Show TOC Entering content frame

Procedure documentation  Integrating Advanced Selection for a Business Component Locate the document in its SAP Library structure

Use

You use this procedure to integrate an Advanced Selection in a mobile client application, using the Mobile Application Studio.

 

Prerequisites

...

·        You have created an advanced selection, using the Mobile System Maintenance application. For more information, see Advanced Selection Workflow.

·        You know how advanced selection is used. For more information, see Using Advanced Selection.

 

Procedure

       1.      Identify the:

                            a.      Business component in which the advanced selection will be integrated.

                            b.      Tile set from which the relevant advanced selection will be called. Usually, the advanced selection is called from the <business component>/Search tile set, of the relevant business component.

Example

The Business Partner Search tile of the Business Partners component.

                            c.      Advanced selection that will be called from the <business component>/Search tile set. This advanced selection is created using the Mobile System Maintenance application.

Example

The Business Partners component uses the Business Partner Advanced Selection.

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

       3.      Define pushbuttons.

To call the required advanced selection you define a pushbutton called, Advanced Selection. To view the details of the search criteria while using the advanced selection you define a pushbutton, Info.

This includes:

                            a.      Adding the controls

You add these pushbuttons to the <business component> Search tile. For more information about defining a pushbutton, see Structure linkDefining a Button Control.

  Note

Set the property of the Info pushbutton as Hidden.

                            b.      Writing the scripts for the controls

You must write code for the following functions to be executed:

§         During run time, in the event of the click of the Advanced Selection pushbutton, the corresponding advanced selection tile set must be loaded.

Example

To load the Business Partner Advanced Selection the following code is written:

Dim AdvSelBo as Object

Dim ErrorMsg as String

On error goto DoNothing

set AdvSelBo = gServices.BOL.GetData(“SFAGLOBAL”).AdvancedSelectionInterface (“EXPT”, “CAP”, “”, ErrorMsg)

if ErrorMsg <> “” then

         Mcore.raiseMessage ErrorMsg

      exit sub

      end if

Dim hExperSelection As Core HyperlinkSource

Set hExpertSelection = gApplication.newHyperlink(Me, “hMSASYSExpertSelection”, “hMSASYSExpertSelection”, Nothing)

hExpertSelection.setRawContent AdvSelBo

hExpertSelection.execute

DoNothing:

§         During run time, in the event of a click of the Info pushbutton a dialog box must appear. This dialog box displays the query that you have executed. For more information, see Using Advanced Selection.

Example

In a case, when the advanced selection for Business Partners is called you enter the following code for the Info pushbutton clicked event:

gServices.showMsgBox (gServices.BOL.GetData (“SFAGLOBAL”). AdvSelInfoText (“CAP”))

                            c.      Writing the following code on the <business component> Search tile as given in the example below:

Example

Before Query Execute Event

ctrlInfo.EditMode = cemHidden

Add Custom Event

Event Name – StartStandardSelection()

Methods

Public Sub ShowInfoButton

   ctrlInfo.EditMode = cemNormal

End Sub

       4.      Define internal hyperlinks.

Defining hyperlinks ensures that the relevant tile set is loaded.

                            a.      You define the:

§         <business component> Search tile as the hyperlink source

§         <business component>/Advanced Selection tile set as the hyperlink target.

The hyperlink source and target have to be defined at the application level.

  Note

The advantage of defining the target at the application level is that the hyperlink established between the source and target can be reused across the application.

                            b.      You define a hyperlink between the source hyperlink and the target hyperlink.

For more information about defining hyperlinks, see Structure linkModel a Hyperlink.

Listed below are all the hyperlinks that have been 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

 

                            c.      Enter the hyperlink name in the User Data Dictionary.

This ensures that the required advanced selection is loaded. You add the hyperlink name in the On Loadevent of the <business component>/Search tile set.

  Example

To load the Business Partners Advanced Selection the following code will be executed in the On Loadevent of the tile set MSAMSACAPbpsearch:

OnLoad

gServices.bol.UserDataDictionary.PutData “EXPT”, “SEACAP”

SEACAP here identifies the Business Partners Advanced Selection.

       5.      Define columns (attributes).

These columns will display the data based on the criteria that you have selected for the search.

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

                            b.      Define the following variables:

§         NumberOf Returns = Long, public

§         ResultRecordSet = Object, public

       6.      Display the result set.

To display the result set back in the List tile of the <business component>/Search tile set:

                            a.      Define the:

§         <business component>/Advanced Selection tile as the hyperlink source

§         <business component>/List tile as the hyperlink target.

                            b.      Define a hyperlink between the source hyperlink and the target hyperlink.

The hyperlink source and target must be defined at the application level.

For more information about hyperlink modeling, see Structure linkModel a Hyperlink.

                            c.      Include the query statement for the search function.

On the Search pushbutton, you must execute the Before Query event. If the query returns values that are not part of the fixed values (columns) in the search execution, then the following code is executed as illustrated in the example below.

  Example

In a case of advanced selection for Business Partners, the following code is written for the Business Partners tile:

·         The OnLoad event contains the CheckAndShow and ChangeAnchorManually events. These events are called from the tile set level.

·         The CheckAndShow event checks which additional fields have to be shown and displays them.

·         The ChangeAnchorManually event makes the Info button visible.

·         The RowLoadedevent updates additional fields according to the record set obtained on execution of the SQL statement.

OnLoad

  ctrlctrlsgrid.setnumberoffrozencolumns(3)

  Dim temp As Boolean

  On Error GoTo Not_There

  Dim Fromwhere As String

  Dim UserDataDic As UserDataDictionary

  Set UserDataDic = gServices.BOL.UserDataDictionary

 

  Fromwhere = UserDataDic.GetData(“EXPSELRESULTSETUSED”)

  Select Case Fromwhere

     Case “SEACAP”

        UserDataDic.PutData “EXPSELRESULTTILESETUSED”, “”

Set pResultRecordset = UserDataDic.GetData(“EXPSELRESULTOBJECTCAPRS”)

  

        pNumberOfReturns = 0

        temp = CheckAndShow (“ReturnValue1”, CtrlReturn1) Or

           CheckAndShow (“ReturnValue2”, CtrlReturn2) Or

           CheckAnd Show (“ReturnValue3”, CtrlReturn3) Or

           CheckAnd Show (“ReturnValue4”, CtrlReturn4) Or

           CheckAnd Show (“ReturnValue5”, CtrlReturn5)

acaplist4DSO.SetRawContent UserDataDic. GetData(“EXPSELRESULTOBJECTCAP”)

acaplist4DSO.SetRawContent UserDataDic. GetData(“EXPSELRESULTOBJECTCAP”)

 

RaiseEvent

ChangeAnchorManually(UserDataDic.GetData(“EXPSELRESULTOBJECTCAP”))

     Case Else

        ‘ error

     End Select

     Set UserDataDic = Nothing

     Exit Sub

Not_There:

acaplist4DSO.SetRawContent Nothing

 

Row Loaded Event

if pNumberOfReturns > 0 then

     columns.Item(“ctrlReturn1”) = pResultRecordSet.Fields(“ReturnValue1”).value

  if pNumberOfReturns > 1 then

       columns.Item(“ctrlReturn2”) = pResultRecordSet.Fields(“ReturnValue2”).value

     if pNumberOfReturns > 2 then

                           columns.Item(“ctrlReturn3”) = pResultRecordSet.Fields(“ReturnValue3”).value

            if pNumberOfReturns > 3 then

                 columns.Item(“ctrlReturn4”) = pResultRecordSet.Fields(“ReturnValue4”).value

                if pNumberOfReturns > 4 then

                       columns.Item(“ctrlReturn5”) = pResultRecordSet.Fields(“ReturnValue5”).value

      end if       

          end if

    end if

end if

end if

 

Public Function CheckAndShow (ResultString).value

ColumnControl.EditMode = cemReadOnly

CheckAndShow = True

pNumberOfreturns = pNumberOfReturns + 1

exit function

ColNotFound:

ColumnControl.EditMode = cemHidden

CheckAndShow = FALSE

End Function

 

Custom Properties

  NumberOfReturns – Long – Public

  ResultRecordSet – Object – Public

Custom Event

  Event Name – ChangeAnchorManually

  Event Signature – Public Event ChangeAnchorManually (BC as Object)

Add return1 – Return5 … as Unbound Grid Column

                            d.      Display the Info pushbutton

To display the Info button you enter the code as given in the example below.

  Example

The ChangeAnchorManually event makes the Info button visible. This event is written in the On Load event on the Business Partners /Search tile set.

EventHandler for List Tile Event – ChangeAnchorManually()

<QueryDetailTile>.ShowInfoButton

                            e.      When you choose the Search pushbutton in the <business component>/Search tile set the result must be restored back to the normal fixed columns.

On choosing the Search pushbutton, the event triggered must restore all the fixed columns. The code that is written for this event is given in the example below:

  Example

The SwitchToNormalSearchMode() function restores the result set to the standard search columns.

·         The call to this function is written at the tile set level and is as follows:

Event Handler for Search Tile Event – StartStandardSelection()

   <ListTile>.SwitchToNormalSearchMode

·         The SwitchToNormalSearchMode() function is written in the <business component>/List tile and is as follows:

Public Sub SwitchToNormalSearchMode()

ctrlReturn1.EditMode= cemHidden

ctrlReturn2.EditMode= cemHidden

ctrlReturn3.EditMode= cemHidden

ctrlReturn4.EditMode= cemHidden

ctrlReturn5.EditMode= cemHidden

End Sub

       7.      Generate the modifications that have been made to the business component. For more information, see Structure linkSpecifying Common Generation Settings.

 

Result

You have integrated the advanced selection for a mobile client application, using Mobile Application Studio.

 

See also:

Using Advanced Selection

Leaving content frame