‎2007 Mar 28 4:32 AM
Hi All,
I am having a string which contains a numeric value . I want to check whether that value is greater than 1000 or not.
Actully I am having a problem like in our server , whenever the amount value is in currency EURO, the ',' in the amount gets replaced by ' . ' and ' . ' gets replaced by ' , '. Now I am trying to replace that ' , ' by ' . ' and ' . ' by ' , ' .
I tried like this
IF STRING GE '1000'.
But its not working.
Now I have to check if the amount value is greater that 1000 or not .
Please suggest the way to do it.
Thanks a lot.
‎2007 Mar 28 4:37 AM
Try
WRITE <source> TO <target> CURRENCY <Currency>.
reward points if helpful.
‎2007 Mar 28 4:43 AM
Hi Rahul,
IF STRING GE '1000'. it is wrong statement,
Try this INT = STRLEN(<string name>).
IF INT > 1000.
-
ENDIF.
Hope this helps you, reply for queries, Shall post you the updates.
Regards.
Kumar. .
‎2007 Mar 28 4:44 AM
Hi Rahul,
data: value type p.
write string to value.
if value > 1000.
****
endif.
hope this helps,
keerthi
‎2007 Mar 28 5:04 AM
hi...
try this.
data: w_amt(4) type n.
w_amt = string. * which is havng amt..
(numc will not take characters )
now..compare
if w_amt > 1000.
endif.
then it works...
‎2007 Mar 28 5:26 AM
Hi All,
Thanks for all your replies but nothing is working , I am posting the code now
Please tell what can be done to remove the error.
The code which is giving error is in bold.
FORM zfun_con18 TABLES in_tab STRUCTURE itcsy
output_tab STRUCTURE itcsy.
DATA : sub1 TYPE string,
sub2 TYPE ebelp,
sub3 TYPE ebeln,
amount4 TYPE netpr.
DATA : it_ekko LIKE ekko.
DATA : curr TYPE string.
DATA: value type n.
READ TABLE in_tab WITH KEY 'EKKO-EBELN'.
sub3 = in_tab-value.
SELECT SINGLE * FROM ekko INTO it_ekko WHERE ebeln = sub3.
READ TABLE in_tab WITH KEY 'EKPO-NETPR'.
sub1 = in_tab-value .
WRITE sub1 TO value.
<b>IF it_ekko-waers EQ 'EUR'.
IF value GT 1000.
REPLACE ',' IN sub1 WITH '.' .
REPLACE '.' IN sub1 WITH ',' .
CONDENSE sub1.
else.
replace ',' in sub1 with '.' .
CONDENSE sub1.</b>
ENDIF.
ENDIF.
‎2007 Mar 28 5:33 AM
If you are checking PO Item price is greater than 1000 or not, you can do it directly. Why do you need to convert it into string?
‎2007 Mar 28 5:36 AM
Coz I am passing the values from the script to the program and I dont think we can compare the values passed from the script to the program .
Pls correct if I am wrong.
Thanks
‎2007 Mar 28 5:39 AM
I am not clear with your requirement. We always extract values in driver program and pass these values to script to display in the layout.
What is your requirement?
BTW REPLACE syntax is
REPLACE ',' WITH '.' INTO sub1. instead of REPLACE ',' IN sub1 WITH '.' .
Message was edited by:
Ashish Gundawar
‎2007 Mar 28 5:41 AM
‎2007 Mar 28 5:42 AM
Actully my requirement is to pass the amount value to the program from the script , check whether this value is greater than 1000, if yes then replace , with . and . with , otherwise keep the value as it is.
‎2007 Mar 28 5:48 AM
BTW REPLACE syntax is
REPLACE ',' WITH '.' INTO sub1. instead of REPLACE ',' IN sub1 WITH '.' .
‎2007 Mar 28 6:07 AM
just check this code
data : text(10) type c value '1,000,200'.
replace all occurrences of ',' in text with ''.
if text gt '1000000'.
write : / 'hi'.
endif.
regards
shiba dutta