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

How to differnetiate global variable as internal table, work area, etc.

Former Member
0 Likes
2,025

Hi Experts,

I need to make a report program to find all global variables in a program(mentioned in the selection screen) and display internal table and work area separately.

By using the function module 'GET_GLOBAL_SYMBOLS' I found out all the variables. Now I have to differentiate each as internal table, work area and other variable.

Please suggest how to differentiate.

Thanks in Advance.

Ann

1 ACCEPTED SOLUTION
Read only

rosenberg_eitan
Active Contributor
0 Likes
1,890

Hi,

See: CL_ABAP_TYPEDESCR

And

Regards.

Hi Experts,

I need to make a report program to find all global variables in a program(mentioned in the selection screen) and display internal table and work area separately.

By using the function module 'GET_GLOBAL_SYMBOLS' I found out all the variables. Now I have to differentiate each as internal table, work area and other variable.

Please suggest how to differentiate.

Thanks in Advance.

Ann

6 REPLIES 6
Read only

ivan_shadrin
Participant
0 Likes
1,890

sorry, I gave a wrong advice.

Read only

0 Likes
1,890

Can we differentiate variable as work area or internal table by using CL_ABAP_TYPEDESCR.

Read only

0 Likes
1,890

Hi,

Not really - that's for run time use.  The results I get back have [] appended for internal tables.  If there's a reference type you can read the data dictionary tables (dd01x-dd04x)

As for work areas etc,  you would need to parse the programs I would think.

Regards

Rich

Read only

0 Likes
1,890

It looks like you're right. I tried to find appropriate FM or class, but I couldn't.

But I have found a report RS_ACI_SHOW_AST. It performs parsing of the ABAP report and outputs a list of statements.

This is a sample program.

And here is the output generated by the report:

So, may be it is possible to analyze statements with the specific types (for example, DATA DEFINITION, FIELD-SYMBOLS, PARAMETER DEFINITION and so on) and get the names of the variables and their data types names.

For example, Node 9 contains STRUCT-OP "TABLE OF..". Hence, this variable is an internal table.

Node 11. It has type SCARR-CARRID. You can use CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_NAME = 'SCARR-CARRID' ) to determine the actual type of this variable.

And so on..

But there also some bad news. The report RS_ACI_SHOW_AST is extremely complicated. More than it, it is marked for internal use only.

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,891

Hi,

See: CL_ABAP_TYPEDESCR

And

Regards.

Read only

Former Member
0 Likes
1,890

Hi Ann,

     In the same function module RFIELDLIST table you have a type field which will hold whether it is an internal table,work area or variable.

internal table -  type h

work area - u

variable of type char - C

variable of type string - g