cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Sales Order Drafts via SAP Business One Service Layer API Has NULL OwnerCode

jun_dolor
Participant
0 Kudos

I'm attempting to generate a Sales Order draft using the Service Layer API call. The request is a POST made to a service layer URL: https://oursapserver:50000/b1s/v1/Drafts

The JSON data included in the request is as follows:

 

{
  "CardCode": "ABC0001",
  "NumAtCard": "ABC00001-1001",
  "DocDueDate": "2024-05-01",
  "DocDate": "2024-04-12",
  "TaxDate": "2024-04-12",
  "SalesPersonCode": "16",
  "OwnerCode": "137",
  "DocObjectCode": "17",
  "DocType": "dDocument_Items",
  "TrnspCode": 4,
  "DocumentLines": [
    {
      "LineNum": 0,
      "ItemCode": "ITM01",
      "Quantity": 4,
      "Price": 178.44,
      "Currency": "PHP",
      "VatGroup": "OVAT-V",
      "SalesPersonCode": "16",
      "OwnerCode": "137",
      "DocDate": "2024-04-12",
    },
    {
      "LineNum": 1,
      "ItemCode": "ITM02",
      "Quantity": 20,
      "Price": 250.44,
      "Currency": "PHP",
      "VatGroup": "OVAT-V",
      "SalesPersonCode": "16",
      "OwnerCode": "137",
      "DocDate": "2024-04-12",
    },
    {
      "LineNum": 2,
      "ItemCode": "ITM03",
      "Quantity": 15,
      "Price": 38.00,
      "Currency": "PHP",
      "VatGroup": "OVAT-V",
      "SalesPersonCode": "16",
      "OwnerCode": "137",
      "DocDate": "2024-04-12",
    }
  ]
}

 

 

Technology Q&A

The SalesPersonCode and OwnerCode fields correspond to an SlpCode in OSLP and empID in OHEM. It's worth noting that the SalesPersonCode specified in the JSON differs from the SlpCode associated with the CardCode in OCRD.

Upon executing the Service Layer API call, a Sales Order draft is successfully created. However, while the SlpCode is populated with the SalesPersonCode value of 16, the OwnerCode remains NULL.

What adjustments do I need to make to populate the OwnerCode?

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi jun_dolor,

What is the behaviour when you try to create the same document with the same input values manually using SAP Business One client?

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

 

View Entire Topic
jun_dolor
Participant
0 Kudos

Hi @ANKIT_CHAUHAN 

We create the Sales Order from the Sales Quotation using Copy From. The Sales Person and Owner are picked from the Sales Employee of the Business Partner master data.