Show TOC Entering content frame

Procedure documentation Writing a Supply Function Locate the document in its SAP Library structure

Use

A supply function creates a relation between two business objects associated in a business anchor hierarchy when no relation exists for them in the business logic layer. The supply function specifies a query for the parent business anchor to enable the child business anchor to supply the results. You can write a supply function for the business anchors modeled in a tile, a tile set, and a business component.

Prerequisites

You have:

·        Created the business anchor hierarchy

·        Opened the Anchor Designer for the interaction component containing the business anchor hierarchy for which a supply function must be written

·        Switched to the required change list

Procedure

...

       1.      In the Anchor Designer, click the dependent anchor in the business anchor hierarchy with the secondary mouse button and choose Set Supply Function.

       2.      Select the appropriate Supply Type.

¡        Local Supply Function ensures that the relation is available within the interaction component. The supply function can reference anchors, controls, custom properties, and methods belonging to the interaction component.

At runtime, the supply function starts when the value of the child anchor is requested in this interaction component.

¡        Global Supply Function allows other interaction components to use the relation. The supply function can reference variables defined through parameters.

At runtime, the supply function starts when the value of the child anchor is requested in any interaction components.

       3.      In the Supply Function property, choose This graphic is explained in the accompanying text.

The Supply Function dialog appears.

       4.      Write the supply function in Microsoft Visual Basic code.

Note

You can use the parameters specified for the interaction component including parent business anchor, destination type and data type. You cannot change the parameters.

Result

At runtime, the child business anchor displays results based on the data held by both the parent anchor and the code of the supply function.

Example

You have created the business anchor hierarchy between the Opportunity and Business Partner business anchors. The Opportunity business anchor is the parent and its associated data source is a business object. The Business Partner business anchor is the child and its associated data source is a business collection. Since the two data sources do not have a relation in the business logic layer, the Business Partner anchor requires an Onsolve supply function to supply the data held by the Opportunity anchor’s data source.

Write an Onsolve supply function for the business partner anchor. At runtime, the user can query which business partners are related to a specific opportunity.

Dim mColResults As Object

Dim mObjBsHelp As Object

Set mObjBsHelp = gFactory.newBusinessQuery("BSOPPBP")

Set mColResults = Nothing

If Not parentAnchor.bo Is Nothing Then

      mObjBsHelp.Sfaobject = parentAnchor.bo.uniquekey

End If

Set mColResults = mObjBsHelp.query

Set destination = mColResults

Set  mColResults = nothing

Set  mObjBsHelp = nothing

Leaving content frame