‎2007 Feb 23 12:55 PM
Hi,
I am new to ABAP.
Can any body tell me whether there is any built in function module for
field validation.
Thanks in advance
Archana
‎2007 Feb 23 1:27 PM
> Hi,
>
> I am new to ABAP.
> Can any body tell me whether there is any built in
> function module for
> field validation.
>
> Thanks in advance
>
> Archana
Thank you everybody.
My exact query is as follows:
I am doing module programming.
I want to validate a particular field while getting input.
For example:
I have a field like location. In that field input should be only india.
If user enters some other value, it should display a message like invalid input.
Thanks in advance
Archana
‎2007 Feb 23 1:07 PM
Hi!
Welcome on the board!
Your question seems very common, what exactly do you want?
A few examples:
- datum fields have automatic validation for correct format, but if you wnat an exat date range, you have to program it yourself
- at the select-option command, you can use the OBLIGATORY extension, to prevent the field staying empty
- in SE11, you can define to your data element a foreign key, which checks in the background, are there entries for the given field
Regards
Tamá
‎2007 Feb 23 1:08 PM
Welcome Archana.
What kind of validation you are looking for? because depends on the field you need to respective validations...like data...like ...customer number...like vendor number....etc...etc...
Hence if you are looking in for your program then you need to make use of AT-SELECTION SCREEN events and write respective validation code.
Hope I could able to give you some details..
Cheers
Manohar
‎2007 Feb 23 1:13 PM
Hi,
u can validate the field values using at selectiion-screen
AT SELECTION-SCREEN
When user enters the values in the fields of selection screen and clicks on execute button, this event gets triggered. This event is basically for checking the values entered by the user for the fields of the selection screen i.e., data validity checking. This event is for entire selection screen. For example:
You are accepting carrid, connid, fldate from user and you dont want to proceed if user enters no value for carrid and fldate. Using AT SELECTION-SCREEN can do this.
Select-options: carrid1 for sflight-carrid,
Connid1 for sflight-connid,
F1date1 for sflight-f1date.
AT SELECTION-SCREEN.
If carrid1-low ne and fldate1-low = .
Error message.
Endif.
In this case, if both the fields are entered blank, then the user gets error message.
Basically, this event is for many fields on selection screen. Usually, it is for the fields which are logically related.
AT SELECTION-SCREEN ON <field>
When you want to check for specific value of a field. For example, carrid should be in the range of LH and SQ. This can be done in this event. Basically, this event is for checking individual fields. You can have many AT selection-screen events in your program (i.e., for each field specified in the Select-Options).
Select-Options carrid1 for sflight-carrid.
AT SELECTION-SCREEN.
If carrid1-low ne LH and carrid1-high ne SQ.
Error message.
Endif.
Here the system will not proceed on entering wrong values.
Regards,
Sruthi
‎2007 Feb 23 1:16 PM
Obligatory is making the input mandatory.
You can use the below event at selection-screen on field and write you respective validation code in the perform.
AT SELECTION-SCREEN ON field p_fname.
PERFORM get_filename USING p_fname.
‎2007 Feb 23 1:27 PM
> Hi,
>
> I am new to ABAP.
> Can any body tell me whether there is any built in
> function module for
> field validation.
>
> Thanks in advance
>
> Archana
Thank you everybody.
My exact query is as follows:
I am doing module programming.
I want to validate a particular field while getting input.
For example:
I have a field like location. In that field input should be only india.
If user enters some other value, it should display a message like invalid input.
Thanks in advance
Archana
‎2007 Feb 23 1:35 PM
Refer this code
Code to demonstrate screen validation for dialog programs. The following code should be inserted into
the PAI module.
Validate single field via module call
FIELD sc_field-ebeln
MODULE validate_screen_field "validation code performed in module
ON INPUT.
* Validate multiple fields via module call
CHAIN.
FIELD: sc_field-ebeln, sc_field-ebelp.
MODULE validate_screen_field. "validation code performed in module
ENDCHAIN.
* Validate field via table selection
FIELD sc_field-ebeln
SELECT *
FROM ekko
WHERE ebeln = sc_field-ebeln
INTO ekko
WHENEVER NOT FOUND SEND ERRORMESSAGE 001
WITH ' Document Number
ON INPUT.http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
Hope this will oslve ur query, reward if this helsp.
‎2007 Feb 23 1:40 PM
hi archana,
in the Flow logic of the screen..
under the PROCESS AFTER INPUT event..
write module...
module MOD1.
MODULE MOD1 INPUT.
IF V_FLD NE 'INDIA'.
MESSAGE E001(ZERR).
ENDIF.
ENDMODULE.
‎2007 Feb 23 1:41 PM
use this it will help you,AT SELECTION-SCREEN ON FIELD S_KUNNR-LOW.
SELECT SINGLE * FROM KNA1 WHERE KUNNR = S_KUNNR-LOW.
IF SY-SUBRC NE 0.
MESSAGE E000(0) WITH 'ENTER VALID VALUE'.
CHEERS