Your Ad Here

Saturday, January 17, 2009

How to do Unicode conversion in ABAP program

In Unicode enabled systems its important to use the correct method to add, remove or check control characters that represents Horizontal-Tab, Vertical-Tab, New-Line, Form-Feed etc. This can be achieved using constants defined as attributes of ABAP class cl_abap_char_utilities.

These control characters are required while reading data from a tab delimited format or any file in an ABAP program. Similarly it’s used to export data from an abap program to a file in tab delimited format or any other format.

CLASS cl_abap_char_utilities DEFINITION LOAD.

CONSTANTS: bs(1) TYPE c VALUE cl_abap_char_utilities=>backspace,
cr(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
crlf(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
ff(1) TYPE c VALUE cl_abap_char_utilities=>form_feed,
ht(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
lf(1) TYPE c VALUE cl_abap_char_utilities=>newline,
vt(1) TYPE c VALUE cl_abap_char_utilities=>vertical_tab,
mn(1) TYPE c VALUE cl_abap_char_utilities=>minchar,
mx(1) TYPE c VALUE cl_abap_char_utilities=>maxchar.


After defining these variables, it can be used along with “concatenate” statement while exporting file from ABAP program. And it can be used with “replace all occurrences of” statement while reading data from an external file in an ABAP program.
 

Copyright © 2008 SAP nxt. All Rights Reserved.
All product names are trademarks of their respective companies. This blog is in no way affiliated with SAP AG or any of its subsidiaries.
Every effort is made to ensure the content integrity. Information used from this blog is at your own risk.

Free Domain & Hosting