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

Retrieving variables of program

Former Member
0 Likes
2,183

Hi all,

I am making a program which checks whether a program uses data declarations and makes a list with the found data elements. For example program below will result in following list.

Name is the name of the variable, objectname is the name of the type and local can be set in case of a like (objname can be a Z without it being a custom data element).

Name
Type/likeObjnameLocal
UT_CODETYPERSFB_SOURCE
LW_CODETYPESTRING
LS_RETURNTYPEBAPIRET2
ZV_CNONE

LV_CCLIKEZV_CX

REPORT ztest2.

DATA: ut_code    TYPE     rsfb_source
      
.

data:lw_code    TYPE string. data ls_return TYPE bapiret2. "CALL FUNCTION
*      lw_objects TYPE gty_objects.

data: zv_c
      
.
DATA: lv_cc  LikE zv_c.

Now I've found FM WB_TREE_GET_OBJECTS but this only results in a list of global data declaration elements. If there is a subroutine it should also be checked.

Is there anything I can use to retrieve a list of variables and its typing?

Kind regards,

Wim van Erp

6 REPLIES 6
Read only

former_member188282
Active Participant
0 Likes
1,542

Hi Wim,

Check with below function module.

WB_TREE_GET_INCLUDE.

Regards,

Rajesh

Read only

0 Likes
1,542

This FM only returns the includes not the variables in the data declaration.

Read only

Former Member
0 Likes
1,542

When using the debugger, all global variables are collectively visible in tab globals. When entering a subroutine all variables are collectively visible in tab locals.

Are these variables retrieved with some kind of call stack principle or is there another way?

And is it possible to retrieve those locally declared variables without executing the subroutine?

Kind regards,

Wim van Erp

Read only

0 Likes
1,542

Perhaps you can use READ REPORT and SCAN ABAP-SOURCE statements to get tokens and statements internal tables, and then look for data statements that fall between form-endform.

Read only

Former Member
0 Likes
1,542

This message was moderated.

Read only

deependra_shekhawat3
Contributor
0 Likes
1,542

Hi Wim,

You can try program 'RS_ABAP_SOURCE_SCAN' .

Deependra