08-08-2012 12:48 PM
I have a report requirement that says, on a given billing date, check if a customer has brought the same material more than once and that to from the same batch. If yes, the quantity should be summed up together. How do I display the calculated value in an ALV grid report?
This is the part where I'm being stuck; I don't where I've made a mistake since no errors come. Can anyone help me?
LOOP AT lt_final INTO wa_final.
wa_display-fkdat = wa_final-fkdat.
AT NEW chkcharg.
SUM.
ENDAT.
wa_display-kunrg = wa_final-kunrg.
wa_display-fkart = wa_final-fkart.
wa_display-matnr = wa_final-matnr.
wa_display-fkimg = wa_final-fkimg.
wa_display-bonusunit1 = wa_final-bonusunit1.
wa_display-billedqty1 = wa_final-billedqty1.
wa_display-chkcharg = wa_final-chkcharg.
wa_display-chkvfdat = wa_final-chkvfdat.
wa_display-preis = wa_final-preis.
wa_display-bwaer = wa_final-bwaer.
wa_display-dcode = 189010.
CONCATENATE sy-datum+6(2) '/' sy-datum+4(2) '/' sy-datum+0(4) INTO wa_display-sourceext.
APPEND wa_display TO lt_display.
CLEAR wa_display.
ENDLOOP.
Thank you for your time.
09-08-2012 7:36 PM
Assuming the structure of it_final as
First field - Customer
Second - Material
Third - Batch
Forth - Billing Date
..and then comes the rest of fields
DATA index TYPE i.
LOOP AT lt_final INTO wa_final.
index = index + 1.
CHECK index GE 2.
AT END OF Billing Date.
CLEAR: index.
SUM.
MOVE THE Quantity field of wa_final TO wa_display.
ENDAT.
CHECK wa_display-quanity IS NOT INITIAL.
"move all other fields of wa_final TO wa_display.
APPEND wa_display TO lt_display.
CLEAR wa_display.
ENDLOOP.
Then make a fieldcatalog for your display table
and use the function module REUSE_ALV_GRID_DISPLAY .
09-08-2012 7:36 PM
Assuming the structure of it_final as
First field - Customer
Second - Material
Third - Batch
Forth - Billing Date
..and then comes the rest of fields
DATA index TYPE i.
LOOP AT lt_final INTO wa_final.
index = index + 1.
CHECK index GE 2.
AT END OF Billing Date.
CLEAR: index.
SUM.
MOVE THE Quantity field of wa_final TO wa_display.
ENDAT.
CHECK wa_display-quanity IS NOT INITIAL.
"move all other fields of wa_final TO wa_display.
APPEND wa_display TO lt_display.
CLEAR wa_display.
ENDLOOP.
Then make a fieldcatalog for your display table
and use the function module REUSE_ALV_GRID_DISPLAY .
10-04-2012 8:05 AM
Hello and thank you for taking time to help.
the structure of lt_final is :
TYPES: BEGIN OF t_final,
fkdat(10) TYPE c,
dcode(6) TYPE n,
kunrg LIKE vbrk-kunrg,
fkart LIKE vbrk-fkart,
matnr LIKE vbrp-matnr,
fkimg LIKE vbrp-fkimg,
pstyv LIKE vbrp-pstyv,
qty LIKE vbrp-fkimg,
billedqty1 LIKE vbrp-fkimg,
bonusunit1 LIKE vbrp-fkimg,
preis LIKE eipa-preis,
bwaer LIKE eipa-bwaer,
chkcharg LIKE mch1-charg,
chkvfdat(10) TYPE c,
sourceext(10) TYPE c,
END OF t_final.
DATA: lt_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0, "itab
wa_final TYPE t_final.
I will try the code and see. Thank you once again.