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

Activating userform via system form

hi friends

i created a form of my own with a combo box in a matrix. what i want to do is...

EMPLOYEE MASTER DATA-- >ADMINISTRATION ->STATUS --->FREEZE ,if i select "FREEZE" it should affect in my matrix combo as absent....

could you please give some guideliness

thanks and regards

manoj nagaraj

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2008 at 01:06 PM

    HI,

    So let's continue

    EMPLOYEE MASTER DATA-- >ADMINISTRATION ->STATUS --->FREEZE ,if i select "FREEZE" it should affect in my matrix combo as absent....

    If pVal.FormTypeEx = "60100" And pVal.EventType = BoEventTypes.et_COMBO_SELECT And pVal.ItemUID = "83" Then
                If pVal.Before_Action = True Or pVal.FormMode = BoFormMode.fm_FIND_MODE Then Exit Sub ' you will have the value afterevent
                Dim oCombo As SAPbouiCOM.ComboBox = sbo_application.Forms.ActiveForm.Items.Item("83").Specific
                If oCombo.Selected.Description = "Freeze" Then
                    'create the form
                    CreateForm_MatrixWithComboBox()
                    Dim oMtxForm As SAPbouiCOM.Form = sbo_application.Forms.ActiveForm
                    'or get your form even it is open
                    'Dim oMtxForm As SAPbouiCOM.Form = sbo_application.Forms.Item("YOURFORMID")
                    Dim oMatrix As SAPbouiCOM.Matrix = oMtxForm.Items.Item("MTX").Specific
                    oMatrix.GetLineData(1) 'first row'
                    oMtxForm.DataSources.UserDataSources.Item("DSCombo").Value = "2"
                    oMatrix.SetLineData(1) 'first row write value
                    oMatrix.GetLineData(2) 'first row'
                    oMtxForm.DataSources.UserDataSources.Item("DSCombo").Value = "1"
                    oMatrix.SetLineData(2) 'first row write value
                    ' here is the oCombo.Select is not working !!!! 
                End If
            End If
    

    I am created a simple matrix for here for testing and to understand how it is going.

    
        Sub CreateForm_MatrixWithComboBox()
    
            Dim oForm As SAPbouiCOM.Form = sbo_application.Forms.Add("TEST_MTX")
            oForm.Visible = True
    
            Dim oitem As SAPbouiCOM.Item = oForm.Items.Add("1", BoFormItemTypes.it_BUTTON)
            With oitem
                .Top = oForm.Height - 60
                .Left = 5
                .Width = 80
            End With
            oitem = oForm.Items.Add("2", BoFormItemTypes.it_BUTTON)
            With oitem
                .Top = oForm.Height - 60
                .Left = 5 + 80 + 1
                .Width = 80
            End With
    
            oitem = oForm.Items.Add("MTX", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
            With oitem
                .Top = 5
                .Left = 5
                .Width = oForm.Width - 15
                .Height = oForm.Height - 70
                .AffectsFormMode = False
            End With
            '
            Dim oMatrix As SAPbouiCOM.Matrix = oitem.Specific
            Dim oColumns As SAPbouiCOM.Columns = oMatrix.Columns
            oForm.DataSources.UserDataSources.Add("#", BoDataType.dt_SHORT_NUMBER)
            oForm.DataSources.UserDataSources.Add("DSCombo", BoDataType.dt_SHORT_NUMBER)
    
            Dim oColumn As SAPbouiCOM.Column = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            With oColumn
                .TitleObject.Caption = "#"
                .Description = .TitleObject.Caption
                .Width = 30
                .DataBind.SetBound(True, "", "#")
                .Editable = False
            End With
    
            oColumn = oColumns.Add("COL1", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
            With oColumn
                .Width = 80
                .TitleObject.Caption = "COMBOBOX"
                .Description = .TitleObject.Caption
                .Editable = False
                .DataBind.SetBound(True, "", "DSCombo")
                .DisplayDesc = True
                .Visible = True
            End With
            Dim vv As SAPbouiCOM.ValidValues = oColumn.ValidValues
            vv.Add("-1", "<>")
            vv.Add("1", "Descent")
            vv.Add("2", "Absent")
            oMatrix.Columns.Item("COL1").Editable = True
            oMatrix.Columns.Item("COL1").Visible = True
            For row As Integer = 1 To 3
                oMatrix.AddRow()
                oMatrix.GetLineData(row)
                oForm.DataSources.UserDataSources.Item("DSCombo").Value = "-1"
                oMatrix.SetLineData(row)
            Next
    
        End Sub
    

    In this case use can bring the combobox into a userdatasource, and you can use

    > oMatrix.GetLineData(2) 'first row'

    > oMtxForm.DataSources.UserDataSources.Item("DSCombo").Value = "1"

    > oMatrix.SetLineData(2) 'first row write value

    Regards,

    J.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2008 at 12:14 PM

    Hi Manoj

    At the combo select event load ur srf form

    using LoadfromXMl("Manoj.srf")

    then catch the form load event specify the matrix column and change using Ocombo.select("Absent", description)

    otherwise if your form is already open

    Catch the form with oform.forms.Activeform and then specify the matrix column and change it

    is this helpful to you

    Regards

    Cool Ice

    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.