Dear experts,
"Cannot trigger document approval with query via Service Layer and no matching record found when posting document for approval with condition “always”
I have enabled document ownership and EnableApprovalProcedureInDI.
I have created Approval Template for approval process.
As I remembered when creating document for approval via DI API, there is a child of Document object which handles the approval process something like this:

And I checked the metadata for Purchase Order entity in Service Layer and I found these:

So I tried to create Purchase Order with Document_ApprovalRequest.
First, I tried to set query for the approval. However, when I tried to POST the Purchase Order document, it went straight creating the PO without triggering the approval. Below is my payload for the PO:

Next I tried to remove the query and made the condition to “Always”. When I POST the Purchase Order, I got error no matching record found:

However, when I check, the alert for approving request shows up but the approval request remarks (Testing Approval from SL) was not there.

Is there any missing setting or fields that should be filled?
Thank you
Request clarification before answering.
This question seems to have been answered here:
https://answers.sap.com/questions/13087767/error-creating-document-when-it-is-subject-to-an-a.html
Summary: the "record not found" is because Service Layer tries to retrieve the created document and fails because it was added as a draft only. You can add the HTTP Header "Prefer: return-no-content" to prevent the error. Either way, according to the linked answer, the document should be created successfully as a draft.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same issue/question. I have no idea yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.