Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ABAP ?
ABAP used to be an abbreviation of Allgemeiner Berichts Aufbereitungs Prozessor, the German meaning of "generic report preparation processor", but was later renamed to Advanced Business Application Programming
It is one of the many the application-specific fourth-generation languages It was originally used by SAP developers to develop the SAP R/3 platform. It is also used by SAP customers to enhance SAP applications add custom reports and interfaces, and enhance user experience. It is a structured language like C. Its syntax is somewhat similar to COBOL The actual processing logic of an application program is written in ABAP. The ABAP processor executes the processing logic of the application program, and communicates with the database
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 3
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 4
Purpose
1. Comprehensive: ERP software supports an organizations all the business transactions and links them together using real-time integration. Integration: Real-time integration means that each change or update in one application causes the automatic change or update of the data in the other applications involved. Scalability: ERP software caters to the needs of small business house with say less than 10 users to multi billion dollar companies. Interfaces (EDI-ALE-IDOC): Directly Sending & receiving information from other systems helps in efficient functioning of business processes without the need for multiple data entry. Adaptability: Last but not the least, the softwares should be customizable to meet the specific needs of an organization that are not available as standard functionalities. 2.
3. 4.
5.
Use
Tables & structures
Data Storage & Retrieval
Interfaces
Routines, Methods
Processing Logic
Programs, Includes
Adaptability
Utilities
Challenges
ABAP shall enable to meet the frequent changes in business requirements by, - enhancing the existing programs - adding customer functionality to existing Transactions without modifying it. - Program testing and debugging
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 8
R/3 Architecture
R/3 Architecture
Presentation Layer
The presentation layer contains the software components that make up the SAPgui (graphical user interface). This layer is the interface between the R/3 System and its users. The R/3 System uses the SAPgui to provide an intuitive graphical user interface for entering and displaying data.
Application Layer
The application layer consists of one or more application servers and a message server. Each application server contains a set of services used to run the R/3 System
Database Layer
The database layer consists of a central database system containing all of the data in the R/3 System. The database system has two components - the database management system (DBMS), and the database itself.
Reports
Reports are Executable Programs that read data from the database, processes the data and display the data to the required format. Mostly a report does not make any changes to the database You can either display the output of a report on the screen, print it or send it to a file. You can also save it, so that it can be displayed as often as you like. It is important to be able to do this, because reading large volumes of original data can impair system performance. Examples of reports are Classical ABAP reports, queries, and drilldown interactive reports.
Interfaces
Interface refers to the data transfer between two independent systems. ALE is used for SAP to SAP communication and EDI is mostly used for any two system communication. Benefits of EDI-ALE: Reduced Data Entry Errors Reduced Processing Cycle time Availability of Data in electronic form Reduced Paperwork Reduced Cost Standard means of communication
Sender System
Purchase Order
Receiving System
Sales Order
Conversion
Conversion programs helps in data transfer from an external system into the SAP R/3 System. In other words, this type of transfer refers to a one-time transfer from a legacy system to the SAP system. Legacy system is the old system that is being replaced by the SAP system.
GUI_UPLOAD
Batch Input Direct Input
Legacy
SAP
AL11
Application data
Application server file
OPEN DATA SET READ DATASET CLOSE DATASET
Application data
Enhancement
Enhancements are plug points provided by SAP to add customer functionality to existing SAP Transactions without modifying it. Transaction Code : CMOD, SMOD,SE18, SE19. Advantages. They do not affect standard SAP Code. They do not affect software updates Techniques for Enhancements Customer Exits User Exits Business Add-Ins.
Enhancements act as hooks. You can hang your own add-on functionality onto these hooks.
Forms
Forms are used for creating and maintaining the output for printing in SAP system. As output medium it also supports a printer, fax, e-mail or the internet (by using the generated XML output). Transaction Code : SE71, SMARTFORMS
Printer
Application Program
FORM
FAX
Web Browser
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 17
Programs
Program Structure ABAP programs are responsible for data processing within the individual dialog steps of an application program. This means that the program cannot be constructed as a single sequential unit but must be divided into sections that can be assigned to the individual dialog steps. To meet this requirement, ABAP programs have a modular structure. Each module is called a processing block. A processing block consists of a set of ABAP statements. When you run a program, you effectively call a series of processing blocks. They cannot be nested. The following diagram shows the structure of an ABAP program:
Data Declaration
Dialog Modules
Event Blocks
Subroutines
Modularization
Procedures:
Procedures contain a set of statements, and are called from other ABAP programs. ABAP contains the following kinds of procedures,
Subroutines
Subroutines are procedures that you can define in any ABAP program and also call from any program.
Function modules
Function modules are procedures that are defined in function groups and can be called from any ABAP program.
Include
If you want to use the same sequence of statements in several programs, you can code them once in an include program.
SAP Database
The SAP database contains literally thousands of tables that store information. Some products like ECC and R/3 have more than 30,000 tables in fact, whereas other products like CRM might have fewer than 10,000. These tables are tied to each other through established relationships. This connection of multiple tables through relationships creates what is known as a Relational Database Management System (RDBMS).
Primary Key - Database tables in an RDBMS are required to contain a unique field that individually distinguishes one particular record from all others in the database. Eg: VBELN is primary key in VBAK.
Foreign Key - You use the primary key field in one table to link it to another. The common link field in the other table is usually not the primary key in the other table: It is called a foreign key. MATNR is primary key in MARA table and foreign key in VBAP.
Data Dictionary
A data dictionary is a central source of information for application data. Data Dictionary is Accessed Via Transaction Code SE11,SE16,SE16N
VIEW 1
VIEW 2
Search Help 2
TABLE 1
TABLE 2
TABLE 3
Structure 1
Search Help 1
DATA ELEMENT 1
DATA ELEMENT 2
DOMAIN
This transaction is a generic transaction for data dictionary where you can maintain all data dictionary objects .
This transaction is used to see the contents of the table. Table maintenance is not possible here .
This transaction is an SAP Enjoy transaction with a much more user friendly appearance; it supports custom controls in the form of ALV controls.
Important SD Tables
Sales Document table VBAK Sales Document: Header Data VBAP Sales Document: Item Data VBFA Sales document: Document flow VBPA Sales document: Partner profile VBEP Sales document: schedule line data VBEH Sales document: schedule line history
Delivery Document table LIKP Delivery: Header Data LIPS Delivery: Item data VBUK Sales document: Header status VBUP Sales document: Item status Billing Document table VBRK Billing: Header Data VBRP Billing: Item Data
Reports
Report is executable code that read data from the database, processes the data and displays the data to the required format. Transaction Code : SE38 Reports are classified into Classical reports and ALV.
Sorting in Descending order Sorting in ascending order Summation/Total Filter ABC Analysis
Graphical display
event end
processing block internal control event keyword processing block internal control ... external control
Events
INITIALIZATION AT SELECTION-SCREEN
START-OF-SELECTION
END-OF-SELECTION Interactive Events
India SAP CoE, Slide 31
TOP-OF-PAGE
Events
ABAP/4 report programs are event driven programs The different events in a report Program are:
Initialization.
Initialization of all the values. You can fill your selection screen with some values at runtime.
At Selection-Screen.
Validation & Checks of inputted values happen here
Start-of-Selection.
Here the program starts selecting values from tables.
End-of-selection.
After all the data has been selected this event writes the data to the screen.
Interactive Events.
Used for interactive reporting. It is used to create a detailed list from a basic list.
Interfaces
ALE (Application Link Enabling ) is a SAP terminology used mostly for SAP to SAP communication in Distributed servers system. EDI (Electronic Data Interchange) is a technology in itself with its own set of standards and used mostly for communication between any 2 systems on different networks IDOC (Intermediate Document) is a Data container
Important T-codes like WE02 To view the IDOC WE09 To search for an IDOC based on data in the IDOC WE19 Test tool to create and simulate an IDOC.
Important IDOC Status are (For Inbound IDOC) 53 - IDOC successfully posted 51 IDOC Failed 64 - IDOC ready to be transferred to Application
Conversions/Data Upload
Data is the single most important asset of a business and data conversion is therefore a critical success factor in any SAP system implementation. Data Migration is the migration/conversion/upload of data from source legacy system to target SAP R/3 system .
Legacy System
R/3 System
BATCH INPUT
Data
Conversions/Data Upload
The Legacy System Migration Workbench (LSMW) is a tool recommended by SAP that can be use to transfer data once only or periodically from legacy systems into an R/3 System. Transaction Code LSMW BDC (Batch Data Communication) also referred as Batch Input is a technique for mass input of data where data input into SAP screens is simulated. BDC allows to perform database updates in the background using standard SAP transactions. The resultant entries will be as if the user had manually entered the data via SAP and no bypassing of any of the standard SAP consistency checks, authorizations etc.
DIRECT INPUT
SAP function modules execute the consistency checks
Function Modules
You can submit the background job RSBDCSUB to start a session in background processing. If several sessions have the same name, RSBDCSUB starts them all.
Steps of LSMW
Create Project, Sub-Project and Object
Specify and assign the data file Read the data file and Convert data in SAP format Start DI programs and SAP Database will Update
India SAP CoE, Slide 44
Enhancement
Suppose we need some functionality which is not provided in sap what do you do. SAP has provided you with three options. 1) 2) 3) Customizing Done through SPRO Modifications Break the SAP standard code and modify. User Exits To avoid modifications, SAP has provide some exit points to add customer's own program . User exits are routine which SAP allows you to add in additional customized programs process without affecting the standard SAP programs. User exits allow developers to access and modify program components and data objects in the standard SAP System. On upgrade, each user exit must be checked to ensure that it conforms to the standard system.
SAP user exit are usually declare as a form routine :form userexit_xxx ........................ endform
Enhancement
User Exits for SD are found in IMG under Sales & Distribution System Modifications User Exits
Business Add-Ins for SD are found in IMG under Sales & Distribution System Modifications Business Add-In
Function Module exit is implemented as: CALL CUSTOMER.-FUNCTION <3 digit suffix>
User Exits
Few examples of User Exit programs in Sales Order
User exits are in the program MV45AFZZ
E.g... USEREXIT_MOVE_FIELD_TO_VBAK - assign values to new fields at sales document header level.
User Exits
Few examples of User Exit programs in Invoice User exits are in the program RV60AFZZ E.g... USEREXIT_NUMBER_RANGE The internal number range used in the standard system is specified in the billing type table and can be changed in this user exit. User exits in the program RV60AFZC E.g... USEREXIT_FILL_VBRK_VBRP This user exit is only called when the billing document is created. It is used to provide the header and the item of the new billing document with deviating or additional data.
Forms
SAPscript and Smartform are the tool that SAP provides for creating layout sets. Transaction Code for SAP Script is SE71 Transaction Code for Smartform is SMARTFORMS SMARTFORMS are client independent while SAP Script are Client Dependent The basic configuration required to do for Smartform/SAPscript is creating output type and attaching the Smartform to the output type. NACE is the transaction to set the output type. In NACE transaction first the application is selected ( e.g.V1 Sales, V2 Shipping etc). Then output type is selected. Sometimes output type is created newly if driver program and Smartform are custom program and not SAP standard ones
Forms
Whenever new output type is created , 3 parameters are required. They are : - Smart form / SAP script Name - Driver Program Name - ENTRY routine name.
RVADOR01
RLE_DELNOTE RLB_INVOICE
Read Data
Output Program
Layout set
Form
Utilities
Debugger - It enables observations and validations of code by displaying data objects and help in checking the flow logic of code.
SAP Notes provide urgent corrections and solutions for smaller problems.
Runtime Analysis - It shows how long system takes to process ABAP code, from single statements to a complete transaction. It also helps to know the System and the data retrieval time from database. T- Code is SE30.
SQL Trace - It helps to knowing the tables for data retrieval by activating the trace by ST05 and then execute the functionality.
Debugger
It is a tool which enables the programmer to monitor the execution of a program, stop it, re-start it, run it in slow motion, change values in memory and even, in some cases, go back in time.
Utilities: Debugger
The debugger is a programming tool used to analyze ABAP programs by line or section. With this tool we can display data objects and check the flow logic of programs Debugger Function Keys (/h) F5 Execute a single line of code. F6 Execute block of code F7 Return F8 Run to Cursor
Display Modes for Debugger: Fields : Displays the contents of a variable in the code. Table : Displays the contents of an internal table. Breakpoints : Displays list of Break-points in the code. Watchpoints : It is set to interrupt the program for field value changes.
The runtime analysis provides an overview of the duration and performance of your source code, from individual statements up to complete transactions. Transaction Code : SE30
Major Functions. Gives Tips & Tricks for coding Setting the measurement restrictions Start the runtime analysis in the current session Start the runtime analysis in a parallel session Display and process performance files Display database, system and ABAP execution time
Utilities: Trace
Trace tool is used to monitor and analyze the performance of the system in database accesses and remote calls of reports and transactions. Transaction Code : ST05
Major Features Trace on (starts recording) Trace off (stops recording) Trace function selection SQL Trace, Enqueue Trace. Display the basic or extended list Start the Explain SQL to analyze an SQL statement or trace file Give details of database usage
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 61
LetMe
In debug mode let the participant(s) find a Z message in a particular Txn Let the participant(s) find out a table where F1F9 will reach a structure Let the participant(s) find out a User Exit Let the participant(s) apply a note through Txn <snote>
PrepareMe TellMe
3
ShowMe
LetMe HelpMe
5
India SAP CoE, Slide 63
Additional Info
Variants Variants are input data which are filled in the selection screen and then saved so that at runtime the variant can be selected and then the entire selection screen is filled with the desired values Background Processing When a program takes a long time to execute then one can execute the program in background so that a job is set up for that program. The job can be seen in transaction SM37. The job log gives the exact start time and the end time for the job CATCH - Catching Runtime Errors CATCH SYSTEM-EXCEPTIONS except1 = rc1 ... exceptn = rcn. ENDCATCH. The CATCHENDCATCH block allows the programmer to catch ABAP runtime errors and assign these to a SY_SUBRC value Comments Commented lines in the program start with asterisk (*) To comment a part of line use double codes ().
India SAP CoE, Slide 65
Additional Info
Unlike most IMG configuration, all program except SAP-scripts are
necessarily client independent. Thus a program developed in one client in a server is also automatically available in all other clients in the same server. Print Program is assigned to Output Condition Type. This assignment needs to be done manually in all the clients. Table document.