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

How to distinguish between two pushbuttons with same function codes

Former Member
0 Likes
892

Hi there,

I had a requirement where there are two pushbuttons with same fcodes, and I want to know which push button is pressed .

for example, there are two input fields, and beside each input field, there is one pushbutton, which have same fcodes.(CHNG)

The functionality is same except the value to be assigned for a exporting parameter to call FM is different.I get the exporting parameters from the input fields.

So how can i differentiate between two pushbuttons pressed.

Regards,

Anil .

6 REPLIES 6
Read only

Former Member
0 Likes
812

First of all is it compulsary to have same Fcode for 2 buttons?

If so can u Elabrate Little bit means What r the input values it differ means how do u Distinguish ......

Murthy

Read only

0 Likes
812

Yes I want same fcode for 2 buttons, since there are two such pair of buttons with same fcodes.

Actually, each input field contains different structure name, and upon clicking the pushbutton, the particular input field value must be assigned to exporting parameter of same FM.

So can u please find solution .

Read only

0 Likes
812

Hi Anil,

Ok then Do one thing... Means if the Input Values are known and limited then According to that u Fix.

MEans

case sy-ucomm.

when 'fcode'.

if p_data = 'XXXXXXX'.

Call Function AAAAAAAAAA.

elseif p_data = 'YYYYYYYY'.

Call Function BBBBBBBBBB.

endif.

endcase.

Just check this out and let me if know.

Bye

Murthy.

Read only

0 Likes
812

Hi

If you have defined the pushbutton on the screen you can use the statamente GET CURSOR:

MODULE USER_COMMAND.
  
  CASE OK_CODE.
     WHEN 'CHNG'.
        GET CURSOR FIELD VA_FIELD.
        
        IF VA_FIELD = 'BUTTON1'.
        ELSE.
        ENDIF.

Max

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
812

Hi,

Use the different Function Codes and then based on clicking the button, u determine the function code and thenimplement ur logic,

As far i know it is not possible to know which button is clicked with the same function code.

Cheers,

Simha.

Read only

Former Member
0 Likes
812

hi

good

declare a flag as 'x'.

use the case and end case statement and pass the value of sy-ucomm and check which pushbutton has been pressed and you can generate action accordingly.

thanks

mrutyun^