Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BATCH update return error #81

Open
halflores opened this issue Oct 7, 2024 · 2 comments
Open

BATCH update return error #81

halflores opened this issue Oct 7, 2024 · 2 comments

Comments

@halflores
Copy link

When I run a batch update like the following.
image

I get the following error message:
{
"error" : {
"code" : "-1116",
"message" : "Could not commit transaction: Error -1 detected during transaction"
}
}
Thanks in advance

@bgmulinari
Copy link
Owner

Hi, @halflores. I noticed that you are specifying "1" as the Content-ID for all your requests. This should be a unique identifier within your changeset.

If the problem still persists, see if you can share a small snippet of code that simulates the error so I can try to reproduce it on my end.

@halflores
Copy link
Author

halflores commented Oct 8, 2024

Hi,
Thank you. I would like to point out that there are times when the error message appears. So, is it possible that it is the memory allocated in SAP?
I am attaching the code

    public async Task<List<BatchResponse>> UpdateBatchItemsAsync(List<Item> itemEntidades, Login login)
    {
        try
        {
            List<SLBatchRequest> slBatchRequests = new List<SLBatchRequest>();
            List<BatchResponse> batchResponses = new List<BatchResponse>();
            int contentId = 1;
            foreach (Item itemEntidad in itemEntidades)
            {
                string source = string.Format("Items('{0}')", itemEntidad.ItemCode);
                SLBatchRequest slBatchRequest = new SLBatchRequest(HttpMethod.Patch, source, itemEntidad, contentId);
                slBatchRequests.Add(slBatchRequest);
                contentId +=1;
            }

            Tuple<HttpResponseMessage[], string> results = await _slConnections[login.SLConexion].PostBatchAsync(slBatchRequests.ToArray<SLBatchRequest>());

            batchResponses = SAPFunctions.MapResponse(results);
            
            return batchResponses;
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "UpdateBatchItemsAsync");
            throw;
        }
    }

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants