1

i have a problem with call transaction in ALV. and now i want to call transaction when i double click on row in my popup. Its possible or not?

Thanks for answers I use user_command '&IC1' -double click to call a popup window with data :

        IF selfield-fieldname = 'MATNR'.
        PERFORM popup.

FORM popup:

FORM popup.
DATA: wa_data LIKE zdata.

CLEAR: wa_data.
REFRESH it_data.

LOOP AT t_data.
CLEAR: wa_data.
MOVE-CORRESPONDING t_data TO wa_data.
APPEND wa_data TO it_data.
ENDLOOP.

CALL SCREEN 200
  STARTING AT 20 20
  ENDING   AT 200 90.

ENDFORM. 

its implementation and definition in my top: lcl_handle_events

CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row column.
ENDCLASS.                    "lcl_handle_events DEFINITION

CLASS lcl_handle_events IMPLEMENTATION.
METHOD on_double_click.
PERFORM get_po_ord_info USING row column.
ENDMETHOD.                    "on_double_click
ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

And this is in ALV include:

FORM get_po_ord_info USING row TYPE salv_de_row
  column TYPE salv_de_column.

IF column EQ 'MATNR'.
  SET PARAMETER ID 'MAT' FIELD t_dost-MATNR.
  SET PARAMETER ID 'WRK' FIELD t_dost-WERKS.
  CALL TRANSACTION 'ZCO06' AND SKIP FIRST SCREEN.
 ENDIF.
ENDIF.

ENDFORM.      
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
miedziopl
  • 13
  • 1
  • 5

1 Answers1

0

I didn't clearly get in what order you call your pieces, but your code works for me like this:

CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table IMPORTING row column.
ENDCLASS.                    "lcl_handle_events DEFINITION

CLASS lcl_handle_events IMPLEMENTATION.
METHOD on_double_click.
IF column EQ 'MATNR'.
SET PARAMETER ID 'MAT' FIELD t_dost-MATNR.
SET PARAMETER ID 'WRK' FIELD t_dost-WERKS.
CALL TRANSACTION 'MB51' AND SKIP FIRST SCREEN.
ENDIF.
ENDMETHOD.                    "on_double_click
ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

START-OF-SELECTION.

DATA: wa_data LIKE zdata.
CLEAR: wa_data, it_data.

LOOP AT t_data.
CLEAR: wa_data.
MOVE-CORRESPONDING t_data TO wa_data.
APPEND wa_data TO it_data.
ENDLOOP.

 DATA: o_alv TYPE REF TO cl_salv_table.
 DATA: lx_msg TYPE REF TO cx_salv_msg.
  TRY.
    cl_salv_table=>factory(
      IMPORTING
        r_salv_table = o_alv
      CHANGING
        t_table      = it_data ).
  CATCH cx_salv_msg INTO lx_msg.
 ENDTRY.

 DATA: handle TYPE REF TO lcl_handle_events.
 CREATE OBJECT handle.
 DATA: lr_events TYPE REF TO cl_salv_events_table.
 CALL METHOD o_alv->GET_EVENT
  RECEIVING
    VALUE  = lr_events.
 SET HANDLER handle->on_double_click FOR lr_events.

 o_alv->display( ).

You can also call popup window via CALL SCREEN...STARTING in on_double_click method instead of calling tcode, but you can do either of these actions, you cannot start new transaction in popup window.
The only workaround here is to to call modal window inside your Z-transaction or to use POPUP_WITH_TABLE_DISPLAY FM if you only need table output in your popup.

P.S. Also your IF column EQ 'MATNR' is redundant as you already check selfield-fieldname when invoking the event.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90