cancel
Showing results for 
Search instead for 
Did you mean: 

Data updation problem?

Former Member
0 Kudos

Hi All,

I have two buttons, submit and save. in submit i am calling FM through service call to get data. data is coming correctly.

In save i am trying to save any changed data. but changed data is not saving, i checked through debug in table showing changed data, but in database it is not updating.

code i am using in SAVE button.

DATA lo_nd_it_vttk TYPE REF TO if_wd_context_node.

DATA lo_el_it_vttk TYPE REF TO if_wd_context_element.

DATA ls_it_vttk TYPE wd_this->Element_it_vttk.

DATA lt_it_vttk TYPE wd_this->Elements_it_vttk.

  • Data lt_it_vttk type STANDARD TABLE OF if_main=>Element_it_vttk.

  • DATA lt_it_vttk TYPE STANDARD TABLE OF vttk.

DATA wa_vttk TYPE vttk.

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

lo_nd_it_vttk = wd_context->path_get_node( path = `ZSHIPMENT_CHANGE.CHANGING.IT_VTTK` ).

  • get element via lead selection

lo_el_it_vttk = lo_nd_it_vttk->get_element( ).

  • get all declared attributes

lo_el_it_vttk->get_static_attributes(

IMPORTING

static_attributes = ls_it_vttk ).

******Changing DATA ************

WA_VTTK-EXTI1 = LS_IT_VTTK-EXTI1.

WA_VTTK-DTDIS = LS_IT_VTTK-DTDIS.

WA_VTTK-UZDIS = LS_IT_VTTK-UZDIS.

WA_VTTK-DPREG = LS_IT_VTTK-DPREG.

WA_VTTK-UPREG = LS_IT_VTTK-UPREG.

append WA_VTTK to lt_it_vttk .

MODIFIED DATA IS COMING TO lt_it_vttk TABLE. BUT NOT UPDATING DB

  • lock the table

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'VTTK'

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

MODIFY VTTK from table lt_it_vttk.

if sy-subrc is initial.

COMMIT WORK .

else.

ROLLBACK work.

endif.

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'VTTK' .

In this i am missing anything? Please Help.

Thanks,

Madan.

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

I guess the problem is here.

******Changing DATA ************
WA_VTTK-EXTI1 = LS_IT_VTTK-EXTI1.
WA_VTTK-DTDIS = LS_IT_VTTK-DTDIS.
WA_VTTK-UZDIS = LS_IT_VTTK-UZDIS.
WA_VTTK-DPREG = LS_IT_VTTK-DPREG.
WA_VTTK-UPREG = LS_IT_VTTK-UPREG.

you are not passing any key fields value here.

i guess you need to pass the value of

WA_VTTK-TKNUM field also.

SO ADD

WA-VTTK-TKNUM = LS_IT_VTTK-TKNUM.

Thanks

sarbjeet singh

Former Member
0 Kudos

Thanks Sarbjeet.. U solved.

Thanks,

Madhan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Did you check sy-subrc value after the call tp FM 'ENQUEUE_E_TABLE' and after the Modify statement??

Is sy-subrc having 0?

Best Regards,

Srilatha

Former Member
0 Kudos

Hi Srilatha,

Yes, sy-subrc value is '0' after FM and Modify statement also.

Thanks,

Madhan.

Former Member
0 Kudos

Hi Madan,

I am not sure if using sy-subrc = initial is the right usage. Can you try with sy-subrc = 0 as the condition for commit.

Everything else seems to be perfect.

Best Regards,

Srilatha

former_member226203
Active Contributor
0 Kudos

Check if the structure of the internal table is same as the database table.

Also, check if the entries being changed are having the same primary key.In such case, the new values will overwrite the old values.