‎2008 Jan 09 9:27 AM
Hello,
I am reading data from an excel sheet into a Function Module. In the excel sheet, when i enter 1000, it gets converted into 1,000.00 since its an amount value. This value is being stored in the function mdoule into an internal table (itab) that has a field 'Value' of type C (Length - 60).
In the FM, i defined a variable 'amt' of data type P.
amt = itab-value.
When i executed the Function Moule, i get a short dump saying 'Unable to interpret '1,000.00' as a number'. How to overcome this issue?
Please suggest.
Thanks
‎2008 Jan 09 9:35 AM
Hi sachin,
We can make that filed as currency type(CURR) ok..
or we make them declare like this
data: begin of itab occurs 0,
net like vbap-netpr,
end of itab.
Here netpr is of type CURR.
Award points if hellpful.
Kiran Kumar.G.A
‎2008 Jan 09 9:35 AM
Hi sachin,
We can make that filed as currency type(CURR) ok..
or we make them declare like this
data: begin of itab occurs 0,
net like vbap-netpr,
end of itab.
Here netpr is of type CURR.
Award points if hellpful.
Kiran Kumar.G.A
‎2008 Jan 09 10:57 AM
Hi,
make the below settings for that field column in you Excel sheet and then try.
selecte the entire column in you excel sheet.
1) right click on the header of that column. choose 'Format cells' option.
2) under the 'number' tab go to 'catagory' list box, select the 'Custom' option.
3) in right side you can find 'Type' list box, select '0' from that list box.
4) immediately above to that list box, you can find one text box (under 'Type' only).
5) there enter as many zeros as of field size, click 'OK' button, and save it.
try to read the data from your excel sheet and then try.
Reward if useful.
Thanks,
Ashok.
Reward if useful.
Thanks,
Ashok.
Edited by: Ashok Kumar P on Jan 9, 2008 5:29 PM
‎2008 Jan 09 11:03 AM
Hello Sachin,
Is that you read data from an excel file directly into your FM?
After reading the data from the excel file, try converting the character value to a packed decimal format. Then move that value into your amount field.
Use this FM to convert the char value to a Packed or Float value. OIU_ME_CHAR_TO_NUMBER
Pass itab-value to FM - OIU_ME_CHAR_TO_NUMBER and get the packed digit number. Use that into your amt field.
Hope dump would not come any more on this issue.
Award me points if useful!
Thanks,
Ananth
‎2008 Jan 09 11:17 AM
Hi Sachin,
Can you please tel me which Function Module you are using to read data from excel so that I can check.
‎2008 Jan 09 7:37 PM
Hello Guys,
Thanks for your replies. I solved the issue.
This is what i did.
*Before these, itab-value has 1,000.00
REPLACE ',' WITH '' INTO itab-value.
The output is: 1 000.00
CONDENSE itab-value NO-GAPS.
The output is: 1000.00
amt = itab-value.
The output is: 1000.00
Thanks