sapdev logo background
sapdev logo sapdev logo
Comments

Inserting TAB's into text strings




Inserting tabs into output strings can be performed using the code below. This can be very useful when building an EXCEL output file. Using the tab value you are able to create a .xls(EXCEL) file containing a TAB value to separate each column. Also see 'Upload Tab Delimited file'.

Any ASCII character can be inserted in this way by simply replacing the hex value for tab with the hex value of another command(i.e. carrage return = '0D'). See sample list of hex values.

-- Non Unicode system
*Code used for inserting a TAB value on a
DATA: gd_result(50) type c.
constants: con_tab type x value '09'.

* con_tab can then be concatenated to create tab spaces.
CONCATENATE 'text1' con_tab 'text2' con_tab 'text3' into gd_result.

-- Unicode system
* When requiring unicode compliancy you will need to use the following syntax.
* Double click on 'cl_abap_char_utilities' then choose attributes for list
* of possible commands.
class cl_abap_char_utilities definition load.
constants: c_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.

CONCATENATE 'text1' c_tab 'text2' c_tab 'text3' into gd_result.



comments powered by Disqus