Show TOC

 Repeat Fields: Input Conversion (Method INPUT_TABLE_CONVERSION)

Definition

This method is the counterpart of method OUTPUT_TABLE_CONVERSION , introduced in the previous topic. However, one substantive difference exists between this method and its counterpart; whereas method OUTPUT_TABLE_CONVERSION is called only once to provide all screen structure records for the repeat fields in question, method INPUT_TABLE_CONVERSION is called separately for each screen structure record. Each record is passed in parameter SCREEN_STRUCTURE , while the Number of Table for Master Data parameter ( TABNO ) indicates the index of the record – that is, the position of the record in table SCREEN_STRUCTURES at the time that it was provided in method OUTPUT_TABLE_CONVERSION .

Use

When implementing method INPUT_TABLE_CONVERSION , one must update the repeat field(s) with the number(s) correspondingly indicated in parameter TABNO of structure Pnnnn . If the generic functionality for this purpose is applied, then all repeat fields are updated automatically. If the generic functionality is not applied, then all repeat fields must be updated manually.

Before calling method INPUT_TABLE_CONVERSION , the framework first calls method INPUT_CONVERSION to convert all non-repeat fields. Thus, when method INPUT_TABLE_CONVERSION is called the first time, parameter PNNNN already contains the updated non-repeat fields. As a result, within the implementation of INPUT_TABLE_CONVERSION , one is only allowed to modify the repeat fields in structure Pnnnn that correspond to the index passed in parameter TABNO . All other repeat fields must remain unchanged.

Example

The following source code excerpt demonstrates a sample implementation of method INPUT_TABLE_CONVERSION . This example assumes that no Customizing has been performed for the repeat fields, so that the implementation must manually convert the contents of the screen structure fields, for storage, to the format of the repeat fields in structure Pnnnn . Note that this example is the counterpart to the second example found within the topic Repeat Fields: Output Conversion (Method OUTPUT_TABLE_CONVERSION

Example Example

METHOD IF_HRPA_UI_CONVERT_STANDARD~INPUT_TABLE_CONVERSION. DATA hcmt_bsp_pa_xx_r0008_lin_a TYPE hcmt_bsp_pa_xx_r0008_lin_a. DATA p0008 TYPE p0008. DATA lgart TYPE lgart. DATA betrg TYPE pad_amt7s. DATA anzhl TYPE anzhl. DATA indbw TYPE indbw. DATA opken TYPE opken. is_ok = if_hrpa_ui_convert_standard~true. * 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. hcmt_bsp_pa_xx_r0008_lin_a = screen_structure. * find the correct repeat field number according to TABNO DO 40 TIMES VARYING lgart FROM p0008-lga01 NEXT p0008-lga02 VARYING betrg FROM p0008-bet01 NEXT p0008-bet02 VARYING anzhl FROM p0008-anz01 NEXT p0008-anz02 VARYING indbw FROM p0008-ind01 NEXT p0008-ind02 VARYING opken FROM p0008-opk01 NEXT p0008-opk02. CHECK sy-index = tabno. * set repeat fields to values of screen structure lgart = hcmt_bsp_pa_xx_r0008_lin_a-lgart. betrg = hcmt_bsp_pa_xx_r0008_lin_a-betrg. anzhl = hcmt_bsp_pa_xx_r0008_lin_a-anzhl. indbw = hcmt_bsp_pa_xx_r0008_lin_a-indbw. opken = hcmt_bsp_pa_xx_r0008_lin_a-opken. EXIT. ENDDO. pnnnn = p0008. ENDMETHOD.

End of the example.