0% found this document useful (0 votes)
41 views30 pages

ABAP Class02

The document discusses creating data elements and tables in SAP ABAP. It explains what data elements are and how they can be reused across tables for common fields. It then provides steps to create a sample data element and use it when defining fields in a new table. The document also covers other table properties like delivery class and key fields.

Uploaded by

Praveen Bharathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views30 pages

ABAP Class02

The document discusses creating data elements and tables in SAP ABAP. It explains what data elements are and how they can be reused across tables for common fields. It then provides steps to create a sample data element and use it when defining fields in a new table. The document also covers other table properties like delivery class and key fields.

Uploaded by

Praveen Bharathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

ABAP – Class 02

Points which are covered


 Data Element
 Step to Create the table
Data Elements and Datatypes in SAP ABAP
 A data type defines the type of value a field will hold. For example a Name field will hold character values and
hence will be a CHAR type in SAP ABAP with let’s say a maximum length of 30. Similarly, different types of
data have different data types.
Now what are data elements?
 Sometimes when we are creating ABAP objects, we might need to use the same fields again and again in them.
Let’s say your client asks you to create 10 tables and while analyzing the requirement, you realize that all of them
contain a field called “Recurring Customer First Name “which should be of maximum length 20.
 What would be a regular approach?
 1. Create table 1 with one of the fields as “Recurring Customer First Name “ and data type as CHAR length 20.
 2. Repeat 9 more times for the other 9 tables.
 The data element can be understood as a custom data type that you can create. For example you create a data
element for “Recurring Customer First Name “ with length 20 and then use this data element instead of the data
type.
 Advantages:
 1. Less development time as re-usability is high. Using the data element brings in the description automatically as
well as the data type and length.
 2. Uniformity is maintained. If the field type has to be changed, it can be centrally changed from the data element
instead of manually changing data types in each tables.
Create a Data Element

To Create a new data element go to TCODE SE11


 Every custom development that we do in SAP should ideally start with a ‘Y’ or a ‘Z’. In our case, for the field
“Recurring Customer First Name “ , let’s give it a technical name as ZREC_FNAME. Enter this as shown and
press “Create”.

 The below pop-up with be shown. Choose data element and press
the tick button
 Enter a description for this data element that you are creating . which in our case is “Recurring Customer First
Name “ and then choose the radio button for “Predefined Type” shown below.
 If you already know the datatype you wish to use, you can type it in or else, just press the button shown
below. Alternatively, use the F4 button on your keyboard to bring up all the possible values for this field.

 This new window shows the list of all data types. The name should be a character string and hence
CHAR should be selected.
Also, type in the Length as shown below .

Now, we maintain the field labels by switching to the Field Label tab. Fill in one or more of these labels as shown below.
 Now we do the standard Save , Check and Activate steps in SAP

 The below message at the bottom left of the screen confirms the save:

 Now we click the check button to check for errors.


 The below message again on the bottom left corner of the screen confirms the consistency of this object.
 Now, for any object to be usable in SAP, it needs to be activated so we press the activate button shown below

The below message confirms successful activation.


Creating Tables in SAP ABAP
 Make sure that you are on the Database Table radio button.
Creating our first table
 We now create a table called ‘Customer Revenue’ with
TCODE SE11 again technical name ZCUST_REV.
 Enter the name and click on the create button.
 What is Delivery Class?
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 - 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.
 C - These are client specific customer table used for customize application. Here data is only entered by
the customer.
 L - These tables used to store temporary data. Tables are delivered to customer as empty.
 G - Customer table where SAP can add data but can not modify or delete it.
 E - System table in which customers can make entries. System tables are delivered with some data.
 Types of Delivery Class

 S - These tables are System table delivered by SAP with predefined data as part of system.
 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

 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 SE16), table/view maintenance (Transaction
SM30/SM31) and Generate Table maintenance Dialog (Transaction SE54)
 There are four options in data browser/table view editing
 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.

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
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.
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.
 You will reach the below screen where you need to fill in a description for this table and a delivery class. All the
custom tables we create will be to hold master and transaction data and those are class ‘A’ objects. Fill in these
values here

 It should look like the below illustration


 Now switch to the Fields tab A key field or a group of key fields uniquely identify a row of
information in the table. It means that for if two fields are marked as key, for a unique value
combination of those two fields, there should not be a duplicate rows in the table.
 Customer Number of length 6. As shown below, I give it a technical name ZCUST_NO but the
Data Type field is greyed out. The only active field is Data Element which I don’t have in this
case. To use an internal datatype, click on the “Predefined Type” button as marked below.

 On clicking this, we see that the data element column gets grayed out and the Datatype, Length,
Decimal places and Short Description field have become active.
 Here we enter the datatype NUMC and not CHAR because we assume that he customer number
is a character string consisting only of numbers in this example. The length and description are
also as specified.
 Quantity Sold with technical name ZQUAN_SOLD. These are key figure values and hence have special
data types available. Let’s do a F4 on the data type field to search for the right data type. As seen below,
there is a data type by the name of QUAN specifically for Quantities.
Here we select QUAN and add a short description for it.
For the final field, we will use the data element “Recurring Customer First Name” To use a
Data Element, we need to switch over using the button marked below

Enter the technical name of the data element in the data element column ZREC_FNAME
and press enter. As seen below, the data type and short description fields get filled
automatically and that is why you should use more data elements in your design if you
are planning to add the same fields across multiple tables.
Add a field name to this row and also mark Customer Number as the key field using the check-box in
front of it as shown below.
Now if you’ve noticed, we added a field called Quantity and one for units but how will the system
know that the unit field is linked to this Quantity field? To make this link, switch to the
Currency/Quantity Fields tab. Here you will see a blank area in front of the Quantity field asking for
the reference table and reference field for the unit. In our case, the Reference table is ZCUST_REV
itself since the unit field is here and the Ref field is ZUNIT_SOLD.
Fill up the required information as shown below.
We are almost done here. There is a minor setting you need to specify to avoid getting warnings in
activation. From the Menu bar as shown below, select the “Enhancement Category” option.
You will get the pop-up like below. Press the tick button.

Mark the option shown below to allow future enhancements (field additions) to this table with Character
or Numeric fields. You can also choose the “Deep” option to allow all enhancement types to be applied
to this table. For now, choose one and press the copy button.
Now, save and activate You should reach the below screen
Using F4 helps to understand the possible values for this field.

Next, we fill out the size category which is the number of records expected in that table
I expect less data and hence choose Category 0 and then press the save button on top and then the green
back button to go back.
When back, activate the table and the table would now be ready to use.

You might also like