Initialization (Method INITIALIZE)

Definition

The implementation of this method is only necessary if other infotypes must be read when output conversion and input conversion is performed (for type MAIN screen structures ) or when output table conversion and input table conversion is performed (for type LINE screen structures ).

Use

Method INITIALIZE is called directly after the instance of the conversion class is created. The sole purpose of this method is to pass references to reader classes that, in turn, might be used to read additional infotype data during output and input conversion. When this method is applied, the following references are passed:

  • PAITF_READ

    Reference PAITF_READ refers to a class with interface IF_HRPA_PAITF_READ . Method READ of this class can be called to read any additional infotype data that will be necessary.

  • PAITF_READ_MOLGA

    Reference PAITF_READ_MOLGA refers to class CL_HRPA_MOLGA . Method READ_MOLGA_BY_PERNR of this class can be called to obtain the country grouping of a specified personnel number.

If this method is required, then we recommend that you implement it as demonstrated in the example below. The sample source code below stores the reader class references within attributes of the conversion class. In any subsequent implementation of methods OUTPUT_CONVERSION and INPUT_CONVERSION , the reader classes are simply called via the attributes.

Caution Caution

No other means are permitted for reading infotype data.

End of the caution.

Example

The following source code excerpt demonstrates a sample implementation of the INITIALIZE method.

Example Example

METHOD IF_HRPA_UI_CONVERT_STANDARD~INITIALIZE. a_paitf_read = paitf_read. a_paitf_read_molga = paitf_read_molga.ENDMETHOD.

End of the example.

This source code requires that the following attributes – that is, Private, Instance attributes – be defined.

  • A_PAITF_READ type ref to IF_HRPA_PAITF_READ

  • A_PAITF_READ_MOLGA type ref to CL_HRPA_MOLGA

In the subsequent implementation of other methods – for example, in method OUTPUT_CONVERSION – you can access these classes in the following manner.

Example Example

METHOD IF_HRPA_UI_CONVERT_STANDARD~OUTPUT_CONVERSION.DATA p0001_tab TYPE STANDARD TABLE OF p0001.DATA p0001 TYPE p0001.DATA molga TYPE molga.FIELD-SYMBOLS <p9001> TYPE p9001.FIELD-SYMBOLS <zhcmt_bsp_pa_xx_r9001> TYPE zhcmt_bsp_pa_xx_r9001.is_ok = if_hrpa_ui_convert_standard~true.CLEAR field_attributes. * ensure that method is called for the correct screen structureIF screen_structure_name <> 'ZHCMT_BSP_PA_XX_R9001'. RAISE EXCEPTION TYPE cx_hrpa_violated_assertion.ENDIF. * assign and type structuresASSIGN pnnnn TO <p9001>.ASSIGN screen_structure TO <zhcmt_bsp_pa_xx_r9001>.... * read infotype 0001CALL METHOD a_paitf_read->read EXPORTING tclas = 'A' pernr = <p9001>-pernr infty = '0001' begda = <p9001>-begda endda = <p9001>-begda no_auth_check = if_hrpa_ui_convert_standard~true message_handler = message_handler IMPORTING pnnnn_tab = p0001_tab is_ok = is_ok.... * read molgamolga = a_paitf_read_molga->read_molga_by_pernr( tclas = 'A' pernr = <p9001>-pernr )....ENDMETHOD.

End of the example.