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: 

Alv..handling at new event in ALV

Former Member
0 Kudos
63

Hi,

I have a problem in ALV. In the report I have to sum up the cols displaying Sales Order and the col displaying P.O #. However while summing for the same sales order there is a one to one correspondence with the P.O

eg . SO # PO #

3301 1000

3301 1000

3301 1000

SO Total = 3 PO Total =3

However I want the PO # count to be 1. I have handeled this in a simple Abap report using the event at new vbeln po cnt = po cnt + 1.

Could you please tell me how to handle this in ALV.

Thanks..

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos
35

Hi,

here in ALV you need to handle that with sort table.

sort-fieldname = 'VBELN'.

sort-up = 'X'.

sort-group = '*'. "triggers new page for each vbeln change

append sort to it_sort.

sort-fieldname = 'EBELN'. "PO

sort-up = 'X'.

sort-group = '*'.

append sort to it_sort.

now pass this to alv fm, for sort parameter.

but you won't get the count of PO's as you required, byt you can group them in one page or with line separator.

Regards

vijay

Former Member
0 Kudos
35

hi arup,

you can handle this in your itab itself..

where you can add an additional po_count field..

data : begin of itab occurs 0.
       include structure vbap.
data : po_count type i,
       end of itab.

 loop at itab.
  at new vbeln.
    itab-po_count = 1.
    modify itab .
    continue. 
  endat.
    itab-po_count = 0.
     modify itab .
  endloop

.

this will add a one to all the new Sales orders in po_count and zero to all the repetitive ones..

something like this..

so# po# po_count

3301 1000 1

3301 1000 0

3301 1000 0

3302 1000 1

3302 .... 0

you can then sum this field using the ALV option to get the result

i.e in the field cat use.

do_sum = 'X'. on the po_count field

...this one worked well for me..

hope this helps you.

regards

satesh