Sap Abap
Sap Abap
SAP - Systems Analysis and Program Development / Systems, Applications, and Products in
Data Processing
Sap is practically known for its ERP (Enterprise Resource Planning) software. SAP's ERP systems
enable businesses to integrate various functions across their operations, ensuring smooth and
efficient workflows.
SAP provides a comprehensive suite of applications and systems that ensure seamless
integration of business processes across departments such as finance, HR, manufacturing,
supply chain, services, procurement, and others.
ABAP is a high-level programming language developed by SAP for building business applications
within the SAP environment. It is specifically designed to meet the needs of SAP's ERP systems
and other SAP applications.
As of now we are in the part of SAP-ABAP Technical Team we will be focusing on the
development server where we will be dealing with the creating and implementing the object
requirements of the client/User!!!
● In SAP development, Transport Requests and Transaction Codes are essential components
for managing changes and executing tasks within the system.
Transport Request:
A Transport Request (TR) is a container that holds one or more development objects (e.g.,
programs, tables, configurations) to be moved from one SAP system to another.
TR’s are used to move changes from one SAP system to another, such as from a development
system to a quality assurance or production system.
Steps to create:
● SE09/SE10:-initiate the creation of a new transport request and assign it a unique
identifier.
● Adding Objects:-objects can include ABAP programs, database tables, data dictionary
objects, configurations, and more.
● Release: Once all necessary objects are added, the transport request is released.
**Releasing a transport request locks the objects and marks them for export to other SAP
systems.
Transaction Code:
A TCode is a shortcut or abbreviation used to execute specific tasks or launch SAP applications
within the SAP system. Each transaction code corresponds to a particular function or program in
SAP.
Transaction Codes are used to navigate and perform tasks within the SAP system quickly and
efficiently.
Users can access transaction codes by entering the code in the SAP command field or using the
SAP Easy Access menu.
Steps to create:
● use the SAP Transaction SE93 to create
● link it to an existing program, object,function module, or report.
Package:
Package is a logical container used to organize and manage development objects within the SAP
repository. It serves as a unit of transport, authorization, and release management for ABAP
objects.
● Package can be created by using SE80
● Once the package is created, you can assign ABAP development objects
Syntax Concepts:-
Keywords in ABAP:-
● DATA: Used to declare variables and data objects.
● SELECT: Used to retrieve data from database tables.
● INSERT: Used to add new records to database tables.
● UPDATE: Used to modify existing records in database tables.
● DELETE: Used to remove records from database tables.
● IF / ELSEIF / ELSE: Used for conditional branching and decision making.
● CASE / END CASE: Used for multi-way branching based on different conditions.
● WHILE / ENDWHILE: Used for looping through a block of code while a condition is true.
● DO / ENDDO: Used for looping through a block of code a specified number of times.
● LOOP / ENDLOOP: Used for looping through internal tables.
● EXIT / EXIT. / EXIT FROM ...: Used to exit from loops or processing blocks.
● TRY / CATCH / ENDTRY: Used for exception handling and error catching.
● CALL FUNCTION: Used to call function modules or remote function modules.
● METHOD: Used to define methods within ABAP classes.
● EXPORT / IMPORT: Used for passing parameters between programs or function modules.
● MESSAGE / MESSAGE ...: Used for displaying messages to users or logging messages.
● CONCATENATE: Used to concatenate strings.
● PARAMETERS: Keyword indicating the declaration of input parameters.
● WRITE / WRITE ...: Used to output data to the screen or log.
● Information of keyword : Select key word +CTRL+F1
SELECT:-
In ABAP, SELECT, SELECT SINGLE, and SELECT SINGLE * are different statements used for
retrieving data from database tables.
Conditional Statements:-
IF / ELSEIF / ELSE:
Syntax:-
IF condition1.
" Code block 1
ELSEIF condition2.
" Code block 2
ELSE.
" Default code block
ENDIF.
Sy-Subrc
● If the last statement executed successfully, SY-SUBRC is set to 0.
● If the last statement encountered an error, SY-SUBRC is set to a non-zero value, typically
4
Dynamic Programming:
Dynamic Calls:
● Subroutines:
● Function Module:
● Method :
● Executable Program
Open SQL:
Ordered Data Sets:-
->Sorting by Primary Keys(Ascending):-
Joins:
Modularisation:
Function Modules:
● Do not define any data objects in dialog modules and event blocks.
● Move source code to methods and subroutines, and use local data inside that.
● Use TABLES structures only in DYNPRO (screen) programming.
● Never create TABLES structures in processing blocks.
● When calculating with integer operands, use type p result fields.
● Avoid floating-point numbers with type f.
● Catch all runtime error from methods.
● Always check validity before dereferencing references.
● Always check validity before accessing field symbols.
● Sort the table once before accessing it with BINARY SEARCH.
● Before accessing the database with FOR ALL ENTRIES, always make sure that the internal
table is not empty.
● Use only key access when changing data in sorted tables.