double click a row in table control

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
ss gg
Posts: 9
Joined: Wed Dec 08, 2004 2:04 am
Contact:

double click a row in table control

Post by ss gg » Mon Jan 10, 2005 11:27 am

i have crated a table control in a screen.
Upon double clicking any row , another SAP standard transaction (fpl9) has to get trigered. the account number for this transaction shold be same as one present on the row on which user double clicked.
the problrem is when the user clicks on a row, i am not able to finf on which row he double-clicked.
i have tried using many system variables and GET CUROSR too. but i amnot able to get it.
please help.

thks
ss gg

Rich Heilman
Posts: 496
Joined: Fri May 28, 2004 10:53 am
Location: York, Pennsylvania USA

Post by Rich Heilman » Mon Jan 10, 2005 11:49 am

Set the account number field as a hotspot in the table control via screen painter. Double click the field in your table control, click the display tab, and check on the "Responds to double Click" box.

In your PAI when sy-ucomm(ok_code) = 'PICK'
do something like this. This system will know where the user clicks.

Code: Select all


data: cursorfield(30) type c,
        cursorline(30) type c,
        cursorvalue(30) type c.

  GET CURSOR FIELD CURSORFIELD LINE CURSORLINE VALUE CURSORVALUE.

  IF NOT CURSORVALUE IS INITIAL.
    CASE CURSORFIELD.
      WHEN ITABCON-ACCTFIELD'.
        SET PARAMETER ID 'WHATEVER' FIELD CURSORVALUE.
        CALL TRANSACTION 'fpl9 AND SKIP FIRST SCREEN.
    ENDCASE.
  ENDIF.


ss gg
Posts: 9
Joined: Wed Dec 08, 2004 2:04 am
Contact:

Post by ss gg » Mon Jan 10, 2005 12:08 pm

hi rich

i have tried this thing....in the display properties i have set it to "respond to double click" and then in API i am using the statement

GET CURSOR field gv_field line GV_LINE offset gv_off.

but i am not able to get the value of gv_line or gv_field.
they are all zero.

plz tell whether is there any other thing i had to go to make it correct?




Rich Heilman wrote:Set the account number field as a hotspot in the table control via screen painter. Double click the field in your table control, click the display tab, and check on the "Responds to double Click" box.

In your PAI when sy-ucomm(ok_code) = 'PICK'
do something like this. This system will know where the user clicks.

Code: Select all


data: cursorfield(30) type c,
        cursorline(30) type c,
        cursorvalue(30) type c.

  GET CURSOR FIELD CURSORFIELD LINE CURSORLINE VALUE CURSORVALUE.

  IF NOT CURSORVALUE IS INITIAL.
    CASE CURSORFIELD.
      WHEN ITABCON-ACCTFIELD'.
        SET PARAMETER ID 'WHATEVER' FIELD CURSORVALUE.
        CALL TRANSACTION 'fpl9 AND SKIP FIRST SCREEN.
    ENDCASE.
  ENDIF.


Rich Heilman
Posts: 496
Joined: Fri May 28, 2004 10:53 am
Location: York, Pennsylvania USA

Post by Rich Heilman » Mon Jan 10, 2005 1:01 pm

You need to get the cursor value.

Code: Select all

  GET CURSOR
         FIELD CURSORFIELD
         LINE CURSORLINE 
         VALUE CURSORVALUE. 
Do this statement in a screen module before the USER_COMMAND MODULE.

Regards,
Rich Heilman

JuergenL
Posts: 875
Joined: Wed Nov 13, 2002 8:08 am
Location: Cologne, Germany
Contact:

Post by JuergenL » Tue Jul 05, 2005 2:38 am

Well I done what you proposed Rich and it works for me as long as I'm working on the first page of my table control. But when I have used page down I get incorrect results as I read values from index = line in table control and not index = (line in table control + n pages).

How to retreive correct values here?

1) Flow Logic in Dynpro

Code: Select all

PROCESS AFTER INPUT.
  LOOP WITH CONTROL tc_snppt.

    MODULE auswerten_snppt.
  ENDLOOP.
2) Module auswerten_snppt.

Code: Select all

*&---------------------------------------------------------------------*
*&      Module  auswerten_snppt  INPUT
*&---------------------------------------------------------------------*

MODULE auswerten_snppt INPUT.
  PERFORM get_cursor.
  zeilen_tc = sy-loopc.
  IF sub_mark = 'X'.
    snpptpos = tc_snppt-current_line.
  ENDIF.
ENDMODULE.                 " auswerten_snppt  INPUT
3) Form get_cursor

Code: Select all

*&---------------------------------------------------------------------*
*&      Form  get_cursor
*&---------------------------------------------------------------------*

FORM get_cursor.

  CLEAR:  cursorfield,
          cursorline,
          cursorvalue.

  GET CURSOR
      FIELD cursorfield
      LINE  cursorline
      VALUE cursorvalue.

ENDFORM.                    " get_cursor

Post Reply