SAP Knowledge Base Article - Public

3321979 - Unable to Upload Scanned Invoices via OData with a Technical User

Symptom

Supplier invoices uploaded via OData are stuck in 'In Process' status in Invoice Scanning view.

Environment

SAP Business ByDesign

Reproducing the Issue

  1. Upload the invoices (PDF files) via OData / Postman.
  2. Go to the front end (ByDesign system).
  3. Go to Supplier Invoicing work center.
  4. Go to Invoice Scanning view.
  5. Check the files that were uploaded.

You can see that their statuses are 'In Process'. They are stuck in process status. Hence invoices are not created because user cannot open/access them.

Cause

You are trying to upload invoices through OData with a technical user instead of a business user. Technical users can create invoices (not post them) in web service scenario, but not for via OData.

That's because when the invoice scanning is triggered, a backend Machine Learning service is used, which is a service for business purposes only. Technical users are not authorized to use this specific service.

Resolution

Firstly, there are other options to create Supplier Invoices in the system, such as using the Collaboration Window tool, via web service and manually create then.

Secondly, regarding the OData scenario. A technical user can upload a PDF file, but the Invoice Scanning should be performed by a business user. You can follow the steps below (please refrain that myxxxxxx is your tenant):

  1. Upload the PDF via technical user and POST the following endpoint:  https://myxxxxxx.sapbydesign.com/sap/byd/odata/v1/scannedinvoicestagingodata/ScannedInvoiceStagingObjectCollection 
  2. Copy the Object ID obtained  in the response body after posting the above POST request.
  3. Perform a GET request via business user on the following endpoint and in the header request, add "x-csrf-token"  key and it's value as "fetch" to get x-csrf-token:  https://myxxxxxx.sapbydesign.com/sap/byd/odata/v1/scannedinvoicestagingodata?format=json
  4. Copy the x-csrf-token obtained in the response header after executing Step 3.
  5. Perform POST request via the same business user on the following endpoint and in the header request, add "x-csrf-token" key and set it's value with value copied in Step 4 to start the Invoice Scanning: https://myxxxxxx.sapbydesign.com/sap/byd/odata/v1/scannedinvoicestagingodata/process?ObjectID='{{ObjectID}}' where, {{ObjectID}} is the Object ID copied in Step 2.

If you with to run the above process in a Postman collection serially without any manual intervention, you can import the Postman collection .json file available in the Attachments section of this KBA. It is required that the Initial and Current value of the following collection variable values is maintained, and run the collection:

  1. tenant: myxxxxxx (myxxxxxx is your tenant)
  2. filename: fileName.pdf
  3. BinaryFileData: 64 base encoded pdf binary string
  4. TechnicalUser: user created via Communication Arrangement
  5. TechnicalUserPassword: password of the above technical user
  6. BusinessUser: user assigned with Invoice Scanning Work Center View (in case if there is a Business Configuration scoping to create Invoice after scanning is complete, then Invoices and Credit Memos Work center view also needs to be assigned)
  7. BusinessUserPassword: password of the above Business User

Keywords

Supplier Invoice; OData; Postman; Invoice Scanning; Technical User; Business User , KBA , AP-SIP-SIV , Supplier Invoice , How To

Product

SAP Business ByDesign all versions

Attachments

SAP Invoice Scanning.postman_collection.json