cancel
Showing results for 
Search instead for 
Did you mean: 

trigger change badi when click a custom button

Former Member
0 Kudos

hello guys i want to trigger the change badi when a user clicks on a button. Any help would be create?

I am using the set change by client setting it to true and then firing the refresh but it is not working? Any clues? Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hello i am trying to get some ideas from this thread but it is not working... Any help for any gurus??????

Former Member
0 Kudos

Hello, maybe you guys are not understanding the question. But let me elaborate. This is going to be a standard dynpro component for Purchase Orders. So i have added a button to the screen. When the user clicks on the button, I want the logic to hit the change badi so that i can do my custom logic based on the values from the other views associated with the PO. Thank you.

matteo_montalto
Contributor
0 Kudos

As I told you in that linked thread, I'd suggest trying to use SET_CHANGED_BY_CLIENT method on the context of your webdynpro. This is sufficient to make the system aware of a change and trigger the CHANGE badi.

As far as I've observed doing my tests, the CHANGE badi is then triggered after an event that will follow the SET_CHANGED_BY_CLIENT execution.

So I'd suggest two test:

- pre-exit of the method you trigger when the user press your custom buttom: set_changed_by_client and then execute your code. See if the badi is then triggered;

- if not: you could "force" a subsequent action after the button press, for example, a simple REFRESH of the view. Then I'm sure that, after the set_changed_by_client method, the badi will surely be triggered.

Please be aware that I'm absolutely NOT a guru on these arguments, so I'm trying to give you some workarounds I implemented on an SRM 7 system. Probably some guru will have better and cleaner solution for your task, but as far as I've seen, these ones should meet your needs.

Former Member
0 Kudos

hey .. so i should loop at each statndard element and set it to set changed and then refresh the view with /sapsrm/if_cll_xo_mapper~fire_event_refresh ? It is still not working for me.

I can't do a post exit or pre exit because it is a custom method and it is greyed out as well.

Former Member
0 Kudos

hey.. actually i got the element that was selected which is the button and set the set change by client to X. Then i called the refresh /sapsrm/if_cll_xo_mapper~fire_event_refresh but it is still not working.

when i debug i can see the changed by client attribute as X as well. Am i doing something wrong? Thanks!

Former Member
0 Kudos

so this is what i did for my custom button.

element = wd_context->get_lead_selection( ).

CALL METHOD element->set_changed_by_client

EXPORTING

flag = ABAP_TRUE.

call the method wd_comp_controller /sapsrm/if_cll_xo_mapper~fire_event_refresh

and it is not triggering my changed badi. Let me know what is wrong? Thanks!