"In ABAP it is very convenient to run a report using a Variant. Basically a report can have several Variants linked to it. If you use a variant then the data entry time is reduced considerably and this also reduces data entry errors. The load on the ABAP processing is also reduced. To create a Variant you may need the necessary authorizations. Most of the times while testing programs you will need to run a report using a variant and hence having the authorization to create a Variant is necessary. To create a Variant go to the main reporting screen, enter the name of the report for which you want to create the variant and select goto Variants option from the menu. The system displays the initial screen for the Variants. For creating a Variant you need to enter all the mandatory fields. Also you need to give a unique name for the Variant. Follow the naming convention rules. You may have to create several Variants for a particular report. Once a Variant is created you ca also schedule to run the report in the background using this Variant. For each variant that you create you need to give a brief description which will help to explain the purpose of the variant and help to distinguish the various Variants that you have created. You may want to protect your Variant by selecting the Protect Variant option. This option enables only the person who has created the Variant to change or delete it. While Running a report directly from the menu you can use the Run with Variant option and then select the desired variant from the dropdown list. Remember that Variants are report dependant. So to create a Variant you need to first create an ABAP report (Executable Program with selection screen). Once you successfully create all the variants for an ABAP report, you will save considerable amount of time which would otherwise have been spent in entering the same data again and again."
"A subset of Standard SQL that is fully integrated in ABAP is Open SQL statements. Their role is to help you by giving permission to access data irrespective of the database system, which the R/3 installation is using. The Data Manipulation Language (DML) part of the Standard SQL is present in the Open SQL. In other words, it gives you the permission to read (SELECT) and change (INSERT, UPDATE, DELETE) data. In the R/3 system, the tasks of the Data Definition Language (DDL) and Data Control Language (DCL) parts of the Standard SQL are performed by the ABAP dictionary and the authorization system."
SAP Logical Databasesoffer the following Advantages:
Saves Time: This is because a Logical Database comes along with a pre-defined Selection Screen and Data Retrieval Logic.
A Logical Database can be used in Multiple Programs. Hence if you you create a Logical Database once it can be used along with several of your programs where similar logic is required.
It offers a easy to use and a Standard User Interface
Central Authorization Checks for Database Access.
Flexibility: This is because even though a Logical Database has its own selection screen and data retrieval logic still you can complement this with your selection screens and SELECT statements. This makes the program more powerful
Checks for the User Input, if it is complete, correct and plausible.
Note: One executable program can have only one Logical Database.
A Logical Database is a special ABAP program. Basically what a Logical Database does is it combines the contents of certain database tables. A Logical Database needs to be mentioned in the Program attributes, this is done while creating a new program. A program that has a Logical Database linked to it basically has another program working along with it, but this program works like a single program. It makes use of the additional functionality provided by the Logical Database. The processing blocks of the Logical Database are called by the runtime environment in a particular order.
Basically a Logical Database has two functions one is to
Call the Selection Screen and the Retrieve the data. __________________________________________________
A program that uses Logical Database is Event Driven. The most important Event associated with a Logical Database is the GET EVENT. This EVENT is responsible for retrieving the Data.
Example of a Logical Database: F1S
If you are using a Logical Database, even though the Selection screen and the Data Retrieval is carried out by the Logical Database still you can control the selection screen and the depth of the data retrieval process. This can be achieved with the help of the NODE statement.
Once the Logical database is mentioned in the Program Attributes you can then use the GET EVENT in the main program to determine the depth of the data retrieval. Also the NODES statement in your program interacts with the Selection Screen of the Logical Database. You can use the EXIT or CHECK statements to determine the depth of the GET EVENT.
Before activating a program you need to check if the program is syntactically correct. This can easily be done in the ABAP editor with the following tools
Syntax Check Extended Program Check _________________________________________
The menu pat is as follows
Program >>>>>> Check >>>>>> Syntax Program >>>>>> Check >>>>>> Extended Program Check _________________________________________________________________
Syntax Check (Standard Syntax Check)
Here the syntax is checked by the system and if an error occurs the check stops and immediately an error message is displayed. Also the system suggests error correction. Any SAP ABAP program before execution needs to be Activated and before activation a Syntax check is necessary. If the program has not been checked for Syntax, and directly activated then during the activation process you have an option to ignore the errors and activate anyway. If you choose this option, the syntax errors are displayed while executing the program.
In case you are running a Syntax check on an Include program then automatically the system combines it with the TOP INCLUDE. In case the systems generates WARNINGS in the syntax check, then you can still run the program as some of the WARNINGS can be ignored. But its a good practice to correct all the warnings as they could lead to unforeseen errors and can give trouble in future SAP releases.
Extended Program Check
The extended program check does a more complete check of the program. It actually does a Syntax check on all the interfaces called from your program. All these check are excluded from the Standard Syntax check explained above. Basically there are 2 types of errors in any program
Static Errors and Runtime Errors
The Runtime errors are not checked by the Standard Syntax Check explained above. Even the Extended Program Check is a Syntax Check for Static Errors. Sometimes in extended program check you may get warnings that cannot be corrected, the code that produces such warnings should be commented for extended check or you can put pseudo comments ("#EC). All other Warnings should be corrected before activating the program. Technically the development is not considered to be complete if the Extended Program Check shows errors/warnings.
Always specify your conditions in the Where-clause instead of checking
them yourself with check statements. The database system can then use an index
(if possible) and the network load is considerably less.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.