Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9159

Re: Any Function Module to convert from string to Packed Decimal.

$
0
0

Hi Dhinesh,

Here in the string Negative sign comes inbetween the value looks like the below.

 

15-.00

 

  • First replace the sign to the front as shown below.

 

Ex:

data Str_value type string value "15-.00".

data dec_value type p decimals 2.

 

"Check whether negative sign in the variable

if str_value CA '-'.

 

     "Replace Negative sign

     REPLACE ALL OCCURRENCES OF '-' IN str_value WITH ``.

   

     "Add the sign value into the first place

     concatenate '-' str_value into str_value.

endif.

Output

-15.00

 

  • And then convert the string to Decimal value

"Remove Empty space

condense str_value.

 

"Convert the value

dec_value = str_value.

 

 

Regards

 

Rajkumar.


Viewing all articles
Browse latest Browse all 9159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>