Implementation of this method is mandatory.
This method is the counterpart of method
OUTPUT_CONVERSION
, introduced in the previous topic. For an explanation of the parameters contained in method
INPUT_CONVERSION
, review the previous topic.
Whereas method
OUTPUT_CONVERSION
is implemented to fill the screen structure, based on the values of the infotype structure, method
INPUT_CONVERSION
is implemented to fill the infotype structure, based on the values of the screen structure. Infotype structure
Pnnnn
is a changing parameter. The values that are imported into it are those that were passed as importing when method
OUTPUT_CONVERSION
was last called.
The first example provided below illustrates the simplest case where this method could be implemented, while the second example demonstrates a more complex case. Moreover, the second example in this topic provides a counterpart to the second example that was demonstrated in the previous topic.
Example
METHOD IF_HRPA_UI_CONVERT_STANDARD~INPUT_CONVERSION.
is_ok = if_hrpa_ui_convert_standard~true.
* ensure that method is called for the correct screen structure
IF screen_structure_name <> 'ZHCMT_BSP_PA_XX_R9001'.
RAISE EXCEPTION TYPE cx_hrpa_violated_assertion.
ENDIF.
* move values of fields with
identical
names
MOVE-CORRESPONDING screen_structure TO pnnnn.
ENDMETHOD.
Example
METHOD IF_HRPA_UI_CONVERT_STANDARD~INPUT_CONVERSION.
* infotype structure P9001 contains these fields:
* NACHN – Last Name
* VORNA – First Name
* GBDAT – Date of Birth
* GBPAS – Date of Birth According to Passport
* NCHMC – Last Name (Field for Search Help) -> not needed on UI
* ANRED – Form-of-Address Key (key values 1, 2, … representing ‘Mr.’, ‘Ms.’,…)
* screen structure ZHCMT_BSP_PA_XX_R9001 contains these fields:
* NACHN– Last Name
* VORNA– First Name
* FULL_NAME – Full Name (Concatenation of First Name and Last Name)
* GBDAT – Date of Birth
* AGE – Employee age (Derived from Date of Birth)
* ANRED – Form-of-Address Key
* FORM_OF_ADDRESS_TEXT – Form-of-Address Description (descriptive texts ‘Mr.’, Ms.’,…)
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.
* ensure that method is called for the correct screen structure
IF screen_structure_name <> 'ZHCMT_BSP_PA_XX_R9001'.
RAISE EXCEPTION TYPE cx_hrpa_violated_assertion.
ENDIF.
* assign and type structures
ASSIGN pnnnn TO <p9001>.
ASSIGN screen_structure TO <zhcmt_bsp_pa_xx_r9001>.
* copy values of fields GBDAT, ANRED
<p9001>-gbdat = <zhcmt_bsp_pa_xx_r9001>-gbdat.
<p9001>-anred = <zhcmt_bsp_pa_xx_r9001>-anred.
* no action required for readonly fields AGE, NACHN, VORNA, FORM_OF_ADDRESS_TEXT
* extract NACHN and VORNA from field FULL_NAME.
SPLIT <zhcmt_bsp_pa_xx_r9001>-full_name AT space
INTO <p9001>-vorna <p9001>-nachn.
ENDMETHOD.