2007 Jul 18 6:06 AM
Hi Experts,
I have probelm in grid display.Actually report is invoice realiazation.
in that customer,plant and material group fields. i want sum all the numeric fields
according to customer wise plant wise and material group wise.Please give me the suggestion.
Regards,
Anand.
2007 Jul 18 6:09 AM
hi,
1, first SORT the internal table on the basis of customer wise, plant wise and material group wise.
2. Use the subtotal(for the numeric field ) option basis of above sorting.
Rgds
Reshma
2007 Jul 18 7:14 AM
2007 Jul 18 7:16 AM
hi
after sorting the internal table by customer wise plant wise etc,
then
loop at itab into wa_itab.
at the end of customer
sum.
write :sum.
endat.
endloop.
2007 Jul 19 7:48 AM
Hi,
find the following code for your help.
if your all result in an final itab i.e. IT_FINAL.
<b>IT_PLANT and IT_MATERIAL are same as IT_FINAL.
IT_PLANT[] = IT_FINAL[].
IT_MATERIAL[] = IT_FINAL[].
SORT IT_PLANT BY <plant wise>.
AT END OF<plant>.
SUM <field1,field2 etc>.
SORT IT_MATERIAL BY <material group wise>.
AT END OF<material group >.
SUM <field1,field2 etc>.</b>
<b><i>hope help you
reward point if find helpful
Debjani</i></b>
2007 Jul 19 8:10 AM
with your ALV program add this below Code ....
<b>Add Default Sorting to ALVgrid report</b>
In order to display an ALV report with specific columns already sorted by default you will need to build a sort catalogue. This is fairly straight forward and is done in the following way:
Step 1. Add data declaration for sort catalogue
Step 2. Add code to build sort catalogue table
Step 3. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'it_sort'
* ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'KUNNR'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'WERKS'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 3.
wa_sort-fieldname = 'MATKL'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
ENDFORM. " build_sortcat
reward points if it is usefull ...
Girish
2007 Jul 19 8:11 AM
with your ALV program add this below Code ....
<b>Add Default Sorting to ALVgrid report</b>
In order to display an ALV report with specific columns already sorted by default you will need to build a sort catalogue. This is fairly straight forward and is done in the following way:
Step 1. Add data declaration for sort catalogue
Step 2. Add code to build sort catalogue table
Step 3. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'it_sort'
* ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'KUNNR'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'WERKS'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 3.
wa_sort-fieldname = 'MATKL'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
ENDFORM. " build_sortcat
reward points if it is usefull ...
Girish
2007 Jul 19 8:13 AM
with your ALV program add this below Code ....
<b>Add Default Sorting to ALVgrid report</b>
In order to display an ALV report with specific columns already sorted by default you will need to build a sort catalogue. This is fairly straight forward and is done in the following way:
Step 1. Add data declaration for sort catalogue
Step 2. Add code to build sort catalogue table
Step 3. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include parameter 'it_sort'
* ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'KUNNR'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'WERKS'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 3.
wa_sort-fieldname = 'MATKL'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
ENDFORM. " build_sortcat
reward points if it is usefull ...
Girish