‎2010 Jan 04 8:25 AM
Hi experts,
Right click event can be used in table control ? and how to do it?
Thanks and Best regards,
Yinyan Lu
‎2010 Jan 04 8:33 AM
Hi
Yes it can, but I suppose it's not link to table control but to input/output field: try to check the help for the [menu contest|http://help.sap.com/saphelp_nw04/helpdata/en/94/c4a6377cc0c92ce10000009b38f8cf/content.htm]
Max
‎2010 Jan 04 8:33 AM
Hi
Yes it can, but I suppose it's not link to table control but to input/output field: try to check the help for the [menu contest|http://help.sap.com/saphelp_nw04/helpdata/en/94/c4a6377cc0c92ce10000009b38f8cf/content.htm]
Max
‎2010 Jan 04 9:32 AM
Hi Max,
I set ON_CTMENU_TEST in table control, and add the flowing code
FORM ON_CTMENU_TEST USING p_menu TYPE REF TO cl_ctmenu.
CALL METHOD p_menu->add_function
EXPORTING fcode = 'TXT1'
text = 'test1'
icon = ' '
ftype = ' '
disabled = ' '
hidden = ' '
checked = ' '.
CALL METHOD p_menu->add_function
EXPORTING fcode = 'TXT2'
text = 'test2'
icon = ' '
ftype = ' '
disabled = ' '
hidden = ' '
checked = ' '.
ENDFORM.
Then i right click the table control, nothing was happend. How can i do ?
Thanks and Best regards,
Yinyan Lu
‎2010 Jan 04 9:45 AM
Hi
Have you set the form name in the attributes of the field by screen painter?
Max
‎2010 Jan 04 9:55 AM
Hi Max,
Yeap, I have set the 'TEXT' behind the 'ON_CTMENU_' field in screen painter.
Thanks and Best regards,
Yinyan Lu
Edited by: YINYAN LU on Jan 4, 2010 10:57 AM
‎2010 Jan 04 10:29 AM
Hi YinYan,
As teh contetx menu is defined as 'TEXT', then the form name should be ON_CTMENU_TEXT. Correct the form name and check if it is working.
Also cehck the program DEMO_DYNPRO_CONTEXT_MENU. It may helps you.
Regards,
Swarna Munukoti.
‎2010 Jan 04 10:29 AM
I've inserted the following modification in your sample:
FORM ON_CTMENU_TEST USING P_MENU TYPE REF TO CL_CTMENU.
DATA: PROG TYPE PROGRAM.
PROG = SY-REPID.
CALL METHOD P_MENU->LOAD_GUI_STATUS
EXPORTING
PROGRAM = PROG
STATUS = 'CONTEXT_MENU_1'
MENU = P_MENU.
CALL METHOD P_MENU->ADD_FUNCTION
EXPORTING
FCODE = 'TXT1'
TEXT = 'test1'
ICON = ' '
FTYPE = ' '
DISABLED = ' '
HIDDEN = ' '
CHECKED = ' '.
CALL METHOD P_MENU->ADD_FUNCTION
EXPORTING
FCODE = 'TXT2'
TEXT = 'test2'
ICON = ' '
FTYPE = ' '
DISABLED = ' '
HIDDEN = ' '
CHECKED = ' '.
ENDFORM. "ON_CTMENU_TESTCONTEXT_MENU_1 is status gui defined for the contest menu by menu painter: it works fine
Max
‎2010 Jan 05 5:17 AM
Hi Both,
It is 'TEST'. I checked it.
How can i check it worked, i right click on the table control, but nothing happend, no context menu popup.
Thanks,
Yinyan Lu
‎2010 Jan 05 5:50 AM
Hi Yinyan,
Add one more method as mentioned in the demo program DEMO_DYNPRO_CONTEXT_MENU
FORM ON_CTMENU_TEST USING p_menu TYPE REF TO cl_ctmenu.
DATA test_menu TYPE REF TO cl_ctmenu.
CREATE OBJECT test_menu.
CALL METHOD test_menu->add_function
EXPORTING fcode = 'TXT1'
text = 'test1'
icon = ' '
ftype = ' '
disabled = ' '
hidden = ' '
checked = ' '.
CALL METHOD test_menu->add_function
EXPORTING fcode = 'TXT2'
text = 'test2'
icon = ' '
ftype = ' '
disabled = ' '
hidden = ' '
checked = ' '.
CALL METHOD p_menu->ADD_MENU
EXPORTING
MENU = test_menu.
ENDFORM.
Check if it helps you in anyway
Regards,
Swarna Munukoti
‎2010 Jan 05 5:59 AM
Hi Swarna,
I added the additional method but It also can't work. Do i need to call the ON_CTMENU_TEST subroutine ? or the system will call it automatical when i right click the table control ?
Regards,
Yinyan Lu
‎2010 Jan 05 6:04 AM
Hi Yinyan,
It will be called automatically if you place the form code in your program. Do one thing: Keep a break-point in the form and check whether the form is getting called or not when you do right click?
Regards,
Swarna Munukoti
‎2010 Jan 05 10:50 AM
Hi Swarna,
I right click the table control but any action happend. It didn't enter the subroutine.
Regards,
Yinyan Lu
‎2010 Oct 12 8:37 AM