on 05-31-2006 7:15 PM
Guys
I am getting a decimal number like 30.22 from SAP. I am sending it to a flat file. Now I have a format for the flat file like 5S2 which means 5 total and the last two is decimal part. Also I dont want decimal point in the output. So my output should be 03022. But I am unable to fulfill this as my output? If I use "FormatNum" in airthmetic functions and if I specify it as 00000 then I am able to get 00030. But instead of this I should get 03022. Can any of you guys help me out?
Regards,
---Satish
Hi Satish,
supposing your number always has a max number of 2 decimal places, you could multiply it by 100 before executing the FormatNum. Then you should get your desired output.
For numbers without decimal places, it would generate additional 0s, which should be correct assuming your flat file works with fixed length.
Regards
Christine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Satish,
you could always write your own user defined function to make it happen. You would have to replace the "." and add leading and trailing zeros if necessary. That should be fairly simple to do in Java.
Just out of curiosity: how will your receiving system recognize how many digits are decimal places? Is there some fixed length to the numbers in the target file?
Regards
Christine
> Christine
>
> I believe your solution would definitely work if I
> have 2 decimal places only. But I may have 2 or 3 or
> 4. So in this situation I think what you have told
> will not work. Is there any process to how to resolve
> this issue?
>
> ---Satish
Satish,
but if I understanded correctly, the 5S2 standard also only accepts 2 decimal positions, isn't it so? How does 3.457 is represented in 5S2? Isn't it 00345?
If that's the case, then the answer that Christine provided satisfies your needs.
Christine
Now it is fine. I have confirmed from functional guys that since it is only 2decimals 9S2 the solution what you have given works for me. The decimal will not vary since 9S2 and suppose even though it varies say 9S3 then I will multiply with 1000 instead of 100.
After your question only I was curious and went to find out from functional guys. I have not got that into my mind when I was working.
Anyway my thanks to you and pinto for your prompt responses.
Regards,
---Satish
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.