cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear batch number assignment

Former Member
0 Kudos
966

Hello experts,

We use DI API to re-assign Batch Numbers automatically in Sales Order.

When the assignment is wrong, how to clear the assignment in Sales Order by DI-API ?

I had tried to clear it via DTW.

There are no error message and no effect.

Can someone help me ?

It would be very appreciated.

Many thanks for your time in advance.

Best regards

Sharon

View Entire Topic
maik_delly
Active Contributor
0 Kudos

Hi Sharon,

you have to set the quantity of the batchline to zero :


SAPbobsCOM.Documents oDoc = SBO_Company.GetBusinessObject(BoObjectTypes.oOrders);

if (oDoc.GetByKey(DOCENTRY))

{

                oDoc.Lines.SetCurrentLine(LINE);

                oDoc.Lines.BatchNumbers.SetCurrentLine(BATCHLINE);

                oDoc.Lines.BatchNumbers.Quantity = 0;

                if (oDoc.Update() != 0)

                {

                        error = SBO_Company.GetLastErrorDescription();

                }

}

else

      error = "Document not found";

regards,

Maik

Former Member
0 Kudos

Hello Maik,

I was using your tip to clear the batch numbers assignment, however after upgrading SBO to 9.1 it's not working anymore... do you know why? Do you know any workaround?

Thanks

maik_delly
Active Contributor
0 Kudos

Hi Eder,

which patchlevel are you using ?

I tested the above code successfully with 9.1 PL8.

regards,

Maik

Former Member
0 Kudos

I'm using 9.1 PL10.

Doing some tests it happens only if I try to remove all batches, for example, if the line has 3 batches and I remove only two, it works normally.

Regards,

Former Member
0 Kudos

Hi Eder, hi Maik,

I have the same problem to remove/update the current line "0" in batchnumbers! All lines greater than 0 can set on quantity = 0 and than the batches are free to use in other dokuments! I'm using 9.1 PL10 too. Do you have  a solution for me to solve the problem?

thx

Mark