Skip to Content
avatar image
Former Member

line selection in SET_TABLE_FOR_FIRST_DISPLAY

Hi All,

I am using SET_TABLE_FOR_FIRST_DISPLAY method to display my data in control in screen 100.

In IT_OUTTAB I am passing internal table with fields like…

Button (Expand/Element)

Business Area.

Cost Element

…

… etc.

Now… After pressing Expand button, Object number for particular business area should be shown bellow in the same display.

Eg.

Button BA Obj.No Cost.Elem.

+ b1

After pressing +

Button BA Obj.No. Cost.Elem.

- b1

.............o1................c1

.............o2................c2

But, I am not getting my control to USER COMMAND in PAI after pressing EXPAND button.

How can I do this ?

Kindly help.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 09, 2008 at 06:30 AM

    Hi,

    To handle the ALV events in the PAI , you would need to set the below parameter when creating the grid:

    CREATE OBJECT <ref_toGrid>
        EXPORTING
          i_parent          = <ref_toCont>
          I_APPL_EVENTS*     = 'X'

    This would enable the Application Events i.e. event handling can be done in PAI. If nothing is passed over, then the events are handled as system events.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Use the method GET_SELECTED_ROWS of the ALV class CL_GUI_ALV_GRID.

      This would return you the row ID's. You can then use these row ID's as index to identify the rows in your output table which is the source for the ALV data.

  • avatar image
    Former Member
    Apr 10, 2008 at 05:21 AM

    HI

    sample report

    &----


    *& Report ZLCL_ALV_BIL *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZLCL_ALV_BIL .

    DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

    O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

    O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,

    O_GRID2 TYPE REF TO CL_GUI_ALV_GRID.

    DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.

    DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.

    TABLES: VBRK.

    START-OF-SELECTION.

    SET SCREEN 100.

    &----


    *& Form GET_DATA

    &----


    • text

    ----


    FORM GET_DATA .

    SELECT *

    FROM VBRK

    INTO TABLE IT_VBRK

    WHERE VBELN = VBRK-VBELN.

    SELECT *

    FROM VBRP

    INTO TABLE IT_VBRP

    WHERE VBELN = VBRK-VBELN.

    ENDFORM. " GET_DATA

    &----


    *& Module STATUS_0100 OUTPUT

    &----


    • text

    ----


    MODULE STATUS_0100 OUTPUT.

    SET PF-STATUS 'MENU'.

    IF O_CONT1 IS INITIAL.

    *--Linking screen custom control to custon container object

    CREATE OBJECT O_CONT1

    EXPORTING

    CONTAINER_NAME = 'VBRK_CONT' "custom control

    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.

    MESSAGE I000(Z00) WITH 'Error in container'.

    EXIT.

    ENDIF.

    *--linking the custom container object as a parent to alv grid

    CREATE OBJECT O_GRID1

    EXPORTING

    I_PARENT = O_CONT1 "custom container object

    EXCEPTIONS

    ERROR_CNTL_CREATE = 1

    ERROR_CNTL_INIT = 2

    ERROR_CNTL_LINK = 3

    ERROR_DP_CREATE = 4

    OTHERS = 5.

    IF SY-SUBRC <> 0.

    MESSAGE I000(Z00) WITH 'Error in alv grid'.

    EXIT.

    ENDIF.

    *--Linking screen custom control to custon container object

    CREATE OBJECT O_CONT2

    EXPORTING

    CONTAINER_NAME = 'VBRP_CONT' "Custom control

    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.

    MESSAGE I000(Z00) WITH 'Error in container'.

    EXIT.

    ENDIF.

    *--linking the custom container object as a parent to alv grid

    CREATE OBJECT O_GRID2

    EXPORTING

    I_PARENT = O_CONT2 "custom container object

    EXCEPTIONS

    ERROR_CNTL_CREATE = 1

    ERROR_CNTL_INIT = 2

    ERROR_CNTL_LINK = 3

    ERROR_DP_CREATE = 4

    OTHERS = 5.

    IF SY-SUBRC <> 0.

    MESSAGE I000(Z00) WITH 'Error in alv grid'.

    EXIT.

    ENDIF.

    ENDIF.

    ENDMODULE. " STATUS_0100 OUTPUT

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0100 INPUT.

    CASE SY-UCOMM.

    WHEN 'BACK'.

    LEAVE PROGRAM.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    &----


    *& Module SHOW_GRIDS INPUT

    &----


    • text

    ----


    MODULE SHOW_GRIDS INPUT.

    PERFORM GET_DATA.

    *--showing the 1st grid

    CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    I_STRUCTURE_NAME = 'VBRK'

    CHANGING

    IT_OUTTAB = IT_VBRK[]

    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.

    *--showing the 2nd grid

    CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    I_STRUCTURE_NAME = 'VBRP'

    CHANGING

    IT_OUTTAB = IT_VBRP[]

    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.

    ENDMODULE. " SHOW_GRIDS INPUT

    SCREEN 100

    PROCESS BEFORE OUTPUT.

    MODULE STATUS_0100.

    PROCESS AFTER INPUT.

    FIELD VBRK-VBELN MODULE SHOW_GRIDS ON INPUT.

    MODULE USER_COMMAND_0100.

    Add comment
    10|10000 characters needed characters exceeded