Application Development 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: 

MBLNR & MATNR wise Total

former_member203806
Participant
0 Kudos

Hi All

I have internal table ,( MBLNR,MATNR,MENGE ,ect...)

I need to add MBLNR wise MATNR wise Quantity (MENGE).

(Same MBLNR Total Quantity for same Material )

How can  i do it....

Rgds

pramod

1 ACCEPTED SOLUTION

former_member209818
Active Contributor
0 Kudos

Hi Pramod,

Fist sort the Internal table by MBLNR and MATNR.

Then make use of Statements "AT NEW" or ON CHANGE OF inside the loop of the internal table to achieve the necessary results.

- Harshad

7 REPLIES 7

former_member199214
Participant
0 Kudos

Hi Pramod pathirana,

You can use Sum or collect as per your requirement.Search in SCN there are many examples for that.

Regards,

Sindhuja.

former_member209818
Active Contributor
0 Kudos

Hi Pramod,

Fist sort the Internal table by MBLNR and MATNR.

Then make use of Statements "AT NEW" or ON CHANGE OF inside the loop of the internal table to achieve the necessary results.

- Harshad

0 Kudos

HI Harshan

in this case i cant use AT new , Because here i need to add MENG, MBLNR wise & MATNR wise....

rgds

pramod

thangam_perumal
Contributor
0 Kudos

Hi Prmod,

                There is many way we can achieve your requirements.

1.  while looping  at new, on change of.

2. Using Collect statements.,...

DATA: BEGIN OF seats,
        carrid   TYPE sflight-carrid,
        connid   TYPE sflight-connid,
        seatsocc TYPE sflight-seatsocc,
      END OF seats.

DATA seats_tab LIKE HASHED TABLE OF seats
               WITH UNIQUE KEY carrid connid.

SELECT carrid connid seatsocc
       FROM sflight
       INTO seats.
  COLLECT seats INTO seats_tab.
ENDSELECT.

0 Kudos

hi Thangam Perumal

when am using AT NEW , How can i use it for sane requirement...

in my coding i am using it, but not working...

rgds

prmaod

former_member212148
Participant
0 Kudos

Hi Pramod,

Just sort the internal table by mblnr and matnr.

display report in ALV.

ALV has functionality to complete your requirement.

Sum quantity and and subtotal wise material and material document.

Former Member
0 Kudos

Hi Pramod,

try this code ....

Keep matnr and mblnr as first field in ur internal table.

SORT itab by MATNR and mblnr

Loop at itab.

if  issued.

  v_issued = v_issued+itab-menge.

elseif recepts

v_recept = v_recepts _ itab_menge.

When there is a change in matnr and mblnr   

add the quantities into reqd internal table