Start of Content Area

Procedure documentation Sorting Classic BAdI Implementations  Locate the document in its SAP Library structure

Use

The sequence for execution of BAdI implementations can be controlled for BAdIs used on a multiple basis by a sort mechanism.

Procedure

en

.

In the BAdI Builder (SE18), choose Utilities   Sort. The following dialog box appears.

This graphic is explained in the accompanying text

Choose Standard Sort if sort is to take place using numeric sort values. The numeric values are entered in the displayed field Layer Value when you create the implementations and stored in a table. The implementations are executed in accordance with the specified sequence.

Choose Special Sort if sorting is to take place using non-numeric sort values. In this case, you need to enter the name of the implementation that will be created in the following step. 

Proceed as follows if you require special sorting:

       1.      Create an implementation for the BAdI definition BADI_LAYER contained in the delivered product. Enter a BAdI definition as filter value in the Properties tab (the name will be used as a dummy value to begin with).

       2.      Create a screen (in a function group or a module pool). The screen contains, for example, a text field with the name Sort Value and an input field. 

       3.      Choose the Subscreens tab of the BAdI implementation and enter the called program and the screen number.

This graphic is explained in the accompanying text

       4.      Choose the Interface tab. The IF_EX_BADI_LAYER interface contains the following methods:

This graphic is explained in the accompanying text

In addition to methods for data transmission of the sort value and for changing the BAdI implementation, the interface also contains a sort method that sorts a table of values in any specified order.

This graphic is explained in the accompanying text

A standard table is passed to this method as a changing parameter. The table contains values only; it does not contain any implementation names. This table contains, for example, inputs for the Sort Value field when you create implementations. The user can maintain any fields as required and sort them according to any specified criteria at runtime.

       5.      Program the method SORT_DATA. Here is an example of simple sorting of numeric values:

This graphic is explained in the accompanying text

       6.      Program the methods for data transmission in the following form (see also: Screen Enhancements).  

This graphic is explained in the accompanying text

       7.      Program the call for implementations from the application program. The IF_EX_BADI_LAYER interface contains a parameter-free method called TEST for test purposes.

This graphic is explained in the accompanying text

The implementations are executed (for example, in numeric sequence).

Switching Off Sort Function

To switch off the sort for the execution of BAdI implementations, choose Utilities Sort and finally No Sort. The implementations will now run in an arbitrary sequence in this case. The edit field that was displayed using a subscreen during the execution of a BAdI implementation now disappears.

Sorting of BAdI implementations can be switched on again at any time. This does not count as a modification to the standard version. The BAdI definition is not changed. Switching off or making a change, on the other hand, counts as a modification.

 

 

End of Content Area