‎2013 Oct 22 10:35 AM
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/like | Objname | Local |
|---|---|---|---|
| UT_CODE | TYPE | RSFB_SOURCE | |
| LW_CODE | TYPE | STRING | |
| LS_RETURN | TYPE | BAPIRET2 | |
| ZV_C | NONE | ||
| LV_CC | LIKE | ZV_C | X |
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
‎2013 Oct 22 11:05 AM
Hi Wim,
Check with below function module.
WB_TREE_GET_INCLUDE.
Regards,
Rajesh
‎2013 Oct 22 11:33 AM
This FM only returns the includes not the variables in the data declaration.
‎2013 Oct 24 9:16 AM
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
‎2013 Oct 24 1:23 PM
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.
‎2013 Oct 24 9:52 AM
‎2013 Oct 24 1:44 PM