‎2005 Dec 28 9:26 AM
I am doing a upload from excel file using FM 'ALSM_EXCEL_TO_INTERNAL_TABLE'. In this there are several currency fields. i am populating the values of excel into an itab of char type.
when i am trying to convert the char type to currency type it is going to dump.
i had declared my currency field of domain WERTV8.
while debugging i observed that amount '9,000.00' is not converted to amount type.
in dump i got a message saying: " unable to interpret '9,000.00' as number.
i had used 'move' stmt for conversion of c type to amount.
hope my problem is clear to you.
‎2005 Dec 28 9:34 AM
Hi Ateeq,
You should use conversion exit insted of moving directly.
for converting use this FM HRCM_STRING_TO_AMOUNT_CONVERT
pass your currency, decimal separator asa '.' and thousand separator as ',' it will give you the correct(converted) value.
regards
vijay
Message was edited by: Vijay Babu Dudla
‎2005 Dec 28 9:30 AM
Hi,
I suggest you to use FM 'GUI_UPLOAD' instead of 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
Or use the following Bapi's for conversion
BAPI_CURRENCY_CONV_TO_EXTERNAL
BAPI_CURRENCY_CONV_TO_EXTERN_9
BAPI_CURRENCY_CONV_TO_INTERNAL
BAPI_CURRENCY_CONV_TO_INTERN_9
Hope it helps...
Lokesh.
Pls. reward appropriate points
‎2005 Dec 28 9:32 AM
Hi
You have to delete the , from your char number, it has always this format: '9000.00'
So
CHAR_NUMBER = '9,000.00'.
REPLACE ',' WITH SAPCE INTO CHAR_NUMBER.
CONDENSE CHAR_NUMBER.
MOVE CHAR_NUMBER TO WERTV8.
Max
‎2005 Dec 28 9:34 AM
Hi Ateeq,
You should use conversion exit insted of moving directly.
for converting use this FM HRCM_STRING_TO_AMOUNT_CONVERT
pass your currency, decimal separator asa '.' and thousand separator as ',' it will give you the correct(converted) value.
regards
vijay
Message was edited by: Vijay Babu Dudla
‎2005 Dec 28 9:36 AM
Hi,
Try using 'KCD_EXCEL_OLE_TO_INT_CONVERT'.Kindly reward points by clicking the star on the left of reply,if it helps.
DATA : lt_intern TYPE STANDARD TABLE OF kcde_cells WITH HEADER LINE.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = p_scol
i_begin_row = p_srow
i_end_col = p_ecol
i_end_row = p_erow
TABLES
intern = lt_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ text-004."Error Uploading file or Path Not Found.
EXIT.
ENDIF.
‎2005 Dec 28 10:05 AM
Hi Ateeq,
1. As already suggested,
we can REPLACE comma with ''
(Because COMMA is creating the main problem,
the string having comma cannot be
converted to number )
2. try this code (just copy paste)
Try with/without commenting REPLACE statement.
REPORT abc.
DATA : cr TYPE wertv8.
DATA : s(20) TYPE c.
s = '9,000.00'.
*----
If we don't use replace, error
REPLACE ',' IN s WITH ''.
cr = s.
WRITE : s , cr.
Regards,
Amit M.
‎2005 Dec 28 10:56 AM
Hi take one local vairable whose type is of any currency field.
then use the write to statement and
write value to local_variable.
then use this local_variable in ur program.
satish