Show TOC Start of Content Area

Object documentation Conversion Classes  Locate the document in its SAP Library structure

Definition

As described in the topic Programming User Interfaces in the De-Coupled Framework, conversion classes are of fundamental importance in ensuring that data from back-end infotype structures is converted for proper display in screen structures. Conversion classes also play a key role in screen control functionality by providing input help values and attributes for user interface fields.

Conversion classes delivered by SAP observe the naming convention CL_HRPA_UI_CONVERT_nnnn_yy, where:

     nnnn

denotes the four-digit number that is assigned to the infotype, and

     yy

denotes the Version ID – for example, FR for France, UP for the United States Public Sector, US for the United States, and XX for the international version.

In contrast, conversion classes created by customers should observe the naming convention ZCL_HRPA_UI_CONVERT_nnnn_yy, where nnnn and yy denote the same information as in the conversion classes delivered by SAP.

Note

If a name range prefix is desired, then customers should observe the naming convention /custcust/ZCL_UI_CONV_nnnn_yy while creating their conversion classes.

Use

Conversion classes are assigned to screen structures, as described in detail at the end of these guidelines. Whenever a screen structure appears in the user interface, the corresponding conversion class is called, both to perform the necessary conversion of data and to provide screen control functionality.

Two types of conversion classes are supported, namely standard conversion classes and advanced conversion classes. Standard conversion classes implement interface IF_HRPA_UI_CONVERT_STANDARD, while advanced conversion classes implement interface IF_HRPA_UI_CONVERT_ADVANCED.

In the majority of cases, it will suffice to implement a standard conversion class. Advanced conversion classes only require implementation in cases where the infotype in question contains additional data (via a specific infotype container) that needs to be accessed, rather than relying upon standard infotype structures alone – for example PNNNN for the primary infotype, PNNNN2 for the secondary infotype (that is, infotype view), PREFfor cost distribution, and so on. (To this end, advanced conversion classes pass this container, instead of the standard infotype structures, in each interface method.)

Aside from this single difference, standard and advanced conversion classes operate in an identical manner; the set of methods to be implemented, as well as the behavior of the methods themselves, equally apply to both types of conversion classes. For this reason, unless explicitly noted otherwise, the remainder of this topic and all subsequent topics in these guidelines always relate to standard conversion classes.

The default conversion class CL_HRPA_UI_CONVERT_BASIC is delivered in the standard system and can be used (that is, assigned to the corresponding screen structure) if the infotype in question lacks specific user interface requirements. However, if the functionality of the default conversion class is insufficient, then that class cannot be applied; a dedicated conversion class must instead be created and implemented.

As delivered, default conversion class CL_HRPA_UI_CONVERT_BASIC provides the following generic functionality.

     Field Values

When the default conversion class is applied, all user interface fields that bear identical field names in both the screen structure and the infotype structure are automatically filled. To this end, a MOVE-CORRESPONDING statement is used to transfer all field values from the infotype structure to the screen structure (for output conversion) and from the screen structure to the infotype structure (for input conversion).

If the screen structure contains fields whose field names differ from the field names in the infotype structure, or if uses of the MOVE-CORRESPONDING statement are not desired, then the default conversion class cannot be applied. Rather, a dedicated conversion class must be created, and methods OUTPUT_CONVERSION and INPUT_CONVERSION must be implemented, in accordance with the specific user interface requirements.

     Input Help Values

When the default conversion class is applied, Data Dictionary information is automatically evaluated, and input help values are automatically retrieved.

If this generic functionality is not suitable for the fields in question, or if other user interface requirements exist for the input help values to be provided, then the default conversion class cannot be applied. A dedicated conversion class must be created instead, and method FILL_HELP_VALUES must be implemented.

     Descriptive Texts

When the default conversion class is applied and the corresponding Customizing has been performed, descriptive texts for fields that hold key values are automatically retrieved, as described in the topic Automatically Retrieving Descriptive Texts. To this end, generic functionality known as the text identifier is applied to evaluate the Data Dictionary and derive the appropriate texts. In cases where this generic functionality is not suitable, the text identifier can be enhanced, if desired, by means of the corresponding exception concept. Advantageously, once an exception has been defined for the text identifier, that exception can always be re-used by the text identifier, regardless of the application that is using it.

Caution

Always apply the exception concept of the text identifier, rather than creating a specific conversion class to derive the text on your own.

     Field Attributes

When the default conversion class is applied, field attribute information (for example, mandatory, read-only, and so on) is automatically provided for those fields that bear identical field names in both the screen structure and the infotype structure. The system provides this information by evaluating the metadata defined for the back-end fields in tables T588MFPROPS and T588MFPROPC (the SAP and customer tables, respectively).

If you wish to set different field attributes, or if the field attributes are dynamically derived on the basis of the current infotype values, or if the screen structure contains fields whose field names differ from the field names in the infotype structure, then the default conversion class cannot be applied. Instead, a dedicated conversion class must be created, and methods OUTPUT_CONVERSION and INPUT_CONVERSION must be implemented.

Note

When the Create Infotype transaction (transaction code PM01) is executed for a new Personnel Administration infotype, the system automatically applies the default conversion class CL_HRPA_UI_CONVERT_BASIC, based on the assumption that no specific user interface requirements exist. The same assumption underlies the foregoing generation of the corresponding screen structure, which by default contains the same fields that are contained in structure Pnnnn.

If – by using the appropriate functionality of the Create Infotype transaction – you elect to change the default fields of the screen structure, then the system will automatically generate a dedicated conversion class in response; this conversion class must be implemented in accordance with the specific user interface requirements.

The conversion class thus generated is a standard conversion class, implementing interface IF_HRPA_UI_CONVERT_STANDARD. However, if the dedicated conversion class will need to access the infotype container, then you must manually replace this default (standard) interface with the interface for an advanced conversion class – that is, IF_HRPA_UI_CONVERT_ADVANCED.

End of Content Area