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

Error in GUI_ Upload

Former Member
0 Likes
564

Hi,

the table is:

TYPES: BEGIN OF g_upload,

blart(2), "Document type

bukrs(4), "Company code

budat(10), "Posting date

monat(2), "Period

waers(5), "Currency key

xblnr(1), "Reference ID

newbs1(2), "Posting key 1

hkont1(10), "GL account 1

wrbtr1(16), "Amount document currency 1

dmbtr1(16), "Amount local currency 1

sgtxt1(50), "Text 1

kostl(10), "Cost center

aufnr(12), "Order no.

newbs2(2), "Posting key 2

hkont2(10), "GL account 2

wrbtr2(16), "Amount document currency 2

dmbtr2(16), "Amount local currency 2

sgtxt2(50), "Text 2

zmsgtx LIKE bapiret2-message, "Message text

END OF g_upload.

but when i use GUI_UPLOAD.

the internal table data is overlapping like, ZY |#110 |0#01.12.20|08 |#12#U|SD#BASS2SAP Asse|t# |70#810013- |

Integration#50#9|702 |00#ADA006#1000.00#3500.00#BASS Integration .

I used GUI_UPLOAD.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = file_name

filetype = file_type

has_field_separator = has_field_separator

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

dat_mode = abap_true

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = pt_table.

please suggest me,

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
527

Hi, Reddy,

Have you tried has_field_separator = 'X' hope this will solve out your problem

Regards,

Faisal

4 REPLIES 4
Read only

faisalatsap
Active Contributor
0 Likes
528

Hi, Reddy,

Have you tried has_field_separator = 'X' hope this will solve out your problem

Regards,

Faisal

Read only

Former Member
0 Likes
527

Hi,

In function module give field separator as 'X' . Check with the following code:

CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = <file-name>
      has_field_separator     = 'X'  (It provides the space between fields )
    TABLES
      data_tab                = <Table-name>
    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.

Hope this solves the issue.

Regards,

Rajani

Read only

0 Likes
527

Thank q faisal and rajani....I've awarded points.

I've passed the variable but haven't checked whether it's coming or not.

Read only

Former Member
0 Likes
527

Hi Anitha,

This is beacuse the mismatch of internal table & your Flat file,

Just check back your flat fiel & internal tbale has same dtat types & in flat file if seperated by Space or Tab. Pass the same to has_field_seperator.

This solves your problem,

Thanks & regards,

Dileep .C