Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data Validation of Custom Table Fields

Former Member
0 Likes
616

Hi Guru's,

I have developed a Custom Table in SE11, generated a view, and am in the process of coding PAI Validation against certain fields.

I want to call a common perform statement for a number of the table fields, and generate a field specific error message:

i.e.

CHAIN.

FIELD ZMMC_CONTROL_TAB-DESCR .

FIELD ZMMC_CONTROL_TAB-VARIANT1 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT2 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT3 .

Module Validate_Variant_selection.

ENDCHAIN.

and, depending on the error, generate 'Error with value in field x', where x eq 'Variant1', 'Variant2', etc.

Is there a means of passing the field-name into the module (along the lines of the perform...using.. statement), or conversely, is there a structure of table that could be read from within the module to ascertain which table field called the module.

10 points up for grabs for a solution/suggestion that works.

Cheers,

Steve

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
572

Hi,

I believe you cannot pass values to the MODULE.. Instead create a subroutine and put in your functionality there..

FIELD ZMMC_CONTROL_TAB-VARIANT1 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT2 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT3 .

Module Validate_Variant_selection.

Example

-


Module Validate_Variant_selection.

IF NOT ZMMC_CONTROL_TAB-VARIANT1 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT1.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT2 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT2.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT3 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT3.

ENDIF.

ENDMODULE.

Thanks,

Naren

Hi,

I believe you cannot pass values to the MODULE.. Instead create a subroutine and put in your functionality there..

FIELD ZMMC_CONTROL_TAB-VARIANT1 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT2 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT3 .

Module Validate_Variant_selection.

Example

-


Module Validate_Variant_selection.

IF NOT ZMMC_CONTROL_TAB-VARIANT1 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT1.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT2 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT2.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT3 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT3.

ENDIF.

ENDMODULE.

Thanks,

Naren

1 REPLY 1
Read only

Former Member
0 Likes
573

Hi,

I believe you cannot pass values to the MODULE.. Instead create a subroutine and put in your functionality there..

FIELD ZMMC_CONTROL_TAB-VARIANT1 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT2 .

Module Validate_Variant_selection.

FIELD ZMMC_CONTROL_TAB-VARIANT3 .

Module Validate_Variant_selection.

Example

-


Module Validate_Variant_selection.

IF NOT ZMMC_CONTROL_TAB-VARIANT1 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT1.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT2 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT2.

ENDIF.

IF NOT ZMMC_CONTROL_TAB-VARIANT3 IS INITIAL.

PERFORM CHECK_VARIANT USING ZMMC_CONTROL_TAB-VARIANT3.

ENDIF.

ENDMODULE.

Thanks,

Naren