ABAP stands for Advanced Business Application Programming. Before release 4.0 of SAP R/3, the language was known as ABAP/4 (the 4 meant it was a fourth-generation language). With release 4.0B, back in 1998, the name was changed to simply ABAP because, although the language maintains most of the best fourth-generation language features and previous syntax and keywords, many object-oriented features have been incorporated in a move to make it a fully capable object-oriented language.
ABAP is the programming language that SAP has used to develop all the SAP R/3 business modules and applications, including the system management functions. It is available to customers and developers to extend SAP functionality for their particular needs. ABAP programs are created and maintained using the workbench tools discussed in previous sections.
Because of its origin and evolution, ABAP retains many of the fourth-generation language features such as the following:
The ABAP object-oriented features started together with SAP's strategic and technological move toward working with business objects and the introduction of Business Application Program Interfaces (BAPIs) within the Business Framework architecture. The business objects are included within the ABAP Workbench in the business object repository (BOR). As an object-oriented language, the new ABAP, from release 4.x onward, incorporates technology principles such as inheritance, encapsulations, and polymorphism to provide the language with advantages such as lower maintenance costs and greater ease in reusing code.
Basic concepts and features of the ABAP object-oriented programming language are the same as those of other object-oriented languages. The most important are as follows:
Basics of the Syntax of the ABAP Programming Language
In the next few sections we will introduce the basic elements of the ABAP programming language, with the objective of providing an overall description of the most important features of the ABAP syntax, such as data types, comments, naming conventions, operators, program flow control, and so on. We will also provide the classical example with the first ABAP program "Hello World."
ABAP Data Objects
When defining a data object within an ABAP program, there are two possibilities: using the keywords LIKE or the keyword TYPE. This type of definition is static. At runtime, we cannot modify the type of the data object. There are other possible syntax options, but they are not supported with ABAP objects. With the LIKE keyword, what we are indicating is that the type of the data object being defined is the same that the data object referenced in the clause. For example,DATA field1 TYPE C.
In the example data object field2 is of type C (field of one position) because that is the type of data object field1. With the keyword TYPE we have three options for defining the data object:
There is also the possibility of defining complex structure types based on the elementary types.
The following table shows the current ABAP predefined data types:
The length of variable fields is established at runtime, and therefore it is not required to specify their length when defining the fields. It is necessary to specify the length for the fields of type "c," "n," "x," or "p." You cannot specify length for type "D" or "t" because the length is predefined for the standard type.
We can also define type groups in the ABAP dictionary. The main features of the type groups are the following:
Maintaining a type group
The features of the integer data type are the following:
This is the arithmetic used by integer number types:
DIV Integer division
MOD Rest of the integer division
The main features and arithmetic of the packed number types are the following:
The arithmetic of the packed type is as follows:
Floating Comma Numeric Type
The features of this type are the following:
In packed numbers the floating comma types are represented by addition of binary fractions. Both the exponent and the mantissa are stored in this way.
The arithmetic of this type is the following:
String Character Type
Main features of the string type are the following:
Comments in ABAP
Comments in ABAP are easy to include in the programs. The two types of comments that we can enter in our ABAP programs are
Line Comments ABAP provides a way to mark a line as a comment. The method consists of entering an asterisk sign (*) in the first column of the line. For example:
Partial Line Comments The partial line comments allow for making a comment only in a part of a line. In order to enter one of these types of comments, you have to code double quotes (") in any column of the line. The compiler will not take into consideration anything that is entered after the quotes. It is important to note that the ABAP comments are entered using quotes (") whereas literal values are identified by a single quote sign ('). For example:
• Select * from bkpf "Read all the columns from the table
Conventions in ABAP
The ABAP programming language is not restrictive when defining identifiers, but it has some rules that must be closely observed. The names of the components of classes (attributes, methods, events, and so on) can only be made up of characters A–Z, a–z, 0–9 and character _. Additionally, the first character cannot be a numeric digit. You cannot use special characters in the identifiers because, on some occasions, these have special meaning for the system. For example: The first DATA statement is wrong, whereas the second one is correct:
DATA: field-name TYPE, ...
1name TYPE ...
DATA: field_name TYPE, ...
name1 TYPE ...
Although there are other elements of the ABAP language less restrictive, it is recommended to use the same conventions as those used in ABAP objects.
Relational Operators for Any Data Type
Relational Operators for String Character Types
Relational Operations for Fields of Byte Type Data of type byte are of type X (fixed length) and XSTRING (variable length).
Relational Operators for Bit Masks
Other Relational Operators
My First ABAP Program, Hello SAP World!!!
As it cannot be any other way, we will show a very easy example that will show the message Hello world!!! in the screen.
Hello SAP World result
The ABAP Language Editor is included within the SAP systems, and it can be accessed from transaction SE38. When in main screen of transaction SE38, enter the name of the program (ZLESSON1) in the Program field, and click on the Create button.
Main Screen of transaction SE38
In the next screen, enter the following information.
Leave default values in the rest of the fields and click on Save. Next the system will show up the ABAP Editor. In this next screen is where we write the ABAP code that will generate the output as we have shown previously.
ABAP source code
After entering the code we must verify the syntax by clicking on the fm:see file in this email button, saving the changes in the program by clicking on the Save button, and then activating the program to be able to run it by clicking on the Activate button. We can run the program by clicking on the Direct Processing button. After pressing this button, and if there was no error on the code, we will get the output. Easy, isn't it?
SAP BASIS Related Interview Questions
|SAP CRM Interview Questions||SAP HR Interview Questions|
|SAP ABAP Interview Questions||SAP HANA Interview Questions|
|SAP Crystal Reports Interview Questions||SAP SOLMAN Interview Questions|
|SAP Security Interview Questions||SAP BPC Interview Questions|
|SAP Netweaver Interview Questions||SAP UI5 Interview Questions|
|SAP Smart Forms Interview Questions|
Sap Basis Tutorial
Sap: From Sap R/3 To Sap Netweaver
The Architecture Of The Sap Web Application Server
Sap Netweaver: An Overview
Using Sap Systems
Upgrading To Sap R/3 Enterprise: The First Step Into Sap Netweaver
The Change And Transport System
Development Options With Sap Solutions: Abap Engine
User Management And Security In Sap Environments
Web Application Server System Management
Performance And Troubleshooting With Sap Solutions
Sap For It Managers: Implementation, Planning, Operation, And Support Of Sap Systems
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.