cancel
Showing results for 
Search instead for 
Did you mean: 

WDC enhancement - only commit after manually change something

Former Member
0 Kudos

Hi all,

I'm new to WDA and now in a project upgrading to SRM7. I had implemented an enhancement (for testing) to shopping cart professional header WDC: /SAPSRM/WDC_UI_SC_DOFC_HD, view: V_SC_BOFC_HD with below statements in a post-exit on method WDDOMODIFYVIEW:

lr_nd_int = wd_context->get_child_node( name = wd_this->wdctx_HEADER ).

lr_el_int = lr_nd_int->get_element( ).

lr_el_int->Set_attribute( name = `ZZAPRID1` value = 'APPROVER-A' ).

A textview was added on the layout to show the value of ZZAPRID1. The view context HEADER (structure

/SAPSRM/S_CLL_WD_SC_HEADER had include structure CI_BBP_HDR_SC from previous SRM version), and attribute ZZAPRID1 is type CHAR12 to store approver user ID.

The problem is: only when I manually change something (e.g. shopping cart name) on shopping cart header, the ordered/saved shopping cart will successfully updated with ZZAPRID1 and I can locate the user ID in table BBP_PDHGP. If I did not change anything, the ordered/ saved shopping cart will not updated with ZZAPRID1, it is blank in table BBP_PDHGP.

May I know how to ensure the attribute is updated by my enhanced method? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>May I know how to ensure the attribute is updated by my enhanced method? Thanks

Since you enhancement is in WDDOMODIFYVIEW it should be firing on any server request. However WDDOMODIFYVIEW occurs after event handling in the phase model:

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/d2/8acd409cc4dd50e10000000a1550b0/frameset.htm

It is quite possible that your enhancement is too late and the data has already been sent into the model layer for updating the database by the time it reaches the WDDOMODIFYVIEW.

Former Member
0 Kudos

Hi Thomas,

Thanks for your reply. I relocated the codes to post-exit of method WDDOBEFOREACTION but the result is same:

When I manually update shopping cart name, the ordered shopping cart will successfully updated with ZZAPRID1. If there is nothing update before order, ZZAPRID1 is not update.

Do you have further advise?

Answers (1)

Answers (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Donald,

are you after more of a "this is the last person to view this cart" type functionality?

If the user does nothing to the cart why would you want to update the backend DB?

Look at the logic in the program - obviously the DB representation of the cart is only updated when it changes - if you want to store something when the cart doesn't change then look at what gets triggered on other actions - or potentially include a call to update DB version of the cart after every user action.

Hope this helps,

Chris

Former Member
0 Kudos

Hi Chris,

I only want to test in WDC enhancement using exit update include structure data. In my case, it seems that the exit does not flag something change or dirty, I need to find a method in interface if_wd_context_node.

Regards,

Donald

Former Member
0 Kudos

Problem solved by adding below statement:

lr_el_int->SET_CHANGED_BY_CLIENT( ).

The method in interface IF_WD_CONTEXT_ELEMENT denote element is changed by client.