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

Uploading a file

Former Member
0 Likes
535

How can i upload a txt file in which fields are seperated by pipe symbol ( | ) , into the database using GUI_UPLOAD or some other function module?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

Hi,

You can upload the file usnig GUI_UPLOAD with filetype as ASC and field_seprator as space. For this you need to take the internal table as Char of 1000 (which is per your requirement).

loop at table and using SPLIT statement you can split the string at pipe '|' in to internal table. check the help on SPLIT statement.

How can i upload a txt file in which fields are seperated by pipe symbol ( | ) , into the database using GUI_UPLOAD or some other function module?

3 REPLIES 3
Read only

Former Member
0 Likes
506

The FM GUI_UPLOAD can identity only a tab separator or no separator. If your txt file has | separator, then do onething. Open the txt file go to menu edit and select replace. Here in find field give | and replace field give 5spaces then click replace all. This will replace all | symbols into tab. Now u can use FM GUI_UPLOAD with parameter HAS_FIELD_SEPARATOR = 'X'.

Read only

Former Member
0 Likes
507

Hi,

You can upload the file usnig GUI_UPLOAD with filetype as ASC and field_seprator as space. For this you need to take the internal table as Char of 1000 (which is per your requirement).

loop at table and using SPLIT statement you can split the string at pipe '|' in to internal table. check the help on SPLIT statement.

Read only

Former Member
0 Likes
506

you can use method also

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = pa_cnfg

filetype = 'ASC'

CHANGING

data_tab = gt_file1

EXCEPTIONS

file_open_error = 1

the file format is

0000263764|005000|0000036122

0000266053|005000|0000034790

0000267268|005000|0000036051

0000267962|005000|0000034792

0000268248|005000|0000038958

0000270838|005000|0000044025