‎2007 Jun 05 8:45 AM
Hi Experts,
I have a selection-screen with two parameters.
I have to select records from a data base table having keys as these two parameters. If no records are found it should give an error message on the selection-screen itself with out going to the list. Prevention of list display is made possible using leave list-processing. How can i give an error message in the selection screen itself?
‎2007 Jun 05 8:47 AM
‎2007 Jun 05 8:49 AM
Hello,
Do like this:
AT SELECTION-SCREEN.
Select single * from table where key1 = p1
and key2 = p2.
if sy-subrc ne 0." Check here
error Message.
endif.
REgards,
Vasanth
‎2007 Jun 05 8:49 AM
hi
write the error message in at selection-screen...it will not trigger list
at selection-screen.
select single * from qals where prueflos eq p_lot and werk eq p_werks.
if sy-subrc ne 0.
message 'Error'.
endif.
if helpful, reward
Sathish. R
‎2007 Jun 05 8:52 AM
Hi,
You need to check the data in the AT SELECTION-SCREEN and give the error message,
Regards
Sudheer
‎2007 Jun 05 9:17 AM
if entries are there it should display the list. otherwise it should trigger an error message at the selection-screen itself. therefore i have to write the select query in at start-of-selection itself . if sy-subrc <> 0. leave list-processing is used. My question is how can i give the error message at the selection-screen itself if sy-subrc <> 0.
‎2007 Jun 05 9:21 AM
Hi
After The selection write like this....
select ......from dbtab into itab.
if sy-subrc <> 0.
message e000(001) with 'No Data has been Selected.
else.
do your processing.........
Reward All Helpfull Answers.......
‎2007 Jun 05 10:31 AM
Hi,
Try using information message and then try leave list-processing.
Message i000.
leave list-processing.
‎2007 Jun 05 9:24 AM
If sy-subrc <> 0.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
IF SY-UCOMM = 'EXEC'.
SET PF-STATUS 'STATUS_100'.
WRITE: No records found.
‎2007 Jun 05 9:27 AM
Hi
Try to define parameters like
Parameters: P_matnr like mara-matnr value-check..
Or else use
AT SELECTION-SCREEN.
Select single * from table where <condition>.
if sy-subrc ne 0.
Show the messages
Submit sy-cprog via selection-screen.
endif
Hope this will solve ur problem
Reward me if its helpful
Regards
Ravi
‎2007 Jun 05 9:41 AM
Hi soumya,
1. We cannot give any message, in the selection screen itself, by defining it.
2. We can use like this.
If error condition.
<b>Message 'No records found' type 'I'</b>
LEAVE LIST-PROCESSING.
ENDIF.
<b>Note : Message should be of type I,W etc. (but not E)</b>
regards,
amit m.
‎2007 Jun 05 9:41 AM
Hi Soumya,
Check if the following code meets your requirement.
data : mara type table of mara with header line.
start-of-selection.
select * from mara into table mara where matnr like '%(*&1'.
if sy-subrc <> 0.
message e000(zam)." with 'No Data has been Selected.
else.
loop at mara.
write : mara-matnr.
endloop.
endif.Regards
Anil Madhavan
‎2007 Jun 05 10:18 AM
Hi soumya jose,
This is a validation and needs to be done if any of the (a) selection criterion is not used if mandatory or to (b) check for the values returned as per the selection criterion.
(a): ----
AT SELECTION-SCREEN *
----
AT SELECTION-SCREEN.
IF p_file IS INITIAL.
MESSAGE text-001 TYPE 'E'.
ENDIF.
Here if the field p_file which is of type parameters is empty then it reports a message of type error at the selection screen itself.
(b): (1) AT SELECTION-SCREEN.
if it_table is intial.
MESSAGE text-001 TYPE 'E'.
endif.
(2) even the sy-subrc needs to be checked and handled similarly.
Reward points if useful.
Thanks,
Tej..
‎2007 Jun 05 10:30 AM
hai,
write
at selection second parameter.
in that only write the select query if no records r found then
write e001.
i.e write a message of type e. so that error message will be thrown instead of list.
i hope u can understand what i am saying.