<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matthew Tice on Medium]]></title>
        <description><![CDATA[Stories by Matthew Tice on Medium]]></description>
        <link>https://medium.com/@abapcoder?source=rss-f64e17be29a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*znoM-7S3wGGMITHH.</url>
            <title>Stories by Matthew Tice on Medium</title>
            <link>https://medium.com/@abapcoder?source=rss-f64e17be29a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:02:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abapcoder/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[SAP ABAP Overview (An Easy Introduction)]]></title>
            <link>https://medium.com/@abapcoder/sap-abap-overview-an-easy-introduction-cedef9677006?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/cedef9677006</guid>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Sun, 09 Sep 2018 03:21:09 GMT</pubDate>
            <atom:updated>2018-09-09T03:22:42.346Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fxSerU4Lzs2goS0k.png" /></figure><h4>SAP ABAP Explained</h4><h4>Introduction — What is ABAP?</h4><p><strong>ABAP</strong> is a <a href="http://www.cs.cmu.edu/~jcarroll/15-100-s05/supps/basics/history.html">compiled</a> 4th generation programming language (4GL). The term ‘<a href="https://www.techopedia.com/definition/24308/fourth-generation-programming-language-4gl">4th generation language</a>’ means that ABAP is human-readable, easy to use and powerful. The ABAP acronym stands for <em>Advanced Business Application Programming</em>. All ABAP programs and compiled code exist in an SAP system. Contrary to programming languages like Java, you cannot execute an ABAP program outside of SAP. SAP created ABAP for the purposes of enhancing and extending the functionality of an SAP system.</p><figure><img alt="4th Generation Languages: Human-readable, easy to use, efficient and powerful." src="https://cdn-images-1.medium.com/max/617/0*sEtS0iInTBf-YejM" /></figure><p>The ABAP programming language was introduced by SAP in the seventies. At that time it was used to generate primitive reports in an SAP system. In the nineties SAP released an updated version of ABAP. This update advanced the usability and power of the language.</p><p>In 1999 an object-oriented extension of the language called ABAP Objects was released. This update included support for computer science concepts like classes and <a href="https://stackify.com/oop-concept-polymorphism/">polymorphism</a>. Much of the functionality introduced by this update was modeled on aspects of <a href="https://www.techopedia.com/definition/24307/third-generation-programming-language-3gl">3rd generation programming languages</a> like C, C++ and Java.</p><h4>How is ABAP written?</h4><p><strong>ABAP Code is written using tools in the ABAP Workbench</strong> (transaction <strong>SE80</strong>.) The Workbench is a comprehensive suite of programs used for developing ABAP code. The Workbench is only available inside of an SAP system. Developers can access specific tools found in the Workbench through transaction codes. For example, transaction <strong>SE38</strong> is for the creation and maintenance of reports. Transaction <strong>SE24</strong> is for the creation and maintenance of classes and interfaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-xL7AOV6bqY1aKFq.png" /></figure><p>Additionally, third party software vendors such as Eclipse provide front end programs for writing ABAP code. These integrated development environments (IDE) still need a connection to an SAP system to check and compile code. You can learn more about Eclipse and SAP <a href="https://www.sap.com/developer/tutorials/abap-create-project.html">here</a>.</p><h4>What is ABAP used for?</h4><p>SAP customers employ ABAP programmers to extend the functionality of their SAP system to meet specific business needs. The acronym <em>WRICEF</em> explains the types of objects developers create in SAP. WRICEF stands for: <a href="https://wiki.scn.sap.com/wiki/display/ABAP/SAP+Business+Workflow"><strong>W</strong>orkflows</a>, <a href="https://wiki.scn.sap.com/wiki/display/ABAP/Types+of+Reports"><strong>R</strong>eports</a>, <a href="https://wiki.scn.sap.com/wiki/display/ABAP/BAPI"><strong>I</strong>nterfaces</a>, <a href="https://wiki.scn.sap.com/wiki/display/ERPLO/Data+Migration+with+LSMW"><strong>C</strong>onversions</a>, <a href="https://wiki.scn.sap.com/wiki/display/Community/An+Introduction+to+Enhancements+and+Modifications+in+SAP+for+Beginners"><strong>E</strong>nhancements</a> and <a href="https://wiki.scn.sap.com/wiki/display/ABAP/Smart+Forms"><strong>F</strong>orms</a>.</p><p>ABAP developers leverage their skills and experience with SAP to create custom objects in an SAP system. For example, an ABAP consultant might be hired to write custom reports that are not available in an out-of-the-box SAP system. Most companies will use at least some custom ABAP code to change how their SAP system behaves. It’s not uncommon for companies that rely heavily on custom ABAP to have completely transformed their SAP system over time.</p><p>SAP provides many frameworks through which customers can enhance SAP-standard code. These include user exits, business add-ins (BAdIs), business APIs (BAPIs) and enhancement spots. Customers also have the option of modifying SAP-standard code directly (although this is very bad practice). Alternatively, an ABAPer might make a z-copy of SAP-standard code and modify it to meet the company’s requirements.</p><h4>How do ABAP programs work?</h4><p>ABAP is a compiled language. The role of the compiler is two-fold. First, the compiler is a gatekeeper: it submits ABAP programs to a battery of tests to ensure the code is as ‘correct’ and as safe as possible. As an example, it’s the compiler’s job to issue an error if a developer’s code is not syntactically correct. Second, the compiler translates the human-readable ABAP code into optimized byte code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*x34vk71zCVzFRrRM" /></figure><p>Byte code is a low-level type of code that is understood by a computer but isn’t human-readable or easy to work with. In SAP, the byte code generated by the compiler contains functions from the C and C++ programming languages. Behind the scenes the ABAP runtime environment coordinates with the <a href="https://www.absoft.co.uk/blog-article/what-is-the-sap-kernel-and-why-should-i-care">SAP kernel</a> to execute functions written in C and C++. These functions do the actual work described by the ABAP program.</p><p>When a user executes a program in SAP the corresponding byte code is loaded into the <a href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenabap_runtime_envir_glosry.htm">ABAP runtime environment</a> and executed. ABAP programs cannot be executed outside of an ABAP runtime environment. The ABAP runtime environment exists inside of an <a href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenabap_personality_glosry.htm">ABAP Application Server</a>.</p><h4>Where are ABAP programs stored?</h4><p>ABAP code is stored in database tables within an SAP system. Code is stored in two ways:</p><p>1. Human-readable source code that can be displayed or modified using the ABAP workbench tools. A compressed version of this code is stored in table <strong>REPOSRC</strong>. For example, if a developer writes code in transaction SE38 and saves it, that code would be stored in table REPOSRC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*4ENXsQEgwL1cLDF_.png" /><figcaption>ABAP source code is stored in table REPORSC.</figcaption></figure><p>2. Non-human-readable byte code that is generated by the ABAP compiler when a developer activates their code. This byte code is executed by the ABAP runtime environment. ABAP byte code is stored in table <strong>REPOLOAD</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*sjxnNScRfexvFx2L.png" /><figcaption>ABAP byte code is stored in table REPOLOAD.</figcaption></figure><h4>How is ABAP code executed?</h4><p>When an ABAP program is executed by the user, the corresponding byte code is loaded into the <a href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenbytecode_glosry.htm">Program Execution Area (PXA).</a> The ABAP runtime environment then interprets the byte code and calls the appropriate C functions behind the scenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*fZnc3uL8creQw8tS.png" /><figcaption>ABAP byte code is loaded into the PXA and executed.</figcaption></figure><h4>Programming Paradigms — Classifying ABAP Based On Its Features</h4><p><a href="https://medium.com/learn-how-to-program/chapter-3-what-is-object-oriented-programming-d0a6ec0a7615"><strong>Object-Oriented</strong></a><strong> ABAP</strong> is referred to as ABAP Objects and is available as of release 4.6. SAP has released <a href="https://www.sap-press.com/official-abap-programming-guidelines_2093/">official guidelines</a> for implementing ABAP Objects the right way. While ABAP Objects shares many similarities to languages like Java and C++, there are several notable differences.</p><p><strong>[X] ABAP Objects does not support </strong><a href="https://www.techopedia.com/definition/24284/destructor"><strong>destructors</strong></a><strong>.</strong> SAP can implement a special kind of destructor that calls a function module from the C programming language. This is for internal use only and not available to SAP customers. For everything else, SAP employs a <a href="https://thesocietea.org/2017/01/programming-concepts-garbage-collection/">garbage collector</a> behind the scenes to handle memory management.</p><p><strong>[X] ABAP Objects does not allow method overloading.</strong> This means that you cannot have two methods in the same class with the same name and visibility, but different <a href="https://www.quora.com/Object-Oriented-Programming-What-is-a-method-signature">method signatures</a>.</p><p><strong>[X] ABAP Objects does not allow multi-class inheritance.</strong> An ABAP class can <a href="https://stackify.com/oop-concept-inheritance/">inherit functionality</a> from exactly one superclass. A superclass can have more than one subclass. A superclass can be the subclass of another superclass, and so-on.</p><h4>Describing How ABAP Gets Things Done</h4><p><strong>ABAP is a structured language.</strong> ABAP code relies on control-flow statements (IF/THEN/ELSE) and repetition statements (LOOP, WHILE, DO). The intention of structured languages is to make code more readable while also being easier to develop and maintain. This in turn reduces the costs associated with creating and maintaining custom code over time.</p><p><strong>ABAP is an imperative language.</strong> The overarching goal of an ABAP program is to tell the SAP system what to do, not necessarily how to do it. The statements in an ABAP program are used to change a program’s state. How the system executes the underlying byte code generated by the compiler is the domain of the ABAP runtime environment and the SAP kernel.</p><h4>Typing Discipline — Describing How The Compiler Enforces Rules</h4><p>Typing disciplines describe how the compiler treats data declared and used in a programming language. Strongly typed languages have strict rules that are enforced when the code is being compiled. Weakly typed languages have looser rules and may produce unpredictable results.</p><p><strong>ABAP is a strongly typed</strong> language. This means that there are strict rules governing what is allowed in ABAP and those rules are enforced by the compiler, not the ABAP runtime environment. This puts the onus of writing correct code on the developer.</p><p><strong>The ABAP compiler uses static type checking</strong> on program source code prior to generating byte code. Static typing requires that variables be clearly defined at compile time. The benefit of static typing is that errors associated with program variables are caught by the compiler before the program can be executed.</p><h4>Conclusion</h4><p>ABAP is a powerful language that has evolved over time. Today it is robust and capable of supporting modern and advanced programming concepts. ABAP developers play a critical role in an SAP implementation. They use their skills to bridge the gap between SAP and a company’s business requirements.</p><h4>Further Reading</h4><ul><li>Code Better — <a href="http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/">4 major principles of Object-Oriented Programming</a></li><li>Programiz — <a href="https://www.programiz.com/article/difference-compiler-interpreter">The difference between an interpreter and a compiler</a></li><li>SCN — <a href="https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Development">The ABAP Developer Wiki</a></li><li>Khan Academy — <a href="https://www.khanacademy.org/computing/computer-science">Computer Science</a></li></ul><p><em>Originally published at </em><a href="https://abapcoder.com/abap-programming-language/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cedef9677006" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips and Tricks for the SAP Transaction Field]]></title>
            <link>https://medium.com/@abapcoder/tips-and-tricks-for-the-sap-transaction-field-901dc1536924?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/901dc1536924</guid>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[sap-abap-training]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Thu, 12 Jul 2018 01:50:37 GMT</pubDate>
            <atom:updated>2018-07-12T01:51:45.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="The SAP Transaction field" src="https://cdn-images-1.medium.com/max/1024/0*ornTFAo-QRaxU73E.png" /><figcaption>Above: The SAP Transaction field is circled in yellow.</figcaption></figure><h3>Introduction</h3><p>In this article we’ll discuss the SAP transaction field and how you can leverage more functionality out of it. After reading this article, you’ll be an expert in the ways you can use the transaction field.</p><h3>Overview</h3><p>Here is an overview of the possible commands you can use in the transaction field:</p><ul><li><strong>/o</strong> — Launches a popup with the list of your current sessions:</li></ul><figure><img alt="slash-o results" src="https://cdn-images-1.medium.com/max/1024/0*ZP7QQ_xr_sQh4vRJ.png" /><figcaption>The number seen on the left in the above screenshot is the session number.</figcaption></figure><ul><li><strong>/o<em>&lt;tcode&gt;</em></strong> — Starts the specified transaction (denoted by <em>&lt;tcode&gt;</em>) in a new session. Example usage: /oSE16N.</li><li><strong>/n</strong> — Ends the current transaction and returns the user to the SAP main menu. This does not prompt before ending the current transaction.</li><li><strong>/n&lt;tcode&gt;</strong> — Ends the current transaction and begins the specified transaction (denoted by <em>&lt;tcode&gt;</em>) in its place.</li><li><strong>/i</strong> — Closes the current session. /i&lt;#&gt; closes the specified session (denoted by &lt;#&gt;). SAP does not prompt the user before closing the session.</li><li><strong>/nend</strong> — Closes all sessions, prompting the user before actually closing the sessions.</li><li><strong>/nex</strong> — Closes all sessions without prompting you</li><li><strong>/h</strong> — Triggers the launch of a debugger session after your next interaction with the screen.</li></ul><figure><img alt="slash-h results" src="https://cdn-images-1.medium.com/max/1024/0*NkxaxLiOpjCvmeQi.png" /></figure><ul><li><strong>/ha</strong> — Triggers the launch of a debugger session with System Debugging switched on.</li></ul><figure><img alt="System program example" src="https://cdn-images-1.medium.com/max/1024/0*G6QdY4t3MW4AIOhb.png" /></figure><ul><li><strong>/hs</strong> — Triggers the launch of the debugger with special configuration to skip screen debugging.</li></ul><figure><img alt="slash-h-s debugger results" src="https://cdn-images-1.medium.com/max/1024/0*jZITuyLgY_p9irfn.png" /></figure><p>There is more to the transaction field than the possible entries detailed above. You can also drag-and-drop SAP GUI shortcuts into the transaction field to launch transactions or turn on the debugger.</p><p>First, create a new SAP GUI shortcut anywhere on your desktop (or desired folder):</p><figure><img alt="Create a new SAP shortcut" src="https://cdn-images-1.medium.com/max/1024/0*Jsv3uRWEGP-dzyLM.png" /></figure><p>Next, right click on the shortcut and click <em>Edit</em>. From here you can modify the shortcut and set it up for drag-and-drop debugging.</p><figure><img alt="GUI shortcut title and type" src="https://cdn-images-1.medium.com/max/1024/0*GmXqt3EwPDIFYy1c.png" /></figure><p>You can set the title to whatever you prefer. Under the <em>Type</em> drop down, select <em>System Command</em>.</p><p>The <em>Report:</em> field label will switch to <em>Command:</em>. Type in any of the commands listed above (I’ve used /H). Note that you’ll need to specify a <em>Client </em>before you can save your changes.</p><figure><img alt="GUI shortcut full setup" src="https://cdn-images-1.medium.com/max/300/0*cXuC1JQcktfjjkzd.png" /></figure><p>Hit <em>OK</em> to save your changes. Now you can use this GUI shortcut to enter the debugger whenever you like. This is useful even if you don’t have access to the SAP Transaction field. You can use these shortcuts to debug SAP popup windows as well:</p><figure><img alt="drag and drop debug" src="https://cdn-images-1.medium.com/max/1024/0*nIwEx-ehAbCM-4BA.gif" /></figure><h3>Conclusion</h3><p>In this article we’ve covered the many ways you can use both the SAP transaction field and SAP GUI shortcuts. In particular, GUI shortcuts are a great way to enter the debugger from a GUI popup window. Thank you for reading this article — I hope you’ve enjoyed it and taken something new for your repertoire.</p><p>Have a great week!</p><p><em>Originally published at </em><a href="https://abapcoder.com/the_sap_transaction_field/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=901dc1536924" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ABAP Debugger Tips and Tricks. (Part II of ∞)]]></title>
            <link>https://medium.com/@abapcoder/abap-debugger-tips-and-tricks-part-ii-of-e5fd84d42f96?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5fd84d42f96</guid>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Wed, 27 Jun 2018 23:49:36 GMT</pubDate>
            <atom:updated>2018-06-27T23:50:53.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZgPRkudbkloGOo77.jpg" /></figure><h3>ABAP Debugging — Short Dump Post Mortem.</h3><p>In this article we’ll cover the ABAP layer post mortem captured by SAP when a program crashes. This ‘tip’ warrants your attention and definitely deserves a spot in your toolbox. Short dump debugging is useful to BAs and ABAPers looking to understand more about why a program terminated. If I were to introduce this tip as an interview question (as we did in <a href="https://abapcoder.com/abap-debugger-tips-and-tricks_part_one/">part I</a>), it might look like this:</p><p><em>You’ve just triggered a short dump. How can you launch the debugger directly from the runtime error long text screen?</em></p><p>If you’ve been around SAP for even a few years, no doubt you’ve seen some variation of the above question. Read on and I’ll get into more depth short dump post mortems. Hopefully I’ll introduce a few additional details that you didn’t already know.</p><h4>You’ve just triggered a short dump. How can you launch the debugger directly from the runtime error long text screen?</h4><p>If you’ve been around SAP for a while then perhaps you’ve noticed the handy button SAP makes available when you generate a short dump.</p><figure><img alt="ST22 runtime error screen" src="https://cdn-images-1.medium.com/max/1024/0*aDb7wsxZMszLKYs8.png" /><figcaption>SAP’s runtime analyses offers a post mortem on what caused the crash.</figcaption></figure><p>Short dumps are serious program crashes that need to be diagnosed and their root cause addressed. Immediately after a short dump is triggered in dialog mode, SAP captures additional data from the ABAP layer and makes a debugger post mortem snapshot available to the user.</p><p>This snapshot is only available while the user who generated the short dump keeps the runtime error diagnosis screen alive. Once the user navigates away from this screen, the ABAP layer snapshot is lost. Similarly, if a short dump is generated in the background or in an update task, SAP does not retain this information. An exception to this is the <a href="https://abapcoder.com/abap-debugger-tips-and-tricks_part_one/">post mortem snapshot SAP creatres for crashed background jobs</a>.</p><p>Here is an example of what the post mortem debugger session looks like:</p><figure><img alt="Debugger Post Mortem" src="https://cdn-images-1.medium.com/max/1024/0*NqLkSTOo7MzQbg5N.png" /></figure><p>When the debugger session is launched, you will immediately be brought to the section of code that caused the crash. There is no need to set breakpoints in another session. You’ll be able to quickly tell you’re in a post mortem snapshot — none of the standard debugger navigation tools are present.</p><p>Similarly, the F5 / F6 / F7 and F8 commands are disabled. You cannot use <em>right click -&gt; goto statement</em> to navigate the source code. You can, however, use this session to query variable values at runtime and navigate the stack as you would in a normal debugger session.</p><p>This can be very useful, especially since SAP does not always capture all of the relevant variables that lead up to a short dump. If you’ve ever been frustrated by trying to navigate the logs of a runtime error in ST22 only to find that one of the variables you need to diagnose the problem was not captured, you’ll know what I mean.</p><p>Note also that you can’t ‘hurt’ anything in the debugger post mortem. No action you take can impact the database tables including master data or transactional data.</p><h4>Conclusion — Keep the debugger in mind if you trigger a short dump.</h4><p>If you’ve triggered a short dump remember that SAP has taken the additional step of collecting data from the ABAP layer for your review. The post mortem session is disconnected from the database layer and you cannot trigger changes to master or transactional data. You won’t be able to interact with the post mortem like you would a standard debugger session. You can use the opportunity to understand a bit more about why the crash happened and how it can be resolved.</p><p><em>[Featured Image by </em><a href="https://www.pexels.com/@matthiaszomer"><em>Matthias Zomer</em></a><em>.]</em></p><p><em>Originally published at </em><a href="https://abapcoder.com/short_dump_debugging/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5fd84d42f96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ABAP Debugger Tips and Tricks. (Part I of II)]]></title>
            <link>https://medium.com/@abapcoder/abap-debugger-tips-and-tricks-part-i-of-ii-3e9b33a8d30b?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e9b33a8d30b</guid>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Thu, 21 Jun 2018 01:30:28 GMT</pubDate>
            <atom:updated>2018-06-21T01:31:39.752Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>ABAP Debugger Tips and Tricks!</h3><p>What follows are a handful of tips and tricks that make life with the <em>New</em> SAP Debugger better. ABAP candidates are typically asked several questions about the ABAP Debugger and how one navigates around effectively in it as part of the interview process. Consider the following interview questions:</p><ol><li>You’re working on diagnosing a complex issue and would like to share your progress with a colleague. How do you save your work and share it with others?</li><li>While performing technical unit testing on new custom code, you have discovered a scenario where a normally short-running program in dialog mode is now running very long. How do you diagnose the issue before your dialog session times out?</li><li>While performing technical unit testing on new custom code, you submitted a normally short-running program as a background job. For some reason the program is running for a very long time. How do you diagnose the issue?</li><li>You’ve been tasked with diagnosing a background job failure. How can you use the debugger to determine the failure’s root cause?</li></ol><p>I’ll grant that there are multiple ways a developer (or skillful BA) can diagnose the issues described above <em>without</em> using the debugger, but for the sake of introducing each of these tips, let’s answer the questions in the spirit they were asked.</p><h4>1. How do you save your current debugger session’s break points, variable lists and layout?</h4><p><strong>Answer:</strong> You can save your debugger layout, including break points, watchpoints, layer-aware configuration, the layout of your debugger subscreens and the variables you’ve entered into the variable fast display.</p><p>To save your debugger layout, follow menu path <em>Debugger -&gt; Debugger Session -&gt; Sav</em>e.</p><p>Note — if you select <em>Save Layout</em> in the dropdown above, only your debugger tool arrangements are saved, and they are saved as your default debugger layout.</p><figure><img alt="Debugger variant save dialogDebugger session save dropdown" src="https://cdn-images-1.medium.com/max/889/0*qveqP9sFV5pAe5dW.png" /></figure><p>In the above screenshot, you’ll see the text <em>(Not for START UP Session). </em>The <em>START UP</em> session is the default debugger session that is used when launching the ABAP debugger if no user layout is found. When creating a new START UP session, you cannot specify break points or watch points.</p><p>After saving your debugger session, other ABAPers can load the same session by following menu path <em>Debugger -&gt; Debugger Session -&gt; Load.</em></p><p>The debugger load dialog is similar to the debugger save. You can specify whether you want to load the debugger session’s layout, breakpoints, etc.</p><figure><img alt="Debugger variant load dialog" src="https://cdn-images-1.medium.com/max/889/0*1YIl64zvw7k2aQMK.png" /></figure><h4>2. How do you debug a long-running dialog process?</h4><p><strong>Answer:</strong> If you’ve identified the section of code that is causing long runtimes (an ST12 trace can help with this), you can set session breakpoints on another screen and force them to be active immediately in all sessions by following menu path <em>Utilities -&gt; Settings</em>. In the dialog window that pops up, click on the <em>Debugging</em> tab.</p><figure><img alt="session breakpoint active immediately" src="https://cdn-images-1.medium.com/max/1024/0*w-7kfs3S8N1uVKfw.png" /></figure><p>Save your changes and shortly thereafter your runaway dialog process should launch a debugger session.</p><h4>3. How do you debug a background job?</h4><p><strong>Answer: </strong>There are two acceptable ways to approach this problem — if the job is visible in SM37, you can select the job, then follow menu path <em>Extras -&gt; Debug Job</em>:</p><figure><img alt="SM37 job debug" src="https://cdn-images-1.medium.com/max/1024/0*-YvAYQDfwgEOGYvu.png" /></figure><p>Alternatively, if you know a background <em>process</em> is running long but cannot see an entry in SM37, try using SM50 to find and debug the long-running process. SM50 is a BASIS transaction that may not be available to ABAP developers. It allows you to audit dialog and background processes and intervene as needed (debug, cancel, etc.). In SM50, select the process you want to debug and follow menu path <em>Administration -&gt; Program -&gt; Debugging</em>:</p><figure><img alt="SM50 program debug" src="https://cdn-images-1.medium.com/max/1024/0*jq7v3JUXmLIRQGEm.png" /></figure><h4>4. How do you debug a failed/crashed (SM37) background job?</h4><p><strong>Answer: </strong>Even if a background job has been canceled (as I did in the example above), you can still debug it via transactions SM37 or SMX (the latter shows your own batch jobs). You should still put a break point in the section of code you want to debug, because debugging a cancelled job will drop you into the debugger at a point in the call stack that is not necessarily relevant to the custom code that was running when the job canceled.</p><p>As before, in SM37 you select the canceled job and then follow menu path <em>Extras -&gt; Debug Job</em>:</p><figure><img alt="SM37 debug cancelled job" src="https://cdn-images-1.medium.com/max/1024/0*dMCDfvfnffn5VuxV.png" /></figure><p>From there, use F8 to continue processing until your session break point triggers and you can begin diagnosing the problem.</p><h4>Conclusion — There are several avenues a skilled developer can use to debug problematic code.</h4><p>Using the tricks described above, it’s possible to use the debugger to diagnose problems in ABAP code even after the code has finished executing. I have another article planned that covers short dump debugging as well as drag-and-drop debugging. I hope that you’ve enjoyed this article and learned something new.</p><p>Have a great week!</p><p><em>Originally published at </em><a href="https://abapcoder.com/abap-debugger-tips-and-tricks_part_one/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e9b33a8d30b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing CL_DEMO_OUTPUT]]></title>
            <link>https://medium.com/@abapcoder/introducing-cl-demo-output-34943ddda21a?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/34943ddda21a</guid>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Tue, 10 Apr 2018 01:42:31 GMT</pubDate>
            <atom:updated>2018-04-11T23:14:49.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1zV4ncJkFO-KVbrS.png" /></figure><p>Since the release of AS ABAP version 7.30 (2012), SAP has provided a class that makes writing complex output to the front end as easy as a method call. That class, <strong>CL_DEMO_OUTPUT</strong>, was created as a demonstration of how modern ABAP could address the lack of a universal <em>println</em> (Java) or <em>printf</em> © statement. Outside of the debugger, ABAP developers have historically misused classical lists when troubleshooting code to display simple output on the screen. This output is generated using WRITE statements:</p><figure><img alt="CL_DEMO_OUTPUT classical list" src="https://cdn-images-1.medium.com/max/1024/0*pWkff87d6ZhI83LP.png" /></figure><h4>Stop Using Classical Lists</h4><p>Using the WRITE statements to review code progression is not good practice to begin with. In a dialog session, you may never see the output from WRITE statements unless you use the LEAVE LIST-PROCESSING statement.</p><p>There is also the prospect of producing spool output every time your code is executed in the background. Keep in mind that writing spool output regardless of whether anything went wrong and regardless of whether anyone is even reviewing the output can result in disastrous consequences for spool performance!</p><p>Program flow troubleshooting is the domain of the debugger, <a href="https://abapcoder.com/checkpoint-groups/">CheckPoint Groups</a> and ABAP Unit Test. Demonstrating output in prototypes is what CL_DEMO_OUTPUT was made to do.</p><h4>What CL_DEMO_OUTPUT Is</h4><p>ABAPers can use CL_DEMO_OUTPUT to push content to the screen for prototyping purposes. There are two formats supplied for this output: text and HTML. Report DEMO_USAGE_OUTPUT_STATIC contains an example of both outputs. This report includes examples of how will behave if you provide the class with data types that are not supported.</p><figure><img alt="CL_DEMO_OUTPUT HTML output" src="https://cdn-images-1.medium.com/max/1024/0*AePUV5SpUQvMNcPA.png" /></figure><p>The above example requires only two lines of code:</p><p><em>SELECT *</em><br> <em>FROM spfli</em><br> <em>INTO TABLE lt_spfli</em><br> <em>UP TO 10 ROWS.</em></p><p><em>cl_demo_output=&gt;begin_section( ‘SPFLI Example’ ).</em><br> <em>cl_demo_output=&gt;display_data( lt_spfli ).</em></p><p>The class can handle parsing and displaying structures as well:</p><figure><img alt="CL_DEMO_OUTPUT HTML Structure output" src="https://cdn-images-1.medium.com/max/300/0*AS33LNuO4IAbsseE.png" /><figcaption>From report DEMO_USAGE_OUTPUT_STATIC</figcaption></figure><p>If you have data formatted as an XML or JSON, the demo class can display that for you easily:</p><figure><img alt="CL_DEMO_OUTPUT HTML XML example" src="https://cdn-images-1.medium.com/max/900/0*XacD5hG4a2Wcm_5l.png" /></figure><p>Note that the class cannot parse a data object and turn it into XML for you. That is the domain of the CALL TRANSFORMATION statement. I’ll cover this statement in more depth in a future article.</p><p>If you wanted to take the time, you could manually set up the XML output by using the various WRITE methods defined in the CL_DEMO_OUTPUT_STREAM class. You’ll find it’s much easier to us CALL TRANSFORMATION to generate XML and JSON output however.</p><h4>What CL_DEMO_OUTPUT Is Not</h4><p>SAP has released CL_DEMO_OUTPUT and its underlying classes as an example of what’s possible in ABAP. The class is <strong>not</strong> intended for use in production programs. And while you could argue that it’s alright to use this class for troubleshooting purposes, doing so would mean modifying ABAP code to insert and remove the data display statements. As mentioned in the introduction, troubleshooting problems in ABAP code is the domain of CheckPoint Groups. You should not be using WRITE statements or CL_DEMO_OUTPUT for this purpose.</p><p>CL_DEMO_OUTPUT cannot parse complex data objects, such as class instances, for output. You must convert the data to XML or JSON (depending on your needs) first. Once you have the parsed data in hand, you can use CL_DEMO_OUTPUT or CL_DEMO_OUTPUT_STREAM to push the contents to the screen.</p><h4>Under The Hood</h4><p>Class CL_DEMO_OUTPUT was born out of a desire to demonstrate how ABAPers could replace standard WRITE statements in their code with a more robust, user friendly framework. The process of converting data into a device agnostic format such as XML or HTML is called serialization. At the most basic level, CL_DEMO_OUTPUT uses serialization to turn data into XML output.</p><p>This is done via class CL_DEMO_OUTPUT_STREAM, which is ultimately what handles converting the information you give to method of CL_DEMO_OUTPUT into a serialized format. If you look at the class attributes in CL_DEMO_OUTPUT, you’ll see that the STATIC_STREAM_HANDLE and STREAM_HANDLE attributes are both TYPE REF TO CL_DEMO_OUTPUT_STREAM:</p><figure><img alt="CL_DEMO_OUTPUT class attributes" src="https://cdn-images-1.medium.com/max/1024/0*sjW3ARE_G7zmv7k9.png" /></figure><h4>Conclusion</h4><p>If you’re prototyping and want a quick and easy way to validate your inputs and outputs that doesn’t involve WRITE statements or plugging in additional code for ALV grids, then CL_DEMO_OUTPUT is your best option! SAP has also provided two example reports that demonstrate the functionality of the class:</p><figure><img alt="CL_DEMO_OUTPUT example reports" src="https://cdn-images-1.medium.com/max/711/0*RTxM87EgmELL3OLd.png" /></figure><p>I’ll be using this class when demonstrating output in future prototypes. It’s a tool that every ABAP developer should be aware of. Keep in mind though that CL_DEMO_OUTPUT is not intended for use in production programs. It is also not the best resource when trying to diagnose problems in code.</p><p>I hope you’ve enjoyed this article. If you’d like to read even more about CL_DEMO_OUTPUT, SAP’s Horst Keller has a two-part blog series written in 2016. It describes both the output of the class and its intended uses:</p><ul><li><a href="https://blogs.sap.com/2016/05/10/cldemooutput-part-1-of-2-usage/">CL_DEMO_OUTPUT part one: Usage</a></li><li><a href="https://blogs.sap.com/2016/05/10/cldemooutput-part-2-of-2-a-look-behind/">CL_DEMO_OUTPUT part two: A Look Behind</a></li></ul><p><em>Originally published at </em><a href="https://abapcoder.com/cl_demo_output/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34943ddda21a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ABAP Debugger (Part II) — (Some Of The) Debugger Tools]]></title>
            <link>https://medium.com/@abapcoder/the-abap-debugger-part-ii-some-of-the-debugger-tools-337833de29e8?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/337833de29e8</guid>
            <category><![CDATA[missing-manual]]></category>
            <category><![CDATA[abap-debugger]]></category>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Tue, 03 Apr 2018 17:35:34 GMT</pubDate>
            <atom:updated>2018-04-04T17:32:17.651Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R5fED6_KQ_iBr_4e.png" /></figure><h3>Let’s build our own ABAP debugger window with Debugger Tools.</h3><p>In the ABAP Debugger, everything you see across all of the tabs from <em>Desktop 1</em> to <em>Script</em> is built from a an ABAP Debugger Tool. You can have up to four of these tools on the screen at once, in any position on the screen.</p><p>In this article I’ll review the Standard Tools and Data Objects tools. This will include a short overview and example for each. We’ll build a custom debugger screen on <em>Desktop 1 </em>and save it for future use.</p><p>This is part two in a multi-part series on the SAP ABAP debugger. If you haven’t read the first part, here it is: <a href="http://abapcoder.com/abap-debugger-part-i/">The ABAP Debugger (Part I) — Overview</a>.</p><h4>Desktop 1–3 are yours to rearrange.</h4><p>While it’s true that you can rearrange the layout of any of the tabs in the debugger, SAP will prevent you from saving changes to all but the <em>Desktop</em> tabs. In the following example I’ve rearranged the layout of the <em>Standard</em> tab. After saving my changes I receive a warning that only user-specific desktop layouts are saved:</p><figure><img alt="Debugger Tools" src="https://cdn-images-1.medium.com/max/300/0*bOZo3N9RwbhoNz4S.png" /><figcaption>Circled at the top: The Save Layout icon.<br>Bottom: SAP warns that my changes to the layout are not saved.</figcaption></figure><p>However, if you rearrange the layout of the <em>Desktop 1</em> tab, SAP will happily save your changes and attach the layout to your user name for future use!</p><blockquote>When you save a debugger layout, SAP will remember your custom layouts on all three desktop tabs and they will be available to you every time you launch the ABAP Debugger.</blockquote><h4>Meet the Debugger Tool configuration ribbon.</h4><p>On the right hand side of each Debugger Tool is a ribbon of configuration options:</p><figure><img alt="ABAP Debugger" src="https://cdn-images-1.medium.com/max/244/0*w_DQSnU-p17Dsypb.png" /></figure><p>Let’s explore what each of these icons does. Some of this will be self-explanatory, but other parts demand a bit more discussion.</p><h4>Close Tool</h4><p>The <em>Close Tool</em> icon will close the corresponding tool, removing it from your debugger window. When you do this, the other remaining tools will fill the newly available space automatically.</p><blockquote>SAP forces you to keep at least one debugger tool on each tab. If you’re down to your last debugger tool, the <em>Close Tool</em> icon will not appear.</blockquote><h4>New Tool</h4><p>The <em>New Tool</em> icon launches a popup that allows you to select from a menu of Debugger Tools available in the debugger. Once you’ve selected a new tool, it SAP will reduce the footprint of other tools in the debugger window to make room for the new tool.</p><blockquote>You can have four tools at most on the debugger window at any time. If you have four tools already open, the <em>New Tool</em> icon will not appear.</blockquote><h4>Replace Tool</h4><p>The <em>Replace Tool</em> icon will replace the existing tool with a new tool from the Debugger Tools menu. The tool you select will occupy the same space as the current tool being replaced in the debugger window.</p><h4>Full Screen</h4><p>The <em>Full Screen</em> icon will force the corresponding tool to occupy the entire debugger window. This action will automatically close any other tools you have open in that window.</p><h4>Maximize Horizontally &amp; Maximize Vertically</h4><p>The <em>Maximize Horizontally &amp; Vertically</em> icons will extend the corresponding tool to occupy additional space in the debugger window. This action will automatically close any other tools that you have open in the direction you’re extending.</p><h4>Swap…</h4><p>The <em>Swap…</em> Icon allows you to move debugger tools around in the debugger window. Because you cannot drag and drop debugger tools, this is the only way to move a debugger tool from one quadrant to another in the debugger window.</p><h4>Services of the Tool</h4><p>The <em>Services of the Tool</em> icon launches a popup with additional functionality available in each tool. The functions available differ based on the tool you’re using, but some examples are:</p><ul><li>Better filtering of variable lists in the Variable Fast View Tool.</li><li>Save Data as an SE37 variant in the Variable Fast View Tool.</li><li>Debug ABAP macros.</li></ul><p>Note that in some tools, no additional functions are defined.In these cases, the <em>Services of the Tool</em> icon will not appear.</p><h4>Let’s get to know some of the Debugger Tools.</h4><p>As of A/S 751 there are a total of 23 tools available in the ABAP Debugger, as seen below:</p><figure><img alt="ABAP Debugger" src="https://cdn-images-1.medium.com/max/286/0*589uEmQT7-qQkJoI.png" /></figure><p>Some of these tools are very self-explanatory and won’t require much of an introduction. Others, such as the <em>Script Wrapper</em>, will receive more attention. Let’s go over each tool, from the top of the list to the bottom, and briefly describe each one.</p><h4>Source Code</h4><figure><img alt="ABAP Debugger Source Code tool" src="https://cdn-images-1.medium.com/max/1000/0*kbwYPuuQ8_Zxstwn.png" /></figure><p><strong>What it does:</strong> Displays an older, less intuitive version of the editor.</p><p><strong>Services of the tool:</strong> Automatic Source Recognition (for Java and ABAP). Review ABAP byte code and debug macros.</p><h4>Call Stack</h4><figure><img alt="ABAP Debugger Call Stack Tool" src="https://cdn-images-1.medium.com/max/1024/0*D6K-RTewSsghHy7m.png" /></figure><p><strong>What it does:</strong> Shows the current call stack, with the current event at the top of the list. I introduced the call stack in <a href="https://abapcoder.com/abap-debugger-part-i/">part one of the debugger series</a>.</p><p><strong>Services of the tool</strong>: Change configuration to show only screens in the call stack or only ABAP events in the call stack. By default both screens and ABAP events are shown.</p><h4>Variable Fast Display</h4><figure><img alt="Debugger Tools - Variable Fast Display Tool" src="https://cdn-images-1.medium.com/max/1000/0*GkMLk697QZvI1J9A.png" /></figure><p><strong>What it does: </strong>A lot! You have two <em>Variables </em>tabs for definition of variables, tables and objects you’re interested in exploring further. You can save these lists by clicking on the disk icon seen in the screenshot above. The <em>Locals</em> tab shows all variables defined in the current event’s scope. The <em>Globals</em> tab shows all variables that are visible and available in the current event across the ABAP call stack.</p><blockquote>If you change the debugger step size to <em>Statement</em>, the <em>Auto</em> tab will display the return variables of individual statements or method calls chained together.</blockquote><blockquote>I introduced the step size concept in <a href="https://abapcoder.com/abap-debugger-part-i/">part one of the debugger series</a>.</blockquote><p>The <em>Memory Analyses </em>tab displays memory allocation statistics for data variables, including allocated space and used space.</p><p><strong>Services of the tool:</strong> One of the most powerful features available in this debugger tool is the <em>Save Parameters as Test Data (SE37)</em> function. You can use this to create variants for function calls launched from transaction SE37! This is especially handy for function modules with complex parameters. The <em>Variable Fast Display</em> tool also offers services for better sorting, filtering and searching in your variables lists. This can be really useful, especially if you’re looking for something specific on the <em>Globals</em> tab.</p><h4>Breakpoints</h4><figure><img alt="ABAP Tools Breakpoints Tool" src="https://cdn-images-1.medium.com/max/1024/0*SRp0IGw3e7o9A0BM.png" /></figure><p><strong>What it does:</strong> There is a tremendous amount of functionality available in the Breakpoints tool. Introducing breakpoints would take up an entire post. <a href="https://abapcoder.com/abap-breakpoints/">Luckily it’s available to you now</a>. :) Using this tool you can set and maintain breakpoints and watchpoints. You can also activate or deactivate checkpoint groups (which I’ve covered <a href="https://abapcoder.com/checkpoint-groups/">here</a>).</p><p><strong>Services of the tool:</strong> The Breakpoints tool does not implement any special services so you won’t see the icon in the tool ribbon. Luckily the tool itself is packed full of powerful features.</p><h4>Source Code (Edit Control)</h4><figure><img alt="ABAP Tools Source Code Edit Control Tool" src="https://cdn-images-1.medium.com/max/1024/0*kbSYy7cf1UrxYaIZ.png" /></figure><p><strong>What it does:</strong> The Source Code (Edit Control) tool is a more user friendly source code view. It features the same functionality as the Source Code tool but is easier to use.</p><p><strong>Services of the tool:</strong> Automatic Source Recognition (for Java and ABAP). Review ABAP byte code and debug macros.</p><h4>Object</h4><figure><img alt="Debugger Tools Object Tool" src="https://cdn-images-1.medium.com/max/1024/0*Bpwocm075YZysYoW.png" /></figure><p><strong>What it does:</strong> The Object tool allows you to explore the contents of data variables declared using TYPE REF TO. This typically involves browsing the contents of a class instance.</p><p><strong>Services of the tool:</strong> Download class instance as an XML file. Unfortunately uploading a class instance from XML through the tool is not supported.</p><h4>Table</h4><figure><img alt="Debugger Tools Table Tool" src="https://cdn-images-1.medium.com/max/1000/0*6FyHNVWcnUYrhBEL.png" /></figure><p><strong>What it does:</strong> The Table tool allows you to explore and edit the contents of a table at runtime. The table edit functionality will not be available if the table is marked as display only. The tool also has a handy ALV display feature that allows you to browse, sort and filter the table contents in an ALV grid.</p><p><strong>Services of the tool:</strong> Display table contents in an ALV. Download the table contents to file. Upload table contents from file. Create/Change/Delete rows.</p><h4>Structure</h4><figure><img alt="Debugger Tools - Structure Tool" src="https://cdn-images-1.medium.com/max/1024/0*_a3tsUdw52blycSE.png" /></figure><p><strong>What it does:</strong> The <em>Structure</em> tool displays the contents of a structure in ABAP memory. If the structure can be modified, you may modify its contents in this tool.</p><p><strong>Services of the tool:</strong> Download structure contents as XML (but no upload capability).</p><h4>Single Field</h4><figure><img alt="Debugger Tools - Field Tool" src="https://cdn-images-1.medium.com/max/1000/0*8QYVpE_S8ISUDiFe.png" /></figure><p><strong>What it does: </strong>The <em>Single Field</em> tool displays the contents and absolute type. If the field is not marked as Read-Only, you can edit the field contents.</p><p><strong>Services of the tool: </strong>Download field as XML (but no upload capability).</p><h4>Data Explorer</h4><figure><img alt="Debugger Tools - Data Explorer Tool" src="https://cdn-images-1.medium.com/max/300/0*cgGH8eSwoY7RExz0.png" /></figure><p><strong>What it does:</strong> Allows you to explore and interact with many different kinds of data types, from class instances to tables. This is a very versatile tool if you’re working with different kinds of objects in the debugger.</p><p><strong>Services of the tool:</strong> This tool does not offer any services.</p><h4>Saving a Custom Layout</h4><p>Let’s save a custom layout on one of the debugger’s <em>Desktop</em> screens. It’s very easy to swap out the tools, rearrange them and save your layout.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0cda3f0edac66ee67d98e3efc0e23fb/href">https://medium.com/media/f0cda3f0edac66ee67d98e3efc0e23fb/href</a></iframe><h4>Conclusion</h4><p>As you can see, there are a lot of tools available in the debugger! In this article we covered the Standard Tools and Data Objects tools. We reviewed the functionality of the Debugger Tool configuration ribbon and finished with a short video demonstrating how easy it is to set up your own debugger layout using one of the <em>Desktop</em> tabs.</p><p>Hopefully you’ve taken something new away from this article! In the next post I’ll cover the remainder of the debugger tools, which includes memory analyses and <em>special</em> tools that allow you to do things trace ABAP code execution on the fly.</p><p><em>Originally published at </em><a href="https://abapcoder.com/the-abap-debugger-part-ii/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=337833de29e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ABAP Debugger (Part I) — Overview]]></title>
            <link>https://medium.com/@abapcoder/the-abap-debugger-part-i-overview-5d401403f418?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d401403f418</guid>
            <category><![CDATA[abap-debugger]]></category>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[missing-manual]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Thu, 29 Mar 2018 15:00:03 GMT</pubDate>
            <atom:updated>2018-03-29T15:16:16.726Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cdIX413XDShMWg2W.png" /></figure><figure><img alt="Empty Racetrack" src="https://cdn-images-1.medium.com/max/300/0*IZEbQkazZvji_rO6.jpg" /></figure><h3>The ABAP Debugger — let’s get started.</h3><p>This article is part one of a multi-part series on the ABAP debugger. This debugger can be a bit daunting so I’m going to tackle the subject by breaking it down into much smaller parts. This article explains what a user sees when launching the debugger without using a debugger profile. This will include an overview of the debugger header area and <em>Standard</em> tab. I’ll be saving the debugger profile settings as well as the more complex layer-aware debugger functionality for future posts. :)</p><p>Please note that I am using A/S 751 to write these articles. If you’re using an older version of the ABAP stack, what you see may be different.</p><h4>Who is this article/series for?</h4><p>I believe that a thorough understanding of the ABAP debugger is one of the cornerstones of a great ABAP programmer. While it’s not required knowledge for business analysts, the best analysts I’ve ever worked with have known their way around the debugger to at least some extent. So whether you’re a business analyst or a developer, experienced or novice, it’s my hope that you’ll be able to learn something new from each article in this series. If you aren’t familiar with breakpoints and have not read my article on that topic (<a href="http://abapcoder.com/abap-breakpoints/">breakpoints in ABAP code</a>), it’s an excellent precursor to this miniseries.</p><h4>The ABAP Debugger has started — what is all this stuff?</h4><p>If you’re not using a debugger profile, SAP will present you with the <strong><em>Standard </em></strong>tab. This tab is divided into three sections. Above the Standard tab is a header area where you can control program flow, change configuration settings and set break points and watch points. In this example I’ll use the selection screen for transaction WE02 (the IDoc viewer). If you run transaction WE02, type <strong>/h</strong> in the command field and hit <strong>enter</strong>, you’ll probably see something like this:</p><figure><img alt="The ABAP debugger standard tab" src="https://cdn-images-1.medium.com/max/1024/0*KOsoW2X7INMyweTu.png" /><figcaption>The Standard tab of the ABAP debugger.</figcaption></figure><p>I suspect SAP provides this view by default because it contains something of (almost) everything the debugger has to offer. If you’re new to debugging ABAP code then this view definitely warrants some explanation. Here is a high level breakdown of each section:</p><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/300/0*vqMKXZN_2y-eCJXH.png" /></figure><ol><li><strong>The header area</strong> contains a lot of functionality hiding in plain sight. As a result, this section of the screen also warrants the most explanation. We’ll cover this area in more depth below, but at a high level you should understand that this area is responsible for navigation and behavior (established through configuration).</li><li><strong>The Source Code</strong> area is an editor view of the ABAP code being executed. The small yellow arrow in the left margin denotes what ABAP statement is currently being executed. You can set debugger breakpoints by clicking in the left margin as well and turn them into session breakpoints by clicking the disk icon at the top of the debugger header area.</li><li><strong>The Call Stack</strong> shows you the direct calls that lead to the current event being processed. You can drill into most call stack layers by double clicking on any of the lines you see in the call stack. The current event is always at the top of the stack, and the initial event that brought processing to this point is at the bottom. This can be useful because SAP caches the state of each stack layer, including its local variables and the values assigned to global variables.</li><li><strong>The Variable Quick View</strong> allows you to explore data in the debugger. This includes local variables declared within the current even, and variables declared globally. You can also use this area to change the values assigned to variables if you have the right authorizations ahead of time.</li></ol><h4>The debugger Header — Command and Control</h4><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/300/0*gqJEQxN5e7VmgL_c.png" /><figcaption>The debugger header.</figcaption></figure><p>This area of the debugger screen is perhaps the most complex because of how much functionality it offers. Here you can tell at a glance what event (function/method/form) is currently being processed. You can step processing forward, set configuration options that drive behavior and tinker with your breakpoints and watchpoints. Let’s break this section down into smaller components and explore what each one does.</p><h4>The current event — you are here.</h4><p>This section displays the current <strong>event</strong> (highlighted with a star below). Simply put, the current event is the section of code currently being executed by the debugger. The top left two boxes contain information about the parent program and program include associated with the event being processed. The top right box contains the current line number being executed within the current event.</p><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/300/0*_MZ3onlclg7Ptr4O.png" /><figcaption>The current method / form being processed in the ABAP debugger.</figcaption></figure><p>In the screenshot above, the debugger is currently inside of function module CONVERSION_EXIT_EDIPV_OUTPUT. Based on the information in the two boxes in the top left, you can load program SAPLEDIK (this is a function group) in transaction SE38 and drill down to program include LEDIKU02 to find function CONVERSION_EXIT_EDIPV_OUTPUT. Alternatively you can load LEDIKU02 in transaction SE38 and skip the main program entirely, or simply load the function module via transaction SE37.</p><figure><img alt="ABAP debugger header" src="https://cdn-images-1.medium.com/max/22/0*8L8VoCvK5_qZ1X0c.png" /></figure><blockquote>If you’ve scrolled away from the line of code currently being executed, you can use the <em>Position</em> icon to get back.</blockquote><figure><img alt="ABAP Debugger Header" src="https://cdn-images-1.medium.com/max/26/0*Y1jghXklKXFvH7Vh.png" /></figure><blockquote>You can press the <em>Info</em> icon at any time to review the program attributes of the current event.</blockquote><h4>Execution steps — where to next?</h4><p>This area allows you to manually step processing forward.</p><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/285/0*W4OO_fciegvJNYOu.png" /></figure><p>From left to right, the options are:</p><ul><li><strong>Step (F5)</strong> — By default this will process a single line of executable code. If, for example, the current event calls a method, then processing steps into that method and the current event is set to the method being called. <strong>Note</strong> — You can use the <em>Step Size</em> icon to change how the Step function behaves. In AS 751 the step can also be used to process the result of subconditions linked together by AND or OR in a complex statement.</li><li><strong>Execute (F6)</strong> — Executes the current statement. If the current statement is a method call (for example) then all of the executable code inside of the method as well as any events it calls is also executed and processing is stopped at the next line of executable code in the current event.</li><li><strong>Return (F7)</strong> — Executes all code in the current event and stops processing at the next line of executable code in the parent event that called the current event.</li><li><strong>Continue (F8)</strong> — Executes all the way to the end of program logic.It’s important to note that the Execute, Return and Continue actions can be interrupted by breakpoints and watchpoints.</li><li><strong>Step Size</strong> — This option allows you to specify how the Step action behaves. If you’re diagnosing a problem with a complex IF statement that uses AND or OR to chain subconditions together, you can use this to toggle whether Step processes a single subcondition or the entire statement.<br> Switch the step size to subcondition and you see get the following info message:</li></ul><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/300/0*sYJOibWyvRJVNSyy.png" /></figure><ul><li>Now you’ll see that the individual subconditions of complex statements are processed individually when you single-step forward:</li></ul><figure><img alt="The ABAP Debugger" src="https://cdn-images-1.medium.com/max/300/0*SJ1Bsc2MGo9iGcSl.png" /></figure><h4>Create and Maintain Breakpoints</h4><p>Clicking on the stop sign icon will launch a popup that delivers a wide variety of break point creation options!</p><figure><img alt="ABAP Debugger Header" src="https://cdn-images-1.medium.com/max/300/0*e2R-fLyVP6hpLC8G.png" /><figcaption>Create breakpoints on everything from ABAP statements to a specific message in a message class.</figcaption></figure><h4>Set Watchpoints on Specific Data Variables</h4><p>Watchpoints can be very powerful if you’re able to leverage them. They are a remnant of the original SAP debugger and require that the variable you want to ‘watch’ for changes be declared globally in a program or class. You can also use watchpoints on reference variables (such as a class instance), but you cannot, for example, use watchpoints on field symbols declared locally in a class method. Watchpoints do come with an additional perk — you can set them to trigger when specific conditions are met instead of being triggered every time the variable changes!</p><figure><img alt="ABAP Debugger Header" src="https://cdn-images-1.medium.com/max/300/0*4zsKa-X5eDSzAPPl.png" /><figcaption>Create watchpoints with simple conditional checks</figcaption></figure><h4>Save custom layouts in the Desktop 1, 2 and 3 tabs.</h4><figure><img alt="ABAP Debugger Header" src="https://cdn-images-1.medium.com/max/300/0*OsUNP-VuhjdUedJs.png" /><figcaption>Save custom layouts in the Debugger 1, 2 and 3 tabs.</figcaption></figure><p>You may have noticed that you can move the various sections under each tab around. You can also delete sections entirely, change their alignment and insert new sections. If you’ve navigated to the <em>Desktop 1, Desktop 2 </em>or <em>Desktop 3</em> tabs, you can save those changes and they will be remembered the next time you launch a debugger session. Note that any changes you make to the other tabs in the debugger will not be saved; SAP retains those tabs as-is for all users. The three Desktop tabs are yours to modify as you wish.</p><p>The ability to tailor the debugger window to your liking is one of the great perks to knowing your way around the debugger! We’ll do a deep dive into the options available to you in a future article.</p><h4>Change how the debugger behaves with Layer-Aware configuration.</h4><p>You can force the debugger to stop immediately after it enters or exits specific objects with layer-aware debugging. This popup is broken down into two parts.</p><figure><img alt="ABAP Debugger Header" src="https://cdn-images-1.medium.com/max/300/0*q2g8RTPPSrePf9yS.png" /></figure><p>Part 1: Using predefined object sets created in transaction SLAD. In this area you can select from predefined profiles containing object sets that are custom made for specific use cases. Transaction SLAD is used to create scenario-specific sets of objects that allow ABAPers to easily review functionality in the debugger.</p><p>Part 2: Define your own custom layer on the fly. Here you can specify what classes, programs, etc. the debugger should automatically react to when entering or exiting each object. If you know, for example, that you want to debug into class CL_EXITHANDLER but don’t want to bother with setting breakpoints, you can simply specify the class name here and the debugger will automatically stop when any of the class methods are encountered! Note that you can’t save these definitions permanently; you’ll need to use transaction SLAD to create permanent profiles. Regardless, this is a great way to quickly set up the debugger if you know you want to review a specific class or program without wading through SAP-standard code.</p><h4>Conclusion — Practice makes perfect!</h4><p>One of the best things a new developer can do is practice regularly. That includes working in the debugger. While you’ve got a good start after reading this article, everyone can benefit from honing their skills <em>by doing</em>. I hope you’ve enjoyed this article, and were able to take something new away from it! I’ve got a lot more planned in terms of explaining the debugger’s hidden functionality in the near future. Keep an eye out for new articles filed under <em>The ABAP Debugger</em> category.</p><p><em>Originally published at </em><a href="https://abapcoder.com/abap-debugger-part-i/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d401403f418" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering BAdIs without debugging.]]></title>
            <link>https://medium.com/@abapcoder/discovering-badis-without-debugging-ba57fca792ca?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba57fca792ca</guid>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[logging]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Tue, 27 Mar 2018 15:00:57 GMT</pubDate>
            <atom:updated>2018-03-27T15:12:04.702Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*X1XkAc0rDpYL71fe.png" /></figure><h3>Introducing Dynamic LogPoints.</h3><p>In today’s article I’ll introduce transaction <strong>SDLP (SAP Dynamic LogPoints)</strong> and class CL_EXITHANDLER (if you haven’t already been introduced). Using dynamic logpoints, we’ll set up an example that allows us to create log entries every time specific ABAP code in class CL_EXITHANDLER is executed. Dynamic logpoints are a powerful alternative to the LOG-POINT statement because you can set dynamic logpoints without modifying a single line of ABAP code. Furthermore, you can create a dynamic logpoint from an existing session breakpoint.</p><p>If you’re unfamiliar with logpoints, I’ve covered them at length as part of a larger <a href="http://abapcoder.com/checkpoint-groups/">article about checkpoints and checkpoint groups</a> in SAP.</p><h4>Meet CL_EXITHANDLER, if you haven’t already.</h4><p>If you’re new to ABAP, you’ve probably never heard of class CL_EXITHANDLER. It’s one of the best ways to discover Business Add-Ins (also known as BAdIs) that fire behind the scenes in SAP-standard transactions. BAdIs play a critical role in custom code development because they allow ABAPers to enhance and influence to some extent the behavior of SAP-standard code.</p><p>Of particular interest to ABAPers is method GET_INSTANCE, which attempts to create instances for BAdIs that are called during transaction processing. The simplest way to utilize this method is to put a break-point at the start of the <em>CASE</em> statement directly after method <em>GET_CLASS_NAME_BY_INTERFACE </em>has fired.</p><figure><img alt="CL_EXITHANDLER exit class" src="https://cdn-images-1.medium.com/max/300/0*lLTK1eI9YlbxNEkN.png" /><figcaption>Discover BAdI and Exit names with variables CLASS_NAME and EXIT_NAME in the debugger.</figcaption></figure><p>Then, you’d run the transaction you want to find BAdIs for and wait for the breakpoint to launch the debugger as you interact with the transaction dialog session. This can be cumbersome because it requires you to step through transactions you might not know anything about. Depending on how your authorizations are set up, you might even require special permissions to run the target transaction.</p><p>Wouldn’t it be great if there were a way you could set up a log that remotely monitored method GET_INSTANCE in class CL_EXITHANDLER for a specific user and transaction? This would allow an experienced end user or business analyst to walk through the transaction from start to finish with no need for the debugger.</p><p>The answer lies in SAP Dynamic LogPoints!</p><h4>Dynamic LogPoints — no checkpoint group required.</h4><p>We’ve covered <a href="http://abapcoder.com/checkpoint-groups/">checkpoints and checkpoint groups</a> in depth, but they are only useful if the ABAPer can insert checkpoint statements into the code at the appropriate point. In the case of classes like CL_EXITHANDLER, SAP has not provided any LOG-POINT statements that we can leverage to record what’s happening in a user’s session at runtime without the use of the debugger.</p><p>Let’s start by setting a breakpoint in method GET_INSTANCE of class CL_EXITHANDLER as seen in the above screenshot. Once that’s set, run transaction <strong>SDLP</strong>. Click on the <em>Create…</em> icon to get started. I’ve put a star next to it in the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*IGOM1d9k6UP-Fn50.png" /></figure><p>This will launch a popup where you can specify the functionality of your new logpoint.</p><figure><img alt="SDLN create new logpoint" src="https://cdn-images-1.medium.com/max/300/0*cWXOZYFKsYSsDkoW.png" /></figure><blockquote><strong>TIP:</strong> You can create a logpoint from an existing breakpoint, which is sometimes much easier than filling out the <em>Program / Include / Line</em> fields manually.</blockquote><figure><img alt="SDLP use existing breakpoint" src="https://cdn-images-1.medium.com/max/300/0*re_Gc8QOEx_PYfDP.png" /><figcaption>You can extract and delete the existing breakpoint in one step (see yellow arrow above).</figcaption></figure><p>Once you’ve extracted the breakpoint, you’ll see that SAP has filled out the <em>Program</em>, <em>Include</em> and <em>Line</em> fields appropriately. Now it’s time to fill out the <em>Key Definition</em>, <em>Field Values</em> and <em>Optional Condition</em> fields.</p><p>The <em>Key Definition </em>field will serve as the subkey for your new dynamic logpoint. You can specify a literal value if you want, but you can also use any of the data variables available at runtime in the <em>Program / Include</em> you’ve specified.</p><p>Since we’re setting up a logpoint for the GET_INSTANCE method, let’s use the <em>class_name</em> and <em>exit_name</em> variables defined in that method.</p><figure><img alt="New SDLP logpoint definition" src="https://cdn-images-1.medium.com/max/300/0*hAzAkHLEWRQJFxyZ.png" /></figure><p>In order to tie this logpoint to the specific user and transaction we want to research, we’ll use the available system variables <em>SY-TCODE</em> and <em>SY-UNAME</em>. This will prevent the logpoint from firing for all users in the system.</p><p>You can syntax check your work using the scale icon at the bottom of the screen, Once you’re satisfied, save your work by clicking on the disk icon.</p><p>You’ll be sent back to the overview screen, and you should see your new dynamic logpoint. Note that SAP has defaulted the validity and deletion timestamps automatically.</p><figure><img alt="SDLP logpoint" src="https://cdn-images-1.medium.com/max/300/0*8X3v-jJ1wFeJ_YJp.png" /></figure><p>At this point, the user can run through the target transaction as they normally would while the system quietly creates a log entry every time the GET_INSTANCE method fires. In this example, I ran through WE02, opening an IDoc for display and then drilling into the IDoc control record to view it. Once done, I backed out of WE02 entirely.</p><blockquote><strong>TIP: </strong>Once the user has finished working in their transaction, refresh your SDLP screen using F8 to import the results.</blockquote><figure><img alt="SDLP logpoint results" src="https://cdn-images-1.medium.com/max/300/0*wEEAuq-8WAoNltkq.png" /></figure><p>Once you’ve imported the results in transaction SDLP, double-click on the logpoint row to launch the activity log.</p><figure><img alt="SDLP results" src="https://cdn-images-1.medium.com/max/300/0*Y-bxaAmquFeF_TeP.png" /></figure><p>Based on the results above, we can see that two BAdIs were recorded, and each one was called 2 times. In each case, the same exit name was used for both of the calls.</p><p>That’s all there is to it! The dynamic logpoint will automatically become inactive (and eventually be deleted) after a set number of days. However, you should deactivate it as soon as you no longer need it. The results will remain until the logpoint is deleted.</p><h3>Conclusion</h3><p>Dynamic logpoints offer a powerful alternative to using the debugger when you need to determine what’s going on in ABAP code at runtime. You can set new logpoints on the fly with transaction SDLP without making modifications to your code base. Existing breakpoints set in the ABAP editor can be converted into new dynamic logpoints with the click of a button. When set up correctly, you can let your end user walk through the transaction while SAP records the available BAdIs for you.</p><p><em>Originally published at </em><a href="http://abapcoder.com/cl_exithandler-dynamic-logpoints/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba57fca792ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Checkpoints and Checkpoint Groups]]></title>
            <link>https://medium.com/@abapcoder/checkpoints-and-checkpoint-groups-a19df8e7514b?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a19df8e7514b</guid>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[checkpoint-groups]]></category>
            <category><![CDATA[checkpoints]]></category>
            <category><![CDATA[logging]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Thu, 22 Mar 2018 15:00:17 GMT</pubDate>
            <atom:updated>2018-03-22T15:30:50.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PD1DopguJmbkQmjK.png" /></figure><h3>Let’s turn you into an expert!</h3><p>In this article we’ll go over checkpoints, checkpoint groups and transaction SAAB. Checkpoint groups are an easy to use framework provided by SAP that allows you to verify assumptions made in your code and quickly diagnose problems from a single cockpit.</p><p>This article will not cover activation variants which essentially control the behavior of checkpoints in multiple checkpoint groups, classes, programs and function groups.</p><h4>What are Checkpoints?</h4><p>A checkpoint is one of three ABAP statements: BREAK-POINT, LOG-POINT and ASSERT. Each of these statements can be attached to a checkpoint group using the <strong><em>ID &lt;group_name&gt;</em></strong> extra. When specifying a checkpoint group, you do not need to use single quotes. Simply enter the checkpoint group as it’s named in transaction SAAB after the <strong>ID</strong> extra. We’ll go over examples of each further down in this post.</p><ul><li><strong>BREAK-POINT</strong></li><li>When executing code in dialog mode, you can control whether a breakpoint is active by assigning it to a checkpoint group. If code is being executed in the background, breakpoints are <strong>always off.</strong> If processing in an update task or via an RFC, then their behavior will depend on your debugger settings.</li><li>Leveraging breakpoints as part of a checkpoint group can be useful because you can switch them on and off as needed by changing configuration in the checkpoint group. You’ll have the flexibility of launching the debugger to review code behavior, validate your assumptions or triage a production issue. You can then easily switch the breakpoints back off by deactivating them in the checkpoint group.</li><li><strong>LOG-POINT</strong></li><li>Logpoints are used to record the contents of data variables at runtime into a checkpoint group’s output log. Logpoints must be assigned to a checkpoint group or you will receive a syntax error when compiling. Logpoints are especially useful because they allow you to review the contents of data variables without using the debugger. Logpoints create output regardless of whether the they were executed in a dialog session or in the background.</li><li>Logpoints can be given a sub-key which will further organize log entry output in the SAAB log. A sub key value is specified with the extra <strong>SUBKEY </strong>and may be up to 200 characters long. When you specify a sub key, you will need to wrap it in single quotes. Logpoints with the same subkey value will overwrite each other in log output. Therefore you may find it useful to generate the sub key value dynamically at run time!</li><li>Logpoints are intended to be used for testing purposes in transaction SAAB. SAP has not provided an API for accessing the logs outside of transaction SAAB and you should not rely on logpoints or checkpoint groups to fulfill general logging requirements.</li><li>There are restrictions around what kind of data (and how much) you can use. Reference variables are not supported. Parameter <em>abap/aab_log_field_size_limit</em> specifies the maximum size allowed per log entry in <em>bytes</em> (the default is 1024).</li><li><strong>ASSERT</strong></li><li>The ASSERT statement is used to verify that a logical expression is true. If the logical expression is false, the ASSERT triggers behavior based on how it’s configured in the checkpoint group. Similar to a LOG-POINT, you can associate fields used in the logical expression with log output in transaction SAAB. Think of an ASSERT statement as an IF statement with potentially dire consequences. If the logical expression associated with an ASSERT fails, then a non-handleable exception ASSERTION_FAILED can be raised and processing terminates with a short dump!</li><li>When attached to a checkpoint group, you can control whether the ASSERT statement creates a log entry (like a LOG-POINT), functions as a BREAK-POINT, or causes a system short dump. I’ve never needed to use an ASSERT to trigger a system crash and I would strongly counsel that voluntarily creating short dumps should never be considered an acceptable course of action.</li><li>When used with a checkpoint group, you can use assertions to trigger conditional log output. Keep in mind that the log entry is only written if the ASSERT logical expression fails.</li></ul><p>That was a lot of text. You deserve a coffee break!</p><figure><img alt="abap checkpoints" src="https://cdn-images-1.medium.com/max/300/0*yHnhQ0GtcpILnJ8k.jpg" /><figcaption>Treat yourself!</figcaption></figure><p>I promised you some examples, so let’s get to it!</p><p><strong>Assigning breakpoints to checkpoint groups</strong> is very simple. Here is an example taken from report DEMO_CHECKPOINTS:</p><figure><img alt="checkpoint group" src="https://cdn-images-1.medium.com/max/300/0*1Wk9XixzJyc1qE8q.png" /></figure><p>In this example the checkpoint group assigned to the breakpoint is literally called<em> demo_checkpoint_group. </em>You don’t use single quotes when specifying the checkpoint group name.</p><blockquote><strong>TIP:</strong> Double-clicking on the checkpoint group name will launch you directly into transaction SAAB with the checkpoint group loaded in display mode!</blockquote><p><strong>Setting up logpoints</strong> is a bit trickier because logpoint output in transaction SAAB can be overwritten if you use the same subkey more than once.</p><p>Here’s an example of a logpoint with a static subkey. It’s defined by the developer in the editor and is enclosed in single quotes:</p><figure><img alt="abap checkpoints" src="https://cdn-images-1.medium.com/max/300/0*1NAhiunTcFflmZnr.png" /></figure><p>In the above example, this logpoint is assigned to checkpoint group <em>zcg_example. </em>It uses subjey <em>‘parameters’ </em>and will write the contents of fields <em>pchar, pint1 </em>and<em> pint2</em> to the checkpoint group log.</p><p>This is sufficient if you only want to record the parameter values once, but what if you’re writing logpoints in a loop? When multiple logpoints use the same subkey, the existing logpoint entry is overwritten in the output log by the next logpoint! This means that you will only see output for last logpoint in transaction SAAB.</p><p>To avoid this, you’ll need to assign a subkey value dynamically. The value you assign must be a character-like data object. In this example I’ll use a CHAR:</p><figure><img alt="abap checkpoints" src="https://cdn-images-1.medium.com/max/300/0*zbpveuACQIGKDi44.png" /></figure><p>As you can see, I’m creating a counter of type INT and casting the value into a variable of type CHAR for use as a subkey. This will write unique entries to the checkpoint group log for each loop iteration!</p><p><strong>Assertions</strong> can behave like logpoints and breakpoints depending on how you have your checkpoint group configured. As mentioned above, they can also cause short dumps that terminate processing entirely. Like logpoints, if multiple assertions share the same subkey, their log entries will be overwritten and you will only see the last assertion log entry in the checkpoint group log. You can specify the subjkey for an assertion dynamically, just as you would for a logpoint (see the above example).</p><figure><img alt="abap checkpoints" src="https://cdn-images-1.medium.com/max/300/0*yVL_fT8t4QUKkfm5.png" /></figure><p>That covers the individual checkpoint types in ABAP. Now we’ll explore checkpoint groups and how they can be used to diagnose problems in your code.</p><h4>What are Checkpoint Groups?</h4><p>Simply put, a checkpoint group allows you to manage the configuration and behavior of associated checkpoints. You can switch breakpoints, logpoints and assertions off and on, assign which users the checkpoints are valid for, and configure how assertions behave when triggered.</p><blockquote><strong>TIP: </strong>Checkpoint groups are transportable, so they can be used in QA and production environments.</blockquote><p>Transaction SAAB is used to create and maintain checkpoint groups. Here is the initial screen:</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*XHCmjVWkJ_KbMUnC.png" /></figure><p>From here you can view, create, modify, delete and activate checkpoint groups.</p><h4>Setting up an example Checkpoint Group.</h4><p>As an example, let’s create a checkpoint group called ZCG_EXAMPLE.</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*04ksvYZH8GUc09US.png" /></figure><p>On the next screen you’ll be prompted for a package assignment because checkpoint groups are transportable. I’m using $TMP so I’ve skipped showing you that step. Once the checkpoint group has been created, you can begin referring to the checkpoint group in your code.</p><blockquote><strong>TIP:</strong> If you refer to a checkpoint group that does not exist in your code, you will receive a syntax check error.</blockquote><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*TiRjkEF7Kurr1wdy.png" /></figure><p>After finishing the creation dialog, you’ll be presented with the checkpoint group configuration screen. By default, all aspects of the checkpoint group will be deactivated.</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*E_0zHx250FyP58rL.png" /></figure><p>For the sake of this example, we’ll only be concerned with the <em>Activation </em>and <em>Log</em> tabs. If you’re curious, the <em>Activation Variants</em> tab is used to show what activation variants the current checkpoint group is a member of.</p><p>Note that breakpoints and logpoints can only be switched on or off. Assertions have a bit more flexibility.</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*TtUmYZagETBmiLDt.png" /></figure><p>If you select <em>Log</em>, then the ASSERT statement will behave like a logpoint and write a log entry to the checkpoint group if its logical expression fails.</p><p>If you select <em>Break</em>, then you’ll receive a popup inquiring how the assertion should behave during background processing, where breakpoints do not trigger the debugger. You can choose to either create a log entry, or abort processing and create a short dump.</p><p>If you choose <em>Abort</em> then the assertion will trigger a short dump if its logical expression fails.</p><h4>Activate your checkpoint group.</h4><p>If you’re in <em>edit</em> mode, you can activate your checkpoint group by switching any of the inactive options to its active counterpart (e.g. switch the <em>Logpoints</em> radiobutton from <em>Inactive</em> to <em>Log</em> and hitting <em>Save</em> (the disk icon) at the top of the screen<em>.</em> The system will prompt you for an activation window.</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*3M6eAZmOFwS_-8-h.png" /><figcaption>You can activate the checkpoint group for the current day, current week, or specify an end date.</figcaption></figure><p>It’s good practice to leave checkpoint groups inactive unless you’re actively using them, so I prefer to use <em>TODAY</em> as the time period exclusively.</p><h4>Assigning Users and Servers to your Checkpoint Group.</h4><p>By default, when you activate a checkpoint group for the first time it will be automatically active for your user. You can add or remove additional users and control checkpoint behavior for each user by clicking on the <em>User</em> icon:</p><figure><img alt="ABAP checkpoint" src="https://cdn-images-1.medium.com/max/300/0*fydBiDIuj0UbWO7a.png" /></figure><p>You can also activate or deactivate the checkpoint group for an entire server, but I’ve never found a need for that.</p><blockquote><strong>TIP:</strong> Target specific users, not servers, when setting up your checkpoint group to keep the log output concise and easier to manage!</blockquote><h4>Understanding Checkpoint Group output.</h4><p>Let’s put together some custom code that illustrates Checkpoint Group logging functionality. This example will be bit more robust than the DEMO_CHECKPOINTS report and will illustrate more of the functionality available to ABAP developers.</p><h4><strong>Example 1:</strong> Assigning a CHAR-like parameter to a LOG-POINT subkey:</h4><figure><img alt="ABAP breakpoints" src="https://cdn-images-1.medium.com/max/300/0*zzdfXbxEOqxb3JgX.png" /></figure><p>I’ll fill out the selection screen with the following values and execute the report:</p><figure><img alt="abap checkpoints" src="https://cdn-images-1.medium.com/max/300/0*8bju0-N4ksymCMRd.png" /></figure><h4><strong>Example 1 Output:</strong></h4><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*ZnmC1_Z5SRZVtSzy.png" /></figure><p>I prefer to use the hierarchy of <em>Group / Program / Proceedure / SUBKEY</em> because it groups output logically by the program and procedure that triggered the log point. Recall that in the example code above I’ve created report <em>ZRT_CHECKPOINT_EXAMPLE</em> and called form <em>PARAMETER_CHECK</em>. Using the <em>PCHAR</em> select option, I defined a subkey name of <em>EXAMPLE_SUBKEY</em>. That is exactly what’s reflected in the log ouput.</p><p>Note that there is a <em>Counter</em> column at the far right of the output. This counter denotes the number of time each checkpoint was triggered during program processing.</p><p>Double-clicking on the file icon (I’ve put a star next to it in the screenshot) will launch a popup with the details of the logpoint:</p><figure><img alt="ABAP logpoint" src="https://cdn-images-1.medium.com/max/300/0*hrh95gJk8LpH9t6J.png" /></figure><h4>Example 2: Using Logpoints inside of a loop:</h4><p>Let’s create a new FORM that demonstrates how logpoints with unique and non-unique subkeys behave:</p><figure><img alt="ABAP logpoints" src="https://cdn-images-1.medium.com/max/300/0*0P5hVcePVDq4G-Qs.png" /></figure><p>The top loop in this FORM will cause log output to be overwritten with each loop iteration because the subkey does not change. The bottom loop in this form will create unique log entries for each loop iteration because the subkey is changed each time.</p><h4>Example 2 Output:</h4><p>Executing the report again will produce the following log entries:</p><figure><img alt="ABAP checkpoints" src="https://cdn-images-1.medium.com/max/300/0*7PMU2rzfs6vKm9RG.png" /></figure><p>Note that we did not delete the previous log entries, so there are two instances of the program in the log output! That’s because log output is stored by date and time. Be default the newest log entries will be sorted to the top. Expanding the top-most node reveals out output:</p><figure><img alt="ABAP logpoints" src="https://cdn-images-1.medium.com/max/300/0*wAp0XKHSWeSDTdt-.png" /><figcaption>Top: Logpoint output using a static subkey.<br>Botom: Logpoint output using a dynamic subkey.</figcaption></figure><p>As with example one, you can drill into the individual subkey nodes to launch a popup window the specifics of each logpoint entry.</p><h4>Example 3: Using ASSERT to create a log entry and logging Exception text with a logpoint:</h4><p>Let’s create a third (and final) example that demonstrates the flexibility of assertions and logpoints:</p><figure><img alt="ABAP ASSERT and LOG-POINT" src="https://cdn-images-1.medium.com/max/300/0*4yN3lpqC7MOj2Gte.png" /></figure><p>In this example we can use the report selection screen to force an assertion by setting parameter pint2 to 0. Subsequently we will also use a logpoint to catch the exception text and put it in the checkpoint group’s log file.</p><p>We left assertions deactivated, so let’s change that now by setting them to behave as logpoints:</p><figure><img alt="ABAP assert" src="https://cdn-images-1.medium.com/max/300/0*_FRQrBTq3bNuIVIa.png" /><figcaption>Be sure to hit save!</figcaption></figure><h4>Example 3 output:</h4><p>Run your report again and leave parameter pint2 blank.</p><figure><img alt="ABAP checkpoint group" src="https://cdn-images-1.medium.com/max/300/0*Xr7QVY1kYhiHD2n6.png" /></figure><p>Now we see a third entry for the <em>MATH</em> form we created above. The assertion has behaved as a logpoint due to the checkpoint group’s configuration. Furthermore, the ‘division error’ logpoint will contain the text from the exception class that was created by the TRY/CATCH statement.</p><figure><img alt="checkpoint group" src="https://cdn-images-1.medium.com/max/300/0*VNz2yGJBOoH6YPEI.png" /></figure><h3>Conclusion — It’s easy to get started with checkpoints.</h3><p>Checkpoints are pretty easy to use! There are three kinds of checkpoint statement available to you in ABAP. They are: BREAK-POINT, LOG-POINT and ASSERT. You can create a Checkpoint Group in transaction SAAB. This transaction is also used to review log output and modify checkpoint behavior. Checkpoint statements are assigned to a Checkpoint Group using the ID extra.</p><p>I hope you’ve enjoyed this article! Thanks for reading. :)</p><p><em>Originally published at </em><a href="http://abapcoder.com/checkpoint-groups/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a19df8e7514b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breakpoints in ABAP]]></title>
            <link>https://medium.com/@abapcoder/breakpoints-in-abap-5ae97333d2f1?source=rss-f64e17be29a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ae97333d2f1</guid>
            <category><![CDATA[point-break]]></category>
            <category><![CDATA[abap]]></category>
            <dc:creator><![CDATA[Matthew Tice]]></dc:creator>
            <pubDate>Tue, 20 Mar 2018 15:00:00 GMT</pubDate>
            <atom:updated>2018-03-22T15:30:03.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Cv17E0-SzTSIGpTG.jpeg" /></figure><h3>Breakpoints!</h3><p>Breakpoints actually serve several purposes in SAP. They can be used to interrupt processing and launch the debugger, but they also have a role in SAP’s <em>Checkpoints</em> testing framework. In this article we’ll explore the different kinds of breakpoints available to ABAPers. I’ll also introduce the role and function of breakpoints in the debugger. We’ll cover breakpoints set by interacting with the editor and breakpoints set using ABAP code.</p><p>Understanding breakpoints is a good first step towards understanding the debugger, which will be covered at length in a series of future posts. If you’re brand new to debugging, then what you need to take away from this is that a breakpoint is used to interrupt program processing and launch the debugger.</p><p>The debugger is a critical tool in ABAP development and understanding how to use it effectively is the hallmark of a great developer. The best business analysts I’ve ever worked with have also known how to navigate and troubleshoot in the debugger. So whether you’re trying to better understand the behavior of SAP standard functionality or attempting to diagnose a problem in custom code, the debugger should be an integral part of your toolkit.</p><h4>Getting started — setting breakpoints in the editor.</h4><p>Most ABAPers will manually set breakpoints themselves by interacting with the ABAP editor. There are many ways to set a breakpoint so let’s start at the beginning by explaining session breakpoints and external breakpoints and how to create them using the editor.</p><p>If you’ve written even a single line of ABAP code, be it in a class, report or function module, no doubt you’ve noticed the two stop sign icons:</p><figure><img alt="gui status bar" src="https://cdn-images-1.medium.com/max/300/0*zbac1UTsl9JIxc5M.png" /></figure><figure><img alt="session and external break points" src="https://cdn-images-1.medium.com/max/80/0*3vpP84039zLqrvc-.png" /><figcaption>Session (left) and external (right) breakpoints.</figcaption></figure><p>You can set a breakpoint by selecting any <strong>executable</strong> line of code then then selecting either of the icons above. But what do they mean? What’s the difference between them?</p><p>A <strong>session breakpoint</strong> is attached to a user’s session, which exists from the point in time where the user logs into SAP until they close their last SAP dialog window. The icon looks like a computer monitor set in front of a stop sign. You can set a session breakpoint, then open a new session and close the editor window with the session breakpoint and that breakpoint will still exist. Depending on your role as a developer, session breakpoints may be all you need to debug ABAP code.</p><p>An <strong>external breakpoint</strong> is attached to the user that set it, and behaves similarly to a session breakpoint. The icon looks like a person set in front of a stop sign. The major difference is that it exists for a 2 hours and can launch the debugger when triggered by an external process. This makes external breakpoints useful for debugging RFC (Remote Function Call) processing, ICF (Internet Communication Framework, e.g. HTTP) processing and APC (ABAP Push Channels) processing.</p><p>Generally speaking, you won’t have a need for external breakpoints unless you’re debugging through an external process. If you’re not sure what any of that means, don’t worry! Just know that you probably won’t use external breakpoints until you’re exploring the subjects described above.</p><p>There is a third kind of breakpoint called a <strong>debugger breakpoint </strong>that you can only set after the debugger has already started. The debugger breakpoint icon looks like a stop sign. These breakpoints will only exist for the lifespan of the debugger session and are useful if you want to set additional temporary program flow interruptions. We’ll see an example of debugger breakpoints a bit later in this article. While in the debugger, you can save your breakpoints (using the disk icon at the top of the screen) to turn them into session breakpoints.</p><h4>Setting breakpoints with the mouse.</h4><p>You can also set session and external breakpoints with your mouse. Left-clicking in the left margin of the editor at the line for which you want to set a breakpoint will create a session breakpoint. If you want to set an external breakpoint, hold down the <strong>control</strong> key<strong> </strong>and left click in the same margin.</p><figure><img alt="session and external breakpoints editor" src="https://cdn-images-1.medium.com/max/300/0*xqkVKUxHxaSDW78j.png" /><figcaption>Set an external breakpoint (top) with control-left-click. Set a session breakpoint (bottom) by left clicking.</figcaption></figure><h4>Setting and managing breakpoints in the debugger.</h4><p>If you’re already in the debugger, you can set a new debugger breakpoint at any time by left clicking in the left margin on any executable line of code. This breakpoint will exist for the duration of the current debugger session. As mentioned above, you can save these debugger breakpoints to turn them into session breakpoints at any time by clicking the disk icon at the top of the debugger window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*1Par7ksTFAZn8po9.png" /><figcaption>Note that the debugger breakpoint in the screenshot above looks different (no monitor or person on the stop sign icon).</figcaption></figure><p>The debugger offers a robust breakpoint creation menu, which you can access by clicking on the stop sign icon at the top of the debugger window:</p><figure><img alt="breakpoint creation meniu" src="https://cdn-images-1.medium.com/max/300/0*y2HYH5s8FHHO2fQL.png" /></figure><p>There are a lot of options here, but the big takeaway is that you can set a breakpoint on <em>almost anything</em>, from specific ABAP statements (shown above) to methods, functions, XLS translations and even individual messages in a message class!</p><blockquote><strong>TIP: </strong>Try using breakpoints for specific messages to quickly diagnose scenarios where error messages are being issued! Consider the following scenario: A user emails you a screenshot of a failed dialog transaction with an SAP-standard error message at the bottom of the screen. Using message breakpoints, you can start the transaction, use <strong>/h</strong> in the command field to launch the debugger and set a message breakpoint for the specific message class and message number, then execute until the debugger stops! Now you can easily diagnose what conditions lead to the message being issued in the first place.</blockquote><p>Furthermore, SAP has provided a tab in the debugger tabstrip devoted exclusively to maintaining breakpoints and watchpoints. From here you can easily get an overview of all debugger, session and external breakpoints you currently have set. This includes where each breakpoint is set, whether it’s active or inactive and any conditions required to trigger the breakpoint.</p><figure><img alt="breakpoints tab" src="https://cdn-images-1.medium.com/max/300/0*jYUUqlSje4xTkbBu.png" /></figure><p>Clicking on the navigation icon in the cell directly to the left of the visibility dropdown box will open a new debugger tool that shows you exactly where your breakpoint is in the code base.</p><h4>Using ABAP to set breakpoints.</h4><p>If you’re even passingly familiar with ABAP, you’re probably aware of the BREAK-POINT and BREAK ‘USERID’ statements. The BREAK-POINT statement is much more versatile than it first appears. SAP has provided an entire suite of functionality called <strong>Checkpoint Groups</strong> that use BREAK-POINT, LOG-POINT and ASSERT statements to help developers write better code and diagnose problems quickly.</p><p>A BREAK-POINT statement can be assigned (using the ID addition) to a checkpoint group that switches its functionality on and off from configuration. BREAK-POINT statements can also be used to write log entries to the system log during background processing. Note: you cannot assign a breakpoint to a checkpoint group AND use it to write a log entry to the system log at the same time.</p><p>Checkpoint groups are a more advanced topic that will be covered in a future article. In short, they control whether specific BREAK-POINT, LOG-POINT and ASSERT statements are active or inactive at runtime. Checkpoint Groups also control whether an ASSERTION behaves as a BREAK-POINT, LOG-POINT or causes a system abort when triggered. Leveraging this functionality requires access to transaction <strong>SAAB</strong>.</p><p>There is a demonstration of checkpoint groups in SAP-standard program <strong>DEMO_CHECKPOINTS</strong>. In order to get the most out of this demonstration report, you’ll need to activate checkpoint group DEMO_CHECKPOINT_GROUP using transaction SAAB. Note — This report was released in 2009. Depending on the age of your system implementation, the checkpoint group and activation variant functionality may not exist!</p><h4>Why didn’t my breakpoint launch the debugger?</h4><p>Depending on your debugger configuration, it’s possible SAP will ignore your breakpoints at runtime. You can view your debugger settings from any session where the debugger is open via the menu path <strong>Settings -&gt; Change Debugger Profile / Settings</strong>:</p><figure><img alt="debugger config settings" src="https://cdn-images-1.medium.com/max/300/0*LdMyK4DFp4DK2N2S.png" /></figure><p>Let’s review what those options mean in the context of setting breakpoints with an example: If you’re looking at the object attributes of a report and you see that the report’s status is <em>S — System Program</em>, this means that breakpoints in this program will only launch the debugger if System Debugging is turned on.</p><figure><img alt="ABAP Breakpoints" src="https://cdn-images-1.medium.com/max/300/0*hGshfMeiYV1Xnyjn.png" /><figcaption>The System Program indicator, found in a program’s object attributes.</figcaption></figure><p>Without <em>System Debugging</em> turned on, breakpoints (including BREAK-POINT statements) are written to the system log (transaction <strong>SM21</strong>) and do not interrupt processing. The same is true if the report is run in the background: Even permanently active BREAK-POINT statements do not trigger the debugger and are instead written to the system log.</p><p>The system log has a variety of uses, but in this context you can use it to review what breakpoints were triggered. Here’s an example of what the system log looks like when a standard BREAK-POINT is encountered, and when a BREAK-POINT with a log message is encountered:</p><figure><img alt="SM21 example" src="https://cdn-images-1.medium.com/max/300/0*IRLzotOfstk2tHSz.png" /><figcaption>The system log (transaction SM21) reflects both break points.</figcaption></figure><h4>Conclusion — breakpoints serve several purposes.</h4><p>Breakpoints are an essential part of working in the debugger. Unless you’re working on an advanced topic like RFC debugging, session break points will probably meet your needs. You can set breakpoints via the editor, the debugger and using ABAP. The BREAK-POINT statement is much more versatile it first appears. If your program was run in the background, use transaction SM21 to review the system log.</p><p><em>Originally published at </em><a href="http://abapcoder.com/abap-breakpoints/"><em>ABAP Coder</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ae97333d2f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>