Application Development 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: 

Add 1B - ESC Character

former_member189862
Participant
0 Kudos

Hello  Experts,

We are writing a file to application server using class- cl_rsan_ut_appserv_file_writer=>appserver_file_write

This is working good.

There is a requirement to add ESC Character (Hex value 1B) at specific position in the file, so that another system can read the file in correct way.

Now my question is how to add the ESC character in ABAP.

I saw there is class CL_ABAP_CHAR_UTILITIES - it has many different options such CR_LF, Backspace, new line etc, but I did not see any option to add ESC character.

Any suggestions?

1 ACCEPTED SOLUTION

Juwin
Active Contributor
0 Kudos

At the appropriate position, you may write:

data: str type string.

str = cl_abap_conv_in_ce=>uccp( '001B' ).


and then, transfer the variable str to file.


Thanks,

Juwin

3 REPLIES 3

Juwin
Active Contributor
0 Kudos

At the appropriate position, you may write:

data: str type string.

str = cl_abap_conv_in_ce=>uccp( '001B' ).


and then, transfer the variable str to file.


Thanks,

Juwin

0 Kudos

Thanks Juwin,

This would add # character to the file, isn't it?

The way we are trying is we don't see the visible # charc, not sure if that is going to corrupt the file.

Juwin
Active Contributor
0 Kudos

# is SAP's method of showing any non-printable character. It is not the same as the number symbol (or hash) on your keyboard. If you use the code I gave, it will put the escape character you needed and not #.

Please try it.

Thanks,

Juwin