‎2009 Jul 30 8:51 AM
Hi Experts,
We need to enter a unique ASCII character called 'US' or Unit Separator in a text file being generated through a program.
The ASCII code for US is 31. However when we try and do it programmatically the character '#' is getting populated.
The code is as follows:
DATA : lv_sep type c.
field-symbols : <xfs> type x.
assign lv_sep to <xfs> casting.
<xfs> = 0031.
write lv_sep.
Kindly help us out.
Thanks and Regards,
Ravi Bhatnagar
‎2009 Jul 30 9:58 AM
Hi,
This character is special one, so you can't print it out. In SAP all special charcter which can't be printed are replaced with placeholder #. They are intended to do theri special purpose in flat file, once you open it.
Do the following:
- use fm HR_KR_XSTRING_TO_STRING to convert xstring with value '1F' (30 decimal value) to string
- write this string to certain place in internal string table (where you want later use it in the file)
- download this table as to file
- special character will do its purpose in text file
This is the same functionality as you would be placing Line Feed (0x0A - 10 dec). It would be shown as # but once you open downlaoded file you don't see hash # anymore, but you see that new line in that place.
Hope this is clear
Regards
Marcin
‎2011 May 31 2:14 PM
Hi,
I used fm HR_KR_XSTRING_TO_STRING and it worked well ! Many thanks !
‎2009 Jul 30 10:10 AM
hI Ravi,
Try This.
DATA : lv_sep type c.
DATA : lv_sep1 type c.
data : m_text(2) type c.
field-symbols : <xfs> type x.
field-symbols : <yfs> type x.
assign lv_sep to <xfs> casting.
assign lv_sep1 to <yfs> casting.
<xfs> = 0085.
<yfs> = 0083.
concatenate lv_sep lv_sep1 into m_text.
write:/ m_text.
Regds,
Anil