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

FM for Variable and there type used in program .

Former Member
0 Likes
1,956

Hi Expart,

Is there is any FM which return all the variable with there ref type (Data element ,C,id,t... like that ) when we pass the program name . i only know about RS_PROGRAM_INDEX which return all variable with in pgm .

and how to used FM " RS_PROGRAM_INDEX _SOURCE " It's may also return the variable and type .

Plz Plz help to get this

Thanks

Raju

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,468

Hi,

I know for Internal Table use class CL_ABAP_STRUCTDESCR,

Try this...

DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.

l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

Now l_descr_ref->components holds the entire list of fields in itab.

Thanks & Regards,

ShreeMohan

11 REPLIES 11
Read only

Former Member
0 Likes
1,468

Go to Standard Program LSEMOF02

and search for your FM RS_PROGRAM_INDEX_SOURCE

Read only

0 Likes
1,468

But i am only pass the program name to RS_PROGRAM_INDEX_SOURCE But it will not return anything.Please help me to get all variable with type in a program .

Thanks

Raju

Read only

Former Member
0 Likes
1,468

Try the function Module 'RS_PROGRAM_INDEX'. This returns all the components of the program.

Also, check the FM 'GET_GLOBAL_SYMBOLS'.

Edited by: jaya rangwani on Aug 12, 2009 10:48 AM

Read only

0 Likes
1,468

Hi ,

By using FM GET_GLOBAL_SYMBOLS , i am only getting the System define ref type ,not getting user define type .

Please help me .

Thanks

Raju

Read only

Former Member
0 Likes
1,469

Hi,

I know for Internal Table use class CL_ABAP_STRUCTDESCR,

Try this...

DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.

l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

Now l_descr_ref->components holds the entire list of fields in itab.

Thanks & Regards,

ShreeMohan

Read only

0 Likes
1,468

Hi

ShreeMohan Puga...

How to display the attibute of l_descr_ref which ref to class cl_abap_structdescr .that is Components table content length and data type .plz help me to get the value

Thanks

Raju

Read only

0 Likes
1,468

Hi,

TYPES:
  BEGIN OF my_struct,
    comp_a type i,
    comp_b type f,
  END OF my_struct.

DATA:
  my_data   TYPE my_struct,
  descr_ref TYPE ref to cl_abap_structdescr.

FIELD-SYMBOLS:
  <comp_wa> TYPE abap_compdescr.

START-OF-SELECTION.
  descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).

  WRITE: / 'Typename     :', descr_ref->absolute_name.
  WRITE: / 'Kind         :', descr_ref->type_kind.
  WRITE: / 'Length       :', descr_ref->length.
  WRITE: / 'Decimals     :', descr_ref->decimals.
  WRITE: / 'Struct Kind  :', descr_ref->struct_kind.
  WRITE: / 'Components'.
  WRITE: / 'Name              Kind   Length   Decimals'.
  LOOP AT descr_ref->components ASSIGNING <comp_wa>.
    WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
             <comp_wa>-length, <comp_wa>-decimals.
  ENDLOOP.

Thanks &regards,

ShreeMohan

Read only

0 Likes
1,468

Hi Expart ,

I don't want to know the basic type ,i only have to know the ref data type like

P_EBELN LIKE EKKO-EBELN.

Only i want that p_ebeln variable name and type ref is ekko-ebeln ,not CHAR with length 10 .

plz help me to do this .

Read only

0 Likes
1,468

Hi,

Why don't you copy the FM which gives you basic types and then modify it according to your requirement.

or create our own new program for this.

Regarads,

Raj Gupta

Read only

0 Likes
1,468

Hi

How to do this can you help me plzz

Read only

0 Likes
1,468

Hi,

Or is there any FM which return the ref type (data element or like ekko-ebeln ) ,if we pass the variable name .

Plz help me .

Thanks

Raju