Application Development and Automation 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: 
Read only

sq02 - infoset query code for extra field

Former Member
0 Likes
736

Hi.

I am new to ABAP and I will need some help.

I have made an infoset based on table MBEWH.

I need to get the total of quantity of table MSEG per plant for a certain period and for certain movement types.

I created an extra field "ANAL" and in extra code for the field I wrote:

after

SELECT * FROM mkpf INNER JOIN mseg ON.........





CHECK sy-subrc = 0.

CLEAR ANAL.

SORT ITAB BY werks bwart.

LOOP AT itab INTO wa.

  AT NEW werks.

  CLEAR ANAL.

  ENDAT.

  IF wa-shkzg = 'H'.

    wa-menge = wa-menge * ( -1 ).

    ENDIF.

  IF wa-bwart = '201' or wa-bwart = '202'.

  ADD wa-menge to ANAL.

  ENDIF.

ENDLOOP.


which works fine if a have selected only one plant.


For more plants, it displays always the last value calculated (as you can see at attached picture).


Could you please help me how I will give a different value per plant?


Thanks in advance.


Hi.

I am new to ABAP and I will need some help.

I have made an infoset based on table MBEWH.

I need to get the total of quantity of table MSEG per plant for a certain period and for certain movement types.

I created an extra field "ANAL" and in extra code for the field I wrote:

after

SELECT * FROM mkpf INNER JOIN mseg ON.........





CHECK sy-subrc = 0.

CLEAR ANAL.

SORT ITAB BY werks bwart.

LOOP AT itab INTO wa.

  AT NEW werks.

  CLEAR ANAL.

  ENDAT.

  IF wa-shkzg = 'H'.

    wa-menge = wa-menge * ( -1 ).

    ENDIF.

  IF wa-bwart = '201' or wa-bwart = '202'.

  ADD wa-menge to ANAL.

  ENDIF.

ENDLOOP.


which works fine if a have selected only one plant.


For more plants, it displays always the last value calculated (as you can see at attached picture).


Could you please help me how I will give a different value per plant?


Thanks in advance.


1 REPLY 1
Read only

Former Member
0 Likes
460

Any ideas please?