cancel
Showing results for 
Search instead for 
Did you mean: 

Service Layer: How to change special prices

former_member411847
Discoverer
0 Kudos

Hi experts,

we are currently using service layer to update special prices.

For bp specific special prices everything is fine.

Updating with a PATCH request and B1S-ReplaceCollectionsOnPatch = true is working.

When we try to update special prices for all bps we are always getting an error.

We want to delete or change one line of SpecialPriceDataAreas.

GET /SpecialPrices(CardCode='*2',ItemCode='1234') gives us the following response:

{
   "odata.metadata": "https://10.20.30.89:50000/b1s/v1/$metadata#SpecialPrices/@Element",
   "ItemCode": "1234",
   "CardCode": "",
   "Price": 272.0,
   "Currency": "EUR",
   "DiscountPercent": 0.0,
   "PriceListNum": 2,
   "AutoUpdate": "tYES",
   "SourcePrice": "sc_PrimaryCurrency",
   "Valid": "tYES",
   "ValidFrom": null,
   "ValidTo": null,
   "SpecialPriceDataAreas": [
      {
         "PriceCurrency": "EUR",
         "AutoUpdate": "tYES",
         "Dateto": "2020-08-05",
         "Discount": 84.24070,
         "SpecialPrice": 55.0,
         "DateFrom": "2020-08-01",
         "BPCode": "",
         "PriceListNo": 4,
         "ItemNo": "1234",
         "RowNumber": 0,
         "U_ROC_DiscountName": "Test 2",
         "SpecialPriceQuantityAreas": [
            {
               "Quantity": 20.0,
               "SPDARowNumber": 0,
               "SpecialPrice": 50.0,
               "ItemNo": "1234",
               "BPCode": "",
               "RowNumber": 0,
               "PriceCurrency": "EUR",
               "Discountin": 85.67340,
               "UoMEntry": -1
            },
            {
               "Quantity": 100.0,
               "SPDARowNumber": 0,
               "SpecialPrice": 40.0,
               "ItemNo": "1234",
               "BPCode": "",
               "RowNumber": 1,
               "PriceCurrency": "EUR",
               "Discountin": 88.53870,
               "UoMEntry": -1
            }
         ]
      },
      {
         "PriceCurrency": "EUR",
         "AutoUpdate": "tYES",
         "Dateto": "2020-08-13",
         "Discount": 77.79370,
         "SpecialPrice": 77.50,
         "DateFrom": "2020-08-12",
         "BPCode": "",
         "PriceListNo": 3,
         "ItemNo": "1234",
         "RowNumber": 1,
         "U_ROC_DiscountName": "Test",
         "SpecialPriceQuantityAreas": [
            {
               "Quantity": 20.0,
               "SPDARowNumber": 1,
               "SpecialPrice": 40.0,
               "ItemNo": "1234",
               "BPCode": "",
               "RowNumber": 0,
               "PriceCurrency": "EUR",
               "Discountin": 88.53870,
               "UoMEntry": -1
            }
         ]
      }
   ]
}

Trying to update this special price by PATCH

PATCH /SpecialPrices(CardCode='*2',ItemCode='1234') with B1S-ReplaceCollectionsOnPatch = true

{
   "SpecialPriceDataAreas": [
      {
         "SpecialPriceQuantityAreas": [
            {
               "Quantity": 20.0,
               "SPDARowNumber": 0,
               "SpecialPrice": 50.0,
               "ItemNo": "1234",
               "BPCode": "",
               "RowNumber": 0,
               "PriceCurrency": "EUR",
               "Discountin": 85.67340,
               "UoMEntry": -1
            },
            {
               "Quantity": 100.0,
               "SPDARowNumber": 0,
               "SpecialPrice": 40.0,
               "ItemNo": "1234",
               "BPCode": "",
               "RowNumber": 1,
               "PriceCurrency": "EUR",
               "Discountin": 88.53870,
               "UoMEntry": -1
            }
         ]
      }
   ]
}

This request always returns an error: "[SAP AG][LIBODBCHDB SO][HDBODBC] Integrity constraint violation;301 unique constraint violated: Table(OSPP)".

Getting the whole speical price object by GET and try to update via PUT will cause the same error.

We don't know what is missing to get this work. How can we update special prices for all business partners?

We could not find an answer in the service layer documentation or online.


Thanks for any help.

Accepted Solutions (0)

Answers (0)