New Dictionary Structure Editor
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:
Thank you for sharing.
This feature will be only available in abap 7.5, right ? or in another SP for ABAP 7.4 ?
BR.
Thank you. Yes, Christiano. This feature is only provided as of NW7.5 SP00.
Wow... Thank you @AiE-Team for this great job!
Please do more things like that to make ABAP sexy!
... hope it will reach our daily business in the next 5 years...
Comparing of versions for DDIC structure was never so easy than with eclipse:
In that case I compare a structure between two different ABAP systems:
Regards,
Thomas.
Hi Guys,
I am on NW 7.5 SP01 with Eclipse Neon ADT 2.64.3. Code completion for the typing of fields is not working when looking for data elements. It works fine if I enter "abap." and use ctrl+space then. It shows me all options for different data types then. Without the "abap." code completion windows does not even open though I already wrote something like "zexc". Does anyone else have the same issue? I think about opening an OSS Ticket for this.
P.S. tried the same on Mars with ADT 2.64.2. Same issue.
Best Regards
Tobias
Hi Tobias,
My colleague has just released an SAP Note that should solve this issue: https://launchpad.support.sap.com/#/notes/2353617
Best Regards
Michael
Hi Michael,
thank you very much. I have implemented the Note. Seems to work again. Thank you again!
Regards
Tobias
For information, here is the reference to the official doc (7.5) 🙂 SAP Library - ABAP Dictionary Editors
Hello Wolfgang,
Great news. Good to see that ADT is evolving and closing the gaps with SAP GUI tooling.
I suppose that the DB Tables tooling will follow the same concept as for structures, with some more annotations for the "Technical Settings".
Speaking of DB Tables, any planned date for supporting DB Tables on Eclipse? What about Domains and Table Types?
Regards,
JN
Hi Jose,
we have now the domain editor available with AS ABAP 7.51:
https://blogs.sap.com/2017/02/20/working-now-with-form-based-domains-in-adt/
Editor for DB Tables will come most likely with AS ABAP 7.52 in September.
Table type editor is not yet planned.
Regards,
Thomas.
Hi Wolfgang,
is there a possibility to write ABAP Doc inside this definitions? This would be very helpful, becase than it would be possible to generate nice technical documentation only from source code and data definitions.
Thanx for info in advance,
have a nice day!
O.
Hi Ondrej
Sorry for my late answer!
Objects of the ABAP Dictionary do not support ABAP doc. This functionality is only provided for ABAP objects.
For predefined values, you can use the EndUser annotation to add a short description.
Example: @EndUserText.label : 'Test Description'
Kind regards,
Wolfgang
I'm trying out ABAP in Eclipse in a Mac using version 2.73.2 in Eclipse Neon
SAP GUI for Mac is version 7.40 rev 3
And Backend is SAP_BASIS 750 SP01
Extending structures using the extend type <original_structure> with <append_structure> does not work at all. The line is automatically replaced to define type <structure_name> everytime I save.
It also messes up existing extended structures, I can open them and see the extend type statement, but if I add a field and save it again replaces with define type statement and removes the append structure from the original one, to fix it I have to delete the append structure and recreate it via SE11. Very frustrating..
Hi Giovanni,
technically it is not possible to convert a normal structure into an append structure. Also not by replacing DEFINE TYPE with EXTEND TYPE.
Your second issue sounds like a bug, but we were not able to reproduce it, even on a 7.50 SP01 system.
So please raise a support ticket to report this incident.
Kind Regards,
Michael
Hello,
I am getting a backend error when i try to use the code completion(Ctrl+Space) for "Enhancement Category" annotation.
Here are the details of the error:
------------Text------------------------------
------------ Request -----------------------
------------ Response ----------------------
It's an ABAP 750 SP6 Backend.
Thanks
Suhas
Hello, this is not a comment but a question. When i follow the steps to create the structure, Eclipse opens the screen directly in a SE11 and i haven't found a way to view it in a code based form. Is there something i have to set to be able to see it in the code based form? Can it be probably due to the fact that the SAP system im using for testing is a 7.40? Thank you
Hi Francisco,
the new ABAP Dictionary editor for structures is supported as of SAP NetWeaver 7.5 SP00.
So, it will not work in 7.40.
Kind regards,
Wolfgang
Hello Wolfgang,
Really appreciate your sharing. Using ADT to edit structure is really a fantastic way.
Actually, I was struggling to find the appended structure of the existed structure. It can be found in SE11, but not in ADT. It drives me crazy.
After went through your super great article, I found the icon of the ‘Tonado’. The appended structure info was hidden there. Haha.
Thank you so much and wish to have more handy tips from you.