This is a test message to test the length of the message box.
Login
ABAP Tools Work with Eclipse
Created by Software-Heroes

ABAP Tools - Work with Eclipse (Table creation)

1872

In this article we will go over the flow for creating tables in the ABAP Development Tools and how you can easily design it.

How do you actually create a table using the ABAP Development Tools? Are there any tricks to increase the speed and is it actually slower than via the SAP GUI? In this article we clarify the questions.

 

Introduction

We repeatedly receive feedback from ABAP developers that, despite using the ABAP Development Tools (ADT), they still like to create their tables using transaction SE11. Why? Many find the SE11 to be tidier and the functions easier to use. Defining foreign key relationships is easier because there is a small wizard in the SAP GUI. Let's now look at the system in the ADTs to check whether the system is really that difficult.

 

Hint: The steps shown may differ depending on the backend, especially for a non-S/4 system, as some objects probably do not have ADT support. We created our example on the ABAP Environment, so the full scope is always available to you.

 

Table

The table is created via the context menu on the package. If there is already a table in the package, you can save some time and create a new table directly in the “Database Tables” directory. In our example we create the table via the package:

 

Search for database ("database") among the objects to limit the selection and get the appropriate object directly.

 

Just use “Next” to store the relevant data for the name of the table and the description. You can easily change the description later.

 

We now get an empty table in the text editor, the client field has already been created, the technical properties and the description can be maintained above the table. This makes these properties easier to access than in the SAP GUI.

@EndUserText.label : 'Table with Content'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zbs_dmo_table {

  key client : abap.clnt not null;

}

 

Fields

In the next step we define the key and the various fields that our table still needs. We can first write down the field names and data types and do not have to pay attention to errors. This provides you with data elements or built-in data types that can be easily inserted.

 

The search help is available to you via the quick fix via CTRL + 1. If the data element has already been created, you can search for it this way, simply start with the name and then call up the quick fix to get initial suggestions.

 

The table still has a few "errors" that we'll take care of right away.

 

Data elements and domains

For the data elements and domains, we can now use forward navigation to define the missing elements. To do this, simply go to the missing data element and call up the quick fix using CTRL + 1 to start the wizard for the system.

 

The package and the name of the data element are preset directly from the table, so we only have to enter the description. Then just confirm with ENTER to carry out the assignment to the package and end the dialog.

 

In contrast to the SE11, the domain and the texts are in one overview and are therefore easy to maintain without navigation. You save a lot of time without changing tabs, especially if you have to create a lot of elements.

 

In the “Type Name” field, Content Assist is active (small light bulb) to search for existing elements. Once the name of the domain has been entered, you can directly define the domain using forward navigation by clicking on the link in front of the field. The package and the name are also preset here, so we only have to enter the description. In the domain we can then enter all the information on an image as usual.

 

To finish, simply go backwards, activate the domain and close it. Activate and close the data element and be back in the view of the table. Each object opens as a window in Eclipse, so you can easily close it again.

 

Hint: In some cases it is also worthwhile not to use a domain at all, but only to use the built-in data type at the data element level. In most cases, the texts are what are needed. So if you don't need a case-sensitive, fixed value, value table or conversion routine, then you can usually save time here.

 

Semantic

The last error relates to the missing assignment of the currency field to the amount. Here Eclipse helps us again with the quick fix and offers us the option to expand the field accordingly.

 

The “Semantics” annotation is added automatically and a suggestion from the current table is used, saving us a lot of typing work.

@Semantics.amount.currencyCode : 'zbs_dmo_table.currency'
amount : abap.curr(15,2);

 

Foreign key

The table could now be activated and is therefore usable. But we also defined a foreign key in the table. In the SE11 we would now have a corresponding wizard to link the table and the individual fields. How does this work in the ABAP Development Tools? To do this, we place the cursor behind the data element and in front of the semicolon and press ENTER to jump to the next line. Now you have the option, for example, of typing the keyword “key” or “foreign” and using CTRL + 1 to call up the quick fix.

 

The template “foreignKey” is suggested, which we now want to insert. The template is inserted in edit mode, so you have the option to jump to the individual brands using TAB. This is how we define the table, the client and the key field. When saving, the statement is formatted cleanly again.

@AbapCatalog.foreignKey.screenCheck : false
sec_key     : zbs_demo_tab_key
  with foreign key zbs_dmo_tab
    where client = syst.mandt
      and tab_key = zbs_dmo_table.sec_key;

 

The template can help you if you want to define foreign key relationships and don't know the current expression.

 

Technical settings

You can find the other technical properties in the “Project Explorer” if you open the folders under the table. The properties are well hidden, but from experience we can say that we only need them in the rarest of cases.

 

Double-clicking opens a separate window to define the various properties, such as logging or table buffering.

 

Display fields

What about tables with many includes? Let's look at a standard table in the system, BUT000, the general data about the business partner.

 

We see all the defined fields in the table, but the includes are not resolved. This means we don't have a full overview of the content and would have to laboriously navigate through the individual includes. To do this, we can place the cursor on the name of the table and open the element info with F2.

 

Here you get all the information about the table, such as information about the keys, data types and the descriptions of the individual fields.

 

Conclusion

Creating a table via the IDE is a matter of practice and works very quickly in both environments. There are a few advantages in Eclipse and after getting used to it you'll find your way around just as quickly. The prerequisite is an S/4 HANA system in order to have the full range of functions available.


Included topics:
ToolsADTEclipseTable creation
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP Tools - Configure Tool Bridge

Category - ABAP

Let's take a look at what the Tool Bridge is in the ABAP Development Tools and how you can easily configure it.

05/28/2024

ABAP Tools - Work with Eclipse (Execute object)

Category - ABAP

In this article a little tip for starting objects directly, without having to go through the display of the object.

03/19/2024

ABAP Tools - Work with Eclipse (Source code compare)

Category - ABAP

Here we look at how we can use the ABAP Development Tools to compare source code, both across systems and the latest versions.

12/01/2023

ABAP Tools - Work with Eclipse (Performance Analysis)

Category - ABAP

In this article we look at the performance analysis of objects using the ABAP development tools and the possibilities of traces.

11/24/2023

ABAP Tools - Work with Eclipse (CDS Analysis)

Category - ABAP

In the complex world of CDS views, it is important to have the right tool at hand to ensure an analysis of the structures and data sources.

08/25/2023