SAP Tables: How to Create SAP ABAP Tables

SAP Tables

Unlike other Database where we write SQL commands (DDL) to create table, SAP provides us option to create Tables in ABAP Dictionary. Upon Activation, SAP Tables are actually defined in database.

Creation of SAP Tables:

#Using ABAP Dictionary

Step 01: Open SE11.

Step 02: Click Database table Radio Button and give your Table name starting with Z or Y e.g. “ZBarry_Table”.

Step 03: Click Create, Enter explanatory description for table in Short Description e.g. “Table for Test”.

Step 04: Under Delivery & Maintenance tab maintain the following:

 FIELDS Value Description
Delivery Class Select from given drop down

A –Application Table

C – Customer Table

A Delivery class controls the transport of table data.
Data Browser/ Table View Maint. Select the Maintenance option from given drop down If allowed, It allows the table owner to maintain data via SE16.

 

Step 05: Under Fields tab maintain the following:

FIELDS Value Description
Field It can be 16 digit Alphanumeric word starting with a letter and can contain underscore It is the column name of your table
Key Tick all the fields whose value will be unique and can define the relationship with other tables A table must contain at least one key field, else it can’t be activated.
Initial Value Indicator Tick if the field must have an initial value All key fields must always be given initial values. By default all fields are assigned initial values irrespective of indicator.
Data Element Select your Data Element or create one If you are not using Predefined Type, you need to provide a Data Element
Predefined Type : If you are not using Data Element, click the Predefined Type tab & enter following:
Data type Any Data type like CHAR,INT According to requirement specify the data type
Length Give max length of your field Length will be dependent upon Data Type
Decimal places Number of places after decimal point Mainly for Float variables
Short description Explanatory statement for your field What your field means/doing
Include Structure: Whenever we include a structure in table, it might have fields with same name as there are other fields in table. To avoid conflict we address the field with a suffix (3-27 Character with ‘-‘) for that structure. This suffix is given in Group tab.
Group 3-27 Character To Address Include Structure fields

 

Note: Maintain foreign key relationship by clicking. Also maintain Search Help by clicking Srch Help tab.

Step 06: Under Entry help/check tab maintain the following: It will be maintained automatically after step 05. [You can skip this step]

FIELDS Value Description
Field Same as above Same as above
Data Element Same as above Same as above
Data Type Same as above Same as above
Foreign Keys Foreign Keys for that field It will be reflected after you maintain Foreign Key relationships
Check Table Check Table for Field It will be reflected once you have check table relationship for the field
Origin of input help Input help with fixed values, with check table, search helps, Static Input Help It reflects the way your input will be made to the given field
Srch Help Your Search Help name To attach Search Helps to field
Defaults Any Value depending upon the type of field To assign Default value for the field
Domain Domain of specified Data Element If your Data Element has a Domain, it will reflect here

 

Step 07: Under Currency/ Quantity Fields tab maintain the following: [You can skip this step]

FIELDS Value Description
Field Same as above Same as above
Data Element Same as above Same as above
Data Type Same as above Same as above
Reference Table Reference Table name If your data element refers to a table
Reference Field Field of Reference table being Referred It is actually the field being referred by the data element
Short Description Same as above Same as above

 

Step 07: Maintain Indexes and Append Structure from respective tab. [You can skip this step]

Step 08: Maintain following @Technical Settings: [Important Step]

FIELDS Value Description
Data Class APPL0 – Master Data
APPL1 – Transaction DataAPPL2 – Organizational Data
It describes the type of Data you will be storing
Size category From 0 to 4 It defines the expected space required for table in database
Buffering Choose from Radio Button It tells whether your table will be using buffering or not. If yes, then which type of Buffering.

 

Step 09: Once all the above fields are maintained, save, check for errors and activate your table.

 

Additional Information

 

  • All Key fields should be maintained in the beginning.
  • Maximum 16 key fields are permitted per table.
  • Length of key field can be max 255 characters (and 120 if data is to be transported).
  • A table can have total 249 fields.
  • A field name must not be longer than 16 characters.
  • Fields of type STRING, LRAW, LCHR must be at the end of table.
  • Fields without data element cannot have foreign keys, F1 Help and fixed values.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.