cancel
Showing results for 
Search instead for 
Did you mean: 

write a query

Former Member
0 Kudos

Hi

in an application i have to use tab functionality to select a query.

that query should retrieve the GRPO number which are opened and whose vendor code is equal to value in the text box of my form..

how to pass the value in text box to the query

is there any posibility

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

You need to add to your CFL (tab functionality) the Condition object.

Search Condition Object for details in UI API Objects Reference of SDK Help.

Some examples

-


To get value of ItemCode in your edit text box:


sValue = oForm.Items.Item("eITEMCODE").Specific.Value

This is only an example how it can be used on an form based on matrix.


Private Sub Form_Matrix_SetConditions(ByRef oForm As SAPbouiCOM.Form)
  Dim oMatrix As SAPbouiCOM.Matrix
  Dim oConditions As SAPbouiCOM.Conditions
  Dim oCondition As SAPbouiCOM.Condition
  Try
    oMatrix = oForm.Items.Item("mtx00").Specific
    If oMatrix Is Nothing Then Throw New Exception("ERROR: matrix object is nothing.")

    oConditions = SBO_Application.CreateObject(BoCreatableObjectType.cot_Conditions)

    ' ++++++++++++++++++++++++++++++++++++++++++++
    ' From/To ItemCode 
    ' ++++++++++++++++++++++++++++++++++++++++++++
    If Not glo_sArti1.Equals("") And Not glo_sArti2.Equals("") Then
	'// AND (P.U_CodArti BETWEEN '" & s1.Trim & "' AND '" & s2.Trim & "')"
	oCondition = oConditions.Add
	oCondition.BracketOpenNum = 1
	oCondition.Alias = "U_CodArti"
	oCondition.Operation = co_BETWEEN
	oCondition.CondVal = glo_sArti1
	oCondition.CondEndVal = glo_sArti2
	oCondition.BracketCloseNum = 1
    Else
	If Not glo_sArti1.Equals("") Then
	    '// AND P.U_CodArti = '" & s1.Trim & "'"
	    oCondition = oConditions.Add
	    oCondition.Alias = "U_CodArti"
	    oCondition.Operation = co_EQUAL
	    oCondition.CondVal = glo_sArti1.Trim
	End If
	If Not glo_sArti2.Equals("") Then
	    '// AND P.U_CodArti = '" & s1.Trim & "'"
	    oCondition = oConditions.Add
	    oCondition.Alias = "U_CodArti"
	    oCondition.Operation = co_EQUAL
	    oCondition.CondVal = glo_sArti2.Trim
	End If
    End If

    ' ... other conditions ...

    '// Execute the query with the conditions collection
    oForm.DataSources.DBDataSources.Item("@MY_TABLE").Query(oConditions)
    oMatrix.LoadFromDataSource()
    oMatrix.SelectionMode = BoMatrixSelect.ms_Single
  Catch ex As Exception
    Dim s As String = ex.Message
  Finally
    System.GC.Collect()
  End Try

End Sub

Regards

Sierdna S.

Former Member
0 Kudos

Hi Mahendra

How r u doing this by Choose form the list method or formatted search

What is GRPO ?

Regards,

Pavana Punja