cancel
Showing results for 
Search instead for 
Did you mean: 

How can i update the expiration date of a BatchNumber?

Former Member
0 Kudos

Hi!

How can i update the expiration date of a BatchNumber by DI using C#?

thanks

Edited by: William Kurosu on Sep 29, 2008 10:45 PM

Edited by: William Kurosu on Sep 29, 2008 10:48 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You cannot update it, the only way is delete the line in document and creeate the line again with new batch and expiration date - in case that you are talking about batches in documents.

Former Member
0 Kudos

Actually, the batch already exists in the SAP. I can update the expiration date by Inventory -> ItemMangement -> Batches -> Batch Details using SAP. But I'd like to do the same thing by script DI in C#.

Is that possible?

thanks!

Former Member
0 Kudos

I think it isnt possible, because is there no method for update batch information in DI.

Former Member
0 Kudos

I wonder how the UI does it?

I've been trying to figure out how to update and delete batches in C# as well, and so far am not finding it.

I've also tried to delete the line item, and re-create it with the new batch information. Though this isn't working either. It will insert the new line item, but the batches are not getting attached.

And yet, somehow the UI manages to do all of this. It does not appear to be deleting the line item, becuase the line item order remains the same when you look at them after a modification. The line item order would change if we deleted the line and then added it again. The new line item would move to the end of the list.

SAP, please HELP! Some clarity here would be MUCH APPRECIATED.

Thank you,

Mike and everyone who is experiencing these issues.

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello MiChael,

BatchNumber in DI doesn't expose the method "Update" at the moment. The last option here is use RecordSet object to update the experation date with SQL. Thanks.

Kind Regards

-Yatsea

Former Member
0 Kudos

Thank you Yatsea.

Can you please share sample source code that we can use to add, update and delete batch line items from oOrder objects, in a way that would be agreeable with the SAP service contract?

We have been trying to figure this out for a REALLY long time, and it is becoming painful.

Also, is this same problem still present in SAP DIAPI 2007?

Is there a way to do it through the GUI API?

Your help is very appreciated.

Thanks,

Mike

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Michael,

See the sample below how to add oOrder with batch line items, but the you can't update the document with DI.

Dim oOrder As SAPbobsCOM.Documents = Nothing
        oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
        oOrder.CardCode = "C001"
        oOrder.DocDueDate = Date.Now
        Dim oLines As SAPbobsCOM.Document_Lines = oOrder.Lines
        'The Item should be managed by batch
        'And Create the Batch number for the item when create Item
        oLines.ItemCode = "B00001"
        oLines.UnitPrice = 15
        'Set the batch number for the line item here.
        oLines.BatchNumbers.BatchNumber = "B001"
        lRetCode = oOrder.Add
        If 0 <> lRetCode Then
            oCompany.GetLastError(lErrCode, errMsg)
            MsgBox(errMsg)
        Else
            MsgBox("Sales order with batch number added.")
        End If

UI: yes, you can simulate what you can do in B1 client with UI API

Item.Click()
EditText.String = "***"
...

I am afraid that it has the same the situation in 2007 SDK

Kind Regards

-Yatsea