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…)

/wp-content/uploads/2015/10/1_806308.png

Creating a Structure

/wp-content/uploads/2015/10/2_806309.png

/wp-content/uploads/2015/10/3_806310.png

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 …

/wp-content/uploads/2015/10/4_806311.png

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:

/wp-content/uploads/2015/10/5_806312.png

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:

/wp-content/uploads/2015/10/6_806313.png

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:

/wp-content/uploads/2015/10/7_806314.png

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:

/wp-content/uploads/2015/10/8_806324.png

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:

/wp-content/uploads/2015/10/9_806325.png

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:

/wp-content/uploads/2015/10/10_806326.png

/wp-content/uploads/2015/10/11_806327.png

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:

/wp-content/uploads/2015/10/12_806328.png

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:

/wp-content/uploads/2015/10/13_806329.png

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:

/wp-content/uploads/2015/10/14_806333.png

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:

/wp-content/uploads/2015/10/15_806334.png

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:

/wp-content/uploads/2015/10/16_806352.png

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:

/wp-content/uploads/2015/10/17_806353.png

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:

/wp-content/uploads/2015/10/18_806369.png

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:

/wp-content/uploads/2015/10/19_806351.png

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:

/wp-content/uploads/2015/10/20_806342.png

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:

/wp-content/uploads/2015/10/21_806344.png

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:

/wp-content/uploads/2015/10/22_806343.png

To report this post you need to login first.

15 Comments

You must be Logged on to comment or reply to a post.

  1. Jens Knappik

    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…   

    (0) 
  2. Thomas Fiedler

    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:

    06-11-2015 14-53-03.png

    Regards,

    Thomas.

    (1) 
  3. Tobias Schnur

    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

    (0) 
  4. Jose Nunes

    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

    (0) 
  5. Ondrej Seman

    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.

    (0) 
  6. Wolfgang Woehrle Post author

    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

    (0) 
  7. Giovanni Degani

    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..

    (0) 
  8. Michael Gutfleisch

    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

    (0) 
  9. Suhas Saha

    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——————————

    com.sap.adt.communication.resources.ResourceException: Execution of request "GET /sap/bc/adt/ddic/elementinfo?path=%23EXTENSIBLE_CHARACTER_NUMERIC&type=ddicAnnotationValue" failed: 500 Internal Server Error
    Typ von Objekt #EXTENSIBLE_CHARACTER_NUMERIC konnte nicht ermittelt werden

    ———— Request ———————–

    GET /sap/bc/adt/ddic/elementinfo?path=%23EXTENSIBLE_CHARACTER_NUMERIC&type=ddicAnnotationValue HTTP/1.1
    Accept: application/vnd.sap.adt.elementinfo+xml
    User-Agent: Eclipse/4.6.3.v20170301-0400 (win32; x86_64; Java ) ADT/2.73.1
    X-sap-adt-profiling: server-time

    ———— Response ———————-

    HTTP/1.1 500 Internal Server Error
    ~server_protocol: HTTP/1.1
    X-sap-adt-profiling: server-time=1625
    Content-Type: application/xml
    <?xml version="1.0" encoding="utf-8"?>
    <exc:exception xmlns:exc="http://www.sap.com/abapxml/types/communicationframework">
    	<namespace id="com.sap.adt.ddic.elementinfo"/>
    	<type id="NoAccessToDdicMetaData"/>
    	<message lang="EN">Typ von Objekt #EXTENSIBLE_CHARACTER_NUMERIC konnte nicht ermittelt werden</message>
    	<localizedMessage lang="DE">Typ von Objekt #EXTENSIBLE_CHARACTER_NUMERIC konnte nicht ermittelt werden</localizedMessage>
    	<properties>
    		<entry key="MessageType">Error</entry>
    	</properties>
    </exc:exception>

    It’s an ABAP 750 SP6 Backend.

    Thanks

    Suhas

    (0) 

Leave a Reply