08-29-2006 4:39 AM
Dear all,
Pls follow the code and suggest me to get the specified format.
Consider that i have created a view to populate the reqd data and collect those in an internal table and do a calculation for one field and modify the internal table.
when i pass this internal table to the function reuse_alv_grid , it throws out a report. But if i need to group the records of the internal table based on three fields, can i do that , if so , how should i do that, if not what method shud i adopt to get the grouped listing in ALV.
kindly give your views.
Code goes here..........
select distinct edatu j_3akvgr6 mvgr4 matnr bismt vbeln auart bstkd bstkd_e ihrez_e
bstdk_e bstdk bezei vrvez brgew ntgew volum werks kwmeng j_3asize posnr
INTO CORRESPONDING FIELDS OF TABLE itabdelshd
from ZVDELISHED
where J_3AKVGR6 IN CUSTOMER AND AUART IN ORDTYP
AND BISMT IN STYLE AND MATNR in FGMtrl AND bstdk_e IN PLNDATE
AND J_3ASIZE IN GRIDVAL and werks in plant and mvgr4 in ppmon and
bstkd in cpono and vbeln in Sales.
LOOP AT itabdelshd INTO wadelshd.
select sum( wmeng ) as tqty into wasumqty-tqty
from vbep where edatu = wadelshd-edatu and vbeln = wadelshd-vbeln
and j_3asize = wadelshd-j_3asize.
select sum( lfimg ) as dqty into wasumqty-dqty
from lips where vbelv = wadelshd-vbeln and j_3asize = wadelshd-j_3asize
.
wadelshd-PLND_QTY = wasumqty-tqty - wasumqty-dqty.
wadelshd-PLND_QTY = wadelshd-wmeng - wadelshd-lfimg.
wadelshd-COLOR = wadelshd-j_3asize(4).
MODIFY itabdelshd FROM wadelshd.
ENDLOOP.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
08-29-2006 10:24 AM
SORT THE ITAB (TYPE) YOU ARE SENDING TO THE ALV ACCORDING TO THE 3 FIELDS BEFORE THE OUTPUT:
SORT ITAB BY FIELD1 FIELD2 FIELD3.
did this help?
If not: post reply
If it did: please be so kind to reward, thanx
Message was edited by: Christoph Balduck
08-29-2006 10:24 AM
SORT THE ITAB (TYPE) YOU ARE SENDING TO THE ALV ACCORDING TO THE 3 FIELDS BEFORE THE OUTPUT:
SORT ITAB BY FIELD1 FIELD2 FIELD3.
did this help?
If not: post reply
If it did: please be so kind to reward, thanx
Message was edited by: Christoph Balduck
08-30-2006 6:00 AM
Dear Jorge,
It is working out, But i need to do the sum for the grouped data, for instance , if the below data is grouped data seen in the alv,
-
sales ord | color line.Item| Ord.qty | Pld.Qty | Date "
-
| 0001000551 | 002V | 100 | 6,800.000 | 1,200.000 | 25.09.2006"
| 0001000551 | 002V | 100 | 6,800.000 | 2,500.000 | 25.09.2006"
| 0001000551 | 002V | 100 | 6,800.000 | 3,100.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 700.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 1,200.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 1,300.000 | 25.09.2006"
and if want to sum the the planed qty based on the line.Item Grouping, meaning, can i get the report in the below form.
-
sales ord | color line.Item| Ord.qty | Pld.Qty | Date "
-
| 0001000551 | 002V | 100 | 6,800.000 | 6,800.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 6,800.000 | 3,200.000 | 25.09.2006"
-
what should i do to get this form.
08-30-2006 9:52 AM
Hi,
one option is as Prasanth Ponnaganti has just informed. Additionally, SLIS_T_SORTINFO_ALV has, among others,GROUP & SUBTOT. I think this is going to solve your problem (never tried it).
information for sort and subtotals
types: begin of slis_sortinfo_alv,
spos(2) type n,
spos like alvdynp-sortpos,
fieldname type slis_fieldname,
tabname type slis_fieldname,
up(1) type c,
down(1) type c,
group(2) type c,
subtot(1) type c,
up like alvdynp-sortup,
down like alvdynp-sortdown,
group like alvdynp-grouplevel,
subtot like alvdynp-subtotals,
comp(1) type c,
expa(1) type c,
obligatory(1) type c,
end of slis_sortinfo_alv.
08-29-2006 11:43 AM
Hi,
you have to provide parameter IT_SORT with the fields that you want to sort and group your data:
data: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
IT_SORT-spos = '01'.
IT_SORT-fieldname = 'myfield'.
append IT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_structure_name = 'SFLIGHT'
is_variant = my_variant
i_default = 'X'
i_save = 'A'
<b> IT_SORT = it_sort</b>
it_fieldcat = field_catal
it_events = events
TABLES
t_outtab = my_table.
08-30-2006 6:08 AM
Dear Raja,
The structure IT_FIELDCAT has a field 'DO_SUM'. Put the value 'X' for the particular column and try.
Regards,
Prasanth