Ariba Buying & Invoicing Service Entry Sheet Automatic Approval in SAP ERP with CIG
When a Service Entry Sheet (SES) is sent from Ariba Buying & Invoicing (B&I) to the SAP ERP (ECC or S/4) though the Ariba CIG adapter, the SES document is created in the ERP without acceptance. An end user must go in the SES document and manually Accept or Reject the SES in the ERP. At this moment a SES Status Update message is triggered, updating the SES document in B&I.
Customers using the SES approval workflows in B&I would prefer for the SES to be automatically approved in the SAP ERP after the approval happens in Ariba.
How to fix this?
Implement the following CIG AddOn BADIs on the SAP ERP.
The 1st BADI will change the Acceptance flag on the incoming SES message, so the SES document on the SAP ERP will be created as Approved for all SES coming from B&I.
The 2nd BADI will trigger an SES Status Update message back to B&I changing the SES Status in B&I from “Awaiting External Approval” to “Processed”. This will also make the SES Response go back to the Supplier on the Ariba Network updating the SES status there.
- CIG AddOn is on version SP08 or greater.
- The connectivity between the SAP ERP, CIG and B&I functional
- All configurations for the Service Entry Sheet are configured and tested on the SAP ERP
- SPRO activity: SAP Ariba Cloud Integration Gateway -> SAP Ariba Procurement Integration -> Application Specific Settings -> Service Entry Sheet
Implement BADI ARBCIG_SES_CREATE
Create an implementation for BADI ARBCIG_SES_CREATE (Enh. Spot ARBCIG_ES_SES_CREATE).
Implement the Method IF_ARBCIG_SES_CREATE~UPDATE_SES_BAPITABLES and add the following code.
* Making B&I SES auto accepted in ECC. CS_ENTRYSHEETHEADER-ACCEPTANCE = 'X'.
Note that if you want to include additional criteria for making certain SES to get Auto-approved and others to be approved on SAP ERP, you can do so in this Method.
This BADI is only executed when a SES is received from Ariba B&I application. It won’t affect SES coming directly from Ariba Network to the SAP ERP (Commerce Automation).
Implement BADI ARBCIG_SESR_UPDATE
Create an implementation for BADI ARBCIG_SESR_UPDATE (Enh. Spot ARBCIG_ES_SESR_UPDATE).
Implement the Method IF_ARBCIG_EX_SESR_UPDATE~POST_CHANGE_SESR_DATA and add the following code.
* Implementation to send the Accepted status for Auto_accepted SES from B&I constants: lc_p2p_import_pull TYPE arbcig_document_type_code VALUE 'ServiceSheetImportPullRequest'. data: lv_realm_name TYPE arbcig_realm_name, wa_p2p_resp TYPE arbcig_resp_p2p, ls_auth_param TYPE arbcig_authparam. * Check if a B&I SESR was triggered. We won't do anything for AN SESR. * Check if a successful message was sent back to B&I. We won't generate an Accept SESR for a failed SES. * A successful B&I SESR message will always contain the SAP SES Number. A failed SESR back to B&I won't contain the SAP SES number. if SESR_P2P-header-sap_document_id is not initial. wa_p2p_resp = SESR_P2P. * mark the SESR as Approved wa_p2p_resp-header-document_status = 'approved'. * Get the B&I Realm name SELECT SINGLE * FROM arbcig_authparam INTO ls_auth_param WHERE solution = 'AR' AND is_parent = ''. lv_realm_name = ls_auth_param-realm. * Call the SESR for the Approval message in ServiceSheetImportPullRequest CALL FUNCTION 'ARBCIG_SAP_RESPONSE_TO_P2P' EXPORTING transaction_type = lc_p2p_import_pull realm_name = lv_realm_name header = wa_p2p_resp-header return = wa_p2p_resp-return. endif.
Note that that the above code is triggering an Accepted SES Status Update message back to Ariba B&I for any SES received from B&I. If you have additional criteria for making certain SES to get Auto-approved and others to be approved on SAP ERP, you also need to include this filter criteria here in this method.