‎2008 May 13 5:28 AM
Dear All,
I have the internal table like this. I want total for DMBTR, based on BELNR, EBELN.
BELNR EBELN LIFNR DMBTR BUDAT
1500000018|4500002958|ROYAL | 500.00 |20080512
1500000018|4500002957|ROYAL | 5000.00 |20080512 1500000018|4500002957|ROYAL | 6000.00 |20080512
1500000018|4500002558|ROYAL | 5000.00 |20080512
1500000018|4500002958|ROYAL | 500.00 |20080512 1500000019|4500002958|ROYAL | 500.00 |20080512
1500000019|4500002958|ROYAL | 1500.00 |20080512
I WANT OUTPUT LIKE
BELNR EBELN LIFNR DMBTR BUDAT
1500000018|4500002558|ROYAL | 5000.00 |20080512
1500000018|4500002957|ROYAL |11000.00 |20080512
1500000018|4500002958|ROYAL | 1000.00 |20080512
1500000019|4500002958|ROYAL 2000.00 |20080512
Which is the suitable code for above output??
Thanks and Regards
Suresh
‎2008 May 13 5:34 AM
Use collect while passing the same records to another internal table.
or use control break statements.
Try it it will work.
Regards,
madan.
‎2008 May 13 5:35 AM
Hi,
1. First sort the internal table ascending by BELNR and EBELN.
Sort itab by belnr ebeln ascending.
2. Loop at itab into ls_itab.
at end of ebeln.
sum.
append ls_itab to itab1.
endat.
endloop.
3. loop at itab1.
print on the screen****
endloop.
Thank you.
Reward points if found useful.
‎2008 May 13 5:35 AM
BELNR EBELN LIFNR DMBTR BUDAT
1500000018|4500002558|ROYAL | 5000.00 |20080512
1500000018|4500002957|ROYAL |11000.00 |20080512
1500000018|4500002958|ROYAL | 1000.00 |20080512
1500000019|4500002958|ROYAL 2000.00 |20080512
Hi,
Loop at table.
at end of lifnr.
move belnr ebeln lifnr to new table.
append to some other table.
clear amt.
endat.
amt = amt + table-amt.
endloop.
‎2008 May 13 5:36 AM
Declare Itab1 which is of the same type as Itab.
Sort itab by BELNR EBELN.
LOOP AT itab.
COLLECT itab INTO itab1.
ENDLOOP.
‎2008 May 13 5:44 AM
Hi,
declare
a variable l_EBELN
a flag type i value 0
sum like DMBTR.
First sort the internal table by 'BELNR' 'EBELN'. then loop at the table into an workarea (wa).
Apply the following logic.......
if l_ebeln <> wa-ebeln and flag = 1 (it not the first record).
print data.
l_ebeln = wa-ebeln.
sum = wa-DMBTR.
else
flag = 1.
l_ebeln = wa-ebeln.
sum =sum + wa-DMBTR.
endif
‎2008 May 13 5:47 AM
Hi Friend,
While useing inner join u can use like this.
as shown below.
SELECT abelnr aebeln a~lifnr
SUM( bdmbtr ) abudat
INTO some itab
it will show sum of ur field dmbtr
Reward points if usefull.