cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear batch number assignment

Former Member
0 Kudos
968

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

Accepted Solutions (1)

Accepted Solutions (1)

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

Answers (2)

Answers (2)

pierrez
Explorer
0 Kudos

Has this issue been resolved? It is not clear from the referenced note.

Former Member
0 Kudos

Same problem here!

After upgrading to 9.1 PL11 my code to deallocate batches from sales order doesn't work anymore.

this line of code

order.Lines.BatchNumbers.Quantity = order.Lines.BatchNumbers.Quantity - qtaATT;

does nothing. No error, no subtraction.

It was working fine in 9.0

Can someone help me please?

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Nicola and All,

Kindly refer to SAP Note 2286694 describing the same issue. Keep looking at the Note as the issue is supposed to be fixed.

Hope it helps.

Kind regards,

ANKIT CHAUHAN

SAP Business One Global Support