2007 Sep 05 1:47 PM
In my ALV report, I would like to group by Sales Order. How to accomplish this. Thank you
WHEN 'VBELN_VA'.
wa_fieldcatalog-seltext_l = 'Order No.'.
wa_fieldcatalog-reptext_ddic = 'Order No.'.
wa_fieldcatalog-emphasize = 'X'.
wa_fieldcatalog-key = 'X'.
MOVE: wa_fieldcatalog-seltext_l TO wa_fieldcatalog-seltext_m,
wa_fieldcatalog-seltext_l TO wa_fieldcatalog-seltext_s.
ADD 1 TO wa_fieldcatalog-col_pos.
2007 Sep 05 2:52 PM
I have the following code so far. It gives me error gd_sort is a table without header line and therefore has no component called Fieldname. I cannot add headerline to gd_sort as that will make the program to dump because of mismatch in data type. Any ideas?
gd_sort TYPE slis_t_sortinfo_alv,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog
it_sort = gd_sort
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = i_zopen_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM build_sort.
gd_sort-fieldname = 'VBELN_VA'.
APPEND gd_sort.
ENDFORM. "build_sort
2007 Sep 05 1:50 PM
You can find how to do that in .<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">this document</a>
2007 Sep 05 1:52 PM
Use the sorting table, like in this code:
FORM f_grouping
CHANGING lpi_sort TYPE slis_t_sortinfo_alv.
DATA: lwa_sort LIKE LINE OF lpi_sort.
* Sorting and subtotaling by PO
lwa_sort-fieldname = 'EBELN'.
lwa_sort-up = k_true. " 'X'
lwa_sort-subtot = k_true. " 'X'
APPEND lwa_sort TO lpi_sort.
ENDFORM. " f_grouping
Then you must send the sorting table to the ALV function module.
If you're using OO ALV, it provides similar functionality.
Regards
Please reward points if helpful.
Message was edited by:
Alejandro Bindi
2007 Sep 05 2:03 PM
2007 Sep 05 2:10 PM
Ok, on the REUSE_ALV_GRID_DISPLAY f.m., it's the it_sort parameter.
Regards
2007 Sep 05 2:52 PM
I have the following code so far. It gives me error gd_sort is a table without header line and therefore has no component called Fieldname. I cannot add headerline to gd_sort as that will make the program to dump because of mismatch in data type. Any ideas?
gd_sort TYPE slis_t_sortinfo_alv,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog
it_sort = gd_sort
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = i_zopen_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM build_sort.
gd_sort-fieldname = 'VBELN_VA'.
APPEND gd_sort.
ENDFORM. "build_sort
2007 Sep 05 3:18 PM
Check this modification of your code:
FORM build_sort.
DATA: lwa_sort TYPE slis_sortinfo_alv.
lwa_sort-fieldname = 'VBELN_VA'.
APPEND lwa_sort TO gd_sort.
ENDFORM. "build_sort
Regards
Please reward points if helpful.