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

FM GUI_UPLOAD

Former Member
0 Likes
945

Hi people!

I have a .txt file that contains 3 fields separeted by ';' in 5 lines:

aaa;bbb;ccc

ddd;eee;fff

ggg;hhh;iii

jjj;kkk;lll

mmm;nnn;ooo

I'm trying to upload this file into a itab using the parameter has_field_separator = 'X' in FM GUI_UPLOAD... but it is not working the table contains only:

aaa

bbb

ccc

Do you have any documentation about GUI_UPLOAD or do you can help me?????

thanks in advance!

Gabriel

Hi people!

I have a .txt file that contains 3 fields separeted by ';' in 5 lines:

aaa;bbb;ccc

ddd;eee;fff

ggg;hhh;iii

jjj;kkk;lll

mmm;nnn;ooo

I'm trying to upload this file into a itab using the parameter has_field_separator = 'X' in FM GUI_UPLOAD... but it is not working the table contains only:

aaa

bbb

ccc

Do you have any documentation about GUI_UPLOAD or do you can help me?????

thanks in advance!

Gabriel

5 REPLIES 5
Read only

Former Member
0 Likes
819

Here's my code:

TYPES:

BEGIN OF tab_type,

cpo01(3) TYPE c,

cpo02(3) TYPE c,

cpo03(3) TYPE c,

END OF tab_type.

DATA: tabela TYPE TABLE OF tab_type.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = c:\file.txt

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = ' '

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = tabela

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

Read only

uwe_schieferstein
Active Contributor
0 Likes
819

Hello Gabriel

If you have the following function modules available in your SAP system I would recommend to use them:


- TEXT_CONVERT_TEX_TO_SAP (upload of file with variable delimiters)
- TEXT_CONVERT_CSV_TO_SAP (upload of TAB delimited file)

Regards

Uwe

Read only

0 Likes
819

HI,

try with this code.


call function 'GUI_UPLOAD'
  exporting
    filename                      = 'C:\FILE.txt'
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = '#'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  tables
    data_tab                      = tabela
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   NO_AUTHORITY                  = 6
*   UNKNOWN_ERROR                 = 7
*   BAD_DATA_FORMAT               = 8
*   HEADER_NOT_ALLOWED            = 9
*   SEPARATOR_NOT_ALLOWED         = 10
*   HEADER_TOO_LONG               = 11
*   UNKNOWN_DP_ERROR              = 12
*   ACCESS_DENIED                 = 13
*   DP_OUT_OF_MEMORY              = 14
*   DISK_FULL                     = 15
*   DP_TIMEOUT                    = 16
*   OTHERS                        = 17
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

<REMOVED BY MODERATOR>

Thanks

Lincon

Edited by: Alvaro Tejada Galindo on Jan 24, 2008 3:51 PM

Read only

0 Likes
819

Instead of ; you can use tab.

Lincon

Read only

Former Member
0 Likes
819

Hi,

when i executing it is giving different type of outputs,But when i changed the file data i mean replace tab instead of ";" at that time it is giving the correct result.

Reward points,if it is useful.

Thanks,

chandu.