cancel
Showing results for 
Search instead for 
Did you mean: 

Join Internal table column headers separated by #(tab)?

sh4il3sh
Participant
0 Kudos

Hello Experts,

I have an internal table which is of Dynamic Type created as below:


METHOD BUILD_LOG:
FIELD-SYMBOLS: <lt_tabinput> TYPE ANY TABLE.
ASSIGN (iv_tabname) TO <lt_tabinput>. "iv_taname is importing param of method.
ENDMETHOD.

above makes <lt_tabinput> like GT_GENERAL (which is global table in class)

and looks like:



I want to create a string line which goes like:
FLGDEFAULT_ADR12#URI_ADDR#URI_TYPE#TELNR_LONG#COUNTRY_ADR2#R3_USER#DFT_RECEIV

I tried utilising DDIF_FIELDINFO_GET but entered into a runtime error because I think this internal table doesn't relate to any repository object?

Need some advice to achieve this or I'll have to rewrite lots of logic.

Regards,
Shailesh

Sandra_Rossi
Active Contributor

To create dynamically or read type descriptions of ABAP data objects (variables, internal tables, etc.) at runtime, use Run Time Type Services (RTTS) = cl_abap_typedescr and so on.

View Entire Topic
jack_graus2
Active Contributor
lv_string = REDUCE #(
  INIT lv_tabinput = ``
  FOR <ls_component> IN 
    CAST cl_abap_structdescr(
      CAST cl_abap_tabledescr(
        cl_abap_tabledescr=>describe_by_data( <lt_tabinput> ) )->get_table_line_type( )
      )->get_components( )
  INDEX INTO lv_index
  NEXT lv_tabinput &&= COND #( WHEN lv_index GT 1 THEN `#` ) && <ls_component>-name ).
sh4il3sh
Participant
0 Kudos

WOW! Amazing.
I didnt know we could cast inside FOR LOOP.
new syntax is beautiful, gotta share this with my peers.

haha, I had a solo loop running over get_table_line_type( )-component.