Query cfl

hi
how to make query cfl... i created combo box in system form..its have two type...job order, subcontracting... when i choose job order . its open production order list....when i choose subcontracting its open Purchase order list...
Thanks & regards
Balan
Edited by: narain.balan on Oct 11, 2010 12:37 PM
Edited by: narain.balan on Oct 11, 2010 12:42 PM

Hello,
See the example (from the SDK help).
SDK example:
Private Sub AddChooseFromList()
    Try
        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
        Dim oCons As SAPbouiCOM.Conditions
        Dim oCon As SAPbouiCOM.Condition
        oCFLs = oForm.ChooseFromLists
        Dim oCFL As SAPbouiCOM.ChooseFromList
        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
        oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
        ' Adding 2 CFL, one for the button and one for the edit text.
        oCFLCreationParams.MultiSelection = False
        oCFLCreationParams.ObjectType = "2"
        oCFLCreationParams.UniqueID = "CFL1"
        oCFL = oCFLs.Add(oCFLCreationParams)
        ' Adding Conditions to CFL1
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        oCon.Alias = "CardType"
        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
        oCon.CondVal = "C"
        oCFL.SetConditions(oCons)
        oCFLCreationParams.UniqueID = "CFL2"
        oCFL = oCFLs.Add(oCFLCreationParams)
    Catch
        MsgBox(Err.Description)
    End Try
End Sub
If this doesn't work for you, please post your own code.
HTH Regards Teun

Similar Messages

  • Query cfl problem in matrix

    hi all good morning.... i have one problem i assigned query cfl for matrix field. the value fetch based on header level.... the query fetch the data but its not show the CFL window..here i pasted my code
    Case "matvariant"
                            Select Case pVal.ColUID
                                Case "Col_Colour"
                                    Select Case pVal.EventType
                                        Case SAPbouiCOM.BoEventTypes.et_GOT_FOCUS
                                            Dim oForm As SAPbouiCOM.Form = gonAppApplication.Forms.Item("VARAINT")
                                            Dim sQuery As String = "SELECT  T1.[U_U_COLOR] FROM [dbo].[@ITEMCOLOR_DETAIL]  T0 inner join [dbo].[@ITEMCOLOR_HEADER]  T1 on t0.docentry=t1.docentry WHERE T0.[U_Itmcode] !='' and T0.[U_Avail] ='y' and T0.[U_Itmcode] = '" & oForm.Items.Item("txticode").Specific.Value & "'"
                                           oGeneral.SetConditionToCFL1(oForm, "COLITEMCFL1", "U_ID", sQuery)
                                                                               Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
                                            Dim bonCflEvents As SAPbouiCOM.ChooseFromListEvent
                                            Dim bonDTTable As SAPbouiCOM.DataTable
                                            Dim bonCflList As SAPbouiCOM.ChooseFromList
                                            Dim bnnstrUID As String
                                            bonCflEvents = pVal
                                            bnnstrUID = bonCflEvents.ChooseFromListUID
                                            bonDTTable = bonCflEvents.SelectedObjects
                                            bonCflList = lonConvForm.ChooseFromLists.Item(bnnstrUID)
                                            If Not (bonDTTable Is Nothing) Then
                                                If bonCflList.UniqueID = "COLITEMCFL1" Then
                                                    gonMatConvMatrix.GetLineData(pVal.Row)
                                                    gonMatConvMatrix.GetLineData(pVal.Row)
                                                    lonDetailDatasource.SetValue("U_Col_COLOR", lonDetailDatasource.Offset, bonDTTable.GetValue("U_COLOR_NAME", 0))
                                                    gonMatConvMatrix.SetLineData(pVal.Row)
                                                    If pVal.Row = gonMatConvMatrix.VisualRowCount Then
                                                        lonDetailDatasource.SetValue("U_Col_COLOR", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_LENGTH", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_WIDTH", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_THICK", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_SIZE", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_Desc", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("U_Col_Price", lonDetailDatasource.Offset, "")
                                                        lonDetailDatasource.SetValue("LineId", lonDetailDatasource.Offset, pVal.Row + 1)
                                                        gonMatConvMatrix.AddRow()
                                                        gonMatConvMatrix.SetLineData(pVal.Row + 1)
                                                        gonMatConvMatrix.FlushToDataSource()
                                                    End If
                                                Else
                                                End If
                                            End If
                                    End Select
                            End Select
    Edited by: narain.balan on Oct 26, 2010 7:02 AM

    Hi
    Please post the function code  oGeneral.SetConditionToCFL1(oForm, "COLITEMCFL1", "U_ID", sQuery)
    I think the problem is with choose from list condition.
    Regards
    Arun

  • Re:Query CFL

    Hi All,
    How to set multiple conditions in a query CFL.
    This is my Code :
    oRs.DoQuery("Select * from [@PSSIT_CMSAMHDR] where U_CardCode = '" & oVenCodeTxt.Value & "'")
                oCFL = oForm.ChooseFromLists.Item("SRLst")
                oCFL.SetConditions(emptyCon)
                oCons = oCFL.GetConditions()
                For IntICount = 0 To oRs.RecordCount - 1
                    If IntICount = (oRs.RecordCount - 1) Then
                        oCon = oCons.Add()
                        oCon.Alias = "U_CardCode"
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                        oCon.CondVal = oVenCodeTxt.Value
                    Else
                        oCon = oCons.Add()
                        oCon.Alias = "U_CardCode"
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                        oCon.CondVal = oVenCodeTxt.Value
                        oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR
                    End If
                    oRs.MoveNext()
                Next
                oCFL.SetConditions(oCons)
    I want to set another condition for status which should be 'open'. how should i achieve this.
    Regards
    Mohana

    Hi Mohana,
    if you want to Add condition on both if and else part means try this following code after  oCon.CondVal on both if and else statements,
    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
                                        oCon = oCons.Add()
                                        oCon.Alias = "U_status"
                                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                                        oCon.CondVal = "Open"
    Regards,
    Ganesh k

  • How to popup form according to query by  CFL for user defined tables?

    Hi Experts!
    Please write a simple code for adding CFL in UDO and popup the window according to query. suppose i want to execute query
    "select code,name from [@WITM]". I want to add CFL in edittext which is on UDO. how can we add CFL in that Edittext by code.
    Thanking You
    vishwajit kumar

    Hi Vishwajit,
    Please response to your previous posting or close it first. Whatever the answer working or not, you need reply.
    Thanks,
    Gordon

  • How to set conditions as a query in cfl?

    i have a combo box and a matrix. i have a cfl in the matrix column, once i select the particular value in the combobox the corresponding values must appear in the cfl. how can this be done?

    Hi Metilda,
    You can try this, i'use this code to set conditions in a CFL for item list. I put this code in the et_CHOOSE_FROM_LIST event in beforeaction=True :
                                            SAPbouiCOM.EditText oEdit;
                                            oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("7").Specific;
                                            string typeMag = oEdit.Value.ToString().Trim();
                                            oCons = oCFL.GetConditions();
                                            if (oCons.Count == 0)
                                                if (typeMag.Substring(0, 1) == "C")
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "SellItem";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "Y";
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 1;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = typeMag;
                                                    oCon.BracketCloseNum = 2;
                                                    oCFL.SetConditions(oCons);
                                                else
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "SellItem";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "Y";
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_IS_NULL;
                                                    //oCon.CondVal = null;
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 1;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "";
                                                    oCon.BracketCloseNum = 3;
                                                    oCFL.SetConditions(oCons);
                                            else
                                                oCons = null;
                                                oCFL.SetConditions(oCons);
                                                oCons = oCFL.GetConditions();
                                                if (typeMag.Substring(0, 1) == "C")
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "SellItem";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "Y";
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 1;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = typeMag;
                                                    oCon.BracketCloseNum = 2;
                                                    oCFL.SetConditions(oCons);
                                                else
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "SellItem";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "Y";
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 2;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_IS_NULL;
                                                    //oCon.CondVal = null;
                                                    oCon.BracketCloseNum = 1;
                                                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
                                                    oCon = oCons.Add();
                                                    oCon.BracketOpenNum = 1;
                                                    oCon.Alias = "U_IFC_CAT";
                                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                                    oCon.CondVal = "";
                                                    oCon.BracketCloseNum = 3;
                                                    oCFL.SetConditions(oCons);
    It's work fine for me.

  • Problem with configuration in my CFL

    Hi,
    I have a problem in my CFL that link with ObjectType = "2", and I want to add one more column in my CFL, I obtained this but in no-one row of this Column they exist data. What it can be happening?      
    I verified in my database if they exist data of this column and they are there.
    How I decide this?
    I do not obtain to make to appear them.

    Hi Frederico,
    Have you tried typing the query in query manager and are you sure you've selected the correct column? You can check the column name if you switch system information on and verifying the values in the database for that column.
    Hope it helps,
    Adele

  • Need to show all BP in Crystal report CFL

    Dear All,
    I add a parameter of customer. However, only the BP that has transactions in SAP can be displayed in CFL. If I open BP screen, the cardcode field is not gray out, I cannot see it in CFL. How can I have the CFL show me the whole list? Thanks in advance.
    Regards,
    Yuka

    Hi Yuka,
    1. Created new report and paste below query in command whatever you paste above same without where condition.
    SELECT T1.CardCode, T1.CardName, T0.ClgCode, T0.Recontact, T2.Name, T0.Tel, T2.E_MailL, T0.Details, T0.Notes, Case T0.Closed When 'Y' Then 'Closed' Else '' End 'Status' FROM OCLG T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN OCPR T2 ON T0.CntctCode = T2.CntctCode
    2. GoTo "Field Explorer" in Crystal Report and create one parameter as following
    Customer @Select * From OCRD Where CardType='C'
    and properties for parameter as follows
    Type=String
    List of values = Static
    Value Field = None
    If you want From to give From to To customer then in Value Options set True for "Allow Multiple Values" Rest keep as it is.
    3. Goto Report Menu->Selection Formulas->Record then you can find in "Field Tree" your command name and all the fields once you double clicked on "cardcode" field it will come downside in details window after that just you have to paste below string next to your cardcode field and save it.
    ={?Customer From @Select * From OCRD Where CardType='C'}
    And one more thing there is no need to set order by for CFL.
    Regards,
    Sachin

  • Date Range in Query

    Hi All,
    We have created a query report which we have created as a stored procedure and we are executing the sp in SBO to get the result. However, there is one issue, we have passed the variables in the sp as well as the fms to get the date range, but if we input the date manually, the result shown is incorrect!!
    It works fine when we tab on the from date, scroll down and select the date from the cfl!! This is not acceptable to the client. They want to enter the dates manually and not select from the cfl.
    Please advise what is wrong here and how to correct this issue?? Is there any limitation of this sort..
    Thanks,
    Joseph

    Hi Joseph,
    Instead of getting the date as string, try by changing the below declaration part
    Declare @datefrom VARCHAR(20)
    DECLARE @dateto VARCHAR(20)
    by this
    Declare @datefrom datetime
    DECLARE @dateto datetime
    I think, then you need to chenge the same in the SP too
    Regards,
    Bala

  • CFL Error

    Hai To All,
             Iam customizing SAP Screen say for example "Issue for Production" Iam filtering Account Code CFL be executing some query.......While running my code i had some error
    XML 'Conditions' parsing failed 66000-116.Invalid alias 'AcctCode' for table 'OITM'
    Here is my code
    Sub LoadGLCFL(ByVal FormUID As String, ByVal CFL_ID As String)
            Dim oCFL1 As SAPbouiCOM.ChooseFromList
            Dim oCons As SAPbouiCOM.Conditions
            Dim oCon As SAPbouiCOM.Condition
            Dim emptyCon As New SAPbouiCOM.Conditions
            IOP_Form = app.Forms.Item(FormUID)
            oCFL1 = app.Forms.Item(FormUID).ChooseFromLists.Item(CFL_ID)
            oCFL1.SetConditions(emptyCon)
            oCons = oCFL1.GetConditions()
            oCon = oCons.Add()
            Dim rec As SAPbobsCOM.Recordset = cmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            rec.DoQuery("select AcctCode,AcctName from OACT where AcctCode not in(select U_glacc from [@GLACC_HEAD] where U_hide='y')")
            oCFL1.SetConditions(emptyCon)
            oCons = oCFL1.GetConditions()
            For i As Integer = 1 To rec.RecordCount
                If i = (rec.RecordCount) Then
                    oCon = oCons.Add()
                    oCon.Alias = "AcctCode"
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                    oCon.CondVal = CStr(rec.Fields.Item(0).Value)
                Else
                    oCon = oCons.Add()
                    oCon.Alias = "AcctCode"
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                    oCon.CondVal = CStr(rec.Fields.Item(0).Value)
                    oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR
                End If
                rec.MoveNext()
            Next
            oCFL1.SetConditions(oCons)
            IOP_Form.Update()
            IOP_Form.Refresh()
        End Sub
    Can anyone help me..........Its so urgent....
    Regards,
    Anitha

    Hi ani
    I think you are using Items List CFL and applying conditions of AcctCode of OACT on OITM table but the AcctCode column does not exist for OITM thats why it is giving the error
    You have to change CFL object to G/L accounts object code
    Regards,
    Atul.

  • SBO Tables CFL

    Any one know how to trigger SBO TABLE NAME Choose From List similar to a CFL that pops in Query Manager.
    Currently I am using formatted search with table names from  sys.tables to fetch list of tables.  Is there anyway to get a CFL similar on that we get in Query Manager with Table Name and Table Description? Is it doable? Please share you experience.
    With Regards
    B Ravi Shankar

    Hello,
    This is not possible. What you can do: A formatted search and can be activated by Tab key (ET_KEY_DOWN event) with sbo_application.AtivateMenuItem('"ID").
    By this you can display the selection screen for system tables...
    Regards,
    János

  • How to fill matrix with the output of recordset query?

    Hi all,
    I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views. 
    writing following line to do this takes several minutes to load the data:
    For j = 0 To Reordset.RecordCount - 1
    Matrix.AddRow()
    Matrix.Columns.Item("col1").Cells.Item(i).Specific.value =  Recordset.Fields.Item("cardcode").Value
    Recordset.movenext()
    next
    Is there any other way to fill the matrix in this case, which loads the data faster?
    Regards,

    Hello Binita,
    I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
    The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
                oDt = oDts.Item("dt_test")
                query = "SELECT  * FROM [@T_CONVTOOLS01]"
                oDt.ExecuteQuery(query)
                oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
                oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
                oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
                oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
                oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
                AddChooseFromLists()
                oMtx.LoadFromDataSource()
    ...where AddChooseFromLists() is...
      Private Shared Sub AddChooseFromLists()
            Try
                Dim oCfls As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                Dim oCfl As SAPbouiCOM.ChooseFromList
                Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oBtn As SAPbouiCOM.Button
                Dim oMtx As SAPbouiCOM.Matrix
                Dim oCol As SAPbouiCOM.Column
                Dim oEtx As SAPbouiCOM.EditText
                oMtx = oForm.Items.Item("MTX_TEST02").Specific
                oCfls = oForm.ChooseFromLists
                oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCflCreationParams.MultiSelection = False
                oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
                oCflCreationParams.UniqueID = "CFL_C1"
                oCfl = oCfls.Add(oCflCreationParams)
                '### OPTION:
                '# Shown ChooseFromList restricted by Conditions
                oCons = oCfl.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCfl.SetConditions(oCons)
                oCol = oMtx.Columns.Item("1")
                oCol.ChooseFromListUID = "CFL_C1"
                oCol.ChooseFromListAlias = "CardCode"
            Catch e As Exception
                Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
            End Try
        End Sub
    But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                    Dim oMtx As SAPbouiCOM.Matrix
                    Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oDataTable As SAPbouiCOM.DataTable
                    Dim cflID As String
                    Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
                    oCFLEvent = pVal
                    cflID = oCFLEvent.ChooseFromListUID
                    'Dim oForm As SAPbouiCOM.Form
                    'oForm = SboConnection.SboUI.Forms.Item(FormUID)
                    oCFL = oForm.ChooseFromLists.Item(cflID)
                    If Not oCFLEvent.BeforeAction Then
                        oDataTable = oCFLEvent.SelectedObjects
                        If oDataTable Is Nothing Then Exit Sub
                        '############## Matrix Test #######################################################################
                        If (oCFLEvent.ItemUID = "MTX_TEST02") Then
                            oMtx = oForm.Items.Item("MTX_TEST02").Specific
                            '### CFL Results to UserForm
                            oDt.Rows.Offset = oCFLEvent.Row - 1
                            MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
                            MsgBox(oDataTable.GetValue("CardCode", 0))
                            ' PROBLEM - can't get this working - don't know at the moment:
                            ' on other forms SetValue works....
                            oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
                            ' this also gives me problems...:
                            'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
                            oForm.Update()
                        End If
                    End If
                End If
    The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
    Maybe you find the last piece. If so: please write here.
    Cheers,
    Roland
    p.s.:
    David Nussböck wrote
    LOL - ROLAND WAS FASTER ))
    ...just one minute...

  • Get DocNum from CFL (choose from list)

    Hi SAP gurus!
    Wish all of you a very Happy and Prosperous New Year 2012 !
    is it possible to get Document Number from List of Goods Receipt (CFL) ..?
    in Landed Cost Screen, when user clicks on 'Copy From' button, i am trying to execute query based on Document Number of List Of Goods Receipt CFL (Screen No. 10019). and then  assign value of  GrossAmnt to textfield  'ActualCost'
    but in Screen 10019, when i press 'Choose' button, value in  pval.formtype is 992!
    in Case statement of 10019, hence my query is not getting executed..
    Does any one have any idea how can i get Document Number from CFL.?
    below is my code.
    '// add an event type to the container
    '// this method returns an EventFilter object
        Set oFilter = oFilters.Add(et_ITEM_PRESSED)
    '// aggign the form type on which the event would be processed
        oFilter.Add 992      'Landed Cost Screen
        oFilter.Add 10019  'List of Goods Receipt Screen (CFL)
    in Case statement of pval.formtype
    If pVal.FormType <> 0 Then
    If pVal.Before_Action = False Then
    Select Case pVal.FormType
    case 992:
    case 10019:
    select case pval.eventtype
    case et_item_pressed
    Set o_TmpForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
    o_matrix = o_TmpForm.items.item("7").specific
    set actual_cost = o_matrix.column.item("DocNum").specific.value ' actual_cost.RowCount is 0, hence runtime error.
    'now passing query in below sub end sub subroutine(procedure)..
    get_actual_cost
    end select
    end Select
    end if
    end if
    i appreciate your help..
    Thanks and Regards,
    kaviprashu

    Hello,
    When you call ChooseFromList object, and select an item, you can get the datatable which contains the selected rows from the CFL object.
    Now it has several columns (basically all columns in the head table), you so it is now easy to select the correct column:
    val1 = oDataTable.GetValue("[COLUMN_NAME]", 0)
    Sample code:
    If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val1 As String
                    Dim val2 As String
                    Try
                        val1 = oDataTable.GetValue("DocNum", 0)
                        val2 = oDataTable.GetValue("DocEntry", 0)
                    Catch ex As Exception
                    End Try
    Now you can only focus on the landed costs screen, (992) and track event et_CHOOSE_FROM_LIST
    Now the complete code:
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oForm As SAPbouiCOM.Form
                oForm = SBO_Application.Forms.Item(FormUID)
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val1 As String
                    Dim val2 As String
                    Try
                        val1 = oDataTable.GetValue("DocNum", 0)
                        val2 = oDataTable.GetValue("DocEntry", 0)
                    Catch ex As Exception
                    End Try
                End If
            End If
    Regards
    János

  • On a UDF (on a system table) add a CFL (linked to a system table)

    Hello,
    I added a UDF to OITM, named say "XXX_RootOfPrj". It appears on the standard UDFs panel:
    Users should type a project code (OPRJ.PrjCode) here.
    For helping them I need to add a ChooseFromList on this UDF, linked to OPRJ.
    So I added this line in the UDF definition:
    oUserFieldsMD.LinkedTable = "OPRJ";
    But when I Add() the UDF I get:
    Errore -5002: Il campo 'Tabella collegata' dovrebbe essere formato da 8 car. alfanumerici senza val. standard validi
    Which means more or less:
    Error -5002: 'Linked table' field should be formed by 8 alphanumeric characters without standard valid values
    Maybe is it impossible what I want to do? It's odd that I can link a UDT but not a system table...
    Maybe should I use a workaround, like manually attaching a CFL on the form using UI API?

    Thanks Edy,
    now I got it!
    Create a query for the formatted search, like this:
    select PrjCode, PrjName
    from OPRJ
    Add this user query to B1 as a saved query
    Open Item Master Data, select your UDF, press Alt + Shift + F2
    In the dialog select "Search in Existing User-Defined Values according to Saved Query", click on "Open Saved Query", select the saved query above and you are done.
    Now the user can pick a valid project code from a CFL.
    Kind regards

  • How to make Parameter field not mandatory while running CFL through SAP B1

    Hi Experts.......
    I have a small doubt if anybody can help me.......
    I have created a simple report for testing purpose by taking table OITM and it is diplayng CFL symbol in B1 scressn when I import. Upto this it is working fine and showing correct input.
    Now I made some changes according to my logic is that When I select any value in condition parameter say any Item Group it shows me output for that particular ItemGroup. And when I select nothing in Parameter then it is displaying all data from all the group and this si what I want. But when I import the same CR in SAP and running same report it is not allwoing me to paas Null value so that I can get all the data as output.
    This is giving right result if I dirctly run CR by refreshinh Parameter but same thing I run from SAP and put the parameter field blank it is giving me error that Parameter (ItemGroup) is mandatory
    Can anybody assist me how to solve this?
    Thanks & Regards,
    Rahul Moundekar

    Hi
    I had the same issue.  As noted by Julie SAP published a workaround.
    See my original thread post below.  Go straight to the last entry.
    Crystal in B1 8.8 - optional parameters not working
    The problem is that when called from B1 the hasvalue command always returns true, hence the checking for nulls and spaces etc. as well.
    You keep the parameter definition as Optional.
    This works find for character fields, both single select and ranges, and I have gotten around it for numerics etc by using a SQL formula to cast these to character fields in the data being queried.
    I have yet to be motivated enough to see how to code around this for multi valued fields.
    Hope this helps.
    Rob

  • SAP B1 UDO: Bind CFL to the same form UDO

    Hi,
    I have created an UDO which is bound to a master data user defined table. Now, I have created a form for that master data, where in a matrix, I need to add some of the entries from the same master table, sort of like a tree structure. I have created a CFL which I have bounded to the object type of "MyUDO". The code on after choose from list is given below.
    try
                            Matrix oMatrix_upsell = (Matrix)form.Items.Item("mtx_upsell").Specific;
                            DBDataSource oDBDataSource = (DBDataSource)form.DataSources.DBDataSources.Item("@PRODUPSELLS");
                            DataTable oDataTable = null;
                            oDataTable = oCFLEvent.SelectedObjects;
                                if (form.Mode == BoFormMode.fm_ADD_MODE | form.Mode == BoFormMode.fm_OK_MODE | form.Mode == BoFormMode.fm_UPDATE_MODE)
                                    if (pVal.Row == oMatrix_upsell.RowCount)
                                        oDBDataSource.SetValue("LineId", oDBDataSource.Size - 1, null);
                                        oDBDataSource.SetValue("U_SKU", oDBDataSource.Size - 1, null);
                                        //oDBDataSource.SetValue("U_CatId", oDBDataSource.Size - 1, null);
                                        oDBDataSource.InsertRecord(oDBDataSource.Size - 1);
                                string Query = null;
                                Query = "select Name, U_Web_Id from [@WITM] where U_SKU =N'" + System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)) + "'";
    Recordset RSet = (Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                                RSet.DoQuery(Query);
                                oDBDataSource.SetValue("U_SKU", pVal.Row - 1, System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)));
                                oDBDataSource.SetValue("U_Name", pVal.Row - 1, RSet.Fields.Item("Name").Value.ToString().Trim());
                                oDBDataSource.SetValue("U_WebId", pVal.Row - 1, RSet.Fields.Item("U_Web_Id").Value.ToString().Trim());
                                oMatrix_upsell.LoadFromDataSource();
                                oDBDataSource = null;
                        catch (Exception ex)
                            B1Connections.theAppl.SetStatusBarMessage(ex.ToString(), BoMessageTime.bmt_Medium, true);
    The problem is that, when I select an item in the matrix, the data of the other fields in the form gets loaded for the selected object from the CFL. Is there a way to create a cfl and bind it to the same table on which the form is operating?

    Hi Philip,
    in SFP When you develop a form you have the interface mapped/assigned to it right.
    So here you have the source fields on the left hand side (the output parameters of your interface) and the form context on the right hand side.
    So lets say your interface gives you several data where employee list (EMP_LIST) is a internal table.
    so now if you drag and drop this EMP_LIST from left to right.
    when you do it again it will have the name EMP_LIST_1 and so on.
    Now if you go to layout tab you will see the form design area, here if you go to data view on the left hand side, you can see all the fields available for your form. since you have the EMP_LIST of 3 instances you will see all 3 of them.
    So now on the form as required have the 3 tables in different pages or so as you like, do the data binding to the 3 different data instances.
    since the actual actual source of the 3 lists is still the same the data presented in thhese tables is also same nothing different.
    you can have your script to individual tables for presentation nothing changes (all is well).
    Now when it comes to matter of support on your developments, when a new developer carries your work, he can see the context and understand that its the same. no need to investigate any scripts or such.
    Hope this makes you clear,
    Cheers,
    Sai

Maybe you are looking for

  • Problems with query on a non-database field

    Hi, Hopefully I am in the correct section... I have some problems. I wanna query a non-database field but it does not work for one of them. I have tried the following... declare vsNewDefaultWhere varchar2(4000); vbFirstWhere boolean; cursor curArea i

  • Zooming in on web pages

    When using the iPod touch on the web, how do u zoom in on the web page? How many times do u tap the screen?

  • User Query

    Hi All, I have a basic query returning header information from open purchase orders. The parameters used is for a user-defined field created on the header level. I have recently upgraded from 2005 to 2007 and since then, the query takes approximately

  • Is there a way to block the inappropriate content in the podcasts app?

    Hello, I am a husband, father and pastor and do a lot of podcast listening throughout the week, but was recently very disappointed to find some very adult content in the podcasts app under "top stations," with seemingly no way to block or monitor pod

  • How do I change the default zoom for New Tab only?

    The New Tab zoom in Firefox 33 is too high to see all 12 of my thumbnails. I changed it using ctrl- but the next time I opened a New Tab, the zoom was back at 100%. How do I change the default zoom for New Tab only?