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

OPEN DATASET

Former Member
0 Likes
953

Hello all,

I am facing a problem in OPEN DATASET.

I need to download a .TXT file on the application server.

Desired format is to download each record in new line. for example:

0110432191852710 20021213

0110432191854710 20021213

I have used:

OPEN DATASET p_daf FOR OUTPUT in text mode.

LOOP AT g_t_itab.

TRANSFER g_t_itab TO p_daf.

CLEAR:g_t_itab. ENDLOOP.

CLOSE DATASET p_daf.

But I get a single stream of data in my text file. The records are separated by a special character ( a Black box ) - I open the .TXT file in <b>NOTEPAD</b>

Is this behaviour normal? Else how do I download the records in different lines as a text file on Application server?

Thanks in advance.

Regards, Murugesh AS

Message was edited by: Murugesh Arcot

Message was edited by: Murugesh Arcot

9 REPLIES 9
Read only

Former Member
0 Likes
882

Hi,

You can use the syntax

OPEN DATASET <dsn> [FOR ....] [IN ... MODE] AT POSITION <pos>.

This statement opens the file <dsn>, and prepares it for reading or writing from position <pos>. <pos> is the number of bytes from the beginning of the file. It is not possible to specify a position before the beginning of the file.

Hope this may help you.

Thanks&Regards

Ruthra.R

Read only

Former Member
0 Likes
882

Hi Muruesh,

Please chek this link:

It might help you.

Regards,

Anjali

Read only

Former Member
0 Likes
882

You haven't included your endloop statement. It has to be before the close statement.

Rob

Read only

andreas_mann3
Active Contributor
0 Likes
882

Hi Murugesh,

your coding is ok.

perhaps try to omit ending .txt in your file name

what is when you reload your saved file with sap ?

-> try another text editor e.g. ultra edit

regards Andreas

Read only

Former Member
0 Likes
882

What are you using to look at the file? Sounds like you have something that doesn't understand unix-style newlines. There is absolutely no reason why that code of yours shouldn't work.

Read only

0 Likes
882

Hello Andreas, Nathan and others,

Thanks for your response.

As Andreas suggested, I uploaded the same in SAP and it works fine.

Well I have not explained the requirement. We have different SAP systems and the data is downloaded in .txt from each system and a java utility uploads this data into the BW system.

This system/interface is in place now and SAP system on which I am working will be giving data to BW system.

Regards, Murugesh AS

Read only

0 Likes
882

If you transfer data from unix to windows computer you have to modify the return code. You do this with ftp when you select ascii transfer.

Maybe look your java utility for text transfer instead of binary transfer

Frédéric

Read only

0 Likes
882

Hello Andreas and Nathan,

The Interface works fine with the downloaded file from Unix bases SAP system too without any changes.

Thanks for the help.

Best Regards, Murugesh AS

Read only

Former Member
0 Likes
882

Hi Murugesh,

WHy dont you try using split command when moving the file.

Let me know if you have any questions still. Put split and go for F1, you will know the syntax.

Thanks,

Bhavana