Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

This article explains you all aspects and some details about the new way of accessing ABAP Dictionary structures in your favorite IDE. Just grab a cup of coffee or tea and have fun reading!

The Editor at a Glance

  • Source-based view on dictionary structures
  • Complete lifecycle support (create, read, edit, delete, transport...)
  • No migration needed: Full support for all existing structures
  • Many editor features already in the initial release (such as, syntax highlighting, code completion, navigation, where-used list, code element info, automatic syntax check, context-sensitive help...)

Creating a Structure

Creating a dictionary structure works in the same way as for any other development object supported in ABAP in Eclipse. Choose New -> Other ABAP Repository Object and search for 'Structure'. If you start from a Dictionary node in the Project Explorer you will get the Structure entry already directly in the menu. The creation wizard comes up and requires for a name and a description. If you create the structure in a transportable package, you are also asked for a transport request. So far nothing new until now ...

However, after the structure has been created, the new source-based editor opens up. No more forms, no more menus for attributes, and so on you will get everything at your fingertips in the source code:

Full SE11/Dictionary compatibility - No separate persistence

For those of you who have already worked with Core Data Services (a.k.a DDL Sources, Views etc.) the syntax may look familiar. Well, it looks like CDS, but it's still the ABAP Dictionary. Underneath the new editor, there is still the same dictionary persistence. We have just generated the source code on the fly when we read the structure from the database and converted the code to the existing persistence when saving or activating the structure. By this, we ensure full compatibility to the existing SE11/Dictionary editors, you could even have a look at the old editor by choosing Open With -> SAP GUI in the context menu. But, who wants to do that?

During the creation, we already did some initial work for you. Of course, the provided short description was inserted and is displayed as a so-called Annotation. Annotations start with a @ and can be assigned to the whole structure or single components. The second annotation is the notorious Enhancement Category. By default, we treat every newly created structure to be not extensible. Now, you need to consciously decide if your structure may be extended. If you want to do that, just position the cursor after the # symbol in the annotation. Then, invoke Code Completion (Ctrl+Space) in order to get the possible values:

But, maybe you are still unsure about the semantics of the individual annotations and their possible values. In this case, just open the context-sensitive help by pressing F1 in the editor. In the F1 help we describe all relevant aspects of the new syntax for Dictionary structures:

Everything starts with a DEFINE TYPE

We know, as a developer you don't want to read documentation for hours, you want to start coding. We have already inserted a first dummy component to the structure. Therefore, you can already get an idea how the structure fields look like. However, before you can enter any component, you need to start with a define type <structure_name> { } . Within these curly brackets, you can define the individual components. Every normal component consists of its name followed by a : - thereafter comes the component type. You have several possibilities for the component type, you can use a data element, a predefined type (e.g. abap.char(30)), another structure, a table type or even an object reference. Just play around, open existing structures or see the documentation for all options. But if you know the options from SE11, everything will look very familiar. Note that we don't add anything new and we target full compatibility with the existing options in the ABAP Dictionary.

The editor supports you anywhere

If you used a predefined type for a component, you may want to introduce a short text as well. As mentioned at the very beginning, you should use an annotation for that. Let the code completion guide you to insert one before the respective component or simply copy it:

If you enter a new component, you can again use the code completion to get possible options for the typing. We provide you with the relevant information on the respective types without the need to perform any additional action.

Another feature that saves you a lot of (double) click efforts that you had when you used the SE11 editor:

When you open an already existing structure and want to get an overview on the length of the respective components, just have a look at the code element info (shortcut F2). It works both on the complete structure and individual component types:

Using Value Helps and Check Tables

A central feature of dictionary structures is the possibility to bind components to value helps or check tables. In the SE11 editor, you needed to switch to a new tab to do that. In ABAP in Eclipse, you can do that directly in the coding! Just use the suffixes with value help or with foreign key after the component type and let the code completion guide you through the needed steps. The previously shown example already has such a complete definition - with dedicated bindings for the importing and exporting parameters to other components for the value transfer on the application's UI. Let us remove this binding and try it ourselves, we want to bind the value help SDSH_SPFLI to the component CARRIER_ID. The code completion already proposes us the desired value help together with a popup containing more detailed information. Let's use it:

After that, just keep on using the code completion, it will guide you through the next steps, e.g. the keyword where and the possible parameter assignments:

You see, an assignment starts with the parameter of the respective value help. It is followed by a = sign and the corresponding structure component. In the code completion for the structure parameter, we take care that only compatible components are being proposed, so that your choice becomes easier:

Just add all assignments to the value help addition using the keyword and but don't forget to complete the component definition by using a semicolon at the end:

Check tables are defined in a similar way using the addition with foreign key. Here we recommend a look at the documentation - it also shows some of the specifics especially with respect to cardinalities or check messages.

Include existing structures

Being a lazy developer (as most of us are ;)) you most certainly also want to re-use existing structures and include them as components to your new structure. Here, we also support the feature set of the SE11 structure editor completely. Just directly include a structure, additionally use a suffix or give it a new name:

Of course, the code element info will display all the components in this structure - both the directly included ones and the ones coming in by an include:

If you press the small buttom at the bottom of the code element info view, you can even get a hierarchical display of the different includes. If you want to switch back again, you find a similar button also there:

Being a good merchant

If you want to sell or buy goods, you need to know what you are talking about. If somebody asks you: "How much water would you like to drink?" you would certainly not just answer "2" - just because the other person would ask "2 what? Glasses, bottles, gallons..?". You always need a unit of measure if you talk about amounts. The same story applies when it comes to payment, especially in an international context. If you answer "150" to the question "How much does it cost?" - you could mean Euro, US-Dollars, or maybe even Icelandic Kronur - that's why you always need to add the currency code to an amount of money.

This duality is also reflected in structures. You always need to enter a currency field together with a currency key and an amount field together with a unit field. In the source-based editor this assignment is done via dedicated annotations before the respective fields. The following example shows a currency and a currency key field:

For additional details on the syntax please again have a look at the documentation or try it out yourself with the code completion. You will also get some handy templates that will do most of the work for you:

Extend other structures

If you chose to let your structure be extended by others, they also want to develop these so-called append structures with ABAP in Eclipse. Of course, this is also possible. Though we don't provide a native creation wizard for new append structures yet, you can simply choose to create a normal structure and turn it into an append structure by changing a single line of code. Instead of define type you say extend type <original_structure> with <append_structure>. The other syntax remains the same - with one addition: You can bind a component from the original structure e.g. to another value help or check table. Just use the keyword extend followed by the name of the original component and use the already introduced syntax for a value help or foreign key binding. Again, please see the F1 documentation in the editor for additional details. Such an append structure with a single additional component may look like that:

After a refresh, the original structure indicates the existence of the new append by the enhancement symbol. Just hover over it and you see the details and can also navigate to it:

Labels in this area