Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9091

Re: Can UI API be used to set fields on Contacts tab within BP Master Data

$
0
0

The problem with the UI API is that you have to get everything PERFECT. It's really like a macro language, essentially. So to be able to update a field, you have to get to that field. In most cases, this is fine, because all fields are available to you. But, in this case, you have to do some extra work. Since the field you want to alter is within a tab, and then from that tab within one specific option on the tab, you have to simulate programmatically all of the mouse clicks that a user would perform to GET to that point.

 

Here is an example procedure that I just successfully tested on my Development server on a customer that has no current contacts listed. I hard coded a lot of things that I would never hard code, just to get it to work for testing purposes.

 

Private Sub handleFindModeItemEvent(ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)

    If pVal.FormMode = SAPbouiCOM.BoFormMode.fm_FIND_MODE Then

            Select Case pVal.ItemUID

                            Case "5"

                                If pVal.ActionSuccess = True AndAlso pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK Then

                                    'Get the BP CardCode field and set it

                                    Dim oTxt As SAPbouiCOM.EditText

                                    oTxt = Me.m_oForm.Items.Item("5").Specific

                                    oTxt.Value = "x414406"

 

                                    'Run a search on this CardCode

                                    Dim oBtn As SAPbouiCOM.Button

                                    oBtn = Me.m_oForm.Items.Item("1").Specific

                                    oBtn.Item.Click()

 

 

                                    'Click the Tab - Which is really "called" a folder for some reason by SAP

                                    Dim oFldr As SAPbouiCOM.Folder

                                    oFldr = Me.m_oForm.Items.Item("13").Specific

                                    oFldr.Item.Click()

 

 

                                    'Get the matrix of the Contacts list

                                    Dim oMatrix As SAPbouiCOM.Matrix

                                    oMatrix = Me.m_oForm.Items.Item("112").Specific

 

 

                                    'Get the specific cell for the contact you want to update and click it

                                    oTxt = oMatrix.GetCellSpecific(0, 1)

                                    oTxt.Item.Click()

 

 

                                    'Get the Contact Specific matrix object, and then update the field you wish to update

                                    oMatrix = Me.m_oForm.Items.Item("107").Specific

                                    oTxt = oMatrix.GetCellSpecific(1, 1)

 

                                    'Finally, update the value

                                    oTxt.Value = "Test"

                                End If

            End Select

    End If

End Sub

 

 

I write in VB.NET, so you might need to use a converter to convert it to C#, unless you can just figure out what I'm doing here and redo it in that language.

 

Hope this helps!


Viewing all articles
Browse latest Browse all 9091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>