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

hi, about validation

Former Member
0 Likes
1,156

Is there any other methods for validation of a field apart from at selection-screen on field.

Is there any other methods for validation of a field apart from at selection-screen on field.

8 REPLIES 8
Read only

Former Member
0 Likes
1,125

Hi Prasoon,

Before the START OF SELECTION event, we have to do the validation part based on the selection screen parameters. So this can be done thro' AT SELECTION SCREEN ON FIELD event.

Regards,

Suresh

Read only

Former Member
0 Likes
1,125

Hi Prasoona,

Go through this program. In this program i done the validations on filed.

REPORT YCLASSICREPORTING NO STANDARD PAGE HEADING LINE-COUNT 20(5)

LINE-SIZE 88 MESSAGE-ID ZMGSVMR .

TABLES : LFA1.

SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.

DATA: BEGIN OF ITAB OCCURS 0,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

ORT01 LIKE LFA1-ORT01,

END OF ITAB.

DATA : FNAME(10) , FVAL(10) TYPE N.

INITIALIZATION .

VENDOR-LOW = 100.

VENDOR-HIGH = 1500.

VENDOR-OPTION = 'BT'.

VENDOR-SIGN = 'I'.

APPEND VENDOR.

AT SELECTION-SCREEN ON VENDOR.

IF VENDOR-LOW < 100 OR VENDOR-HIGH > 1500.

MESSAGE I000(ZMSGVMR) WITH 'enter oroper input'.

ENDIF.

START-OF-SELECTION.

SELECT LIFNR NAME1 ORT01 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN

VENDOR.

LOOP AT ITAB.

FORMAT COLOR 1.

WRITE : / ' accno' , 'name of vendor' , 'city of vendor' .

WRITE : / ITAB-LIFNR ,SY-VLINE , ITAB-NAME1,SY-VLINE , ITAB-ORT01,

SY-VLINE.

ULINE.

FORMAT COLOR OFF.

ENDLOOP.

SET PF-STATUS 'YVMR'.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'VENDOR'.

GET CURSOR FIELD FNAME VALUE FVAL.

SET PARAMETER ID 'LIF' FIELD FVAL.

CALL TRANSACTION 'XK02' AND SKIP FIRST SCREEN.

ENDCASE.

TOP-OF-PAGE.

WRITE : / 'VENDOR DETAILS ' COLOR 3 .

END-OF-PAGE.

WRITE 😕 'PAGE NO:' , SY-PAGNO COLOR 6.

END OF SELECTION.

Rewards some points.

Rgds,

P.Naganjana Reddy

Read only

Former Member
0 Likes
1,125

HI,

You can validate under At SELECTION-SCREEN.

But if an error encounters then this will not trigger to the error selection option,,

But when you validate undet AT SELECTION-SCREEN on FILED.

This will get to the particular field where the error occured and make to change the value of the field to run the program,,

rewrds if useful,

regards,

nazeer

Read only

Former Member
0 Likes
1,125

Hai,

You can <b>use dialog programming</b>.

Create your own sceens and events for actions on the screen.

In <b>event definition,validate the fields.</b>

Make sure of your sceen sequence.

Regds,

Rama chary.Pammi

Read only

Former Member
0 Likes
1,125

U can perform the validation in at selection-screen only..

The thing is u no need to write the validation code in at-selection..U can use subroutines and call those sub-routines in at selection-screen...

Read only

Former Member
0 Likes
1,125

Hi Prasoon,

Apart from <i>At Selection-Screen on <Field></i>, one can use <b><i>AT SELECTION- SCREEN</i></b> to validate the input on the screen. As by this time, the screen input is already passed to ABAP code.

Following is a small e.g. showing the validation & message display for some condition on <i>AT SELECTION-SCREEN.</i>

AT SELECTION-SCREEN.

IF CARRID-LOW IS INITIAL

OR CITY_FR IS INITIAL

OR CITY_TO IS INITIAL.

MESSAGE E000(HB).

ENDIF.

Hope this sorts out your issue.

PS If the answer sorts out your query, plz close the thread by rewarding each reply.

Regards

Read only

Former Member
0 Likes
1,125

You can use only 2 events to validate data on the selection screen.

1) AT SELECTION-SCREEN

2) AT SELECTION-SCREEN ON <field>.

The difference between the two is that when you use AT SELECTION-SCREEN and you issue an error message (message of type E) when the validation of a field fails then all the fields ar enabled for input. In this case your message should be clear enough to direct the user to the field whose data needs to be changed.

If you use AT SELECTION-SCREEN ON <field> and you issue an error message (message of type E) when the validation of a field fails then only the field containing the incorrect data is enabled for input. All the other fields are disabled. This makes it obvious to the user which field needs attention.

Read only

Former Member
0 Likes
1,125

hi prasoon

we can use AT LINE-SELECTION as below...

AT LINE-SELECTION ON s_kunnr.

loop at s_kunnr.

select single * from kna1 where kunnr in s_kunnr.

if sy-subrc ne 0.

message e012(ZMSG) with 'Invalid Input'.

endif.

endloop.

REWARD IT PLEASE...!!