When you call a function module, an instance of its function group plus its data, is loaded into the memory area of the internal session. An ABAP program can load several instances by calling function modules from different function groups.
SAP R/3 refers to Systems Application and Product for data processing Real-time having a 3 tier architecture i.e. Presentation layer, Application layer and Database layer.
There are five contents in Technical Settings:
Function Groups act as containers for Function Modules that logically belong together.
1) These cannot be defined in a Function Module.
2) It cannot be called.
3) They are containers for Function Module.
1) These must be defined in a Function Group.
2) It can be called from any program.
3) They are not containers for Function Group.
Central information repository for application and system data. The ABAP Dictionary contains data definitions (metadata) that allow you to describe all of the data structures in the system (like tables, views, and data types) in one place. This eliminates redundancy.
Domain - Specifies the technical attributes of a data element - its data type, length, possible values, and appearance on the screen. Each data element has an underlying domain. A single domain can be the basis for several data elements. Domains are objects in the ABAP Dictionary.
Data Element - Describes the business function of a table field. Its technical attributes are based on a domain, and its business function is described by its field labels and documentation.
Aggregate Object – Views, Match Code and Lock objects are called aggregate objects because they are formed from several related table.
View - A view is a virtual table containing fields from one or more tables. A virtual table that does not contain any data, but instead provides an application-oriented view of one or more ABAP Dictionary tables.
Different Types of View:
No, we cannot print decimals in type N because decimal places are not permitted with N data type.
Float Data Type: It cannot be declared in Parameters.
Packed Number: It can be declared in Parameters.
PARAMETERS : A(4) TYPE P DECIMALS 2, B(4) TYPE P DECIMALS 2.
DATA : C(4) TYPE P DECIMALS 2.
C = A + B.
WRITE : / ‘THE SUM IS’ , C.
There are three different functions used in SAP Script:
Parameters in Each Function:
There are 6 events in report:
There are four standard layouts in the SAP Script:
SELECTION-SCREEN BEGIN OF BLOCK ABC WITH FRAME TITLE T01.
SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
CALL SELECTION-SCREEN 500 STARTING AT 10 10.
The ABAP system fields are active in all ABAP programs. They are filled by the runtime environment, and you can query their values in a program to find out particular states of the system. Although they are variables, you should not assign your own values to them, since this may overwrite information that is important for the normal running of the program. However, there are some isolated cases in which you may need to overwrite a system variable. For example, by assigning a new value to the field SY-LSIND, you can control navigation within details lists.
SAP Script – It is the integrated text management system of the SAP R/3 System.
Reports - It is the way to display data fetched from database table onto screen or directly output it to a printer.
SY-TABIX - Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.
* APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
* COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
* LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop loss. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
* READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
SY_INDEX - In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.
There are Two Events:
GET - After the logical database has read an entry from the node table Tag.
GET LATE - After all the nodes of the logical database have been processed that are below <table> in the database hierarchy.
There are three types:
The Events used in ABAP are:
2. AT SELECTION-SCREEN
3. AT SELECTION-SCREEN ON <field>
6. TOP-OF-PAGE DURING LINE SELECTION
9. AT USER-COMMAND
10. AT LINE-SELECTION
11. AT PF<NN>
13. GET LATE.
14. AT User Command
An output list which displays just the basic details & allow user to interact, so that a new list is populated based on user-selection. With interactive list, the user can actively control data retrieval and display during the session.
Top-of-Page during line-selection.
I had worked with the following (30) system fields:
1) SY-DBSYS - Central Database
2) SY-HOST - Server
3) SY-OPSYS - Operating System
4) SY-SAPRL - SAP Release
5) SY-SYSID - System Name
6) SY-LANGU - User Logon Language
7) SY-MANDT - Client
8) SY-UNAME - Logon User Name
9) SY-DATLO - Local Date
10) SY-DATUM - Server Date
11) SY-TIMLO - Local Time
12) SY-UZEIT - Server Time
13) SY-DYNNR - Screen Number
14) SY-REPID - Current ABAP program
15) SY-TCODE - Transaction Code
16) SY-ULINE - Horizontal Line
17) SY-VLINE - Vertical Line
18) SY-INDEX - Number of current loop Pass
19) SY-TABIX - Current line of internal table
20) SY-DBCNT - Number of table entries processed
21) SY-SUBRC - Return Code
22) SY-UCOMM - Function Code
23) SY-LINCT - Page Length of list
24) SY-LINNO - Current Line
25) SY-PAGNO - Current Page Number
26) SY-LSIND - Index of List
27) SY-MSGID - Message Class
28) SY-MSGNO - Message Number
29) SY-MSGTY - Message Type
30) SY-SPONO - Spool number during printing
Primary Key – It can accepts 0 value and cannot be NULL.
Unique Key – It can be NULL.
Select-options : dname for deptt-dname.
Remote Function Call.
It stores the click value and display the related record in the secondary list.
In a LOOP statement.
There are two types of BDC’s:
There are three events of Interactive Reports:
RDBMS – Relational Database Management System. It helps to create relationship between two or more table.
START-OF-SELECTION SELECT * FROM DEPTT INTO CORRESPONDING FIELDS OF ITAB WHERE DEPTNO IN DEPTNO. APPEND ITAB. ENDSELECT. LOOP AT ITAB. WRITE : / 10 ITAB-DEPTNO. HIDE : ITAB-DEPTNO. ENDLOOP. END-OF-SELECTION
There are four types of Joins:
By using two statements:
There are five Standard Layouts in SAP Script:
There are three functions used in SAP Script:
Extracts are dynamic sequential datasets in which different lines can have different structures. We can access the individual records in an extract dataset using a LOOP.
Logical Unit of Work.
Two types of LUW are:
eps_get_directory_listing for directory.
Steps for making and inserting Logo in SAP Script:
1) Draw the picture
2) Save it
4) Write name & Choose Color
5) Click on Import
6) Browse picture
4) Click on stored on document server
6) Choose name of BMAP
Call Screen: Calling a single screen is a special case of embedding a screen sequence. If you want to prevent the called screen from covering the current screen completely, you can use the CALL SCREEN statement with the STARTING AT and ENDING AT
LEAVE SCREEN: statement ends the current screen and calls the subsequent screen.
No, records will be displayed.
Suppressing of entire screens is possible with this command. This command allows us to perform screen processing “in the background”. Suppressing screens is useful when we are branching to list-mode from a transaction dialog step.
Steps for writing BDC
2) Declare Tables, Data (for ITAB) and Data (for BDCITAB)
3) Call function ‘Upload’.
4) Write code for the First Screen, Radio Button, Filename, Change Button, Second Screen, Utilities (Create Entries), Third Screen and Save.
5) Call transaction ‘SE11’ using BDCITAB mode ‘A’.
6) Save, Check Errors, Activate and Execute.
Write code of the following:
Steps for creating the Functions:
3) Function Group (FG)
4) Create Group
5) Name of FG (ZREKHA_FG)
6) Short Text
8) Local Object
2) Inactive Object
3) Function Group (ZREKHA_FG)
1) Name of Function Module (ZREKHA_FM)
3) Write FG Name (ZREKHA_FG)
4) Short Text
Call function ‘ZREKHA_FM’.
There are two types of function modules used in F4 help:
Sales & Distribution Module
1) Sales Document: Item Data – VBAP
2) Sales Document: Partner – VBPA
3) Sales Document: Header Data – VBAK
4) Sales Document Flow – VBFA
5) Sales Document: Delivery Item Data - LIPS
6) Customer Master – KNA1
7) Material Data – MARA
8) Conditions (Transaction Data) - KONV
READ LINE and READ CURRENT LINE – These statements are used to read data from the lines of existing list levels. These statements are closely connected to the HIDE technique.
No, there cannot be more than 1 main window in SAP Script because in WRITE_FORM, it asks for the parameter Window that will create the problem.
ABAP Memory is a memory area in the internal session (roll area) of an ABAP program. Data within this area is retained within a sequence of program calls, allowing you to pass data between programs that call one another. It is also possible to pass data between sessions using SAP Memory.
SAP Memory is a memory area to which all sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session (as with ABAP memory) or to pass data from one session to another.
AT SELECTION-SCREEN - event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program.
AT SELECTION-SCREEN OUTPUT - This event block allows you to modify the selection screen directly before it is displayed.
GET CURSOR statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <f>.
GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] LENGTH <len>].
Select-options specify are displayed on the selection screen for the user to enter values.
Different Properties of Select-options:
1) Visible Length
2) Matchcode Object
3) Memory ID
6) No Display
7) Modify ID
Free - You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.
Refresh - This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement
Yes, we can have more than one selection screen.
Selection-screen begin of block honey with frame title text-101.
Select-options : deptno for zrekha_deptt-deptno.
Selection-screen end of block honey.
Selection-screen begin of block honey1 with frame title text-102.
Select-options : dname for zrekha_deptt-dname.
Selection-screen end of block honey1.
SELECT-OPTIONS: specify are displayed on the selection screen for the user to enter values.
Parameters: dname like dept-dname.
Select-options: dname for dept-dname.
By using two types of function modules to be called in SAP Script:
Mark the Table maintenance allowed flag if users with the corresponding authorization may change the data in the table using the Data Browser (Transaction SE16). If the data in the table should only be maintained with programs or with the table view maintenance transaction (Transaction SM30), you should not set the flag.
Parameters, Select-options & Selection-Screen.
Reason for Setting Lock: Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.
Page Window: In this window, we define the margins for left, width, upper and height for the layout of Header, Logo, Main, & Footer.
Go to SE71, give layout set name, go to utilities select debugger mode on.
There are maximum 6 sessions open in SAPgui.
System variables have been predefined by SAP. We can use these variables in formulas or, for example, to pass on certain pieces of information to a function module. How the function called by the function module behaves depends on the type of information passed on.
Sum: You can only use this statement within a LOOP. If you use SUM in an AT - ENDAT block, the system calculates totals for the numeric fields of all lines in the current line group and writes them to the corresponding fields in the work area. If you use the SUM statement outside an AT - ENDAT block (single entry processing), the system calculates totals for the numeric fields of all lines of the internal table in each loop pass and writes them to the corresponding fields of the work area. It therefore only makes sense to use the SUM statement in AT...ENDAT blocks. If the table contains a nested table, you cannot use the SUM statement. Neither can you use it if you are using a field symbol instead of a work area in the LOOP statement.
COLLECT : It allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa.
HEADER, BODY, FOOTER.
Field Symbols – They are placeholder or symbolic names for the other fields. They do not physically reserve space for a field, but point to its contents. It can point to any data objects.
Field Groups – Field groups does not reserve storage space but contains pointers to existing fields.
An extract dataset consists of a sequence of records. These records may have different structures. All records with the same structure form a record type. You must define each record type of an extract dataset as a field group, using the FIELD-GROUPS statement.
BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along with the action is stored in session i.e. data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.
Call Transaction Method & Call Dialog.
Go to SM36 and create background job by giving job name, job class and job steps (JOB SCHEDULING).
Pool Table :
Transparent Table :
Two Problems: -
Different types of data dictionary objects:
3) Data elements
6) Search Helps
7) Local Objects
4 Types of Tables:
Steps to create a table:
No, Transparent table do exist with the same structure both in the dictionary as well as in the database, exactly with the same data and fields.
In PAI, define function code and write code for the same.
YES. e.g.:- ITAB LIKE SPFLI.
Here we are referring to a data object (SPFLI) not data element.
Open SQL – These statements are a subset of standard SQL. It consists of DML command (Select, Insert, Update, Delete). It can simplify and speed up database access. Buffering is partly stored in the working memory and shared memory. Data in buffer is not always up-to-date.
Native SQL – They are loosely integrated into ABAP. It allows access to all functions containing programming interface. They are not checked and converted. They are sent directly to the database system. Programs that use Native SQL are specific to the database system for which they were written. For e.g. to create or change table definition in the ABAP.
To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
EXEC SQL [PERFORMING <form>].
<Native SQL statement>
There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
ABAP Editor: Tool in the ABAP Workbench in which you enter the source code of ABAP programs and check their syntax. You can also navigate from the ABAP Editor to the other tools in the ABAP Workbench.
The events are as follows:
An Interactive report is a dynamic drill down report that produces the list on users choice.
It’s an Interactive report where in the user can get more relevant data by selecting explicitly.
Exceptions: Our function module needs an exception that it can trigger if there are no entries in table SPFLI that meet the selection criterion. The exception NOT_FOUND serves this function.
COMMUNICATION_FAILURE & SYSTEM_FAILURE
Different types of data dictionary objects:
When the table is activated, a physical table definition is created in the database for the table definition stored in the ABAP dictionary. The table definition is translated from the ABAP dictionary of the particular database.
It is available for any insertion, modification and updation of records by any user.
It is similar to table index that gives list of possible values for either primary keys or non-primary keys.
In commercial, organizational and technical terms, the client is a self-contained unit in the R3 system, with separate set of Master data and its own set of Tables. When a change is made in one client all other clients are affected in the system - this type of objects are called Client independent objects.
Yes, group of users can access these programs with a client number.
SY-SUBRC, SY-DBCNT, SY-LILLI, SY-DATUM, SY-UZEIT, SY-UCOMM, SY-TABIX..
Performance of ABAP programs can be improved by minimizing the amount of data to be transferred. The data set must be transferred through the network to the applications, so reducing the amount of time and also reduces the network traffic.
Some measures that can be taken are:
The sequential files (ON APPLICATION SERVER) are called datasets. They are used for file handling in SAP.
Open SQL has 2 system fields with return codes:
Using function modules
No, it is not must to use LDB. Apart from it, we have other options:
We will look into the error log file (SM35). Check number of records already updated and delete them from input file and run BDC again.
We look into the list of incorrect session and process it again. To correct incorrect session, we analyze the session to determine which screen and value produced the error. For small errors in data we correct them interactively otherwise modify batch input program that has generated the session or many times even the data file.
The tool, which is used to create layout set is called SAP Script. Layout set is a design, appearance and structure of document.
Control Commands, System Commands.
Data : NUM type P decimals 2.
There are 6 attributes of FM:
There are 13 screen elements:
i. Input / output fields
ii. Text fields
iv. Radio button
v. Push Button
vi. Drop down list
viii. Table control
ix. Tabstrip control
x. Custom control
xii. Status icons
xiii. OK_CODE fields
There are 2 default Tab strips. Screen painter attributes contain Tab Title, which is used to insert more tabs in tab strip.
There are 11 properties of selection screen:
There are four components of selection table:
Select, Insert, Delete, Modify, Update.
Asynchronous Update – The program does not wait for the work process to finish the update.
Synchronous Update – The program wait for the work process to finish the update.
Commit Work and Wait.
There are three function module in BDC:
Steps for execution Session Method:
3) Batch Input
5) Choose Session Name
7) Asks for Mode (Display All Screen, Display Errors & Background)
There are three modes in Call Transaction:
There are four types of screen keywords:
There are four specials commands of lists:
Each field of cluster table behaves as tables, which contains the number of entries.
SAP Script layout, text element, and some DDIC objects.
In PAI (Write field statement on field you want to validate, if you want to validate group of fields put in chain and End chain statement).
Data in IDOC is stored in segments; the output from IDOC is obtained by reading the data stored in its respective segments.
After executing first write statement in start-of-selection event.
In SE11, one option is available above the fields strip i.e. Data element / direct type.
Transaction Code AL21.
Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z_table name and press enter.
It checks program execution time in microseconds. When you go to SE30. If you give desired program name in performance file. It will take you to below screen. You can get how much fast is your program.
Call transaction is faster then session method. But usually we use session method in real time...because we can transfer large amount of data from internal table to database and if any errors in a session, then process will not complete until session get correct.
Table contains vertical and horizontal lines. We can store the data in table as blocks. We can scroll depends upon your wish. And these all are stored in database (data dictionary).
ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
To read data from a database tables we use logical database. A logical database provides read-only access to a group of related tables to an ABAP/4 program. Advantages:
Check functions which check that user input is complete, correct, and plausible.
Meaningful data selection.
Central authorization checks for database accesses.
Good read access performance while retaining the hierarchical data view determined by the application logic.
Batch input session is an intermediate step between internal table and database table. Data along with the action is stored in session i.e data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.
These are the steps to be followed to Upload data through CATT: Creation of the CATT test case & recording the sample data input. Download of the source file template. Modification of the source file. Upload of the data from the source file.
If you do not specify a logical database in the program attributes, the GET events never occur.
There is no ENDGET command, so the code block associated with an event ends with the next event statement (such as another GET or an END-OF-SELECTION).
Client dependent or independent transfer requirements include client specific or cross client objects in the change requests. Workbench objects like Subscripts are client specific, some entries in customizing are client independent. If you display the object list for one change request, and then for each object the object attributes, you will find the flag client specific. If one object in the task list has this flag on, then that transport will be client dependent.
Macros can only be used in the program they are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program they are defined in and other programs. A MACRO is more or less an abbreviation for some lines of code that are used more than once or twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a subroutine that is called external. Since debugging a MACRO is not really possible, prevent the use of them (I’ve never used them, but seen them in action). If the subroutine is used only local (called internal) use a FORM. If the subroutine is called external (used by more than one program) use a FUNCTION.
Spool requests are generated during dialog or background processing and placed in the spool database with information about the printer and print format. The actual data is places in the Term See (Temporary Sequential objects).
An update request can be divided into one primary (V1) and several Secondary update components (V2). Time-critical operations are placed in V1 component and those whose timing is less critical are placed in V2 components. If a V1 update fails, V2 components will not be processed.
• In case of a substructure, the reference originates in the table itself, in the form of a statement include.
• In case of an append structure, the table itself remains unchanged and the reference originates in the append structure.
The different views are:
a. Logical view
b. Software-oriented view
c. User-oriented view
The components are:
a. Work Processes
d. Shared Memory
The two ways are:
• By specifying fixed values.
• By stipulating a value table.
Act as a bridge to connect different work processes with the respective users logged on to the SAP R/3 system. The request received by the Application Server are first directed to the dispatcher, which enrolls them to a dispatcher queue. The dispatcher then retrieves the request from the queue on the first-in first-out basis, and allocate them to a free work process.
It acts as an interface for R/3 communication protocols such as a Remote Function Call (RFC). RFC is the standard SAP Interface used to communicate between SAP systems.
The Three components of work process are:
1. Screen Processor
2. ABAP Processor
3. Database Interface
Dialog Work Process: Deals with request to execute dialog steps triggered by an active user.
Update Work Process: Execute database update requests
Background Work Process: Execute the programs that run without the involvement of the user
Enqueue Process: Handle the lock mechanism.
Spool Work Process: Passes sequential data flows on to printers
It is a graphical programming environment in the SAP R/3 system to develop different application using ABAP language. It provides different tools such as ABAP Dictionary, ABAP Editor, Screen Painter to create ABAP application.
It is a system that automates and integrates all modules of the business. It effectively and efficiently manages the resources of an enterprise to maximize the profit and to give a value to its stakeholders.