Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV grid display

Former Member
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

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

0 Kudos

Hi Reshma,

Can u give me the example.

Regards,

Anand.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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>

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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