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: 

Transfer file string to Dataset

giancarla_aguilar
Participant
0 Kudos

I have a program which transfers inbound IDOC file from local directory to the application server. I stored the file contents to an internal table with a single field type STRING. The file has a maximum of 541 chars per row. But when I transferred each row, only the first 256 chars were transferred to the file in the application server. How will I transfer the whole string?

Below is a snipet of the code:

DATA: gc_fname TYPE authb-filename.

DATA: BEGIN OF gt_file OCCURS 1000,

str TYPE STRING,

END OF gt_file.

OPEN DATASET gc_fname FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc EQ 0.

LOOP AT gt_file.

TRANSFER gt_file-str TO gc_fname LENGTH 541.

ENDLOOP.

ENDIF.

CLOSE DATASET gc_fname.

2 REPLIES 2

Former Member
0 Kudos

data : lv_str type string. "add

DATA: gc_fname TYPE authb-filename.

DATA: BEGIN OF gt_file OCCURS 1000,

str TYPE STRING,

END OF gt_file.

OPEN DATASET gc_fname FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

IF sy-subrc EQ 0.

LOOP AT gt_file.

move : gt_file-str+0(255) to lv_str. "add

TRANSFER lv_strTO gc_fname. "Modify

move : gt_file-str+255(255) to lv_str. "add

TRANSFER lv_strTO gc_fname. "add

ENDLOOP.

ENDIF.

CLOSE DATASET gc_fname.

Former Member
0 Kudos

Hi,

The maximum length allowed for the transfer of data is 256 only for each line.

If you want to send additional data split and send it in two lines.

bye

sasi