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

Writing a file using OPEN DATASET

jwalithtatikonda2
Participant
0 Likes
3,945

Hi all ,

I am trying to write a file using OPEN DATASET fname FOR OUTPUT IN TEXT MODE and in a loop i am using TRANSFER statement. When I am doing this , am able to transfer only 256 bytes. Can anybody help me out with this issue

7 REPLIES 7
Read only

Former Member
0 Likes
2,603

Hi,

Pls see the below example.

In the OPEN DATASET statement, the data object f is interpreted in lines if you use IN TEXT MODE. If you use the IN BINARY MODE addition, the line breaks are ignored. If the specified file is not already open, TRANSFER attempts to open the file FOR OUTPUT IN BINARY MODE. If this is not possible, a runtime error occurs.

Example

DATA rec(80).

TRANSFER rec TO '/usr/test.dat'.

This example transfers the field rec to the file test.dat in the usr directory on the application server. The data record is 80 bytes long. If you do not specify a directory, the file is written in the directory specified in the profile parameter.

Regards,

Ram Mohan

Read only

Former Member
0 Likes
2,603

Don't worry, you are able to download the full length of the record.

I think you are trying to see the file contents from some SAP transaction and that transaction has this restriction on showing only 256 characters.

Go to the OS (or ask someone who has the access) and take a look at the file using some text editor.

Read only

sridharreddy_kondam
Active Contributor
0 Likes
2,603

Hi Tatikonda,

OPEN DATASET l_out_file FOR OUTPUT IN TEXT MODE

ENCODING DEFAULT.

*Then Transfer the data to l-out_file. by Looping the internal table...

  • Here Declare wa(wa_control_file contains n no of fields with required length) according to required length per line...

TRANSFER wa_control-file TO l_out_file.

And this definitely transfers the Total data from itab to Application server....

<b>Better use CG3Y and Transfer all the data to the local file and check how much data is available...</b>

Hope this helps u sure...or else do reply again

Regards,

Sridhar

Message was edited by: sridhar reddy kondam

Read only

Former Member
0 Likes
2,603

Hi,

It is transferring correctly.I think u are checking the file contents using transaction AL11.This will show only 256 bytes.download this file into ur system and then check. you will be able to see entire data.

for download :

1)open the file in al11

2)goto system->list->save->local file.

rgds,

latheesh

Message was edited by: Latheesh Kaduthara

Read only

Former Member
0 Likes
2,603

HI

GOOD

FOR OUTPUT IN TEXT MODE ->

If a file is opened with this addition, the system assumes that the file has a line structure. Each time READ DATASET or TRANSFER occurs, exactly one line is input or output. If the data area is too big for the line read, the remaining area is padded with blanks. If it is too small, the remainder of the line is lost.

THIS IS THE IN TEXT MODE CONCEPT,GO THROUGH THIS LINK WHICH WILL GIVE YOU SOME IDEA ABOUT THE INCREASE LENGHT OF IN TEXT MODE.

THANKS

MRUTYUN

Read only

0 Likes
2,603

Hi Tripathy,

U mentioned to go through a particular link , i am unable to find that link , can u help me out

Read only

0 Likes
2,603

Though it shows only 256 chars , the files holds the Full length.

try to read it to itab and then download it to PC and see ...

or Else you can use transaction CG3Y transaction to download directly from Application Server to PC.

Regards

vijay