DATA: gd_okcode TYPE ui_func, * gt_sort TYPE lvc_t_sort, gt_fcat TYPE lvc_t_fcat, go_docking TYPE REF TO cl_gui_docking_container, go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA: gt_outtab TYPE STANDARD TABLE OF vbak.
PARAMETERS: p_vkorg TYPE vkorg DEFAULT '3000' OBLIGATORY.
START-OF-SELECTION.
SELECT * FROM (gc_table) INTO TABLE gt_outtab WHERE vkorg = p_vkorg.
* Create docking container CREATE OBJECT go_docking EXPORTING parent = cl_gui_container=>screen0 ratio = 90 EXCEPTIONS OTHERS = 6. IF sy-subrc <> 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_grid1 EXPORTING i_parent = go_docking EXCEPTIONS OTHERS = 5. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
* Display data CALL METHOD go_grid1->set_table_for_first_display CHANGING it_outtab = gt_outtab it_fieldcatalog = gt_fcat it_sort = gt_sort EXCEPTIONS OTHERS = 4. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
* Link the docking container to the target dynpro CALL METHOD go_docking->link EXPORTING repid = syst-repid dynnr = '0100' * CONTAINER = EXCEPTIONS OTHERS = 4. IF sy-subrc <> 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'.
CASE gd_okcode. WHEN 'BACK' OR 'END' OR 'CANC'. SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS. ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM build_fieldcatalog. * define local data DATA: ls_fcat TYPE lvc_s_fcat.
REFRESH: gt_fcat. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING * I_BUFFER_ACTIVE = i_structure_name = gc_table * 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 <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.
DELETE gt_fcat WHERE NOT ( fieldname = 'VBELN' OR fieldname = 'VKORG' OR fieldname = 'VTWEG' OR fieldname = 'SPART' OR fieldname = 'NETWR' ). LOOP AT gt_fcat INTO ls_fcat WHERE ( fieldname = 'NETWR' ). ls_fcat-do_sum = abap_true. " sum up column values
MODIFY gt_fcat FROM ls_fcat. ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------* *& Form BUILD_SORT_CRITERIA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM build_sort_criteria . * define local data DATA: ls_sort TYPE lvc_s_sort.