Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What's the purpose of Variables Checkbox in ABAP Debugger Session Save Popup?

JerryWang
Product and Topic Expert
Product and Topic Expert
878

Today, a friend asked me about the meaning of the "Variables Checkbox" in the ABAP debugger, as shown in the image below:

clipboard5.png

The friend was referring to the Save and Load functions in the Debugger Session of the ABAP debugger:

clipboard4.png

To be honest, although I am quite familiar with the ABAP debugger, I have never used this particular function.

The Load and Save menus appear as a pair, which likely means they are meant to handle the persistence of the ABAP debugging session. This would involve saving the various settings and values of the current session to some storage medium and later reloading and restoring these saved values from that medium.

When you click Save, a dialog box appears, divided into three sections.

Section 1 specifies the storage medium for persisting the debugging session, whether to save it to a local file or to a table in the ABAP system database.

Section 2 specifies the Technical Name of the stored session.

Section 3 specifies which properties of the current session need to be persisted.

Both my friend and I were puzzled by the Variables checkbox in Section 3.

What does this option mean? If checked, does it mean that the content of the variables in the current debugging session will also be persisted?

clipboard5.png

My first instinct was that this was unlikely.

Imagine a debugging session where we use OPEN SQL to read a large amount of data into an ABAP internal table variable from a database table.

If the save function of the ABAP debugging session also persisted the content of the ABAP variables in the current session, it would consume too much storage space.

Of course, this is just my guess.

To verify it, we need to find evidence.

We could check the SAP official help documentation.

But I prefer the method: Talk is Cheap. Show me the Code.

Click the Variables area with the mouse and press F1.

clipboard6.png

In the pop-up dialog box, click Technical Information:

clipboard7.png

Then you will see that the Variables checkbox in the save session dialog corresponds to the field named VARIABLES in the ABAP report program SAPLSTPDA_DEBUG_SESSIONS, Screen number 0100.

clipboard8.png

So, there is no need to spend effort looking up documentation. Just look at the source code to understand the function of this field, right?

We open the ABAP program found above in SE80, locate Screen 0100, and see that the PROCESS AFTER INPUT on line 8 is responsible for handling user input.

In line 26, the subroutine user_command_0100 contains the code I want to check.

clipboard9.png

Double-clicking line 26, I find it calls another subroutine ok_code_handling.

So, continue double-clicking:

clipboard10.png

Line 20 enters the corresponding branch according to the OK Code.

For the Save operation, the logic is encapsulated in the save_session method of cl_tpda_debug_session_handler.

clipboard11.png

Double-clicking this method, I search for the field VARIABLES, as found through F1 earlier, and find an IF branch.

This branch includes the cl_tpda_variable_manager, which, judging by the name, is responsible for managing variables in the ABAP debugging session.

Double-click to enter this class.

clipboard12.png

These methods with DB in their names include the logic for CRUD operations on variables in the ABAP debugging session at the database level.

clipboard13.png

Opening one method randomly, I finally find the TPDA_VARIABLES table. This table is where variable information in the ABAP debugging session is stored when selecting persistence at the database level.

clipboard14.png

I wrote a random ABAP report and checked the values of three variables, cv_data, lv_s, and lt_content, in the debugger Variables window, then used the Debugger Session->Save function to save the current session along with the variable information:

clipboard15.png

When saving, remember to check the Variables Checkbox and name the session var_test.

clipboard16.png

After successfully saving, query the TPDA_VARIABLES table with the name var_test and find that the variable information in the debugging session is stored in XML format in this table.

clipboard17.png

Let's check the specific content of the XML.

The truth is revealed.

Conclusion: When the Variables checkbox is checked, the ABAP debugger will only persist the names of the variables currently being viewed in the Variables panel. The actual content of the variables will not be saved.

clipboard18.png

The following image shows the ABAP debugger before selecting the Load function, with the Variables area empty.

clipboard19.png

After selecting Load, the variable names saved in the database table automatically appear in the Variables area.

When debugging a very complex ABAP program, if you need to check multiple variables at once but need to interrupt the debugging for some reason, you can use the Save - Load function to save the names of the variables you are viewing for future restoration.

clipboard20.png

This article introduces another example of verifying one's guesses by reading the source code to figure out how the standard functions provided by the system work.

Thanks a lot for reading my post 🙂

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Kudos
627

Thanks. Shouldn't it be published as a blog post rather than a discussion? (Technology Blogs by SAP | SAP Community)