Start of Content Area

Function documentation Programmed Binding  Locate the document in its SAP Library structure

Use

You can use programmed binding in a binding instruction. You can use programmed binding to create more complex assignments, such as:

·        Perform calculations or checks on container elements before assignment

·        Combine two or more container elements before assignment

You can define programmed binding for each line in the binding editor.

ABAP Class or Function Module

You can implement a programmed binding as an ABAP class or a function module.

ABAP class

You can use an ABAP class to implement the Container ® Container and Expression ® Expression bindings.

A binding that is implemented as an ABAP class is displayed in the list of binding statements as an enhancement and is visible in all Workflows. This type of ABAP class is therefore particularly suitable for making company-wide enhancements.

An enhancement such as this is completely integrated in the binding editor. You can implement you own checks for the class and choose the names and symbols to be used to display the enhancement in the binding editor.

Function module

You can use a function module to implement the Container ® Container binding.

A function module can use the BOR container interface or the container interface.

Note

The BOR container interface supports compatibility reasons. It is therefore advisable to use the container interface for new function modules for the following reasons:

·         The container interface has no restrictions with regard to data types. The BOR container does not support the following data types: REF TO, STRING, XSTRING, fields that are longer than 255 characters.

·         No data type conversions are required for the container interface. This improves performance.

Activities

Programmed Binding with ABAP Classes

An ABAP class for a programmed binding must implement the following interface:

·        Expression ®Expression binding: IF_SWF_IFS_BIND_TRANSFORM

·        Container ®Container binding: IF_SWF_IFS_BIND_TRANSFORM_CONT

Both interfaces contain the following methods:

Interface Methods

Method

Description

CHECK

Compatibility check. Can check the data type of the data source.

Accessed by the binding editor once you have selected the class.

Can be implemented without entries if no checks are required.

TRANSFORM

User-defined binding instruction.

Called at runtime.

GET_SUPPORTED_OPTIONS

List of supported options. Determines which standard options are visible.

Accessed by the binding editor.

If the static CHECK and TRANSFORM methods are implemented and the class is activated, the class is made available as a selection in the list field for the binding instruction (under Enhancements).

Expression ® Expression Binding With IF_SWF_IFS_BIND_TRANSFORM

The interface determines the source and target expressions and transfers them to the user-defined class as source_element and target_element. The class can determine the data type of the source and target expressions in the CHECK method.

The CL_SWF_BND_TRANS_ADD_TO demo class, which adds the source expression to the target expression, is an example of this type of binding. The source expression can be a table.

Container ® Container Binding With IF_SWF_IFS_BIND_TRANSFORM_CONT

A Container ®Container binding can only make changes in the target container. Changes in the source container are not permitted.

The interface determines the source and target expressions and transfers them to the user-defined class as source_container and target_container.

The interface also transfers the binding event dataflow_event to the CHECK and TRANSFORM methods. This means you can respond differently to an access of the import or export event. The following applies for a binding between the workflow:

·        The workflow container is the source container and the task container is the target container for the export event.

·        The task container is the source container and the workflow container is the target container for the import event.

You can implement plausibility checks in the CHECK method. You can check whether specific elements have been defined in the source or target container.

Display Data Flow Editor With IF_SWF_IFS_BIND_PRESENTATION

The class can also implement the IF_SWF_IFS_BIND_PRESENTATION interface. The interface provides the name, language-dependent description and the icon for the class. This information is only displayed if you select the class in the list field for the binding instruction.

Interface Methods

Method

Description

GET_ICON

Icon displayed for the class.

GET_NAME

Unique language-dependent description for the class, for example “Add to“.

GET_DESCRIPTION

Language-dependent description, such as “Add to”.

This binding is displayed in the following places:

·        In the list field under Enhancements

·        As a quick info

·        As a field name

 

The following methods are not currently used. You must to implement them, but you can leave them blank.

·        GET_SYMBOL

·        GET_TEXT_KEY

·        TO_HTML

·        TO_STRING

Programmed Binding with Function Module

You should create a function module for the programmed binding in the function group specified in the basic data of the workflow. This function group should contain all the objects created for this workflow. If you create a function module using the binding editor, it is automatically stored in the function group.  If no function group is specified in the basic data of the workflow, the system creates one automatically.

A new function module created is based in the following function modules:

·        BOR container: SWA_TEMPLATE_EXECUTE_DATAFLOW

·        Container interface: SWA_BINDING_TEMPLATE

A description of interfaces and notes on programming is available in the function module documentation.

 

End of Content Area