‎2005 Oct 24 3:36 PM
Hi All,
I am using a table control to display some info and would need to bring up a new screen when a row in the table is double clicked. Do you know how I can assign a function code for this ?
It's been a long time since I used the table controls. So any help would be greatly appreciated.
Thanks!
‎2005 Oct 24 3:38 PM
Hi,
In your GUI Status (PF-STATUS) assign a function code (for example PICK) for F2 Function Key.
And then code for it in your user_command routine.
Like,
CASE ok_code.
"or OKCODE whatever is given in your screen elements list
WHEN 'PICK'.
****Your processing here..
ENDCASE.
Double click on any screen element including a table control row trigger F2 function key..
You can use
GET CURSOR LINE line. "To get the line dbl clicked
and then,
get the corresponding internal table line by,
line = tctrl-top_line + line - 1.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
‎2005 Oct 24 3:38 PM
Hi,
In your GUI Status (PF-STATUS) assign a function code (for example PICK) for F2 Function Key.
And then code for it in your user_command routine.
Like,
CASE ok_code.
"or OKCODE whatever is given in your screen elements list
WHEN 'PICK'.
****Your processing here..
ENDCASE.
Double click on any screen element including a table control row trigger F2 function key..
You can use
GET CURSOR LINE line. "To get the line dbl clicked
and then,
get the corresponding internal table line by,
line = tctrl-top_line + line - 1.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
‎2005 Oct 24 3:42 PM
Hi
The code of doubleclick is the code you assign to F2 function key in your stauts gui.
So:
PROCESS PAI.
LOOP AT...
MODULE GET_CURSOR.
ENDLOOP.
MODULE USER_COMMAND.
MODULE GET_CURSOR.
Get the line of table control where doubleclick is done
GET CURSORD LINE V_LINE.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'F2'.
Get (calculate) the record of internal table
INDEX_ITAB = TABLECONTROL-TOP_LINE + V_LINE - 1.
read the the table
READ TABLE ITAB INDEX INDEX_ITAB.
Call new screen
SET SCREEN XXXX.
LEAVE SCREEN.
ENDMODULE.
Max
‎2005 Oct 24 4:07 PM
Only problem here is I do not have a GUI status. This is a SAP CRM screen and I am calling my table control in a subscreen. I do see that that the GUI status in SAP main screen has the Fcode defined for F2 but when I double click on my table control, it gives an error message saying - Function code cannot be selected.
Any ideas???
‎2005 Oct 24 4:21 PM
Hi,
Are you sure that there is a function code defined for F2 in the main screen's gui status?
Normally the message "Function code cannot be selected"
will come only if there is no function code specified for F2 function key..
You can check by placing the cursor on any field in the main screen and then go to menu System->Status. You can see the GUI Status in the popup, double click on it to navigate and see whether F2 has a function code..
And then if this is not working out then I suggest you add a Pushbutton as column to your table control and then
give a fcode to it like 'PICK'.
Sri
‎2005 Oct 24 4:34 PM
Hi
If you can't change the status gui of main screen, because it's std, I think you can't use the doubleclick. You could use a column with pushbutton instead of doubleclick. If you give a code with %, the system'll replace % symbol with the number of selected row.
For example if you give F2% as code of pushbutton, if user press the pushbutton of second row, the code'll be F22.
So in your user_command:
MODULE USER_COMMAND.
if OK_CODE(2) = 'F2'.
MOVE OK_CODE+2 TO V_LINE.
Get (calculate) the record of internal table
INDEX_ITAB = TABLECONTROL-TOP_LINE + V_LINE - 1.
read the the table
READ TABLE ITAB INDEX INDEX_ITAB.
Call new screen
SET SCREEN XXXX.
LEAVE SCREEN.
ENDIF.
ENDMODULE.
Max
Message was edited by: max bianchi
‎2005 Oct 24 4:42 PM
Yes, it is defined in the main screen Gui status. I am puzzeled too as to why I get that error message.
Anyways thanks for the helpful suggestion!
‎2005 Oct 24 4:47 PM
Even if its defined , if it is disabled in PBO with statement SET PF-STATUS .... EXCLUDING ITAB. , you will still see the error .
Cheers.
‎2005 Oct 24 4:51 PM
Hi Max/Sri,
How do you define a column as pushbutton in the internal table?
‎2005 Oct 24 4:53 PM
Hi,
In your graphical screen painter, just drag and drop a push button element on to your table control's column list, specify a name, fcode and give a header for it.
If you are working with Alpha numeric screen painter,
then first double click on the table control,
go to control elements,
click on button "New Table Column", give a name, press ENTER and then it will ask whether it is a push button or not and from that point onwards it is same as above..
Also, what sanjay said is quite possible that the fcode given for F2 function key is excluded while setting PF-STATUS. May be you should check that as well whether it is possible to remove it from the exlusion list (if it is done based upon certain conditions)..
Sri
Message was edited by: Srikanth Pinnamaneni
Message was edited by: Srikanth Pinnamaneni