abap-platform-yy
A demo library for the ABAP Environment that reads a variable's type and value at runtime as RTTI does, published to show what APACK, the ABAP package and dependency manager, can do.
Reading a variable's type and value at runtime on the ABAP Environment normally means reaching for the officially supported RTTI classes. This sample builds an alternative library instead, called the YY Data Service, purely to demonstrate APACK, the ABAP package and dependency manager: an instance of ZCL_YY_ABAP_DATA_SERVICE describes a data element's name and type through GET_DESCRIPTOR and returns its value, structure or table content through GET_VALUE. It only handles simple data types, structures and tables, not reference types, and the README says as much: this is a demo, and production code should use the supported RTTI.
Facts
Where it sits
Who is behind it
In the atlas: maintains 222@SAP-samplesmaintainerAjinkya PatilContributes to this
In the atlas: contributes to 112@ajinkyapatil8190Brian BernardContributes to this
In the atlas: contributes to 64@btbernardJonathan BakerContributes to this
In the atlas: contributes to 9@jonathanbaker7Sebastian WolfContributes to this
In the atlas: contributes to 22@SebastianWolf-SAP4 contributors
What it declares
Every artifact
- Type
- Sample
- Origin
- By SAP
- Use as
- A reference
As a sample
- Form
- does not say
Connections
Keeping source and development objects in version control
JSON-to-ABAP conversion library sample showing what APACK can do
Git client written in ABAP that runs inside the system
Download
README
quoted from SAP-samples/abap-platform-yy under Apache-2.0, readYY Data Service
Attention: This is sample code!
This repository contains sample code which should not be used in production. It only shows the capabilities of APACK - the ABAP package and dependency manager.
A Poor Man's RTTI for the ABAP Environment on SAP Cloud Platform
This small library - called the YY Data Service - is an alternative approach towards RTTI on an ABAP system running on the SAP Cloud Platform. Keep in mind that this is just a demo. In production, you better use the officially supported RTTI...
Prerequisites
Please make sure to fulfill the following requirements:
- You have access to an SAP Cloud Platform ABAP Environment instance (see here for additional information)
- You have downloaded and installed ABAP Development Tools for SAP NetWeaver (ADT)
- You have created an ABAP Cloud Project in ADT that allows you to access your SAP Cloud Platform ABAP Environment instance
- You have installed the abapGit plug-in for Eclipse via the updatesite
Download and Installation
Use the abapGit plug-in to install the YY Data Service by executing the following steps:
- In ADT create the package
/DMO/YYas a subpackage under/DMO/SAP(keep the defaulted values) - In ADT click on
Window>Show View>Other...and choose the entryabapGit Repositoriesto open the abapGit view - Make sure to have the correct ABAP Cloud Project selected (See the little headline in the abapGit view for the current project)
- Click on the
+icon to clone an abapGit repository - Provide the URL of this repository:
https://github.com/SAP/abap-platform-yy.git - On the next page choose the master branch and provide the package
/DMO/YY - Provide a valid transport request and choose
Finish. This starts the cloning of the repository - which might take a few minutes - Once the cloning has finished, refresh your project tree
- Usually, the imported objects are not activated after cloning. Use the mass activation feature in ADT to activate those artifacts.
Usage
If you want to get some information about ABAP data in the Cloud, YY makes it really easy for you. The service is ready-to-use, no configuration is necessary. Simply get an instance of the service class by calling ZCL_YY_ABAP_DATA_SERVICE=>CREATE_INSTANCE. The one and only parameter I_DATA expects the data which you want to investigate.
The resulting object of type ZIF_YY_DATA_ELEMENT has two methods, GET_DESCRIPTOR and GET_VALUE.
ZIF_YY_DATA_ELEMENT=>GET_DESCRIPTOR
This method returns an object of type ZIF_YY_DATA_DESCRIPTOR which describes the metadata of the respective element. If the element has a name (e.g. as a structure element), you'll find this name by calling the method GET_NAME. If there was no name, it will return the value of ZIF_YY_DATA_DESCRIPTOR=>CO_UNNAMED_OBJECT. The more important information is probably the type of the data element which you can get by calling GET_TYPE. This one returns an instance of the interface ZIF_YY_DATA_ELEMENT_TYPE. It's currently one and only method GET_TYPE_NAME returns a textual representation of the data type. Constants for currently supported ones can be found in the interface ZIF_YY_DATA_ELEMENT_TYPE as well. Depending on this format you need to decide which format your variable needs to have which you use to get the actual data from GET_VALUE...
ZIF_YY_DATA_ELEMENT=>GET_VALUE
If you have a simple data type such as a number or text, you get it directly back using this method. For structures and tables it's slightly more difficult. There you get the full information about the structure or the table in a nice format, either ZIF_YY_DATA_ELEMENT=>TY_STRUCTURE or ZIF_YY_DATA_ELEMENT=>TY_TABLE. They feature the structure elements or the table lines with their corresponding data element objects in their original order of sequence.
Limitations
Currently no support for objects (reference types), only simple data types, structures and tables. And it's not even guaranteed that it works for them as you might expect... It's sample code!
Known Issues
As mentioned before, after cloning a abapGit repository some objects might not be active. Use the mass activation feature in ADT to activate those artifacts.
License
Copyright (c) 2019-2026 SAP SE or an SAP affiliate company.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use any file of this project except in compliance with the License.
You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.
Details
Sources
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
abaplint
Flavors
“You have created an ABAP Cloud Project in ADT that allows you to access your SAP Cloud Platform ABAP Environment instance” — SAP-samples/abap-platform-yy — README, Requirements
History in the atlas
- First seen.
For your agent
- Ref
artifact:sap-samples-abap-platform-yy- JSON
- /artifacts/sap-samples-abap-platform-yy.json
- MCP
- Connecting an agent