0% found this document useful (0 votes)
17 views46 pages

SAP ABAP Basics and Programming Guide

The document provides a comprehensive guide on SAP ABAP, covering its basics, usage, and key concepts such as transport requests, system landscapes, and the ABAP editor. It includes detailed sections on creating programs, managing database tables, and various programming techniques like loops and conditional statements. Additionally, it outlines advanced topics like data migration, enhancements, and object-oriented programming in ABAP.

Uploaded by

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

SAP ABAP Basics and Programming Guide

The document provides a comprehensive guide on SAP ABAP, covering its basics, usage, and key concepts such as transport requests, system landscapes, and the ABAP editor. It includes detailed sections on creating programs, managing database tables, and various programming techniques like loops and conditional statements. Additionally, it outlines advanced topics like data migration, enhancements, and object-oriented programming in ABAP.

Uploaded by

devanshi9701
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

[Link] Content Page


No

1 Basic Of ABAP
1 What is SAP ABAP? 6
2 Where is ABAP Used? 6
3 What is a Transport Request in SAP? 7
4 What is system landscape 8
5 Create transport request 9
6 What is package? 12
7 Types and package creation? 13
8 What is ABAP Editor? 16
9 Create first program 18
10 What is comment in ABAP 23
11 What are system variables in ABAP? 26
12 How to use system variable in program? 27
13 What is a Data Type? 28
14 What is a Data Object in SAP ABAP? 30
15 ABAP Operators example codes 34

2 ABAP DICTIONARY 38
1 Create first database table 39
2 Record data in table 49
3 Display data 50
4 Change data 51
5 Table Maintenance Generator(TMG) 52
a) One step 52
b) Two step 55
6 Structure 58
a) Include Structure 58
b) Append Structure 67
7 Create second table 70
8 Maintain foreign key relation 72
9 Maintain record in second table using SM30 75
10 Views 76
a) Creation of Base view 77
b) Creation of Projection view 84
c) Creation of Maintenance view 87
d) Creation of Help view 95
11 Search Help 98
a) Creating Elementary Search Help 98

2
b) Collective search help 104
12 Lock Objects 107

3 Conditional Statement 110


1 IF...ENDIF 110
2 IF–ELSE...ENDIF 111
3 IF-ELSEIF-ELSE...ENDIF 112
4 CASE-WHEN...ENDCASE. 114
1
4 Loops 116
1 Do-Enddo. 117
2 While-Endwhile. 118
3 Loop At Table – Endloop 119

5 Loop Break Statements 120


1 Create a program using exit statement 120
2 Create a program using stop statement. 121
3 Create a program using continue statement. 122
4 Create a program using check statement. 123

6 String operations 124


1 Concatenation 125
2 Split 126
3 Condense 127
4 Strlen 128
5 Find 129
6 Translate 130
7 Replace 131

7 Internal Table And Work Area 132


1 Example: Fetching Material Master Data from MARA Table 137
2 Code Breakdown 138

8 Internal table operations 142


1 Append 143
2 Collect 146
3 Insert 148
4 Sort 150
5 Describe Table 152
6 Read Table 154
7 Loop At 158

3
8 Modify 159
9 Delete 161
10 Delete Adjacent Duplicates From 165
11 Clear, Refresh, Free 167

9 Joins 170
1 Creating a program using inner join 170
2 Creating a program using outer join 172

10 For all entries 174

11 Select Statement 177


1 Program to select all the fields from data base table into Work area 177
2 Program to select particular fields from data base table into internal table. 179
3 Program to select particular fields from data base table into Internal table using
where condition. 181
4 Program to select all the fields from data base table into internal table with
where condition and using rows 182
5 Program to select all the fields from data base table into work area using
append. 183

12 Selection Screen 184

13 Modularization Techniques 193


1 Micros 194
2 Subroutine 197
3 Include 201
4 Function Module 209

14 File Handling 226


1 File handling on presentation server. 228
2 File handling on application server 239

15 Module Pool Programming 248

16 Debugging 319

17 Reports 333
1 Classical report 334
2 Interactive reports 340
3 ALV Reports 351

4
18 Data Migration 375
1 LSMW 377
2 BDC 416
3 BAPI ((Business Application Programming Interface) 453

19 Enhancement 464
1 Customer Exit 464
2 Enhancement framework 495
3 BADI (Business Add-ins) 512

20 Smartform 526

21 OOPs 547
Upcoming Topics
22 Workflow

23 IDoc

24 New Syntax

25 CDS

26 AMDP

27 Odata

5
1. What is SAP ABAP?

ABAP (Advanced Business Application Programming) is the primary programming language used
to develop applications on the SAP platform. It is a high-level, 4th-generation language (4GL)
developed by SAP SE and is primarily used for building custom reports, interfaces, enhancements,
forms, and workflows in SAP ERP systems like ECC and S/4HANA.

Key Highlights of SAP ABAP:

Feature Description
Purpose Used to develop SAP applications within the SAP ecosystem.
Type Procedural and object-oriented language.
Platform Runs on SAP NetWeaver (application server).
Integration Deeply integrated with SAP modules (FICO, MM, SD, etc.).
Environment Developed in SE80 (Object Navigator) and SE38 transaction codes.

2. Where is ABAP Used?

Custom Reports – To meet specific business requirements (via ALV, classical reports).

Enhancements/User Exits/BADIs – Modify standard SAP behavior without modifying core code.

Interfaces – Communicate with external systems (IDOCs, RFCs, BAPIs).

Forms – Print documents like invoices using SAPscript, SmartForms, Adobe Forms.

Data Migration – Load legacy data using programs like BDC or LSMW.

Workflow – Automate business processes.

OData & Fiori – Used in S/4HANA for backend logic behind Fiori apps.

6
3. What is a Transport Request in SAP?

A Transport Request (TR) in SAP is a container that holds changes made to repository objects
(like programs, tables, function modules) or customizing settings. It is part of the Change and
Transport System (CTS) used to move developments or configurations from one SAP system to
another,

Typically:

Development → Quality → Production

Purpose of Transport Requests

• Move custom ABAP code from the development system to testing and production.
• Ensure version control and traceability of changes.
• Maintain system consistency across SAP landscapes.
• Facilitate collaborative development with multiple developers working on the same
system.

SAP Landscape and Transport Flow

Most organizations follow this three-tier system:

DEV (Development)

Transport Request

QAS (Quality/Testing)

After Testing & Approval

PRD (Production)

All changes must pass through this flow using Transport Requests.

7
4. What is System Landscape?
System Landscape refers to the arrangement of SAP servers (systems) in an organization that
supports the entire development, testing, and production process of SAP applications.
It defines how different SAP systems are structured and connected to ensure smooth software
development, transport, and maintenance.
Typical SAP System Landscape
A standard SAP landscape consists of three systems:

System Purpose Description


Development Development & All ABAP programs, customizations, and
System (DEV) Configuration configurations are done here by developers and
functional consultants.
Quality Assurance Testing The changes from DEV are transported here for
System (QAS) testing by end users or QA team before going live.
Production System Live System The final working system where real-time
(PRD) business transactions are performed. No direct
development is allowed here.

How It Works (Transport Path)


Development (DEV):
ABAP programs, configuration settings, and customization are created.
-> Transport Request is created.
Transport to Quality (QAS):
The request is moved to QAS for testing and validation.
-> Users test the changes for correctness.
Transport to Production (PRD):
Once approved, the same transport is moved to PRD.
-> The change becomes live for business use.

Example (SAP ABAP Context)


You develop a custom report (ZREPORT_SALES) in DEV system.
You test it in QAS system with dummy data.
After approval, it’s transported to PRD system, where end users execute it for real business
data.

8
5. Create transport request
Tcode: SE01

[Link] Create

9
Select workbench request and click on copy.

10
11
6. Create Package (SE21)

A Package (previously called a Development Class) is a logical container used to group related
development objects such as programs, classes, function modules, tables, screens, etc.

Packages help organize ABAP objects, manage transport, and define dependencies and access
control for modular development.

Why Packages Are Important

Purpose Description

Keep related objects (like reports, tables, classes) grouped together


Organize Objects
logically.

Transport Objects in a package can be assigned to a transport request for system


Management movement.

Access Control Packages define interfaces and visibility of objects to other packages.

Encapsulation Supports modular and reusable development through visibility settings.

How Packages Work

When you create any development object (e.g., program, table), SAP prompts you to assign it to
a package.

• If you choose a local package ($TMP), the object is not transportable (for
temporary/testing objects only).
• For reusable or deployable code, assign it to a custom package (usually starting with Z or
Y).

12
7. Types of Packages

Type Description

Development
Standard type. Holds development objects and allows transport.
Package

Main Package Top-level package that can contain other packages.

Subpackage Nested under a main package for better structure.

Structure Package Contains only other packages (no objects) to structure the hierarchy.

Declares public elements (APIs, constants) meant for access by other


Interface Package
packages.

Test Package Contains test objects like unit tests, test data, etc.

Use Tcode: SE21


Give name and select Create.

13
Continue.

Enter.

14
Save it.

15
8. What is the ABAP Editor?

The ABAP Editor is the integrated development environment (IDE) inside SAP where developers
write, edit, test, and debug ABAP code.

It is the central tool for ABAP development and allows you to create everything from simple
reports to complex business logic, modular functions, forms, and interfaces.

Purpose of the ABAP Editor

• Write and edit ABAP programs, classes, function modules, and more
• Check syntax and activate programs
• Run and test code directly
• Perform debugging and analyze program flow
• Manage modularization units like FORM, FUNCTION, and METHOD

Accessing the ABAP Editor

There are two primary ways to use the ABAP Editor:

Method T-Code Description

SE38 /
Classic ABAP Editor Traditional GUI-based editor in SAP GUI
SE80

Modern ABAP in Eclipse Eclipse-based tool for HANA, S/4HANA, and RAP

(ADT) development

1. Classic ABAP Editor (SAP GUI)

➢ Transaction Codes:

• SE38 – For creating and editing programs (reports)


• SE80 – Object Navigator (access everything: programs, tables, classes, etc.)
• SE24 – For working with classes and methods
• SE37 – For function modules

16
Key Features:

• Editor window with syntax coloring


• Toolbar for syntax check, pretty print, activate, execute
• Any customized program must start with Y or Z as first alphabet.
• A statement is a sequence of worlds that ends with a period.
• In the ABAP editor, the keywords appear in blue colour.
• F1 and F4 help for documentation and field values
• Line numbering, search/replace functionality
• Modular code editing (includes, forms, etc.)

2. ABAP Development Tools (ADT) in Eclipse

For modern ABAP development, SAP recommends using Eclipse-based ADT:

Benefits:

• Intelligence (code suggestions, navigation)


• Inline syntax checks and error highlighting
• Git integration and version control
• Support for CDS views, AMDP, and RAP
• Easier navigation between objects (classes, interfaces, data elements, etc.)

Ideal for SAP S/4HANA, HANA-based, and cloud development.

What You Can Do in ABAP Editor

Action Description

Write Code Type ABAP statements like SELECT, WRITE, LOOP, FORM, etc.

Check Syntax Validate correctness of code using Ctrl + F2 or "Check" button

Activate Make your code executable in SAP

Execute Run your report or program using F8

Debug Set breakpoints and trace execution line-by-line

Pretty Printer Format your code for better readability (Shift + F1)

Object Navigation Jump between program, includes, screens, etc.

17
9. Create first program
Use Tcode: SE38
Give program name and select create.

18
Enter title and select type – executable program.

19
Give package name and press enter.

Save it.

20
Input

Write a above code, save (Ctrl+S), activate (Ctrl+F3) and execute(Ctrl+F8).


Output

21
Syntax: Write: / pos (width) ‘text1’ left/right/centered justified color <Color number>.
Explanation of each component:

• Write -The WRITE statement in ABAP is used to display data or output on the screen. It's
mainly used in reports, test programs, or to check intermediate results during
development.
Think of it like ABAP’s version of print in Python or [Link] in Java.

• : - chain operator: It is a statement which is used to display multiple texts which are
separated by using a single WRITE statement.
• / – This indicates the start of the new line.
• pos (width) – Defines the position and width of the text box or area where the text will
be displayed.
• 'text1' – The actual text to display (should be enclosed in single quotes).
• left/right/centered – Specifies how the text should be aligned within the defined width.
• justified – Optional keyword if the text should be fully justified (i.e., aligned both left and
right).
• color <Color number> – Sets the text color using a numeric code.

22
10. What is a Comment in ABAP?

A comment in ABAP is a line or part of a line that is ignored during program execution.
Comments are used to:

• Explain what the code does


• Leave notes or reminders for yourself or other developers
• Temporarily disable lines of code for testing (also called commenting out)

Comments do not affect the logic or output of your program — they are purely for
documentation and readability.

The * character at the start of a program line indicates that the entire line is a comment.

The “ character, which can be entered at any position in the line, indicates that the remaining
content in the line a comment.
Examples:

23
Write your first program.
Source code:
*&---------------------------------------------------------------------*
*& Report ZDEMO5
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO5.

write 'SAP ABAP first program'.


skip 2.
write:/'SAP ABAP',
'fisrt',
'program'.
write: / 'SAP ABAP first program' COLOR 1.
write: / 'SAP ABAP first program' COLOR 2.
write: / 'SAP ABAP first program' COLOR 3.
write: / 'SAP ABAP first program' COLOR 4.
write: / 'SAP ABAP first program' COLOR 5.
write: / 'SAP ABAP first program' COLOR 6.
write: / 'SAP ABAP first program' COLOR 7.
write: / 'SAP ABAP first program' COLOR 1 INVERSE.
write: / 'SAP ABAP first program' COLOR 2 INVERSE.
write: / 'SAP ABAP first program' COLOR 3 INVERSE.
write: / 'SAP ABAP first program' COLOR 4 INVERSE..
write: / 'SAP ABAP first program' COLOR 5 INVERSE.
write: / 'SAP ABAP first program' COLOR 6 INVERSE.
write: / 'SAP ABAP first program' COLOR 7 INVERSE.
write: / 'Hello ABAPers 1 '.
skip 2.
write: /30 'Hello ABAPers 2'.
write: /40(20) 'Hello ABAPers 3' COLOR 4.
write:/50(30)'Hello ABAPers 4' LEFT-JUSTIFIED COLOR 1.
write:/60(30)'Hello ABAPers 5' centered color 4.
write:/60(30)'Hello ABAPers 6' right-justified color 4.

24
Output.

25
11. What are System Variables in SAP ABAP?

System Variables (technically called System Fields) are predefined internal variables provided by
the SAP system. These hold runtime information about the current program, user session,
screen data, database access, and more.

They all belong to the structure SYST (or its alias SY) and are automatically available in any ABAP
program - no need for declaration.

Syntax to Use System Variables

WRITE: sy-datum, sy-uzeit, sy-uname.

• sy is the alias for syst


• Fields are accessed using sy-<field_name>

Commonly Used System Variables

System Variable Description


SY-DATUM Current system date (e.g., 20250407)
SY-UZEIT Current system time (e.g., 143015)
SY-UNAME Current user name (e.g., BHAGWAT)
SY-REPID Name of the currently running ABAP program
SY-SUBRC Return code of the last ABAP statement
SY-TCODE Current transaction code (e.g., SE38, FB50)
SY-LANGU Logon language (E for English, D for German)
SY-INDEX Loop index in a LOOP AT or DO loop
SY-TABIX Index of internal table in loop
SY-MANDT Client number (e.g., 100, 800)
SY-TITLE Title of the current screen/report
SY-CPROG Calling program (in modularization or function modules)
SY-DBCNT Number of rows affected in last DB operation (e.g., SELECT, UPDATE)
SY-UCOMM Function code triggered (e.g., button pressed in a screen)
SY-STEPL Index of current screen line in a table control

26
12. How to use system variable in program?

Save, activate and execute.


Output.

27
13. What is a Data Type?

A data type defines the type of data a variable can store, such as numbers, characters, dates,
strings, or structures. It ensures that the program uses memory efficiently and performs
accurate operations.

There are three categories of data type.


1. Elementary data types.
2. Complex data types.
3. Reference data type.
1. Elementary data types
Elementary data types are the most basic data types used to define the type of data a variable
can hold. These are predefined by the system and form the foundation for all other data types
(like structures or internal tables)

Data Type Description Example


DATA name TYPE c LENGTH 10.
C Character (fixed length)
Data name(10) types c.
N Numeric text (0–9 only) DATA phone TYPE n LENGTH 10.
D Date (YYYYMMDD format) DATA today TYPE d.
T Time (HHMMSS format) DATA now TYPE t.
I Integer (whole number) DATA count TYPE i.
P Packed number (decimal) DATA salary TYPE p DECIMALS 2.
F Floating point (decimals) DATA pi TYPE f.
X Hexadecimal DATA raw TYPE x LENGTH 2.
STRING Variable-length character string DATA long_text TYPE string.
XSTRING Variable-length binary string DATA file_content TYPE xstring.

2. Complex data types.


Complex data types are data types that are made up of multiple elementary data types. These
are used to group and manage related data fields together.
• There are 2 types of complex data types.
1. Structure type
2. Table type

28
2.1. Structure type

A structure is a group of related data objects. For example, you can have a structure address that
contains house_no, street, city, state, zip_code and country.

A structure is an instance of a structure type. To define a structure type, you use the type
statement. For example, the following defines a structure type called address_type.

Example:

TYPES: BEGIN OF address,


house_no(15) TYPE c,
street(120) TYPE c,
city(50) TYPE c,
state(50) TYPE c,
zip_code(6) TYPE c,
country(100) TYPE c,
END OF address.

2.2. Table Data Types


It is another type of complex data type, that allows you to define a structure for table of data.
when there are collections of data in ABAP program then we use this data types. Another name
of this data types are array data types because it defines dynamic arrays that can hold multiple
data records of the same data type.
Syntax for using this table data type

Data: it_data TYPE TABLE OF address.


Use structure type to define table type

3. Reference data type.

The reference types describe reference variables that refer to instances of classes, interfaces,
and runtime data objects.

The following shows how to define a reference of the cl_salv_table class:

Data: lo_obj type ref to cl_salv_table.

29
14. What is a Data Object in SAP ABAP?

A data object in ABAP is a runtime instance of a data type. In simpler terms:

Data Type = Definition


Data Object = Actual Variable (Instance) in Memory

You use data objects to store, read, and manipulate values during the execution of an ABAP
program.

Example Analogy:
Concept Real World Example

Data Type Blueprint of a house

Data Object Actual house built from that blueprint

Characteristics of a Data Object

• Memory allocated at runtime


• Created using DATA, CONSTANTS, or PARAMETERS
• Has a specific type (elementary, structure, table, etc)
• Can be assigned values, passed to functions, or modified

How to Declare a Data Object

➢ Using DATA (for variables)

DATA lv_name(20) TYPE c. " Character type


DATA lv_age TYPE i. " Integer

➢ Using CONSTANTS (for constant values)

CONSTANTS lc_country(3) TYPE c VALUE 'IND'.

➢ Using PARAMETERS (for input fields in selection screen)

PARAMETERS p_date TYPE d.

30
Types of Data Objects in ABAP

Category Examples Description

Elementary lv_name, lv_age Single value: character, number, date

Structure ls_employee Group of fields (like a row)

Internal Table it_customers Multiple rows of structured data

Reference lo_obj Pointer to an object or instance

Constants lc_tax_rate Immutable value

Field Symbols <fs_field> Dynamic reference to memory location

Examples

1. Elementary Data Object


DATA lv_total TYPE p DECIMALS 2.
lv_total = 200.50.

2. Structured Data Object


TYPES: BEGIN OF ty_emp,
id TYPE i,
name(30) TYPE c,
END OF ty_emp.

DATA ls_emp TYPE ty_emp. “(Here ls_emp Becomes work area)


*Pass values to work area.
ls_emp-id = 101.
ls_emp-name = 'Bhagwat'.

3. Internal Table Data Object

DATA it_emp TYPE TABLE OF ty_emp.


APPEND ls_emp TO it_emp.

31
Why Data Objects Matter

• They are the actual containers that hold your program data
• You manipulate them through ABAP statements (e.g., MOVE, WRITE, LOOP, etc.)
• Without data objects, a program has no memory to work with

Types of data objects.


• The data objects are of 2 types.
1. Literals (unnamed data object)
2. Named data objects
Literals
• Literals don’t have any name that’s why they are called as unnamed data objects.
• They are fully defined by their value.
• There are 2 types of literals.
1. Numeric literals- numeric literals have sequence of numbers. Examples-123,-456 etc.
2. Character literals – character literals are sequences of alphanumeric characters in single
quotation marks. Ex. ‘Test 123’,’sap abap’. Etc.

Named data objects


• Data object that have a name are called as named data objects.
• The various types of named data objects are as follows:
1. Variables
2. Constants
3. Text symbols

32
Named data object-Variable
• Variables are data objects whose contents can be changed.
• Variable are declared using the DATA, CLASS-DATA, STATICS, PARAMETERS, SELECT-
OPTIONS, and RANGES statements.
• Example –DATA: lv_empid(20) TYPE n.
lv_empid = 10.
lv_empid = 20.

Named data object - Constants.


• Constants are data objects whose contents can not be changed.
• Constants are declared using the CONSTANTS keyword.
• Example – CONSTANTS lc_pi TYPE P DECIMALS 3 VALUE ‘3.141’.

Named data object-Text symbols.


• A text symbol is a data that is not declared in the program itself.
• It is defined as a part of the text elements of the program.

33
15. SAP ABAP Operators
In SAP ABAP operators are symbols or special characters that apply particular operations on
operands. Variables, constants, or expressions can all be considered operands. Numerous
operator types are supported by SAP ABAP, such as, arithmetic, comparison, automated type
adjustment, and character string operators.

Arithmetic Operators in SAP ABAP


Arithmetic Operators are used to perform basic operations in mathematics that are used in
algebra, Here is a list of arithmetic operators in SAP ABAP.
Basic mathematical operations in SAP ABAP are carried out using arithmetic operators. Addition
(+), subtraction (-), multiplication (*), division (/), and modulus (MOD) are some of these
operators.

Operator Function Order


+ Adds the operands From left to Right
– Subtract the operands From left to Right
* Multiply the operands From left to Right
/ Divide the left operand by the From left to Right
right operand
DIV integer parts after the From left to Right
division of the left operand
by the right operand

34
REPORT ZDEMO_PRGM.
*write 'SAP ABAP Development'.

DATA: num1 TYPE I VALUE 10,


num2 TYPE I VALUE 5,
result TYPE I.
result = num1 + num2. " Addition
*result = num1 - num2. " Subtraction
*result = num1 * num2. " Multiplication
*result = num1 / num2. " Division
*result = num1 MOD num2. " Modulus

write: / result.

Output
15
5
50
2
0

35
Comparison/ Relational Operators in SAP ABAP

Comparison operators in SAP ABAP are utilized to compare data and offer conclusions depending
on the comparison’s results. These operators include equal to (EQ), not equal to (NE), less than
(LT), less than or equal to(LT) , greater than(GT) , and greater than or equal to (GE). Here we are
sharing you a table in which every comparison operator is discussed in detail.

Operator Function
=, EQ Returns true If two operands are equal to each
other
<>, NE Returns true If two operands are not equal to
each other
<, LT Returns true If first operand is less than
second.
>, GT Returns true If first operand is greater than
second.
<=, LE Returns true If first operand is less than or
equal to second.
>=, GE Returns true If first operand is greater than or
equal to second.
IS INITIAL Returns true if the variable declared is not
modified
IS NOT INITIAL Returns true if the variable declared is
modified

36
Example.
REPORT ZDEMO_PRGM.

DATA: value1 TYPE I VALUE 10,


value2 TYPE I VALUE 20,
result TYPE C LENGTH 1.
IF value1 EQ value2.
result = ' True '.
ELSE.
result = ' False '.
ENDIF.

Write: / result.

Output
False

37
ABAP Data Dictionary – Create database table

The ABAP Data Dictionary (DDIC) is a central repository in SAP that defines and manages
database objects such as tables, views, data elements, domains, search helps, and lock objects.
It ensures data consistency, integrity, and reusability across the SAP system.

With DDIC, developers can define database structures independently of the underlying database,
making it easier to manage data definitions centrally without redundancy. The transaction code
to access the Data Dictionary is SE11.

1. What are the different types of tables in the Data Dictionary?

1️ Transparent Tables

• These are one-to-one representations of database tables, meaning their structure in SAP is the
same as in the underlying database.
• Used to store actual business data.
• Example: BKPF (Accounting Document Header), MARA (Material Master).

2️ Pooled Tables (Obsolete in S/4HANA)

• Multiple small logical tables are stored in a single physical table in the database.
• Used to manage control data with small, rarely accessed records.
• Example: T000 (Client Table).

3️ Cluster Tables (Obsolete in S/4HANA)

• Stores multiple records from different tables in a single field of a physical database table.
• Used for storing complex data structures such as HR data.
• Example: BSEG (Accounting Document Segment in ECC).

Note: In SAP S/4HANA, Pooled and Cluster Tables are replaced by Transparent Tables for
performance optimization.

38
1. Create database table.
In this document I have given step by step procedure to create below table.
[Link] Fields Data Element Data Type Length Decimal Short Description
1 MANDT MANDT CLNT 3 Client
2 Order_N Zonum NUMC 14 Order Number
3 Date1 ZDate DATS 8 Order Date
4 Vendor Zvname CHAR 30 Vendor Name
5 POrg Zporg CHAR 4 Purchasing Org
6 Total_A Ztotal CURR 7 2 Total Amount
7 Currency ZCrn CUKY 5 Currency

There are two approaches for table create:


1. Top-Down Approach
In top-down approach first we create table then data element last domain.
2. Bottom up
In bottom-up approach first we need to create Domain then data element and last table.
Use TCode: SE11

Select Create.

39
Give client field and data element.

40
Give field name and data element for Order name.
Save it.
Double click on data element (ZONUM).

Click on Yes.

41
• Data Element

Give Description and domain name.


Select Field label.

Again, select data types.


Double click on Domain.

42
Select Yes.

Select Local Object.

43
Click on Yes.

44
Save – Check and Activate.

Select Local Object.


Activate (Ctl+3).

Select Domain and Data element.


Follow same steps and create remaining data element and domains.

45
[Link] Fields Data Element Data Length Decimal Short Description
Type
1 MANDT MANDT CLNT 3 Client
2 Order_N Zonum NUMC 12 Order Number
3 ODate ZDate DATS 8 Order Date
4 Vendor Zvname CHAR 30 Vendor Name
5 POrg EKORG CHAR 4 Purchasing Org
6 Total_A Ztotal CURR 7 2 Total Amount
7 Currency ZCrn CUKY 5 Currency

What is domain and data element?


Domain (Defines Technical Attributes)
A domain defines the technical characteristics of a field, such as:

• Data type (CHAR, NUMC, DEC, etc.)


• Length (e.g., CHAR(10), NUMC(5))
• Value range (Fixed values or Check table)

Example:

• Domain: CURRENCY (Data type: CURR, Length: 3, Fixed values: INR, USD, EUR)

46

You might also like