12-11-2008 3:42 PM
Dear Friends,
I having an requirement. I have ALV report which shows the PO details as mentioned below.
-
PO No PO Item PO Quan PO Val GR No GR Qan GR Val GR Date Pur.Req No etc
-
12344 10 50.000 500.00 A12 15.000 150.00 10.12.2008 xx123
-
12344 10 50.000 500.00 A13 15.000 150.00 11.12.2008 xx124
-
12344 10 50.000 500.00 A14 20.000 300.00 12.12.2008 xx125
-
Friends My requirement is similar data needs to be grouped as shown below.
-
PO No PO Item PO Quan PO Val GR No GR Qan GR Val GR Date Pur.Req No
-
12344 10 50.000 500.00 A12 15.000 150.00 10.12.2008 xx123
-
A13 15.000 150.00 11.12.2008 xx124
-
A14 20.000 300.00 12.12.2008 xx125
-
Dear Friends please provide some examples for this ASAP
Thankq
Vamshi
12-11-2008 3:47 PM
Declare the four first columns as [sort criteria|https://www.sdn.sap.com/irj/scn/advancedsearch?query=sortcriteriaALVgridit_sort+&cat=sdn_all], ALV (grid) will group the columns.
Regards
12-12-2008 5:31 PM
Hi Vamshi,
To do this, you probably need to maintain an internal table and a work area to sort records based upon the first four columns.
Declare a work area and an internal table.
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
Now, append the internal table using the work area to sort the internal table based upon the first four columns.
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'. "field name 1
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'. "field name 2
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-spos = 3.
wa_sort-fieldname = 'MENGE'. "field name 3
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-spos = 4.
wa_sort-fieldname = 'NETPR'. "field name 4
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
Now, simply pass this internal table into the 'REUSE_ALV_GRID_DISPLAY'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
EXPORTING
i_callback program = sy-repid "program report id
is_fieldcat = it_field "for field catalogs
it_sort = it_sort "your sort internal table
TABLES
t_outtab = it_ekpo "internal table from which the records will be displayed
This will generate the ALV output as per your requirement.
Hope this solves your problem.
Thanks & Regards
Tarun Gambhir