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

GUI UPload problem

Former Member
0 Likes
748

Hello friends,

I have data in the text file and when I use this FM it says bad format data.


DATA:  BEGIN OF i_stru_tab OCCURS 0,
       pernr LIKE p0001-pernr,
       prozt LIKE p1001-prozt,
       otype LIKE p1001-otype,
       plans LIKE p1001-objid,
       orgeh LIKE p1001-objid,
       kostl LIKE p0001-kostl,
       stell LIKE p1001-objid,
       begda LIKE p1001-begda,
       endda LIKE p1001-endda,
       END OF i_stru_tab.

PARAMETERS: ps_file4 LIKE rlgrap-filename                        DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE,

  PERFORM upload_local_file4.

FORM upload_local_file4 .

  DATA: p_file14 TYPE string.
  p_file14 = ps_file4.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = p_file14
      filetype                = 'ASC'
    TABLES
      data_tab                = i_stru_tab
    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.

When I execute the code I see data only for the first field of the first row and all the fields are 0.00 and i dont see any records from second row onwards.

Below is the data in the text file.



25310000100.00S 5000001300000000          500000112001083199991231
25312951100.00S 5000001300000000          500000112003080199991231
25313427100.00S 5000001300000000          500000112003060199991231

Thanks,

Raju.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
655

Hi,

fields in flat file must be seperatedby tab

Regards

5 REPLIES 5
Read only

Former Member
0 Likes
656

Hi,

fields in flat file must be seperatedby tab

Regards

Read only

0 Likes
655

Can you please let me know more in detail.

This is afile that is downloaded by another program.

Can I change that program that downloads to download as what would be necessary for this file.

Thanks again,

Raju.

Read only

0 Likes
655

Raju, if that program uses gui_download to create the file, add the export WRITE_FIELD_SEPARATOR = 'X' this will automatically separate each field with tabulations, so you only need to add the export has_field_separator = 'X' in your call to gui_upload

Read only

0 Likes
655

THanks Ramiro.

Raju.

Read only

Former Member
0 Likes
655

use option has_field_separator = 'X'

and separate the fields with tabulations in the text file.

How did you got that file?

You made it with gui_download or are you getting it from an independent source?

Edited by: Ramiro Escamilla on Feb 8, 2008 3:30 PM