SAP Tables: How to Create SAP ABAP Tables

by | Apr 13, 2018 | ABAP Beginner

Home » SAP » ABAP » ABAP Beginner » SAP Tables: How to Create SAP ABAP Tables

Preface – This post is part of the ABAP Beginner series.

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:

 FIELDSValueDescription
Delivery ClassSelect 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 downIf allowed, It allows the table owner to maintain data via SE16.

 

Step 05: Under Fields tab maintain the following:

FIELDSValueDescription
FieldIt can be 16 digit Alphanumeric word starting with a letter and can contain underscoreIt is the column name of your table
KeyTick all the fields whose value will be unique and can define the relationship with other tablesA table must contain at least one key field, else it can’t be activated.
Initial Value IndicatorTick if the field must have an initial valueAll key fields must always be given initial values. By default all fields are assigned initial values irrespective of indicator.
Data ElementSelect your Data Element or create oneIf 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 typeAny Data type like CHAR,INTAccording to requirement specify the data type
LengthGive max length of your fieldLength will be dependent upon Data Type
Decimal placesNumber of places after decimal pointMainly for Float variables
Short descriptionExplanatory statement for your fieldWhat 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.
Group3-27 CharacterTo 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]

FIELDSValueDescription
FieldSame as aboveSame as above
Data ElementSame as aboveSame as above
Data TypeSame as aboveSame as above
Foreign KeysForeign Keys for that fieldIt will be reflected after you maintain Foreign Key relationships
Check TableCheck Table for FieldIt will be reflected once you have check table relationship for the field
Origin of input helpInput help with fixed values, with check table, search helps, Static Input HelpIt reflects the way your input will be made to the given field
Srch HelpYour Search Help nameTo attach Search Helps to field
DefaultsAny Value depending upon the type of fieldTo assign Default value for the field
DomainDomain of specified Data ElementIf 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]

FIELDSValueDescription
FieldSame as aboveSame as above
Data ElementSame as aboveSame as above
Data TypeSame as aboveSame as above
Reference TableReference Table nameIf your data element refers to a table
Reference FieldField of Reference table being ReferredIt is actually the field being referred by the data element
Short DescriptionSame as aboveSame 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]

FIELDSValueDescription
Data ClassAPPL0 – Master Data
APPL1 – Transaction DataAPPL2 – Organizational Data
It describes the type of Data you will be storing
Size categoryFrom 0 to 4It defines the expected space required for table in database
BufferingChoose from Radio ButtonIt 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.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

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

Author