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

two ALV buttons with same function code but different functionalities

Former Member
0 Likes
1,046

I am using the same method for handling the user command for both buttons. Since the function code is same i want to identify the object from which the button got called .. Can any one help in this ?? Thanks in advance

Message was edited by: Thomas Zloch - subject adjusted

5 REPLIES 5
Read only

Pawan_Kesari
Active Contributor
0 Likes
918

In your local class  where you have created method to handle event create an attribute for example NAME

create two instance of your local class with different value in NAME attribute and then register these to your individual grid.

When methods are called, you can read value from NAME attribute to find out which grid has triggered the event.

Regards,

Pawan

Read only

Former Member
0 Likes
918

Dear Pawan ,

  While debugging , suppose i clicked the button from the second alv (say object obj2) , then while debugging i could find that ,obj2->m_ucomm = FCODE , same time for obj1 (instance of alv1 )it is blank.

But i can not access obj2->m_ucomm or obj_ucomm->m_ucomm in the program since it is a protected attribute of the class cl_gui_alv_grid. How can i pass the value of m_ucom to a variable. ? If i can pass the value to a variable or if i am able to access m_ucomm using the object of alv in program then i can do the rest by checking the value of it . Can you help me in this ???

regards

Varun

Read only

Abhijit74
Active Contributor
0 Likes
918

Hello,

Isn't is possible to store the m_ucomm into a global variable?

Thanks,

Abhijit

Read only

Former Member
0 Likes
918

I tried stoirng m_ucomm to a variable, but its not possible.

Read only

viktoru
Product and Topic Expert
Product and Topic Expert
0 Likes
918

Hi Varun,

can you explane why are you using the same event handler method for two different alv grids, if you want to have different functionalities? I think it would be better to use two different methods or you can create a second event handler which inherits from the first and overrides the event handler method.

Best regards,

Viktor