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

Table control events

Former Member
0 Likes
1,442

Hi experts,

Right click event can be used in table control ? and how to do it?

Thanks and Best regards,

Yinyan Lu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,307

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,308

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

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

Hi

Have you set the form name in the attributes of the field by screen painter?

Max

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

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.

Read only

0 Likes
1,307

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_TEST

CONTEXT_MENU_1 is status gui defined for the contest menu by menu painter: it works fine

Max

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

Hi Swarna,

I right click the table control but any action happend. It didn't enter the subroutine.

Regards,

Yinyan Lu

Read only

Former Member
0 Likes
1,307

Should turn off the quick paste function.