‎2007 Nov 16 8:43 AM
Hi Experts,
i want to know, how to get the internal tables uesd in a program and how to get the field lenghts and names of each field in that internal table.
REPORT zktest MESSAGE-ID zi LINE-COUNT 60.
DATA: BEGIN OF line,
col1 TYPE i,
col2 TYPE i,
END OF line.
DATA: itab1 TYPE TABLE OF line WITH HEADER LINE INITIAL SIZE 0.if i have an internal table like this, i need to get , what are the internal tables used in the program and have to get the field lenghts of <b>col1 col2</b> under the table itab1.
i need to get this information within the same program, to get the table informations that i have used.
any suggestions and clues are appreciated.
Thanks & Regards,
Poorna.
‎2007 Nov 22 2:26 PM
Hi Poorna,
To get the runtime details of any variable there is a RTTI functins available.
for your querry checkout the cl_abap_structdescr class and its usage.
You need to create a structure variable as
Data itab1_struct like itab1.
and then call the abovt method with itab1_struct as an exporting parameter in the call statement.
In return you will get name,kind,length of the individual components of the structure you want to know at runtime.
Explore more in the RTTI (Real Time Type Identification) functionality in the help documentations for other details.
Regds,
Gaurav
‎2007 Nov 16 9:17 AM
HI
select that name of the internal table and follw this path
UTILITIES -> WHERE USED LIST
you will get one pop up and select program option there
it will show all the programs in which it is used
‎2007 Nov 16 9:21 AM
u can simply use find button in programand select main program check box. click on data declarations.
‎2007 Nov 22 2:26 PM
Hi Poorna,
To get the runtime details of any variable there is a RTTI functins available.
for your querry checkout the cl_abap_structdescr class and its usage.
You need to create a structure variable as
Data itab1_struct like itab1.
and then call the abovt method with itab1_struct as an exporting parameter in the call statement.
In return you will get name,kind,length of the individual components of the structure you want to know at runtime.
Explore more in the RTTI (Real Time Type Identification) functionality in the help documentations for other details.
Regds,
Gaurav
‎2007 Nov 23 9:07 AM
try out with following code.
you need to use DESCRIBE statement to have internal table details.
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1
INITIAL SIZE 10.
DATA: LIN TYPE I,
INI TYPE I,
KND TYPE C.
<b>DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.</b>
WRITE: / LIN, INI, KND.
DO 1000 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
<b>DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.</b>
WRITE: / LIN, INI, KND.
‎2007 Nov 26 4:50 AM
Hi,
To get internal table info you can see the "where used list" and to get the internal table column names you can use a function module called GET_COMPONENT_LIST .
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
PROGRAM = sy-repid
FIELDNAME = 'WA_WBS'
TABLES
COMPONENTS = res1
.
'WA_WBS' - structure name to get column names
res1 - data res1 type table of rstrucinfo with header line.
Regards,
soumya
‎2007 Nov 26 12:15 PM
Hi,
select that name of the internal table and follw this path
UTILITIES -> WHERE USED LIST
you will get one pop up and select program option there
it shows the programs in which it is used .
‎2007 Nov 28 11:57 AM