Tuesday, 9 September 2025

Custom Table Creation in SAP ABAP Cloud — ADT (Developer Extensibility)

 Step 1 — Create the database table in ADT (Eclipse)

1.      In Eclipse ADT: File New Others.




 

 

2.      Search for Database Table and select it Next.




3.      Enter Package, Table name (Z*), and Description Next.

4.      Click Finish (table will be generated).




5.      The generated table will include some technical annotations and a client field.


Technical annotations explanation

When the table is created you will set several ABAP catalog annotations. Here’s what they mean:

1.      End user Text label: This is the description / label that users see for the table.

2.      AbapCatalog.enhancement.category controls whether the table can be enhanced (append/includes):




o   NOT_EXTENSIBLE cannot be enhanced.

o   EXTENSIBLE_CHARACTER can be enhanced only with character fields.

o   EXTENSIBLE_CHARACTER_NUMERIC can be enhanced with character or

numeric fields.

o   #EXTENSIBLE_ANY can be enhanced with any type.

o   In SAP Public Cloud all custom tables are NOT_EXTENSIBLE (Clean Core — append structures / includes not allowed).

3.      AbapCatalog.tablecategory table type:




 

o   TRANSPARENT Table stored in the database. Has physical space in database to hold records.

o   GLOBAL_TEMPORARY (Global_Temporary) holds data only during program execution, data wiped after run (not stored in database).

4.      AbapCatalog.DeliveryClass controls transport & nature of data:

o   A Application table (master & transaction data created during runtime). Example: material company code = master data; SO/PO = transaction data.


o   C Customizing table (data created by customer).

5.      ABAPcatalog.DataMaintenance controls whether table data can be maintained via tools:




o   #RESTRICTED cannot be maintained, only display.

o   #DISPLAY display only.

o   #ALLOWED can be maintained and displayed.

o   #NOT_ALLOWED no display, no maintenance.

o   (This setting defines use with tools like SM30/SE16N — Not applicable in Public Cloud.)

 

 

Client Field explanation




 

·       Key Field: unique field to avoid duplicates. Every key field is usually NOT NULL.

·       Client Field: Created Records will be client-dependent (examples: client 080 / 100). Data Created in 080 will not be visible in 100/

·       Data types & length: define type and length for each field (example: abap.numc(6) → numeric field length 6; values like 123456 only).

·       Not null: must hold a value (cannot be blank) — apply on appropriate fields (especially keys).

 

 

Step 3 Fill table fields (type & length)

·       Add the required fields for the table (e.g., Employee ID, Employee Name, etc.).

·       For every table field, define the data type and length appropriately (Built in type):


·       If the field stores alphabets/characters use abap.char(<length>)

·       If the field stores only numbers (numeric text) use abap.numc(<length>)

·       Choose the length based on the business requirement.

·       Example: For a Mobile Number field, which contains only digits and always 10 characters, the field type should be abap.numc(10).

·       Note: Built-in types (directly using CHAR/NUMC etc.) have a disadvantage: you cannot attach a friendly field label or fixed values for UI. For that use Domain + Data Element (see step 4).

“Complete the table as below by adding the required fields” — add each field with its data type and length.




 

 

Step 4 When built-in types are not enough: Create Domain & Data Element

Why: Built-in types cannot provide friendly field labels or fixed values in UI. If end-users need meaningful names, camel case, or fixed value lists, create a Domain and a Data Element.

Create a Domain

1.      File New Others.




2.      Search for Domain Next.




 

 

3.      Enter Package, Domain name, Description Next.

4.      Set data type (e.g., NUMC), length (e.g., 1) and fixed values if needed.

5.      Activate the Domain.


Now the Domain exists and can be used inside Data element.

Create a Data Element and assign the Domain

1.      File New Others.




2.      Choose Data Element Next.




3.      Give field label(s): short, medium, long (these define how the label will appear in UI; use appropriate lengths).


o   (“short medium long based on value it shriks…” provide labels in those three sizes so UI can pick best fit.)

4.      In the Type/Domain field assign the Domain you created (type name = the Domain).

5.     
Check and Activate the Data Element.

 

 


After activation, use the Data Element as the field type in your table to get good labels and fixed value behavior.

Assign that Data Element to the table field instead of raw built-in type as below.




Step 5 Test the table using ABAP Console (no UI screens)

When you create a Z table and want to test without UI screens (no selection/output screens), use a test class.


1.      File New Others.




2.      Choose ABAP Class Next.

 




 

3.      Add Interface IF_OO_ADT_CLASSRUN’ à To run a Class independently without any user interface.

4.      Put your test logic inside this method ‘if_oo_adt_classrun~main’ (inserts, selects, updates to the Z table, etc.).

5.      Use out->write () to display messages on the ABAP console (for example Success messages or output).


6.      Execute the class on the console (click the Run icon in ADT or press F9).

7.      Check the console output for out->write () messages and test results.

8.      Validate the created/updated records in your table (use SE16-like tools or database view as applicable).




No comments:

Post a Comment