*&---------------------------------------------------------------------*
*& Report Z_ALV_EXAMPLE *
*& *
*&---------------------------------------------------------------------*
*& Author tech.sap29@gmail.com *
*& *
*&---------------------------------------------------------------------*
REPORT Z_ALV_EXAMPLE .
DATA : O_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID,
IT_T001 TYPE TABLE OF T001.
CALL SCREEN 9001.
*&---------------------------------------------------------------------*
*& Module STATUS_9001 OUTPUT
*&---------------------------------------------------------------------*
module STATUS_9001 output.
SET PF-STATUS 'ZSTATUS'.
* SET TITLEBAR 'xxx'.
CREATE OBJECT O_container
EXPORTING
* PARENT =
container_name = 'C1'
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
* EXCEPTIONS
* CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* others = 6
.
IF sy-subrc = 0.
CREATE OBJECT o_grid
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = O_CONTAINER
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* EXCEPTIONS
* ERROR_CNTL_CREATE = 1
* ERROR_CNTL_INIT = 2
* ERROR_CNTL_LINK = 3
* ERROR_DP_CREATE = 4
* others = 5
.
IF sy-subrc = 0.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'T001'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
it_outtab = IT_T001
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 1
* PROGRAM_ERROR = 2
* TOO_MANY_LINES = 3
* 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.
ENDIF.
ENDIF.
endmodule. " STATUS_9001 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
module USER_COMMAND_9001 input.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
endmodule. " USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
*& Module DATA_READ OUTPUT
*&---------------------------------------------------------------------*
module DATA_READ output.
SELECT * INTO TABLE IT_T001 FROM T001 UP TO 20 ROWS .
endmodule. " DATA_READ OUTPUT
Please tell about how to display the alv Grid using oops
ReplyDelete