Sunday, January 13, 2013

R/3 Modules

R/3 Functional Modules:

R/3's applications are modules.  They can be used either alone or combined with other solutions.  The integration capability of these applications increases the benefits derived for any company.
1.      Logistics
Logistics comprises all processes involved in purchasing, materials management, manufacturing, warehousing, quality management, plant maintenance, service management and sales and distribution.  All applications access a shared consistent database, supported by production data management.
SD: Sales & Distribution        SD actively supports sales and distribution activities with outstanding functions for pricing, prompt order processing, and on-time delivery, interactive variant configuration, and a direct interface to profitability analysis and production.
PP: Production Planning and Control        PP provides comprehensive process for all types of manufacturing: from repetitive, make-to-order, and assemble-to-order production, through process, lot and make-to-stock manufacturing, to integrated supply chain management with functions extended MRP || and electronic kanban, plus optional interfaces to PDC, process control systems, CAD and PDM.
PS: Project System        PS coordinates and controls all phases of a project, in direct cooperation with Purchasing and Controlling, from quotation to design and approval, to resource management and cost settlement.
MM: Materials Management        MM optimizes all purchasing processes with workflow-driven processing functions, enables automated supplier evaluation, lowers procurement adn warehousing costs with accurate inventory and warehouse management, and integrates invoice verification.
QM: Quality Management        QM monitors, captures, and manages all processes relevant to quality assurance along the entire supply chain, coordinates inspection processing, initiates corrective measures, and integrates laboratory information systems.
PM: Plant Maintenance        PM provides planning, control, and processing of scheduled maintenance, inspection, damage-related maintenance, and service management to ensure availability of operational systems, including plants and equipment delivered to customers.
SM: Service Management        SM provides highly integrated cusotmer service functionality to compete in today's global markets.
PDM: Product Data Management        PDM supports in creating and managing product data throughout the product life cycle.
2.      Financials
Fianancials is a suite of integrated financial application components encompasses all aspects of financial accounting, investment management, controlling, treasury management, and enterprise controlling.
FI: Financial Accounting        FI collects all the data in company relevant to accounting, providing complete documention and comprehensive information, and is at the same an up-to-the-minute basis for enterprise-wide control and planning.
CO: Controlling        CO is a complete array of compatible planning and control instruments for company-wide controlling systems, with a uniform reporting system for coordinating the contents and procedures of company's internal processes.
IM: Investment Management        IM offers integrated management and processing of invetment measures and projects from planning to settlement, including pre-investment analysis and depriciation simulation.
TR: Treasury        TR is a complete solution for efficient financial management that ensures the liquidity of worldwide company, its structures, financial assets, profitability and minimizes risks.
EC: Enterprise Controlling        EC continuously monitors company's success factors and performance indicators on the basis of specially prepared management information.
3.      Human Resources
HR provides solutions planning and managing company's human resources, using integrated applicatons that cover all perosnnel management tasks and help simplify and speed the process.
PM: Personnel Management        PM is a complete solution for personnel administration, recruitment management, travel management, benefits administration and salary administration.
OM: Organizational Management        OM assists in maintaining an accurate picture of organization's structure, no matter how fast it changes.  It is systematic and forward planning tool that considers the final effects of all personnel events thus it's complete solution for personnel cost planning.
PA: Payroll Accounting        PA addresses payroll functions from a global point-of-view and gives the capability to centralize payroll processing or decentralize the data based on country or legal entities.
TM: Time Management        TM is integrated with payroll accounting, controlling, production planning, plant maintenance, project system, external services and shift planning.  It provides with a variety of standard reports that will assist in tracking and analyzing employee time with compeleteness and accuracy.
PD: Personnel Development        PD assists with planning, monitoring, and analyzing scheduled seminars, training courses, and business events, registration and booking, price determination and invoicing.

Introducing SAP ABAP

   ABAP( a business programming language).

ABAP is a high level programming language created by SAP. ABAP is considered one of many fourth generation languages and it was developed in early 1980s. ABAP is an acronym for 'Advanced Business Application Programming' (in German it means Allgemeiner Berichtsaufbereitungsprozessor).
ABAP is used by SAP to develop SAP R/3 applications. ABAP is very easy to learn. However to start programming with ABAP programmers are expected to have some basic knowledge of data bases, other programming knowledge and preferably also some basic principles of Object oriented concepts.
ABAP programs are stored in a database unlike with other popular programming languages like C++ or JAVA where the programs are stored as files on the computer. The ABAP environment (syntax checking, compiling and executing) is a part of SAP Basis component.
All SAP data and programs run on an SAP system. A SAP system consists of one or more application servers, data base and client terminals. A typical SAP landscape will have 3 systems for Development, Testing and  Production.

1.    Abap Data types:

Built in data types
Character (text), Numerical character (number string), Date, Time Integer, Floating point number, Packed number, and HeX code).

Data Type
Initial Value
Standard Length
Permitted Length

Packed Number


Floating point no.

Numeric text


Date (yyyyMMdd)

Time (hhmmss)


Max : 65,535 bytes

2.  ABAP operators

Operator Description
=, EQ Equal: True, if the content of operand1 matches the content of operand2.
<>, NE Not Equal: True, if the content of operand1 does not match the content of operand2.
<, LT Lower Than: True, if the content of operand1 is smaller than the content of operand2.
>, GT Greater Than: True, if the content of operand1 is greater than the content of operand2.
<=, LE Lower Equal: True, if the content of operand1 is lower than or equal to the content ofoperand2.
>=, GE Greater Equal: True, if the content of operand1 is greater than or equal to the content of operand2.

Comparison operators for character type data types.

                  Operator     Meaning
                         CO      Contains only
                         CN      Contains not only
                         CA      Contains any
                         NA      Contains not any
                         CS       Contains string
                         NS       Contains no string
                         CP       Suits pattern
                         NP       Does not suit pattern

3. ABAP Events


          ABAP is an event-driven programming language. The general flow of an ABAP program is controlled by events. These events are defined in an ABAP program using event keywords. All statements between event keywords or between an event keyword and a FORM statement form processing blocks. For clarity of reading code, it is good programming practice to code event processing blocks in the order in which they will be triggered during execution.  However, they do not have to be coded in a sequential order.  Within an ABAP Processing Block, statements are processed sequentially (top to bottom). Finally, the code in the END-OF-SELECTION processing block is executed. All ABAP statements that are not written as part of a processing block (after an event keyword) or a FORM-ENDFORM block are automatically part of the Start-of Selection processing block if they are coded above all other event keywords or subroutines.
The Events in ABAP are,
Classical Events.
1) Initialization
2) Load of Program
3) At selection-screen output
4) At Selection-Screen of Field
5) At Selection-Screen on Value-Request
6) At Selection-Screen on Help-Request
7) At Selection-Screen
8) Start of Selection
9) End of Selection
10) Top of Page
11) End of Page

Interactive Events
12) At Line-Selection.
13) At PF key
14) At User-Command
15) Top-of-page During Line-Selection.

Module pool Programming events are
1) PAI - Process After Input
2) PBO - Process Before Output
3) POV - Process On Value Request (F1 HELP)
4) POH - Process On Help Request (F4 HELP)

Load of program is the first event in case of module pool , function groups. But for Executable programs the event Initialization is triggered first. If Load of program would have triggered first in type 1 program then it would have triggered before executing the default additions of parameters/select options.
But default additions are only gets triggered when the value of the corresponding data object is initial. So Initialization is the first event for executable programs to achieve dynamic default settings.

An event gets ended by the start of another event. So events can’t be nested. Sequence of events in a program is irrelevant. Subroutine is  a block executed for the event triggered by perform. Start of selection is the implicit standard event for a executable program.

When an ABAP program is started, first all global data objects are created in working memory. Then runtime system triggers the events one by one. If a processing block exists for an event then the statements under it are executed. All write statements are stored in the List buffer first and only gets displayed after the start of selection gets processed.

ABAP runtime provides certain Work Processes and services .
Work processes: ( Transaction SM50: Work process overview)
1.    DIA : Dialog requests (min 2 per dispatcher)
2.    UPD : Update requests ( 1 or more)
3.    UPD2 : Time critical update (1 or more)
4.    BGD  : Background job
5.    SPO(Spool)  : Output requests
6.    ENQ(Enquee)  : Locks (only 1)
Services      :
1. Message server ( Between several application servers)
2. Gateway Server (SAP and external)
3. Internet Communication Manager


4.    Types of reports


In ABAP, there are a total of 7 types of reports. They are:
Logical Database
ABAP query
ALV Reports (ALV stands for ABAP List Viewer)
Report Writer/Report Painter
Views (There are different types of views also)

Classical Reports
These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.
Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
Events In Classical Reports.
INTIALIZATION: This event triggers before selection screen display.
AT-SELECTION-SCREEN: This event triggers after processing user input still selection screen is in active mode.
START OF SELECTION: Start of selection screen triggers after processing selection screen.
END-OF-SELECTION : It is for Logical Database Reporting.

Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel : contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
Interactive Report Events:
AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
AT PFn: For predefined function keys...
AT USER-COMMAND : It provides user functions keys.
TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.

Logical Database Reports
Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.
While using LDB there is no need for us to declare Parameters.
Selection-screen as they will be generated automatically.
We have to use the statement NODES in ABAP report.
If there are many tables the Performance will be slow as all the table data will be read from top node to bottom node .

ABAP Query Reports
ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.
Transaction Code : SQ01
   The advantage with ABAP QUERY is logic required for classic & interactive reports system design automatically 80%.
For ABAP QUERY handle these

Report Writer
Key Concept :
Super users and end users can use Report Painter/Report Writer tools to write their own reports.
Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.
Instead of using ABAP code to write a report in FI and CO, many users build a Report Painter/ Report Writer library using transaction MC27.
However, this workaround has some drawbacks. Little known transaction GRCT solves these problems in most cases, and eliminates the need to use transaction MC27.

ABAP Report Types
ABAP report types are those ones available in some report's attributes screen, i.e. :
Executable program
Function group (containing function modules)
Interface pool
Class pool
Module pool
Subroutine pool
Also ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf. transaction se83) available from release 4.6 of SAP R/3.
ALV is available in two modes: list and grid. List mode is good old list processing with standard functionalities , and grid mode is using a new OCX object displaying grids.

Simple/Classical type of reports programs are read-only report programs that show the data once. When users want to drill down and expand the results, we develop Interactive Reports.

Reports (lists) are displayed in a special container screen. On a normal screen, a user action triggers the PAI event. In the screen flow logic, you code a processing block that calls ABAP dialog modules in this event. In list processing, the event is intercepted by the list processor and processed.

Instead of calling dialog modules, one of the three following list events mat be called depending on the function code triggered by the user.We usually have report code that consists of :
TOP OF PAGE event - where we write the Page Header details, Column names, etc.
END OF PAGE event - where we write sum, total, end of report comments, etc.
START OF SELECTION event - all the select queries would go in this event
END OF SELECTION event - written after start of selection, it would consist of all the logic to process the data that was selected in start of selection and to fill up the Internal table and lastly looping at the internal table and displaying the contents using write statement
 Incase of Interactive reports, we drill down if certain records are selected by user. This is done with the help of HIDE statement. Hide statement will act as a temp buffer and the selected line is available for drilling or displaying the next list.
AT LINE-SELECTION - This event has the code block required to drill down the report whenever user selects any particular record
AT USER-COMMAND  -  If you have written the corresponding event blocks in your program, they are executed. You can access the function code in the system field SY-UCOMM.

The output from any list statements that you write in these event blocks is written to detail lists. One can maintain one basic list and up to 19 detail list, total is 20.
The ABAP system field SY-LSIND is very important contains the index of the list currently being created. For Basic list, SY-LSIND is zero.
By default, the basic list has a standard list status and standard page header.
The TOP-OF-PAGE and END-OF-PAGE events can occur while the basic list is being created. All output in these events is placed in the page header and footer of the basic list. In executable programs, the basic list is automatically sent to the list processor and displayed at the end of the END-OF-SELECTION event. Otherwise, it is displayed after the PAI processing block on the screen from which the LEAVE TO LIST-PROCESSING statement occurred.

The list produced by classical report doesn’t allow user to interact with the system.The list produced by interactive report allows the user to interact with the system.

Events / Processing Blocks in ABAP Reports
Events/Processing blocks in ABAP Start of an event is marked by event keyword.
End of an event is indicated by start of another event.
INITIALIZATION Before the standard selection screen is displayed
AT SELECTION-SCREEN After user input on a selection screen has been processed, but while the selection screen is still active
START-OF-SELECTION After the standard selection screen has been processed, before data is read from the logical database
GET node After the logical database has read a data record from the node node
GET node LATE After all of the nodes of the logical database have been processed that are hierarchically subordinate to the node in the structure of the logical database
END-OF-SELECTION This event is generally used to mark the end of GET node event in reports where LDB’s are used
List processor events:     

In list processing when a new page starts. Frequently used in Simple Reports to display header data.
This event is executed whenever the first WRITE statement is encountered. System first executes the TOP OF PAGE event and then processes the WRITE statement.
In list processing when a page ends. Generally used in Simple Reports to print footer data.
Triggers when a specific line in the output is selected. Generally used in Simple Drill down reports for navigation. sy-lisel holds the content of the line that was clicked
When the user triggers the predefined function code
When the user triggers a function code defined in the program

4. What is RICEF?
You usually come accross the word RICEF when searching for SAP ABAP Developer jobs.
RICEF isn't a standard SAP acronym. It's not defined by SAP like we have ABAP, ALV, etc. It's a comon term used to describe five areas of technical developments in SAP.

RICEF stands for Reports, Interfaces, Conversions, Enhancements, Forms.

R- Reports
R stands for Report developments. All the technical objects/developments that deal with programing of SAP Reports. It includes different types of reports; Simple reports where you output using WRITE statements, Simple ALV reports, ALV Grid, ALV Grid with advanced functionality,etc.

I - Interfaces
I stands for Interface developments. Interfaces are ALE/IDOCs development. Involves not just ABAP programming for IDOCs but also IDOC customization.

C - Conversion
C stands for conversion objects. Conversion refers to BDC programing. Data upload from legacy system in flat files format to SAP system is done via Conversion Objects. This involves uploading data through BDC, LSMW, BAPI, etc.

E - Enhancements
Enhancements are User Exits, Customer Exits, BADI's etc. ABAP code that has to be written in order to enhance SAP system functionality.

F - Forms
Forms include SAP Smartforms, SAP Scripts. Technical development that deals with fetching necessary data from SAP system and displaying in terms of forms for printout are classified as under Forms.

5.    Modularization Techniques in ABAP


Each ABAP program has a modular structure. ABAP programs are divided in:
Processing blocks that are controlled by time events when the program is a report program (standalone program of type 1).
Modules that are controlled by the screen flow logic when the program is ah dialog program (module pool of type M).
If the program contains the same or similar blocks of statements or you want to process the same function several times, we can avoid redundancy by using modularization techniques. By modularizing your ABAP programs further, you make them easy to read and improve their structure. Modularized programs are also easier to maintain and to update than programs which have not been modularized.
Purpose of modularization is: 1) Organizing your ABAP Code 2) Limit maintenance cost by coding every thing only once and making your ABAP code easier to understand.
Modularization techniques:
1) Organizing your ABAP code can be done by using INCLUDE reports and local MACRO's (DEFINE statement). Typical examples can be found in Module Pools and Function Groups with TOP-includes and special includes for PBO events, PAI events et cetera. You can discuss if using subroutines, functions or methods is also part of this type of modularization technique. At this moment, most ABAP programmers use subroutines partly as a means to create some sort of main line in their program, thus limiting large chunks of ABAP code. Regarding MACRO's there are some special problems, especially that they don't improve readability of ABAP coding, and you can not debug them.
2)Here, we are talkin about ABAP PROCEDURES:
 a) Subroutines, b) Functions and c) Methods

- 2a) Subroutines:
These can be used locally and globally (external subroutine calls). Subroutines have a formal interface ( USING, CHANGING, TABLES parameters). The interface parameters can be passed BY VALUE or BY REFERENCE. Data that is defined within a subroutine (FROM ... ENDFORM.) is local: lifetime and visibility is limited to the moment the subroutine is called. External Subroutines are subroutines that are called from another program. Typical example can be found in the way SAPscript and SMARTforms printprograms are called by RSNAST00. External Subroutines can be grouped into Subroutine Pools.

- 2b) Functions:These are part of function groups. They are designed for global use and have a unique name. Function Modules also have a formal interface using IMPORTING, EXPORTING, CHANGING and TABLES parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A function module can also have local data.  In theory, a function module can only use data a)from the interface parameters, b) defined locally in the function module and c) defined globally in the function group. However, it is possible to see global data from calling programs using field-symbols.
Remote Function Modules are function modules that can be called from other SAP or NON-SAP systems. BAPI's are examples of RFC-enabled function modules.  Function Groups and Function Modules are maintained using transaction SE37 (or SE80).

- 2c) Methods: These are part of CLASSES. Here we are talking about ABAP Objects, supporting inheritance, instantiation, encapsulation, polymorphism, events, Interfaces, visibility sections (PUBLIC, PROTECTED, PRIVATE) and lifetime options STATIC and INSTANCE.
Classes can be defined locally or globally: a) Local Classes are classes, defined as part of an ABAP program. They can be used only within this program. b) The functionality of Global Classes is identical, but these classes are maintained using the Class Builder (SE24 or SE80).  The name of a method is not unique; you always need the name of the object to create the unique name. As a result, several classes will have exactly the same method name.
Methods also have a formal interface using IMPORTING, EXPORTING, CHANGING and RETURNING parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A method can also have local data.  In general, using classes is considered a much better alternative to using subroutines and function modules, especially with regards to maintenance costs. Actually, you do not need subroutines anymore. Function Modules are only needed is some cases, for example as RFC's because the classes don't support remote calls.
One limitation of ABAP Classes is that they do not support dynpro's. This means that you always need a report/module pool/function group if you want to create screens.  Within methods, several types of obsolete ABAP statements are not allowed like: ON CHANGE OF, TABLES and OCCURS.