Skip to Content
author's profile photo Former Member
Former Member

recordset problem

hi please guide me how to retrieve sum of field value in recordset

my requirement when i choose item in row level the another one field shows open qty retrieve based on vendor and item

If (pVal.FormUID = "Requisition") And pVal.ItemUID = "REQ_Mat" And (pVal.ColUID = "Col_Item") And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.Before_Action = False Then

                    Dim str1, str4 As String
                    Dim oForm As SAPbouiCOM.Form
                    Dim oEdit As SAPbouiCOM.EditText
                    oForm = gonAppApplication.Forms.Item("Requisition")
                    oEdit = oForm.Items.Item("txtsupID").Specific
                    str1 = oEdit.Value
                    Dim iCnt As Integer
                    For iCnt = 1 To gonMatConvMatrix.RowCount - 1
                        gonMatConvMatrix = oForm.Items.Item("REQ_Mat").Specific
                        str4 = gonMatConvMatrix.Columns.Item("Col_Item").Cells.Item(iCnt).Specific.value
                        Dim oRS As SAPbobsCOM.Recordset = gonComCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        If str4 <> "" Then
                            Dim sSql As String = ""
                            sSql = "SELECT T0.[CardCode], T1.[ItemCode],sum(T1.[OpenQty]) FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[CardCode] ='" & str1 & " ' and T1.[Itemcode] ='" & str4 & " 'GROUP BY T1.[ItemCode],T0.[CardCode]"
                            For i As Integer = 1 To oRS.RecordCount
                                If oRS.EoF <= 0 Then
                                    gonMatConvMatrix.Columns.Item("Col_PQty").Cells.Item(i).Specific.Value = oRS.Fields.Item("CardCode").Value
                                End If
                        End If
                Catch ex As Exception

                End Try

            End If

Thanks & Regards

B.Lakshmi Narayanan

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2010 at 01:03 PM

    Modify the line

    gonMatConvMatrix.Columns.Item("Col_PQty").Cells.Item(i).Specific.Value = oRS.Fields.Item("CardCode").Value

    and change it to

    gonMatConvMatrix.Columns.Item("Col_PQty").Cells.Item(i).Specific.Value = oRS.Fields.Item(2).Value

    Hope this helps


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.