6 Replies Latest reply: May 18, 2012 11:27 AM by Pedro Magueija RSS

New fields on P.O

Sunny Brar
Currently Being Moderated

Hi

 

Label & Textbox is being displayed on A/R Invoice but it's not displaying On Purchase Order

 

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Try
            If pVal.FormType = 133 And pVal.BeforeAction = False Then

                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
                    Dim oForm As SAPbouiCOM.Form
                    oForm = Me.SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
                    Dim oItems As SAPbouiCOM.Items = SBO_Application.Forms.Item(FormUID).Items
                    Dim oItem, oNewItem As SAPbouiCOM.Item
                    Dim oStaticText As SAPbouiCOM.StaticText

                    oItem = oForm.Items.Item("34")
                    oNewItem = oForm.Items.Add("lblAmtWord", SAPbouiCOM.BoFormItemTypes.it_STATIC)

                    oNewItem.Top = oItem.Top
                    oNewItem.Left = oItem.Left + oItem.Width + 10
                    oNewItem.Width = oItem.Width + 40
                    oNewItem.Height = oItem.Height
                    oStaticText = oItem.Specific
                    oStaticText.Caption = "Amount in words"
                    'oItems.Item("40").Enabled = False 'disable the drop-down ComboBox for BP types…


                    oItem = oForm.Items.Item("lblAmtWord")
                    oNewItem = oForm.Items.Add("TxtAmtWord", SAPbouiCOM.BoFormItemTypes.it_EDIT)
                    oNewItem.Top = oItem.Top
                    oNewItem.Height = 14
                    oNewItem.Width = oItem.Width + 250
                    oNewItem.Left = oItem.Left + 20
                End If
            End If
            If pVal.FormType = 142 And pVal.BeforeAction = False Then
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
                    Dim oForm As SAPbouiCOM.Form
                    oForm = Me.SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
                    Dim oItems As SAPbouiCOM.Items = SBO_Application.Forms.Item(FormUID).Items
                    Dim oItem As SAPbouiCOM.Item
                    Dim oStaticText As SAPbouiCOM.StaticText

                    oForm.DataSources.DBDataSources.Add("OPOR")

                    oItem = oForm.Items.Add("lblBillNo", SAPbouiCOM.BoFormItemTypes.it_STATIC)
                    oItem.Height = oForm.Items.Item("86").Height
                    oItem.Top = oForm.Items.Item("86").Top + 15
                    oItem.Left = oForm.Items.Item("86").Left
                    oItem.Width = oForm.Items.Item("86").Width
                    oItem.Visible = True
                    oStaticText = ((oItem.Specific))
                    oStaticText.Caption = "Bill Number "

                    oItem = oForm.Items.Add("txtBillNo", SAPbouiCOM.BoFormItemTypes.it_EDIT)
                    oItem.Height = oForm.Items.Item("46").Height
                    oItem.Top = oForm.Items.Item("46").Top + 15
                    oItem.Left = oForm.Items.Item("46").Left
                    oItem.Width = oForm.Items.Item("46").Width
                    oItem.Visible = True
                    oItem.Enabled = False
                    oEdittext = ((oItem.Specific))
                    oEdittext.DataBind.SetBound(True, "OPOR", "U_BILL_NO")

                    oItem = oForm.Items.Add("lblBillDt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
                    oItem.Height = oForm.Items.Item("lblBillNo").Height
                    oItem.Top = oForm.Items.Item("lblBillNo").Top + 15
                    oItem.Left = oForm.Items.Item("lblBillNo").Left
                    oItem.Width = oForm.Items.Item("lblBillNo").Width
                    oItem.Visible = True
                    oStaticText = ((oItem.Specific))
                    oStaticText.Caption = "Bill Date "

                    oItem = oForm.Items.Add("txtBillDt", SAPbouiCOM.BoFormItemTypes.it_EDIT)
                    oItem.Height = oForm.Items.Item("txtBillNo").Height
                    oItem.Top = oForm.Items.Item("txtBillNo").Top + 15
                    oItem.Left = oForm.Items.Item("txtBillNo").Left
                    oItem.Width = oForm.Items.Item("txtBillNo").Width
                    oItem.Visible = True
                    oItem.Enabled = False
                    oEdittext = ((oItem.Specific))
                    oEdittext.DataBind.SetBound(True, "OPOR", "U_BILLDATE")

                End If
            End If

        Catch oEx As Exception
            MessageBox.Show(oEx.Message)
        End Try
    End Sub

 

Thanks

  • Re: New fields on P.O
    Pedro Magueija
    Currently Being Moderated

    Hi Sunny,

     

    Have you registered the event in the event filters for that form (142)?

     

    Good luck.

     

    Best regards,

     

    Pedro Magueija

    • Re: New fields on P.O
      Sunny Brar
      Currently Being Moderated

      Hi Pedro

       

          What do u mean by this since i am new to development . I am using Visual Studio & VB.Net . Secondly i have not yet created any Add-On.

       

      Thanks

      • Re: New fields on P.O
        Pedro Magueija
        Currently Being Moderated

        Hi Sunny,

         

        For an event to be captured you need to register that event in the eventfilters of your addon, like so:

         

        Private Sub SetFilters()
                '// Create a new EventFilters object
                oFilters = New SAPbouiCOM.EventFilters()
                '// add an event type to the container
                '// this method returns an EventFilter object
                oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_CLICK)
                '// assign the form type on which the event would be processed
                oFilter.AddEx("139") 'Orders Form
                oFilter.AddEx("142") 'Purchase Form
                oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_KEY_DOWN)
                oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_LOAD)
                '// assign the form type on which the event would be processed
                oFilter.Add(139) 'Orders Form
                oFilter.Add(142) 'Purchase Form
                '// For a list of all form types see the help or use the
                '// Tools -> User Tools -> Display Debug Information option
                '// in the SBO application
                '// then open the desired form and hover over it with the mouse
                '// the form's type will apear in the lower left side of the screen
                '// Setting the application with the EventFilters object
                '// in this case we will process a click event for form types 142 and 139
                '// and we will process a key down event for for form type 13
                SBO_Application.SetFilter(oFilters)
            End Sub

         

        The above example was taken form the samples in the SDK.

        You should run this method when starting your addon to register those events.

         

        Hope it helps,

         

        Best regards,

         

        Pedro Magueija

  • New fields on P.O
    Bryan Gomez
    Currently Being Moderated

    Hi,

     

    Because you didn't include the Sales order form in this condition.

     

      If pVal.FormType = 133 And pVal.BeforeAction = False Then

     

    Try this.

      If pVal.FormType = 133 OR pVal.FormType = 139 And pVal.BeforeAction = False Then

     

    Regards,

Actions