Show TOC

 Repeat Fields: Output Conversion (Method OUTPUT_TABLE_CONVERSION)

Definition

This method is the counterpart of method INPUT_TABLE_CONVERSION , introduced in the subsequent topic.

Implementation of this method is necessary only in cases where the infotype in question contains repeat fields and the generic functionality to process these repeat fields (via Customizing) is neither suitable nor possible.

For an overview of the generic functionality for processing repeat fields, review the topic Repeat Field Screen Structures (Type LINE) .

Use

The use of methodOUTPUT_TABLE_CONVERSIONclosely corresponds to the use of method OUTPUT_CONVERSION . If the infotype to be processed contains repeat fields, then methodOUTPUT_CONVERSIONis first called to process the non-repeat fields, followed by methodOUTPUT_TABLE_CONVERSION, which is called to process the repeat fields. Because the respective uses of these methods closely correspond to one another, the parameters within these methods are essentially the same. Therefore, refer to the topic Output Conversion (Method OUTPUT_CONVERSION) for a summary of its parameters, which essentially correspond to the parameters within the present method,OUTPUT_TABLE_CONVERSION

Unlike methodOUTPUT_CONVERSION, which converts one infotype structure into exactly one screen structure, methodOUTPUT_TABLE_CONVERSIONcreates several screen structure records – one for each repeat field value. For this reason, the attributes of parameterSCREEN_STRUCTURESdefine it to have type Table . Moreover, the parameter is defined to have theCHANGINGattribute, which enables it to support the generic functionality for processing repeat fields. In the event that the generic functionality is applied, parameterSCREEN_STUCTURESwill already contain the records that this functionality correspondingly created. For this reason, if the generic functionality is sufficient, then the implementation of methodOUTPUT_TABLE_CONVERSIONcan be omitted. Alternatively, if additional source code is desired to complement and enhance the generic functionality – by providing additional data or field values – then methodOUTPUT_TABLE_CONVERSIONcan be implemented to this end. The first example provided at the end of this topic illustrates sample source code that complements and enhances the generic functionality.

In contrast, if the generic functionality is neither suitable nor possible for the infotype in question, and if no corresponding Customizing is defined, then parameterSCREEN_STRUCTURESremains empty, and is passed without a value. Consequently, an implementation of methodOUTPUT_TABLE_CONVERSIONmust subsequently create the necessary entries. The second example provided at the end of this topic illustrates sample source code that would fulfill this requirement.

Finally, like methodOUTPUT_CONVERSION, methodOUTPUT_TABLE_CONVERSIONalso can be implemented to provide field attributes – for example, read-only or mandatory – for repeat fields. However, because methodOUTPUT_TABLE_CONVERSIONreturns multiple records in parameterSCREEN_STRUCTURES(rather than a single screen structure record), the field attributes for each of these records must be set separately. Therefore, for each record in parameterSCREEN_STRUCTURES, a corresponding record must be returned in parameterFIELD_ATTRIBUTES. Moreover, a synonymous identifier must be defined for each record in fieldOBJECT_KEY; this identifier serves to establish the link between parametersSCREEN_STRUCTURESandFIELD_ATTRIBUTES

Special attention must be paid to fieldOBJECT_KEYof parameterSCREEN_STRUCTURES. If the generic functionality is applied, then the system will accordingly pass records in parameterSCREEN_STRUCTURES, and fieldOBJECT_KEYalready will be correctly defined for each record. However, if the generic functionality is not applied – meaning that output table conversion is implemented manually – then a uniqueOBJECT_KEYvalue must exist for each record created in parameterSCREEN_STRUCTURES. In either case, whether or not the generic functionality is applied, exactly the sameOBJECT_KEYvalue must be used in the corresponding record that is created to specify the field attributes in parameterFIELD_ATTRIBUTES

Example

The first example below illustrates sample source code that complements and enhances the generic functionality, while the second example illustrates sample source code to create the necessary entries in parameterSCREEN_STRUCTURESwhen the generic functionality is neither suitable nor possible for the infotype in question, and when no corresponding Customizing has been defined.

The following example demonstrates an implementation of methodOUTPUT_TABLE_CONVERSIONfor the Basic Pay infotype (0008) by means of screen structure HCMT_BSP_PA_XX_R0008_LIN_A. In this example, table T588AUTO_MAP has been customized in the same manner described in the example within the topic Repeat Field Screen Structures (Type LINE) .

In this example, the generic functionality for processing repeat fields has already created records to be passed in parameterSCREEN_STRUCTURES. Consequently, entries have already been filled in the fields Wage Type (LGART), Amount (BETRG), Number (ANZHL), Indicator for Indirect Valuation (INDBW) and Operation Indicator for Wage Types (OPKEN). The Currency Key field (WAERS), however, has not yet been filled, because it is not a repeat field. The following source code excerpt therefore demonstrates how this non-repeat field can be filled for each record in parameterSCREEN_STRUCTURES. This excerpt also illustrates how the field attributes can be set.

METHOD IF_HRPA_UI_CONVERT_STANDARD~OUTPUT_TABLE_CONVERSION. FIELD-SYMBOLS <p0008> TYPE p0008. FIELD-SYMBOLS <hcmt_bsp_pa_xx_r0008_lin_a> TYPE hcmt_bsp_pa_xx_r0008_lin_a. DATA field_attribute TYPE hrpad_field_attribute. DATA field_attribute_wa TYPE hrpad_obj_field_attribute. is_ok = if_hrpa_ui_convert_standard~true. CLEAR field_attributes. * ensure that method is called for the correct screen structure IF screen_structure_name <> 'HCMT_BSP_PA_XX_R0008_LIN_A'. RAISE EXCEPTION TYPE cx_hrpa_violated_assertion. ENDIF. * assign and type structure ASSIGN pnnnn TO <p0008>. * process all records automatically created by T588AUTO_MAP and T588AUTO_TABLE customizing LOOP AT screen_structures ASSIGNING <hcmt_bsp_pa_xx_r0008_lin_a>. CHECK <hcmt_bsp_pa_xx_r0008_lin_a> IS NOT INITIAL. * set the currency of the wage type amount IF <hcmt_bsp_pa_xx_r0008_lin_a>-betrg IS NOT INITIAL. <hcmt_bsp_pa_xx_r0008_lin_a>-waers = <p0008>-waers. ENDIF. * for each record we have to create field attributes CLEAR field_attribute_wa. field_attribute_wa-object_key = <hcmt_bsp_pa_xx_r0008_lin_a>-object_key. * set field WAERS to readonly CLEAR field_attribute. field_attribute-field_name = 'WAERS'. field_attribute-field_property = if_hrpa_ui_convert_standard~read_only. APPEND field_attribute TO field_attribute_wa-field_attribute. * set field LGART to mandatory CLEAR field_attribute. field_attribute-field_name = 'LGART'. field_attribute-field_property = if_hrpa_ui_convert_standard~obligatory. APPEND field_attribute TO field_attribute_wa-field_attribute. APPEND field_attribute_wa TO field_attributes. ENDLOOP. ENDMETHOD.

Assume in the following example that no Customizing has been performed for the repeat fields … unlike the previous example. In this case, the implementation of methodOUTPUT_TABLE_CONVERSIONmust create all screen structure records with unique object keys, as illustrated in the source code excerpt shown below.

METHOD IF_HRPA_UI_CONVERT_STANDARD~OUTPUT_TABLE_CONVERSION. DATA field_attribute TYPE hrpad_field_attribute. DATA field_attribute_wa TYPE hrpad_obj_field_attribute. DATA hcmt_bsp_pa_xx_r0008_lin_a TYPE hcmt_bsp_pa_xx_r0008_lin_a. DATA object_key_index TYPE i. DATA p0008 TYPE p0008. is_ok = if_hrpa_ui_convert_standard~true. CLEAR screen_structures. CLEAR field_attributes. * ensure that method is called for the correct screen structure IF screen_structure_name <> 'HCMT_BSP_PA_XX_R0008_LIN_A'. RAISE EXCEPTION TYPE cx_hrpa_violated_assertion. ENDIF. p0008 = pnnnn. DO 40 TIMES VARYING hcmt_bsp_pa_xx_r0008_lin_a-lgart FROM p0008-lga01 NEXT p0008-lga02 VARYING hcmt_bsp_pa_xx_r0008_lin_a-betrg FROM p0008-bet01 NEXT p0008-bet02 VARYING hcmt_bsp_pa_xx_r0008_lin_a-anzhl FROM p0008-anz01 NEXT p0008-anz02 VARYING hcmt_bsp_pa_xx_r0008_lin_a-indbw FROM p0008-ind01 NEXT p0008-ind02 VARYING hcmt_bsp_pa_xx_r0008_lin_a-opken FROM p0008-opk01 NEXT p0008-opk02. * reset currency and object key CLEAR hcmt_bsp_pa_xx_r0008_lin_a-waers. CLEAR hcmt_bsp_pa_xx_r0008_lin_a-object_key. * make sure that this is not an empty record CHECK hcmt_bsp_pa_xx_r0008_lin_a IS NOT INITIAL. * set object key ADD 1 TO object_key_index. hcmt_bsp_pa_xx_r0008_lin_a-object_key = object_key_index. * set the currency of the wage type amount IF hcmt_bsp_pa_xx_r0008_lin_a-betrg IS NOT INITIAL. hcmt_bsp_pa_xx_r0008_lin_a-waers = p0008-waers. ENDIF. APPEND hcmt_bsp_pa_xx_r0008_lin_a TO screen_structures. * create field attributes for each record CLEAR field_attribute_wa. field_attribute_wa-object_key = hcmt_bsp_pa_xx_r0008_lin_a-object_key. * set field WAERS to readonly CLEAR field_attribute. field_attribute-field_name = 'WAERS'. field_attribute-field_property = if_hrpa_ui_convert_standard~read_only. APPEND field_attribute TO field_attribute_wa-field_attribute. * set field LGART to mandatory CLEAR field_attribute. field_attribute-field_name = 'LGART'. field_attribute-field_property = if_hrpa_ui_convert_standard~obligatory. APPEND field_attribute TO field_attribute_wa-field_attribute. APPEND field_attribute_wa TO field_attributes. ENDDO. ENDMETHOD.