‎2008 Feb 14 11:03 AM
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.
‎2008 Feb 14 11:06 AM
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
‎2008 Feb 14 11:12 AM
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
‎2008 Feb 14 11:12 AM
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.
‎2008 Feb 14 11:15 AM
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.
‎2008 Feb 14 11:30 AM
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