03-30-2013 4:17 AM
Hi all,
I am required to sort and show 2 lines if the customer no, sales order no the same.
I used the REUSE_ALV_GRID_DISPLAY FM for my ALV and have done the sorting.
Problem is despite having do the sorting for all the fields to be displayed in the ALV, the quantity field and amount fields still displayed for every line items despite the figures are the same. I need to be able to show 2 lines only since there are 2 different document no but it is showing 20 lines or more currently.
Required displayed
Doc 1 SO Quantity Amount
Doc 2 SO Quantity Amount
Currently display
Doc 1 SO Quantity Amount
Quantity Amount
Quantity Amount
Doc 2 SO Quantity Amount
Quantity Amount
Anyone knows what's wrong?
fkimg TYPE vbrp-fkimg, " Invoice Qty
wrbtr TYPE bsis-wrbtr, " Amount in doc curr
dmbtr TYPE bsis-dmbtr, " Amount in loc curr
03-31-2013 10:48 AM
hi
You can do this by the following below code
LOOP AT IT_FINAL INTO WA_FINAL.
AT END OF CONNID.
SUM.
WA_FINAL2-CARRID = WA_FINAL-CARRID.
WA_FINAL2-CONNID = WA_FINAL-CONNID.
*WA_FINAL2-FLDATE = WA_FINAL-FLDATE.
WA_FINAL2-PRICE = WA_FINAL-PRICE.
*WA_FINAL2-CITYFROM = WA_FINAL-CITYFROM.
APPEND WA_FINAL2 TO IT_FINAL2.
CLEAR WA_FINAL2.
ENDAT.
ENDLOOP.
Reward if you find w8
Thanks & Regards
RKarmakar
03-30-2013 4:48 AM
hi ,
change your loop statment instead of that try to use read syntax it will solve u r problem .
like ...
loop at internal table " this should be your main internal table where all records are coming
now try to use "read statment " inside the loop
endloop.
please, post the code if possible .
03-30-2013 5:02 AM
Hi Siong Chao Ng,
the internal table you r passing to the function module REUSE_ALV_GRID_DISPLAY contains the repeated records in it..... first correct there and you'll get the desired output... and you may get confused but there'll be two internal tables in the function module 1. the internal table with the field names and 2. internal table with the data of the fields.
Pls check there and post the progress with your issue.
Thanks,
ENOCH.
03-30-2013 7:38 AM
Hi,
The data is correct but something is wrong with the loop. Paste your code here. By the way, have you connected both the loops with key <doc>?
Regards
Purnand
03-30-2013 11:52 AM
Hi Siong ,
The sorting logic has to be corrected You may not be deleting the Repeated Entires.Do Proper looping based on the Keyfields.
Thanks,
Vijay.
03-30-2013 2:09 PM
03-31-2013 10:48 AM
hi
You can do this by the following below code
LOOP AT IT_FINAL INTO WA_FINAL.
AT END OF CONNID.
SUM.
WA_FINAL2-CARRID = WA_FINAL-CARRID.
WA_FINAL2-CONNID = WA_FINAL-CONNID.
*WA_FINAL2-FLDATE = WA_FINAL-FLDATE.
WA_FINAL2-PRICE = WA_FINAL-PRICE.
*WA_FINAL2-CITYFROM = WA_FINAL-CITYFROM.
APPEND WA_FINAL2 TO IT_FINAL2.
CLEAR WA_FINAL2.
ENDAT.
ENDLOOP.
Reward if you find w8
Thanks & Regards
RKarmakar
04-01-2013 5:21 AM
Hey Raju,
The quantity field and amount field can be summed up. (10 lines reduced to 1 line per doc no)
But all my other data for instance document date, doc type, reference no, sales doc, item no, broker no, terms of pymt, document currency etc fields all showing ************. I need to be able to display all these fields correctly as well.
In addition, what about those field that I do not want to be summed like exchange rate? I need to exclude fields I do not want to be summed.
04-01-2013 5:46 AM
Hello Siong Chao Ng,
Use another workarea and move those work area fields into another one before the at new or at end statement.
Thanks,
Vijay.
04-01-2013 6:25 AM
Hi,
Plz before use the itab inside the FM 'REUSE ALV GRID_DISPLAY ' you have to sort the itab
then used delete the duplicate records by using the syntax....
syntax:
delete adjacent duplicates from itab comparing all fields .
whichever field u want to take u can take as ur reqirment .
thanks & regards
suraj singh