Skip to Content
0
Jan 23, 2018 at 09:02 AM

Code for SUM of Component quantity for similar material in sap Query

205 Views Last edit Jan 24, 2018 at 05:03 AM 6 rev

Hi

I Create query for BOM Explosion by FM 'CS_BOM_EXPL_MAT_V2' for multi material.

Cs13 display report like this :

my query report display like this :

how can i change the query and create abap code for sum of the Component quantity in my query.field related to these

please tell me the code for loop .

this code dosen't work:

TYPES : BEGIN OF ty_STPOX,
MNGLG TYPE STPOX-MNGLG,
IDNRK TYPE STPOX-IDNRK,
END OF ty_STPOX.
DATA : it_STPOX TYPE TABLE OF ty_STPOX,
wa_STPOX TYPE ty_STPOX.
DATA : g_sum TYPE i.
IF sy-subrc EQ 0.
LOOP AT it_STPOX INTO wa_STPOX.
g_sum = g_sum + wa_STPOX-IDNRK.
COMPONENTQUANTITY = g_sum.
ENDLOOP.
CLEAR g_sum.
ENDIF.

Attachments

2.jpg (222.0 kB)
capture25.jpg (11.0 kB)
capture26.jpg (14.0 kB)
capture11.jpg (105.3 kB)