Skip to Content
0
Former Member
Jun 13, 2016 at 07:19 AM

problem in report to display total quantity

26 Views

Hello Experts,

I am displaying three fields in my report . i wants total po quantity against vendor.

how i can display.

PLEASE REFER FOLLOWING CODE.

form GET_DATA .

SELECT LIFNR EBELN FROM EKKO INTO TABLE IT_EKKO

WHERE LIFNR IN S_LIFNR.

IF NOT IT_EKKO[] IS INITIAL.

SELECT EBELN ELIKZ MENGE FROM EKPO INTO TABLE IT_EKPO

FOR ALL ENTRIES IN IT_EKKO

WHERE EBELN = IT_EKKO-EBELN

AND ELIKZ = ''.

SELECT LIFNR TOTAL_STOCK UNIT FROM ZVENDOR_STOCK INTO TABLE IT_STOCK

FOR ALL ENTRIES IN IT_EKKO

WHERE LIFNR = IT_EKKO-LIFNR.

ENDIF.

endform. " GET_DATA

*&---------------------------------------------------------------------*

*& Form COMBINE_DATA

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

form COMBINE_DATA .

DATA : SUM_MENGE(13) TYPE C.

LOOP AT IT_EKKO INTO WA_EKKO.

* WA_FINAL-EBELN = WA_EKPO-EBELN.

WA_FINAL-LIFNR = WA_EKKO-LIFNR.

WA_FINAL-EBELN = WA_EKKO-EBELN.

READ TABLE IT_EKPO INTO WA_EKPO WITH KEY EBELN = WA_FINAL-EBELN .

WA_FINAL-SUM_MENGE = WA_FINAL-SUM_MENGE + WA_EKPO-MENGE.

* COLLECT WA_FINAL-MENGE INTO IT_FINAL.

**** data : sum_menge(13) type c.

****LOOP AT it_ekpo INTO wa_ekpo.

**** AT NEW ebeln .

**** sum_menge = sum_menge + wa_ekpo-menge.

**** ENDAT.

****wa_final-menge = sum_menge.

****MODIFY it_final FROM wa_final.

****CLEAR: sum_menge.

READ TABLE IT_STOCK INTO WA_STOCK WITH KEY LIFNR = WA_FINAL-LIFNR.

*on change of wa_ekko-lifnr.

WA_FINAL-TOTAL_STOCK = WA_STOCK-TOTAL_STOCK.

APPEND WA_FINAL TO IT_FINAL.

*modify it_final from wa_final.

*endon.

CLEAR:WA_FINAL , WA_EKKO , WA_EKPO , WA_STOCK .

ENDLOOP.

endform. " COMBINE_DATA