AbapGit
A source-verified project description is not available yet. Open the detail page or wait for a manual refresh.
Source facts need a manual refresh
TAB-delimited text parser for ABAP
TAB-delimited text parser and serializer for ABAP
Text2tab is an utility to parse TAB-delimited text into an internal table of an arbitrary flat structure.
FOO in the parsed text move to BAR component of the target internal table)And vice versa - serialize flat table or structure to text.
The package also contains 2 examples (see examples sub-package):
ZTEXT2TAB_EXAMPLE - simple parsing codeZTEXT2TAB_BACKUP_EXAMPLE - example of DB table backup with serializerPlease find the complete documentation at our github pages site. The documentation includes infromation about installation, examples of usages and library API.
Source text file (CRLF as a line delimiter, TAB as a field delimiter)
NAME BIRTHDATE
Alex 01.01.1990
John 02.02.1995
Lara 03.03.2000
Simple parsing code
types:
begin of my_table_type,
name type char10,
birthdate type datum,
end of my_table_type.
data lt_container type my_table_type.
zcl_text2tab_parser=>create( lt_container )->parse(
exporting
i_data = my_get_some_raw_text_data( )
importing
e_container = lt_container ).
... or a more complex one ...
types:
begin of my_table_type,
name type char10,
city type char40, " <<< New field, but the text still contains just 2 !
birthdate type datum,
end of my_table_type.
...
zcl_text2tab_parser=>create(
i_pattern = lt_container " table or structure
i_amount_format = ' .' " specify thousand and decimal delimiters
)->parse(
exporting
i_data = my_get_some_raw_text_data( )
i_strict = abap_false " text may contain not all fields (city field will be skipped)
i_has_head = abap_true " headers in the first line of the text
importing
e_container = lt_container ). " table or structure (first data line from text)
The code is licensed under MIT License. Please see the LICENSE for details.