SAP ABAP

Introduction to SAP ABAP: 

ABAP stands for Advanced Business Application Programming language. It is an interpreted programming language that runs in the SAP ABAP Runtime environment. ABAP is the main language used for building solid-state business application solutions in the SAP Runtime environment. It has evolved over the years to include Object Oriented language extensions as well.

With the introduction of the Netweaver release, certain applications such as Portal technology were best run on a JAVA based solution, such as J2EE. SAP Netweaver also has a JAVA based runtime environment. This runtime environment runs JAVA based solutions that have been deployed to the SAP JAVA server.

SAP has balanced its SAP software to leverage the best of either language for supporting the various applications.
  • SAP Applications are installed on two different database schemas, depending on the specific application and each are accessed by the respective runtime environment. 
     1. One for the JAVA instance (JAVA Stack)
     2. One for the ABAP Instance (ABAP Stack)
                
  • ABAP is used for all applications based on the ABAP stack.
        1.This includes all versions of SAP prior to SAP Netweaver, including the SAP Enterprise release.
       2.The ABAP Stack can still handle web based activities, however this is realized via ABAP based Web Applications such as ABAP WebDynpro or Business Server Pages for UI solutions, and ABAP web services for SOAP/XML based solutions.
  • JAVA is used based on an integrated J2EE Engine that presents the foundation for fully web based technologies.
        1.Portal framework, Business Intelligence, IPC (Internet Pricing and   Configuration) use the JAVA stack as its foundation, running a J2EE engine.


ABAP Feature:

  • Declaring data with various types and structure
  • Operational elements for data manipulation
  • Control elements for controlling the program flow
  • Event elements for reacting to external events
ABAP Report Programming:
SAP-ABAP supports two types of Programs -  Report Programs & Dialog Programs. Report Programs are used when large amounts of data needs to be displayed

Purpose/Use of Report Programs:
  • They are used  when data from a number of tables have to be selected and processed before presenting
  • Used when reports demand  a special format
  • Used when the report has to be downloaded from SAP to an Excel sheet to be distributed across.
  • Used when the report has to be mailed to a particular person.
Important Points to Note About Report Program:
  • Report Programs are always Executable Programs. Program Type is always 1.
  • Every Report program corresponds to a particular Application Type i.e. either with Sales & Distribution, FI – CO etc. It can also be Cross Application i.e. type ‘*’.
  • Report Programming is an Event-driven programming.
  • The first line of a report program is always Report <report-name>.
  • In order to suppress the list heading or the name of the program the addition No Standard Page Heading is used.
  • The line size for a particular report can be set by using the addition line-size <size>.
  • The line count for a particular page can be set by using the addition line-count n(n1). N is the number of lines for the page and N1 is the number of lines reserved for the page footer.
  • To display any information or error message we add a message class to the program using the addition: Message-id <message class name>. Message classes are maintained in SE91.
Dialog Programming:
  • SAP-ABAP supports two types of programs – Report Program and Dialog Program.
  • If your ABAP program demands user input , Dialog programming is used.
  • A  user dialog is any form of interaction between the user and the program and could be any of the following
  • Entering data
  • Choosing a menu item
  • Clicking a button
  • Clicking or double clicking an entry
  • Dialog program is also used when we need to navigate back and forth between screens
  • Dialog programs are created with type as ‘M’ – Module Pool. They cannot be executed independently and must be attached to at least one transaction code in which you specify an initial screen.
Difference between Report and Dialog Programs:



Report Program:
A report is a program that typically reads and analyzes data in database tables without changing the database.
Dialog Program:
A dialog program allows you to work interactively with the system and to change the contents of the database tables. Each dialog program has a certain sequence of screens that are processed by the system one after the other.
A Sample transaction processing in Dialog Programming:


Components of Dialog Program
Unlike report which generally entails the creation of one autonomous program which can be executed independently of other objects, dialog program development entails development of multiple objects none of which can be executed on it’s own. Instead all objects are linked hierarchically to the main program and and are executed in a sequence dictated by the Dialog Main Program.

Transaction code
  • The transaction code starts a screen sequence.
  • You create transaction codes in the Repository Browser in the ABAP Workbench or using Transaction SE93.
  • A transaction code is linked to an ABAP program and an initial screen.
  • You can start a screen sequence from any ABAP program using the CALL SCREEN statement.

Screens
  • Each dialog in an SAP system is controlled by one or more screens.
  • You create screens using the Screen Painter in the ABAP Workbench through transaction SE51
  • Each screen belongs to an ABAP program.
  • These screens consist of a “screen mask” or “layout” and its flow logic. The screen has a layout that determines the positions of input/output fields and other graphical elements such as checkboxes and radio buttons. A flow logic determines the logical processing within screen.
GUI status
  • Each screen has a GUI status(es) which are independent components of a program.
  • This controls the menu bars, standard toolbar, application toolbar , with which the user can choose functions in the application.
  • You create them in the ABAP Workbench using the Menu Painter.
ABAP Program
  • Each screen and GUI status in the R/3 System belongs to one ABAP program.
  • The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status.
  • ABAP programs that use screens are also known as dialog programs.
  • In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.
Types of ABAP programs:
As in other programming languages, an ABAP program is either an executable unit or a library, which provides reusable code to other programs and is not independently executable.

ABAP distinguishes two types of executable programs:

  • Reports
  • Module pools

Reports follow a relatively simple programming model whereby a user optionally enters a set of parameters (e.g., a selection over a subSET of data) and the program then uses the input parameters to produce a report in the form of an interactive list. The term "report" can be somewhat misleading in that reports can also be designed to modify data; the reason why these programs are called reports is the "list-oriented" nature of the output they produce.

Module pools define more complex patterns of user interaction using a collection of screens. The term “screen” refers to the actual, physical image that the user sees. Each screen also has a "flow logic", which refers to the ABAP code implicitly invoked by the screens. Each screen has its own flow logic, which is divided into a "PBO" (Process Before Output) and "PAI" (Process After Input) section. In SAP documentation the term “dynpro” (dynamic program) refers to the combination of the screen and its flow logic.

The non-executable program types are:
  • INCLUDE modules
  • Subroutine pools
  • Function groups
  • Object classes
  • Interfaces
  • Type pools

An INCLUDE module gets included at generation time into the calling unit; it is often used to subdivide very large programs. Subroutine pools contain ABAP subroutines (blocks of code enclosed by FORM/ENDFORM statements and invoked with PERFORM). Function groups are libraries of self-contained function modules (enclosed by FUNCTION/ENDFUNCTION and invoked with CALL FUNCTION). Object classes and interfaces are similar to Java classes and interfaces; the first define a set of methods and attributes, the second contain "empty" method definitions, for which any class implementing the interface must provide explicit code. Type pools define collections of data types and constants........

ABAP programs are composed of individual sentences (statements). The first word in a statement is called an ABAP keyword. Each statement ends with a period. Words must always be separated by at least one space. Statements can be indented as you wish. With keywords, additions and operands, the ABAP runtime system does not differentiate between upper and lowercase.


Statements can extend beyond one line. You can have several statements in a single line (though this is not recommended). Lines that begin with asterisk * in the first column are recognized as comment lines by the ABAP runtime system and are ignored. Double quotations marks " indicate that the remainder of a line is a comment.






















No comments:

Post a Comment

Note: only a member of this blog may post a comment.