Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query about GUI_UPLOAD

Hi All,

I am really sorry but this is a basic question and i need help immediately.

In my local file i have ';' as field seperator. How should I get the data properly. A little example would be fine and appreciated.

Thanks,

Jignesh

Tags:
Former Member
Former Member replied

Hi jignesh,

1. Exactly for this purpose,

i have developed an <b>independent FORM</b>

where we give inputs

a) file name (eg. abcd.txt)

b) separator (eg ; in your case)

c) internal table (eg. t001)

2. It will provide the data

in proper format

<b>(no matter what the separator)

(it can work with any kind of separator)</b>

3. just copy paste in new program.

REPORT abc.

*----


*----


change your table declaration and file name

*----


DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

PERFORM myupload TABLES t001 USING 'd:\t001.txt' ';'.

BREAK-POINT.

*----


in debug see t001

*----


  • INDEPENDENT FORM

*----


FORM myupload TABLES orgtab

USING filename separator.

*----


Data

DATA : BEGIN OF itab OCCURS 0,

myline(1000) TYPE c,

END OF itab.

DATA : extension(5) TYPE c.

DATA : name(100) TYPE c.

DATA : newfilename TYPE string.

*----


Step 1

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

TABLES

data_tab = itab.

*----


Step 2

LOOP AT itab.

REPLACE ALL OCCURRENCES OF separator IN itab-myline WITH

cl_abap_char_utilities=>horizontal_tab.

MODIFY itab.

ENDLOOP.

*----


Step 3

DATA : path LIKE pcfile-path.

path = filename.

CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'

EXPORTING

complete_filename = path

  • CHECK_DOS_FORMAT =

IMPORTING

  • DRIVE =

extension = extension

name = name

  • NAME_WITH_EXT =

  • PATH =

EXCEPTIONS

invalid_drive = 1

invalid_extension = 2

invalid_name = 3

invalid_path = 4

OTHERS = 5

.

*----


Step 4

newfilename = filename.

REPLACE name IN newfilename WITH 'temp'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = newfilename

TABLES

data_tab = itab

  • FIELDNAMES =

.

*----


Step 5

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = newfilename

has_field_separator = 'X'

TABLES

data_tab = orgtab.

ENDFORM. "myupload

regards,

amit m.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question