on 05-04-2012 12:19 PM
Hi Experts
I have created a new method(not attribute method) in the context node class to have some common code for my requirement. Now I want call this method in Event Handler of the IMPL class. My code in Event Handler is below
DATA: lr_node TYPE REF TO ZL_BP_HEAD1_MAINSEARCH_IMPL.
CALL METHOD lr_node->zcustom_method
* EXPORTING
* attribute_path = attribute_path
* iterator =
RECEIVING
value = lv_value
I am not getting the value in lv_value.
Please help me to call Context node Zmethod in Implementation class mtethod.
Thanks
Dinesh Sing
Hello, Dinesh Sing.
Do you get a dump or an exception with your code? Because I think that lr_node should be not bound as far as you do nothing to initialize (bound) it.
Do you want to call an instance method or a static one?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right, because in context node class you are in instance itself. And everything is fine there.
Actually why is lr_node TYPE REF TO some ...._IMPL class? In general ..._IMPL class is a class of view controller. And context node class is with _CNyy postfix (where yy - some digits).
I'd suggest to try such a code:
METHOD EH_ONSOMEEVENT. "your event handler method
DATA: lr_node TYPE REF TO Zxxxxxx_CN01. "reference to your context node class. CN01 is just an example.
lr_node ?= me->typed_context->name_of_context_node->collection_wrapper->get_current( ).
* you can try this. Instead of name_of_context_node put your context node name
* if it's still initial try me->ztyped_context....
CALL METHOD lr_node->zcustom_method
* EXPORTING
* attribute_path = attribute_path
* iterator =
RECEIVING
value = lv_value .
ENDMETHOD.
Hope this will help you.
ztyped_context is suitable I think. I have tried with above code, I am getting an Exception (CX_SY_NO_HANDLER occured) at the below line in debug.
lr_node ?= me->ztyped_context->node->collection_wrapper->get_current( ).
what observed is I think only Context node attribute methods can be accessed in the IMPL class methods. If it is true then I have to replace my custom method with any GET method of the existing/new attribute in the Node.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.