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

Codepage for DOS

Former Member
0 Likes
640

Hi all,

I want to import a file from a DOS application. In the file is a character in DOS format (e.g. ï) which has to be translated to '

When i use FM WS_UPLOAD and use filetype IBM all is working fine. SAP returns the value '

But the program needs to be run in the background and has to read the file from the application server, so i can't use WS_UPLOAD or GUI_UPLOAD.

I am using OPEN DATASET dsn FOR INPUT IN LEGACY TEXT MODE CODE PAGE cp.

Does anybody know which Code page should be used to be able to read the 'strange' characters? Or is it possible to solve it in another way?

Thanks in advance.

Marcel Leeraar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
475

Hi Marcel,

I resolved that problem with this the code above.

*Reward points if it was helpful.

FIELD-SYMBOLS .

DATA texto(10).

DATA var.

START-OF-SELECTION.

  • Subimos los archivos de carga

OPEN DATASET p_file IN TEXT MODE FOR INPUT ENCODING NON-UNICODE.

IF sy-subrc EQ 0.

DO .

READ DATASET p_file INTO linea.

IF sy-subrc NE 0. EXIT. ENDIF.

MOVE linea TO record.

APPEND record.

ENDDO.

ELSE.

WRITE: sy-subrc.

WRITE: 'Error en el Open Dataset'.

ENDIF.

+indice(1) .

IF var CA '0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz:;.,'.

ADD 1 TO indice.

ELSE.

  • Reemplazamos # por /

+indice(1) = '/'.

ADD 1 TO indice.

ENDIF.

ENDDO.

  • Dividimos los campos

SPLIT

Message was edited by:

Eric Hernandez Pardo

2 REPLIES 2
Read only

Former Member
0 Likes
476

Hi Marcel,

I resolved that problem with this the code above.

*Reward points if it was helpful.

FIELD-SYMBOLS .

DATA texto(10).

DATA var.

START-OF-SELECTION.

  • Subimos los archivos de carga

OPEN DATASET p_file IN TEXT MODE FOR INPUT ENCODING NON-UNICODE.

IF sy-subrc EQ 0.

DO .

READ DATASET p_file INTO linea.

IF sy-subrc NE 0. EXIT. ENDIF.

MOVE linea TO record.

APPEND record.

ENDDO.

ELSE.

WRITE: sy-subrc.

WRITE: 'Error en el Open Dataset'.

ENDIF.

+indice(1) .

IF var CA '0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz:;.,'.

ADD 1 TO indice.

ELSE.

  • Reemplazamos # por /

+indice(1) = '/'.

ADD 1 TO indice.

ENDIF.

ENDDO.

  • Dividimos los campos

SPLIT

Message was edited by:

Eric Hernandez Pardo

Read only

Former Member
0 Likes
475

Hi Eric,

I don't know if this helps in my case. I want to convert between code pages, it seems to me that your code does something else (maybe i'm wrong).

I solved the problem myself in the meanwhile.

The following code converts the read string from DOS format to the SAP system format (code page 1100).


OPEN DATASET l_recht
      FOR INPUT
      IN LEGACY TEXT MODE
      CODE PAGE '1103'
      MESSAGE p_mess

Thanks anyway for the effort to look at my problem!

Marcel.