Skip to Content
0
Former Member
Aug 29, 2006 at 03:39 AM

Grouping records in an internal table

125 Views

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.