Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling a Transaction from ALV Grid Using OO method

Former Member
0 Likes
2,402

Hi,

My requirement is as follows....

I have an ALV grid with columns such as PO no., GR no., Invoice no., etc...

When I double click on any of these cells it should take me to the respective Transaction (say ME23n for PO no.) with the cell content as input in the transaction.

Thanks and Regards,

Navaneeth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,080
1.   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    I_CALLBACK_PROGRAM                = W_REPID
    I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'


2. FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                        P_SELFLD TYPE SLIS_SELFIELD.
  DATA : L_REP_MODE.                "report mode
  CASE P_UCOMM.

    WHEN '&IC1'.    "Double click
      READ TABLE ITAB INDEX P_SELFLD-TABINDEX.
      set parameter id 'XXX' field  ITAB-field.
      call transaction 'XXXX'
    endcase.
endform.

Hi,

My requirement is as follows....

I have an ALV grid with columns such as PO no., GR no., Invoice no., etc...

When I double click on any of these cells it should take me to the respective Transaction (say ME23n for PO no.) with the cell content as input in the transaction.

Thanks and Regards,

Navaneeth

5 REPLIES 5
Read only

Former Member
0 Likes
1,081
1.   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    I_CALLBACK_PROGRAM                = W_REPID
    I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'


2. FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                        P_SELFLD TYPE SLIS_SELFIELD.
  DATA : L_REP_MODE.                "report mode
  CASE P_UCOMM.

    WHEN '&IC1'.    "Double click
      READ TABLE ITAB INDEX P_SELFLD-TABINDEX.
      set parameter id 'XXX' field  ITAB-field.
      call transaction 'XXXX'
    endcase.
endform.
Read only

0 Likes
1,080

Hi Chndrasekhar,

Thanks for ur response...

But I need it using Object Oriented Method.

Ive been using the factory method to display my ALV.

Regards,

Navaneeth

Read only

0 Likes
1,080
Hi,

  then u can write the code in HANDLE_DOUBLE_CLICK method

 CLASS LCL_EVENT_RECEIVER DEFINITION.
  PUBLIC SECTION.
    METHODS:
*method used for double click
    HANDLE_DOUBLE_CLICK
        FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW E_COLUMN,
*
ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION


CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*implementation of the method double click
*when document no is double clicked in ALV GRID , its value is sent to
*transaction FPE3 and the corresponding values of the document are
*displayed
  METHOD HANDLE_DOUBLE_CLICK.
    CLEAR WA_WRT_OFF_FLDS.
    IF E_COLUMN = 'OPBEL'.
      READ TABLE ITAB INTO WA_IAB INDEX E_ROW-INDEX.
           set parameter....
           call transaction...
      endif.
       ENDMETHOD.                    "handle_double_click
*method to remove unwanted icons from toolbar
endclass.
Read only

Former Member
0 Likes
1,080

Hi Navaneeth ,

You will have to create a class with methods to handle event in the alv and create handlers for them.

Please refer to the program <b>BCALV_GRID_02</b>. In this the class <b>lcl_event_receiver</b> is used to handled event , see the method <b>handle_double_click</b>, it is used to handle double click.

You will have to do some thing similar , but in the method call the transaction , using the command CALL TRANSACTION.

Please do remeber to set handlers , other wise the events will not be triggered. See line no 212 of the program

Regards

Arun

  • Reward points if reply is helpful

Read only

Former Member
0 Likes
1,080

Hi Navaneeth,

Check this thread with same requirement.

Thanks to Uwe for sample program

Check this link for another simple program with screen shots

http://www.4ap.de/abap/alv_listausgabe_oo.php

<b>Search the forum with HANDLE_HOTSPOT_CLICK</b>

Regards,

Raghav