2010 Oct 25 11:07 AM
Hello together,
I have the following situation: I implemented a badi; in this badi I need to access to an attribute of the instance of the outer class; the badi is called by this outer class:
In the outer class CL_WRF_APC_PURC_LIST_DIALOG the badi EXIT_PLALV_DIALOG is called:
IF mr_exit_plalv_dialog IS NOT INITIAL.
CALL METHOD mr_exit_plalv_dialog->set_style
EXPORTING
i_expanded = im_exp
i_level = im_level
i_lastline = im_lastline
ir_pl_item = imr_plitem
ir_plistline = ims_plist
CHANGING
ct_style = et_style.
ENDIF.Is there any possibility to access to the instance of CL_WRF_APC_PURC_LIST_DIALOG from badi implementation?
Thank you & best regards,
Kurt.
Hello together,
I have the following situation: I implemented a badi; in this badi I need to access to an attribute of the instance of the outer class; the badi is called by this outer class:
In the outer class CL_WRF_APC_PURC_LIST_DIALOG the badi EXIT_PLALV_DIALOG is called:
IF mr_exit_plalv_dialog IS NOT INITIAL.
CALL METHOD mr_exit_plalv_dialog->set_style
EXPORTING
i_expanded = im_exp
i_level = im_level
i_lastline = im_lastline
ir_pl_item = imr_plitem
ir_plistline = ims_plist
CHANGING
ct_style = et_style.
ENDIF.Is there any possibility to access to the instance of CL_WRF_APC_PURC_LIST_DIALOG from badi implementation?
Thank you & best regards,
Kurt.
2010 Oct 25 12:30 PM
Hi,
Inside BADI try below statement,
ME->attribute.
I have not tried but check if it works.
2010 Oct 25 12:33 PM
Hi,
Thanks for your hint, however ME is the reference of the badi instance; I need to access to the attribute of the class outside badi.
Best regards,
Kurt.
2010 Oct 25 1:26 PM
You can try it through call stack.
Check this thread in which Naimesh gives an example
2010 Oct 27 4:06 PM
Hi,
Thank you very much; I tried the following code, but I got the object not assigend:
data: ld_class type string,
ld_method type string.
data: lo_obj type ref to object.
field-symbols:
<lo_provider> type any.
ld_class = 'CL_WRF_APC_ARTICLE_REL'.
assign (ld_class) to <lo_provider>.
if sy-subrc eq 0.
lo_obj ?= <lo_provider>.
endif.Do you have any idea?
Thanks & best regards,
Kurt.
2010 Oct 28 10:12 AM
You need to add the program name where the object was created.
Example:
'(SAPMXXXXXX)CL_WRF_APC_ARTICLE_REL''
2010 Oct 28 12:35 PM
Hi,
Thank you for your hint.
The program where the class is called is RWRF_APC_POST_ART; but the following is not working:
ld_class = '(RWRF_APC_POST_ART)CL_WRF_APC_ARTICLE_REL'.
assign (ld_class) to <lo_provider>.in Program RWRF_APC_POST_ART the instance of the class CL_WRF_APC_ARTICLE_REL is created.
How can I access to the class (e.g. to a public attribute)?
Thank you & best regards,
Kurt.
2010 Oct 31 10:02 PM
Hi,
obviously it is no more possible to access to an outer class by a u201Cdirtyu201D assign.
I implemented to my class CL_WRF_APC_ARTICLE_REL a factory method in that way that I can get any instance by the article number.
Thanks again for your hints.
Best regards,
Kurt.