4

Pulling the Sales Price via API - Sales Price - Retrieve (A2X)

 1 year ago
source link: https://answers.sap.com/questions/13859939/pulling-the-sales-price-via-api-sales-price-retrie.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
6 minutes ago

Pulling the Sales Price via API - Sales Price - Retrieve (A2X)

2 Views Last edit 2 minutes ago 2 rev

Hi experts,

We are attempting to extract pricing information from the endpoint with a given combination of business, customer, and product information.

I can see that this is supported using the Sales Price - Retrieve (A2X) API. The business documentation outlines example request and response payloads. However, when trying to make the call, while I'm getting a 200 response, the payload does not include the expected objects.

Using Postman I can call the api with the example payload (valid for our system) as outlined in the business documentation.

Request:

POST <host>/sap/opu/odata4/sap/api_salesprice/srvd_a2x/sap/salesprice/0001/

X-CSRF-Token: abc

Content-Type: application/json

Accept: application/json

Body:

"SALESORGANIZATION": "6910",

"DISTRIBUTIONCHANNEL": "10",

"DIVISION": "01",

"PRICEELEMENTSAREREQUESTED": true,

"SALESPRICERETRIEVEUSECASE": "SAP_DFLT",

"PRICINGDATE": "2023-01-01",

"PRODUCT": [

"PRODUCT": "000000001000000000"

"SOLDTOPARTY": [

"SOLDTOPARTY": "0001000000"

Response:

Status: 200 OK

Body:

"@odata.context": "$metadata",

"value": [

"name": "SalesPrice",

"url": "SalesPrice"

According to the documentation, this SHOULD return the sales price elements for this combination of customer, product and business information.

Some notes about what I have tried:

SALESPRICERETRIEVEUSECASE is used instead of setting each SALESDOCUMENTTYPE, SALESDOCUMENTITEMCATEGORY, SALESDOCUMENTITEMCATEGORY. I can set these individually, but it returns the same result.

TRANSACTIONCURRENCY and LANGUAGEISOCODE are optional fields, including these does not alter the response.

Some SAP APIs I have used require leading zeros for product, customer or other ids, other times it doesn't seem to care. In this instance I have tried referring to the product in each field PRODUCT and PRODUCTUSEDBYCUSTOMER by:

  • the 10 digit material number (as pulled from the Material field from the API A_SalesOrder()/to_Item/?).
  • the 10 digit material number with 8 leading zeros (the format required elsewhere)
  • the 10 digit material number with leading zeros to meet the 40/35 character limit of the field
  • the product code (i.e. PRT-GX-SR)

I have tried each of these against the customer number with and without leading zeros.

For each of these combinations, I am getting a 200 response with the same (lack of) content.

The API hub (which, does not support Try Out for this API), has the code snippets which I have also tried working in with my request. Though, there it looks to be outlining batch requests, rather than my single example. Regardless, I have had no luck playing around with the headers/url/format which is referred to there.

I am unsure what else I can try, and cannot seem to find any applicable forum posts regarding this api/problem anywhere. Any suggestions around this would be much appreciated.

Reference:

API hub: https://api.sap.com/api/SALESPRICE_0001/overview

Business documentation: https://help.sap.com/docs/SAP_S4HANA_CLOUD/03c04db2a7434731b7fe21dca77440da/de46c9996c154ddb9d1d8926446217f9.html


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK