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

Problem in file format OPEN DATASET

Former Member
0 Likes
716

Hi all,

i am upgrading the systemm 4.7 to ECC6.0

In one of the programs OPEN dataset statement is being used to download the file to unix server, but when i run the same program in ECC6.0 version an try to opn in notepad the same file it is coming in single line (i.e end of line delimiter is being ignored.)

Hence I tried using WITH WINDOWS LINEFEED addition

it is displayed correctlyin notepad but when i see thru

transaction AL11 character'#' is displayed after every end of line also when i take a printout now one extra new line is added

the delimiter which i have used here is

C type c value CL_ABAP_CHAR_UTILITIES=>CR_LF

Can anyone suggest a better method to solve the problem?

4 REPLIES 4
Read only

Former Member
0 Likes
576

Hi,

You can use cl_abap_char_utilities=>horizontal_tab as seperator.

'#' symbol in AL11 is a Horizontal tab delimiter. Hence u can open the file from AL11 in an excel format.

Regards,

Asif

Read only

Former Member
0 Likes
576

Hi,

When you upload the tab delimited file to the application server then the tab spaces are removed and instead the spaces are replaced by the '#" symbols.

CL_ABAP_CHAR_UTILITIES=>CR_LF

This class contains an element whose value is '#'.

So it is generally used incase of tab delimited files on application server.

If you use any other symbols like ',' or '|' etc, they remain as it is.

Reward points if helpful.

Thanks and Regards

Read only

Former Member
0 Likes
576

Your problem is due to different end of line characters in windows and Unix. When you are dealing with cross platform environment you have to e very carefull in selecting the transfer mode used when bringing the file from the unix environment to windows environment.

In your case I would sugest doing open dataset using the normal way(not using windows addition) so that AL11 will not show the # character. As far as reading the file you can choose the right transfer format(ASCII) when you use other utilities(like reflections or FTP) to get the file. You can also use Wordpad instead of Notepad as wordpad takes care of both the end of line characters.

Read only

Former Member
0 Likes
576

DATA L_MSG1 TYPE STRING.

CONSTANTS: C_TAB1 TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

*-- Open Dataset

OPEN DATASET p_aosvr FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc EQ 0.

DO.

*-- Read Dataset and Populate Input file data to Internal Table

READ DATASET unix_filename INTO L_MSG1.

IF sy-subrc EQ 0.

SPLIT L_MSG1 AT C_TAB1 INTO it_final-field1

it_final-field2

it_final-field3

it_final-field4

it_final-filed5.

APPEND it_final.

CLEAR it_final.

ELSE.

EXIT.

ENDIF.

ENDDO.

ELSE.

MESSAGE e000 WITH 'Error while uploading data'(013).

ENDIF.

*-- Close Dataset

CLOSE DATASET p_aosvr.