Skip to Content
0

how to append multiple line items in it_final from it_covp table's loop

Jan 23, 2017 at 05:01 PM

117

avatar image

Hi

My issue is , i cannot be able to print 9 line items which is present in it_covp table, i am using modify statement, by using this statement only last line item is getting ,i tried with append statement in place of modify , but repeated number of lineitems is showing in it_final table, please help in this regard.


LOOP AT IT_PRPS INTO WA_PRPS.
* IF SY-SUBRC = 0.

* WA_FINAL-POSID = WA_PRPS-POSID.
WA_FINAL-POSKI = WA_PRPS-POSKI.
WA_FINAL-PSPHI = WA_PRPS-PSPHI.
WA_FINAL-ERDAT = WA_PRPS-ERDAT.
WA_FINAL-OBJNR = WA_PRPS-OBJNR.

* ENDIF.

APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.

ENDLOOP.

IF IT_COVP[] IS NOT INITIAL.
LOOP AT IT_FINAL INTO WA_FINAL.

LOOP AT IT_COVP INTO WA_COVP WHERE OBJNR = WA_FINAL-OBJNR.


WA_FINAL-BELNR = WA_COVP-BELNR.
WA_FINAL-BUZEI = WA_COVP-BUZEI.
WA_FINAL-PERIO = WA_COVP-PERIO.
WA_FINAL-WTGBTR = WA_COVP-WTGBTR.
WA_FINAL-WKGBTR = WA_COVP-WKGBTR.
WA_FINAL-MEGBTR = WA_COVP-MEGBTR.
WA_FINAL-LEDNR = WA_COVP-LEDNR.
WA_FINAL-OBJNR = WA_COVP-OBJNR.
WA_FINAL-GJAHR = WA_COVP-GJAHR.
WA_FINAL-BEKNZ = WA_COVP-BEKNZ.
WA_FINAL-KSTAR = WA_COVP-KSTAR.
WA_FINAL-TWAER = WA_COVP-TWAER.
WA_FINAL-GKONT = WA_COVP-GKONT.
WA_FINAL-EBELN = WA_COVP-EBELN.
WA_FINAL-EBELP = WA_COVP-EBELP.
WA_FINAL-BUKRS = WA_COVP-BUKRS.
WA_FINAL-WERKS = WA_COVP-WERKS.
WA_FINAL-BUDAT = WA_COVP-BUDAT.
WA_FINAL-USNAM = WA_COVP-USNAM.
WA_FINAL-REFBN = WA_COVP-REFBN.
WA_FINAL-BLART = WA_COVP-BLART.
WA_FINAL-BLTXT = WA_COVP-BLTXT.
WA_FINAL-AWTYP = WA_COVP-AWTYP.
WA_FINAL-CPUTM = WA_COVP-CPUTM.



READ TABLE IT_PROJ INTO WA_PROJ WITH KEY PSPNR = WA_FINAL-PSPHI.
IF SY-SUBRC = 0.

WA_FINAL-PSPID = WA_PROJ-PSPID.
WA_FINAL-WERKS = WA_PROJ-WERKS.


ENDIF.

READ TABLE IT_EKKO INTO WA_EKKO WITH KEY EBELN = WA_FINAL-EBELN .
IF SY-SUBRC = 0.
WA_FINAL-BEDAT = WA_EKKO-BEDAT.
WA_FINAL-LIFNR = WA_EKKO-LIFNR.

ENDIF.

MODIFY IT_FINAL FROM WA_FINAL.
CLEAR WA_FINAL.

ENDLOOP.

ENDLOOP.
ENDIF.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Raghu Govindarajan Jan 23, 2017 at 05:37 PM
0

Get the loop index from the outer loop, store it in a variable and then use that index on the Modify. MODIFY itab FROM workarea INDEX outer_loop_index.

Share
10 |10000 characters needed characters left characters exceeded