09-11-2006 7:49 PM
Hi All,
I need to add some code at the subtotal level of the ALV report output. My output shound look something like this.
FLD1 FLD2 FLD3 FLD4
A1 B1 1 AA
A1 B1 2 BB
<i><b>Sum A1 B1 3 C</b></i>
A1 B2 11 D1
A1 B2 22 D2
<i><b>Sum A1 B2 33 CD</b></i>
B1 B1 1 D1
<i><b>Sum B1 B1 1 CCD</b></i>
B1 B2 5 D1
<i><b>Sum B1 B2 5 CCDD</b></i>
I should be able insert a summation level into the output so that the FLD4 can be changed based on the total of FLD3 at the summation level.
Please let me know if this is a possibility atleast.
Thanks in advance..!
Jr.
Message was edited by: Jr Abaper
09-11-2006 7:54 PM
You need to build a sort table with feild you want to have for subtoal by setting one of attributes subtot = 'X'.
Data:
dt_sortcat TYPE slis_t_sortinfo_alv, "table - sort table
ds_sortcat LIKE LINE OF dt_sortcat, "structure-sort structure
ds_sortcat-spos = '1'.
ds_sortcat-fieldname = 'VBELN'.
ds_sortcat-tabname = 'IT_DATA'.
ds_sortcat-up = 'X'.
ds_sortcat-down = space.
ds_sortcat-subtot = 'X'.
APPEND ds_sortcat TO dt_sortcat.
ds_sortcat-spos = '2'.
ds_sortcat-fieldname = 'POSNR'.
ds_sortcat-tabname = 'IT_DATA'.
ds_sortcat-up = 'X'.
ds_sortcat-down = space.
APPEND ds_sortcat TO dt_sortcat.
and pass the sort table to the exporting parameter IT_SORT of the REUSE_ALV_GRID_DISPLAY function module.
For Demo programs: Go to se38 and enter BCALV* and press F4 key you will get list of ALV demo programs
Message was edited by: Sid
09-11-2006 7:58 PM
Hi Sid,
Thanks for the reply..!
But my problem is with FLD4:
I should be able change the FLD4 value (which is a char field )at the subtotal line based on the total of FLD3 at the summation level.
Let me know how to achieve this or if this is even possible? Can it be done in a List Display?
Thanks again,
Jr.
Message was edited by: Jr Abaper