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

interactive alv

Former Member
0 Likes
417

hiii,

i made a alv report which consist a coloum equipment no(EQUNR) , now what i want is when i double on a particular

equipment no it should be shifted to a IE02 of that particular

equipment no ,now it shifting to a one fixed equipment no,

feedback, appreciated

3 REPLIES 3
Read only

Sm1tje
Active Contributor
0 Likes
398

Upon double click, determine the equipment number. Pass this to the CALL TRANSACTION 'IE02' by setting the parameter SET PARAMETER ID 'XXX'.

Read only

Former Member
0 Likes
398

Refer the following code:



REPORT zdemoab.

TYPE-POOLS: slis.
TABLES: mara.

TYPES: BEGIN OF t_itab,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       END OF t_itab.

DATA: itab TYPE TABLE OF t_itab,
      wa_itab like line of itab.

DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat LIKE LINE OF i_fieldcat,
      i_layout TYPE slis_layout_alv,
      g_repid TYPE sy-repid.


SELECT matnr mtart INTO TABLE itab FROM mara UP TO 10 ROWS.


CLEAR: wa_fieldcat.
wa_fieldcat-col_pos = 0.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'MARA'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.

wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-tabname = 'MARA'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.


i_layout-colwidth_optimize = 'X'.
i_layout-hotspot_fieldname = 'MATNR'.

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   i_callback_program                = g_repid
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
   is_layout                         = i_layout
   it_fieldcat                       = i_fieldcat[]
  TABLES
    t_outtab                          = itab
 EXCEPTIONS
   program_error                     = 1
   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

*   Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'MATNR'.
*     To pass the material no in ME22 transaction
      READ TABLE itab INTO wa_itab INDEX rs_selfield-tabindex.
*     Set parameter ID for transaction screen field
      SET PARAMETER ID 'BES' FIELD wa_itab-matnr.
*     Sxecute transaction ME23N, and skip initial data entry screen
      CALL TRANSACTION 'MM03'.
*
    ENDIF.
ENDFORM.

Read only

venkat_o
Active Contributor
0 Likes
398

Shamsher singh, Follow these steps to get ur object done. 1. USER_COMMAND call back subroutine should be like this in your case. This is nowhere called using PERFORM statement in ur program.

*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
form user_command using ucomm like sy-ucomm
                  selfield type slis_selfield.
  case ucomm .
    when '&IC1'. "This is for double click on ALV output.
     case selfield-sel_tab_field."It gives on which field double click was done.
       when 'ITAB-EQUNR'.
        SET PARAMETER ID 'EQN' FIELD selfield-value.
         "selfield-value contains the value of the field on which double click was done
        CALL TRANSACTION 'IE02' AND SKIP FIRST SCREEN.
        " It skips IE02 transaction initial screen and displays next screen.If you want to see IE02 first screen just remove AND SKIP FIRST SCREEN addition.
     endcase.
  endcase.
endform.                    "user_command
2. Now pass USER_COMMAND callback subroutine through FM.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM      = l_program "Program name
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IT_FIELDCAT             = i_field
    IT_SORT                 = i_sort
  TABLES
    T_OUTTAB                = i_tab
  EXCEPTIONS
    PROGRAM_ERROR           = 1
    OTHERS                  = 2.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I hope that you will get it. Regards, Venkat.O