Application Development 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: 

a simple problem

Former Member
0 Kudos
66

i want to put validation checks that if the 3 select-options on my selection screen in combination does not match from the database table content, then it should give pop the message..............also when one of the fields are not filled.

PLZ GIVE THE SOLUTION <b>NOT IN OOABAP.</b>

Thanks & Regards

DS

7 REPLIES 7

Former Member
0 Kudos
45

hi

to validate the fields u can use the condition...

if s_fl1 or s_fl2 ors_fld3 is initial.

message............

endif.

Former Member
0 Kudos
45

Hi

Make the fields mandatory by using keyword obligatory .

select-options : s1 type x obligatory.

This will take care of displaying error message even if one parameter is not entered .

To display the error message if values are not in database table .

At selection-screen .

select from the data base table .

if not success .

display a message .

endif.

Example .

select-options : s1 type x obligatory

s2 type x obligatory

s3 type x obligatory .

At selection-screen .

select * from table into itab where X1 in S1 and x2 in S2 and X3 in s3.

if sy-subrc NE 0 .

message "text" type 'E'.

endif.

Reward points for all helpfull answer

Former Member
0 Kudos
45

Hi,

Lets say your Select-options are FIELD1, FIELD2 and FILED3

SELECT SINGLE * FORM TABLE1 where FIELD = FIELD1. " First field chacking
IF SY-SUBRC = 0.
 SELECT SINGLE * FORM TABLE2 where FIELD = FIELD2. " Second Field checking
IF SY-SUBRC = 0.
 SELECT SINGLE * FORM TABLE3 where FIELD = FIELD3. " Third Field Checking
ELSE.
 Call the funtion POPUP_TO_CONFIRM function module to give the message
ENDIF.
ENDIF.

The same thing, if any field is Blank then call the same function module to give the popup

Regards

Sudheer

Former Member
0 Kudos
45

AT-SELECTION SCREEN.

if s_matnr is intial.

  • display error

endif.

select * from vbap into table itab where vbekn in s_vbeln

and posnr in s_posnr

and matnr in s_matnr.

if sy-subrc NE 0.

  • display error

endif.

where s_vbeln , s_posnr & s_matnr are the select option.

Reward points if helpful

Former Member
0 Kudos
45

At selection-screen.

if ( s_f1 is initial ) or

( s_f2 is initial ) or

( s_f3 is initial ).

message s000 with text-001.

endif.

if ( s_f1 = 'X' ) and

( s_f2 = 'Y' ).

Messsage s000 with text-002.

endif.

etc.....

Former Member
0 Kudos
45

IF s_select1 IS NOT INITIAL.

IF s_select2 IS NOT INITIAL.

IF s_select3 IS NOT INITIAL.

SELECT SINGLE * FROM database table INTO (structure)

WHERE field1 IN s_select1 AND

field2 IN s_select2 AND

field3 IN s_select3.

IF sy-subrc <> 0.

MESSAGE 'no entries found' TYPE 'I'.

ENDIF.

ELSE.

MESSAGE 's_select3 is not filled' TYPE 'I'.

ENDIF.

ELSE.

MESSAGE 's_select2 is not filled' TYPE 'I'.

ENDIF.

ELSE.

MESSAGE 's_select 1 is not filled' TYPE 'I'.

ENDIF.

0 Kudos
45

At selection-screen. " This is the Event to check the selection screen

if ( field1 is initial ) or ( field2 is initial ) or ( field3 is initial ). "Check fields if empty

message i001 with text-001. " This will give u the pop up

endif.