Tag: abap
-
ABAP Value Optional and Default value
With the new ABAP syntax, you can use the VALUE keyword to extract an entry from an internal table. So as an example, we have defined an internal table called lt_items which should be read with id = 2. So, if an entry with the component id = 2 exists, it will be transferred to…
-
How to create an own switch with the Switch Framework from SAP?
You may have experienced the case, that you must implement something, and then you need to build a switch to simply turn on or off your implementation or a part of it. For that, SAP has implemented the Switch Framework, where you can simply define states of “functions” via switches. In this short demo, I…
-
How to create a simple Z-BAdI definition?
In this short demonstration, I have tried to create a custom Z-BAdI definition for a project. This allows you to build a product report and classes and allowing the customers to build later custom logic thanks to the enhancement spots and BAdIs. Until now, I only have always implemented standard BAdIs from SAP directly. In…
-
How to use and customize ECENV_*?
There are some various transactions with the prefix ECENV_*. Some of them are here, which are standard included: Transaction Description ECENV_CO Connection object ECENV_BP Business partner ECENV_DV Devices Table of possibile ECENV_* transactions in a SAP system. Extending objects When you want to extend an object, we need to create a new subtype from a…
-
How to import an abapGit repository with existing objects in the target system?
You may have asked yourself, how to simply transfer objects from one SAP system to another SAP system easily. For that we can use abapGit, a simple tool, which can be installed via SE38 by a standalone installation. Next that you can export the repository objects into a Github online repository, you may can also…
-
How to use table functions with CDS views?
In this short tutorial, I want to showcase you, how to use table functions. Table functions allows you to simply define a CDS structure and later a view to be consumed by other CDS views or custom ABAP logic. The underlaying data acquisition differs from the normal CDS view entities. It can refer to a…
-
Using table comprehensions and reductions
I recently came across to useful features in the new ABAP syntax. These two functions relay on internal tables, where you can do some quick operations on it. Table comprehension The first example loads initially a table or a view to the variable lt_connections. The lt_connections contain later the fields, which are in the work…
-
How to assert an exception message in ABAP Unit test
How may have the requirement to assert in a unit test an exception, which has been thrown. To properly test, if the thrown message is equal to the expected message, we can check the message ID. So first, let’s assume that we have a method, which throws a custom exception. Our exception class contains some…
-
Setup a simple access control for your CDS View
When we define a CDS view with our ADT tools, we provide a useful tool to query data from database tables and more. Since may your data has to been protected, we can use the access control to set the visibility of our data, who can access it and exactly what data can be queried.…
-
How to add a determination for your SAP RAP application?
With a determination, you can modify an entry via the Entity Manipulation Language to fill out automatically the necessary fields needed. For example, when you type a username inside a field, you may want to extend that in the database as well as in the view with the full name, so that it can be…