cancel
Showing results for 
Search instead for 
Did you mean: 

Update order with Service Layer :Cannot add row without complete selection of batch/serial numbers

xenios
Explorer
1,281

Hi Experts,

We are working with SAP Business one Service layer and we need to update the sales order lines and change the batch number using the below body. Please note that on the sales order there is already a selected Batch number lets say TEST2 with quantity 10 and we need to change the butch number to TEST1 with quantity 10.When i use the PATCH method we get an error response Cannot add row without complete selection of batch/serial numbers.

SAP Business one version: 10 FP 2102

{ "DocumentLines": [ { "LineNum": 0, "ItemCode": "TEST", "Quantity": 10, "WarehouseCode": "01", "BatchNumbers": [ { "BatchNumber": "TEST1", "ManufacturerSerialNumber": null, "InternalSerialNumber": null, "ExpiryDate": "2023-09-15", "ManufacturingDate": "2021-09-16", "AddmisionDate": "2022-04-11", "Location": null, "Notes": null, "Quantity": 10, "BaseLineNumber": 0, "TrackingNote": null, "TrackingNoteLine": null, "ItemCode": "TEST", "SystemSerialNumber": 6 } ] } ]}

Thank you for your time.

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi xenios,

For this specific scenario, we would ask you to use the header B1S-ReplaceCollectionsOnPatch with value true.

B1S-ReplaceCollectionsOnPatch is just for the scenario where you want to delete a line or update existing lines at the same time.

In other words, it is to update the matched lines and delete the unmatched lines.

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

xenios
Explorer
0 Kudos

Hi Ankit Chauhan,

Thank you for your reply.

We tested the above and it works.

Thank you in advance.

xenios
Explorer
0 Kudos

Also, I have checked on the user manual and I did not found the specific command.

Can you please let us know where I can find those commands?

Thank you for your time

0 Kudos

Hello, ankit.chauhan1!

Is that a bug? We need to update batch numbers for some specific line items and leave other items as unchanged.

Answers (1)

Answers (1)

{
    "CardCode": "S0003",
    "Comments": "创建自Service Layer",
    "DocumentLines": [
        {
            "ItemCode": "D0100285",
            "Quantity": 2.0,
            "Price": 122.13,
            "BatchNumbers": [
                {
                    "BatchNumber": "aaa",
                    "Quantity": 1.0
                },
                {
                    "BatchNumber": "bbb",
                    "Quantity": 1.0
                }
            ]
        },
        {
            "ItemCode": "D0100285",
            "Quantity": 3.0,
            "Price": 122.13,
            "BatchNumbers": [
                {
                    "BatchNumber": "ccc",
                    "Quantity": 2.0
                },
                {
                    "BatchNumber": "ddd",
                    "Quantity": 1.0
                }
            ]
        }
    ]
}



xenios
Explorer
0 Kudos

Dear chenhua123,

Thank you for your reply.

Our scenario is that we want to update the batch number for example.

Original order:

{
    "CardCode": "S0003",
    "Comments": "创建自Service Layer",
    "DocumentLines": [
        {
            "ItemCode": "D0100285",
            "Quantity": 2.0,
            "Price": 122.13,
            "BatchNumbers": [
                {
                    "BatchNumber": "aaa",
                    "Quantity": 2.0
                }
              
            ]
        }
    ]
}

Update the order like:

{
    "CardCode": "S0003",
    "Comments": "创建自Service Layer",
    "DocumentLines": [
        {
            "ItemCode": "D0100285",
            "Quantity": 2.0,
            "Price": 122.13,
            "BatchNumbers": [
               
                {
                    "BatchNumber": "bbb",
                    "Quantity": 2.0
                }
            ]
        }
    ]
}
Thank you in Advance.