*---------------------------------------------------------------------*
* DATA DECLARATIONS
*---------------------------------------------------------------------*
DATA: CONT_DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,
GRID TYPE REF TO CL_GUI_ALV_GRID,
CUST_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
IT_FIELDCAT TYPE LVC_T_FCAT,
GS_LAYOUT TYPE LVC_S_LAYO,
ITAB TYPE TABLE OF SBOOK.
*&---------------------------------------------------------------------*
*& SELECTION SCREEN PARAMETERS
*&---------------------------------------------------------------------*
PARAMETERS:P_TEST TYPE I .
*&---------------------------------------------------------------------*
*& AT SELECTION SCREEN OUTPUT
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
CREATE OBJECT CONT_DOCKING
EXPORTING
REPID = SY-REPID
DYNNR = SY-DYNNR
SIDE = CONT_DOCKING->DOCK_AT_LEFT
EXTENSION = 1700.
IF CUST_CONTAINER IS INITIAL.
*----Create the alv with docking container
PERFORM CREATE_AND_INIT_ALV .
ENDIF.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCAT
*&---------------------------------------------------------------------*
FORM BUILD_FIELDCAT .
DATA WA_FIELDCAT TYPE LVC_S_FCAT.
WA_FIELDCAT-FIELDNAME = 'CARRID'.
WA_FIELDCAT-REPTEXT = 'Airline Code'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'CONNID'.
WA_FIELDCAT-REPTEXT = 'Flight Connection Number'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'WUNIT'.
WA_FIELDCAT-REPTEXT = 'Weight Unit'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
LOOP AT IT_FIELDCAT INTO WA_FIELDCAT.
IF WA_FIELDCAT-FIELDNAME EQ 'WUNIT'.
WA_FIELDCAT-EDIT = 'X'.
WA_FIELDCAT-DRDN_HNDL = '1'.
WA_FIELDCAT-CHECKTABLE = '!'.
MODIFY IT_FIELDCAT FROM WA_FIELDCAT.
ENDIF.
ENDLOOP.
ENDFORM. "build_fieldcat
*&---------------------------------------------------------------------*
*& Form CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
FORM CREATE_AND_INIT_ALV .
CREATE OBJECT GRID
EXPORTING I_PARENT = CONT_DOCKING.
*--perform build field catalog for alv display
PERFORM BUILD_FIELDCAT .
*--fill the drop down list values
PERFORM fill_dropdown_table .
*----fill final output table
SELECT * FROM SBOOK
INTO TABLE ITAB
UP TO 10 ROWS.
*---display alv
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB.
*---Set editable cells to ready for input initially
CALL METHOD GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "create_and_init_alv
*&---------------------------------------------------------------------*
*& Form set_drdn_table
*&---------------------------------------------------------------------*
FORM fill_dropdown_table.
DATA: LT_DROPDOWN TYPE LVC_T_DROP,
LS_DROPDOWN TYPE LVC_S_DROP.
LS_DROPDOWN-HANDLE = '1'.
LS_DROPDOWN-VALUE = 'KG'.
APPEND LS_DROPDOWN TO LT_DROPDOWN.
LS_DROPDOWN-HANDLE = '1'.
LS_DROPDOWN-VALUE = 'G'.
APPEND LS_DROPDOWN TO LT_DROPDOWN.
LS_DROPDOWN-HANDLE = '1'.
LS_DROPDOWN-VALUE = 'B'.
APPEND LS_DROPDOWN TO LT_DROPDOWN.
LS_DROPDOWN-HANDLE = '1'.
LS_DROPDOWN-VALUE = 'T'.
APPEND LS_DROPDOWN TO LT_DROPDOWN.
CALL METHOD GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN = LT_DROPDOWN.
ENDFORM. "set_drdn_table
ALSO READ:
- ALV Report With User Defined Buttons In It's Toolbar.
- ALV Report Program - Colors- Using REUSE_ALV_GRID_DISPLAY_LVC.
- Displaying Percentage In ALV List / Grid Display.
- Handling An ALV Grid With Check Box Using A Method.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment