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: 

How to get the FIX-LENGTH non-unicode file in unicode system?

Former Member
0 Kudos

I tried to use the GUI_UPLOAD

but it seems it cannot get the correct data by the length i defined if the record contains 2-byte words.

2 REPLIES 2

former_member386202
Active Contributor
0 Kudos

Hi,

I think it should work

try like this.

*--Call the function to get the file into an internal table.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lv_file

filetype = 'ASC'

TABLES

data_tab = pr_eord

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.

  • File not found.

MESSAGE e503.

ELSE.

regards,

Prashant

Former Member
0 Kudos

Solved.Get all content to a string then use the following method

TRY.

CALL METHOD CL_ABAP_LIST_UTILITIES=>READ_FROM_DISPLAY_LAYOUT

EXPORTING

DISPLAY_DATA = IO_OUTPUT

DISPLAY_OFFSET = I_OFFSET

DISPLAY_LENGTH = I_LENTH

IMPORTING

FIELD = I_STRING.

CATCH CX_PARAMETER_INVALID_RANGE .

ENDTRY.