on 03-17-2012 4:27 PM
Hello
I have a WDA (ABAP), where in i have 4 views, by using the below code i am throwing (mostly error) messages, working fine.
As per our business requirement, we are throwing these messages in many situations/spots of different views, so kind of code redenency. So, i want to avoid this code redennecy and instead of using this piece of code on all spots of different views, i want to put this code in a central place/globally, so that i will call it by using CALL METHOD some thing like that.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
CALL METHOD l_message_manager->report_t100_message
EXPORTING
msgid = 'ZZ'
msgno = '000'
msgty = 'E'
p1 = lv_p1.
Pls. let me know can i put this code by defining a METHOD in COMPONENT CONTROLLER and i can call it where ever i needed it?
If so, pls. let me know How shoud i call that method of COMPOENENT CONTROLER
(i dont think i should use WD_THIS->THROW_MESSAGE_FROM_COMPOEMENT_CONTROLLER_Z_METHOD)?
In general, any code (say, my_global_code), if i want to act as GLOBAL (i mean, i can use/trigger it from any where/any corner of the WDA), then where should i put/place that my_global_code? How should i call it to trigger its code?
Thank you
Create a method in the component controller and pass the message attributes to it. You can call component controller methods from anywhere using the WDA wizard (the button next to Pattern button).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As already suugested, you can define a method in component controller and then calll the same in all the views by wd_comp_controller->method_name( ).
Another idea is to define a assistance class and then define the method inside that. You can use the method in all the components which use this class as assistance class.
To call the methos,
wd_assist->method_name( ).
Refer this link, here I am explaining how to use assistance class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
MSR MSR wrote:
Hello
I have a WDA (ABAP), where in i have 4 views, by using the below code i am throwing (mostly error) messages, working fine.
As per our business requirement, we are throwing these messages in many situations/spots of different views, so kind of code redenency. So, i want to avoid this code redennecy and instead of using this piece of code on all spots of different views, i want to put this code in a central place/globally, so that i will call it by using CALL METHOD some thing like that.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.
CALL METHOD l_message_manager->report_t100_message
EXPORTING
msgid = 'ZZ'
msgno = '000'
msgty = 'E'
p1 = lv_p1.
Pls. let me know can i put this code by defining a METHOD in COMPONENT CONTROLLER and i can call it where ever i needed it?
If so, pls. let me know How shoud i call that method of COMPOENENT CONTROLER
(i dont think i should use WD_THIS->THROW_MESSAGE_FROM_COMPOEMENT_CONTROLLER_Z_METHOD)?
In general, any code (say, my_global_code), if i want to act as GLOBAL (i mean, i can use/trigger it from any where/any corner of the WDA), then where should i put/place that my_global_code? How should i call it to trigger its code?
Thank you
Hi,
you will have to create a method in component controller of your compenent.
Now after you have created this method all you need to call this method from anywhere in the program.
for example say you created a method global_message.
call this like the following
wd_comp_controller->global_message( ).
This will call your code in the method you just created and so you will get the desired results..
Thanks and regards,
Sahai.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create a attribute say message_manager in component controller of type if_wd_message_manager.
then in component controller wddoinit method write the below code.
DATA l_current_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = message_manager .
now in any view if you want to generate message you can using above attibute like below coding
wd_comp_controller->message_manager-> l_message_manager->report_t100_message
EXPORTING
msgid = 'ZZ'
msgno = '000'
msgty = 'E'
p1 = lv_p1.
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.