2006 Oct 17 11:18 AM
Hi all,
I have inserted a table control on the screen. I have activated Respond on double click for one column. When I would double click on one particular row of that column I want to display more details about that row on next screen.
How do I go about it.
Thanks in adv
2006 Oct 17 11:28 AM
Hi,
In your PF-STATUS enable F2 giving an okcode.
( You can find it in PF-STATUS -> Function keys -> Recommeneded function keys)
Once you enable this and activate any doubleclick on the screen will create the ok code you assign and control comes to PAI.
Where you write the statement
if sy-ucomm eq 'CLICK'.
GET CURSOR FIELD ws_field LINE ws_line.
endif.
If ws_field contains the field on which the user clicked and ws_line contains the line no. of ur table control.
Regards,
Hi all,
I have inserted a table control on the screen. I have activated Respond on double click for one column. When I would double click on one particular row of that column I want to display more details about that row on next screen.
How do I go about it.
Thanks in adv
2006 Oct 17 11:28 AM
Hi,
In your PF-STATUS enable F2 giving an okcode.
( You can find it in PF-STATUS -> Function keys -> Recommeneded function keys)
Once you enable this and activate any doubleclick on the screen will create the ok code you assign and control comes to PAI.
Where you write the statement
if sy-ucomm eq 'CLICK'.
GET CURSOR FIELD ws_field LINE ws_line.
endif.
If ws_field contains the field on which the user clicked and ws_line contains the line no. of ur table control.
Regards,
2006 Oct 17 2:59 PM
Hi
Just as the guys have suid to u, assign a function code to F2 in your status.
PROCESS PAI.
LOOP AT ITAB.
MODULE GET_CURSOR.
ENDLOOP.
MODULE USER_COMMAND.
MODULE GET_CURSOR.
GET CURSOR FIELD ws_field LINE ws_line.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'PICK'.
WS_LINE = <TABLE CONTROL>-TOP_LINE + WS_LINE - 1.
READ TABLE ITAB INDEX WS_LINE.
---> Show details
ENDMODULE.
Max
2006 Oct 17 12:02 PM
u need to use LVC type but not SLIS type.
to select a row,
declare
data: s_layout like lvc_s_layo, t_layo type table of s_layout.
s_layout-sel_mode = 'A'.
append s_layout to t_layout.
sel_mode has values 'A' ( display buttons and single selection)
'B' (buttons with multiple selection)
'C' (no buttons but single row selection)
'D'( no buttons with multiple row selection)
u can give any value. by setting this sel_mode only u can select a row. otherwise not possible.
2006 Oct 17 4:15 PM
HI Sanjay,
Maintain a one character field at the end of table control and set the check box.Double click for it when generating the table control thru Wizard.
In Menu painter Set function key CS for F2.
Reward Points if this helps.
Manish
2006 Oct 19 9:00 AM
Hiii..
I'm attaching a sample code with this..
&----
*& Include MZ_DBLCLICK_TCTOP Module pool SAPMZ_DBLCLICK_TC
*&
&----
PROGRAM sapmz_dblclick_tc.
TABLES:scarr.
CONTROLS: tc1 TYPE TABLEVIEW USING SCREEN '9000'.
DATA: it_scarr TYPE TABLE OF scarr,
wa_scarr LIKE LINE OF it_scarr,
wa_scarr1 LIKE LINE OF it_scarr,
ok_code TYPE sy-ucomm,
wa_cols LIKE LINE OF tc1-cols.
DATA: ws_field(30),
ws_line TYPE i.
&----
*& Module status_9000 OUTPUT
&----
text
----
MODULE status_9000 OUTPUT.
<b>" Here I've set Ok_code As 'DBLCLICK' for F2 functionKey</b>
SET PF-STATUS '9000'.
SELECT * FROM scarr INTO CORRESPONDING FIELDS OF TABLE it_scarr.
ENDMODULE. " status_9000 OUTPUT
&----
*& Module USER_COMMAND_9000 INPUT
&----
text
----
MODULE user_command_9000 INPUT.
CASE ok_code.
WHEN 'DBLCLICK'.
GET CURSOR FIELD ws_field LINE ws_line.
IF ws_field EQ 'WA_SCARR-CARRID'.
READ TABLE it_scarr INDEX ws_line INTO wa_scarr1.
CALL SCREEN 9001.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
Hope it helps..
If so Notify us..
Regards,
Simy
2010 Jul 25 3:15 PM
HEY..
THANKS A LOT.. I HAD A SIMILAR PROBLEM AND IT WORKED FOR ME.
CHEERS!
2011 Dec 29 9:23 AM
I too had similar problem. But working now.
Thanks for your sample syntax
2011 Dec 29 9:57 AM
Hi,
Place the code under a module in PAI in which table control is displaying.
Got to layout editor in table control double click on any column and give the 'PICK' name in FCTCODE.
save and activate it .Keep break-point after get cursor field statement . In output double click on table control of that column it captures that current line and you can use that details .
IF SY-UCOMM = 'PICK'.
GET CURSOR FIELD ws_field LINE ws_line.
READ TABLE it_scarr INDEX ws_line INTO wa_scarr1.
write : / wa_scarr1-carrid.
ENDIF.
Regards,
G.Aditya
2012 Jan 14 10:51 AM
Hi,
You can try this code as per your requirement you will get a idea how to put some more function when double click on some column in table control. Here on basis on ebeln u will see company code and vendor number .Then when you double click on any vendor number then it will show that vendor number details like vendor country and name.
&----
*& Module pool ZTESTPRO4 *
*& *
&----
*& *
*& *
&----
PROGRAM ztestpro4.
TABLES:ekko,lfa1.
TYPES:BEGIN OF ty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
lifnr TYPE ekko-lifnr,
END OF ty_ekko.
TYPES:BEGIN OF ty_lfa1,
lifnr TYPE lfa1-lifnr,
land1 TYPE lfa1-land1,
name1 TYPE lfa1-name1,
END OF ty_lfa1.
DATA:gt_ekko TYPE STANDARD TABLE OF ty_ekko,
gt_lfa1 TYPE STANDARD TABLE OF ty_lfa1,
gs_ekko TYPE ty_ekko,
gs_lfa1 TYPE ty_lfa1.
DATA:ws_field(30),
ws_value(30).
DATA:lv_value(10),
val(10).
CONTROLS vcontrol TYPE TABLEVIEW USING SCREEN '0110'.
&----
*& Module USER_COMMAND_0110 INPUT
&----
text
----
MODULE user_command_0110 INPUT.
CASE sy-ucomm.
WHEN 'DISPLAY'.
SELECT ebeln
bukrs
lifnr FROM ekko
INTO TABLE gt_ekko
WHERE ebeln EQ ekko-ebeln.
WHEN 'PICK'.
GET CURSOR FIELD ws_field VALUE ws_value.
lv_value = STRLEN( ws_value ).
IF lv_value < 10.
val = 10 - lv_value.
DO val TIMES.
CONCATENATE '0' ws_value INTO ws_value.
ENDDO.
ENDIF.
SELECT SINGLE lifnr
land1
name1
FROM lfa1
INTO (gs_lfa1-lifnr,gs_lfa1-land1,gs_lfa1-name1)
WHERE lifnr = ws_value.
CALL SCREEN 9001.
ENDCASE.
ENDMODULE. " USER_COMMAND_0110 INPUT
&----
*& Module STATUS_0110 OUTPUT
&----
text
----
MODULE status_0110 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
LOOP AT gt_ekko INTO gs_ekko.
MOVE:gs_ekko-ebeln TO ekko-ebeln,
gs_ekko-bukrs TO ekko-bukrs,
gs_ekko-lifnr TO ekko-lifnr.
ENDLOOP.
CLEAR gt_ekko.
CLEAR gs_ekko.
ENDMODULE. " STATUS_0110 OUTPUT
&----
*& Module exit INPUT
&----
text
----
MODULE exit INPUT.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " exit INPUT
&----
*& Module STATUS_9001 OUTPUT
&----
text
----
MODULE status_9001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
MOVE:gs_lfa1-lifnr TO lfa1-lifnr,
gs_lfa1-land1 TO lfa1-land1,
gs_lfa1-name1 TO lfa1-name1.
ENDMODULE. " STATUS_9001 OUTPUT
&----
*& Module USER_COMMAND_9001 INPUT
&----
text
----
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0110.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT
Edited by: ABHINAV GOEL on Jan 14, 2012 12:25 PM
2012 Jan 16 5:13 AM
Hi Sanjay
In order to put Double click event on the Table control,
1. Create a PF Status with F2 Function named, DOU_CLK.
2. Create a Table control in the Screen with Respond to Double Click option selected.
3. In the UserCommand Module, Write the code for double click uder DOU_CLK function code.
CASE okcode.
WHEN 'DOU_CLK'.
ENDCASE.Thanks and Regards,
Rinzy Deena Mathews
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |