Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
mickaelquesnot
Active Participant
https://youtu.be/8kIIq1MIeSc

Public share link is on.
This item can be accessed by anyone with the public link

https://icedrive.net/s/APyBWPS1tfDC5XRWt6wgj4DwAWhV

Tables
Definition
Tables can be defined independently of the database in the ABAP Dictionary. The fields of the table are defined with their (database-independent) data types and lengths.
When the table is activated, the system creates a physical table definition in the database for the table definition stored in the ABAP Dictionary. The system translates the table definition from the ABAP Dictionary to a definition of the particular database. You can see these relations between the ABAP Dictionary and the database in the following figure.

Structure
A table definition in the ABAP Dictionary contains the following components:
● Table Fields:
Table fields define the field names and data types of the fields contained in the table
● Foreign keys:
Foreign keys define the relationships between the table and other tables.
● Technical settings:
Technical settings control the creation of the table in the database.
● Indexes:
To speed up data selection, secondary indexes can be created for the table.
The customer can modify SAP tables with append structures and customizing includes. This kind of modification ensures that the customer enhancements are automatically merged with the new versions of the SAP tables when there is a release upgrade.
See also:
Creating Tables
Making Changes to Tables

Step 1: Enter transaction code SE11 from where we can create a table and press Enter.

Step 2: You will get below window. Enter the table name which you want to create.
Note: Table name should start with Y or Z only.

Step 3: Click on Create button. You will get below window.

Step 4: Enter Short Description. Enter Delivery Class as A. Select Display/Maintenance Allowed from the dropdown Data Browser/Table View Editing.

 

What is Delivery Class?

Delivery class
Delivery class for database tables
Delivery class for controlling data transport of tables for installation, upgrade, and client copy, and for transporting between customer systems. The delivery class is also used in extended table maintenance.
See
• Task-Oriented Instructions
• Reference Documentation for Delivery Class of Database Tables

Delivery class is how database table is going to be transported during installation, upgrade, and copies within landscapes, clients and customer systems.
Types of Delivery Class
There is a total of 7 Delivery Classes in SAP ABAP.
A Application table (master and transaction data)
C Customizing, maintenance only by customer, no SAP imports
L Local data, delivered empty
G Customizing, protected against SAP updates, only INS allowed
E Control table, SAP and customer have separate key areas
S System table, edited only by SAP, change = modification
W System table, contents transportable by separate TR objects
1. A
If we select this delivery class type that means, we are creating application table which contain master data or transaction data. Application Tables are transported to the customer as empty.
Master data means the data which rarely gets changed. For example, Customer data, Address data.
Transaction Data means the data which change frequently. For Example, Sales Data.
2. C
These are client specific customer table used for customizing application. Here data is only entered by the Customer.
3. L
These tables used to store temporary data. Tables are delivered to customer as empty.
4. G
Customer table where SAP can add data but cannot modify or delete it.
5. E
System table in which customers can make entries. System tables are delivered with some data.
6. S
These tables are System table delivered by SAP with predefined data as part of system.
7. W
System table for system administration data. A system table in the delivery class W usually delivered with predefined data by SAP.

Data Browser/Table View Editing

Indicates maintenance with standard tools allowed
Definition
This indicator specifies whether it is possible to display/maintain a database table or view using the tools "Data Browser" (transaction SE16) and "Table View Maintenance" (transactions SM30 and SM31).
See
• Task-Oriented Instructions
• Reference Documentation for Display and Maintenance of Database Tables

Data browser/table view editing allows you to edit the contents of the table, create entries into the table, delete entries from the table using table maintenance tools.

Table maintenance tools are data browser (Transaction SE16N),

table/view maintenance (Transaction SM30/SM31)

and Generate Table maintenance Dialog (Transaction SE54).

There are four options in data browser/table view editing.

1. Display/Maintenance allowed with restrictions
If we select this option in dropdown, using data browser (Transaction SE16) display of the table contents is possible but no maintenance is allowed.
Using table/view maintenance (Transaction SM30/SM31) display and maintenance of the table/view is not allowed.
Using Generate Table Maintenance Dialog (Transaction SE54) tool only display of the table contents is allowed no maintenance.
2. Display/Maintenance Allowed
If we select this option in dropdown, using data browser (Transaction SE16) display of the table contents as well as maintenance of table/view is allowed.
Using table/view maintenance (Transaction SM30/SM31) display and maintenance of the table/view is allowed.
Using Generate Table Maintenance Dialog (Transaction SE54) tool display of the table contents and maintenance is allowed.
3. Display/Maintenance Not Allowed
If we select this option in dropdown, using data browser (Transaction SE16) display of the table contents as well as maintenance is not allowed.
Using table/view maintenance (Transaction SM30/SM31) display and maintenance of the table/view is not allowed.
Using Generate Table Maintenance Dialog (Transaction SE54) tool display of the table contents as well as maintenance is not allowed.
4. Only Display Allowed
If we select this option in dropdown, using data browser (Transaction SE16) display of the table contents is possible but no maintenance is allowed.
Using table/view maintenance (Transaction SM30/SM31) display is allowed and maintenance of the table/view is not allowed.
Using Generate Table Maintenance Dialog (Transaction SE54) tool only display of the table contents is allowed no maintenance.

Step 5: Press Save button and save it in your existing package. Click on Fields Tab. You will get below window.

 

 

 

 

 

 

 

Step 6: Add fields into the table. First add MANDT field and make it key also add the MANDT as a data element. Press Enter.

FIELDS TAB
ADD FIELD / DATA ELEMENT

 

 

 

What is MANDT?
MANDT is a client field. Here client means area. If we have MANDT field in our table that means table is client dependent and if we don’t have that field that means table is client independent.
Client dependent means if we create table in one client it will be accessible only in that client and it is not accessible in other clients.
Client independent means if we create table in one client it will be accessible in that client and other client also.
MANDT is a standard data element which is already created by SAP. Hence, we are reusing it here.

Step 7: Add fields into the table. First add BUKRS field and make it key also add the BUKRS as a data element. Press Enter.

 

 

CLICK ENTER

 

 

 

Foreign Keys
Use
You use foreign keys to define relationships between tables in the ABAP Dictionary, create value checks for input fields and link several tables in a view or a lock object.
Features
Field Assignment in the Foreign Key
A foreign key links two tables T1 and T2 by assigning fields of table T1 to the primary key fields of table T2. In the following figure you can see the relationships between the fields of these two tables.

Table T1 is called the foreign key table (dependent table) and table T2 the check table (referenced table). The pair of fields for the two tables must have the same data type and length. One field of the foreign key table corresponds to each key field of the check table. This field is called the foreign key field.
A foreign key allows you to assign data records in the foreign key table and check table. By using the entries in the foreign key fields, one record of the foreign key table uniquely identifies one record of the check table.
Check Field and Value Check
One of the foreign key fields is marked as the check field. The foreign key relationship is maintained for this field.
When you make an entry in the check field, the system checks whether the check table contains a record with the key defined by the values in the foreign key fields. If there is such a record, the entry is valid. Otherwise the system rejects the entry.

The figure above is an example of the usage of check fields. In this example the entry Field2 = 2 and Field4 = 2 would be rejected since T2does not contain a record with the key Field5 = 2 and Field6 = 2.
You have the option of not checking against all the key fields of the check table. To exclude fields of the foreign key table from the assignment of the fields to the check table, use generic and constant foreign keys.
How the Input Check Works
A SELECT statement is generated from the definition of the foreign key. If you make an entry in the check field, the system submits this SELECT statement. If the system finds a suitable record of the check table, the entry is valid. Otherwise the system rejects the entry.
The corresponding SELECT statement has the following form for the foreign key table shown in the figure above:
SELECT * FROM T2 WHERE T2-FIELD5 = T1-FIELD2 AND T2-FIELD6 = T1-FIELD4.

This SQL statement is a pseudo code that explains the corresponding functionality. The syntax of this statement is not the same in ABAP.
A screen entry for check field Field2 is valid if the check table contains a record with the entries made in the screen for Field2 and Field4 as key.
Example
Table SBOOK in the flight model contains the customer’s flight bookings for a carrier. The flight bookings can be made by a travel agency or directly at the carrier’s sales counter. If the booking was made at a counter, its number is stored together with the booking in field COUNTER in table SBOOK.
You must make sure that only correct counter numbers can be entered in table SCOUNTER. The necessary value check can be defined by creating a foreign key for check field COUNTNUM. This is explained in the figure below.

See also:
Multi-Structured Foreign Keys
Semantic Attributes of Foreign Keys
Creating Foreign Keys

 

 

 

Save

 

 

Maintaining Technical Settings
Procedure
1. On the maintenance screen of the table, choose Technical settings.

The maintenance screen of the technical settings appears.

2. Select the data class and size category of the table.

 

Data class in technical settings
Physical area of database where for database platforms Oracle and Informix the database table is stored.
See
• Task-Oriented Instructions
• Reference Documentation for Datay Type of Database Tables

APPL0 Master Data, Transparent Tables
APPL1 Transaction Data, Transparent Tables
APPL2 Organization and customizing
DDIM Dimension Tables in BW
DFACT Facts Table in BW
DODS ODS Tables in BW
USER Customer Data Class
USER1 Customer Data Class

 

 

Size category
Size category for reservation of initial memory space in the database.
See
• Task-Oriented Instructions
• Reference Documentation for Size Category of Database Tables

0 0 to 23.000
1 23.000 to 94.000
2 94.000 to 370.000
3 370.000 to 1.500.000
4 1.500.000 to 6.000.000
5 6.000.000 to 12.000.000
6 12.000.000 to 24.000.000
7 24.000.000 to 48.000.000
8 48.000.000 to 96.000.000
9 96.000.000 to 3,800000E+09

 

 

The input help for the Size category field shows how many data records correspond to the individual categories.

3. The buffering permission defines whether the table can be buffered.

If you allow table buffering, you must define the buffering type of the table.

 

You can find further information about when to buffer tables and what buffering type you must choose in Database Table Buffers.
4. If you want to log changes to data records of the table, select Log data changes (see Logging).

To log changes, system logging must be switched on with the profile parameter rec/client. The Log data changes indicator on its own does not cause the table changes to be logged.

5. Choose with the quick info text Activate.

 

 

Errors that occurred during activation are displayed in the activation log.

Table Maintenance Generator

What is table maintenance generator?
Table Maintenance Generator is a tool used to customize the tables created by end users and can be changed as required, such as making an entry to that table, deleting an entry etc.
In other words, table maintenance generator is a user interface tool which is used to change the entry of the table or delete an entry from the table or create an entry for the table.

Prerequisite
To make this feature work care should be taken while creating the database table that in the 'Delivery and Maintenance' tab, the 'Table View Maint.' should have the "Maintenance allowed" property defined.

 

Transaction Codes
SE54: Generate Table Maintenance Dialog
SE55: Table view maintenance DDIC call
SE56: Table view display DDIC call
SE57: Deletion of Table Maintenance
SM30: Maintenance Table Views

Implementation of table maintenance generator for a custom table
Go to SE11 and create a table with the fields as per the requirement.
In table change mode, click on Utilities and then click on Table maintenance generator.

Following screen will be displayed for setting up the Maintenance generator

 

Following are the available options, choose them accordingly

Authorization Group: If the table needs to be maintained by only particular group of people, then the Authorization group needs to be filled otherwise fill it as NC. To maintain the authorization group, refer to SU21.

 

Function group is the name to which the generated maintenance modules will belong to.
Generally Function Group name can be same as table name.

Maintenance screens: Provide the desired screen numbers. Maintenance can be done in 2 ways

1. Maintenance and Overview both on one screen
2. Maintenance on one screen and Overview on another screen.

Create

 

 

 

RESULT

 

 
1 Comment
Labels in this area