Quantcast
Channel: SCN : All Content - Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 3667

get element data throu Parameter or variable

$
0
0

I Try to optimize my methods and put them from my view to the component Controller.

 

In my View MAIN i got a Context Node BLUBB with some data in it.

i write a method SAVE_DATA to save all the Data ob BLUBB.

 

     DATA lo_nd_BLUBB    TYPE REF TO if_wd_context_node.     DATA lo_el_BLUBB      TYPE REF TO if_wd_context_element.     DATA ls_BLUBB            TYPE wd_this->element_BLUBB.     lo_nd_BLUBB = wd_context->get_child_node( name = wd_this->wdctx_BLUBB ).     lo_el_BLUBB = lo_nd_BLUBB->get_element( ).     IF lo_el_BLUBB IS INITIAL.     ENDIF.
 *   get all declared attributes     lo_el_BLUBB->get_static_attributes( IMPORTING static_attributes = ls_BLUBB ).
 *
 **speichern
 update BLUBB from ls_BLUBB.

This Coding workes fine in my View MAIN.

But now i what to have a Method SAVE_DATA in my Component Controller to use this more often in other Views etc.

 

I Created a Method SAVE_DATE in my CC with the Import Parameter (the Context Node BLUBB is mapped in den CC already)

TABLE Type String

 

*Übergebene Context node wird lokal übergeben.
 data: xy_node type string.
 xy_node =TABLE.     DATA lo_nd_DATA TYPE REF TO if_wd_context_node.     DATA lo_el_DATA TYPE REF TO if_wd_context_element.     DATA ls_DATA    TYPE wd_this->element_BLUBB.
 *    lo_nd_zberufuverf = wd_context->get_child_node( name = wd_this->wdctx_BLUBB ).     lo_nd_DATA = wd_context->get_child_node( name = xy_node ).     lo_el_DATA = lo_nd_DATA->get_element( ).     IF lo_el_DATA IS INITIAL.     ENDIF.
 *   get all declared attributes     lo_el_DATA->get_static_attributes( IMPORTING static_attributes = ls_DATA ).
 CASE TABELLE.   WHEN 'BLUBB'.     update ZBLUBB from ls_DATA.
 ENDCASE.

In my View MAIN i start the Method with

 

wd_comp_controller->data_save( 'BLUBB' ).

The Coding on line 8 is my Problem.


     DATA ls_DATA    TYPE wd_this->element_BLUBB.


This coding works for now..but when i whant to use an other context element...for example BLAH my Element wont do it.

 

So how can i change this definition so "BLUBB" is my Parameter or my Varaiable???

Something like this wont work, but i hope u understand what i mean

 

DATA ls_DATA TYPE wd_this->element_TABLE

Can u Please Help me.

Kind Regards

Tobi


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>