Symptom
You are working with Business Object Interface I_COSTCENTERTP_2. You have applied the sample code, however, after execution, there is no creation of cost center.
Environment
SAP S/4HANA Cloud Public Edition
Cause
The sample code is without error handling part.
Resolution
The sample code can be found: SAP Business Accelerator Hub
1. cid field should be automatically determined.
Remove - %cid = 'CID_VALUE'
Modify -
MODIFY ENTITY i_costcentertp_2
CREATE AUTO FILL CID
SET FIELDS WITH lt_costcenter_create
2. You can debug and check the content lt_reported to findout whether there are any issues during data preparation.
3. Add commit part as below
COMMIT ENTITIES BEGIN
RESPONSE OF i_costcentertp_2
" TODO: variable is assigned but never used (ABAP cleaner)
FAILED DATA(tl_commit_failed)
REPORTED DATA(tl_commit_reported).
COMMIT ENTITIES END.
Debug and check the value for tl_commit_reported. If there is content in the structure, it means error happened. You can check the error detail in the structure.
Example, KM 700 error indicates that the profit center is not valid. You can check whether profit center exists or not. Or maybe the profit center valid date is not covered within the cost center valid date. You need to adjust the input values accordingly.
4. Cost center can only be created if draft mode is off.
You should set as:
%is_draft = if_abap_behv=>mk-off
Useful links:
- For the usage of EML language, please check
Entity Manipulation Language (EML) | SAP Help Portal
- Tutorial
Keywords
Steampunk, business object interface, I_COSTCENTERTP_2 , KBA , CO-OM-CCA-2CL , Cost Center Accounting (Public Cloud) , Problem