SAP4TECH

SAP and ABAP Free Tutorials
Menu
  • SAP Technical
    • ABAP Code Snippets
    • ABAP WebDynPro
    • SAP GW
    • SAP IDOC (ALE)
    • SAP PI (XI)
    • SAP Screen Personas
    • SAP Workflow
  • SAP Functional
    • SAP FI
    • SAP FSCM
    • SAP HR
    • SAP SD & SAP MM
    • SAP PM
    • SAP PP
    • SAP PS
    • SAP QM
    • SAP VIM
    • SAP WM
  • SAP Fiori
  • SAP HANA
  • SAP BW
  • SAP CRM
  • SAP SRM
  • SAP4TECH
    • About Us
    • Contact Us
    • Terms & Conditions
    • Privacy and Cookie Policy

SAP4TECH » List of The most important JSON ABAP Classes in SAP

ABAP Tutorials

List of The most important JSON ABAP Classes in SAP

December 19, 2017 John

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and easy for machines to parse and generate.

It is based on a subset of the JavaScript Programming Language.

SAP can handle JSON format. So standard SAP offers mutiple JSON ABAP Classes. Here the main list of theses classes. 

Table of Contents

  • List of main JSON ABAP Classes
    • /UI2/CL_ABAP2JSON
    • ABAP JSON Class /UI2/CL_JSON
    • /UI2/CL_JSON_SERIALIZER
    • /UI5/CL_DC_JSON_SCHEMA_CHECK
    • /UI5/CL_JSON_PARSER ( for internal use only )
    • /UI5/CL_JSON_READ_API
    • /UI5/CL_JSON_READ_WRITE_API
    • /UI5/CL_JSON_SCHEMA_CHECKER
    • /UI5/CL_JSON_SCHEMA_DATASOURCE
    • /UI5/CL_JSON_SCHEMA_INBOUND
    • Other JSON Classes for Schema:
    • JSON Utility Class in ABAP: /UI5/CL_JSON_UTIL

List of main JSON ABAP Classes

The ABAP JSON Class start with /UI2/* or /UI5/*.

The most used JSON ABAP classes in SAP are:

  • /UI2/CL_ABAP2JSON
  • /UI2/CL_JSON
  • /UI5/CL_JSON_READ_API
  • /UI5/CL_JSON_UTIL

Check also How to Convert JSON to ABAP Internal Table and ABAP Data to JSON Format

Let’s get indeep for theses ABAP Classes and more JSON utilities classes:

List of The most important JSON ABAP Classes in SAP

/UI2/CL_ABAP2JSON

The first class for JSON handling in SAP ABAP is /UI2/CL_ABAP2JSON. It offers a basic conversion for JSON to ABAP Format.

Here the list of methods for /UI2/CL_ABAP2JSON

  • CONV_XSTRING_TO_STRING
  • SERIALIZE2JSON_STR
  • STRUC2JSON
  • TABLE2JSON
  • TABLES2JSON
  • ROW2JSON
  • CONVERT_TO_CAMEL_CASE

Check also Convert JSON to ABAP Internal Table and ABAP Data to JSON Format

ABAP JSON Class /UI2/CL_JSON

The next class is /UI2/CL_JSON. It offers more functionnalities such as SERIALIZE and DESERIALIZE …

The class /UI2/CL_JSON : JSON converter has the following method:

  • STRING_TO_XSTRING : Converts XSTRING data to STRING
  • XSTRING_TO_STRING : Converts XSTRING data to STRING
  • DUMP : Recursive conversion
  • DESERIALIZE : Serializes object
  • SERIALIZE : Serializes object
  • DESERIALIZE_INT : Deserializes ABAP object from JSON
  • SERIALIZE_INT : Serializes ABAP object to JSON
  • CONSTRUCTOR : CONSTRUCTOR
  • BOOL_TO_TRIBOOL : Convertes 2 state bool to 3 state bool
  • TRIBOOL_TO_BOOL : Convertes 3 state bool to 2 state bool
  • DUMP_SYMBOLS : Dump to JSON symbol table
  • GET_SYMBOLS : Alternative impl. of CL_ABAP_STRUCTDESCR=>GET_SYMBOLS_TAB
  • GET_FIELDS : Prepares structure fields cache
  • DUMP_INT : Recursive conversion
  • IS_COMPRESSABLE : Check if initial field shall be compressed
  • RESTORE : Deserialize JSON to ABAP
  • RESTORE_TYPE : Deserialize JSON to ABAP
  • DUMP_TYPE : Dumps elementary type to string
  • DUMP_TYPE_EX : Dumps elementary type to string (no type description needed)
  • PRETTY_NAME_EX : PrettyPrint names in extended form
  • PRETTY_NAME : PrettyPrint names
  • ESCAPE : Escapes JSON String

Read also Conversion ABAP: between Binary, String, XString and Table

/UI2/CL_JSON_SERIALIZER

The next JSon utility Class is /UI2/CL_JSON_SERIALIZER. It has the following methods:

  • /UI2/IF_SERIALIZE~SERIALIZE
  • /UI2/IF_SERIALIZE~SET_CASE_TYPE
  • GET_VALUE_BOOLEAN
  • GET_VALUE_NUMERIC
  • GET_VALUE_STRING
  • SERIALIZE_TO_STRING
  • ADD_FIELDS
  • CLASS_CONSTRUCTOR
  • GET_VALUES
  • ESCAPE_JSON
  • SERIALIZE_ARRAY_TO_OBJ
  • SERIALIZE_STRUC
  • SERIALIZE_TABLE
  • CONSTRUCTOR

/UI5/CL_DC_JSON_SCHEMA_CHECK

The JSON Class /UI5/CL_DC_JSON_SCHEMA_CHECK is Base class for json checks. Find following the list its main methods:

  • /UI5/IF_JSON_SCHEMA_CHECK_OBJ~GET_SCHEMA
  • /UI5/IF_JSON_SCHEMA_CHECK_OBJ~ON_ERROR
  • /UI5/IF_JSON_SCHEMA_CHECK_OBJ~GET_CHILD_JSON_CHECK_OBJECT

/UI5/CL_JSON_PARSER ( for internal use only )

/UI5/CL_JSON_PARSER UI Theming: JSON Parser (INTERNAL NOT FOR PUBLIC USE)

/UI5/CL_JSON_READ_API

The next JSON ABAP Class is /UI5/CL_JSON_READ_API: Json API. You will find the following Methods:

  • /UI5/IF_JSON_READ_API~GET_NODE
  • /UI5/IF_JSON_READ_API~GET_NODE_BY_SEGMENT
  • /UI5/IF_JSON_READ_API~GET_NODE_VAL_AS_STRING
  • /UI5/IF_JSON_READ_API~GET_NODE_VAL_BY_SEG_AS_STRING
  • NEW
  • SPLIT_PATH_INTO_SEGMENTS
  • GET_NODE
  • COPY_OBJECT_WO_PROPERTY
  • APPEND_SEGMENT_TO_RESULT
  • REMOVE_ESCAPE_CHARS_FROM_SEG

/UI5/CL_JSON_READ_WRITE_API

The methods of /UI5/CL_JSON_READ_WRITE_API are:

  • /UI5/IF_JSON_READ_API~GET_NODE
  • /UI5/IF_JSON_READ_API~GET_NODE_BY_SEGMENT
  • /UI5/IF_JSON_READ_API~GET_NODE_VAL_AS_STRING
  • /UI5/IF_JSON_READ_API~GET_NODE_VAL_BY_SEG_AS_STRING
  • /UI5/IF_JSON_WRITE_API~SET_NODE
  • /UI5/IF_JSON_WRITE_API~DELETE_NODE
  • NEW
  • SPLIT_PATH_INTO_SEGMENTS
  • GET_NODE
  • CREATE_INSTANCE
  • SET_NODE
  • DELETE_NODE

/UI5/CL_JSON_SCHEMA_CHECKER

If you want to check a Json schema is ABAP program, you shoud use the following class /UI5/CL_JSON_SCHEMA_CHECKER.

Check the list of methods for /UI5/CL_JSON_SCHEMA_CHECKER:

  • CHECK
  • CHECK_ENTITY_PROPERTY_CHANGE
  • CHECK_
  • CHECK_VALUE_IN_ENUMS
  • CHECK_PROPS_AGAINST_SCHEMA
  • CHECK_NUMBER_MULTIPLE_OF
  • CHECK_REQUIRED_PROPERTIES
  • CHECK_STAR_PROPERTIES
  • CREATE_CHECK_METH_DATA_CONTEXT
  • CHECK_PATTERN
  • CHECK_ALTERNATIVE_TYPES
  • CHECK_TYPE
  • CHECK_TYPE_ARRAY_ITEMS
  • CHECK_PATTERN_FOR_PROP_NAME
  • CHECK_PATTERN_FOR_PROP_VALUE
  • CHECK_MULTIPLICITY
  • TRAVERSE_FOR_OBJECTS
  • TRAVERSE_FOR_STAR_PROP_OBJECTS
  • RESOLVE_PATH
  • EXTRACT_I18N_TEXT

/UI5/CL_JSON_SCHEMA_DATASOURCE

The schema for datasource can handled using the following JSON ABAP Class /UI5/CL_JSON_SCHEMA_DATASOURCE and the method GET_SCHEMA_CHECK_CLASS

  • IV_CHECK_CLASS_NAME TYPE STRING
  • value( RO_RESULT ) TYPE REF TO /UI5/IF_JSON_SCHEMA_CHECK_OBJ

/UI5/CL_JSON_SCHEMA_INBOUND

The method GET_SCHEMA_CHECK_CLASS in the class /UI5/CL_JSON_SCHEMA_INBOUND will check the schema for inbound

  • IV_CHECK_CLASS_NAME TYPE STRING
  • value( RO_RESULT ) TYPE REF TO /UI5/IF_JSON_SCHEMA_CHECK_OBJ

Other JSON Classes for Schema:

Here the list of relevant JSON ABAP Class for Schema:

/UI5/CL_JSON_SCHEMA_INBOUND schema for inbound

/UI5/CL_JSON_SCHEMA_MODEL schema for model inclusively datasource

/UI5/CL_JSON_SCHEMA_OUTBOUND schema for inbound

JSON Utility Class in ABAP: /UI5/CL_JSON_UTIL

The main utility class for JSON in ABAP is :/UI5/CL_JSON_UTIL JSON utility.

The main methods of /UI5/CL_JSON_UTIL are:

  • IS_WELLFORMED
  • EQUALS
  • GET_FIRST_PROPERTY
  • IS_STRING
  • IS_NUMBER
  • IS_BOOLEAN
  • IS_NULL
  • IS_TYPE
  • SPLIT_PATH
  • EQUALS_INT
  • GET_NUM_NOT_IGNORED_PROPS

You can found an online Json Validator and formatter here.

Prev Article
Next Article
Tags:Datasource JSON Schema Utility Class

Related Articles

domino 163522 1280 e1442441105680
This sample code will delete a customer address following :Delete …

Full ABAP Program How to Delete Customer Address in SAP

JSON and ABAP
JSON is a more and more used when dealing with …

Convert JSON to ABAP Internal Table and ABAP Data to JSON Format

Search on SAP4TECH

The Most Populars

  • The Most Important SAP ISU Tables
    The Most Important SAP ISU Tables
  • SAP Users Tables
    SAP Users Tables (for Personal, Logon, and Address Data)
  • List of SAP Purchase Order Tables in SAP MM SAP PO Tables
    SAP Purchase Order Tables: Main PO tables in SAP MM – SAP PO Tables
  • Full list of SAP Movement Types
    SAP Good Movement Types – Full list of SAP Movement Types
  • The Main SAP GL Account Tcodes SAP GL Account Tables
    The Main SAP G/L Account Tcodes & SAP GL Account Tables
  • SAP BOM Tables
    SAP BOM Tables for BOM Header, Items and components and Category

Related Posts

  • List of Important SAP Material Types in SAP MM e1531389169319
    List of Important SAP Material Types in SAP MM
  • SAP Alternative Unit of Measure for Material
    SAP Alternative Unit of Measure for Material
  • FIXATOR Errors and Fix e1455293383379
    Statement SUBMIT is not allowed in this form
  • SAP License Table
    SAP Address – important Tables and BAPI
  • e commerce 402822 1920 e1469785791965
    EDI 870 : Order Status Report SAP ORDERS05 IDoc Explained

SAP4TECH

SAP and ABAP Free Tutorials

Trending Posts

  • The Most Important SAP ISU Tables
  • SAP Users Tables (for Personal, Logon, and Address Data)
  • SAP Purchase Order Tables: Main PO tables in SAP MM – SAP PO Tables
  • SAP Good Movement Types – Full list of SAP Movement Types
  • The Main SAP G/L Account Tcodes & SAP GL Account Tables
  • SAP BOM Tables for BOM Header, Items and components and Category

The Most Recents

  • The Most Important SAP ISU Tables
  • SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture
  • The Main SAP Dunning Transaction Codes
  • SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)
  • The Most Important SAP Payment Terms Tables (ZTERM, Text…)

Search

SAP Tutorials by Topics

  • SAP Tables
  • SAP Tcodes
  • SAP BAPI
  • ABAP Snippets
  • Top SAP Courses
  • Top SAP Books
Copyright © 2021 SAP4TECH

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
This website uses cookies to improve your experience. We'll assume you accept this policy as long as you are using this websiteAcceptView Policy