cancel
Showing results for 
Search instead for 
Did you mean: 

How to store context data into a database table?

Former Member
0 Kudos

Hi All,

I am very new to Web Dynpro ABAP.

I am trying to store context data into database table. For this i need to write some code.

I have created one context attribute to store data and i have one database table.

Know i want to store that context attribute's data into database table.

Can anyone provide me necessary code to do this.

Thanks in Advance!

Regards,

Sreelakshmi.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thank you. Map from Context into Wa.

Former Member
0 Kudos

Thanks!

shaik_sajid
Active Contributor
0 Kudos

Hello Sreelakshmi,

i think there would be some button and when u click that, the data of the context need to get saved into the database.

For the button,create an action.

in the action handler write the following code.

DATA lo_nd_kna1 TYPE REF TO if_wd_context_node.

DATA lo_el_kna1 TYPE REF TO if_wd_context_element,

DATA lt_kna1 TYPE wd_this->elements_znode.

DATA ls_kna1 TYPE wd_this->element_znode.

lo_nd_kna1 = wd_context->get_child_node( name = wd_this->wdctx_znode ).

lo_el_kna1 = lo_nd_kna1->get_element( ).

lo_el_kna1->get_static_attributes( IMPORTING static_attributes = ls_kna1 ).

modify kna1 from ls_kna1.

Regards

Sajid

Former Member
0 Kudos

Hi,

TO_XML method of IF_WD_CONTEXT_NODE can be used to store the context node information to XML

later you can save it in DB table by other methods.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

You will have to create a FM or a class method which will have the code for updating the database (normal ABAP DB update code), in your WDP appliction, read the context attribute (since you are new to WDA you can use the wizard to generate the code for reading the context attribute for you). You will be reading the context attribute into a normal structure/variable/table depending on what type of attribute it is, then call your FM or class method to actually update the data into the DB.

Hope this helps,

Wenonah