SAPbobsCOM.BoObjectTypes.BoRecordset

Hi Experts,
I am new to SAP Business One SDK, I created a this code :
Dim oRecordSet As SAPbobsCOM.Recordset
Dim oItem1 As SAPbouiCOM.EditText = oForm.Items.Item("Item_1").Specific
oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery("SELECT TOP 1 T0.[DocID] FROM [dbo].[@Testtable]  T0 ORDER BY T0.[DocID] DESC")
If oRecordSet.RecordCount > 0 Then
      oItem1.Value = oRecordSet.Fields.Item(0).Value
Else
      oItem1.Value = 1
End If
I have a clean database and it has no record at all. It gives me a correct value in my first testing but when I try to truncate my table it give me other record number. please help me about what does SAPbobsCOM.BoObjectTypes.BoRecordset do.

this is the script in my sql
CREATE TABLE [dbo].[@Testtable](
   [ID] [int] NOT NULL,
    [DocEntry] [int] NOT NULL,
    [DocNum] [int] NULL,
CONSTRAINT [Testtable] PRIMARY KEY CLUSTERED
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Im still trying to figuring it out.

Similar Messages

  • Bug in SAPbobsCOM.Recordset.GetAsXML()?

    I am using the following code:
    string query =
            "SELECT BoxCode as stBoxcode, (CASE WHEN TaxCode = 'B' THEN BaseAmount ELSE Debit + Credit END) AS Amountx " +
            "FROM (SELECT VatTaxBox.BoxCode, VatTaxBox.TaxCode, SUM(dbo.JDT1.Basesum * VatTaxBox.FSign) as BaseAmount, SUM(dbo.JDT1.Debit * VatTaxBox.FSign) AS Debit, SUM(dbo.JDT1.Credit * VatTaxBox.FSign) AS Credit " +
            "FROM  dbo.JDT1 INNER JOIN dbo.OJDT ON dbo.JDT1.TransId = dbo.OJDT.TransId " +
            "INNER JOIN dbo.OVTG ON dbo.JDT1.VatGroup = dbo.OVTG.Code " +
            "inner join (SELECT  (CASE WHEN BOXx IS NULL THEN VatBoxes.Boxcode ELSE BOXx END) AS BoxCode, VATMember, FormulSignx * FormulSign as FSign, OBOX.summayfld AS TaxCode " +
            "FROM (SELECT TOP 100 PERCENT B11.BoxCode AS BOXx, B0.boxcode, B0.BoxMember, B0.VATMember, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B0.boxcode and b1.SeqNum = B0.Seqnum-1), +1) AS FormulSignx, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
            "where b1.boxcode=B11.boxcode and b1.SeqNum = B11.Seqnum-1), +1) AS FormulSign " +
            "FROM BOX1 B0 LEFT OUTER JOIN BOX1 B11 ON B0.BoxCode = B11.BoxMember " +
            "WHERE (NOT (B0.VATMember IS NULL)) ORDER BY B11.BoxCode, B0.BoxCode, B0.SeqNum) AS VatBoxes " +
            "INNER JOIN OBOX ON VatBoxes.boxcode = obox.boxcode) as VatTaxBox ON JDT1.VatGroup = VatTaxBox.VATMember " +
            "WHERE (dbo.OJDT.RefDate >= '2005/01/01') AND (dbo.OJDT.RefDate <= '2005/07/01') AND OJDT.Series = 4 GROUP BY VatTaxBox.BoxCode, VatTaxBox.TaxCode ) as ResultSet ";
          SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)_sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
          try
            rs.DoQuery(query);
            int i = rs.RecordCount;
            int j = i++;
            string s = rs.GetAsXML(); //-> throws an error: "External component has thrown an exception."
          catch (Exception ex)
            System.Windows.Forms.MessageBox.Show(ex.ToString());
    The statement rs.GetAsXML() throws an exception. However when I use a simpler query everything works fine.
    What am I doing wrong?
    Jurgen

    I don't specifically, but one trick I've learned of is to "hide" complex SQL queries in functions or stored procedures.  SBO sometimes has problems with complex SQL queries.  They're aware of this, but until it's fixed, try putting that "monster" in a function or a view. 
    Hope that helps.

  • SAPBobsCOM Recordset cannot execute Stored Procedure

    I have a query stored in a SQL 2005 Stored Procedure, and when want to retrieve my procedure with the Recordset.doQuery() command, this error message appears :
    System.Runtime.InteropServices.COMException (0xFFFFF930) at SAPbobsCOM.IRecordset.DoQuery(String QueryStr) at [ blah2..... (it refers to my code line) ]
    My code is :
    Dim oRec As SAPbobsCOM.Recordset
    oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    Try
            oRec.DoQuery("EXEC PO_LIst2")
    Catch ex As Exception
            MsgBox(ex.GetBaseException.ToString)
    End Try
    And when I change my code to be like this :
    Dim oRec As SAPbobsCOM.Recordset
    oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    Try
            oRec.DoQuery("Select * From OPOR")
    Catch ex As Exception
            MsgBox(ex.GetBaseException.ToString)
    End Try
    I don't get any error....
    For all of the code I use SQL Server 2005, Visual Studio 2008, and SAPBobsCOM version 8.8.
    Have anyone experience this?? Why the recordset can't execute my stored procedure??
    Edited by: Rinaldi Sugiono on Jun 18, 2010 1:44 PM

    I would search the forums for SAPBobsCOM to find a more appropriate forum, since the BusinessOne components are outside of scope for this forum.
    Sincerely,
    Ted Ueda

  • QueryInterface error for the interface SAPbobsCOM.ICompany

    Hello everybody,
    I get this error (subject of the thread) if my AddOn is running for a while and I then try to
    oRecSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    I haven't got this problem before.
    Isearched the forum for simular problems. Somebody said it could be from security reason. Can you help me?
    How can I avoid this error? Why is my oCompany object currupt after an hour of doing nothing?

    Hi Juri!
    could you describe your AddOn's idea?
    If i understand you correctly your AddOn is connected to SBO using SSO and is waiting for some events. When the needed event is handled you try to do something via DI, and a period of time between connection and needed event can be more than an hour.. am i right?
    if so, i suppose the trouble is that DI-connection die till the end user initiates needed event.
    try to check DI-Connect Status before you try to perform any operations like RecordSet ones.
    You can also try to make a DI-connection exactly in event handler and disconnect after (but you must know that DI-connection can take some seconds and it influences on addOn and SBO perfomance)
    HTH

  • How to Delete a Specific Cell in a Matrix + plz Give sample code for Lost F

    hello there !!!!
    i m in Great Trouble please help me out..
    i have to search for a specific Column n then i have to validate that portion, similarly after validating i have to add update delete all the fuction apply... so please help me i m very upset.
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim Count As Int32
                If FormUID.Equals("Allowance") Then
                    If (pVal.BeforeAction = True) And (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                        If pVal.Row = 0 Then
                            'BubbleEvent = False
                        End If
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        Count = o_Matrix.RowCount()
                        SBO_Application1.MessageBox("Matrix Count is " & o_Matrix.RowCount)
                        Validate(pVal, EventEnum, FormUID, BubbleEvent)
                    End If
                End If
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim Row, ii As Integer
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            o_Matrix.FlushToDataSource()
            Try
                For Row = 2 To o_Matrix.RowCount
                    StrName = Convert.ToString(DBtable.GetValue("CardCode", Row - 1)).Trim()''' i got Error over there n rest of my code is also not working pls...
                    StrUId = Convert.ToString(DBtable.GetValue("U_AlwID", Row - 1)).Trim()
                    StrEnter = Convert.ToString(DBtable.GetValue("U_SupEnter", Row - 1)).Trim()
                    StrExist = Convert.ToString(DBtable.GetValue("U_SupExist", Row - 1)).Trim()
                    If Row - 1 < DBtable.Rows.Count - 1 Or (Not (StrName.Equals(String.Empty) And StrUId.Equals(String.Empty) And (StrEnter.Equals(String.Empty) Or StrExist.Equals(String.Empty))) And (Row - 1 = DBtable.Rows.Count - 1)) Then
                        If (Not StrName.Equals(String.Empty)) And ((StrUId.Equals(String.Empty) Or StrEnter.Equals(String.Empty)) Or StrExist.Trim.Equals(String.Empty)) Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                        For ii = Row To DBtable.Rows.Count - 1
                            If Convert.ToString(DBtable.GetValue("ColName", ii)).Trim().Equals(StrName.Trim()) Then
                                SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Duplication Not Allowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
                                BubbleEvent = False
                                Exit Sub
                            End If
                        Next
                        If CDbl(StrName) < 0 Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                    End If
                Next Row
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

    Hello there
    sir i want to Add Update and delete these three basic operation onto the Matrix, Sir u game me a Sample code of Delete a specific Column...
    Sir can u do me a favour pls leave every thing n just told me how to update a matrix ,like i have to fill the matrix field through the DATABASE table now i want to update the DataBase table from the matrix..
    i just only know thta i have to fill back database table with the help of FLUSHTODATABASE()
    here is my Sample Code...n i have to update in the validate portion...
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim oCellValue As SAPbouiCOM.EditText
                If FormUID.Equals("Allowance") Then
                    If (pVal.ItemUID = "MatAllow") Then
                        If pVal.Row = 0 Then Exit Sub
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        If (pVal.Row > o_Matrix.RowCount) Then Exit Sub
                        oForm = SBO_Application1.Forms.Item(FormUID)
                        If (pVal.ItemUID = "1" Or EventEnum = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                            If pVal.ColUID = "ColName" And pVal.BeforeAction = True Then
                                If pVal.Row = 0 Then Exit Sub
                                oCellValue = CType(o_Matrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific(), SAPbouiCOM.EditText)
                                If (oCellValue.Value.Trim().Equals(String.Empty) And o_Matrix.RowCount <> pVal.Row) Then
                                    SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Blank Value Not Allowed", )
                                    oCellValue.Active = True
                                    BubbleEvent = False
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
                End If
                Validate(pVal, EventEnum, FormUID, BubbleEvent)
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
    Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim str, str1 As String
            Dim checkbox1, Checkbox2 As SAPbouiCOM.CheckBox
            Dim o_Matrix As SAPbouiCOM.Matrix
            Dim Sum As Integer
            Dim oRecordset As SAPbobsCOM.Recordset
            Dim Container As Integer
            Dim Count As Int32
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            oRecordset = o_CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                For Count = 0 To DBtable.Rows.Count - 1
                    CodeFill = Convert.ToString(DBtable.GetValue("Name", Count).Trme())
                    NameID = Convert.ToString(DBtable.GetValue("ColUID", Count).Trim())
                    Price = Convert.ToString(DBtable.GetValue("ColPrice", Count).Trim())
                    Quantity = Convert.ToString(DBtable.GetValue("ColQuant", Count).Trim())
                    Total = Convert.ToString(DBtable.GetValue("ColTotal", Count).Trim())
                    checkbox1 = o_Matrix.Columns.Item("ColSEnter").Cells.Item(Count).Specific
                    Checkbox2 = o_Matrix.Columns.Item("ColSExist").Cells.Item(Count).Specific
                    If (checkbox1.Checked = True) And (Checkbox2.Checked = True) Then
                        Dim Sql As String
                        Sql = "Update [@Supplier] Set U_Price=' " & Price & " ',U_ID=" & NameID & "Where Name ='" & CodeFill & " '"
                        oRecordset.DoQuery(Sql)
                    End If
                Next Count
                SBO_Application1.MessageBox("Record was Updated")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

  • Error while creating a column in master

    Hi all,
    I am using the sap business one 8.8 version.
    I am getting an error while creating a user defined column for a master table.
    The error code is -104.
    The method I had used for creating a master table is as follows.
    *#region Create Table*
            public static bool CreateTable(string TableName, string TableDescription, SAPbobsCOM.BoUTBTableType TableType, SAPbouiCOM.Application oApplication, SAPbobsCOM.Company oCompany)
                SAPbobsCOM.UserTablesMD oUserTableMD;
                int intRecCode;
                bool boolResult = false;
                oUserTableMD = (SAPbobsCOM.UserTablesMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables);
                try
                    if (!oUserTableMD.GetByKey(TableName))
                        oUserTableMD.TableName = TableName;
                        oUserTableMD.TableDescription = TableDescription;
                        oUserTableMD.TableType = TableType;
                        intRecCode = oUserTableMD.Add();
                        if (intRecCode == 0)
                            boolResult = true;
                catch (Exception e)
                    oApplication.MessageBox(e.Message, 1, "Ok", "", "");
                finally
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTableMD);
                    GC.Collect();
                return boolResult;
            #endregion
    ==================================
    The following is the code for creating a column in the above master
    private static void AddField(string TableName, string ColumnName, string ColDescription, SAPbobsCOM.BoFieldTypes FieldType, int Size, SAPbobsCOM.BoFldSubTypes SubType, string ValidValues, string ValidDescription, string
    SetValidValues, SAPbouiCOM.Application oApplication, SAPbobsCOM.Company oCompany)
    int intLoop;
                string[] strValue, strDesc;
                SAPbobsCOM.UserFieldsMD oUserFieldsMD;
                SAPbobsCOM.Recordset oRecordSet;
                oUserFieldsMD = (SAPbobsCOM.UserFieldsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
                oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                try
                    oRecordSet.DoQuery("SELECT COUNT(*) FROM CUFD WHERE TableID = '" + TableName + "' AND AliasID = '" + ColumnName + "'");
                    if (Convert.ToInt16(oRecordSet.Fields.Item(0).Value) == 0)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecordSet);
                        oRecordSet = null;
                        strValue = ValidValues.Split(Convert.ToChar(","));
                        strDesc = ValidDescription.Split(Convert.ToChar(","));
                        if (strValue.GetLength(0) != strDesc.GetLength(0))
                            throw new Exception("Invalid Values");
                        oUserFieldsMD.TableName = TableName;
                        oUserFieldsMD.Name = ColumnName;
                        oUserFieldsMD.Description = ColDescription;
                        oUserFieldsMD.Type = FieldType;
                        if (FieldType != SAPbobsCOM.BoFieldTypes.db_Numeric)
                            oUserFieldsMD.Size = Size;
                        else
                            oUserFieldsMD.EditSize = Size;
                        oUserFieldsMD.SubType = SubType;
                        oUserFieldsMD.DefaultValue = SetValidValues;
                        for (intLoop = 0; intLoop <= strValue.GetLength(0) - 1; intLoop++)
                            oUserFieldsMD.ValidValues.Value = strValue[intLoop];
                            oUserFieldsMD.ValidValues.Description = strDesc[intLoop];
                            oUserFieldsMD.ValidValues.Add();
                        if (oUserFieldsMD.Add() != 0)
                            UpdateLastErrorDetails(-104, oCompany);
                catch (Exception e)
                { oApplication.MessageBox(e.Message, 1, "Ok", "", ""); }
                finally
                    if (oRecordSet != null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecordSet);
                        oRecordSet = null;
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFieldsMD);
                    GC.Collect();

    Hi,
    I am newly using BI publisher . I am using 10.1.3.4.0 . I am just trying to create a report in test name. that is the first step to create a report where i am getting error. I am using default RPD paint , where all the user and Groups are defined .

  • Error while updating a database

    hi,
    i am getting an error "Object reference not set to an instance of object" while updating a database. here is my code..
    QryStr = "update OSRI set U_sqf = Val('" & sqft & "'),U_sqm = Val('" & sqmt & "') where ItemCode = '" & Code & "'"
                RecSet.DoQuery(QryStr)
                Res = True
    Edited by: puneeth shankar on Jul 2, 2008 7:27 PM

    Hi
    Maybe you are missing these sentences ..
    Dim RecSetAs SAPbobsCOM.Recordset
    RecSet= SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    and then
    QryStr = "update OSRI set U_sqf = Val('" & sqft & "'),U_sqm = Val('" & sqmt & "') where ItemCode = '" & Code & "'"
    RecSet.DoQuery(QryStr)
    Res = True
    But I think you are trying to update directly using an Update statement to a SAP table.  You must check the documentation.  I think this is not allow.  You must then use an alternate way !

  • Unable to use User Fields

    Hello,
    I'm using SAP2005A SP01 PL36.
    I can create UserTables with UserFields (other than Code and Name standard fields) by DI API.
    But every time I try to set data in these UserFields I got the error "Invalid Field Name", and no error when I set data in Code and Name standard fields.
    Code is like this:
    Dim oTable As SAPbobsCOM.UserTable
    ' THIS WORKS FINE
    oTable = SBO_Company.UserTables.Item("MyTable")
    oTable.Code = "000001"
    oTable.Name = "Addon 000001"
    If oTable.Add() = 0 Then
       Me.txtLog.AppendText("Ok" & vbCrLf)
    Else
       Me.txtLog.AppendText("Error" & vbCrLf)
       Return False
    End If
    ' THIS GIVES ERROR "Invalid Field Name"
    oTable = SBO_Company.UserTables.Item("MyTable2")
    oTable.Code = "000000"
    oTable.Name = "000000"
    oTable.UserFields.Fields.Item("U_ParName").Value = "Param0"   'Here I got the error
    oTable.UserFields.Fields.Item("U_ParValue").Value = "Value0"
    If oTable.Add() = 0 Then
       Me.txtLog.AppendText("Ok" & vbCrLf)
    Else
       Me.txtLog.AppendText("Error" & vbCrLf)
       Return False
    End If
    In debug mode, I can see that <b>oTable.UserFields.Fields</b> collection is always empty.
    Already open a message in SAP, but no feedback.
    Anyone got this error too? (or can reproduce this error?)
    Regards,
    Andrea

    Use this function While Saving,
    Function KeyGen(ByVal TableName As String, Optional ByVal Prefix As String = "DOC") As String()
            Dim rs As SAPbobsCOM.Recordset
            Dim Qry As String
            Dim s(2) As String
            Dim str As String = Prefix & "-"
            Dim i As Integer
            rs = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Qry = "SELECT MAX(CAST(Code AS int)) code FROM [@" & TableName & "]"
            rs.DoQuery(Qry)
            If rs.RecordCount <> 0 Then
                For i = 5 To Len(CStr(rs.Fields.Item("Code").Value)) Step -1
                    str &= "0"
                Next
                str &= (CInt(rs.Fields.Item("Code").Value) + 1)
                s(0) = CStr(rs.Fields.Item("Code").Value + 1)
                s(1) = str
            Else
                str = Prefix & "000001"
                s(0) = "1"
                s(1) = str
            End If
            Return s
        End Function
    If it is helpful give reward points,
    Regards,
    Anitha

  • Delivery Notes Generation Via Pick List

    Am trying to generate delivery notes off pick tickets and i can't find any code example. I now came up with the following code but am having issues when items are in multiple Bin Locations.
    Public Sub Sales2Delivery() '(ByVal OrderID As String)
            Dim OrderID As String = ""
            Try
                Using connection As New SqlConnection(StaginConn)
                    'Dim command As New SqlCommand("SELECT DocEntry from ORDR with (nolock) WHERE NumAtCard = '" & OrderID & "'", connection)
                    Dim command As New SqlCommand("SET DATEFORMAT DMY; select distinct top 5 o.DocEntry, o.NumAtCard from ordr O with (nolock) join RDR1 R with (nolock) on R.DocEntry = O.DocEntry join OPKL P with (nolock) on P.AbsEntry = R.PickIdNo where u_shipstate = 'Delivered' and CAST(O.docdate as date) >= '30/04/2014' and P.Status = 'Y';", connection)
                    connection.Open()
                    Dim reader As SqlDataReader = command.ExecuteReader()
                    ' Call Read before accessing data.
                    While reader.Read()
                        Dim BusinessOrders As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oOrders), Documents)
                        Dim BusinessDelivery As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes), Documents)
                        Dim orders As Documents = BusinessOrders
                        orders.GetByKey(Convert.ToInt32(reader(0)))
                        OrderID = Convert.ToString(reader(1))
                        Dim Delivery As Documents = BusinessDelivery
                        Delivery.CardCode = orders.CardCode
                        Delivery.CardName = orders.CardName
                        Delivery.NumAtCard = orders.NumAtCard
                        'Delivery.DocNum = orders.DocNum
                        Delivery.HandWritten = BoYesNoEnum.tNO
                        Delivery.Series = 8
                        Delivery.DocDate = DateTime.Today
                        Delivery.DocDueDate = DateTime.Today
                        Delivery.TaxDate = DateTime.Today
                        Delivery.Address = orders.Address
                        Delivery.Address2 = orders.Address2
                        Delivery.Comments = "Based on Sales Order #" + orders.NumAtCard & "."
                        Delivery.DocCurrency = orders.DocCurrency
                        Delivery.DocDueDate = orders.DocDueDate
                        Delivery.DocObjectCode = SAPbobsCOM.BoObjectTypes.oDeliveryNotes
                        Delivery.ShipToCode = orders.ShipToCode
                        Dim lines As Document_Lines = orders.Lines
                        'If (count > 0) Then
                        '    lines.Add()
                        '    lines.SetCurrentLine((lines.Count - 1))
                        'End If
                        Dim oPickList As PickLists = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oPickLists), PickLists)
                        oPickList.GetByKey(orders.Lines.PickListIdNumber)
                        For i As Int32 = 0 To (lines.Count - 1)
                            If i > 0 Then
                                Delivery.Lines.Add()
                                Delivery.Lines.SetCurrentLine(i)
                            End If
                            ' Set the Current Lines on the order
                            orders.Lines.SetCurrentLine(i)
                            Try
                                oPickList.Lines.SetCurrentLine(i)
                                Delivery.Lines.BaseEntry = oPickList.Lines.OrderEntry
                                Delivery.Lines.BaseLine = oPickList.Lines.OrderRowID
                                Delivery.Lines.Quantity = oPickList.Lines.PickedQuantity
                                Delivery.Lines.BaseType = DirectCast(SAPbobsCOM.BoObjectTypes.oOrders, Integer)
                                Delivery.Lines.BinAllocations.BinAbsEntry = oPickList.Lines.BinAllocations.BinAbsEntry
                                Dim rs As SAPbobsCOM.Recordset = vCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                rs.DoQuery("select itemcode, price, dscription from RDR1 R where R.LineNum = " & oPickList.Lines.OrderRowID & " and R.PickIdNo = " & oPickList.Lines.AbsoluteEntry)
                                While (rs.EoF <> True)
                                    Delivery.Lines.ItemCode = rs.Fields.Item(0).Value.ToString 'orders.Lines.ItemCode
                                    Delivery.Lines.UnitPrice = CType(rs.Fields.Item(1).Value.ToString, Double) 'orders.Lines.UnitPrice
                                    Delivery.Lines.ItemDescription = rs.Fields.Item(2).Value.ToString 'orders.Lines.ItemDescription
                                    rs.MoveNext()
                                End While
                                rs = Nothing
                            Catch ex As Exception
                                Continue For
                                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                            End Try
                        Next
                        If Delivery.Add() <> 0 Then
                            ErrDetails.AppendLine(" Unable to create Delivery note for Order: " & OrderID & " <br /> " & vCompany.GetLastErrorCode() & ":" & vCompany.GetLastErrorDescription())
                        Else
                            ErrDetails.AppendLine("Successfully created Delivery note for Order:" & OrderID) ' & " as requested by " & UserEmail & ".")
                        End If
                        orders = Nothing
                        Delivery = Nothing
                        BusinessOrders = Nothing
                        BusinessDelivery = Nothing
                        My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                    End While
                    'orders = Nothing
                    'BusinessOrders = Nothing
                End Using
            Catch ex As Exception
                ErrDetails.AppendLine(" Error generating Delivery note for Order: " & OrderID & " <br /> " & ex.ToString())
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            Finally
                If Not String.IsNullOrWhiteSpace(ErrDetails.ToString) Then
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Errors encountered while registering data on " & System.DateTime.Now.ToString("F") & ".Errors:" & ChrW(13) & ChrW(10) & Me.ErrDetails.ToString), True)
                Else
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Application Ran successfully on " & System.DateTime.Now.ToString("F") & "."), True)
                End If
            End Try
        End Sub
    The Error message am getting is 1470000368 - The quantity allocated to bin locations must be positive.

    Am getting this error now is
    "1470000341 - Fully allocate item "1017494" to bin locations in warehouse "Isolo". Issue is we have items in multiple Bin locations and the items have been picked via the pick ticket. Is it also possible to generate the delivery note off the Pick List.
    The new code am using is
        Public Sub Sales2Delivery() '(ByVal OrderID As String)
            Dim OrderID As String = ""
            Try
                Using connection As New SqlConnection(StaginConn)
                    'Dim command As New SqlCommand("SELECT DocEntry from ORDR with (nolock) WHERE NumAtCard = '" & OrderID & "'", connection)
                    Dim command As New SqlCommand("SET DATEFORMAT DMY; select distinct top 5 o.DocEntry, o.NumAtCard from ordr O with (nolock) join RDR1 R with (nolock) on R.DocEntry = O.DocEntry join OPKL P with (nolock) on P.AbsEntry = R.PickIdNo where u_shipstate = 'Delivered' and CAST(O.docdate as date) >= '30/04/2014' and P.Status = 'Y' and o.DocStatus = 'O';", connection)
                    connection.Open()
                    Dim reader As SqlDataReader = command.ExecuteReader()
                    ' Call Read before accessing data.
                    While reader.Read()
                        Dim BusinessOrders As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oOrders), Documents)
                        Dim BusinessDelivery As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes), Documents)
                        Dim orders As Documents = BusinessOrders
                        orders.GetByKey(Convert.ToInt32(reader(0)))
                        OrderID = Convert.ToString(reader(1))
                        Dim Delivery As Documents = BusinessDelivery
                        Delivery.CardCode = orders.CardCode
                        Delivery.CardName = orders.CardName
                        Delivery.NumAtCard = orders.NumAtCard
                        'Delivery.DocNum = orders.DocNum
                        Delivery.HandWritten = BoYesNoEnum.tNO
                        'Delivery.Series = 8
                        Delivery.DocDate = DateTime.Today
                        Delivery.DocDueDate = DateTime.Today
                        Delivery.TaxDate = DateTime.Today
                        Delivery.Address = orders.Address
                        Delivery.Address2 = orders.Address2
                        Delivery.Comments = "Based on Sales Order #" + orders.NumAtCard & "."
                        Delivery.DocCurrency = orders.DocCurrency
                        Delivery.DocDueDate = orders.DocDueDate
                        Delivery.DocObjectCode = SAPbobsCOM.BoObjectTypes.oDeliveryNotes
                        Delivery.ShipToCode = orders.ShipToCode
                        Dim lines As Document_Lines = orders.Lines
                        'If (count > 0) Then
                        '    lines.Add()
                        '    lines.SetCurrentLine((lines.Count - 1))
                        'End If
                        Dim oPickList As PickLists = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oPickLists), PickLists)
                        oPickList.GetByKey(orders.Lines.PickListIdNumber)
                        For i As Int32 = 0 To (lines.Count - 1)
                            If i > 0 Then
                                Delivery.Lines.Add()
                                Delivery.Lines.SetCurrentLine(i)
                            End If
                            ' Set the Current Lines on the order
                            orders.Lines.SetCurrentLine(i)
                            Try
                                oPickList.Lines.SetCurrentLine(i)
                                Delivery.Lines.BaseEntry = oPickList.Lines.OrderEntry
                                Delivery.Lines.BaseLine = oPickList.Lines.OrderRowID
                                Delivery.Lines.Quantity = oPickList.Lines.PickedQuantity
                                Delivery.Lines.BaseType = DirectCast(SAPbobsCOM.BoObjectTypes.oOrders, Integer)
                                'Dim rs As SAPbobsCOM.Recordset = vCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                'rs.DoQuery("select itemcode, price, dscription from RDR1 R where R.LineNum = " & oPickList.Lines.OrderRowID & " and R.PickIdNo = " & oPickList.Lines.AbsoluteEntry)
                                'While (rs.EoF <> True)
                                Delivery.Lines.ItemCode = orders.Lines.ItemCode
                                Delivery.Lines.UnitPrice = orders.Lines.UnitPrice
                                Delivery.Lines.ItemDescription = orders.Lines.ItemDescription
                                '            rs.MoveNext()
                                '            End While
                                'rs = Nothing
                            Catch ex As Exception
                Continue For
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            End Try
                        Next
                        If Delivery.Add() <> 0 Then
                            ErrDetails.AppendLine(" Unable to create Delivery note for Order: " & OrderID & " <br /> " & vCompany.GetLastErrorCode() & ":" & vCompany.GetLastErrorDescription())
                        Else
                            ErrDetails.AppendLine("Successfully created Delivery note for Order:" & OrderID) ' & " as requested by " & UserEmail & ".")
                        End If
                        orders = Nothing
                        Delivery = Nothing
                        BusinessOrders = Nothing
                        BusinessDelivery = Nothing
                        My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                    End While
                    'orders = Nothing
                    'BusinessOrders = Nothing
                End Using
            Catch ex As Exception
                ErrDetails.AppendLine(" Error generating Delivery note for Order: " & OrderID & " <br /> " & ex.ToString())
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            Finally
                If Not String.IsNullOrWhiteSpace(ErrDetails.ToString) Then
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Errors encountered while registering data on " & System.DateTime.Now.ToString("F") & ".Errors:" & ChrW(13) & ChrW(10) & Me.ErrDetails.ToString), True)
                Else
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Application Ran successfully on " & System.DateTime.Now.ToString("F") & "."), True)
                End If
            End Try
        End Sub

  • Open a Crystal Report preview using a button

    Hello. I need to open a Crystal Report preview using a button from my add-on. I've already created my report, so I need to create the object, pass the parameters and open an screen with my preview. Does anyone has a C# example? Thank you.

    hi,
    this is code for open the crystal report press the button.
    First import the crystal report  using Report  and  layout manager
    goto administration->setup->general--->Report  and  layout manager
    create one button in add-on form.when we press the button the following event triggered.
    get the docnumber for that particular form and pass it.
    Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                            If pVal.ItemUID = "btnPrint" Then
                                Dim strAcNcmr As Integer
                                strAcNcmr = objForm.Items.Item("txtDocNo").Specific.Value
                                Dim oRS As SAPbobsCOM.Recordset
                                oRS = objSBOAPI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                oRS.DoQuery("SELECT MenuUID FROM OCMN WHERE Name = ' Purchase Indend' AND Type = 'C'")
                                objSBOAPI.SBO_Appln.ActivateMenuItem(oRS.Fields.Item(0).Value.ToString())
                                Dim oForm1 As SAPbouiCOM.Form
                                oForm1 = objSBOAPI.SBO_Appln.Forms.ActiveForm
                                oForm1.Items.Item("1000003").Specific.String = strAcNcmr
                                oForm1.Items.Item("1").Click()
                                oForm1.Items.Item("1").Visible = False
                                oForm1.Items.Item("2").Click()
                            End If
    this is easy solution for open the crystal report for add-on form
    Thanks & regards
    B.lakshmi narayanan

  • How to use the Combo Box In MAtrix Colums

    HI Experts,
    Good Mornong.How to use the Combo Box In MAtrix Colums?
    Regards And Thanks,
    M.Thippa Reddy

    hi,
    loading data in to the combobox on form load.but, it should be done when atleast one row is active.
    the values what ever you are inserting in to combo should  be less than or eqhal to 100 or 150.if it exceeds beyond that performance issue arises.it takes more time to load all the data.so, it is better to have 100 or less.
    oMatrix.AddRow()
    RS = Nothing
    RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    RS.DoQuery("select ItemCode,ItemName from oitm")
    oCombo = oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific
    For i = 1 To RS.RecordCount
          If RS.EoF = False Then
                oCombo.ValidValues.Add(RS.Fields.Item("ItemCode").Value,RS.Fields.Item("ItemName").Value)
                RS.MoveNext()
          End If
    Next
    the above code is inserting data from database to column combobox.
    you can fill combo directly also as shown below.
    oCombo.ValidValues.Add("x","1")
    oCombo.ValidValues.Add("y","2")
    oCombo.ValidValues.Add("z","3")
    oCombo.ValidValues.Add("","")
    and what ever the values you are filling into combo should be unique.other wise it shows valid value exists.
    regards,
    varma

  • To send data from a Recordset (DI) to a matrix(grid) of UI.

    Hello to all, I am creating a demo, a SQL execute with a Recordset, any problem until the moment, when I want to pass the data to one you GRID (matrix) I don't eat to make it. 
    it grid it it is an object of UI and the recordset of DI 
    as I can supplement the DI with the UI.
    Thanks.
    from Chile.

    Hello Francisco,
    You also can use the recordset.
    oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            oRecordSet.DoQuery("Select * from OHEM where EmpId < 10")
            SBO_Application.MessageBox("REgistros seleccionados :" & CStr(oRecordSet.RecordCount()))
            oMatrix = oForm.Items.Item("Rejilla").Specific
            oMatrix.Clear()
            If oRecordSet.RecordCount > 0 Then
                oRecordSet.MoveFirst()
                With oForm.DataSources.UserDataSources
                    While Not oRecordSet.EoF
                        .Item("Codigo").Value = oRecordSet.Fields.Item("EmpId").Value
                        .Item("Nombre").Value = oRecordSet.Fields.Item("FirstName").Value
                        .Item("Apellido1").Value = oRecordSet.Fields.Item("MiddleName").Value
                        .Item("Apellido2").Value = oRecordSet.Fields.Item("LastName").Value
                        oMatrix.AddRow()
                        oRecordSet.MoveNext()
                    End While
                End With
            End If
    Un Saludo.
    Jose Antonio.

  • Application Crash while updating a Bill of Material

    Hi,
    I am currently developing an addon for SAP Business One. When updating a BOM record I have the following problem:
    If i call the Update Method of the ProductTrees Object the SAP Business One Application Crashes with the Error:
    "Runtime Error!
    Programm: E:ProgrammeSAPSAP Business OneSAP Business One.exe
    R6025
    - pure virtual function call"
    The Code i am Calling looks like this:
    Protected Sub closeBundleBillOfMaterial(ByVal sCode As String)
            Dim oRec As SAPbobsCOM.Recordset = cInit.getInstance.getSboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Dim sSQL As String = "SELECT OITT.Code FROM ITT1 INNER JOIN OITT ON ITT1.Father = OITT.Code WHERE ITT1.Code = '" & sCode & "'"
            Dim oBOM As SAPbobsCOM.ProductTrees = cInit.getInstance.getSboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees)
            Dim iRetVal As Integer = 0
            Dim sItemCode As String = ""
            Try
                oRec.DoQuery(sSQL)
                oRec.MoveFirst()
                While oRec.EoF = False
                    sItemCode = oRec.Fields.Item("Code").Value
                    If oBOM.GetByKey(sItemCode) Then
                        oBOM.UserFields.Fields.Item("U_Status").Value = "C"
                        iRetVal = oBOM.Update()
                        If iRetVal <> 0 Then
                            Throw New Exception("Fehler bei Methode Update in closeBundleBillOfMaterial")
                        End If
                    End If
                    oRec.MoveNext()
                End While
            Catch ex As Exception
                cLog.err("Fehler beim Ermitteln der verbundenen Stücklisten. ", ex)
            Finally
                cUtil.deleteObject(oRec)
            End Try
        End Sub
    My stats are:
    - SAP Business One 8.8 PL 16
    - SQL Server 2008 Standard Edition with SP2
    - Visual Studion 2010
    I hope someone has a solution for this problem. Thanks a lot.
    Regards
    Michael

    Hi experts;
    I´m getting the same error on one of my ADDONS. Did migrating the SAP B1 database to PL 18 Worked? I'm very frustrated with this error. Thanks for your hekp.

  • Get Error while update the User defined row table through DSK Code

    Hi experts,
    I have got an error while updating the user row defined table.
    Error is - "Invalid row"
    I have created one master table "@CBF_FARM " and Child table "@CBF_FAR1"
    First i inserted 5 record in the child table so in my my child table there are 5 Line id (1,2,3,4,5 one for each row).
    after that i delete 2 rows (3rd & 4th row) from child table now in my child table there are 3 rows( Line id 1, 2, 5). Please See attachment.
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    Following Code used for updating the user defined child table.
      SAPbobsCOM.GeneralService oGeneralService1 = null;
                                    SAPbobsCOM.GeneralData oGeneralData1 = null;
                                    SAPbobsCOM.GeneralDataParams oGeneralParams1 = null;
                                    SAPbobsCOM.CompanyService sCmp1 = null;
                                    SAPbobsCOM.GeneralData oChild1 = null;
                                    SAPbobsCOM.GeneralDataCollection oChildren1 = null;
                                    sCmp1 = clsAddOn.LDNA_Company.GetCompanyService();
                                    oGeneralService1 = sCmp1.GetGeneralService("CBF_FARM");
                                    // Get UDO record
                                    oGeneralParams1 = ((SAPbobsCOM.GeneralDataParams)(oGeneralService1.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
                                    oGeneralParams1.SetProperty("Code", oForm.Items.Item("edtFarmCd").Specific.Value);
                                    oGeneralData1 = oGeneralService1.GetByParams(oGeneralParams1);
                                    // Add lines on UDO Child Table
                                    oChildren1 = oGeneralData1.Child("CBF_FAR1");
                                    // Create data for rows in the child table
                                    SAPbouiCOM.Item oItem = oForm.Items.Item("cmbShed");
                                    oCombo = oItem.Specific;
                                    string ShedCode = oCombo.Selected.Value;
                                    ldna_Rec = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                                    string strQuery1 = "select LineId from [@CBF_FAR1] where U_ShedCd = " + ShedCode;
                                    ldna_Rec.DoQuery(strQuery1);
                                    oChild1 = oChildren1.Item(ldna_Rec.Fields.Item("LineId").Value - 1);
                                    oChild1.SetProperty("U_Status", "Ready For Schedule");
                                    //Update the UDO Record
                                    oGeneralService1.Update(oGeneralData1);
    Please Help me it is an urgent requirement,
    -Regards
    Vikas

    hi.
    Error is - "Invalid row"
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    As per my knowledge
    What i understood is you have 5 lines and you are going to be update 5th line
    am i correct..
    while u are updating the line in child table
    you have to consider like this..
    line number         u have to update like
    1                                        0
    2                                        1
    3                                        2
    4                                        3
    5                                        4
    which means in child table treat
    line 1  as 0
    line 2 as  1
    line 5 as 4
    If you want to update the line 5 u have to mention 4 th line

  • Change data in matrix of order document

    hi
    i developing the add-on for sap 9.0 (c#). And i have a problem.
    i need to write in the matrix of order document the warehouse/project/Profit Center code for each item that user add.
    maybe someone can give me a example code.
    thanks.

    hi..
    yes u can update after adding the
       Try
                If (pVal.FormMode = "3" And pVal.ItemUID = "1" And pVal.BeforeAction = False And pVal.FormTypeEx = "139" And pVal.ActionSuccess = True And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
                    oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
    ------ here u have to add the  code what u want to do...ok
       Catch ex As Exception
                SBO_Application.MessageBox(ex.Message)
            End Try
    The above code will be fire after adding the sales order success fully..
    ================================================
    This is the sample  program i have done after adding successfully...
    Try
                If (pVal.FormMode = "3" And pVal.ItemUID = "1" And pVal.BeforeAction = False And pVal.FormTypeEx = "139" And pVal.ActionSuccess = True And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
                    oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                    Dim SDocNo As Integer = oForm.Items.Item("8").Specific.value
                    Dim ORec11 As SAPbobsCOM.Recordset
                    ORec11 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    Rsql = "select max(DocEntry) as DocEntry from ordr"
                    ORec11.DoQuery(Rsql)
                    Dim RDocNo As Integer = ORec11.Fields.Item("DocEntry").Value
                    Dim sitem As String
                    Dim orec As SAPbobsCOM.Recordset
                    orec = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    Dim sql As String
                    sql = "select * from RDR1"
                    orec.DoQuery(sql)
                    Dim i12 As Integer = orec.RecordCount
                    ' SBO_Application.SetStatusBarMessage("Document Added  Successfully")
                    Dim RetVal As Long
                    Dim ErrCode As Long
                    Dim ErrMsg As String
                    'Create the Documents object
                    Dim OSorder As SAPbobsCOM.Documents
                    OSorder = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                    If OSorder.GetByKey(RDocNo) Then
                        Dim ORec1 As SAPbobsCOM.Recordset
                        ORec1 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        Rsql = "select COUNT(*) as total from RDR1  where rdr1.DocEntry =" & RDocNo & ""
                        ORec1.DoQuery(Rsql)
                        Dim Total_Lines As Integer = ORec1.Fields.Item("total").Value - 1
                        For i As Integer = 0 To Total_Lines
                            Dim ORec2 As SAPbobsCOM.Recordset
                            ORec2 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                            Rsql = "select  rdr1.ItemCode   from RDR1  where  rdr1.DocEntry =" & RDocNo & " and rdr1.LineNum=" & i & ""
                            ORec2.DoQuery(Rsql)
                            Dim Line_Item As String
                            Line_Item = ORec2.Fields.Item(0).Value
                            Dim oRec3 As SAPbobsCOM.Recordset
                            oRec3 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                            Rsql = "select oitm.TreeType  from OITM where  oitm.ItemCode ='" & Line_Item & "'"
                            oRec3.DoQuery(Rsql)
                            Dim Typ As String = oRec3.Fields.Item(0).Value
                            OSorder.Lines.SetCurrentLine(i)
                            If (Typ = "P" Or Typ = "A" Or Typ = "T" Or Typ = "S") Then
                                OSorder.Lines.UserFields.Fields.Item("U_BomSno").Value = "P" & p1
                                p1 = p1 + 1
                                c1 = 1
                            Else
                                OSorder.Lines.UserFields.Fields.Item("U_BomSno").Value = "C" & c1
                                c1 = c1 + 1
                            End If
                        Next
                        'Add the Invoice
                        RetVal = OSorder.Update
                        'Check the result
                        If RetVal <> 0 Then
                            ocompany.GetLastError(ErrCode, ErrMsg)
                            SBO_Application.MessageBox(ErrCode & " " & ErrMsg)
                        Else
                            SBO_Application.StatusBar.SetText("Document Updated Successfully....", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
                        End If
                    End If
                End If
            Catch ex As Exception
                SBO_Application.MessageBox(ex.Message)
            End Try
        End Sub
    =====
    here what it is having is..
    after adding successully the above code will be fire... ok..
    immediatly u have to catch the  max sales order docentry
    in it u have to check it..how many row items(rdr1)  are thee..
    u use for loop
    and update it..
    and also change the fields
    like  as per the ur requirement... ok..
           OSorder.Lines.ProjectCode
                            OSorder.Lines.DiscountPercent
                            OSorder.Lines.WarehouseCode

Maybe you are looking for

  • Text Input Dialog

    Hello experts, How to configure the Web Item: "Text Input Dialog" to show label in different languages (Language-Dependent Text) according to languages configured in user web browser? Thanks and Regards, Pablo Moraes

  • AVCHD wont Log and Transfer

    Hello all. So I got this footage that's in the AVCHD format. I have FCS 2, with the latest update. But when I try to use the Log and Tranfer function to open the folder with the clips, I get the error "AVCHD Media is unsupported on PowerPC based hard

  • Please advice in character set

    Good day for you i have 2 database's (db1,db2) they almost mirror , i have value in one table have character ö , when i select this column from toad there's no problem but when i select this column from any application or from sqlplus i read this let

  • Execute .hta document from ABAP

    Hi, I want to execute a .hta document using ABAP. What way do I have to go? .hta is an HTML Application (HTML and Java Script). In our case a form that has to be started by clicking on a file name. In what direction do I have to look for a solution.

  • HCM Processes & Forms - Message Type is unknown

    Hi, I have created an HCM process using HCM P&F framework. I can test the process from the ""Test Process" application on the ECC and it works fine. When I launch the process from the portal, I can see the adobe form correctly, the "Check and Send" a