Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Append into itab with no header line

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

4 REPLIES 4

former_member70391
Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks a lot everybody.

Joys' answer worked perfectly