2013 Mar 20 4:52 PM
Hi All,
Can you please advise me , how can i compare alphanumeric value.
I have a table entry where postalcode-from = DA1 0AA and postalcode-to =DA9 0ZZ. I want to select value in between these two value.For example i want to select DA2 0AA.
My select query below.
v_input = DA2 0AA.
SELECT SINGLE transpzone FROM yoet_tpzone_map
* INTO x_tptzone-transpzone
* WHERE country = <fs_country> AND ( POSTALCODE_FROM LE v_input AND POSTALCODE_TO GE v_input).
Here its selecting for value DA2 0AA.
Please advise me some logic for this.
Thanks
Satya
2013 Mar 21 6:33 AM
Dear Satyaranjan Mohanty,
if your table have any other(apart form postalcode-from and postalcode-to) field for postalcode if it is then given logic may work
V_INPUT = DA2 0AA.
SELECT SINGLE TRANSPZONE
FROM YOET_TPZONE_MAP
INTO X_TPTZONE-TRANSPZONE
WHERE COUNTRY = <FS_COUNTRY>
AND POSTALCODE between 'DA1 00A' and 'DA9 0ZZ'.
if you don't have that extra field POSTALCODE then the code you are write is the right one only .
if you not get output, in that case you have to fetch data related to country specific first and then you have break postal code and compare character and numeric fields seperatly.
2013 Mar 21 3:54 AM
Dear Satyaranjan Mohanty,
Please read the documentation about select options and ranges and try to use them in your select query.
Define a select option without display or a range for your required variable, set the fields SIGN, OPTION, LOW and HIGH as required and then tuse in select query using th IN addition in where clause. In your case the following should be the values:
SIGN = 'I'
OPTION = 'BT'
LOW = DA1 0AA
HIGH = DA9 0ZZ
Regards,
Kartik
2013 Mar 21 5:44 AM
Hi Satyaranjan,
Try this below statement
v_input_low = DA1 0AA.
v_input_high = DA9 0ZZ.
SELECT SINGLE transpzone FROM yoet_tpzone_map
INTO x_tptzone-transpzone
WHERE country = <fs_country> AND
( POSTALCODE_FROM BETWEEN v_input_low AND v_input_high).
This query will select the values between range specified in v_input_low and v_input_high.
2013 Mar 21 5:54 AM
Hi,
Please try this:
select single transpzone from yoet_tpzone_map
into....
where country = <fs_country> and postal code between 'DA1 00A' and 'DA9 0ZZ'.
Regards
Purnand
2013 Mar 21 6:33 AM
Dear Satyaranjan Mohanty,
if your table have any other(apart form postalcode-from and postalcode-to) field for postalcode if it is then given logic may work
V_INPUT = DA2 0AA.
SELECT SINGLE TRANSPZONE
FROM YOET_TPZONE_MAP
INTO X_TPTZONE-TRANSPZONE
WHERE COUNTRY = <FS_COUNTRY>
AND POSTALCODE between 'DA1 00A' and 'DA9 0ZZ'.
if you don't have that extra field POSTALCODE then the code you are write is the right one only .
if you not get output, in that case you have to fetch data related to country specific first and then you have break postal code and compare character and numeric fields seperatly.
2013 Mar 21 7:35 AM
Hi,
You can write a select query using LIKE statement
SELECT SINGLE transpzone FROM yoet_tpzone_map
INTO x_tptzone-transpzone
WHERE country = <fs_country> AND
POSTALCODE LIKE 'DA%'.
Hope this helps.
Thanks,
Tooshar Bendale
2013 Mar 21 8:44 AM
Just read again your code, and try to understand the effect of coding
POSTALCODE_FROM LE v_input AND POSTALCODE_TO GE v_input
very (very) similar to
POSTALCODE_EQ LE v_input
As already written, either define two parameter / fields for low and high values or define a RANGE / SELECT-OPTIONS.
Regards,
Raymond