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: 

Getting current row or cursor

Former Member
0 Kudos

Hi all,

I'm using FM 'REUSE_ALV_GRID_DISPLAY' in my program. However, I'm having problem getting the current row or the cursor position in my ALV. If possible, I do not wish to use OO method in doing this. Is there any other way?

3 REPLIES 3

Former Member
0 Kudos

HI,

whenever you click on any row of a alv

grid or list display

selfield structure will be flled with the row contents

try this

FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

if SELFIELD-TABNAME = internal table name

endif.

endform.

check out the structure SELFIELD.

reward points if helpful

regards,

venkatesh

Former Member
0 Kudos

hi

i assume u mean to capture the current line or the line index that is selected in the grid display..if so, then do something like this

data: W_BOXNAM TYPE SLIS_FIELDNAME VALUE 'BOX'.

declare a char. field BOX of length 1 in the itab that you are displaying in grid

in layout, LAYOUT-BOX_FIELDNAME = 'BOX'.

in itab, the value of field BOX will be set to X when it's selected...can get the row no with sy-tabix inside the loop.

loop at itab where box = 'X'.

endloop.

if helpful, reward

Sathish. R

Former Member
0 Kudos

Hello Mil,

When u double click a row we can able to capture the column value field name every thing.#

Check this.


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                  RS_SELFIELD TYPE SLIS_SELFIELD.

  CHECK RS_SELFIELD-FIELDNAME = 'VBELN_O' OR
        RS_SELFIELD-FIELDNAME = 'VBELN'.
  CASE R_UCOMM.
    WHEN '&IC1'.   "doubleclick
      SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
*      IF RS_SELFIELD-FIELDNAME = 'VBELN_O'.
      IF RS_SELFIELD-FIELDNAME = 'VBELN_O'.
        IF  NOT  RS_SELFIELD-VALUE IS INITIAL.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ELSE.
          MESSAGE E999(Z48MM) WITH TEXT-T02 SPACE SPACE SPACE.
        ENDIF.
      ELSEIF RS_SELFIELD-FIELDNAME = 'VBELN'.
        PERFORM CALL_TRANSACTION_VA23 USING RS_SELFIELD-VALUE.
*        CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.
      ENDIF.

  ENDCASE.

ENDFORM.                    " USER_COMMAND