Tuesday, December 21, 2010
The wrapper class implemented to encapsulate ALV Grid functionality is “CL_GUI_ALV_GRID”.As a control object, ALV Grid instance requires a container to be linked to the screen. Generally, an instance of the class “cl_gui_custom_container” is used for this purpose.
  • Create one program and paste the below code. 
  • REPORT ZTEST_NOTEPAD.
    DATA:
          G_GRID_CONTROL     TYPE REF TO CL_GUI_ALV_GRID,
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: IT_T100 TYPE TABLE OF T100.
    
    *start-of-selection
    START-OF-SELECTION.
      CALL SCREEN 1001.
    *&---------------------------------------------------------------------*
    *&      Module  INITIALIZE_DATA  OUTPUT
    *&---------------------------------------------------------------------*
    MODULE INITIALIZE_DATA OUTPUT.
      IF G_CUSTOM_CONTAINER IS INITIAL.
        CREATE OBJECT G_CUSTOM_CONTAINER
          EXPORTING
            CONTAINER_NAME = 'C_CUSTOM_CONTROL'.
        CREATE OBJECT G_GRID_CONTROL
          EXPORTING
            I_PARENT = G_CUSTOM_CONTAINER.
      ENDIF.
      IF IT_T100[] IS INITIAL.
        SELECT * FROM T100 INTO TABLE IT_T100 UP TO 20 ROWS WHERE SPRSL = SY-LANGU.
      ENDIF.
      CALL METHOD G_GRID_CONTROL->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'T100'
        CHANGING
          IT_OUTTAB        = IT_T100.
    ENDMODULE.                 " INITIALIZE_DATA  OUTPUT
  • Double click on 1001 screen and description.
  • Go to Layout of the screen and drag and drop custom control and give name ' C_CUSTOM_CONTROL'.
  • Flow logic of the screen.
    PROCESS BEFORE OUTPUT.
      MODULE INITIALIZE_DATA.
    
    PROCESS AFTER INPUT.
    * MODULE USER_COMMAND_1001.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.