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).
The use of method OUTPUT_TABLE_CONVERSION closely corresponds to the use of method OUTPUT_CONVERSION. If the infotype to be processed contains repeat fields, then method OUTPUT_CONVERSION is first called to process the non-repeat fields, followed by method OUTPUT_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 method OUTPUT_CONVERSION, which converts one infotype structure into exactly one screen structure, method OUTPUT_TABLE_CONVERSION creates several screen structure records – one for each repeat field value. For this reason, the attributes of parameter SCREEN_STRUCTURES define it to have type Table. Moreover, the parameter is defined to have the CHANGING attribute, which enables it to support the generic functionality for processing repeat fields. In the event that the generic functionality is applied, parameter SCREEN_STUCTURES will already contain the records that this functionality correspondingly created. For this reason, if the generic functionality is sufficient, then the implementation of method OUTPUT_TABLE_CONVERSION can be omitted. Alternatively, if additional source code is desired to complement and enhance the generic functionality – by providing additional data or field values – then method OUTPUT_TABLE_CONVERSION can 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 parameter SCREEN_STRUCTURES remains empty, and is passed without a value. Consequently, an implementation of method OUTPUT_TABLE_CONVERSION must 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 method OUTPUT_CONVERSION, method OUTPUT_TABLE_CONVERSION also can be implemented to provide field attributes – for example, read-only or mandatory – for repeat fields. However, because method OUTPUT_TABLE_CONVERSION returns multiple records in parameter SCREEN_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 parameter SCREEN_STRUCTURES, a corresponding record must be returned in parameter FIELD_ATTRIBUTES. Moreover, a synonymous identifier must be defined for each record in field OBJECT_KEY; this identifier serves to establish the link between parameters SCREEN_STRUCTURESand FIELD_ATTRIBUTES.
Special attention must be paid to field OBJECT_KEY of parameter SCREEN_STRUCTURES. If the generic functionality is applied, then the system will accordingly pass records in parameter SCREEN_STRUCTURES, and field OBJECT_KEY already 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 unique OBJECT_KEY value must exist for each record created in parameter SCREEN_STRUCTURES. In either case, whether or not the generic functionality is applied, exactly the same OBJECT_KEY value must be used in the corresponding record that is created to specify the field attributes in parameter FIELD_ATTRIBUTES.
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 parameter SCREEN_STRUCTURES when 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 method OUTPUT_TABLE_CONVERSION for 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 parameter SCREEN_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 parameter SCREEN_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 method OUTPUT_TABLE_CONVERSION must 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.