Application Development 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: 

RTTS question

former_member215188
Participant
0 Kudos

Hi,

Given any internal table i was wondering if i could get the refernce type of its components?

So far i could only get the internal types and lengths. I want to get the Data Dictionary references so i can dynamically assign column titles in creating my ALV field catalog.

Is this possible? My other option is to use a dynamic internal table managed by a type manager class but thats too tedious and using the dynamic internal table is a bit awkward.

thanks in advance!

10 REPLIES 10

Former Member
0 Kudos

Hi emir,

1. we can get the field list using

the FM GET_COMPONENT_LIST

2. just copy paste

3.

REPORT abc.

*----


DATA : BEGIN OF itab OCCURS 0,

lifnr LIKE lfa1-lifnr,

land1 LIKE lfa1-land1,

name1 LIKE lfa1-name1,

name2 LIKE lfa1-name2,

END OF itab.

DATA : allfields(300) TYPE c.

DATA : fld(100) TYPE c.

DATA : components LIKE rstrucinfo OCCURS 0 WITH HEADER LINE.

*----


CALL FUNCTION 'GET_COMPONENT_LIST'

EXPORTING

program = sy-repid

fieldname = 'ITAB'

TABLES

components = components.

BREAK-POINT.

LOOP AT components.

CONCATENATE 'LFA1~' components-compname '' INTO fld.

CONCATENATE allfields fld INTO allfields SEPARATED BY space.

ENDLOOP.

*----


SELECT (allfields)

FROM lfa1

INTO TABLE itab.

*----


BREAK-POINT.

regards,

amit m.

0 Kudos

Amit,

Thanks for the quick response.

However, I could already do this.

Based on your example, is it possible to get

lfa1-lifnr from the component itab-lifnr?

0 Kudos

repost deleted.

0 Kudos

Hi again,

1. From ITAB-LIFNR,

u want LFA1-LIFNR,

2. If your purpose of getting this,

is for getting the FIELD DESCRIPTION,

then the FM for ALV FIELD CATALOGUE MERGE,

will automaticlly do it.

3. However,

we can get some TABLE-LIFNR

from DD03L table,

where we can pass the field name as LIFNR,

and we get all records,

(ie. all tables/structures)

which use this field.

regards,

amit m.

0 Kudos

Hi again,

1. From ITAB-LIFNR,

u want LFA1-LIFNR,

2. If your purpose of getting this,

is for getting the FIELD DESCRIPTION,

then the FM for ALV FIELD CATALOGUE MERGE,

will automaticlly do it.

3. However,

we can get some TABLE-LIFNR

from DD03L table,

where we can pass the field name as LIFNR,

and we get all records,

(ie. all tables/structures)

which use this field.

regards,

amit m.

0 Kudos

Hi again,

1. From ITAB-LIFNR,

u want LFA1-LIFNR,

2. If your purpose of getting this,

is for getting the FIELD DESCRIPTION,

then the FM for ALV FIELD CATALOGUE MERGE,

will automaticlly do it.

3. However,

we can get some TABLE-LIFNR

from DD03L table,

where we can pass the field name as LIFNR,

and we get all records,

(ie. all tables/structures)

which use this field.

regards,

amit m.

0 Kudos

Hi again,

1. From ITAB-LIFNR,

u want LFA1-LIFNR,

2. If your purpose of getting this,

is for getting the FIELD DESCRIPTION,

then the FM for ALV FIELD CATALOGUE MERGE,

will automaticlly do it.

3. However,

we can get some TABLE-LIFNR

from DD03L table,

where we can pass the field name as LIFNR,

and we get all records,

(ie. all tables/structures)

which use this field.

regards,

amit m.

former_member215188
Participant
0 Kudos

repost deleted.

Former Member
0 Kudos

Hi again,

1. From ITAB-LIFNR,

u want LFA1-LIFNR,

2. If your purpose of getting this,

is for getting the FIELD DESCRIPTION,

then the FM for ALV FIELD CATALOGUE MERGE,

will automaticlly do it.

3. However,

we can get some TABLE-LIFNR

from DD03L table,

where we can pass the field name as LIFNR,

and we get all records,

(ie. all tables/structures)

which use this field.

regards,

amit m.

former_member215188
Participant
0 Kudos

hi. cool stuff but it still doesnt fit my requirement.

ie.

DATA: BEGIN OF itab,

document LIKE bkpf-belnr,

gjahr LIKE bkpf-gjahr,

budat LIKE bkpf-budat,

line_item LIKE bseg-buzei,

END OF itab.

notice that my internal table could be anything. It is not defined by a specific DDIC structure or table. The components, however, are ALWAYS defined by a table-field.

Basically, I am trying NOT to hardcode the descriptions of my field catalog.