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

leave list-processing

Former Member
0 Likes
3,113

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?

13 REPLIES 13
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,832

Hi

Using selection-screen output .

Regards,

Sree

Read only

Former Member
0 Likes
1,832

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

Read only

Former Member
0 Likes
1,832

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

Read only

Former Member
0 Likes
1,832

Hi,

You need to check the data in the AT SELECTION-SCREEN and give the error message,

Regards

Sudheer

Read only

0 Likes
1,832

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.

Read only

0 Likes
1,832

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.......

Read only

0 Likes
1,832

Hi,

Try using information message and then try leave list-processing.

Message i000.

leave list-processing.

Read only

Former Member
0 Likes
1,832

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.

Read only

Former Member
0 Likes
1,832

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

Read only

Former Member
0 Likes
1,832

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.

Read only

Former Member
0 Likes
1,832

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

Read only

Former Member
0 Likes
1,832

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..

Read only

Former Member
0 Likes
1,832

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.