Application Development 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: 

double click in alv list

Former Member
0 Kudos

Hi all,

Here is the code:

my aim is to double click the alv list and display the correspoonding data .can any one tell me how to solve this.


regards,

Lisa

Message was edited by: Lisa Roy

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try the following code in User Command perform...similar requirement in our project to click on customer name...

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

READ TABLE it_customer INDEX rs_selfield-tabindex.

IF sy-subrc = 0.

IF it_customer-name = '@0A@'.

PERFORM call_transaction_va01.

ELSE.

READ TABLE it_erdat WITH KEY kunnr = it_customer-kunnr.

SET PARAMETER ID 'AUN' FIELD it_erdat-vbeln.

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

ENDFORM.

AND POPULATE EVENT TABLE AND PASS AT ALV.

Sreedhar

Message was edited by: Sreedhar Kanchanapalli

7 REPLIES 7

Former Member
0 Kudos

Hi,

Try the following code in User Command perform...similar requirement in our project to click on customer name...

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

READ TABLE it_customer INDEX rs_selfield-tabindex.

IF sy-subrc = 0.

IF it_customer-name = '@0A@'.

PERFORM call_transaction_va01.

ELSE.

READ TABLE it_erdat WITH KEY kunnr = it_customer-kunnr.

SET PARAMETER ID 'AUN' FIELD it_erdat-vbeln.

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

ENDFORM.

AND POPULATE EVENT TABLE AND PASS AT ALV.

Sreedhar

Message was edited by: Sreedhar Kanchanapalli

0 Kudos

Hi sridhar,

Hi sridhar where user commad exist?whether i have to creat a new one or what i have to do.Can you please expain me clearly.

0 Kudos

Hi

DATA: GS_LAYOUT TYPE SLIS_LAYOUT_ALV

GS_LAYOUT-F2CODE = 'DETA'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = gs_extract1-report

i_structure_name = 'SPFLI'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IS_LAYOUT = GS_LAYOUT

i_save = 'A'

it_events = my_list_event[]

TABLES

t_outtab = my_itab.

FORM user_command

USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

IF R_UCOMM = 'DETA'.

READ TABLE <ITAB> INDEX rs_selfield-TABINDEX.

........

ENDIF.

ENDFORM.

Max

0 Kudos

Hi Lisa,

**-ALV list Display
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = SY-REPID
   <b>   I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'</b>
    <b>  I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'</b>
      IS_LAYOUT                = X_LAYOUT
      IT_FIELDCAT              = IT_FIELDCAT
      IT_EVENTS                = IT_EVENTS
    TABLES
      T_OUTTAB                 = IT_FINAL
    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.

you need to pass these two forms

FORM PF_STATUS_SET USING    P_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'STANDARD' EXCLUDING P_EXTAB.
ENDFORM.                    "PF_STATUS_SET


FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE
                                                         SLIS_SELFIELD.
 case UCOMM.
 when '&IC1'.  "this is for double click.
 "do some thing..
  ENDCASE.
ENDFORM.                    "USER_COMMAND

Former Member
0 Kudos

Hi Lisa,

When u double click on the line in ALV report, the user command f2 is triggered and the index of that line is stored in the rs_selfield table and field tabindex. By using this index u can proceed further..

Sreedhar

0 Kudos

USER_COMMAND is an event that is already available in SLIS type pools. You doont need a perform statement. Just a FORM - ENDFORM statement like Sreedhar has mentioned. The FORM name that u give in the events table should be used here in the fORM-ENDFORM as well.

0 Kudos

in my_list_event interface that u pass to IT_EVENTS, u need to equate the subroutine name to the FORMNAME . So if u want ur subroutine to be called DOubleclick, then u pass it_events-formname = 'doubleclick' and append it to my_event_list.

then somewhere at the end of the codelines, u can start the subroutine

FORM doubleclick using rs_ucomm rs_selfield.

ur logic...

endform.