PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

sbcgua/text2tab

A library that parses TAB-delimited text into an internal table of any flat ABAP structure, with non-strict, header and type-less modes, and serialises tables back to text in configurable formats.

Turning tab-delimited text into a flat internal table normally means writing a parser for one specific structure. text2tab parses text into a table or structure of any flat type, in a non-strict mode that skips fields missing from the source, a header mode that lets the text's column order differ from the structure's own, and a type-less mode that builds a string-typed table dynamically when no structure is supplied at all. Date and amount formats and on-the-fly field name remapping are configurable on read. It serialises the same data back to TAB-delimited text, with its own date, amount and line-break format.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
SerialisationABAPSerialisationcapabilityTurning typed in-memory data into a text or binary format such as JSON, CSV or protobuf and reading it back, including the mapping of names and types the language does not do for you. The protocol that carries the payload is a separate concern: an HTTP or OData client moves the bytes, and serialisation decides what they say.

Who is behind it

Alexander TsybulskyAlexander TsybulskyPersonMaintains this
In the atlas: maintains 5, contributes to 11
@sbcgua
maintainerJohannes GerbershagenPersonContributes to this
In the atlas: maintains 1, contributes to 7
@germanysources
Matthias AignerPersonContributes to this
In the atlas: contributes to 1
@Huargh
JXYSGX7CPersonContributes to this
In the atlas: contributes to 2
@JXYSGX7C
Lars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
sshlapakPersonContributes to this
In the atlas: contributes to 2
@sshlapak
5 contributors

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
does not say
Distributed through
does not say

Connections2

README

quoted from sbcgua/text2tab under MIT, read
sbcgua/text2tab/README.mdOn GitHub

ABAP text2tab parser and serializer (ex. Abap data parser)

abaplint Version

TAB-delimited text parser and serializer for ABAP

Synopsis

Text2tab is an utility to parse TAB-delimited text into an internal table of an arbitrary flat structure.

  • supports "non-strict" mode which allows to skip fields in the source data (for the case when only certain fields are being loaded).
  • supports "header" specification as the first line in the text - in this case field order in the text may differ from the internal abap structure field order.
  • supports loading into a structure (the first data line of the text is parsed).
  • supports type-less parsing, when the data is not checked against existing structure but dynamically create as a table with string fields.
  • supports specifying date and amount formats
  • supports on-the-fly field name remapping (e.g. field FOO in the parsed text move to BAR component of the target internal table)
  • supports "deep" parsing - filling structure or table components in the target data container
  • supports "corresponding" parsing - filling only those fields which are in target structure. Kind of opposite to "non-strict" feature above.

And vice versa - serialize flat table or structure to text.

  • support specifying date and amount formats, and line-break symbol

The package also contains 2 examples (see examples sub-package):

  • ZTEXT2TAB_EXAMPLE - simple parsing code
  • ZTEXT2TAB_BACKUP_EXAMPLE - example of DB table backup with serializer

Documentation

Please find the complete documentation at our github pages site. The documentation includes infromation about installation, examples of usages and library API.

Example of usage

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)

License

The code is licensed under MIT License. Please see the LICENSE for details.

MIT, read

History

Latest

v1.0.0

Notes

First public release. Code works fine, unit tests coverage >90%.

Serialisation
  1. ABAP JSON APIJSON renderer and parser for ABAP with camelCase conversionfrom ABAP
  2. zcl_mdp_jsonABAP library generating and parsing JSON stringsfrom ABAP
  3. JSON2ABAPTypeGenerator of ABAP type definitions from JSON structuresfrom ABAP
  4. abap-protobufProtocol Buffers (proto2) implementation in ABAPfrom ABAP
  5. ZASISRegex RuleSets that read barcode strings into named fieldsfrom ABAP
  6. ABAP ArchitectEclipse plug-in turning JSON or XML into ABAP types and DDIC objectsfrom ABAP
  7. ABAP to JSON serializer and deserializerOpen-source Z* version of /UI2/CL_JSON for ABAP to JSONfrom ABAP
  8. ajsonJSON parser and serialiser for ABAP with a node treefrom ABAP
  9. ABAP JSON Encoder/DecoderJSON encoder and decoder for ABAP, modelled on Go's encoding/jsonfrom ABAP
  10. ZwdCSVRFC 4180 CSV parser and generator for ABAPfrom ABAP
  11. ABAP CSV ManagerConfigurable CSV reader and writer for ABAPfrom ABAP

Details

Sources3
dotabapdiscovered herechecked
github.com/sbcgua/text2tabtree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viadotabap
first seen in the atlas
ecosystem and domainabap, protocols-and-apis
abaplint
issues under its own abaplint configuration0
lines6,227
statements3,772
objects10
files22
analysed, master
abaplint version2.120.84
Contributors5

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sbcgua-text2tab
JSON
/artifacts/sbcgua-text2tab.json
MCP
Connecting an agent