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

selection screen validations

Former Member
0 Likes
724

hi,

please tell me how io write code for screen validation.

i have vendor number (LFB1-LIFNR) and bukrs (LFB1-BUKRS) IN SELECTION SCREEN this are select options.

if we enter incorrect vendor it need to display invald vendor and for bukrs invalid company code..

do we need to create message for it . please explain how to write,

and if no data found for that company code and vendor.

it need to display no data found.

its urgent.

please help.

5 REPLIES 5
Read only

Former Member
0 Likes
632

Hi,

write those in between chain and endchain if error comes throw error msg..

then these fileds will still be open for input..

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:38 PM

Read only

Former Member
0 Likes
632

Hi,

at selection-screen.

select LIFNR

from LFB1

into table

where lifnr in s_lifnr.

if sy-subrc ne 0.

message e888(sabapdocu) with 'no number found'.

endif.

in this way u can write the select query.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:38 PM

Read only

Former Member
0 Likes
632

Hi Try this format..

Ex:

selection-screen begin of block b1.

parameters: p_datum1 type sy-datum,

p_datum2 type sy-datum.

selection-screen end of block b1.

at selection-screen on block b1.

if p_datum1 is initial

and p_datum2 is initial.

message e001(00) with 'Enter at least one date'.

endif.

in se91 T-Code you can create message and that number you can use after

Message

command.

Regards,

Ramesh.

Read only

Former Member
0 Likes
632

let s_vendor and s_burks be those 2 sel-options

tables: lfa1,t001.

at selection-SCREEN on s_vendor.
select * from lfa1 where lifnr = s_vendor.
if sy-subrc is not initial.
message.................
endif.

at selection-SCREEN on s_burks.
select * from t001 where burks = s_burks.
if sy-subrc is not initial.
message.................
endif.

Read only

Former Member
0 Likes
632

Hi Dude,

You should use the AT SELECTION-SCREEN event.

AT SELECTION-SCREEN.

if s_lifnr not in ('0001',.......).

message E100 with s_lifnr.

endif.

if s_bukrs not in ('1000',....).

message E101 with s_bukrs.

endif.

select * from lfb1

into table it_lfb1

where lifnr = s_lifnr and

bukrs = s_bukrs.

if sy-subrc <> 0.

MESSAGE I102 with s_lifnr s_bukrs.

endif.

see these validations check for the value to be in a specific

set of alternatives.If the values' attributes doesn't match the

variables' attributes then the system will automaticlly generate a message.

To issue messages you shoud add the message-class addition to the report statement as below,

report zxxxxxxxx message-class zmsgxxx.

double click on the zmsgxxx and

write messages as

msg-no desc.,

100 & not a valid vendor

101 & not a valid company code

102 No records found for vendor & and company

code &.

The ampersands are place holders for values.

They are specified at run-time with the 'WITH' addition.

eg., with s_lifnr.

the E & I before the message nos denote the message types

which decided the time or place of message issual.

If any clearance needed please share it.

<REMOVED BY MODERATOR>

Regards,

Lakshmanan

Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:40 PM