REPORT ZLLTEST13.
*****************************************
* D A T A D E C L A R A T I O N START*
*****************************************
*********************************************************
* D I S P L A Y A L V I N S C R E E N S T A R T *
*********************************************************
DATA: gs_fieldcatalog TYPE lvc_s_fcat OCCURS 0,
gv_fcat LIKE LINE OF gs_fieldcatalog,
gs_layout TYPE lvc_s_layo.
*<----------------CUSTOM TABLE START----------------------
TYPES : BEGIN OF gty_item,
checkbox type c, "field for checkbox
celltab type lvc_t_styl, "field to switch editability
VBELN TYPE VBAK-VBELN, "<---CUSTOMIZED
TABLE(4) TYPE C, "<---CUSTOMIZED
GV_ADDRESS1(500) TYPE C, "<---CUSTOMIZED
GV_ADDRESS2(500) TYPE C, "<---CUSTOMIZED
END OF gty_item.
DATA : gs_item TYPE gty_item,
gt_item TYPE TABLE OF gty_item.
*<----------------CUSTOM TABLE END------------------------
DATA : g_Container TYPE scrfname VALUE 'C_ALV', ""<---CUSTOMIZED CONTAINER VALUE
g_Custom_Container TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
g_Grid TYPE REF TO CL_GUI_ALV_GRID.
DATA : OK_CODE LIKE sy-ucomm,
SAVE_OK LIKE sy-ucomm.
******************************************************
* D I S P L A Y A L V I N S C R E E N E N D *
******************************************************
******************************************************
* CUSTOM TABLE OR DATA DECLRATION FOR PROGRAM *
******************************************************
TABLES: T001, ADRC,
Ekko, "Purchasing Document Header EBELN
vbrk, "Billing Document: Header Data VBELN
vbak. "Sales Document: Header Data VBELN
DATA: TA_T001 TYPE TABLE OF T001,
WA_T001 LIKE LINE OF TA_T001,
TA_ADRC TYPE TABLE OF ADRC,
WA_ADRC LIKE LINE OF TA_ADRC,
LV_BUKRS TYPE T001-BUKRS,
GV_ADDRESS1 TYPE STRING,
GV_ADDRESS2 TYPE STRING,
SY_PROG TYPE SY-CPROG,
LV_VBELN TYPE VBAK-VBELN.
SY_PROG = SY-CPROG.
******************************************************
* S E L E C T I O N S C R E E N *
******************************************************
SELECTION-SCREEN BEGIN OF BLOCK b_top WITH FRAME.
PARAMETERS : p_EKKO RADIOBUTTON GROUP g1,
p_VBRK RADIOBUTTON GROUP g1,
p_VBAK RADIOBUTTON GROUP g1,
p_DOCNO type vbeln DEFAULT '4970000000'.
SELECTION-SCREEN: END OF BLOCK b_top.
FORM U_PREPARE_FIELDCATALOG .
CLEAR gv_fcat.
CLEAR gv_fcat.
gv_fcat-fieldname = 'TABLE'.
gv_fcat-tabname = 'TABLE'.
gv_fcat-col_pos = 0.
gv_fcat-coltext = 'TABLE'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
gv_fcat-fieldname = 'VBELN'.
gv_fcat-tabname = 'VBELN'.
gv_fcat-col_pos = 0.
gv_fcat-coltext = 'VBELN'.
gv_fcat-hotspot = 'X'.
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'GV_ADDRESS1'.
gv_fcat-tabname = 'GV_ADDRESS1'.
gv_fcat-col_pos = 0.
gv_fcat-coltext = 'GV_ADDRESS1'.
gv_fcat-INTLEN = 55.
"gv_fcat-no_out = 'X'. " Do not Display Column
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
CLEAR gv_fcat.
gv_fcat-fieldname = 'GV_ADDRESS2'.
gv_fcat-tabname = 'GV_ADDRESS2'.
gv_fcat-col_pos = 1.
gv_fcat-coltext = 'GV_ADDRESS2'.
gv_fcat-INTLEN = 55.
"gv_fcat-no_out = 'X'. " Do not Display Column
INSERT gv_fcat INTO TABLE gs_fieldcatalog.
ENDFORM. " U_PREPARE_FIELDCATALOG
*****************************************
* D A T A D E C L A R A T I O N END *
*****************************************
*****************************************
* H O T S P O T START *
*****************************************
CLASS event_class DEFINITION DEFERRED.
*& Refrence Objects To Alv Grid & Custom Container Classes
DATA:
**** g_Grid TYPE REF TO cl_gui_alv_grid, <-- your customized ALV
**** g_Custom_Container TYPE REF TO cl_gui_custom_container, <-- your customized ALV
event_receiver TYPE REF TO event_class,
e_object TYPE REF TO cl_alv_event_toolbar_set.
*& Data Declaration For Interactive Lists
DATA:
t_layo TYPE lvc_s_layo,
t_fcat TYPE lvc_t_fcat,
fs_fcat TYPE lvc_s_fcat,
t_cell TYPE lvc_t_cell,
t_row TYPE lvc_t_roid,
t_cel TYPE lvc_t_ceno.
*----------------------------------------------------------------------*
* CLASS event_class DEFINITION
*----------------------------------------------------------------------*
CLASS event_class DEFINITION.
PUBLIC SECTION.
METHODS:
handle_hotspot_click
* FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id.
FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_column_id
e_row_id
es_row_no .
ENDCLASS. "event_class DEFINITION
*----------------------------------------------------------------------*
* CLASS event_class IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS event_class IMPLEMENTATION.
METHOD handle_hotspot_click.
* fl_flag = 1.
*& Work Variable Declarations
***** DATA:
***** fs_carrid LIKE LINE OF t_flight. " Airline Passed Variable
*& Reading the selected data into the variable
**** READ TABLE t_flight INDEX e_row_id-index INTO fs_carrid.
**** PERFORM get_booking_data USING fs_carrid.
**** CALL SCREEN 600.
READ TABLE GT_ITEM INTO GS_ITEM INDEX e_row_id-index.
CASE GS_ITEM-TABLE.
WHEN 'EKKO'. SET PARAMETER ID 'BES' FIELD GS_ITEM-VBELN. CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
WHEN 'VBRK'. SET PARAMETER ID 'VF' FIELD GS_ITEM-VBELN. CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
WHEN 'VBAK'. SET PARAMETER ID 'AUN' FIELD GS_ITEM-VBELN. CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "event_class IMPLEMENTATION
*****************************************
* H O T S P O T END *
*****************************************
*****************************************
* PROCESS DATA START *
*****************************************
*&---------------------------------------------------------------------*
*& Form F_PROCESS_DATA - TO POPULATE GT_ITEM
*&---------------------------------------------------------------------*
FORM F_PROCESS_DATA .
CLEAR: LV_BUKRS, GS_ITEM.
CASE 'X'.
WHEN p_EKKO. SELECT SINGLE BUKRS FROM EKKO INTO LV_BUKRS WHERE EBELN EQ p_DOCNO.
WHEN p_VBRK. SELECT SINGLE BUKRS FROM VBRK INTO LV_BUKRS WHERE VBELN EQ p_DOCNO.
WHEN p_VBAK. SELECT SINGLE BUKRS_VF FROM VBAK INTO LV_BUKRS WHERE VBELN EQ p_DOCNO AND VKORG = '0190'. "SALES oRDER
ENDCASE.
IF SY-SUBRC EQ 0.
SELECT * FROM T001 INTO CORRESPONDING FIELDS OF TABLE TA_T001 WHERE BUKRS EQ LV_BUKRS.
IF TA_T001[] IS NOT INITIAL.
SELECT * FROM ADRC INTO CORRESPONDING FIELDS OF TABLE TA_ADRC
FOR ALL ENTRIES IN TA_T001 WHERE ADDRNUMBER EQ TA_T001-ADRNR.
IF SY-SUBRC EQ 0.
READ TABLE TA_ADRC INTO WA_ADRC INDEX 1.
IF SY-SUBRC EQ 0.
CLEAR: GV_ADDRESS1, GV_ADDRESS2.
CONCATENATE: WA_ADRC-NAME1 WA_ADRC-NAME2 INTO GV_ADDRESS1 SEPARATED BY SPACE.
IF WA_ADRC-STR_SUPPL1 IS NOT INITIAL. "NEXT LINE IS NOT INITIAL
CONCATENATE WA_ADRC-STREET ',' INTO WA_ADRC-STREET.
ENDIF.
IF WA_ADRC-STR_SUPPL2 IS NOT INITIAL. "NEXT LINE IS NOT INITIAL
CONCATENATE WA_ADRC-STR_SUPPL1 ',' INTO WA_ADRC-STR_SUPPL1.
ENDIF.
CONCATENATE WA_ADRC-STREET
WA_ADRC-STR_SUPPL1
WA_ADRC-STR_SUPPL2 INTO GV_ADDRESS2 SEPARATED BY SPACE.
REPLACE ',,' WITH ',' INTO: GV_ADDRESS1 , GV_ADDRESS2.
REPLACE ', ,' WITH ',' INTO: GV_ADDRESS1 , GV_ADDRESS2.
REPLACE ' ,' WITH ',' INTO: GV_ADDRESS1 , GV_ADDRESS2.
GS_ITEM-VBELN = P_DOCNO.
CASE 'X'.
WHEN p_EKKO. GS_ITEM-TABLE = 'EKKO'.
WHEN p_VBRK. GS_ITEM-TABLE = 'VBRK'.
WHEN p_VBAK. GS_ITEM-TABLE = 'VBAK'.
ENDCASE.
GS_ITEM-GV_ADDRESS1 = GV_ADDRESS1.
GS_ITEM-GV_ADDRESS2 = GV_ADDRESS2.
DELETE GT_ITEM WHERE VBELN = P_DOCNO.
APPEND GS_ITEM TO GT_ITEM.
ENDIF.
ENDIF.
ENDIF.
ELSE.
DATA: DOC_NO TYPE VBRK-VBELN.
CASE 'X'.
WHEN p_EKKO. SELECT SINGLE EBELN FROM EKKO INTO DOC_NO.
WHEN p_VBRK. SELECT SINGLE VBELN FROM VBRK INTO DOC_NO.
WHEN p_VBAK. SELECT SINGLE VBELN FROM VBAK INTO DOC_NO.
ENDCASE.
IF sy-subrc eq 0.
MESSAGE 'NO COMPANY CODE FOUND' TYPE 'I' display like 'I' .
ELSE.
MESSAGE 'NO DATA' TYPE 'I' display like 'E'.
ENDIF.
P_DOCno = DOC_NO.
ENDIF.
ENDFORM. " F_PROCESS_DATA
*****************************************
* PROCESS DATA END *
*****************************************
******************************************************
* S T A R T - O F - S E L E C T I O N *
******************************************************
START-OF-SELECTION.
PERFORM F_PROCESS_DATA.
IF GT_ITEM[] IS NOT INITIAL.
call SCREEN 100.
ENDIF.
END-OF-SELECTION.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZMARK'. "<--- CUSTOMIZED GUI STATUS
* SET TITLEBAR 'xxx'.
PERFORM F_INIT_ALV.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE USER_COMMAND_0100 INPUT.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'BACK' OR 'CANCEL'.
submit zmark VIA SELECTION-SCREEN WITH p_ekko EQ p_ekko
WITH p_DOCNO eq p_DOCNO.
when 'EXIT'.
LEAVE PROGRAM.
when 'F_BT_SEARCH'.
IF LV_VBELN NE ''.
p_DOCNO = LV_VBELN.
PERFORM F_PROCESS_DATA.
LV_VBELN = P_DOCno.
CALL METHOD g_Grid->REFRESH_TABLE_DISPLAY.
ELSE.
MESSAGE 'SEARCH FIELD IS BLANK' TYPE 'I' display like 'E'.
ENDIF.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM F_INIT_ALV.
data: lt_exclude type ui_functions.
IF g_Custom_Container IS INITIAL.
" Create CONTAINER object with reference to container name in the screen
CREATE OBJECT g_Custom_Container
EXPORTING CONTAINER_NAME = g_Container.
" Create GRID object with reference to parent name
CREATE OBJECT g_Grid
EXPORTING I_PARENT = g_Custom_Container.
PERFORM u_prepare_fieldcatalog.
"****************************
" CELLTAB start "
"****************************
*-> Initially, set all checkbox cells editable.
DATA:
ls_celltab type lvc_s_styl,
lt_celltab type lvc_t_styl,
tp_iindex type i.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
loop at gt_item INTO GS_ITEM.
tp_iindex = sy-tabix.
refresh lt_celltab.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
insert ls_celltab into table lt_celltab.
gS_item-celltab[] = lT_celltab[].
modify GT_ITEM FROM GS_ITEM index tp_iindex.
endloop.
"****************************
" CELLTAB END "
"****************************
"****************************
" gs_layout settings start "
"****************************
* A Multiple columns, multiple rows with selection buttons.
* B Simple selection, listbox, Single row/column
* C Multiple rows without buttons
* D Multiple rows with buttons and select all ICON
gs_layout-sel_mode = 'D'. "SELECT ALL AT THE UPPER RIGHT
gs_layout-ZEBRA = 'X'.
gs_layout-stylefname = 'CELLTAB'.
"gs_layout-edit = 'X'. "Makes all Grid editable
"****************************
" gs_layout settings end "
"****************************
perform exclude_tb_functions changing lt_exclude.
" SET_TABLE_FOR_FIRST_DISPLAY
CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = gs_fieldcatalog
IT_OUTTAB = gt_item. " Data
************************************************************************
*Create object of the event class and setting handler for hotspot click
************************************************************************
************************************************************************
*Create object of the event class and setting handler for hotspot click
************************************************************************
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_hotspot_click FOR g_Grid."cl_alv_grid.
CREATE OBJECT e_object.
************************************************************************
*Create object of the event class and setting handler for hotspot click
************************************************************************
************************************************************************
*Create object of the event class and setting handler for hotspot click
************************************************************************
ELSE.
CALL METHOD g_Grid->REFRESH_TABLE_DISPLAY.
ENDIF.
ENDFORM.
form exclude_tb_functions changing pt_exclude type ui_functions.
* data ls_exclude type ui_func.
*
* ls_exclude = cl_gui_alv_grid=>mc_fc_refresh.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
* append ls_exclude to pt_exclude.
endform. " EXCLUDE_TB_FUNCTIONS
*NOTE:
*1. create gui status zmark
* - assign cancel, back and exit
*2. create screen 100. copy into a file below and upload the screen 100
****************************************************************************
****************************************************************
* THIS FILE IS GENERATED BY THE SCREEN PAINTER. *
* NEVER CHANGE IT MANUALLY, PLEASE ! *
****************************************************************
*%_DYNPRO
*ZMARK_T
*0100
*700
* 40
*%_HEADER
*ZMARK_T 0100 0100 30112192 37 0 0 35141 0G E 20150624173745
*%_DESCRIPTION
*Test result screen
*%_FIELDS
*SY_PROG C CHAR 13 80 00 80 32 00 1 7 0 0 0 0 0 0 _____________
*GV_ADDRESS1 C CHAR 107 80 00 80 32 00 2 7 0 0 0 0 0 0 ___________________________________________________________________________________________________________
*GV_ADDRESS2 C CHAR 107 80 00 80 32 00 3 7 0 0 0 0 0 0 ___________________________________________________________________________________________________________
*C_ALV 108 00 00 00 30 00 4 6 0 0 0 22 U 1 1 101
*LV_VBELN C CHAR 25 80 00 80 00 00 27 6 0 0 0 0 0 0 _________________________
*BT_SEARCH CHAR 6 00 00 00 30 00 27 34 0 0 0 0 P 0 0 102 Search
* F_BT_SEARCH [bring this line up]
*P_EKKO C CHAR 1 80 00 80 00 00 28 6 0 0 0 0 A 0 0 103 G1 G1 G1 G1
*P_EKKO 0 CHAR 4 00 00 00 30 00 28 8 0 0 0 0 A 0 0 103 G1 G1 G1 G1 EKKO
*P_VBRK C CHAR 1 80 00 80 00 00 29 6 0 0 0 0 A 0 0 103 G1 G1 G1 G1
*P_VBRK 0 CHAR 4 00 00 00 30 00 29 8 0 0 0 0 A 0 0 103 G1 G1 G1 G1 VBRK
*P_VBAK C CHAR 1 80 00 80 00 00 30 6 0 0 0 0 A 0 0 103 G1 G1 G1 G1
*P_VBAK 0 CHAR 4 00 00 00 30 00 30 8 0 0 0 0 A 0 0 103 G1 G1 G1 G1 VBAK
*OK_CODE CHAR 20 80 10 00 00 00 255 1 O 0 0 0 0 0 0 ____________________
*%_FLOWLOGIC
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
**
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
*%_PARAMS
Post a Comment