on 01-22-2010 7:27 PM
Hi, currently if I need to 'convert' a Sales Order into A/R Invoice, I have to do it via the SAP application directly. What I'm trying to achieve is to automatically do it via an EXE application (I have one ready for other purpose -> connect to SAP via DI).
So far I know how to create a new A/R Invoice and close the Sales Order, but the problem is that I can't 'link' the Invoice to the original Sales Order (ie. the BaseRef field). Is there a way to do it?
Furthermore, is there any easier way? ie. simply call a 'copy' method or something else, instead of writing the same information (field by field) from Sales Order to Invoice?
Please advise.
Thanks.
Hi Tjandra,
I want to copy those SO to Invoice. May I have the VB coding for doing this?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to be absolutely clear:
If you are creating an A/R Invoice through the DI API, I know of no easy way to copy a Sales Order. You have to copy all properties and in particular the base properties mentioned in an earlier post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
You need to set the base properties on each line in the A/R Invoice
line.BaseEntry = (DocEntry of Sales Order);
line.BaseType = BoLinkedObject.lf_Order;
line.BaseLine = (the line number from the Order);
Unfortunately there is no "CopyTo" function available, that would indeed have been nice.
Regars
/Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Afandi,
This will solve your problem
Private Sub CreateInvoice()
' init the invoice object
oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInvoice.CardCode = cmbCustomer.Text
Dim sNewObjCode As String
Dim i As Integer
' Get last added document number (the order that was added)
oCompany.GetNewObjectCode(sNewObjCode)
' this loop adds the different items to the invoice object
i = 0
Do
oInvoice.Lines.BaseEntry = sNewObjCode
oInvoice.Lines.BaseLine = i
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.TaxCode = TableLines.Rows(i).Item(4)
i += 1
If i <> TableLines.Rows.Count Then
oInvoice.Lines.Add()
End If
Loop Until i = TableLines.Rows.Count
' Try to add the invoice object to the database
lRetCode = oInvoice.Add()
If lRetCode <> 0 Then ' If the addition failed
oCompany.GetLastError(lErrCode, sErrMsg)
MsgBox(lErrCode & " " & sErrMsg) ' Display error message
Else
cmdInvoice.Enabled = True
MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")
End If
Mohamed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
9 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.