07-15-2008 12:33 PM
Hi,
i would like to append some data from an internal table into another internal table that has no header line.
The code looks like this :
FIELD-SYMBOLS :
<ls_uom> TYPE bapi_marm_ga,
<ls_uom2> type ZMM_EXTRACT_UOM.
DATA : tt_uom LIKE STANDARD TABLE OF bapi_marm_ga,
tt_uom2 type table of ZMM_EXTRACT_UOM.
CALL FUNCTION 'BAPI_MATERIAL_GETALL'
EXPORTING
material = p_matnr
TABLES
unitsofmeasure = tt_uom.
LOOP AT tt_uom ASSIGNING <ls_uom>.
*Appending some datas from tt_uom into tt_uom2
ENDLOOP.
The problem is that my itabs do not have the same structure.
How can i add those fields of tt_uom into tt_uom2
Thanks in advance
07-15-2008 12:38 PM
try this:
FIELD-SYMBOLS :
<ls_uom> TYPE bapi_marm_ga,
<ls_uom2> type ZMM_EXTRACT_UOM.
DATA : tt_uom LIKE STANDARD TABLE OF bapi_marm_ga,
tt_uom2 type table of ZMM_EXTRACT_UOM,
w_uom2 like line of tt_uom2.
CALL FUNCTION 'BAPI_MATERIAL_GETALL'
EXPORTING
material = p_matnr
TABLES
unitsofmeasure = tt_uom.
LOOP AT tt_uom ASSIGNING <ls_uom>.
w_uom2-fld1 = <ls_uom>-fld1.
....
w_uom2-fldn = <ls_uom>-fldn.
append w_uom2 to tt_uom2.
ENDLOOP.
Regards,
Joy.
07-15-2008 12:37 PM
Hi,
loop at lt_mara into ls_mara.
*Different field names. I am moving matnr to another field ernam *for matnr
move ls_mara-matnr to it2_mara-ernam.
append it2_mara.
endloop.
Thanks & Regards,
Nagaraj Kalbavi
07-15-2008 12:38 PM
try this:
FIELD-SYMBOLS :
<ls_uom> TYPE bapi_marm_ga,
<ls_uom2> type ZMM_EXTRACT_UOM.
DATA : tt_uom LIKE STANDARD TABLE OF bapi_marm_ga,
tt_uom2 type table of ZMM_EXTRACT_UOM,
w_uom2 like line of tt_uom2.
CALL FUNCTION 'BAPI_MATERIAL_GETALL'
EXPORTING
material = p_matnr
TABLES
unitsofmeasure = tt_uom.
LOOP AT tt_uom ASSIGNING <ls_uom>.
w_uom2-fld1 = <ls_uom>-fld1.
....
w_uom2-fldn = <ls_uom>-fldn.
append w_uom2 to tt_uom2.
ENDLOOP.
Regards,
Joy.
07-15-2008 12:41 PM
hiiii
you can use following code for appending data from one itab to another.if both is having different structure then also it will work
LOOP AT i_output INTO wa_output.
READ TABLE i_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
*here you can use move corresponding or individual fields.*
wa_output-lgort = wa_mard-lgort.
MODIFY i_output FROM wa_output.
CLEAR wa_output.
ENDLOOP. " LOOP AT i_output
regards
twinkal.
07-15-2008 12:46 PM