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

ABAP Program global variable print at runtime

Former Member
0 Likes
1,323

Hi,

I have an abap program with more than 1000 global variables. I want to run the program and at a specific point show a report with names and runtime values of all the global variables in the program. Is there some system table which stores all the global variable names and source code? Kindly help.

Satya

5 REPLIES 5
Read only

Former Member
0 Likes
874

I am not sure I understood your requirement. 'At a specific point', do you mean when the program is running and it reaches a certain point? The values are available to the program at that point of time, so I don't see why you need system tables etc. Can't you just write the values at that specific point?

Please give some clarification.

Srinivas

Read only

Former Member
0 Likes
874

Hi Srinivas,

Thank you for the reply. Actually I CAN write the values one by ony using WRITE statements at a specific point the in the program but I would have to write atleast 1000 write statements to accomplish this. Instead if there is a system table which stores the global variables for a program / source code I can get the names of the global variables dynamically at runtime and print them

Read only

0 Likes
874

OK, now I understand. Your issue is with the large number of WRITE statements. I am not sure how easy this is but whenever there is a dump, system writes out all the information including values of the variables. It will not be anywhere in the database tables but I think it may be in some system memory areas. I don't know if there is a easy way to get that information.

Read only

naimesh_patel
Active Contributor
0 Likes
874

Hello Satya,

You can store all your global variables in one internal table.

let's say your Itab contains 1000 fields. Now, if you want to retrive the name of the itab, you can use the system call.

DATA: IT_COMP LIKE RSTRUCINFO OCCURS 0 WITH HEADER LINE.

*-- Getting fields of internal table

CALL 'AB_STRUC_INFO'

ID 'PROGRAM' FIELD SY-CPROG

ID 'STRUCNAME' FIELD P_ITAB

ID 'STRUCINFO' FIELD IT_COMP-SYS.

After getting all your fields in it_comp table you can use field symbol to get the values of your fields.

Regards,

Reward points, if it is useful...!

Read only

0 Likes
874

Thanks Naimesh, it doesnt completely solve my problem but it certainly helps. I have awarded 6 points.