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

Button column in table control.

Former Member
0 Likes
556

Hello,

I have a button column in table control. How can I tell which button was clicked?

Thanks,

Leon

1 ACCEPTED SOLUTION
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
368

Hi Leon

Use this:

DATA lv_linno LIKE sy-linno .
DATA lv_fname(30) TYPE c .

GET CURSOR LINE lv_linno .

lv_linno = lv_linno + <tc_control_name>-top_line - 1 .

GET CURSOR FIELD lv_fname .

READ TABLE <itab_linked_to_tc> INDEX lv_linno .
IF sy-subrc = 0 .
  CASE lv_fname .
    WHEN 'FIELD1' . "button field name 1"
    ...
    WHEN 'FIELD2' . "button field name 2"
    ...
  ENDCASE .

ENDIF .

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

2 REPLIES 2
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
369

Hi Leon

Use this:

DATA lv_linno LIKE sy-linno .
DATA lv_fname(30) TYPE c .

GET CURSOR LINE lv_linno .

lv_linno = lv_linno + <tc_control_name>-top_line - 1 .

GET CURSOR FIELD lv_fname .

READ TABLE <itab_linked_to_tc> INDEX lv_linno .
IF sy-subrc = 0 .
  CASE lv_fname .
    WHEN 'FIELD1' . "button field name 1"
    ...
    WHEN 'FIELD2' . "button field name 2"
    ...
  ENDCASE .

ENDIF .

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Read only

0 Likes
368

Thank you. forgot about GET CURSOR LINE.