Skip to Content
0

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

Jan 23 at 09:02 AM

53

avatar image

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.

2.jpg (222.0 kB)
capture25.jpg (11.0 kB)
capture26.jpg (14.0 kB)
capture11.jpg (105.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Jan 24 at 05:26 AM
0

Hi Ali ,

If my understanding is right .. you need to SUM the whole Qty column in your report .. Right ?

Share
10 |10000 characters needed characters left characters exceeded
ali khojaloo Jan 24 at 05:51 AM
0

Hi kavi.

no , I want to sum the Component Column per material display like cs13.

look at the screenshot of CS13 . for material 10000004 Quantity = 0.327

in my query report material 10000004 have 4 rows quantity

0.093 , 0.186 ,0.024 , 0.024 ,

total of that EQ 0.327

Share
10 |10000 characters needed characters left characters exceeded