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 data problem

Former Member
0 Kudos
348

we are uploading .DAT file in following program, after uploading the data into sap system, we are not able to see the complete data

first row last two three fields are missing, the total field values length is 331 character, even if i given the 5000 character also same values is showing when i runtime.

even i have dowloaded the tabtyp_tbl at runtime into .DAT format, i am not able to see the last field values

please provide the reason behind this one

.

SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-s01.

PARAMETERS:

r1 RADIOBUTTON GROUP rad1 DEFAULT 'X',

p_file_u TYPE file DEFAULT

'XXX_TR.DAT',

r2 RADIOBUTTON GROUP rad1,

p_file TYPE localfile.

SELECTION-SCREEN END OF BLOCK file.

TYPES: BEGIN OF rectyp_tbl,

  • data(331), "tarn72 "gb13032009 D

data(5000), "gb13032009 I

  • end(2),

END OF rectyp_tbl.

data : tabtyp_tbl TYPE standard TABLE OF rectyp_tbl.

  • WITH NON-UNIQUE DEFAULT KEY

    • INITIAL SIZE 500."gb13032009 D

  • INITIAL SIZE 1000."gb13032009 I

DATA:

l_gui_filename TYPE string, " Filetype

l_gui_filetype(10) TYPE c, " Filetype

l_gui_filz TYPE i. " Filesize

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

mask = ',TR.DAT file,tr*.dat'

static = 'X'

CHANGING

file_name = p_file.

MOVE p_file TO l_gui_filename.

MOVE 'ASC' TO l_gui_filetype.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_gui_filename

filetype = l_gui_filetype

HAS_FIELD_SEPARATOR = 'X'

IMPORTING

filelength = l_gui_filz

TABLES

data_tab = tabtyp_tbl

EXCEPTIONS

file_open_error = 01

file_read_error = 02

invalid_type = 03

unknown_error = 04.

CASE sy-subrc.

WHEN 01.

MESSAGE e000(fb) WITH 'Cannot open file'(125) p_file.

WHEN 02.

MESSAGE e000(fb) WITH 'Cannot read file'(126) p_file.

WHEN 03.

MESSAGE e000(fb) WITH 'File'(127) p_file

'has invalid file type'(128) l_gui_filetype.

WHEN 04.

MESSAGE e000(fb) WITH 'Unknown error, file'(129) p_file.

ENDCASE.

1 REPLY 1

Former Member
0 Kudos
79

Hi ,

There are few very little changes that I want to suggest you, please make the below made changes into your existing code and try to execute.

data : tabtyp_tbl TYPE standard TABLE OF rectyp_tbl with header line.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_gui_filename

filetype = l_gui_filetype

*HAS_FIELD_SEPARATOR = 'X' " REMOVE THIS PARAMETER

*IMPORTING " REMOVE - NO NEED

*filelength = l_gui_filz " REMOVE - NO NEED

TABLES

data_tab = tabtyp_tbl[] " BRACKETS

EXCEPTIONS

file_open_error = 01

file_read_error = 02

invalid_type = 03

unknown_error = 04.

CASE sy-subrc.

WHEN 01.

MESSAGE e000(fb) WITH 'Cannot open file'(125) p_file.

WHEN 02.

MESSAGE e000(fb) WITH 'Cannot read file'(126) p_file.

WHEN 03.

MESSAGE e000(fb) WITH 'File'(127) p_file

'has invalid file type'(128) l_gui_filetype.

WHEN 04.

MESSAGE e000(fb) WITH 'Unknown error, file'(129) p_file.

ENDCASE.

Hope this will solve your issue.

Regards,

Ashish Arora