Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

comma seperated file uploading

Former Member
0 Likes
1,968

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.

1 ACCEPTED SOLUTION
Read only

viquar_iqbal
Active Contributor
0 Likes
1,879

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.

9 REPLIES 9
Read only

viquar_iqbal
Active Contributor
0 Likes
1,880

Hi

you need to give a value for HAS_FIELD_SEPARATOR in the function module gui_upload

example HAS_FIELD_SEPARATOR = 'X'

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,879

Hello,

Plz see the post for details: [Upload Comma Separated File|;

HAS_FIELD_SEPARATOR only works for tab-delimited files only !!

BR,

Suhas

Read only

Former Member
0 Likes
1,879

This message was moderated.

Read only

former_member404244
Active Contributor
0 Likes
1,879

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

Read only

Former Member
0 Likes
1,879

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

Read only

Former Member
0 Likes
1,879

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

Read only

former_member404244
Active Contributor
0 Likes
1,879

Hi,

also check the FM 'KCD_CSV_FILE_TO_INTERN_CONVERT'.

Regards,

Nagaraj

Read only

awin_prabhu
Active Contributor
0 Likes
1,879

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....

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,879

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.