Symptom
Updating a custom business object node in an action created in the Custom Business Object application using the "update" method does not work.
Environment
SAP S/4HANA Cloud
Reproducing the Issue
1. Accessing the Custom Business Object app
2. Creating a custom business object
3. Defining fields and key fields
4. Creating an action called "update"
5. Adding logic:
DATA ls_data TYPE yy1_CBOABC.
DATA lv_node_key TYPE yy1_kr_cboabc.
lv_node_key = CBOABC-keyfield.
DATA(lo_node) = write->get_root(
business_object_id = 'YY1_CBOABC'
key = lv_node_key
).
lo_node->get( IMPORTING data = ls_data ).
ls_data-field1 = 'String'.
lo_node->update(
CHANGING
data = ls_data
).
6. Notice the node field "field1" does not get changed.
Cause
This is a limitation of the framework where the instance on which a determination/action is called on cannot be modified by the determination/action logic.
The Custom Business Object write API is intended to modify other business object instances.
Resolution
The Custom Business Object application implements a workaround for modifying the determination/action instance by changing the value of the changing parameter.
For example, CBOABC-field1 = 'String'.
See Also
Code Samples to Write Data from Determinations or Actions to Custom Business Objects - SAP Help
Setting the Lifecycle Status to Purpose Completed with an Action - SAP Help
Keywords
cbo, custom business object, action, update, node, s/4hana cloud, s4hc, sap s/4hana cloud, public cloud, key user extensibility , KBA , BC-SRV-APS-EXT-BO , Custom Tables and Nodes , Problem