on 01-18-2013 1:20 PM
Hey experts,
i'm actually beginning to use the assistance class in my webdynpro.
at the moment i'm trying to get a table of the node, of which i get the reference:
- i created a globale variable from type if_wd_context_node
- i created a method with an import-Parameter of the same type like before
- in the method i'm getting the reference to my context-node
no i want to get a table of the globale variable. in webdynpro i just use the wizard and get:
DATA lo_nd_mepo1211_alv TYPE REF TO if_wd_context_node.
DATA lt_mepo1211_alv TYPE wd_this->elements_mepo1211_alv.
* navigate from <CONTEXT> to <MEPO1211_ALV> via lead selection
lo_nd_mepo1211_alv = wd_context->get_child_node( name = wd_this->wdctx_mepo1211_alv ).
* @TODO handle non existant child
* IF lo_nd_mepo1211_alv IS INITIAL.
* ENDIF.
lo_nd_mepo1211_alv->get_static_attributes_table( IMPORTING table = lt_mepo1211_alv ).
but this, of course, won't work in my assistance class.
my Problem is the type of lt_mepo1211_alv .. which type should i use? i can't use the structure vor the node, because after that i added some attributes directly to the node and not to the structure.
I think with a structure like ls_mepo1211_alv i will have the same Problem of getting the right type.
Has anyone an idea, of how to solve that Problems?
regards,
Mathias
Hi,
I think you can't refer to a type created in your component.
You can try with the following work arround:
Create a new attribute in the method of your assitance class:
I_TABLE TYPE REF TO DATA.
Then before call to the method do the following:
DATA: lv_table TYPE REF TO data.
CREATE DATA lv_table TYPE TABLE OF wd_this->element_mepo1211_alv.
wd_assistt->your_method( i_node = lo_nd_your_node
i_table = lv_table)
And inside your method use the following:
FIELD-SYMBOLS: <table> TYPE ANY TABLE,
<ls_table> TYPE ANY,
<field> TYPE any.
ASSIGN i_table->* TO <table>.
lo_nd_mepo1211_alv->get_static_attributes_table( IMPORTING table = <table>.
LOOP AT <table> ASSIGNING <ls_table>.
ASSIGN COMPONENT 'YOUT_FIELD' OF STRUCTURE <ls_table> TO <field>.
ENDLOOP.
Hope this help you.
Regards,
Ricardo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathias,
You're on the right track. Let's say you have defined in the data dictionary a structure structuretype and also a table type tabletype which has line type structuretype
If you have defined your context node as having dictionary structure structuretype, then you could fetch the context node's static attributes table and pass that to your assistance class method. The node's static attributes table will be a table of type structuretype so you can use tabletype to type the assistance class method's parameter.
data lo_nd_mynode type ref to if_wd_context_node.
data lt_atrributes_table type wd_this->elements_mynode.
lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
lo_nd_mynode->get_static_attributes_table( importing table = lt_atrributes_table ).
So the piece you're missing is to define your context node with a dictionary structure.
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathias,
There's always more than one way to solve a problem. Try different approaches to see what works best for your requirements and coding style. The two approaches discussed here will achieve the same end result but delegate the work differently.
One Approach:
Another Approach:
Cheers,
Amy
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.