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

ALV (Get cursor)

Former Member
0 Likes
776

Hi ABAP experts ,

I have an ALV list output.

Now if I double click on any of the record I need to capture the entire record.

I used "get cursor field" ,it captures the value where i have double clicked.

Is it possible to capture the entire row where I have double clicked.

The issue is I have vendor field in my output, if the user clicks vendor thats fine and i can navigate to vendor account balance transaction.

But if the user clicks any other value apart from vendor I need to capture the vendor (corresponding to the value selected) and navigate to FBL1n.

Please revert in this regard.

Thanks in advance.

BR,

Jay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
553

Hi,

In the i_callback_user_command form you should check the r_ucomm value. When double clicked r_ucomm equals to '&IC1'. Then you can get the double clicked row from rs_selfield-tabindex. rs_selfield-fieldname holds the value of double clicked field name.

Example code:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' " ALV display function
       EXPORTING
            i_callback_program = gv_repid
            i_callback_user_command  = 'USER_COMMAND' "user_command form to be called
            it_fieldcat        = gt_fieldcat[]
            it_events          = gt_events
            i_callback_pf_status_set = 'SET_STATUS_ALV'
       IMPORTING
            e_exit_caused_by_caller = g_exit_caused_by_caller
            es_exit_caused_by_user  = gs_exit_caused_by_user
       TABLES
            t_outtab           = gt_itab
       EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.

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

  CASE r_ucomm.
    WHEN '&IC1'.     "doubleclick

       READ TABLE gt_itab INDEX rs_selfield-tabindex INTO ls_itab .

  ENDCASE .

ENDFORM.

2 REPLIES 2
Read only

Former Member
0 Likes
554

Hi,

In the i_callback_user_command form you should check the r_ucomm value. When double clicked r_ucomm equals to '&IC1'. Then you can get the double clicked row from rs_selfield-tabindex. rs_selfield-fieldname holds the value of double clicked field name.

Example code:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' " ALV display function
       EXPORTING
            i_callback_program = gv_repid
            i_callback_user_command  = 'USER_COMMAND' "user_command form to be called
            it_fieldcat        = gt_fieldcat[]
            it_events          = gt_events
            i_callback_pf_status_set = 'SET_STATUS_ALV'
       IMPORTING
            e_exit_caused_by_caller = g_exit_caused_by_caller
            es_exit_caused_by_user  = gs_exit_caused_by_user
       TABLES
            t_outtab           = gt_itab
       EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.

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

  CASE r_ucomm.
    WHEN '&IC1'.     "doubleclick

       READ TABLE gt_itab INDEX rs_selfield-tabindex INTO ls_itab .

  ENDCASE .

ENDFORM.

Read only

Former Member
0 Likes
553

Hello Jagdish,

To get the entire record on which you double click inALV, you can use the System variable

SY-LISEL. In this variable the complete line is fetched from the ALV.

As the column positions are fixed for each field, you can get the required data (Vendor No.) by reading the exact column (char) nos.

Hope this helps you.

Edited by: Sachinkumar Mehta on Nov 25, 2008 8:09 AM