Integrating Advanced Selection with Business Components
You use this procedure to integrate advanced selection in mobile applications using Mobile Application Studio (MAS).
You have created an advanced selection in Mobile System Maintenance.
For more information, see Advanced Selection Workflow.
You are familiar with the procedure to use advanced selection in mobile applications.
For more information, see Using Advanced Selection.
Identify the following:
The business component with which the advanced selection must be integrated
The tile set from which the relevant advanced selection must be called.
Usually, the advanced selection is called from the <business component>/Search
tile set, of the relevant business component. The Business Partner Search
tile of the Business Partners
component, for example.
The advanced selection that must be called from the <business component>/Search
tile set.
The Business Partners
component, for example, uses the Business Partner
advanced selection.
Add the selected advanced selection tile set to the chosen business component as a hidden tile set.
Define pushbuttons to call the required advanced selection (say, Advanced Selection
) and to view details of the search criteria while using the advanced selection (say, Info
).
Add the pushbuttons to the <business component> Search
tile.
For more information, see Defining a Button Control.
Note
Set the property of the Info
pushbutton to Hidden
.
Write code to load the advanced selection tile set when users choose the Advanced Selection
pushbutton.
Syntax
Dim AdvSelBo as ObjectDim ErrorMsg as StringOn error goto DoNothingset AdvSelBo = gServices.BOL.GetData("SFAGLOBAL").AdvancedSelectionInterface ("EXPT", "CAP", "", ErrorMsg)if ErrorMsg <> "" thenMcore.raiseMessage ErrorMsgexit subend ifDim hExperSelection As Core HyperlinkSourceSet hExpertSelection = gApplication.newHyperlink(Me, "hMSASYSExpertSelection", "hMSASYSExpertSelection", Nothing)hExpertSelection.setRawContent AdvSelBohExpertSelection.executeDoNothing:Write code to load the dialog box that must appear when users choose the Info
pushbutton; this dialog box contains the query that was executed.
For more information, see Using Advanced Selection.
Syntax
gServices.showMsgBox (gServices.BOL.GetData ("SFAGLOBAL"). AdvSelInfoText ("CAP"))Write code in the <business component> Search
tile as shown in the following example:
Syntax
//Before Query Execute EventctrlInfo.EditMode = cemHidden//Add Custom Event//Event Name – StartStandardSelection()//MethodsPublic Sub ShowInfoButtonctrlInfo.EditMode = cemNormalEnd SubDefine internal hyperlinks to ensure that the relevant tile set is loaded.
Define the <business component> Search
tile as the hyperlink source and <business component>/Advanced Selection
tile set as the hyperlink target.
The hyperlink source and target must be defined at the application level.
The advantage of defining the target at the application level is that the hyperlink that is established between the source and target can be reused across the application.
Define a hyperlink between the source and the target hyperlinks.
For more information about defining hyperlinks, see Model a Hyperlink.
The following hyperlinks are defined for advanced selection:
Internal Hyperlink Name |
Advanced Selection |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enter the name of the hyperlink in the User Data Dictionary (UDD) to ensure that the required advanced selection is loaded.
You add the name of the hyperlink in the OnLoad
event of the <business component>/Search
tile set.
To load the Business Partners Advanced Selection
, the following code is executed in the OnLoad
event of the MSAMSACAPbpsearch
tile set:
Syntax
gServices.bol.UserDataDictionary.PutData "EXPT", "SEACAP"SEACAP
identifies the Business Partners Advanced Selection
.
Define columns (attributes) to display the data based on the criteria that you have selected for the search.
You must add five unbound attributes to the <business component> List
tile, and set their properties as Hidden
.
Define the following variables:
NumberOfReturns
: Long, public
ResultRecordSet
: Object, public
To view the result set in the List tile of the <business component>/Search
tile set:
Define the <business component>/Advanced Selection
tile as the hyperlink source and <business component>/List
tile as the hyperlink target.
Define a hyperlink between the source and target hyperlinks.
The source and target hyperlinks must be defined at the application level.
For more information about hyperlink modeling, see Model a Hyperlink.
Include the query statement for the search function.
On the Search
pushbutton, you must execute the BeforeQuery
event. If the query returns values that are not part of the fixed values (columns) in the search execution, then certain code is executed as shown in the following samples.
In a case of advanced selection for business partners, the following code is required for the Business Partners
tile:
Note
The OnLoad
event contains the CheckAndShow
and ChangeAnchorManually
events, which are called at the tile set level. The CheckAndShow
event checks the additional fields that must be shown and displays them. The ChangeAnchorManually
event makes the Info
button visible.
The RowLoaded
event updates additional fields according to the record set that is retrieved when the SQL statement is executed.
Syntax
//OnLoadctrlctrlsgrid.setnumberoffrozencolumns(3)Dim temp As BooleanOn Error GoTo Not_ThereDim Fromwhere As StringDim UserDataDic As UserDataDictionarySet UserDataDic = gServices.BOL.UserDataDictionaryFromwhere = UserDataDic.GetData("EXPSELRESULTSETUSED")Select Case FromwhereCase "SEACAP"UserDataDic.PutData "EXPSELRESULTTILESETUSED", ""Set pResultRecordset = UserDataDic.GetData("EXPSELRESULTOBJECTCAPRS")pNumberOfReturns = 0temp = CheckAndShow ("ReturnValue1", CtrlReturn1) OrCheckAndShow ("ReturnValue2", CtrlReturn2) OrCheckAndShow ("ReturnValue3", CtrlReturn3) OrCheckAndShow ("ReturnValue4", CtrlReturn4) OrCheckAndShow ("ReturnValue5", CtrlReturn5)acaplist4DSO.SetRawContent UserDataDic. GetData("EXPSELRESULTOBJECTCAP")acaplist4DSO.SetRawContent UserDataDic. GetData("EXPSELRESULTOBJECTCAP")//RaiseEventChangeAnchorManually(UserDataDic.GetData("EXPSELRESULTOBJECTCAP"))Case Else" errorEnd SelectSet UserDataDic = NothingExit SubNot_There: acaplist4DSO.SetRawContent Nothing//Row Loaded Eventif pNumberOfReturns > 0 thencolumns.Item("ctrlReturn1") = pResultRecordSet.Fields("ReturnValue1").valueif pNumberOfReturns > 1 thencolumns.Item("ctrlReturn2") = pResultRecordSet.Fields("ReturnValue2").valueif pNumberOfReturns > 2 thencolumns.Item("ctrlReturn3") = pResultRecordSet.Fields("ReturnValue3").valueif pNumberOfReturns > 3 thencolumns.Item("ctrlReturn4") = pResultRecordSet.Fields("ReturnValue4").valueif pNumberOfReturns > 4 thencolumns.Item("ctrlReturn5") = pResultRecordSet.Fields("ReturnValue5").valueend ifend ifend ifend ifend ifPublic Function CheckAndShow (ResultString).valueColumnControl.EditMode = cemReadOnlyCheckAndShow = TruepNumberOfreturns = pNumberOfReturns + 1exit functionColNotFound:ColumnControl.EditMode = cemHiddenCheckAndShow = FALSEEnd FunctionCustom Properties
NumberOfReturns
: Long – Public
ResultRecordSet
: Object – Public
Custom Event
Event name: ChangeAnchorManually
Event signature: Public Event ChangeAnchorManually (BC as Object)
Add return1
–return5
as an unbound grid column
To display the Info
pushbutton, write code as follows:
Note
The ChangeAnchorManually
event makes the Info
button visible. Write this event in the OnLoad
event on the Business Partners /Search
tile set.
Event handler for the list tile event: ChangeAnchorManually()
Syntax
<QueryDetailTile>.ShowInfoButtonWrite code to restore the fixed columns in the search result when users choose the Search
pushbutton in the <business component>/Search
tile set.
Note
The SwitchToNormalSearchMode()
function restores the search result to the standard search columns. Write the call to this function at the tile set level.
Event handler for the list tile event: StartStandardSelection()
Syntax
<ListTile>.SwitchToNormalSearchMode//Write the SwitchToNormalSearchMode() function in the <business component>/List tile as follows:Public Sub SwitchToNormalSearchMode()ctrlReturn1.EditMode= cemHiddenctrlReturn2.EditMode= cemHiddenctrlReturn3.EditMode= cemHiddenctrlReturn4.EditMode= cemHiddenctrlReturn5.EditMode= cemHiddenEnd SubGenerate the changes that you have made in the business component.
For more information, see Specifying Common Generation Settings.
You have integrated advanced selection with a mobile application using MAS.