Ir al contenido principal

Entradas

Mostrando las entradas de agosto, 2013

Tab character as delimiter in ABAP string

It can be a bit difficult to use tabulator character (hex code 0x0009) in ABAP strings. On the other hand it is often used as separator in various interface files and you need tab character to split the lines into fields or insert it into the strings as delimiter. If you need to fulfill the unicode check, you have to use special approach to combine hex code and string. Otherwise you will get the syntax error from compiler: "TAB" must be a character-like data object (data type C, N, D, T, or STRING) Here three examples, how the tab character can be used in combination with string in abap. You can use similar approach for other difficult characters, for example ENTER. Example 1: can be used in non-unicode and unicode systems: (tabulator hex code is defined in class CL_ABAP_CHAR_UTILITIES as constants HORIZONTAL_TAB) DATA:   tab type c value cl_abap_char_utilities=>horizontal_tab,   str TYPE string. CONCATENATE 'aaa' 'bbb' INTO str SEPARATED BY tab.