on 03-18-2024 12:19 PM
I connect to the SAP service layer via Nestjs.
In the SAP software I have created User Defined Fields for the IncomingPayment entity and A/R Invoice entity.
There are already a ton of entities created and all of them have their UDF value set to null.
I decided to programmatically set them using Nestjs with a for loop.
So what I do is fetch /IncomingPayments (GET Request) and I set the 'Prefer' header to 'odata.maxpagesize=30000'. This way I ensure all of the Incoming Payments ever created are fetched.
I ensure only the DocEntry and PaymentInvoices properties are selected.
Using a for loop, I loop over all of the fetched entities and I then do a PATCH request to /IncomingPayments(i) where i is the current incomingpayment being looped over. By accessing the first element of PaymentInvoices (PaymentInvoices[0]) and then getting it's DocEntry property (PaymentInvoices[0].DocEntry), I get the A/R Invoice Docentry that the current incoming payment is based on.
In the patch request body I have this:
{
"U_invoice_id": invoiceId,
}
This is the approach I use to update each incoming payment.
But, I noticed not all of them are getting updated when I use this method.
I thought the Prefer header was the cause of that so I reduced it to 1000 instead of 30000.
But that still doesn't update all incoming payments. Some are skipped and I need to run the service multiple times to update all of them.
Is there a more efficient way to do this??
Maybe in SAP itself.
Using a Script?
Help
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.