cancel
Showing results for 
Search instead for 
Did you mean: 

Help Creating table

Former Member
0 Kudos

Hi,

I need help creating a table with one column where the fields of that column are the name of the columns of another table.

Can some one please help me?

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ok.

One last thing, how do I bind it to a node named SORT.

Regards

former_member184578
Active Contributor
0 Kudos

Hi Khaytaah.,

To bind internal table to table UI use bind_table( ) method.,

lo_nd_sort->bind_table( lt_tab ).

Thanks & Regards

Kiran

Former Member
0 Kudos

You cannot just simple bind any table to any node.

You need to have matching types.

What you can do is , see the structure of the SORT node use this structure instead of the String_table in my code.

lt_tab type string_table --> to the table type of the SORT

ls_name type string->struct type of SORT

This way you are making sure that there are no type mismatching.

Edited by: Baskaran Senthivel on Apr 1, 2011 3:44 PM

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks for all.

Former Member
0 Kudos

I tried that but this error appears in run time.

" Dynamic type conflict when assigning references "

Former Member
0 Kudos

Hi.

Now I get an error.

"wa..." cannot be converted to the line type of LT_COMP.

Regards and thank you for your help!

Former Member
0 Kudos

try this one ..

DATA:
lr_rtti_struc TYPE REF TO cl_abap_structdescr,
lt_comp TYPE cl_abap_structdescr=>component_table,
ls_comp like line of lt_comp,

lt_tab             type string_table,
ls_name       type string.
 
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_name( `spfli` ).
lt_comp = lr_rtti_struc->get_components( ).
 
loop at lt_comp into ls_comp.
clear ls_name.
ls_name = ls_comp-name.
append ls_name to lt_tab.
endloop.

Former Member
0 Kudos

My main difficulties are in coding.

I want to create a table with the elements of SPFLI table.

Regards

Former Member
0 Kudos

You need to do that with using RTTI.

See this wiki [http://wiki.sdn.sap.com/wiki/display/ABAP/RuntimeTypeServices(RTTS)|http://wiki.sdn.sap.com/wiki/display/ABAP/RuntimeTypeServices(RTTS)]

For example.

DATA:
lr_rtti_struc TYPE REF TO cl_abap_structdescr,
lt_comp TYPE cl_abap_structdescr=>component_table,
ls_comp like line of lt_comp,
wa_tabdescr type abap_compdescr,
lt_tab             type string_table,
ls_name       type string.

lr_rtti_struc ?= cl_abap_structdescr=>describe_by_name( `spfli` ).
lt_comp = lr_rtti_struc->get_components( ).

loop at lt_comp into wa_tabdescr.
clear ls_name.
ls_name = wa_tabdescr-name.
append ls_name to lt_tab.
endloop.

The lt_tab contains the names of the line types of the table. You can bind this table to the context_node with same structure and bind that to the TABLE UI.

Edited by: Baskaran Senthivel on Mar 31, 2011 9:56 PM

Former Member
0 Kudos

What is the problem here. You may have to explain your difficulties so that we can help you effectively.

Normally you need a context node with cardinality of 0..n or 1..n.

In the node create a attribute say col_name of type string.

Now fill the node or bind a internal table to context node.

Bind this node to the table UI dataSource property.