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

ABAP Basics

The document provides an overview of SAP ABAP basics, covering key topics such as ERP concepts, SAP architecture, and the role of an ABAP consultant. It details the components of SAP systems, including the three-tier architecture, SAP modules, and the Data Dictionary (DDIC) for managing data structures. Additionally, it outlines the creation and management of domains, data elements, packages, and tables within the SAP environment.
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)
5 views30 pages

ABAP Basics

The document provides an overview of SAP ABAP basics, covering key topics such as ERP concepts, SAP architecture, and the role of an ABAP consultant. It details the components of SAP systems, including the three-tier architecture, SAP modules, and the Data Dictionary (DDIC) for managing data structures. Additionally, it outlines the creation and management of domains, data elements, packages, and tables within the SAP environment.
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

SAP ABAP BASICS

Topics: ERP Concepts, SAP Landscape, ECC vs S/4HANA, SAP Architecture, ABAP
Consultant Role, SAP GUI Navigation

➢ Enterprise Resource Planning (ERP) – Definition


ERP (Enterprise Resource Planning) is an integrated information system used to manage and
automate the core business processes of an organization within a single platform.

It connects departments like Sales, Finance, HR, Procurement, Manufacturing, and Inventory so
that all teams work on the same real-time data.
Key Benefits of ERP
• Centralized business data
• Real-time reporting and decision making
• Reduced data duplication
• Improved coordination between departments
• Better control over business processes
Real-Time Example:

When a sales order is created, the inventory is updated automatically and finance records the
revenue without manual intervention.

➢ SAP – Overview
SAP stands for Systems, Applications, and Products in Data Processing.
It is one of the most widely used ERP software suites that helps organizations run their business
processes in real time.
Why SAP is Used
• Integrates all business functions into one system
• Supports large-scale enterprise operations
• Provides real-time processing and reporting
• Highly secure and reliable

Real-Time Example:
A company can view today’s sales, stock availability, and financial status instantly using SAP.

➢ History of SAP
SAP was founded in 1972 by former IBM employees in Walldorf, Germany.
Over time, SAP evolved from early versions to modern ERP solutions such as SAP ECC and
SAP S/4HANA.

➢ SAP Architecture (3-Tier / R/3 Model)


SAP follows a three-tier client-server architecture that separates user interface, business logic,
and data storage.
Layers of SAP Architecture
Presentation Layer:
This is the user interface layer where users interact with SAP through SAP GUI.
Application Layer:
This layer contains the business logic. ABAP programs and SAP applications are executed here.
Database Layer:
This layer stores all business data in database tables and provides data to the application layer.
Real-Time Example:
When a user runs a report, the request is processed by ABAP in the application layer and data is
fetched from the database layer to display on the screen.

➢ SAP NetWeaver – Technology Platform


SAP NetWeaver is an integrated technology platform that supports different SAP applications
and enables communication between them.
Applications Supported by SAP NetWeaver
• SAP ERP
• SAP CRM
• SAP SRM
• SAP PI
Real-Time Example:
Data created in SAP ERP can be shared with SAP CRM through SAP NetWeaver integration.

➢ ABAP /4 – Overview
ABAP (Advanced Business Application Programming) is SAP’s programming language used to
develop custom applications, reports, forms, enhancements, and interfaces within the SAP
system.
ABAP programs run in the application layer and are optimized for business logic and database
operations.
Real-Time Example:
An ABAP program is written to generate a custom sales report for management.

➢ SAP Modules – Functional and Technical


SAP modules are divided into functional and technical areas based on business roles and system
roles.
Functional Modules
• SAP SD – Manages sales and customer distribution processes
• SAP MM – Manages procurement and inventory
• SAP FICO – Manages financial accounting and controlling
• SAP HCM – Manages employee data and payroll
• SAP WM – Manages warehouse operations
Technical Modules
• SAP BASIS – System administration and technical configuration
• SAP ABAP – Custom development and enhancements
• SAP BI/BO – Reporting and analytics
➢ SAP Application Server Architecture

The SAP Application Server is responsible for processing user requests and executing business
logic.
Main Components
• Dispatcher – Distributes user requests
• Work Processes – Execute ABAP programs
• User Context – Stores user session data
• Roll Area – Stores temporary user data
Real-Time Example:
When a user executes a transaction, the dispatcher assigns it to a free work process, which runs
the ABAP program and returns the result to the user.

➢ SAP System Landscape (DEV, QAS, PRD)


A standard SAP system landscape consists of three systems:
Development System (DEV):
Used by developers to create programs, tables, and objects.
Quality System (QAS):
Used for testing and User Acceptance Testing (UAT).
Production System (PRD):
Live system used by business users.

Real-Time Example:
An ABAP report is developed in DEV, tested in QAS, and then transported to PRD for business
use.

➢ SAP GUI – Front-End Tool

SAP GUI is the front-end client used by users and developers to access SAP systems.

Types of SAP GUI


• SAP GUI for Windows
• SAP GUI for Java
• SAP GUI for HTML

Main Elements of SAP GUI


• Menu Bar
• Command Field
• Standard Toolbar
• Application Toolbar
• Screen Area
• Status Bar

➢ SAP Easy Access Screen


SAP Easy Access is the initial screen displayed after logging into SAP.
It allows users to access transaction codes, SAP menus, and favorites easily.
Real-Time Example:
A user enters transaction code SE38 in the command field to create or execute an ABAP
program.

12. ECC vs S/4HANA – High-Level Difference

• SAP ECC is the traditional ERP system used by many organizations.


• SAP S/4HANA is the next-generation ERP designed for in-memory processing, faster
performance, simplified data model, and real-time analytics.
Real-Time Example:
Reports that take minutes in ECC can run in seconds in S/4HANA due to in-memory
processing.

➢ ABAP Consultant – Role & Responsibilities

An ABAP Consultant is responsible for technical development in SAP.


Key Responsibilities
• Develop custom reports, programs, and enhancements
• Fix defects and performance issues
• Create interfaces and forms
• Support functional consultants
• Optimize existing code
Real-Time Example:
If the Sales team needs a custom report, the ABAP consultant develops it, tests it, and deploys it
to production.

Data Dictionary (DDIC)


22.1 Definition of Domain
A Domain defines the technical properties of a field in SAP DDIC. It controls how data is
stored and validated in the database.

A Domain contains:
• Data Type

• Length

• Decimal Places
• Sign

• Case Sensitivity

• Value Range (Fixed Values)

Why Domain is used:

• Ensures consistency of field definitions


• Enables reusability across multiple Data Elements and Tables

• Central control of validations

• If a domain is changed, all data elements and fields using that domain are affected
automatically.

22.2 Steps to Create a Domain (SE11)

1. Go to transaction SE11 (ABAP Dictionary).


2. Select the Domain radio button.
3. Enter a custom Domain name (start with Z or Y).
4. Click Creat
5. Enter a Short Description.

6. Maintain technical attributes:

• Data Type

• Length

• Decimal Places (if required)

• Sign (if required)

• Case Sensitivity (if required)

• Value Range / Fixed Values (if required)

7. Click Save → Check → Activate.


�After activation, the Domain is ready to be used in Data Elements and Tables.

Examples:
● Z017_STD_ID
● Z017_STD_NAME

22.3 Domain Search Using Pattern


To view all domains created by a specific user:
● Use the domain name pattern with an asterisk (e.g., Z017*).
● Press F4 (Search Help).
● The system displays all domains matching the pattern.

23. Data Element Creation

23.1 Definition of Data Element


A Data Element provides the logical meaning of a field in SAP DDIC. It defines what the
field represents to the user.

Data Element = Domain + Short Description


What a Data Element controls:

• Field labels (Short, Medium, Long, Heading)


Field description in screens and reports
• Documentation

• Technical properties (through Domain)

• The same Data Element can be reused in multiple tables to ensure

23.2 Types of Data Element Creation


1. With Domain

• Uses an existing Domain for technical properties

• Recommended approach

• Supports value range / fixed values and F4 help

2. Without Domain(Built-in Type)

• No Domain is assigned

• Data type and length are defined directly

• Not recommended for reusable fields

• F4 help using fixed values is not possible without a Domain


24. Creation of Package
24.1 Purpose of Package
A Package is used to organize development objects and manage their transport across systems

(DEV → QAS → PRD).

What can be assigned to a Package:

• Programs

• Tables

• Domains

• Data Elements

• Classes

• Function Groups

• Objects in $TMP are local and cannot be transported.

24.2 Steps to Create a Package (SE21)


1. Go to transaction SE21.
2. Enter a custom Package name (start with Z or Y).
3. Click Create.
4. Provide:
○ Short Description
○ Application Component
5. Click Continue.
6. Assign a Transport Request(Create a new request, or Use an existing request).
7. Save and Activate.

24.3 Transport Request Management


•Workbench Request → For DDIC objects (Domains, Data Elements, Tables,
Packages, Programs)
• Customizing Request → For configuration and table maintenance data
• Always choose Workbench Request while creating DDIC objects.
25. Database Table in DDIC
25.1 Preliminary Concepts
Database tables are created and managed using SAP Data Dictionary (SE11).

• Steps to Create a Database Table (SE11)


Step 1: Open Data Dictionary
1. Go to transaction SE11
2. Select Database Table
3. Enter a custom table name (start with Z or Y)
4. Click Create

Step 2: Basic Details


1. Enter Short Description

2. Maintain required tabs (Fields, Delivery & Maintenance, Technical Settings)

Step 3: Maintain Fields (Columns)


1. Enter field names under Field Name

2. Assign:

○ Data Element (recommended)

○ OR directly define data type & length

3. Mark at least one field as Key

○ Minimum key fields: 1


○ Maximum key fields: 16

25.2 Delivery Class (Table Ownership)


Delivery Class defines who owns the table and how data is transported:
● A → Application Table (Master / Transaction data)

● Customizing Table (Configuration data)

● L, G, E, S, W → SAP internal usage

25.3 Types of Data Stored


Master Data
● Accessed frequently
● Changed rarely
● Examples:
○ Customer Master
○ Material Master

○ Company Code

Transactional Data
● Accessed frequently
● Changed frequently
● Examples:

○ Oil prices
○ Gold prices

25.4 Message Types in SAP


● I → Information message
● E → Error message
● W → Warning message
● S → Success message
● A → Abort message

25.5 Technical Settings


Data Class
Specifies the type of data stored:

● Master data
● Transaction data
● Organizational data

Size Category
Defines the amount of database space required for the table.

25.6 Table Data Maintenance


● Create/Change entries:
○ Utilities → Table Contents → Create Entries
● Display data:
○ Use transaction SE16N

25.7 Conceptual Architecture Explanation (Table Creation)


Application Layer → ABAP Dictionary (SE11) → Database Layer

● Table definition is created in SE11.


● Technical settings map the table to physical storage in the database.
● Data is accessed through Open SQL.
26. Structure vs Table
26.1 Structure
A Structure is a collection of fields similar to a table, but it does not physically store data in the database.

Characteristics of Structure
● Stores data only at runtime(memory).
● Does not have:
○ Delivery Class
○ Data Class
○ Size Category
● Used mainly for internal processing and screen definitions, Data transfer between programs.

26.2 Table
A Table physically stores data in the database.

Characteristics of Table
● Has Delivery Class.
● Has Data Class.
● Has Size Category.
● Requires at least one key field.
● Data is permanently stored in database.

26.3 Types of Structures


1. Append Structure

• Added only at the end of the table

• Used to enhance standard tables without modification

• Added in change mode

• Can be created multiple times (each append is unique)

• Used for both standard and custom tables

2. Include Structure
● Can be reused multiple times.
● Added only in table change mode.
● Used for custom tables.
● Can be added anywhere in the table (after key fields).

26.4 Rules for Adding Structures


● Structures can be added only after key fields.
● Component Type must be a Data Element.
● Component is the field name.
● Include Structure is added using Include field option in SE11.

• Steps to Create a Structure (SE11)

1. Go to SE11
2. Select Data Type
3. Enter Structure Name (Z / Y prefix for custom)

4. Click Create
5. Enter Short Description
6. Define Fields (Field Name + Data Element / Data Type)
7. No key fields required
8. Technical settings not needed
9. Click Save
10. Assign Package ($TMP or custom)
11. Click Activate

26.5 Client Field (MANDT)


● MANDT is a client-specific field.
● Ensures data is accessed only for a particular client.
26.6 Structure Change at Field Level Error
Occurs when:

● Table is inactive, or
● New fields are added or deleted.

System requires activation to synchronize structure.

26.7 Architecture Explanation (Structure vs Table)


Structure: Application Layer (Runtime Only) ↓ Memory Processing

Table: Application Layer (SE11 Definition) ↓ Database Layer (Physical Storage)

27. Table Maintenance Generator (TMG)


27.1 Definition
Table Maintenance Generator (TMG) is used to generate a ready-made maintenance screen for database
tables without writing ABAP programs.

TMG allows users to:

● Insert records
● Update records
● Delete records
● Display records

All operations are performed using transaction SM30.

27.2 Purpose of TMG


Normally, table maintenance requires custom programs and screens. TMG eliminates this effort by
automatically generating maintenance dialogs.

Used for:

● Custom tables (Z/Y tables)


● Configuration tables
● Master data tables
● Small control tables
27.3 TMG Creation Flow
1. Create table in SE11
2. Maintain:
○ Delivery Class
○ Authorization Group
3. Generate TMG

4. Maintain data using SM30

Architecture Flow: SE11 Table Definition ↓ TMG Generation (Function Group Created) ↓ SM30
Maintenance Screen ↓ Database Update

27.4 TMG Generation Types


● One-Step: Single screen for all fields
● Two-Step: Overview screen + detail screen
27.5 Important Transactions
● SE11 – Create table
● SE54 – Generate/Maintain TMG
● SM30 – Maintain table entries

27.6 Important Restrictions


● String data type should not be used when TMG is required.
● TMG cannot be created for objects in Local Package.
● Standard recording routine is used to move objects along with data from Development to QAS.

28. TMG Events


28.1 Definition
TMG Events allow adding custom validation and control logic during table maintenance.

SAP provides 39 standard TMG events triggered at different stages such as:

● Before saving
● After saving
● Before create
● After create
● Before delete
● After delete

28.2 Important Event Numbers


● 01 – Before saving the data
● 05 – After saving the data
● 21 – Before creating a new entry
● 22 – After creating a new entry
● 06 – Before deleting
● 07 – After deleting

28.3 Creation Steps


1. Open SE11 → Table → Utilities → Table Maintenance Generator
2. Navigate to: More → Environment → Modification → Events
3. Select required event number
4. Provide FORM name
5. System creates FORM…ENDFORM in function group
6. Write ABAP code between FORM and ENDFORM
7. Save, Check, Activate
8. Activate entire Function Group in SE80
9. Test using SM30

Code Location Architecture: SM30 Screen ↓ Function Group ↓ FORM Routine (Event Logic) ↓
Database Operation

28.4 Message Usage


● MESSAGE 'text' TYPE 'E' – Stops saving
● MESSAGE 'text' TYPE 'W' – Warning
● MESSAGE 'text' TYPE 'I' – Information

29. Custom Transaction Code


29.1 Purpose
Custom T-Code is created to restrict user access instead of giving direct access to SM30.

29.2 Creation Steps (SE93)


1. Enter SE93
2. Provide custom T-code (Z/Y)
3. Select "Transaction with Parameters"
4. Assign standard transaction SM30
5. Provide parameters:
○ View/Table → Table Name
○ Show → X
○ Update → X (if modification allowed)
6. Save, Check, Test

Security Flow: User → Custom T-Code → SM30 (Restricted Table Access)


29.3 Refreshing TMG After Structure Change
If table structure changes:

1. Open TMG
2. Choose Change → Expert Mode
3. Select All
4. Save
5. Activate Function Group in SE80

30. Custom Transaction Code


30.1 Purpose
Custom T-Code is created to restrict user access instead of giving direct access to SM30.

30.2 Creation Steps (SE93)


1. Enter SE93
2. Provide custom T-code (Z/Y)
3. Select "Transaction with Parameters"
4. Assign standard transaction SM30
5. Provide parameters:
○ View/Table → Table Name
○ Show → X
○ Update → X (if modification allowed)
6. Save, Check, Test

Security Flow: User → Custom T-Code → SM30 (Restricted Table Access)

30.3 Refreshing TMG After Structure Change


If table structure changes:

1. Open TMG
2. Choose Change → Expert Mode
3. Select All
4. Save
5. Activate Function Group in SE80
31. System Fields (Automatic Data Fetching)
● User Name → SY-UNAME
● Time → SY-UZEIT
● Date → SY-DATUM
● Client → SY-MANDT

Using TMG event logic, these values can be auto-populated during entry creation.

32. Views in SAP ABAP


32.1 Definition
Views are created on standard or custom tables primarily for reading data.

Most views do not allow data manipulation except Maintenance View.

32.2 Types of Views


1. Projection View
○ Based on single table
○ Select required fields only
○ Read-only
2. Database View
○ Based on multiple tables
○ Uses foreign key relationships
○ Read-only
3. Maintenance View
○ Allows Insert/Update/Delete
○ Used with TMG
4. Help View
○ Used for F4 help

32.3 View Architecture


Tables → View Definition → User Access (Read Only / Maintenance)
33. Search Help
33.1 Types
1. Elementary Search Help
○ Fetches values from one table/view
○ Supports Import/Export parameters
○ LPos – List Position
○ SPos – Screen Position
○ SDis – Screen Display
2. Collective Search Help
○ Combines multiple elementary search helps
○ Uses parameter assignment

33.2 Search Help Flow

User Action Flow:

User presses F4

→ Search Help

→ Help View

→ Database Tables

Important Notes:

• Help View works only when assigned to a Search Help

• Search Help controls how F4 values are fetched and displayed

• Help View defines the data source for Search Help

• Search Help can be assigned at Data Element, Domain, or Screen Field level.

34. TYPES OF TABLES


34.1 Transparent Table
Definition: A Transparent Table is a table where one table is created in the application layer and the
same table exists physically in the database layer.
Architecture Explanation
Application Layer Database Layer

Transparent Table → Same Table


(1) (1)

Relationship: 1 : 1

● One table in application layer

● One corresponding table in database layer

● Direct physical existence in database

Key Characteristics
● Data is stored directly in the database.

● INNER JOIN is applicable.

● Used for standard and custom tables.

● Best performance among table types.

● Supported in S/4HANA.

Functional Understanding
Since the table exists physically in both layers with a one-to-one relationship, data retrieval and
manipulation operations are straightforward. This structure provides high performance and supports SQL
operations such as INNER JOIN effectively.

34.2 Pooled Table


Definition
A Pooled Table is a table where multiple application layer tables are stored together in a single database
table called a table pool.
Architecture Explanation
Application Layer Database Layer

Table A
Table B
Table C → Table Pool
(1)

Relationship: N : 1

● Many tables in application layer

● One table pool in database layer

Key Characteristics
● Data is stored logically.

● INNER JOIN is not applicable.

● Used for small customizing data.

● Poor performance.

● Not supported in S/4HANA.

Functional Understanding
In this structure, multiple logical tables share a single physical database table (table pool). Because of this
pooling mechanism, SQL operations such as INNER JOIN are not supported. Performance is
comparatively poor due to logical data storage.

34.3 Cluster Table


Definition
A Cluster Table is a table where multiple application layer tables are stored together in a single database
table called a table cluster in compressed form.
Architecture Explanation
Application Layer Database Layer

Table X
Table Y
Table Z → Cluster Table
(Compressed)

Relationship: N : 1

● Many tables in application layer

● One cluster table in database layer

● Data stored in compressed format

Key Characteristics
● Data is stored in compressed form.

● INNER JOIN is not applicable.

● Used for application data.

● Poor performance.

● Not supported in S/4HANA.

Functional Understanding
Cluster tables store multiple logical tables inside a single physical table in compressed format. Due to
compression and shared storage, direct SQL operations like INNER JOIN are not supported. Performance
is lower compared to transparent tables.

35. Foreign Key


Definition
A Foreign Key is a key field in a table which is used to maintain the relationship with item tables.
Purpose
● Used for maintaining relationships between tables.

● Used for data validation at check tables.

36. Check Table


Definition
A Check Table is used to validate data at field level.

Function
● Ensures that field-level values are valid.

● Works together with foreign keys for data validation.

37. Value Table


Definition
A Value Table is used to validate data at domain level.

Function
● Validation happens at domain level.

● Controls allowed values for a particular domain.

38. Lock Object


Definition
A Lock Object is used to protect data and avoid concurrent access by multiple users to the same data at
the same time.

Purpose
● Prevents data inconsistency
● Ensures data integrity during read and write operations

● Lock entries can be monitored in transaction SM12

Types of Locks
1. Read Lock (Shared Lock)

● First user can display and change data

● Other users can only display data, no changes allowed

● Identified with S

2. Write Lock (Exclusive Lock)

● First user can display and change data

● Other users cannot display or change the data

● Lock requests are synchronized and processed one by one

● Identified with E

3. Exclusive Lock with Cumulative

● Only the first lock request is accepted

● All remaining lock requests are rejected

● Identified with X

Lock Function Modules


● ENQUEUE – Used to lock the object

● DEQUEUE – Used to unlock the object

Naming Convention
● Lock objects are created starting with letter ‘E’

● While creating lock objects, focus is on the second letter


39. BUFFERING
Definition
Buffering is a mechanism to load data from the database layer to the application layer for faster access.

Purpose
● Improves performance

● Reduces database access

● Commonly used for frequently accessed master data

Buffer Location
● Defined in the Technical Settings of a table

Types of Buffering
1. Generic Buffer

● Data is buffered based on key fields

2. Single Record Buffer

● Only one record is loaded from multiple records

3. Full Buffer

● All records of the table are loaded into buffer

Buffering Modes
1. Buffering not allowed

○ No buffer space allocated

2. Buffering allowed but switched off

3. Buffering switched on

Important Notes
● Buffering is not applicable for transaction tables as data changes frequently
● Buffering is suitable for tables with constant or rarely changing data

● Log changes track who changed the data, when it was changed, and how the data was modified

You might also like