09-08-2008 12:34 PM
Hi,
i have 2 variables consisting of type character.
i have to substract those two variables.
though their type is character they have the numbers.
i have to substract them or convert them into currency and substract them.
can any one tell me the procedure.
09-08-2008 12:38 PM
Hi
DATA :
w_n(3) type c VALUE '4.1',
w_n1(3) TYPE c VALUE '3.4',
w_c TYPE p DECIMALS 2.
w_c = w_n - w_n1.
WRITE :
w_c.
regards
Pavan
09-08-2008 12:39 PM
Thank for the reply.
its going to dump if we do as you suggested.
we tried it.
09-08-2008 12:40 PM
Hi
Its working fine in my system check whether you have checked UNICODE CHECKS ACTIVE and FIXED POINT ARITHMETIC in program attributes
regards
pavan
09-08-2008 12:39 PM
09-08-2008 12:45 PM
hii
you can use following code too
DATA :
w_val1(3) type c VALUE '40',
w_val2(3) TYPE c VALUE '10',
w_val11 type p decimals 2,
w_val22 type p decimals 2,
w_result(10) TYPE c.
w_val11 = w_val1.
w_val22 = w_val2.
w_result = w_val11 - w_val22.
WRITE :
w_result.
regards
twinkal
09-08-2008 12:53 PM
As also said by others it should work this way:
Data:
char1(5),
char2(5),
char3(5).
char1 = '30.60'.
char2 = '25.40'.
char3 = char1 - char2.
Write:
char3.
With luck,
Pritam.
09-08-2008 12:56 PM
Hi,
Check the code below.
It is working fine.
DATA :
w_n(3) type c VALUE '4.1',
w_n1(3) TYPE c VALUE '3.4',
w_c TYPE p DECIMALS 2.
w_c = w_n - w_n1.
WRITE :
w_c.