‎2011 Aug 18 7:19 AM
Hi,
One of my internal table is filled from transparent table. Second internal table is created using RTTI ( dynamic table ). I want to fill the second table by looping on the first table and moving matching fields and other fields based on conditions. How to do it? how to compare the table of two fields during runtime, and then move. Kindly help me out in filling the 2nd table.
new_type = cl_abap_structdescr=>create( fcat_table ).
TRY.
CALL METHOD CL_ABAP_TABLEDESCR=>CREATE
EXPORTING
P_LINE_TYPE = new_type
P_TABLE_KIND = cl_abap_tabledescr=>tablekind_std
P_UNIQUE = ABAP_FALSE
P_KEY =
P_KEY_KIND = KEYDEFKIND_DEFAULT
RECEIVING
P_RESULT = new_tab
.
CATCH CX_SY_TABLE_CREATION .
ENDTRY.
ASSIGN tab_records->* to <disp_tab>.
CREATE DATA tab_line like line of <disp_tab>.
LOOP AT i_validn_categ ASSIGNING <struc_dbtable>.
ENDLOOP.
Regards,
DPM
‎2011 Aug 18 8:41 AM
‎2011 Aug 18 8:43 AM
Do you want to check the FIELDNAME and then you want to move the value to other table
or
simply you want to push the records from one tab to other tab?
‎2011 Aug 18 10:11 AM
Yes, some fields are common. There is one field in 1st internal table, which is split across many fields in 2nd table, most of the remaining fields are same in both the tables. So based on condition value will move to field in 2nd bucket.
Thanks,
DPM
‎2011 Aug 18 10:15 AM
Hi
You need to use the field-symbol, but how depends on the conditions you need
Max
‎2011 Aug 18 10:17 AM
Hello,
Loop at the tab1 to tab1 work area.
move corresponding fields of tabl wa to tab2 wa.
modify tab2 from tab2 work area.
end the loop.
This is a method of transferring datas from one table to another
Rgds
Siva
‎2011 Aug 18 4:49 PM
My Team Lead helped in resolving the issue. Thanks to all of you for your support.
Solution:
I was trying to fill the empty dynamic table from another table which was already filled. I changed the approach and instead filled a known field of a dynamic table from database table followed by:
looping at dynamic internal table and assigning component of structure ,then using read table from the 1st table( already filled using select query from dbtable), I managed to fill the other fields.
Regards,
DPM
‎2015 Sep 20 8:49 PM
‎2015 Sep 21 2:38 AM
Hi,
Please check the "Last Logged In:" of DEBOPRIYO MALLICK......
Regards .