‎2009 Feb 25 6:04 AM
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.
‎2009 Feb 25 6:21 AM
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
‎2009 Feb 25 6:09 AM
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.
‎2009 Feb 25 6:19 AM
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.
‎2009 Feb 25 6:25 AM
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
‎2009 Feb 25 6:27 AM
Hi,
The values are coming from internal table, by the way where you are entering range.
Thanks,
Srilakshmi.
‎2009 Feb 25 6:21 AM
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
‎2009 Feb 25 6:26 AM
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.
‎2009 Feb 25 6:31 AM
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
‎2009 Feb 25 6:43 AM
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.