sapdev logo background
sapdev logo sapdev logo
Comments

Create SAP database table within the data dictionary transaction SE11




SAP database tables are created within the data dictionary using transaction SE11 (can also be accessed via SE80) and are used to store data within your SAP system. This includes Master data, transaction data, configuration data etc. Once a database table has been created any data entered will remain until something physically removes or changes it. This is different from internal tables that you create within your ABAP code as data contained in these is only available while the program is running. Once you exit the program all the data within the internal tables is lost. Creating a basic database table within your R/3 SAP system is a very straight forward process and can be done in a few minutes following the below steps.


Step 1 - Enter new table name
Using transaction SE11, ensure the "Database table´┐Ż radio button is selected and enter a name for your new table into the input box. For this example I am going to create a table called ZTEST_TABLE



Step 2 - Enter basic details
With the 'Delivery and Maintenance' tab enter a short description, set delivery class to A and choose Display/Maintenance Allowed for the 'Data Browser/Table View Maint.' option. See table settings for more details about these options and their effects on the table.



Step 3 - Enter field names
Now go to the fields tab and add some fields, ensure you add the MANDT field first as this will make you table client specific I.e. stores different data in each client or system. Also set it as a key field by checking the keyfield checkbox for that row. Then add some other fields such as FIELD1, FIELD2 and FIELD3, note I have used existing data elements for each for simplicity. I will show you how to create your own and explain what these are in a later help document. To make this easier you can actually cut and paste the following text into the table and press enter. Also enter one or two of these additional fields as key fields.

MANDT	MANDT
FIELD1	EBELN
FIELD2	EBELP
FIELD3	UNAME




Step 4 - Enter technical settings
Before you can activate your new table you need to maintain the technical settings to define the type and size of data being stored. To do this first Click on the Goto->Technical Settings option


On the next screen enter the data class as 'APPL0' and the size as '0'. The size zero doesn't mean you can't store more records than stated but just means it allocates space in smaller chucks and may affect performance if the table is going to be storing large amounts of data. See table settings for more information as to how the options you choose here can affect the behaviour of the database table.



Step 5 - Enter technical settings
The next step is to enter an enhancement category for your table. You don't really need to do this but if you don't you get a warning when you activate your table so is nice to make a selection in here in-order to get rid of that. Select the menu option Extras->Enhancement Category


On the next screen select any option you want, I always choose can be enhanced (Deep)



Step 6 - SAVE, Activate and your done
Right thats it, simply save and activate your table and its ready to use.


Step 7 - Example ABAP code
Just for information here is the ABAP code you could use to populate this table

  data: wa_test type ztest_table.

  wa_test-Field1 = '1234'.
  wa_test-Field2 = '1234'.
  wa_test-Field3 = 'hello'.
  MODIFY ztest_table from wa_test.

If you then execute this code and look at the table entries via SE11 or SE16 etc you should see the following record in the table.


SAP dictionary information
Dictionary home
Create Table Maintenance
Screen to Add, Delete, Change table data




comments powered by Disqus