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 Try 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]" oRS.DoQuery(sSql) 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 oForm.Freeze(False) End If Next End If Next Catch ex As Exception gonAppApplication.SetStatusBarMessage(ex.Message) End Try End If
Thanks & Regards
B.Lakshmi Narayanan
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
Krishnan
Add a comment