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

Display error message

Former Member
0 Likes
1,203

Hi,

In my scenario if a give a single value as i/p the values are fetched from the select query and if the codn is not satisfied it will throw error message.Consider if I give range of values if the 1st entry alone doesnu2019t satisfy the codn if must skip it without displaying error message and proceed to next.How to do so?See the code below.Looping is done in some other place so i cant loop here.

select fields from ekpo into gi_table where some codn.

if sy-subrc NE 0.

error message.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
952

Hi Divya

since your condition is a range,say select-option ,system will search for the entries in that given range.

Here the particular low range or high range is not considered ,insted the whole range is considered.

Try this code.

tables ekpo.
select-option s_ebeln for ekpo-ebeln.
select * from ekpo into table gi_table where ebeln in s_ebeln.
If sy-subrc ne 0.

message type 'E' text-001.
endif.

Kindly dont forget to close the thread.Regards

Hareesh

Edited by: Hareesh Menon on Feb 25, 2009 7:24 AM

8 REPLIES 8
Read only

Former Member
0 Likes
952

Hi,

Can u write your complete select query with the where clause conditions so that it will be easy to solve ur problem.

Thanks,

Srilakshmi.

Read only

0 Likes
952

Hi,

This is the code

IF gi_ekpo_dtls[] IS NOT INITIAL.

SELECT ebeln ebelp pstyp knttp

FROM ekpo

INTO TABLE gi_ekpo

FOR ALL ENTRIES IN gi_ekpo_dtls

WHERE ebeln = gi_ekpo_dtls-ebeln

AND ebelp = gi_ekpo_dtls-ebelp

AND pstyp = '9'.

IF sy-subrc NE 0.

error message.

ENDIF.

endif.

this code works only if one entry is entry .If i enter range of values and if the 1st value doesnt satisfy the codn its throwing error message and not proceeding to next message.

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
952

Hi,

U can try this:

IF gi_ekpo_dtls[] IS NOT INITIAL.

SELECT ebeln ebelp pstyp knttp

FROM ekpo

INTO TABLE gi_ekpo

FOR ALL ENTRIES IN gi_ekpo_dtls

WHERE ebeln = gi_ekpo_dtls-ebeln

AND ebelp = gi_ekpo_dtls-ebelp

AND pstyp = '9'.

endif.

IF gi_ekpo[] IS INIRIAL.

error message.

ENDIF.

Try giving the error msg after the ENDIF.

Keerthi.

Edited by: Keerthy K on Feb 25, 2009 7:30 AM

Read only

0 Likes
952

Hi,

The values are coming from internal table, by the way where you are entering range.

Thanks,

Srilakshmi.

Read only

Former Member
0 Likes
953

Hi Divya

since your condition is a range,say select-option ,system will search for the entries in that given range.

Here the particular low range or high range is not considered ,insted the whole range is considered.

Try this code.

tables ekpo.
select-option s_ebeln for ekpo-ebeln.
select * from ekpo into table gi_table where ebeln in s_ebeln.
If sy-subrc ne 0.

message type 'E' text-001.
endif.

Kindly dont forget to close the thread.Regards

Hareesh

Edited by: Hareesh Menon on Feb 25, 2009 7:24 AM

Read only

JoffyJohn
Active Contributor
0 Likes
952

In my scenario if a give a single value as i/p the values are fetched from the select query and if the codn is not satisfied it will throw error message.Consider if I give range of values if the 1st entry alone doesnu2019t satisfy the codn if must skip it without displaying error message and proceed to next.How to do so?See the code below.Looping is done in some other place so i cant loop here.

declare s_ebeln as ranges.

select fields from ekpo into gi_table where ebeln in s_ebeln.

if sy-subrc NE 0.

error message.

endif.

Read only

Former Member
0 Likes
952

Hi ,

Try this code -


IF gi_ekpo_dtls[] IS NOT INITIAL.
SELECT ebeln ebelp pstyp knttp 
FROM ekpo
INTO TABLE gi_ekpo
FOR ALL ENTRIES IN gi_ekpo_dtls
WHERE ( ebeln = gi_ekpo_dtls-ebeln
AND ebelp = gi_ekpo_dtls-ebelp
AND pstyp = '9' ) or ( ebelp = gi_ekpo_dtls-ebelp
AND pstyp = '9'. ) or ( pstyp = '9'. ) .
IF sy-subrc NE 0 .
error message.
ENDIF.
endif.

Regards

Pinaki

Read only

kamesh_g
Contributor
0 Likes
952

HI

for this u have to use select options in Where condition of select statement .

if sy-subrc ne 0 and <ur select option>-high is initial.

error message .

endif.

for range dont give meesge.