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

Convert a structure into a table - Function module

Former Member
0 Likes
2,344

Hello everyone,

I heard of a function module which converts a structure into a table.

Afterwards every line of the table represents a field of the converted structure. Does anyone know the name of this function module?

thx

Stephan

7 REPLIES 7
Read only

Former Member
0 Likes
1,476

hi bro....

u can use fm

FICO_CONVERSION_AMTPOS

for ur purpose

regards

Read only

viquar_iqbal
Active Contributor
0 Likes
1,476

Hi

you can check this MS_GET_MASTERDATA_STRUCT_TABLE

Thanks

Viquar Iqbal

Read only

Former Member
0 Likes
1,476

Hi Stephen,

Use the Method CL_WD_DYNAMIC_TOOL=>CREATE_TABLE_FROM_NODE

Thanks

kalyan B

Read only

Former Member
0 Likes
1,476

Hi,

Not sure if this is the one you are looking for. REUSE_ALV_FIELDCATALOG_MERGE . This function takes a structure as an input and returns the field catalogue.

regards,

Advait

Read only

Former Member
0 Likes
1,476

Hello again!

No, my problem doesn´t concern field catalogues.

Unfortunately i have also problems making any of the other function modules work.

MS_GET_MASTERDATA_STRUCT_TABLE seems to fit best for my problem, however as i said i cannot make it run as a have problems with the parameters. Do i have to modify the function modules to work with my wanted structure or is it possible without modifying?

Again for explanation:

I have a structure containing: name/city/country/gender

Now i want to convert this structure into a table with the lines:

name

city

country

gender

(I need that convertation to be able to loop over the table and define some selectioncriterias.)

greez

Stephan

Read only

0 Likes
1,476

Can you do something like this?

REPORT zz_temp.

TYPES: BEGIN OF  ty_table,
  tabline(60)  TYPE c.
TYPES: END OF  ty_table.

DATA:
  g_s_tstc  TYPE  tstc,
  g_s_tab   TYPE ty_table,
  g_t_tab   TYPE TABLE OF ty_table,
  g_lines   TYPE i.


FIELD-SYMBOLS: <fs_component> TYPE ANY.


SELECT * FROM tstc
  INTO CORRESPONDING FIELDS OF  g_s_tstc
  WHERE tcode = 'SE38'.
ENDSELECT.


DO.
  ASSIGN COMPONENT sy-index
    OF STRUCTURE g_s_tstc TO <fs_component>.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  g_s_tab-tabline = <fs_component>.
  APPEND g_s_tab TO g_t_tab.
  WRITE:/ g_s_tab-tabline.
ENDDO.

DESCRIBE TABLE g_t_tab LINES g_lines.

WRITE g_lines.

Read only

0 Likes
1,476

I have a structure containing: name/city/country/gender

Now i want to convert this structure into a table with the lines:

name

city

country

gender

You can use the method DESCRIBE_BY_DATA method of the class cl_abap_structdescr. This will return you a reference to the CL_ABAP_TYPEDESCR class and then you can cast this to an object of the cl_abap_structdescr class and then use the attribute components to get the list of compnents.

regards,

Advait