‎2005 May 06 6:23 AM
HI ,
I have 2 internal tables, itab and itab1.
how do I combine the two to get the output.
thanks
ajju
‎2005 May 06 6:29 AM
Hi,
Use your main itab in loop. Inside that based on the fields you have loop the other internal table or read records from that.Place the record in another internal table (say output).
Loop at itab.
output-field1 = itab-field1.
output-field2 = itab-field2.
read table itab1 with key field2 = itab-field2.
if sy-subrc eq 0.
output-field3 = itab1-field3.
....
append output.
endif.
endloop.
‎2005 May 06 6:30 AM
Hi,
If both tables have similar structure, you could use <b>APPEND LINES OF itab1 TO itab</b>. Otherwise, if the structure is not the same, then you might have to loop at itab1 and append corresponding columns to itab. Please get back if I haven't understood the question correctly.
Regards
Message was edited by: Shehryar Khan
‎2005 May 06 6:53 AM
Hi,
Try this out
LOOP AT i_output INTO w_output.
READ TABLE i_connect INTO w_connect
WITH KEY object_id = w_output-awkey.
IF sy-subrc = 0.
MOVE-CORRESPONDING w_connect TO w_output.
APPEND w_output TO i_output.
ENDIF. " SY_SUBRC
CLEAR: w_connect,
w_output.
ENDLOOP.
Can also do MODIFY i_output FROM w_output when u need to modify any fields further in the program.
Thanks & Regards,
Judith.
‎2005 May 06 8:27 AM
DATA itab_scarr TYPE STANDARD TABLE OF scarr.
DATA wa_scarr TYPE scarr.
DATA itab_scarr2 TYPE STANDARD TABLE OF scarr.
SELECT * FROM scarr
INTO TABLE itab_scarr.
wa_scarr-carrid = 'AA'.
wa_scarr-carrname = 'Aeroplane'.
wa_scarr-currcode = 'PKR'.
wa_scarr-url = 'www.pia.com.pk'.
APPEND wa_scarr TO itab_scarr2.
wa_scarr-carrid = 'AB'.
wa_scarr-carrname = 'AeroAsia'.
wa_scarr-currcode = 'PKR'.
wa_scarr-url = 'www.aeroasia.com.pk'.
APPEND wa_scarr TO itab_scarr2.
LOOP AT itab_scarr2 INTO wa_scarr.
APPEND wa_scarr TO itab_scarr.
ENDLOOP.
LOOP AT itab_scarr INTO wa_scarr.
WRITE: / wa_scarr.
ENDLOOP.
‎2005 May 06 7:58 PM
If you have the optin to define the table structure you may should ceck the ABAP docu regarding the PROVIDE statement.
Best Regards
Klaus