Wednesday, May 31, 2017

Creating tables with the AET in SAP CRM

Most of us are aware of the AET, the Application Enhancement Tool. It can be used to add fields to standard SAP objects in a safe and flexible way. It is also possible to create new relations with 1-to-many relationships to standard SAP Objects with the AET.

It has been possible for a long time to enhance the Genil model of standard SAP objects with new 1-to-many relations. The process however can be a bit cumbersome. One good overview can be found here. We need to write quite a bit of code and customizing, which can be error prone to get just right.

When you use the AET to create a new table, most of this work will be done automatically. We will walk through the process and discuss alternatives.


The AET will generate a basic UI for your table. You are expected to supply a UI Component during the definition of the table:

  • In the GUI, navigate to transaction AXTSYS
  • Click on Generate UI Component and supply a name.

You might get the following warnings:

  • Errors during generation of object ZWILCOAETTABLE:
  • Generation of SICF node for ZWILCOAETTABLE has failed
  • The associated SICF node zwilcoaettable could not be created automatically.

These errors do sometimes signify an authorization problem, but it is also possible that the SICF node already exists.

Extending with EAT

Start the Web UI with Business Role ADMIN
Navigate to Tools > Enhance Applications

Click New and select the Object that you want to enhance. In our example we choose the APPOINTMENT

In the next screen you can either add fields to the object or complete tables.

Click on New in the Table Assignment Block and define to which part of the BO the extension belongs. In our case it is the Order Header (ORDERADM_H).

Fill in the details of your table. For component, supply the component from the preparation, for window, supply a new window name. The window will then be generated by the AET.

For each field you can supply additional details, as you are able to do with structure extensions in the AET

When you're done, navigate back to the Object Extension Screen. You can now Save and Generate the extension.

Get a cup of coffee.
After generating, you can start using the table in the Web UI, it should already be available in the UI Configuration of your object:

Now you can populate your table with data:

In the background, the following objects have been generated:
  • A transparent ZTable to hold your data
  • API function modules (Do not modify ztable directly, but always via API modules)
  • All required Genil configuration/implementation
  • A basic Table view in a UI Component
  • The CRM Order API, including CRM_ORDER_READ, CRM_ORDER_MAINTAIN is made aware of the extension

Extending the AET extension

But what if the generated UI is too limited for your taste? It is possible to modify the generated component. But your modifications can be overwritten when someone regenerates the table with the AET. However: You can safely ignore the generated UI Component and bring you own. All the basic CRUD logic is already contained in the BOL object, so you can just create a new UI Component and present the data in a suitable way.

When to use

If you are interested in a flat table with no real business logic in the Genil Layer (besides simple CRUD logic), then use the AET. It is the quickest and easiest method to add new tables to standart SAP objects. If you are not happy with the generate UI, you can bring your own.

Another strong point is that not only the Genil/Bol layer is enhanced, but other API as well. This means you can also read and modify data with CRM_ORDER_READ, CRM_ORDER_MAINTAIN (and for example, idocs).

When you need more control and flexibility in the CRUD logic of your object, or even a multi-level hierarchy with multiple tables consider using the manual approach as shown in the link at the beginning of this post.

+ Quick and easy
+ Modifies most standard API's (Function Modules, Idocs etc)
+ UI can be modified easily
- Limited flexibility in adding business logic

Manual extension:
+ More flexibility in business logic
- Complex, error prone
- New data is only available in Genil layer

No comments:

Post a Comment