Product Information
Trigger Sales Price Approval Workflow Using OData Service
The OData service (API_SLSPRICINGCONDITIONRECORD_SRV) supports the approval process when user works on condition record for sales. The introduction of the OData service is in How to use Condition Record OData Service for Sales.
There are 3 main parts for the approval process:
- The process expert configures workflow, refers to Workflow Configuration for SAP S/4HANA Sales Price.
- The requester triggers workflow when using the OData service to create, update or delete condition record
- The approver makes decision to do ‘Approve’ or ‘Reject’ in My Inbox app.
Important fields for Workflow
Field | Entity | Comment |
ConditionReleaseStatus | A_SlsPrcgCndnRecdValidity | Reflect the approval progress |
SalesPriceApprovalRequest | A_SlsPrcgConditionRecord | Approval request ID |
PrevApprovedConditionRecord | A_SlsPrcgConditionRecord | Previously approved condition record |
Create new record with condition validity
The requester posts a new record, then the system simulates the workflow. If it is for workflow, then a new record number is generated and its release status in condition validity is set ‘D’, which means ‘In Review’, and workflow is triggered. If not, then condition record is created without workflow.
HTTP Method: POST
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord
HTTP Request:
{ "ConditionRecord" : "$$00000001", "ConditionSequentialNumber" : "01", "ConditionTable" : "304", "ConditionApplication" : "V", "ConditionType" : "ZNEO", "ConditionRateValue" : "10.00", "ConditionRateValueUnit" : "EUR", "ConditionRateRatio" : "0.000000000", "ConditionRateRatioUnit" : "", "ConditionRateAmount" : "10.000000000", "ConditionCurrency": "EUR", "to_SlsPrcgCndnRecdValidity" : [ { "ConditionRecord" : "$$00000001", "ConditionValidityEndDate" : "3028-11-11T00:00:00", "ConditionValidityStartDate" : "3026-11-11T00:00:00", "ConditionApplication" : "V", "ConditionType" : "ZNEO", "Material" : "TG-D06", "SalesOrganization" : "1710", "DistributionChannel" : "10" } ], "to_SlsPrcgCndnRecdSuplmnt" : [ { "ConditionRecord" : "$$00000001", "ConditionSequentialNumber" : "02", "ConditionTable" : "304", "ConditionApplication" : "V", "ConditionType" : "PPR0", "ConditionRateValue" : "20.00", "ConditionRateValueUnit" : "EUR", "ConditionRateRatio" : "0.000000000", "ConditionRateRatioUnit" : "", "ConditionRateAmount" : "20.000000000", "ConditionCurrency": "EUR" } ], "to_SlsPrcgCndnRecordScale" : [ { "ConditionRecord": "$$00000001", "ConditionSequentialNumber": "01", "ConditionScaleLine": "0001", "ConditionScaleQuantity": "10", "ConditionScaleQuantityUnit": "PC", "ConditionScaleAmount": "0", "ConditionScaleAmountCurrency": "", "ConditionRateValue": "10", "ConditionRateValueUnit": "EUR", "ConditionRateRatio": "0", "ConditionRateRatioUnit": "", "ConditionRateAmount": "10", "ConditionCurrency": "EUR" } ], "to_SlsPrcgConditionRecordText" : [ { "ConditionRecord": "$$00000001", "ConditionSequentialNumber": "01", "Language": "EN", "ConditionText": "Test approval " } ] }
HTTP Response: for entity A_SlsPrcgConditionRecord
<d:ConditionRecord>0000328158</d:ConditionRecord> <d:ConditionSequentialNumber>1</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:PricingScaleType>A</d:PricingScaleType> <d:PricingScaleBasis>C</d:PricingScaleBasis> <d:ConditionCalculationType>C</d:ConditionCalculationType> <d:ConditionRateValue>10.00</d:ConditionRateValue> <d:ConditionRateValueUnit>EUR</d:ConditionRateValueUnit> <d:ConditionRateAmount>10.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency> <d:ConditionQuantity>1</d:ConditionQuantity> <d:ConditionQuantityUnit>PC</d:ConditionQuantityUnit> <d:ConditionIsDeleted>false</d:ConditionIsDeleted> <d:SalesPriceApprovalRequest>0000328158</d:SalesPriceApprovalRequest> <d:PrevApprovedConditionRecord/>
HTTP Response: for A_SlsPrcgConditionRecord(‘0000328158’)/to_SlsPrcgCndnRecdValidity
<d:ConditionRecord>0000328158</d:ConditionRecord> <d:ConditionValidityEndDate>3028-11-11T00:00:00</d:ConditionValidityEndDate> <d:ConditionValidityStartDate>3026-11-11T00:00:00</d:ConditionValidityStartDate> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionReleaseStatus>D</d:ConditionReleaseStatus> <d:Material>TG-D06</d:Material> <d:SalesOrganization>1710</d:SalesOrganization> <d:DistributionChannel>10</d:DistributionChannel>
The approver goes to My Inbox app, finds the approval request, and checks the details (e.g. release status, amount, approval request ID) after clicking ‘Open Task’ button.
Open Task for Approval Request 0000328158
Amount for Approval Request 0000328158
Condition Record for Approval Request 0000328158
Then the approver goes back to the previous page and clicks ‘Reject’ button, the release status is changed to Rejected (E).
Reject for Approval Request 0000328158
The requester can check the release status using below request URI via HTTP method GET.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000328158')/to_SlsPrcgCndnRecdValidity
HTTP Response:
<d:ConditionRecord>0000328158</d:ConditionRecord> <d:ConditionValidityEndDate>3028-11-11T00:00:00</d:ConditionValidityEndDate> <d:ConditionValidityStartDate>3026-11-11T00:00:00</d:ConditionValidityStartDate> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionReleaseStatus>E</d:ConditionReleaseStatus>
The requester uses the same HTTP request to trigger workflow. A new record number and an approval request are generated.
HTTP Response: for entity A_SlsPrcgConditionRecord
<d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionSequentialNumber>1</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:PricingScaleType>A</d:PricingScaleType> <d:PricingScaleBasis>C</d:PricingScaleBasis> <d:ConditionCalculationType>C</d:ConditionCalculationType> <d:ConditionRateValue>10.00</d:ConditionRateValue> <d:ConditionRateValueUnit>EUR</d:ConditionRateValueUnit> <d:ConditionRateAmount>10.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency> <d:ConditionQuantity>1</d:ConditionQuantity> <d:ConditionQuantityUnit>PC</d:ConditionQuantityUnit> <d:ConditionIsDeleted>false</d:ConditionIsDeleted> <d:SalesPriceApprovalRequest>0000328159</d:SalesPriceApprovalRequest> <d:PrevApprovedConditionRecord/>
HTTP Response: For A_SlsPrcgConditionRecord(‘0000328159’)/to_SlsPrcgCndnRecdValidity
<d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionValidityEndDate>3028-11-11T00:00:00</d:ConditionValidityEndDate> <d:ConditionValidityStartDate>3026-11-11T00:00:00</d:ConditionValidityStartDate> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionReleaseStatus>D</d:ConditionReleaseStatus> <d:Material>TG-D06</d:Material> <d:SalesOrganization>1710</d:SalesOrganization> <d:DistributionChannel>10</d:DistributionChannel>
After the approver clicks ‘Approve’ button in My Inbox app, the release status is changed to Released (blank).
Approve for Approval Request 0000328159
The requester can check the approval status using below request URI via HTTP method GET.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord('0000328159')/to_SlsPrcgCndnRecdValidity
HTTP Response:
<d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionValidityEndDate>3028-11-11T00:00:00</d:ConditionValidityEndDate> <d:ConditionValidityStartDate>3026-11-11T00:00:00</d:ConditionValidityStartDate> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionReleaseStatus/>
Add new supplement
The requester can add new supplement for existing record via POST entity A_SlsPrcgCndnRecdSuplmnt.
If it is for workflow, system will generate a new record for the existing record.
HTTP Method: POST
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt
HTTP Request:
{ "ConditionRecord" : "0000328159", "ConditionSequentialNumber" : "3", "ConditionTable" : "304", "ConditionApplication" : "V", "ConditionType" : "PPR0", "ConditionRateAmount" : "20.000000000", "ConditionCurrency" : "EUR", "ConditionQuantity" : "1", "ConditionQuantityUnit" : "PC" }
HTTP Response:
<d:ConditionRecord>0000328160</d:ConditionRecord> <d:ConditionSequentialNumber>3</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>PPR0</d:ConditionType> <d:ConditionRateAmount>20.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency> <d:ConditionQuantity>1</d:ConditionQuantity> <d:ConditionQuantityUnit>PC</d:ConditionQuantityUnit>
The approver goes to My Inbox to check the details.
Open Task for Approval Request 0000328160
Details for Approval Request 0000328160
After the approver clicks ‘Approve’ button in My Inbox app, the release status is changed to Released (blank). The new supplement is added to the existing record, and the new record is deleted.
The requester can check the new supplement using below request URI via HTTP method GET.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000328159',ConditionSequentialNumber='3')
HTTP Response:
<d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionSequentialNumber>3</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>PPR0</d:ConditionType> <d:ConditionRateAmount>20.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency> <d:ConditionQuantity>1</d:ConditionQuantity> <d:ConditionQuantityUnit>PC</d:ConditionQuantityUnit>
Note: The requester can also add new scale, record text, supplement text like new supplement.
Change approved sales price
The requester can change all entities via actions PATCH, PUT.
If the request is for workflow, it generates new record with ‘In Review’ (D) release status.
Here change the amount of entity A_SlsPrcgConditionRecord.
HTTP method: PATCH
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Request:
if-match: W/"'8749AAF0583FEB8EC450F9836945C06533A86D49'" { "ConditionRateAmount" : "210.000000000", "ConditionCurrency" : "EUR" }
HTTP Response:
Status code is 204.
The requester can get the approval request number via GET method.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Response:
<d:SalesPriceApprovalRequest>0000330352</d:SalesPriceApprovalRequest>
The approver goes to My Inbox app and finds the approval request, then clicks ‘Open Task’ button.
Open Task for Approval Request 0000330352
Details for Approval Request 0000330352
Then go back to the previous page, click ‘Approve’ button.
Approve for Approval Request 0000330352
The requester checks the result via GET method.
Request URI: /sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Response: <d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionSequentialNumber>1</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionRateAmount>210.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency>
Delete condition supplement
If the request is for workflow and deletion is supplement A_SlsPrcgCndnRecdSuplmnt, then it will generate new record with release status ‘D’ (In Review).
The requester deletes supplement.
HTTP Method: DELETE
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000328159',ConditionSequentialNumber='3')
HTTP Request:
If-Match: W/"'940F7312C8E803DB553781C5E16DEBF409231123'"
HTTP Response:
Status code is 204.
The requester can get the approval request number via GET method.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Response:
<d:SalesPriceApprovalRequest>0000330353</d:SalesPriceApprovalRequest>
The approver goes to My Inbox app, and clicks ‘Open Task’ button.
Details for Approval Request 0000330353
Go back to the previous page, click ‘Approve’ button
Approve for Approval Request 0000330353
The requester checks if the supplement is deleted via GET method.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgCndnRecdSuplmnt(ConditionRecord='0000328159',ConditionSequentialNumber='3')
HTTP Response:
<d:ConditionRecord>0000328159</d:ConditionRecord> <d:ConditionSequentialNumber>3</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>PPR0</d:ConditionType> <d:ConditionIsDeleted>true</d:ConditionIsDeleted>
Note: The same behavior also applies when the requester deletes the following entity A_SlsPrcgCndnRecordScale, A_SlsPrcgConditionRecordText or A_SlsPrcgCndnSupplementText.
Delete approved sales price
If the request is for workflow and deletion is for record entity A_SlsPrcgConditionRecord, then it will generate new record with release status ‘F’ (Request Deletion).
The requester deletes sales price.
HTTP Method: DELETE
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Request:
If-Match: W/"'F65BD510D70B88252786421C4BFFB9F0CE04F472'"
HTTP Response:
Status code is 204.
The requester can get the approval request number via GET method.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000328159')
HTTP Response:
<d:SalesPriceApprovalRequest> 0000330358</d:SalesPriceApprovalRequest>
The approver goes to My Inbox app, and clicks ‘Open Task’ button.
Details for Approval Request 0000330358
Go back to the previous page. Click ‘Reject’ button.
Reject for Approval Request 0000330358
There is no change on the record 0000328159. The new record 0000330358 is marked “deleted”.
The requester can get this information via GET method.
Request URI:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord(ConditionRecord='0000330358')
HTTP Response:
<d:ConditionRecord>0000330358</d:ConditionRecord> <d:ConditionSequentialNumber>1</d:ConditionSequentialNumber> <d:ConditionTable>304</d:ConditionTable> <d:ConditionApplication>V</d:ConditionApplication> <d:ConditionType>ZNEO</d:ConditionType> <d:ConditionRateAmount>210.000000000</d:ConditionRateAmount> <d:ConditionCurrency>EUR</d:ConditionCurrency> <d:ConditionIsDeleted>true</d:ConditionIsDeleted> <d:SalesPriceApprovalRequest>0000330358</d:SalesPriceApprovalRequest> <d:PrevApprovedConditionRecord>0000328159</d:PrevApprovedConditionRecord>
Note: The sales price with ‘Rejected’ (E) release status can also be deleted.
Summary
In this blog, we introduced how to use workflow of condition record OData Service for sales part. The request example can be copied directly and change some data as test input.
Another relevant blog for workflow in Manage Prices – Sales app, please refer to