Error WarehouseCode

I am creating a scenario that sends SAP B1 WarehouseCode and I generated the following error:
Sender SysId, Sender ObjectType or Sender payload is missing.
Someone knows what is that?
Thank's

Hi,
What object/s have you selected?
Thanks,
Gordon

Similar Messages

  • A/R Invoice Draft failed with error - "no matching records met ......."

    Hi Guys,
    For the past one week I have been struggling to import draft A/R invoices into SAP Business One 9.0 PL 07. The database to which i'm doing this import continually returns the error "no matching records met ........." during simulation and also import stage.
    Interestingly, I noticed that import picks draft invoices with only one row detail leaving out the ones with more than one row details. I desperately need a solution to this issue as my client is scheduled to go live coming Monday.
    A sample of the structure of the data is below for your review and advice:
    ODRF
    DocEntry
    DocNum
    DocType
    DocDate
    DocDueDate
    CardCode
    CardName
    DocCurrency
    DocObjectCode
    DocEntry
    DocNum
    DocType
    DocDate
    DocDueDate
    CardCode
    CardName
    DocCur
    ObjType
    1
    1
    dDocument_Items
    20140122
    20140122
    GH-XX-001
    Customer A
    GHS
    13
    2
    2
    dDocument_Items
    20140122
    20140122
    GH-XX-002
    Customer B
    GHS
    13
    3
    3
    dDocument_Items
    20140122
    20140122
    GH-XX-003
    Customer C
    GHS
    13
    DRF1:
    ParentKey
    LineNum
    ItemCode
    Quantity
    Price
    WarehouseCode
    VatGroup
    DocNum
    LineNum
    ItemCode
    Quantity
    Price
    WhsCode
    VatGroup
    1
    0
    AB-0003
    2
    34.7018
    01
    VP
    1
    1
    LC-0002
    1
    27.0245
    01
    VP
    1
    2
    TW-0002
    1
    26.8469
    01
    VP
    1
    3
    DG-0002
    5
    28.161
    01
    VP
    1
    4
    FLI-075
    25
    7.83
    01
    VP
    2
    0
    AB-0003
    27
    31.5478
    01
    VP
    2
    1
    DG-0002
    8
    25.6
    01
    VP
    2
    2
    TW-0002
    5
    23.9652
    01
    VP
    2
    3
    KW-0002
    8
    27.7913
    01
    VP
    2
    4
    LC-0002
    10
    24.1249
    01
    VP
    2
    5
    FLI-075
    35
    7.8261
    01
    VP
    2
    6
    FLI-075
    2
    7.8261
    01
    VP
    3
    0
    AB-0003
    6
    31.5478
    01
    VP
    3
    1
    DG-0002
    40
    25.6
    01
    VP
    3
    2
    LC-0002
    20
    24.1249
    01
    VP
    3
    3
    KW-0002
    15
    27.7913
    01
    VP
    3
    4
    FLI-075
    5
    7.83
    01
    VP
    Please advice on how i can work at transferring this data into SAP Business One. Thanks for your help in advance.
    Regards
    John

    Hi,
    You may check this SAP note for service type invoice. Follow instruction and apply for above conditions.
    1135341 - How to import service invoices for foreign customers
    Thanks & Regards,
    Nagarajan

  • DTW Error while importing A/R Invoice

    Hi,
       Iam using SAP B1 2005B Patch 38
    When importing Item type A/R Invoices using DTW  it shown
    the following errpr message
    customer record not found[INV1.ActDelDate][Line:1]Application-defined or object-defined error..."
    In my Item master data i create the Item code as
    HARCUT is a only sales item not a inventory item and
    purchase item
    Documents :
    1.RecoreKey              -  1
    2.CardCode                -  C000001
    3.HandWritten            -   tYES
    4.DocNum                  - 10653
    5.DocDate                  -  20081001
    6.DocDueDate            -  20081001
    7.TaxDate                  -  20081001
    8.SalesPersonCode    -  2
    9.Comments              -  Importing Through DTW
    Documents Lines :
    1.RecordKey     -  1
    2.temCode  -  HARCUT
    3.CostingCode - NGM
    4.LineTotal - 1149
    5.Quantity - 1
    6.TaxCode - Srv12.36
    7.WarehouseCode - CH-NGM
    Regards
    P.Jambulingam

    hi jambulingam,
    If you use manual number then defined
    HandWritten - tYES in DTW otherwise make it as tNo.
    If you use manual number then DocNum - 10653 is Ok,
    but if you are using any numbering series remove it.
    Jeyakanthan

  • Internal Error -5000 while Adding a PODeliveryNote Document using DI

    Hello friends:
    I am getting an Internal -5000 error while trying to upload a PODeliveryNote (Goods Receipt) into Business One using SDK. The description of error just says Internal Error - so I really cannot understand what's going on. Any help will be appreciated.
    Here is the part of the code that is running into this error:
       Private Sub LoadObjectsFromXML()
            Dim sXmlFileName As String
            Dim iElementCount As Long
            Dim iCounter As Long
            '// setting the file name
            sXmlFileName = "C:\SAP2HJXMLData\Upload\NewPODelivery.xml"
            '// Get the number of Business object in the file ...
            iElementCount = oCompany.GetXMLelementCount(sXmlFileName)
            MsgBox(iElementCount & " Elemnts found in xml file" & vbNewLine & "Ready To Start Transaction")
            '// start a transaction
            oCompany.StartTransaction()
            '// Run a loop through the objects and when with in the file
            '// and the objects to the DB
            For iCounter = 0 To iElementCount - 1
                '// get the objects type at the specified position
                oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode
                '// get the business object data from the file
                oDocument = oCompany.GetBusinessObjectFromXML(sXmlFileName, iCounter)
                '// add the object to the data base
                oDocument.Add()
                '// Check for errors during connect
                oCompany.GetLastError(lErrCode, sErrMsg)
                If lErrCode <> 0 Then
                    MsgBox("Error: " & lErrCode & " - " & sErrMsg & vbNewLine & "Transaction will be rolled back")
                    oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
                    Exit Sub
                End If
            Next iCounter
            '// Commit Transaction
            oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
            MsgBox("Data inserted successfully")
        End Sub
    Following is the XML that we are trying to post. There is a corresponding PO open.
      <?xml version="1.0" encoding="utf-16" ?>
    - <BOM>
    - <BO>
    - <AdmInfo>
      <Object>20</Object>
      <Version>2</Version>
      </AdmInfo>
    - <Documents>
    - <row>
      <DocNum />
      <DocType>dDocument_Items</DocType>
      <HandWritten>tNO</HandWritten>
      <Printed>tNO</Printed>
      <DocDate>20071224</DocDate>
      <DocDueDate>20071224</DocDueDate>
      <CardCode>V30000</CardCode>
      <CardName />
      <Address />
      <DocCurrency />
      <DocRate />
      <DocTotal />
      <Reference1 />
      <Comments>This was received in SAP</Comments>
      <JournalMemo />
      <PaymentGroupCode />
      <DocTime />
      <SalesPersonCode />
      <Confirmed>tYES</Confirmed>
      <ImportFileNum />
      <SummeryType>dNoSummary</SummeryType>
      <ContactPersonCode />
      <ShowSCN>tNO</ShowSCN>
      <Series />
      <TaxDate>20071224</TaxDate>
      <PartialSupply>tYES</PartialSupply>
      <DocObjectCode />
      <DiscountPercent />
      <RevisionPo>tNO</RevisionPo>
      <BlockDunning>tNO</BlockDunning>
      <Pick>tNO</Pick>
      <PaymentMethod />
      <PaymentBlock>tNO</PaymentBlock>
      <MaximumCashDiscount>tNO</MaximumCashDiscount>
      <WareHouseUpdateType>dwh_Stock</WareHouseUpdateType>
      <Rounding>tNO</Rounding>
      <DeferredTax>tNO</DeferredTax>
      <NumberOfInstallments />
      <ApplyTaxOnFirstInstallment>tNO</ApplyTaxOnFirstInstallment>
      <DocumentsOwner>3</DocumentsOwner>
      <DocumentSubType>bod_None</DocumentSubType>
      <Address2 />
      <PayToCode />
      <UseShpdGoodsAct>tNO</UseShpdGoodsAct>
      <IsPayToBank>tNO</IsPayToBank>
      <DownPayment />
      <LanguageCode>3</LanguageCode>
      <PickRemark />
      <SequenceModel>0</SequenceModel>
      <UseCorrectionVATGroup>tNO</UseCorrectionVATGroup>
      <VatPercent />
      </row>
      </Documents>
    - <Document_Lines>
    - <row>
      <LineNum>0</LineNum>
      <ItemCode>A00004</ItemCode>
      <ItemDescription />
      <Quantity>3.000000</Quantity>
      <ShipDate>20071224</ShipDate>
      <Price />
      <PriceAfterVAT />
      <Currency />
      <Rate />
      <DiscountPercent />
      <VendorNum />
      <WarehouseCode>01</WarehouseCode>
      <SalesPersonCode />
      <CommisionPercent />
      <TreeType>iNotATree</TreeType>
      <AccountCode />
      <UseBaseUnits>tNO</UseBaseUnits>
      <SupplierCatNum />
      <CostingCode />
      <ProjectCode />
      <BarCode />
      <VatGroup />
      <Height1 />
      <Height2 />
      <Lengh1 />
      <Lengh2 />
      <Weight1 />
      <Weight2 />
      <Factor1 />
      <Factor2 />
      <Factor3 />
      <Factor4 />
      <BaseType />
      <BaseEntry>6</BaseEntry>
      <BaseLine>0</BaseLine>
      <Volume />
      <VolumeUnit />
      <Width1 />
      <Width2 />
      <Address />
      <TaxCode>0</TaxCode>
      <TaxType>tt_Yes</TaxType>
      <TaxLiable>tYES</TaxLiable>
      <ShippingMethod />
      <CorrectionInvoiceItem>ciis_ShouldBe</CorrectionInvoiceItem>
      <CorrInvAmountToStock />
      <CorrInvAmountToDiffAcct />
      <WTLiable>tNO</WTLiable>
      <DeferredTax>tNO</DeferredTax>
      <NetTaxAmount />
      <NetTaxAmountFC />
      <LineTotal />
      <TaxPercentagePerRow />
      <ConsumerSalesForecast>tNO</ConsumerSalesForecast>
      <ExciseAmount />
      <SWW />
      <DistributeExpense>tYES</DistributeExpense>
      <ShipToCode />
      <RowTotalFC />
      <TaxOnly>tNO</TaxOnly>
      <UnitPrice />
      <LineStatus>bost_Open</LineStatus>
      <LineType>dlt_Regular</LineType>
      <ChangeAssemlyBoMWarehouse />
      </row>
      </Document_Lines>
      </BO>
      </BOM>
    Thank you.
    Kushal Dutta.

    OK - I figured this one out. Bottom line, I was leaving several fields unpopulated, expecting SAP to populate the data. That was not working. I had to populate more fields to make it working.
    Thanks.
    Kushal.

  • Error while trying to raise a Goods Receipt PO in SAP B1 v 9.0

    Hi Experts,
    while trying to raise a Goods Receipt PO in SAP B1 v 9.0 the following error is been generated:
    You should use existing Serial/batch number for this document type [21-59 ]
    Note:We are able  to generate Goods Receipt PO for an item which is not serialized.
    Thanks
    Regards,
    Satish.

    Hi Edy,
    Dim oPDN As SAPbobsCOM.Documents
    oPDN = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
                    oPDN.CardCode = "C232323"
                    oPDN.Lines.ItemCode = "A00004"
                    'oGR.Lines.LineNum = 0
                    oPDN.Lines.BaseLine = 1
                    oPDN.Lines.BaseEntry = 202
                    'oGR.Lines.BaseRef = 203
                    oPDN.Lines.BaseType = 20
                    oPDN.Lines.Quantity = 1
                    oPDN.Lines.UnitPrice = 2
                    oPDN.Lines.WarehouseCode = '01'
                        oPDN.Lines.SerialNumbers.InternalSerialNumber = 3
                        oPDN.Lines.SerialNumbers.SystemSerialNumber = "Sh01"
                        oPDN.Lines.SerialNumbers.ManufacturerSerialNumber = "Mf01"
                        oPDN.Lines.SerialNumbers.SetCurrentLine(iRowNo)
                        oPDN.Lines.SerialNumbers.Add()
                    End If
                Next
                oPDN.Lines.Add()
                lRetCode = oPDN.Add
    Thanks,
    Satish.

  • Error when creating Invoice via DI API

    Can you help me, I have a problem about DI
    When I create invoice with serial number and create transaction with 1 item in many serial number itu2019s no problem but
    If i create transaction with 2 diffrent item with many serial number has error the error code -5002([inv1.docentry][line:0],u2019item serial us not found in whseu2026.u2019)
    I using sap 2005 pl 40, I have debug my coding there is nothing wrong with it, than I suspec this is bug in DI is that rightu2026
    This is my code
      Dim oInvoices As SAPbobsCOM.Documents
            Dim iRetVal As Integer = -1
            Dim sErrMsg As String = ""
            Dim isAddHeader As Boolean = True
            Dim iRow As Integer = 0
            Dim sWhsCode As String = ""
            Dim iAddedQty As Integer
            Dim iCurrLine As Double = 0
            Dim iBasedDoc As Integer = 0
            Dim sNewDocNum As String = ""
            Dim sCardCode As String = ""
            Dim isdocnum As String = ""
            Dim CompleteOrder As DataRow
            Try
                oInvoices = myCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
                For iRow = 0 To myOrderDetailsTable.Rows.Count - 1
                    Console.WriteLine(myOrderDetailsTable.Rows(iRow).Item(ISSCANNED_FIELD))
                    If myOrderDetailsTable.Rows(iRow).Item(ISSCANNED_FIELD) = 1 Then
                        Console.WriteLine(myOrderDetailsTable.Rows(iRow))
                        CompleteOrder = myOrderDetailsTable.Rows(iRow)
                        Console.WriteLine(sWhsCode & "   " & CompleteOrder(WHSCODE_FIELD))
                        sWhsCode = CompleteOrder(WHSCODE_FIELD)
                        With oInvoices
                            If isAddHeader Then
                                isdocnum = CompleteOrder(DOCNUM_FIELD)
                                iBasedDoc = CompleteOrder(DOCENTRY_FIELD)
                                sCardCode = CompleteOrder(CARDCODE_FIELD)
                                '.DocObjectCode = SAPbobsCOM.BoObjectTypes.oInvoices
                                .Reference2 = CompleteOrder(DOCENTRY_FIELD)
                                .DocDate = Today.Date
                                .DocDueDate = Today.Date
                                .TaxDate = Today.Date
                                Console.WriteLine("cardcode : " & sCardCode)
                                .CardCode = sCardCode
                                Console.WriteLine("ibasedDoc :" & iBasedDoc)
                                .Reference1 = iBasedDoc
                                isAddHeader = False
                            ElseIf isAddHeader = False Then
                                ' .Lines.Delete()
                                .Lines.Add()
                            End If ' isAddHeader
                            iAddedQty = 0
                            iCurrLine = 0
                            Console.WriteLine("CompleteOrder(ITEMCODE_FIELD) : " & CompleteOrder(ITEMCODE_FIELD))
                            .Lines.ItemCode = CompleteOrder(ITEMCODE_FIELD)
                            Console.WriteLine(".Lines.WarehouseCode = CompleteOrder(WHSCODE_FIELD) : " & CompleteOrder(WHSCODE_FIELD))
                            .Lines.WarehouseCode = CompleteOrder(WHSCODE_FIELD)
                            Console.WriteLine("Lines.UnitPrice = CompleteOrder(PRICE_FIELD) " & CompleteOrder(PRICE_FIELD))
                            .Lines.UnitPrice = CompleteOrder(PRICE_FIELD)
                            Console.WriteLine("CompleteOrder(ISUSEBATCH_FIELD) : " & CompleteOrder(ISUSEBATCH_FIELD))
                            If CompleteOrder(ISUSEBATCH_FIELD) = 1 Then
                                For iCurrLine = 0 To CompleteOrder(QUANTITY_FIELD) - 1
                                    If iCurrLine > 0 Then .Lines.BatchNumbers.Add()
                                    .Lines.BatchNumbers.SetCurrentLine(iCurrLine)
                                    .Lines.BatchNumbers.Quantity = 1
                                    Console.WriteLine("CompleteOrder(SCANNED_FIELD) :" & CompleteOrder(SCANNED_FIELD))
                                    .Lines.BatchNumbers.BatchNumber = CompleteOrder(SCANNED_FIELD)
                                    '.Lines.BaseEntry = iBasedDoc
                                Next
                            ElseIf CompleteOrder(ISUSEBATCH_FIELD) = 0 Then
                                Console.WriteLine("CompleteOrder(WHSCODE_FIELD) :" & CompleteOrder(WHSCODE_FIELD))
                                While sWhsCode = CompleteOrder(WHSCODE_FIELD)
                                    If iCurrLine > 0 Then .Lines.SerialNumbers.Add()
                                    .Lines.SerialNumbers.SetCurrentLine(iCurrLine)
                                    Console.WriteLine("CompleteOrder(SYSSERIAL_FIELD)" & CompleteOrder(SYSSERIAL_FIELD))
                                    CompleteOrder(SYSSERIAL_FIELD) = IIf(IsDBNull(CompleteOrder(SYSSERIAL_FIELD)), 0, CompleteOrder(SYSSERIAL_FIELD))
                                    .Lines.SerialNumbers.SystemSerialNumber = CompleteOrder(SYSSERIAL_FIELD)
                                    Console.WriteLine("CompleteOrder(SCANNED_FIELD) :" & CompleteOrder(SCANNED_FIELD))
                                    .Lines.SerialNumbers.InternalSerialNumber = CompleteOrder(SCANNED_FIELD)
                                    ' .Lines.BaseEntry = iBasedDoc
                                    iCurrLine = iCurrLine + 1
                                    iRow = iRow + 1
                                    If iRow <= myOrderDetailsTable.Rows.Count - 1 Then
                                        CompleteOrder = myOrderDetailsTable.Rows(iRow)
                                    ElseIf iRow > myOrderDetailsTable.Rows.Count - 1 Then
                                        Exit While
                                    End If
                                End While
                                iRow = iRow - 1
                            End If
                            .Lines.Quantity = iCurrLine
                        End With ' oInvoices
                    End If ' CompleteOrder(ISSCANNED_FIELD) = 1
                Next iRow
                iRetVal = oInvoices.Add()
    thnx for your attention

    Hello tony,
    Please check the following:
    1.Make sure the item is managed by serials
    2.The serials number have been auto created in GRPO/AP invoice etc puchase document
    3.You need to set the system serial number for the lines. How do you know the system serial number of the serial number? refer to the Serial Number Details form
    Inventory=>Item management=>Serials Numbers=>Serial Number Details
    SystemSerialNumber Sets or returns the successive numerator starting from1 issued for each item with serial numbers management. This numerator progresses according to the creation of new units of the same sort (for the same item).
    This property is mandatory when using Serial Numbers for outgoing documents. Field name: SysSerial.This is a foreign key to the SerialNumbers object
    Sample code to add invoice with items managed by serials:
    Private Sub btnSerials_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSerials.Click
            ConnectViaDI()
            Dim oInvoice As SAPbobsCOM.Documents = Nothing
            oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            oInvoice.CardCode = "C001"
            oInvoice.DocDueDate = Date.Now
            Dim oLines As SAPbobsCOM.Document_Lines = oInvoice.Lines
            oLines.ItemCode = "S00002"
            oLines.UnitPrice = 1500
            oLines.Quantity = 2
            oLines.TaxCode = "CA"
            'Set the system serial no. for the 1st item
            oLines.SerialNumbers.SystemSerialNumber = 3
            'Set the system serial no. for the 2nd item
            oLines.SerialNumbers.Add()
            oLines.SerialNumbers.SystemSerialNumber = 4
            lRetCode = oInvoice.Add
            If 0 <> lRetCode Then
                oCompany.GetLastError(lErrCode, errMsg)
                MsgBox(errMsg)
            Else
                MsgBox("AR Invoice with serials number added.")
            End If
        End Sub
    Kind Regards, yatsea

  • Error while posting initial quantities using stocktaking template of DTW

    Hi All,
    I am getting this below error while posting initial quantities using stocktaking template of DTW.
    Can not find this object in B1Application-defined or object-defined error65171
    I am using B1 8.8 PL10 version. Below is my sample txt file data
    ItemCode WarehouseCode Counted
    ItemCode WarehouseCode Counted
    CHA0002 1 500
    CHA0076 1 4000
    Any help is appreciated.
    Regards,
    Noor Hussain

    Hi Gordon,
    Thanks a lot for your time. I am able to post the quantities. Now please let me know how to update the item cost/price for these items using DTW ?
    Regards,
    Noor Hussain

  • Partial Qty delivery error

    Hey guys..
    I'm plagued with this problem and haven't found a solution yet so I'd thought I'd come the experts:
    We routinely ship partial qty's per delivery line to customers if they choose..
    ie- SalesOrder is for 3 widgets and we only have 1. We'll ship the 1 we have and later ship  the remaining 2.
    Our GUI-SAP has no problem with this but when I push this though the SAPbobsCom.dll, it returns the following error:
    SAPbobsCom_Call Funct- Error in SAP Post--- DocEntry:16052 didn't commit--->Quantity falls into negative inventory  [DLN1.ItemCode][line: 1]| retval: -10
    This error seems revolve around serialized stock but I'm not ruling out that our non-serialized is also a problem.. I'll test shortly.
    Regardless, here's the code
    SAPbobsCOM.Documents odeliveries = (SAPbobsCOM.Documents)Vcmp.GetBusinessObject(BoObjectTypes.oDeliveryNotes);//new SAPbobsCOM.Documents();
                        odeliveries.DocDate = DateTime.Now;
                        foreach (var CommitItem in CommitObject)
                            BaseEntry = CommitItem.RDR_DocEntry;
                            BaseNum = CommitItem.RDR_DocNum;
                            odeliveries.Lines.BaseEntry = Convert.ToInt32(CommitItem.RDR_DocEntry);
                            odeliveries.Lines.BaseType = 17;
                            odeliveries.Lines.BaseLine = Convert.ToInt32(CommitItem.RDR_LineNum);
                            odeliveries.Lines.WarehouseCode = CommitItem.RDR_WhsCode;
                            //odeliveries.Lines.Quantity = CommitItem.Qty_To_Pick;
                            //odeliveries.Lines.ItemCode = CommitItem.RDR_ItemCode;
                            if (CommitItem.Serial_Flag == "Y")
                                int SerialCount = 0;
                                foreach (var sysnum in CommitObject.FirstOrDefault(x => x.RDR_LineNum == CommitItem.RDR_LineNum).SysNum)
                                    odeliveries.Lines.SerialNumbers.Quantity = 1;
                                    odeliveries.Lines.SerialNumbers.SystemSerialNumber = Convert.ToInt32(sysnum);
                                    odeliveries.Lines.SerialNumbers.SetCurrentLine(SerialCount);
                                    odeliveries.Lines.SerialNumbers.Add();
                                    SerialCount++;
                            else
                                int CurrentLine = 0;
                                odeliveries.Lines.ItemCode = CommitItem.RDR_ItemCode;
                                foreach (var Bin_AbsNum in CommitObject.FirstOrDefault(x => x.RDR_LineNum == CommitItem.RDR_LineNum).From_Bin)
                                    odeliveries.Lines.BinAllocations.Quantity = Bin_AbsNum.Value;
                                    odeliveries.Lines.BinAllocations.BinAbsEntry = Bin_AbsNum.Key;
                                    odeliveries.Lines.BinAllocations.SetCurrentLine(CurrentLine);
                                    odeliveries.Lines.BinAllocations.Add();
                                    CurrentLine++;
                            odeliveries.Lines.Add();
    Note this code has worked for creation of over 2000 lines on 850 deliveries, So the problem seems to be isolated to partial line deliveries..
    Thanks in advance Guys!!

    Hi Steve,
    the error message is quite clear - you are trying to add an delivery line with an item which is not onhand  ( in that warehouse ).This isn't't working in SBO client either : you can't deliver something you don't have.
    btw. you always add an empty line at the end which is not needed.
    regards,
    Maik

  • Error: Delivery based on Sales Order

    -5002: The complete Sales BOM, not just some of the components, must be copied to an A/R Invoice or a Delivery   DLN1.TreeType    line: 1
    the Sales Order has 3 lines
    Line 0 treeType  = I
    Line 1 TreeType = I
    Line 2 TreeType = S
                        FoDelivery.Lines.Add;
                        FoDelivery.Lines.SetCurrentLine(j);
                        FoOrder.Lines.SetCurrentLine(k);//aseline from Order
                        FoDelivery.Lines.BaseEntry:= 'DocEntry';
                        FoDelivery.Lines.BaseLine:= Baseline from Order;
                        FoDelivery.Lines.BaseType := 17;
                        FoDelivery.Lines.Quantity:= FoOrder.Lines.Quantity;
                        FoDelivery.Lines.WarehouseCode:= FoOrder.Lines.WarehouseCode;
                        inc(j);
    Thanks

    view sap note
    Note 1179405 - Error -5002 when trying to copy a document with Sales BOM

  • While creating Goods Receipt for multiple serial numbers it is generating an internal error

    Error:Internal error (-5002) occurred  [ 131-183]
    we are using version SAP B1 9.0 PL 4
    The code which we are using.
           Dim oPDN As SAPbobsCOM.Documents
           oPDN = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
                         Dim serno As String = "SH-A1,SH-A2"
                        Dim sernoval As String() = serno.Split(",")
                        Dim mnfser As String = "SH-B1,SH-B2"
                        Dim mnfserval As String() = mnfser.Split(",")
                        For k = 0 To sernoval.Length - 1
                            oPDN.Lines.SerialNumbers.InternalSerialNumber = sernoval(k).Trim
                            oPDN.Lines.SerialNumbers.ManufacturerSerialNumber = mnfserval(k).Trim
                            oPDN.Lines.SerialNumbers.Quantity = linedetails(iRowNo).Quantity
                        Next
                    oPDN.CardCode = "C232323"
                    oPDN.Lines.ItemCode = "A00004"
                    'oGR.Lines.LineNum = 0
                    oPDN.Lines.BaseLine = 1
                    oPDN.Lines.BaseEntry = 202
                    'oGR.Lines.BaseRef = 203
                    oPDN.Lines.BaseType = 20
                    oPDN.Lines.Quantity = 1
                    oPDN.Lines.UnitPrice = 2
                    oPDN.Lines.WarehouseCode = '01'
                 oPDN.Lines.Add()
                 lRetCode = oPDN.Add

    Hi Vasanth,
    I'm not really fluent in VB, but I think that a SerialNumbers.Add() and SerialNumbers.SetCurrentLine() are missing before the Next
    Regards,
    Eric

  • Internal error (-2014) Goods Issue with Batch Items added through UI

    Hello Experts,
    I've added a button to my Production Order screen labeled 'Issue Components' that is meant to streamline the process, and it works, except when the ProdOrder has Batch controlled items on it. When that happens it returns Internal error (-2014)<br><br>
    I've tried stepping through the code and it doesn't error until the final Add
    Here is my function, Thanks for the Help!<br><br>
    I'm using CitiXSys Inventory Pro and am pulling the items from the Picked table, that's what that sQuery does. It returns correctly. I've also set everything to 'Manual' instead of 'Backflush'<br><br><br>
    <pre>
    Private Sub IssueComponents(ByVal iDocNum As Integer)
            Try
                'Declaring the needed variables'
                Dim oRec As SAPbobsCOM.Recordset
                Dim oGoodsIssue As SAPbobsCOM.Documents
                Dim bIssueLineAdded As Boolean = False, sQuery As String = "", x As Integer = 0, iCode As Long = 0, sErrorMessage As String = ""
                Dim tmpLot As String = ""
                'Instanciating the Goods Issue'
                oGoodsIssue = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit)
                'Initialzing the SBO object'
                oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                'Assing the header of the Goods Issue'
                oGoodsIssue.DocDate = Date.Now
                oGoodsIssue.DocDueDate = Date.Now
                'Getting the entire "Manual" components for this production order to issue them'
                sQuery &= "Select PK1.U_DocNo, KI.U_ItemCode, KI.U_BseLnNo, OW.DocEntry, KI.U_Quantity, KI.U_WhsCode, KI2.U_BatSrlNo, KI2.U_LotNo from [OWOR] OW (NOLOCK) INNER JOIN [@ctx_pkin] PK ON OW.DocNum = PK.U_BaseDoc," & vbNewLine
                sQuery &= "[@ctx_PKIN] PK1 (NOLOCK) INNER JOIN [@CTX_KIN1] KI (NOLOCK) ON PK1.U_DocNo = KI.U_DocNo," & vbNewLine
                sQuery &= "[@ctx_KIN1] KI1 (NOLOCK) INNER JOIN [@CTX_KIN2] KI2 (NOLOCK) ON KI1.U_DocNo = KI2.U_DocNo and KI1.U_BseLnNo = KI2.U_BseLnNo" & vbNewLine
                sQuery &= "where OW.DocNum = '" & iDocNum & "' and PK.U_BaseType = 202 and PK1.U_DocNo = PK.U_DocNo and KI1.U_DocNo = PK.U_DocNo and KI1.U_BseLnNo = KI.U_BseLnNo" & vbNewLine
                'Executing the query'
                oRec.DoQuery(sQuery)
                'Looping through the "Manual" components'
                For x = 0 To oRec.RecordCount - 1
                    'Prompting the user'
                    oAppl.StatusBar.SetText("Issuing Components...(" & x + 1 & " of " & oRec.RecordCount & ")", SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)
                    'Adding the previous line if applicable'
                    If bIssueLineAdded Then
                        oGoodsIssue.Lines.Add()
                    End If
                    'Filling the line information'
                    oGoodsIssue.Lines.WarehouseCode = oRec.Fields.Item("U_WhsCode").Value 'dIssueComponents(x).Item("WhsCode")
                    'oGoodsIssue.Lines.TransactionType = SAPbobsCOM.BoTransactionTypeEnum.botrntComplete
                    oGoodsIssue.Lines.BaseEntry = oRec.Fields.Item("DocEntry").Value 'oProductionOrder.AbsoluteEntry
                    oGoodsIssue.Lines.BaseType = 202                                          'Production Order Type'
                    oGoodsIssue.Lines.BaseLine = oRec.Fields.Item("U_BseLnNo").Value 'GetBaseLine(oProductionOrder.AbsoluteEntry, dIssueComponents(x).Item("Component"))
                    'oGoodsIssue.Lines.ItemCode = oRec.Fields.Item("U_ItemCode").Value
                    oGoodsIssue.Lines.Quantity = oRec.Fields.Item("U_Quantity").Value 'Math.Round(oRec.Fields.Item("U_Quantity").Value, 2) 'dIssueComponents(x).Item("PlanQty")
                    'Checking if the item is neither lot or serial controlled item'
                    If oRec.Fields.Item("U_BatSrlNo").Value = "" And oRec.Fields.Item("U_LotNo").Value = "" Then
                        'Nothing controlled item'
                    ElseIf oRec.Fields.Item("U_BatSrlNo").Value <> "" Then
                        'Lot controlled item'
                        tmpLot = oRec.Fields.Item("U_BatSrlNo").Value
                        'oAppl.MessageBox("Lot: " & tmpLot & ", whs: " & oRec.Fields.Item("U_WhsCode").Value & ", qty: " & oRec.Fields.Item("U_Quantity").Value)
                        oGoodsIssue.Lines.BatchNumbers.Add()
                        oGoodsIssue.Lines.BatchNumbers.BatchNumber = oRec.Fields.Item("U_BatSrlNo").Value
                        oGoodsIssue.Lines.BatchNumbers.Quantity = oRec.Fields.Item("U_Quantity").Value 'Math.Round(oRec.Fields.Item("U_Quantity").Value, 2)
                        'Else
                        'Serial controlled item'
                        'oGoodsIssue.Lines.SerialNumbers.SystemSerialNumber = oRec.Fields.Item("").Value
                    End If
                    'Setting the line to be added'
                    bIssueLineAdded = True
                    'Movoing to the next record'
                    oRec.MoveNext()
                Next x
                'Checking if there was any component or not'
                If bIssueLineAdded Then
                    'Adding the Goods Issue'
                    iCode = oGoodsIssue.Add
                    If iCode <> 0 Then
                        oCompany.GetLastError(iCode, sErrorMessage)
                        oAppl.MessageBox("Goods Issue Production Order: " & iDocNum & " didn't get created for the following reason: " & serrormessage)
                    Else
                        oAppl.StatusBar.SetText("Components were issued successfully.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
                        'TODO: add to ProdOrder remarks field
                    End If
                End If
            Catch ex As Exception
                oAppl.MessageBox("IssueComponents() " & ex.Message)
                oAppl.StatusBar.SetText("Error in IssueComponenets() : " & ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
            End Try
        End Sub
    </pre>
    Edited by: Rob Daniels on May 30, 2011 10:33 PM

    Please use the latest upgrade of Inventory Pro from CitiXsys.
    If you are using SAP Business One 2007; use Inventory Pro 5.6 series
    For SAP Business One 8.8 and up; use Inventory Pro 6.6.1 and up

  • Error When Insert Invoice!!!

    Hi All!  "Item no. is missing  [INV1.ItemCode][line: 2]"
    I have function to Insert A/R Invoice as follows:
    Private Function Add_Invoice(ByVal TransCode As Double) As Boolean
             Dim strShop As String = "C570004"
            Dim oInv As SAPbobsCOM.Documents
            oInv = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            oInv.CardCode = strShop
            oInv.DocDate = Now.Date
            oInv.DocDueDate = Now.Date
            oInv.Comments = "From POS System - With Transaction Code " & TransCode
            Dim disc As Double = 0
            Dim WarehouseCode As String = "HCI001"
            Dim VATGroup As String = "S10_CM"
            For i_row As Integer = 0 To jsgxDetails.RowCount - 1
                jsgxDetails.Row = i_row
                oInv.Lines.SetCurrentLine(i_row)
                oInv.Lines.ItemCode = jsgxDetails.GetValue("Item_Code")
                oInv.Lines.ItemDescription = jsgxDetails.GetValue("Item_Name")
                oInv.Lines.UnitPrice = jsgxDetails.GetValue("Item_Price")
                oInv.Lines.Quantity = jsgxDetails.GetValue("Item_Quantity")
                oInv.Lines.DiscountPercent = disc
                oInv.Lines.WarehouseCode = WarehouseCode
                oInv.Lines.VatGroup = VATGroup
                oInv.Lines.Add()
            Next
            lRetCode = oInv.Add()
           If lRetCode <> 0 Then
                oCompany.GetLastError(lErrCode, sErrMsg)
                MessageBox.Show(sErrMsg)
                Return False
    else
              Return true
    end if
    end function
    But when I Add 1 item, It Appears error "Item no. is missing  [INV1.ItemCode][line: 2]". Add 2 items appears "Item no. is missing  [INV1.ItemCode][line: 3]". I don't know this bug. Help me to solve this problem. Thanks.

    Hi Jane Jing!
    Thanks for your support I have fixed this problem. Now I want to add Payment continue in Add Invoice function:
    Dim oPayment As SAPbobsCOM.Payments
                    oPayment = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments)
                    oPayment.CardCode = strShop
                    oPayment.DocDate = Now.Date
                    oPayment.DocCurrency = "VND"
                    oPayment.CashAccount = "111100"
                    oPayment.CashSum = oInv.DocTotal
                    oPayment.Series = 0
                    oPayment.Remarks = "Remarks"
                    oPayment.Invoices.DocEntry = oInv.DocEntry
                    oPayment.Invoices.DocLine = 0
                    oPayment.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
                    oPayment.Invoices.SumApplied = oInv.DocTotal
                    lRetCode = oPayment.Add
                    If lRetCode <> 0 Then
                        oCompany.GetLastError(lErrCode, sErrMsg)
                        MessageBox.Show(sErrMsg)
                        Return False
                    End If
    The DocEntry of Invoice i have Add, but appear Error "No matching records found (ODBC -2028)" . Help me to fix it. Thanks
    Edited by: Tao lao on Jun 5, 2008 12:09 PM

  • How can i deal with it : -1004[IGE1],'Error(-1004) encountered'

    Hi,all,
    I'm trying to create a 'Issue for production' document through DI, and get this error message: -1004[IGE1],'Error(-1004) encountered', what shall i do? any tip is appreciated.
    I'm using DI 6.7, and my codes are:
    Private Sub Command6_Click()
    Dim RetVal As Long
    Dim ErrCode As Long
    Dim errMsg As String
    'Create the Documents object
    Dim vscfh As SAPbobsCOM.Documents
    Set vscfh = oCompany.GetBusinessObject(oInventoryGenExit)
    vscfh.DocDate = "06/12/2006"
    vscfh.Comments = "add from DI"
    vscfh.Lines.BaseType = "202"
    vscfh.Lines.BaseEntry = "5"
    vscfh.Lines.ItemCode = "A00001"
    vscfh.Lines.WarehouseCode = "01"
    vscfh.Lines.Quantity = 2
    RetVal = vscfh.Add
    If RetVal <> 0 Then
    oCompany.GetLastError ErrCode, errMsg
    MsgBox ErrCode & " " & errMsg
    End If
    End Sub

    Hi Hongtao Dong
    I see you are using
    -vscfh.Lines.BaseType = "202"
    -vscfh.Lines.BaseEntry = "5"
    But you then go and stipulate your item codes. You only use Basetype and baseentry if you are basing it on a previous document. If this is what you are trying to do, then don't stipulate the item code, rather use vscfh.Lines.BaseLine = 0 to stipulate which line it is based on.
    Hope this helps

  • Error "Item is not defined as an Inventory Item" using oInventoryGenEntry

    I am trying to create a Receipt from Production with this code:
                    receive = (Documents)_Company.GetBusinessObject(BoObjectTypes.oInventoryGenEntry);
                    receiveLine = receive.Lines;
                            receiveLine.BaseType = 202;
                            receiveLine.BaseEntry = oli.ProductionOrderNumber;
                            receiveLine.BaseLine = 0;
                            receiveLine.Quantity = oli.Quantity;
                            receiveLine.WarehouseCode = "01";
                    int errorCode = receive.Add();
    where the production order will contain several component items that make up a finished good.  Two of the component items are Labor and Royalties and are not marked as Inventory Items.
    The Add method returns this error:
    "Item is not defined as an Inventory Item" and references one the non-inventory items (ie 'Labor').
    I can received the same Production Order through SBO without an error.
    Suggestions?
    Thanks

    Because I am concerned about eliminating Labor from the Bill Of Material and its effect on the 'Acutal Product Cost' when I create a Production Order I set up a test.
    I created two Finished Goods Inventory Items with similar Bills of Material.  Both included a Labor component (non-inventory item).  The difference though, is one Labor component has an Item Type of Labor and the other Labor component has an Item Type of  'Items'
    Next, I create a Work order for each of the finished items.  Then I did a receipt from Production and closed the Work Orders.
    Looking at the Production Order summary, the Finished Good had an 'Actual Additional Cost' that was non-zero for the Finished Good that had a Labor component of the 'Items'; the other Finshed Good had a zero 'Actual Additional Cost'.  These seems in conflict with the eLearning segment on Production.
    At this point is this a different Forum?

  • SP01: DI error -5002 Invalid Total ORDR.DocTotal

    Hi All,
    i'm getting a strange error.
    i'm adding a sales order via DI.
    when the code is executed via the .net debugger it works great.
    when i create an installer and install the Addon i receive the error:
    -5002 Invalid Total [ORDR.DocTotal]
    do someone ever had this kind of error?
    btw i'm using SAPB12005A SP1 PL2
    thanks
    Moty Moshin

    Here is the code:
    oNewOrder = B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                        'B1Connections.diCompany.StartTransaction()
                        Dim LinesAdded As Integer = 0
                        For i = 1 To intDupAmount
                            Try
                                ' this loop adds the different items to the Delivery object
                                oNewOrder.CardCode = strBPCode
                                oNewOrder.Series = strSeriesCode
                                oNewOrder.NumAtCard = strVendorRefNo
                                oNewOrder.Project = strProjectCode
                                oNewOrder.ShipToCode = strShipToCode
                                oNewOrder.DocDueDate = strDocDueDate
                                oNewOrder.Comments = strComments
                                oNewOrder.PaymentGroupCode = strPaymentTerms
                                oNewOrder.PaymentMethod = strPaymentMethod
                                'Currently not available thru the DI/UI
                                'oNewOrder.header = OQUTHeader
                                'oNewOrder.Footer = OQUTFooter
                            Catch ex As Exception
                                B1Connections.theAppl.MessageBox("In For Step 1")
                            End Try
                            Try
                                oNewOrder.Lines.SetCurrentLine(0)
                                'Line item fields that are visible on the sales order form
                                oNewOrder.Lines.ItemCode = currSalesFormLines.ItemCode 'As String '1     'ItemCode
                                oNewOrder.Lines.ItemDescription = currSalesFormLines.ItemDesc 'As String '1     'ItemDesc
                                oNewOrder.Lines.WarehouseCode = currSalesFormLines.WhsCode 'As String '24     'WhsCode
                                oNewOrder.Lines.UnitPrice = currSalesFormLines.UnitPrice 'As Double '14     'UnitPrc
                                oNewOrder.Lines.DiscountPercent = currSalesFormLines.DiscPct 'As Double '14     'DiscPct
                                oNewOrder.Lines.Price = currSalesFormLines.Price 'As Double '17     'Price
                                oNewOrder.Lines.Quantity = currSalesFormLines.Quantity 'As Double '11     'Quantity
                                'Line item fields that are not visible on the sales order form
                                oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_EstQty).Value = currSalesFormLines.EstQty  'As Double 'U_XX_EstQty
                                'oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_STCC).Value = currSalesFormLines.STCC.ToString    'As Double 'U_XX_STCC
                                'oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_HSC).Value = currSalesFormLines.HSC   'As String 'U_XX_HSC
                                'oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_CVal).Value = currSalesFormLines.CVal.ToString    'As Double 'U_XX_CVal
                                oNewOrder.Lines.TotalLc = currSalesFormLines.TotalLc 'As Double '21     'TotalLc
                                oNewOrder.Lines.Total()
                                oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_QtyMT).Value = currSalesFormLines.QtyMT  'As Double 'U_XX_QtyMT
                                oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_QtyST).Value = currSalesFormLines.QtyST   'As Double 'U_XX_QtyST
                                'oNewOrder.Lines.UserFields.Fields.Item("U_" + cUDinit.udfMdL_DGood).Value = currSalesFormLines.DGood.ToString    'As String 'U_XX_DGood
                            Catch ex As Exception
                                B1Connections.theAppl.MessageBox("In For Step 2 - Lines")
                            End Try
                            Try
                                'Header level UDF's
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_ConNum).Value = cLastUdfMD.ConNum
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_ConTyp).Value = cLastUdfMD.ConTyp
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_ConSta).Value = cLastUdfMD.ConSta
                                If cLastUdfMD.RefCon <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_RefCon).Value = cLastUdfMD.RefCon
                                End If
                                'Get Release number
                                'B1Connections.theAppl.MessageBox("Before Add Msg 2")
                                lngNextRelease = cReleaseNumber.GetNextNum(cUDinit.udoRn_ReleaseNumber, strSeries)
                                If lngNextRelease = -1 Then
                                    B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack)
                                    retVal = cReleaseNumber.UnLockNumbering(cUDinit.udoRn_ReleaseNumber, strSeries)
                                    B1Connections.theAppl.MessageBox("Error - Cannot Get Next Number from NNM1")
                                    Exit Sub
                                End If
                                releaseNumbers.Add(lngNextRelease)
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_RelNum).Value = lngNextRelease.ToString  'intRelNum
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_ShDtSt).Value = cLastUdfMD.ShDtSt
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_ShDtEn).Value = cLastUdfMD.ShDtEn
                                If cLastUdfMD.StrDt <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_StrDt).Value = cLastUdfMD.StrDt
                                End If
                                If cLastUdfMD.StrAmt <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_StrAmt).Value = cLastUdfMD.StrAmt
                                End If
                                If cLastUdfMD.AcrAmt <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_AcrAmt).Value = cLastUdfMD.AcrAmt
                                End If
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_CQTY).Value = cLastUdfMD.CQTY
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_LN).Value = cLastUdfMD.LN
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_STerms).Value = cLastUdfMD.STerms
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_Mode).Value = cLastUdfMD.Mode
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_Carrier).Value = cLastUdfMD.Carrier
                                If cLastUdfMD.PortEntry <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_PtEnt).Value = cLastUdfMD.PortEntry
                                End If
                                If cLastUdfMD.CBrok <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_CBrok).Value = cLastUdfMD.CBrok
                                End If
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_Fterm).Value = cLastUdfMD.FTerms
                                If cLastUdfMD.PriveEq <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_PrivEq).Value = cLastUdfMD.PriveEq
                                End If
                                If cLastUdfMD.Route <> "" Then
                                    oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_Route).Value = cLastUdfMD.Route
                                End If
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_TF).Value = cLastUdfMD.TF
                                'oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_Season).Value = cLastUdfMD.Season
                                'oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_STCity).Value = cLastUdfMD.STCity
                                'oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_STCtr).Value = cLastUdfMD.STCtr
                                'oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_STSt).Value = cLastUdfMD.STSt
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_TAmtIn).Value = cLastUdfMD.TAmtIn
                                oNewOrder.UserFields.Fields.Item("U_" + cUDinit.udfMdH_TAmtOr).Value = cLastUdfMD.TAmtOr
                            Catch ex As Exception
                                B1Connections.theAppl.MessageBox("In For Step 3 - Header Level UDF")
                            End Try
                            ' add sales order current quntity () from total (U_XX_TQTYR)
                            ' add sales order current dollar value() from total (U_XX_TAMTR)
                            ' Try to add the sales order object to the database
                            'B1Connections.theAppl.MessageBox("Before Add Msg 3")
                            lRetCode = oNewOrder.Add()
                            'B1Connections.theAppl.MessageBox("Before Add Msg 3.1")
                            If lRetCode <> 0 Then ' If the addition failed
                                B1Connections.diCompany.GetLastError(lErrCode, sErrMsg)
                                B1Connections.theAppl.MessageBox("Error - " & lErrCode & sErrMsg)
                                '   B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack)
                                Try
                                    B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_RollBack)
                                Catch ex As Exception
                                    B1Connections.theAppl.MessageBox("Error - Add Error:" & lRetCode & " - " & ex.Message)
                                End Try
                                retVal = cReleaseNumber.UnLockNumbering(cUDinit.udoRn_ReleaseNumber, strSeries)
                                'B1Connections.diCompany.GetLastError(lErrCode, sErrMsg)
                                'B1Connections.theAppl.MessageBox("Error - " & lErrCode & sErrMsg)
                                Exit Sub
                            Else
                            End If
                            LinesAdded = LinesAdded + 1
                            ' init the order object
                            oNewOrder = B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                        Next i
                        'B1Connections.diCompany.EndTransaction(BoWfTransOpt.wf_Commit)
                        retVal = cReleaseNumber.UnLockNumbering(cUDinit.udoRn_ReleaseNumber, strSeries)

Maybe you are looking for