cancel
Showing results for 
Search instead for 
Did you mean: 

Adding A/R Invoice, in Item

Former Member
0 Kudos

I am adding a A/R Invoice through my add on, it gets added everything fine but i need to add it in Item type and not in service but i cant do it, every time the A/R gets updated but it gets added as a service ( in the A/R invoice menu, you could find Item/Servicetype edit box in which it shows up only Service for my code, it is uneditable, how to change it to item.,

its little urgent, if any body know please let me know

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try it as

invoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items

hope it helps

Petr

Former Member
0 Kudos

Petr thanks for that message i have corrected that but now it says revenue account needed even after i have specified a account code what may the problem dude?

Nussi
Active Contributor
0 Kudos

well, issac

when you want to add item lines, only set the itemcode related properties.

dont set any account propery !

try to set only lines.itemcode, quantity, price

Former Member
0 Kudos

hi david,

i have given only lines.cardname,lines.cardcode,lines.accountcode and lines.quantity and lines.linetotal properties but still i get the same error as revenue account requires

this is my code

Public Sub addtoinv()

Try

Dim oInvoice As SAPbobsCOM.Documents

oInvoice = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items

oInvoice.CardCode = CStr(bpname)

'oInvoice.Lines.SerialNum = CStr(bpname)

oInvoice.CardName = CStr(carname)

'oInvoice.Reference1 = "Rental"

'oInvoice.Reference2 = "Petrol Trancation"

'oInvoice.Lines.AccountCode = "20300"

oInvoice.Lines.ItemCode = itemcode

oInvoice.Lines.Quantity = xx

oInvoice.Lines.AccountCode = acc

'oInvoice.Lines.ItemDescription = "Rented Item"

'oInvoice.Lines.ItemDescription = "Rental"

oInvoice.Lines.LineTotal = total

If strtax = "ST.12.36" Then

oInvoice.Lines.TaxCode = "ST.12.36"

End If

If strtax = "VAT@4" Then

oInvoice.Lines.TaxCode = "VAT@4"

End If

If strtax = "Service" Then

oInvoice.Lines.TaxCode = "Service"

End If

If strtax = "CST@4" Then

oInvoice.Lines.TaxCode = "CST@4"

End If

If strtax = "VAT@12.5" Then

oInvoice.Lines.TaxCode = "VAT@12.5"

End If

If oInvoice.Add = 0 Then

oapp.MessageBox("Sucess")

Else

oapp.MessageBox("Error: " & ocompany.GetLastErrorDescription)

End If

Catch ex As Exception

oapp.MessageBox(ex.Message)

End Try

End Sub

Nussi
Active Contributor
0 Kudos

Hi Issac,

remove also oInvoice.Lines.AccountCode = acc

try it

regards

David

Former Member
0 Kudos

if i remove it asks for revenue account, actually that 700040 is an revenue account(named rental Income)

now i am getting error that item B01 cannot added with out serial num/batch etc

what can i do with this

Former Member
0 Kudos

the error reads as such

Error:[INV.WhsCode][line1],'cannot add item A01without complete selection of batch/serial num

what can i do for this please do reply

Former Member
0 Kudos

Hi,

at quick look i think that the error is related to stores. Do you have set stores for this invoice line?

Petr

Nussi
Active Contributor
0 Kudos

Issac,

when the item is a serial/batch item you have to set

Lines.SerialNumbers.SystemSerialNumber

or

Lines.BatchNumbers.BatchNumber

regards

David

Former Member
0 Kudos

thank you david and Petr

Former Member
0 Kudos

Hi David,

Can you please help me in the following?

I want to add items managed by Serial Number to delivery document.

We have set of internal serial numbers to be used for that item (We allow the user to specify the internal serial numbers to be used - For E.g 00080).

I'm not sure how to get the system serial number for this item.

I believe OSRI has these values for each item, w.r.t the marketing documents. (Is each item has its own set of system serial nos & internal serial no.s? From where we need to take it?)

Can you please post if you have any sample code?

Thanks a lot.

Regards,

Geetha

Code that I'm using:

Private Function UpdateSerialNumbers(ByRef objSerialNumbers As SAPbobsCOM.SerialNumbers, ByVal strShpReqNm As String, ByVal strShpReqRw As String) As Boolean

'Get the values of Internal Serial numbers from our table, into this RS.

....

If objRS.RecordCount > 0 Then

objRS.MoveFirst()

Dim i As Integer

If objSerialNumbers.Count <= 0 Then SerialNumbers.Add()

For i = 0 To objRS.RecordCount - 1

Dim strTmp As String

strTmp = objRS.Fields.Item(0).Value() & ""

objSerialNumbers.SetCurrentLine(i)

objSerialNumbers.InternalSerialNumber = strTmp 'e.g 00080

'Need your help in this step

objSerialNumbers.SystemSerialNumber = objCommon.GetNextKeyValue("OSRI", "SysSerial")

objRS.MoveNext()

If Not objRS.EoF Then

SerialNumbers.Add()

End If

Next

End If

End If

End Function

Function CallingFn() as boolean

.....

UpdateSerialNumbers(objDLDoc.Lines.SerialNumbers, objHeaderInfo.ShipReqNum, strTmp)

objDLDoc.Add

End Function

Answers (1)

Answers (1)

Former Member
0 Kudos

no comments