cancel
Showing results for 
Search instead for 
Did you mean: 

to get the input values from the dynamic tables and save in the SAPdatabase

Former Member
0 Kudos

HI EXPERTS,

I AM NEW TO WEB DYNPRO ABAP. MY QUERY IS HOW TO GET THE VALUES THE USER ENTERS IN THE DYNAMIC TABLE AND SAVE THE SAME IN THE SAP DATABASE. I HAVE CREATED THE TABLES BUTTON EVERYTHING BUT I DONT KNOW THE CODE HOW TO DO. PLEASE HELP ME OUT.

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

>

> HI EXPERTS,

>

> I AM NEW TO WEB DYNPRO ABAP. MY QUERY IS HOW TO GET THE VALUES THE USER ENTERS IN THE DYNAMIC TABLE AND SAVE THE SAME IN THE SAP DATABASE. I HAVE CREATED THE TABLES BUTTON EVERYTHING BUT I DONT KNOW THE CODE HOW TO DO. PLEASE HELP ME OUT.

hi,

1 there is one property OnAction of the button...

2 So, in this event handler,you have to read the context node to which ur table is binded

3 use the code wizard

control+f7

, and use the method

get_static_attribute_table

4 now u have got the vaues in internal table,so now as pointed in the previous reply, you can use the

Update

or

Modify

statement...

regards,

Amit

Former Member
0 Kudos

Hi vadiv_maha ,

You have created tables and buttonts.

Now you need to do the required coding in the action of button. In that action handler

use code wizard to read the table .

here select the context node related with the table and get the values as a table .

you will get a internal table populated with the values provided in the output.

update your data base table from this table.

sample code:-

code wizard will generate code like this:-

DATA LO_ND_STOCK TYPE REF TO IF_WD_CONTEXT_NODE. " nose STOCK

DATA LT_STOCK TYPE WD_THIS->ELEMENTS_STOCK. "internal table

  • navigate from <CONTEXT> to <CTX_VN_STOCK> via lead selection

LO_ND_STOCK = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_STOCK ).

LO_ND_STOCK->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_STOCK ).

Update database table:-

MODIFY database table FROM TABLE LT_STOCK .

Regards,

Monishnkar C

Former Member
0 Kudos

method ONACTIONCREATE .

DATA : lo_nd_phase TYPE REF TO if_wd_context_node,

lt_phase type STANDARD TABLE OF wd_this->element_phase.

DATA lo_el_phase TYPE REF TO if_wd_context_element.

lo_nd_phase = wd_context->get_child_node( name = wd_this->wdctx_phase ).

lo_el_phase = lo_nd_phase->get_element( ).

lo_nd_phase->get_static_attributes_table(

IMPORTING

table = lt_phase ).

modify ZPROPOSAL_TYPE FROM TABLE lt_phase.

endmethod.

hi Monish,

i tried executing the above code and i got an error like LT_PHASE is not long enough in the modify statement. please suggest.

Former Member
0 Kudos

Hi vadiv,

Just read that table node you created using code wizard no need to write any code.

for example here sample code.. to read table here DELIVERY is my node which is binded to table ui element.

DATA lo_nd_delivery TYPE REF TO if_wd_context_node.

DATA lo_el_delivery TYPE REF TO if_wd_context_element.

DATA ls_delivery TYPE wd_this->Element_delivery.

  • navigate from <CONTEXT> to <DELIVERY> via lead selection

lo_nd_delivery = wd_context->get_child_node( name = wd_this->wdctx_delivery ).

  • get element via lead selection

lo_el_delivery = lo_nd_delivery->get_element( ).

  • get all declared attributes

lo_el_delivery->get_static_attributes(

IMPORTING

static_attributes = ls_delivery ).

now ls_delivery containes all table data that you are entered.

now declare one table of type database table and workarea.

pass this data to table and modify db table.

Cheers,

Kris.

Former Member
0 Kudos

hi Kris,

i tried executing the above code and i got an error like LT_PHASE is not long enough in the modify statement. please suggest.

method ONACTIONCREATE .

DATA : lo_nd_phase TYPE REF TO if_wd_context_node,

lt_phase type STANDARD TABLE OF wd_this->element_phase.

DATA lo_el_phase TYPE REF TO if_wd_context_element.

lo_nd_phase = wd_context->get_child_node( name = wd_this->wdctx_phase ).

lo_el_phase = lo_nd_phase->get_element( ).

lo_nd_phase->get_static_attributes_table(

IMPORTING

table = lt_phase ).

modify ZPROPOSAL_TYPE FROM TABLE lt_phase.

endmethod.

Former Member
0 Kudos

Hi

Try with this code...

DATA : lo_nd_phase TYPE REF TO if_wd_context_node,

lt_phase type STANDARD TABLE OF wd_this->elements_phase.

DATA lo_el_phase TYPE REF TO if_wd_context_element.

lo_nd_phase = wd_context->get_child_node( name = wd_this->wdctx_phase ).

lo_el_phase = lo_nd_phase->get_element( ).

lo_nd_phase->get_static_attributes_table(

IMPORTING

table = lt_phase ).

modify ZPROPOSAL_TYPE FROM TABLE lt_phase.

Cheers,

Kris.

Former Member
0 Kudos

Hi Kris,

The code which u have semt is the same as mine. Please suggest.

Former Member
0 Kudos

HI vadiv_maha ,

Check there are some mismatch in data types with your internal table and your db table.

Regards,

Monishankar C

Former Member
0 Kudos

hi Monish,

I got wat my mistake is, my database table and my internal table does not match. I have a table with 4 fields where the first 2 fields are in one context node and the rest 2 in other context node. i want to get the values of both the context and store in the table can we do so. if so please do help.