Skip to Content

DI Question (invoice)

Hi,

How can we assign the property oInvoice.Lines.AccountCode ?

I try with the account code but I've got an error...

I also try with the _sysxxx number but it seems to be linked with the wrong gl account

Thank you for your help

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 07, 2006 at 02:22 PM

    Hi,

    Looking at your code I think you are using segmentation in your chart of accounts. Is this is the case to set the account code you need to use the FormatCode to find the key:

    1. Get the key using the GetObjectKeyBySingleValue method.

    2. Use the returned recordset to retrieve the value of the key.

    3. Use the value as the AccountCode.

    Hope it helps

    -M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 06, 2006 at 10:16 PM

    Hi,

    Can you tell me the error you get with the account code?

    -M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 07, 2006 at 12:29 PM

    Hi,

    Maybe we can help you better if you post your sourcecode?

    Regards,

    Jacco

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      here's my VB.net code used to add my invoice:

      Dim oInvoice As SAPbobsCOM.Documents

      Dim intError As Integer

      Dim intI As Integer

      oInvoice = oUSCompany.GetBusinessObject(BoObjectTypes.oInvoices)

      ' facture de service

      oInvoice.DocType = BoDocumentTypes.dDocument_Service

      oInvoice.CardCode = oEditText.Value

      oEditText = oForm.Items.Item("54").Specific

      oInvoice.CardName = oEditText.Value

      ' * * * * * * * * * *

      ' lignes de commande

      Dim oMatrix As SAPbouiCOM.Matrix

      oMatrix = oForm.Items.Item("38").Specific

      For intI = 1 To (oMatrix.RowCount - 1)

      If intI <> 1 Then

      oInvoice.Lines.Add()

      End If 'If intI <> 1 Then

      oEditText = oMatrix.Columns.Item("1").Cells.Item(intI).Specific

      oInvoice.Lines.UserFields.Fields.Item("U_SvcItem").Value = oEditText.Value

      oEditText = oMatrix.Columns.Item("3").Cells.Item(intI).Specific

      oInvoice.Lines.UserFields.Fields.Item("U_SvcDesc").Value = oEditText.Value

      oEditText = oMatrix.Columns.Item("11").Cells.Item(intI).Specific

      oInvoice.Lines.UserFields.Fields.Item("U_SvcQty").Value = oEditText.Value

      Try

      oEditText = oMatrix.Columns.Item("17").Cells.Item(intI).Specific

      'MsgBox(ReturnNum(oEditText.Value))

      'oInvoice.Lines.UserFields.Fields.Item("U_SvcUnitPrice").Value = oEditText.Value

      oInvoice.Lines.UserFields.Fields.Item("U_SvcUnitPrice").Value = CDbl(ReturnNum(oEditText.Value))

      Catch ex As Exception

      MsgBox(ex.Message)

      End Try

      oComboBox = oMatrix.Columns.Item("27").Cells.Item(intI).Specific

      oInvoice.Lines.SalesPersonCode = oComboBox.Selected.Value

      oEditText = oMatrix.Columns.Item("21").Cells.Item(intI).Specific

      oInvoice.Lines.LineTotal = oEditText.Value

      oInvoice.Lines.AccountCode = "41100-01-0-00"

      Next intI

      intError = oInvoice.Add

      If intError <> 0 Then

      oApplication.MessageBox("Error " & intError & Chr(13) & oUSCompany.GetLastErrorDescription())

      Else 'If intError <> 0 Then

      oApplication.MessageBox("Transfert facture terminé.")

      End If 'Else 'If intError <> 0 Then