Show TOC

Procedure documentationIntegrating Advanced Selection with Business Components

 

You use this procedure to integrate advanced selection in mobile applications using Mobile Application Studio (MAS).

Prerequisites

  • 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.

Procedure

  1. 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.

  2. Add the selected advanced selection tile set to the chosen business component as a hidden tile set.

  3. 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).

    1. Add the pushbuttons to the <business component> Search tile.

      For more information, see Defining a Button Control.

      Note Note

      Set the property of the Info pushbutton to Hidden.

      End of the note.
    2. Write code to load the advanced selection tile set when users choose the Advanced Selection pushbutton.

      Syntax Syntax

      1. Dim AdvSelBo as Object
      2. Dim ErrorMsg as String
      3. On error goto DoNothing
      4. set AdvSelBo = gServices.BOL.GetData("SFAGLOBAL").AdvancedSelectionInterface ("EXPT", "CAP", "", ErrorMsg)
      5. if ErrorMsg <> "" then
      6. Mcore.raiseMessage ErrorMsg
      7. exit sub
      8. end if
      9. Dim hExperSelection As Core HyperlinkSource
      10. Set hExpertSelection = gApplication.newHyperlink(Me, "hMSASYSExpertSelection", "hMSASYSExpertSelection", Nothing)
      11. hExpertSelection.setRawContent AdvSelBo
      12. hExpertSelection.execute
      13. DoNothing:
      End of the code.
    3. 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 Syntax

      1. gServices.showMsgBox (gServices.BOL.GetData ("SFAGLOBAL"). AdvSelInfoText ("CAP"))
      End of the code.
    4. Write code in the <business component> Search tile as shown in the following example:

      Syntax Syntax

      1. //Before Query Execute Event
      2. ctrlInfo.EditMode = cemHidden
      3. //Add Custom Event
      4. //Event Name – StartStandardSelection()
      5. //Methods
      6. Public Sub ShowInfoButton
      7. ctrlInfo.EditMode = cemNormal
      8. End Sub
      End of the code.
  4. Define internal hyperlinks to ensure that the relevant tile set is loaded.

    1. 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.

    2. 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

      SEACAP

      Business Partner Search

      SEACON

      Contact Person Search

      SEAPAS

      Products Search

      CAMCON

      Campaigns, Contact Person Result

      CAMCOP

      Campaigns, Business Partner Result

      DOCCON

      Activity Journal, Contact Person Result

      DOCCAP

      Activity Journal, Business Partner Result

      ACTCAP

      Tour Planning Business Partner

      ACTCON

      Tour Planning Contact Persons

    3. 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 Syntax

      1. gServices.bol.UserDataDictionary.PutData "EXPT", "SEACAP"
      End of the code.

      SEACAP identifies the Business Partners Advanced Selection.

  5. Define columns (attributes) to display the data based on the criteria that you have selected for the search.

    1. You must add five unbound attributes to the <business component> List tile, and set their properties as Hidden.

    2. Define the following variables:

      • NumberOfReturns: Long, public

      • ResultRecordSet: Object, public

  6. To view the result set in the List tile of the <business component>/Search tile set:

    1. Define the <business component>/Advanced Selection tile as the hyperlink source and <business component>/List tile as the hyperlink target.

    2. 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.

    3. 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 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.

      End of the note.

      Syntax Syntax

      1. //OnLoad
      2. ctrlctrlsgrid.setnumberoffrozencolumns(3)
      3. Dim temp As Boolean
      4. On Error GoTo Not_There
      5. Dim Fromwhere As String
      6. Dim UserDataDic As UserDataDictionary
      7. Set UserDataDic = gServices.BOL.UserDataDictionary
      8. Fromwhere = UserDataDic.GetData("EXPSELRESULTSETUSED")
      9. Select Case Fromwhere
      10. Case "SEACAP"
      11. UserDataDic.PutData "EXPSELRESULTTILESETUSED", ""
      12. Set pResultRecordset = UserDataDic.GetData("EXPSELRESULTOBJECTCAPRS")
      13. pNumberOfReturns = 0
      14. temp = CheckAndShow ("ReturnValue1", CtrlReturn1) Or
      15. CheckAndShow ("ReturnValue2", CtrlReturn2) Or
      16. CheckAndShow ("ReturnValue3", CtrlReturn3) Or
      17. CheckAndShow ("ReturnValue4", CtrlReturn4) Or
      18. CheckAndShow ("ReturnValue5", CtrlReturn5)
      19. acaplist4DSO.SetRawContent UserDataDic. GetData("EXPSELRESULTOBJECTCAP")
      20. acaplist4DSO.SetRawContent UserDataDic. GetData("EXPSELRESULTOBJECTCAP")
      21. //RaiseEvent
      22. ChangeAnchorManually(UserDataDic.GetData("EXPSELRESULTOBJECTCAP"))
      23. Case Else
      24. " error
      25. End Select
      26. Set UserDataDic = Nothing
      27. Exit Sub
      28. Not_There: 
      29. acaplist4DSO.SetRawContent Nothing
      30. //Row Loaded Event
      31. if pNumberOfReturns > 0 then
      32. columns.Item("ctrlReturn1") = pResultRecordSet.Fields("ReturnValue1").value
      33. if pNumberOfReturns > 1 then
      34. columns.Item("ctrlReturn2") = pResultRecordSet.Fields("ReturnValue2").value
      35. if pNumberOfReturns > 2 then
      36. columns.Item("ctrlReturn3") = pResultRecordSet.Fields("ReturnValue3").value
      37. if pNumberOfReturns > 3 then
      38. columns.Item("ctrlReturn4") = pResultRecordSet.Fields("ReturnValue4").value
      39. if pNumberOfReturns > 4 then
      40. columns.Item("ctrlReturn5") = pResultRecordSet.Fields("ReturnValue5").value
      41. end if
      42. end if
      43. end if
      44. end if
      45. end if
      46. Public Function CheckAndShow (ResultString).value
      47. ColumnControl.EditMode = cemReadOnly
      48. CheckAndShow = True
      49. pNumberOfreturns = pNumberOfReturns + 1
      50. exit function
      51. ColNotFound:
      52. ColumnControl.EditMode = cemHidden
      53. CheckAndShow = FALSE
      54. End Function
      End of the code.

      Custom Properties

      • NumberOfReturns: Long – Public

      • ResultRecordSet: Object – Public

      Custom Event

      • Event name: ChangeAnchorManually

      • Event signature: Public Event ChangeAnchorManually (BC as Object)

      Add return1return5 as an unbound grid column

    4. To display the Info pushbutton, write code as follows:

      Note Note

      The ChangeAnchorManually event makes the Info button visible. Write this event in the OnLoad event on the Business Partners /Search tile set.

      End of the note.

      Event handler for the list tile event: ChangeAnchorManually()

      Syntax Syntax

      1. <QueryDetailTile>.ShowInfoButton
      End of the code.
    5. Write code to restore the fixed columns in the search result when users choose the Search pushbutton in the <business component>/Search tile set.

      Note Note

      The SwitchToNormalSearchMode() function restores the search result to the standard search columns. Write the call to this function at the tile set level.

      End of the note.

      Event handler for the list tile event: StartStandardSelection()

      Syntax Syntax

      1. <ListTile>.SwitchToNormalSearchMode
      2. //Write the SwitchToNormalSearchMode() function in the <business component>/List tile as follows:
      3. Public Sub SwitchToNormalSearchMode()
      4. ctrlReturn1.EditMode= cemHidden
      5. ctrlReturn2.EditMode= cemHidden
      6. ctrlReturn3.EditMode= cemHidden
      7. ctrlReturn4.EditMode= cemHidden
      8. ctrlReturn5.EditMode= cemHidden
      9. End Sub
      End of the code.
  7. Generate the changes that you have made in the business component.

    For more information, see Specifying Common Generation Settings.

Result

You have integrated advanced selection with a mobile application using MAS.