Application Development 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: 

GUI_Upload

Former Member
0 Kudos
178

Hi All,

I am getting problem in GUI_upload function module,

i am having one flat file and am taking the data from this flat file to one internal table using GUI_upload FM, the flat file is seperated by Tab.

after executing the program , if i try to print the internal table data then data is coming with "#" symbol,

how can i remove this,

Help me.

BALU.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
126
  1. - refers that the length might not be sufficient.

In debugging check whetehr the values are coming.

Refer this code

  • Retrieve data file from presentation server(Upload from PC)

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.  
DATA: begin of it_datatab occurs 0,
  row(500) type c,
 end of it_datatab.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename        = i_file
            filetype        = 'ASC'
       TABLES
            data_tab        = it_datatab  "ITBL_IN_RECORD[]
       EXCEPTIONS
            file_open_error = 1
            OTHERS          = 2.

http://www.sapdevelopment.co.uk/file/file_updown.htm

7 REPLIES 7

Former Member
0 Kudos
127
  1. - refers that the length might not be sufficient.

In debugging check whetehr the values are coming.

Refer this code

  • Retrieve data file from presentation server(Upload from PC)

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.  
DATA: begin of it_datatab occurs 0,
  row(500) type c,
 end of it_datatab.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename        = i_file
            filetype        = 'ASC'
       TABLES
            data_tab        = it_datatab  "ITBL_IN_RECORD[]
       EXCEPTIONS
            file_open_error = 1
            OTHERS          = 2.

http://www.sapdevelopment.co.uk/file/file_updown.htm

Former Member
0 Kudos
126

HI,

Doesn't matter.

Read the contents into an internal table, and then use SPLIT stmt and store it into separate fields of another internal table.

Regards

Subramanian

0 Kudos
126

try.

START-OF-SELECTION.

gd_file = p_infile.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gd_file

<b>has_field_separator = 'X' </b> "file is TAB delimited

TABLES

data_tab = it_record

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 NE 0.

write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.

skip.

endif.

Former Member
0 Kudos
126

Hi

I think # will come due to tab. in flat file replace tab with ',' you will get desired output.

Regards

Ravi Kanth

Former Member
0 Kudos
126

Hi,

You will have to check if the Internal table has the value Tab in your program and implement whatever logic you want to if you find it.

You can use the class CL_ABAP_CHAR_UTILITIES and the Attribute HORIZONTAL_TAB to check whether there is a Tab in your record.

regards,

Mahesh

Former Member
0 Kudos
126

hi

CONSTANTS: C_SPLIT TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB. this tell us to define the tab key .

sometimes we can use it . but to this question i think the up floor show us a good solution

Former Member
0 Kudos
126

just do this

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = i_file

filetype = 'ASC'

has_field_separator = 'X'

********************************************

in your flat file use tab as separators