ALV - Sort on Subtotals
Hi,
Does anyone know how to sort on the subtotals of a numeric column in an ALV.
Murali.
Hi Santosh,
Wouldnt this just sort a column and then show the subtotals ?
a X 1
b X 2
c X 3
X subtotal 6
d Y 4
e Y 5
f Y 6
g Y 7
Y subtotal 22
Grand total 28
I am looking to sort 22 and 6 in descending order with subtotal 22 at the top.
Thanks
Edited by: Muralidaran Shanmugam on Feb 10, 2010 7:11 AM
Similar Messages
-
Hotspot-clicking (Insert function) plus ALV Sorting
Hi,
I have a requirement where the ALV display has to be SORTED based on values entered/changed on a certain column. The sort works ok when used with a custom APPEND button for new records (always inserted at the bottom of the list).
However, it does not work correctly when used with the Hotspot-click (INSERT functionality). It looks like if you CLICK on a particular record onscreen, you are actually addressing the original record in that position before the SORT was effected.
Is the Hotspot-clicking (Insert functionality) possible with ALV sorting? The ideal solution would be to have the ALV sorted at PBO and also at PAI so that the user can change existing records and add new ones with the sorting being updated everytime ON_DATA_CHANGED is triggered.
Will appreciate any help on this.
Thanks!
MichaelHello Michael
Thanks for further specifying your requirements. I have created the sample variant ZUS_SDN_ALVGRID_HOTSPOT_SORT_1 which contains two differences as compared to its template:
Replace table VBAK with VBAP (so we have two levels of sorting: VBELN, POSNR)
Move SET_TABLE_FOR_FIRST_DISPLAY method call into PBO
When I click on the hotspot (VBELN) a new row entry for the order number is created. The sorting (VBELN, POSNR) is kept even though the new row has been appended to the itab.
*& Report ZUS_SDN_ALVGRID_HOTSPOT_SORT
*& Thread: Hotspot-clicking (Insert function) plus ALV Sorting
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1159431"></a>
REPORT zus_sdn_alvgrid_hotspot_sort.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbap.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syrepid,
gt_sort TYPE lvc_t_sort,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
ms_sel_row TYPE lvc_s_row. " selected row
CLASS-METHODS:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
sender,
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_data_changed.
FIELD-SYMBOLS: <lt_outtab> TYPE ty_t_outtab.
BREAK-POINT.
ENDMETHOD. "handle_data_changed
METHOD handle_hotspot_click.
" define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_msg TYPE bapi_msg.
BREAK-POINT.
CLEAR: lcl_eventhandler=>ms_sel_row.
ms_sel_row = e_row_id.
READ TABLE gt_outtab INTO ls_outtab INDEX e_row_id-index.
CONCATENATE 'Selected Sales Order = ' ls_outtab-vbeln ' / '
ls_outtab-posnr
INTO ld_msg.
message i398(00) with ld_msg.
" Trigger PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'INSERT'
* IMPORTING
* rc =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_vkorg TYPE vkorg DEFAULT '0001' OBLIGATORY.
START-OF-SELECTION.
** SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE gt_outtab
** UP TO 200 ROWS
** WHERE vkorg = p_vkorg.
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE gt_outtab
UP TO 100 ROWS.
PERFORM init_controls.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
PERFORM set_sorting.
" Register EDIT event
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER:
lcl_eventhandler=>handle_data_changed FOR go_grid,
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
* Display data
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = abap_true
is_variant = gs_variant
i_save = 'A'
* i_default = 'X'
is_layout = gs_layout
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
it_sort = gt_sort
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** CALL METHOD go_grid->refresh_table_display
*** EXPORTING
*** IS_STABLE =
*** I_SOFT_REFRESH =
** EXCEPTIONS
** finished = 1
** OTHERS = 2.
** IF sy-subrc ne 0.
*** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
** ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'INSERT'.
PERFORM insert_row.
WHEN OTHERS.
" Check for changed data at the frontend (= grid control)
CALL METHOD go_grid->check_changed_data( ).
ENDCASE.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
others = 6.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
others = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog.
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'VBAP' " 'VBAK'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** LOOP AT gt_fcat INTO ls_fcat.
** CASE ls_fcat-fieldname.
** WHEN 'VBELN' OR
** 'ERDAT' OR
** 'ERZET' OR
** 'ERNAM' OR
** 'AUART' OR
** 'NETWR' OR
** 'WAERK'.
** CONTINUE.
** WHEN OTHERS.
** ls_fcat-no_out = abap_true.
** ENDCASE.
** MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
** ENDLOOP.
* Only non-key fields are editable
** ls_fcat-edit = 'X'.
** MODIFY gt_fcat FROM ls_fcat
** TRANSPORTING edit
** WHERE ( fieldname NE space ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING hotspot
WHERE ( fieldname = 'AUART' OR
fieldname = 'VBELN' ).
** DELETE gt_fcat FROM 15 TO 99.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*& Form SET_SORTING
* text
* --> p1 text
* <-- p2 text
FORM set_sorting .
* define local data
DATA: ls_sort TYPE lvc_s_sort.
REFRESH: gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'VBELN'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'POSNR'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
ENDFORM. " SET_SORTING
*& Form INSERT_ROW
* text
* --> p1 text
* <-- p2 text
FORM insert_row .
* define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_order TYPE vbeln.
READ TABLE gt_outtab INTO ls_outtab
INDEX lcl_eventhandler=>ms_sel_row-index.
ld_order = ls_outtab-vbeln.
" Find last item of sales order
LOOP AT gt_outtab INTO ls_outtab
WHERE ( vbeln = ld_order ).
ENDLOOP.
" Create next item:
add 10 to ls_outtab-posnr.
" NOTE: added at the end of the list
APPEND ls_outtab TO gt_outtab.
" NOTE: insert new row AFTER selected row => works, too
** INSERT ls_outtab INTO gt_outtab
** INDEX lcl_eventhandler=>ms_sel_row-index.
ENDFORM. " INSERT_ROW -
Hi Guru's
i am use alv sort in my report .
i use following code.
but it gives me DUMP ERROR.
my code like this.
DATA : it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
FORM do_sort .
it_sort-spos = 1.
it_sort-fieldname = 'vbeln'.
it_sort-tabname = 'it_vbak'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
it_sort-group = '*'.
it_sort-expa = 'X'.
APPEND it_sort.
it_sort-spos = 2.
it_sort-fieldname = 'posnr'.
it_sort-tabname = 'it_vbap'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
it_sort-group = '*'.
it_sort-expa = 'X'.
APPEND it_sort.
ENDFORM.
please tell me where is the error.
Thanks in advance.
Regards.
Sam.Hi,
Try the following code
DATA : it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
FORM do_sort .
it_sort-spos = 1.
it_sort-fieldname = 'VBELN'.
it_sort-tabname = 'IT_VBAK'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
it_sort-group = '*'.
it_sort-expa = 'X'.
APPEND it_sort.
it_sort-spos = 2.
it_sort-fieldname = 'POSNR'.
it_sort-tabname = 'IT_VBAP'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
it_sort-group = '*'.
it_sort-expa = 'X'.
APPEND it_sort.
ENDFORM.
Hope this will have u.
If it is helpful provide point.
Thanks. -
Simple question about ALV sorting
I retrieve data from SFLIGHT table and display it in ALV by using cl_salv_table class. I added a sorting column PRICE as follows:
data r_salv_sort type ref to cl_salv_sorts.
r_salv_sort = r_salv_table->get_sorts( ).
r_salv_sort->add_sort('PRICE').
and got exception message:
Subtotals cannot be calculated on aggregatable columns
it is fine when I change from PRICE column to CONNID column.
What could be the reason for that? I just want to sort the Price column. Thanks!We can do the sorting on the Quantity or Amount column once it ALV is displayed. Because now the control is no more with the SALV model. It is with the ALV framework.
SALV model doesn't allow the sorting on the columns on which you can perform the Agreegation.
You can save the default layout variant and then start the ALV with that variant.
Regards,
Naimesh Patel -
Hi Experts!
I have a problem in sorting.
I have a field called Remaining time having data type char20.
Format is HH:MM:SS.
The problem is, i want it to be sorted in a way that a number is sorted.
Example (descending):
I want it to be sorted this way:
121:89
111:00
12:34
10:78
00:00
-01:44
-10:22
-11:45
-109:11
but in my program, it is sorted as text:
121:89
12:34
111:00
10:78
-109:11
-11:45
-10:22
-01:44
00:00
Edited by: navi on Aug 11, 2008 4:04 PMHi,
Step 1. Sort your internal table by time field before passing it to
ALV.
Step 2. Pass the sorted table.
OR
use function module reuse_alv_grid_display.
IMPORTING
REFERENCE(I_INTERFACE_CHECK) DEFAULT SPACE
VALUE(I_BYPASSING_BUFFER) TYPE CHAR01 DEFAULT SPACE
VALUE(I_BUFFER_ACTIVE) DEFAULT SPACE
REFERENCE(I_CALLBACK_PROGRAM) LIKE SY-REPID DEFAULT SPACE
REFERENCE(I_CALLBACK_PF_STATUS_SET) TYPE SLIS_FORMNAME DEFAULT
SPACE
REFERENCE(I_CALLBACK_USER_COMMAND) TYPE SLIS_FORMNAME DEFAULT
SPACE
REFERENCE(I_CALLBACK_TOP_OF_PAGE) TYPE SLIS_FORMNAME DEFAULT
SPACE
REFERENCE(I_CALLBACK_HTML_TOP_OF_PAGE) TYPE SLIS_FORMNAME
DEFAULT SPACE
REFERENCE(I_CALLBACK_HTML_END_OF_LIST) TYPE SLIS_FORMNAME
DEFAULT SPACE
REFERENCE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL
REFERENCE(I_BACKGROUND_ID) TYPE SDYDO_KEY DEFAULT SPACE
REFERENCE(I_GRID_TITLE) TYPE LVC_TITLE OPTIONAL
REFERENCE(I_GRID_SETTINGS) TYPE LVC_S_GLAY OPTIONAL
REFERENCE(IS_LAYOUT) TYPE SLIS_LAYOUT_ALV OPTIONAL
REFERENCE(IT_FIELDCAT) TYPE SLIS_T_FIELDCAT_ALV OPTIONAL
REFERENCE(IT_EXCLUDING) TYPE SLIS_T_EXTAB OPTIONAL
REFERENCE(IT_SPECIAL_GROUPS) TYPE SLIS_T_SP_GROUP_ALV OPTIONAL
REFERENCE(IT_SORT) TYPE SLIS_T_SORTINFO_ALV OPTIONAL ---> uncomment this (see details bellow)
REFERENCE(IT_FILTER) TYPE SLIS_T_FILTER_ALV OPTIONAL
REFERENCE(IS_SEL_HIDE) TYPE SLIS_SEL_HIDE_ALV OPTIONAL
REFERENCE(I_DEFAULT) DEFAULT 'X'
REFERENCE(I_SAVE) DEFAULT SPACE
REFERENCE(IS_VARIANT) LIKE DISVARIANT STRUCTURE DISVARIANT
OPTIONAL
REFERENCE(IT_EVENTS) TYPE SLIS_T_EVENT OPTIONAL
REFERENCE(IT_EVENT_EXIT) TYPE SLIS_T_EVENT_EXIT OPTIONAL
REFERENCE(IS_PRINT) TYPE SLIS_PRINT_ALV OPTIONAL
REFERENCE(IS_REPREP_ID) TYPE SLIS_REPREP_ID OPTIONAL
REFERENCE(I_SCREEN_START_COLUMN) DEFAULT 0
REFERENCE(I_SCREEN_START_LINE) DEFAULT 0
REFERENCE(I_SCREEN_END_COLUMN) DEFAULT 0
REFERENCE(I_SCREEN_END_LINE) DEFAULT 0
REFERENCE(I_HTML_HEIGHT_TOP) TYPE I DEFAULT 0
REFERENCE(I_HTML_HEIGHT_END) TYPE I DEFAULT 0
REFERENCE(IT_ALV_GRAPHICS) TYPE DTC_T_TC OPTIONAL
REFERENCE(IT_HYPERLINK) TYPE LVC_T_HYPE OPTIONAL
REFERENCE(IT_ADD_FIELDCAT) TYPE SLIS_T_ADD_FIELDCAT OPTIONAL
REFERENCE(IT_EXCEPT_QINFO) TYPE SLIS_T_QINFO_ALV OPTIONAL
REFERENCE(IR_SALV_FULLSCREEN_ADAPTER) TYPE REF TO
CL_SALV_FULLSCREEN_ADAPTER OPTIONAL
EXPORTING
REFERENCE(E_EXIT_CAUSED_BY_CALLER)
REFERENCE(ES_EXIT_CAUSED_BY_USER) TYPE SLIS_EXIT_BY_USER
TABLES
T_OUTTAB
EXCEPTIONS
PROGRAM_ERROR
( Using internal table IT_SORT, the caller determines the sort order and/or the subtotalling of the basic list.)
Regards,
anirban -
ALV sort/group disfunction ?!
Hi there,
I'm a bit helpless because of the sort/group function my ALV should do. Current situation is that I'm using an CL_GUI_ALV_GRID.
CALL METHOD gr_config_alv_1_2->set_table_for_first_display
EXPORTING
is_layout = ls_layout
CHANGING
it_sort = sort_table
it_outtab = config_1_2_table
it_fieldcatalog = cat_config_fieldcat_alv
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3.
IF sy-subrc <> 0.
EXIT.
ENDIF.
So you can see that I'm using it_sort to tell the ALV how to sort the it_outtab. [Result looks like this|http://fabianvogt.com/alv_1.jpg].
What the it_sort does is sorting the it_outtab ASCENDING for the coloum "GRP" (display-name: "Bezugstyp"). So far so good...But I know that CL_GUI_ALV_GRID normally does some kind of grouping by merging cells with the same content. [This would look like that|http://fabianvogt.com/alv_2.jpg].
In my case it does not work and I don't have any idea why. I searched the CLASS for a hint or maybe an attribute which has to be filled/flagged to do this kind of grouping.
Looking forword to your help!Hi everyone!
I've checked BCALV_TEST_GRID. Basically they do it the same way I'm trying. I found out that I have the possibility to set ls_layout-no_merging to control, whether cells with the same content are merged or not. By default no_merging is set SPACE, so the cells should be merged - NOT in my case.
Even if I set no_merging = ' ' (SPACE) manually, the merging won't be done.
Running out ouf ideas ...
NEWS:
I did some kind of a workaround, in my opinion even a nicer way to realize my purpose. So take a look at what I did right now:
(take a look at the screenshots in my previous posts for your better understanding)
- The old 'GRP' field (old content: 'B',' K', 'M') is now filled with 'Belegbezug', 'Kundenbezug', 'Materialbezug' and is set NO_OUT (fieldcatalogue).
- I insterted a field called 'CNT' type I, which i use to create Totals/Subtotals.
- NO_TOTLINE = 'X' (Layout) --> total line is not shown; only subtotals
- TOTALS_BEF (Layout) --> subtotals are placed on top
[So this is what I got now|http://fabianvogt.com/alv3.jpg]. Much better than before!!!
My only problem is now, that the 'CNT' coloum looks pretty ugly and has no function except doing the sum thing.
I tried to make it invisible using the fieldcatalogue (NO_OUT / TECH), but then the total lines disappear :/
Any suggestions?
Edited by: Fabian Vogt on Oct 4, 2010 4:35 PM -
ALV Sorting Not Working after Adding Checkbox to ALV
Hi All.
I am currently doing an ALV report using REUSE_ALV_GRID_DISPLAY function. I am sorting the list by Employee Name and Personnel Area. It works fine where the personnel are field and employee name field are merger together for same personnel are and employee name. But afterwards I added a checkbox field to the internal table and the list outputs a checkbox for each line. Afer putting the checkbox the list no long merges the same personnel are and employee name fields according to original sorting.
Can anyone explain if there is a way to solve this?
Thanks a lot.
Lilyyes there is a way. Just see this..
There is no Straight forward solution. There is a work around.
REPORT ztest_check_box .
TYPE-POOLS: slis,icon.
DATA: BEGIN OF it_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
matnr LIKE vbap-matnr,
posnr LIKE vbap-posnr,
kunnr LIKE vbak-kunnr,
kwmeng LIKE vbap-kwmeng,
check TYPE c,
id TYPE icon-id,
END OF it_vbap.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv.
DATA: x_fieldcat TYPE slis_fieldcat_alv.
DATA: it_sort TYPE slis_t_sortinfo_alv,
x_sort TYPE slis_sortinfo_alv.
SELECT vbak~vbeln
vbak~kunnr
vbap~posnr
vbap~matnr
vbap~kwmeng
INTO CORRESPONDING FIELDS OF TABLE it_vbap
FROM vbak JOIN vbap
ON vbak~vbeln = vbap~vbeln.
SORT it_vbap BY matnr.
DELETE it_vbap WHERE matnr IS INITIAL.
LOOP AT it_vbap.
it_vbap-id = '@T9@'.
MODIFY it_vbap.
ENDLOOP.
x_fieldcat-fieldname = 'ID'.
x_fieldcat-seltext_l = 'CHECK'.
x_fieldcat-outputlen = 4.
x_fieldcat-icon = 'X'.
x_fieldcat-col_pos = 1.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'MATNR'.
x_fieldcat-seltext_l = 'MATNR'.
x_fieldcat-col_pos = 2.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'KUNNR'.
x_fieldcat-seltext_l = 'KUNNR'.
x_fieldcat-col_pos = 3.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-col_pos = 4.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-col_pos = 5.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'KWMENG'.
x_fieldcat-seltext_l = 'KWMENG'.
x_fieldcat-col_pos = 6.
x_fieldcat-do_sum = 'X'.
x_fieldcat-tabname = 'IT_VBAP'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_sort-fieldname = 'MATNR'.
x_sort-spos = 1.
x_sort-up = 'X'.
x_sort-group = 'X'.
x_sort-subtot = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
x_sort-fieldname = 'KUNNR'.
x_sort-spos = 2.
x_sort-up = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
x_sort-fieldname = 'VBELN'.
x_sort-spos = 3.
x_sort-up = 'X'.
APPEND x_sort TO it_sort.
CLEAR x_sort.
*DATA:x_layout TYPE lvc_s_layo.
*x_layout-box_fname = 'CHECK'.
*x_layout-no_rowmark = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* is_layout = x_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_vbap[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc ne 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& Form itab_user_command
* text
* -->WHATCOMM text
* -->WHATROW text
FORM user_command USING whatcomm TYPE sy-ucomm selfield TYPE
slis_selfield.
IF selfield-fieldname = 'ID'.
READ TABLE it_vbap INDEX selfield-tabindex.
IF sy-subrc = 0.
IF it_vbap-check = ''.
it_vbap-id = '@R7@'.
it_vbap-check = 'X'.
ELSE.
it_vbap-id = '@T9@'.
it_vbap-check = ''.
ENDIF.
MODIFY it_vbap INDEX selfield-tabindex.
ENDIF.
ENDIF.
selfield-refresh = 'X'.
ENDFORM. "itab_user_command
if you want to make the above code to work in lower versions then you have to do this..
then maintain the ICON using the view V_ICON from SM30 add the New Entry.
get the properties from the below screen shot.
http://img404.imageshack.us/img404/3338/testig9.png -
ALV Totals and Subtotals line in the output
Hi!
I want to display an ALV report in which there should be totals and subtotals buttons are to be displayed without displaying the totals and subtotals line when the list is displayed. It should be displayed only when the user clicks the button. If i take do_sum in the fieldcat table it'll display the subtotal button and also the totlas line and that shouldn't happen. If i take no_totalline in the layout it'll not display the totals line even the user selects the totals button. So is there any possibility like this. Please help me.
Thanks & Regards,
SwathiHi Swathi,
Have a look at these good links-
<b>Add subtotals</b>
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
You can also search for the same in the below links-
www.sap-img.com
www.sapfans.com
www.sapgenie.com
Reward points if you find the links useful.
Regards,
Tanuja. -
Hi Experts,
I have encountered a peculiar situation with respect to ALV, using sort. The problem is as follows:
1. I have an internal table with 3 fields, upon which I am supposed to implement a sort criteria on the first two fields.
2. My data is something like this, for ex:
abc 1 a
abc 1 b
cde 1 a
cde 1 b
3. I have applied sort criteria, on the first two fields and passed to the fm "REUSE_ALV_GRID_DISPLAY'.
4. Now the output is as follows:
abc 1 a
-- b
cde -- a
--- -- b
Here ( -- ) dotted lines mean the identical entry from the previous row...
5. My requirement is I want the output as:
abc 1 a
--- -- b
cde 1 a
--- -- b
I mean the sort critetia of the second column should follow the first(adjacent column) sort criteria
I hope it is clearly explained, and kindly let me know how this can be solved..
Thank you,
ShashiHi Bala,
The suggested solution is not giving the desired results..
This happens because, when i sort the entries i mentioned earlier, remains the same, even after the two explicit sort statements on the internal table.
Kindly check the same and let me know.
Regards,
Shashi -
hi
need to sort alv data, but the entries are like header and item
means first line is of header data and if has items then
the items will be displayed starting from second line but some columns for all items
will be empty (means header data at the top line refers)
now second header data comes and then its items.
in such case how to sort the ALV basing on the header number.
while sorting all the items are going at the bottom since it has no header number in its line
and header items are coming at the top
how to sort these entries correctlyHi,
Try this
DATA : gt_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
PERFORM fill_sort. " Filling sort of REUSE_ALV_GRID_DISPALY
FORM fill_sort .
wa_sort-fieldname = 'MATNR'.
wa_sort-up = c_x.
APPEND wa_sort TO gt_sort.
CLEAR wa_sort.
ENDFORM. " FILL_SORT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_grid_title = text-012
is_layout = wa_slis_layout
it_sort = gt_sort[]
it_fieldcat = gt_fieldcat[]
i_save = 'A'
TABLES
t_outtab = <fs_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
Please help!
When i run an ALV report in foreground, there is cell-merge when a column is sorted.
However, when the ALV run @ background, why the cell-merge cannot work ? All data is listed, rather than is summarized into a block for all rows with the same field content.
Please Advice
Regards
AnnieHi,
see this example.
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM.
rgds,
bharat. -
hi,
Can u pls tell me what is the use of subtotal in sort exactly with an example of records..
I need to work out with this..in ALV.
will be rewarded.
Thankx in advREPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
Check this program...
Regards,
Pavan -
I am trying to display a table in a subscreen,
1. I have made my sort table and passed it to the set_table_first_display.
lw_sort-spos = '1'.
lw_sort-fieldname = 'KUNNR'.
lw_sort-up = c_x.
* Append Work Area to the Table
APPEND lw_sort TO p_sort.
CLEAR lw_sort.
2. I have also made sure that the No_merging field is not marked in the fieldcatalog and layout.
But inspite of all of this, the cells do NOT get vertically merged.
I was under the impression, In ALV Grid Display, the Sort Criterion by default makes the column contents Vertically merged.
Basically I am getting this as a display,
1400 -------other data -----
1400 -------other data -----
1500 -------other data -----
1500 -------other data -----
I want this,
1400 -------other data -----
-------other data -----
1500 -------other data -----
-------other data -----
How do I achieve this? Doesnt this generally come default in ALV Grid?
Also let me add, my display table is editable, so does this default vertical merge get turned off in any scenario?
Has anyone encountered this/something similar?
Would be thrilled to get a solution.
Thanx.
Message was edited by: Prasenjit Guha
Message was edited by: Prasenjit GuhaHi Serdar thank you for your post.
How do you suggest I achieve the following for an editable grid.
Current Display,
1400 -------other data -----
1400 -------other data -----
1500 -------other data -----
1500 -------other data -----
I want this,
1400 -------other data -----
-------other data -----
1500 -------other data -----
-------other data ----- -
Getting UNCAUGHT_EXCEPTION CX_WD_CONTEXT at using alv sort function
Dear colleagues,
I developed a simple application which displays records in an ALV and at lead-selection shows detailed data in a form. Everthing is working fine except one is clicking on the sort functionality at the top of the ALV short dump is thrown.
In trx ST22 I find :
The lead selection has not been set. V_DEFAULT
"UNCAUGHT_EXCEPTION" "CX_WD_CONTEXT"
"CL_WDR_CONTEXT_NODE===========CP" or "CL_WDR_CONTEXT_NODE===========CM00R"
"_RAISE_ELEMENT_NOT_FOUND"
Lead selection is checked and also debugging the code did not bring me any further.
Any help is greatly appreciated.
Thanks in advance
MichaelHi Regina,
first of all thanks for your quick answer and explanation. I'm not sure what you mean with 'register to the standard functions of the ALV' because this is a functionality which works in other ALVs without register any event method to them or do you mean that in my case I have to react to the sorting in a new method in the view controller? Concerning 'refill the subnode via supply function' I'm doing this already.
Disabling the sorting is no option anymore because the users already know and love this feature
Regards
Michael -
ALV sort any column in fieldcatalog by default
hi all
i have developed report in ALV format. i have total 8 columns
normally we sort any column in the output only.
i have requirement that instead of sorting manually any column say Material no
it should be sorted by default when user execute the report. he should not do manually by pressing Sort button in
alv list
give code for refrencehi u can use the IT_SORT parameter of the FM REUSE_ALV_GRID_DISPLAY for this purpose.
specify the fields for which u need to sort ur table and the sorting order
( I have jst given da example for one field but this it_sort table can hav more than one fields.)
gs_alv_sort-spos = 1.
gs_alv_sort-fieldname = 'VKORG'. " Sales Org
gs_alv_sort-up = 'X'. " Ascending
APPEND gs_alv_sort TO gt_alv_sort.
then pass this internal table to teh alv fm
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = wf_repid
I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
I_BACKGROUND_ID = 'WEAVE_BACKGROUND'
IS_LAYOUT = gs_alv_layout
IT_FIELDCAT = gt_alv_fieldcat
IT_SORT = gt_alv_sort
TABLES
T_OUTTAB = it_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Maybe you are looking for
-
I have updated to ios 7 and Microsoft outlook web access for work emails no longer works nor my remote access can you help
-
Setup macbook pro from g4 cube
Trying to set up a new macbook pro using firewire connection to a g4 cube, but macbook pro doesn't seem to recognize the g4 cube harddrive or system. is the g4 simply too old to be recognized? (btw, i can get the g4 cube icon to appear when i connect
-
WMV export on Windows CS6 version 6.0.3
Hi! I have Adobe Media Encoder CS6 on a Windows machine at work. Despite having the version 6.0.3 update, the export presets for WMV format video files appear to be missing. Edit >> Export Settings (Export Settings > Format) The list includes only:
-
Table for total actual cost and total actual revenue.
Hi Gurus, Can anybody pls tell me what is the table for total acutal cost and total actual revenue for a service order. Thanks in advance. Regards Satish
-
IPTC NewsCodes Standards - Metadata
Howdy, Here is the IPTC - NewsCodes - List from the iptc.org site which lists the words used in cataloguing. Search: View Strings Standards love & peace, victor G5, 2.5 GHz Mac OS X (10.4.4)