2009 Feb 09 10:50 AM
Hi ,
i want to upload comma seperated file into sap.
iam using 'GUI_UPLOAD' fm.
problem is flat file currency field it is also contains comma.
i can't change file type comma to tab.
How can i upload currency fields with comma.
Regards,
Suresh.
2009 Feb 09 10:54 AM
Hi
you need to give a value for HAS_FIELD_SEPARATOR in the function module gui_upload
example HAS_FIELD_SEPARATOR = 'X'
Hi ,
i want to upload comma seperated file into sap.
iam using 'GUI_UPLOAD' fm.
problem is flat file currency field it is also contains comma.
i can't change file type comma to tab.
How can i upload currency fields with comma.
Regards,
Suresh.
2009 Feb 09 10:54 AM
Hi
you need to give a value for HAS_FIELD_SEPARATOR in the function module gui_upload
example HAS_FIELD_SEPARATOR = 'X'
2009 Feb 09 11:01 AM
2009 Feb 09 11:01 AM
2009 Feb 09 11:05 AM
Hi Suresh,
do like this
call function 'GUI_UPLOAD'
exporting
filename = <specify ur file>
filetype = 'ASC'
tables
data_tab = itab.
now u have to loop the internal table
loop at itab.
split itab at ',' into itab1-fld1 itab1-fld2 itab1-fld3.
itab2-fld1 = itab1-fld1 .
itab2-fld2 = itab1-fld2.
append itab2.
clear : itab,
itab1,
itab2.
endloop.
P.S->HAS_FIELD_SEPARATOR will work only for tab delimeted.
Regards,
Nagaraj
2009 Feb 09 11:08 AM
Hi Suresh ,
If it is possible change that comma seperated file to tab seperated file and
make that interface parameter as follows -
HAS_FIELD_SEPARATOR = 'X'
It will work.
Regards
Pinaki
2009 Feb 09 11:15 AM
You have 2 options :
1. Ask the source system guys to unpack the the currency amount as a single string without the thousand separater and then store it in the file
2. Upload the currency field into 2 parts (fields) first part having the thousand sepearator value and the second part having the reamaining value. Once the data is uploaded to the fields, concatenate the 2
parts.
Example : 1,564 is uploaded as 1 in the first field f1 and 564 in f2 , then concatenate f1 and f2 will give you 1564.
regards,
Advait
2009 Feb 09 11:38 AM
Hi,
also check the FM 'KCD_CSV_FILE_TO_INTERN_CONVERT'.
Regards,
Nagaraj
2009 Feb 09 12:53 PM
Hi friend,
After uploading data into internal table,
Remove all commas and replace by space using 'Translate' except currency field.
For ex:
loop at g_t_out into g_r_wa.
TRANSLATE g_r_wa-matnr USING ', ' .
TRANSLATE g_r_wa-matnr USING ', ' .
(Donot translate in currency field.)
endloop.
Might be helpful...
Thanks....
2009 Feb 09 1:18 PM
You can upload your file into a string table. Now split it:
split uploadtab at ',' into table items.
if you have
a,b,c,11,d,e,f
your tables items contains 7 elements now.
if you have
a,b,c,11,22,d,e,f
your table contains 8 elements now. In that case you now that you have splitted a number with a comma and need to do some actions, e.g. merge elements 4 and 5 together to get 11,22 again and shift the 6th to 5th, the 7th to 5th and the 8th to 7th element.
After that you number is again in item 4.
An easier way is to enforce you customer to put values into apostrophes or quotes. If this is not possible, you have to check if an unwanted split was taken in place and act as shown above.
But: this will work only if one item with a comma in between. If oyu have more components you can not evaulate where the unwanted split is in effect.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |