0% found this document useful (0 votes)
59 views152 pages

SAP Theory

Uploaded by

modiboyinadivya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views152 pages

SAP Theory

Uploaded by

modiboyinadivya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 152

DATA DICTIONARY

 What is a data dictionary?


 Data Dictionary is a central source of data in a data management system. Its main
function is to support the creation and management of data definitions. It has
details about
 What data is contained?
 What are the attributes of the data?
 What is the relationship existing between the various data elements?
 What are the uses of the information in the Data dictionary?
 The following information is directly taken from the Data dictionary:
 Information on fields displayed with F1 help.
 Possible entries for fields are displayed with F4 help.
 Match code and help views search utilities.
 What are the basic objects of the data dictionary?
 Tables
 Domains
 Data Elements
 Structures
 Foreign Keys
 What are the aggregate objects in the data dictionary?
 Views
 Match codes
 Lock objects
 What are the technical properties of a table and explain about
them?
 Delivery Class: - It is used to control the Transport of the table data. It is used to
specify the type of table.
 In Real-time we mostly use the delivery class ‘C’.
 In the case of delivery class 'A' the table can be maintained in any system
(development, quality, production systems) using SM30.
 Data Browser/table view maintenance: - This property is used to specify whether
the table can be maintained or not.
 In real-time we mostly use the “Display/maintenance allowed “option.
 Data Class: - It is used to specify the type of data to be maintained in the table.
 In Real-time we mostly use APPL0 or APPL1
 APPL0 – Master data – Access frequently & updated (changed) rarely. Ex:
D.O.B
 APPL1 – Transactional data – Access frequently & updated frequently. Ex: Sal
 Organization & Customizing data – Updated rarely. Ex: Company Codes
 Size Category: - It is used to specify the initial space required for the table in the
database.
 In real-time we mostly use the '0' category. ( 0 – 7 ) -> [ 0 – 7100]
 It specifies the number of records that can be stored in a database table. Size
categories will be incremented dynamically based on increases in records.
 Buffering: - It is used to control (reduce) the traffic in the database when the table
is accessed by multiple users.
 In Real time we mostly use the mode “Buffering not allowed" – Table Can’t be
buffered
 Buffering allowed but Switched Off – Buffering allowed but not activated
 Buffering Switched on – The table can be buffered. In case of this option any
one of the buffering types should be selected.
 Single record buffering: In case of this buffering type, record by record is
buffered from the database tables.
 Generic Area buffer: It is used to buffer the table data based on the
specified key fields. In case of this buffering type, the no. of key fields must
be specified.
 Fully buffer: The entire table is buffered.
 Enhancement category: - It is used to enhance the particular fields of the table.
 In Real time we mostly use “Can be enhanced (DEEP)”.
 Table Maintenance generator: - It is used to maintain multiple entries & validate
the table data using the T-code SM30.
 What is the delivery class in ABAP dictionary?
 Delivery class defines what kind of data that is going to be stored in the database.
For example: - System data, Transaction data, Master data.
 Options Available in the delivery class.
 A- Application table (Master and Transaction data).
 C- Customizing table (Maintenance only by customer Not by SAP.)
 L- Table for storing temporary data.
 G, E, S, W- (These are used to store system data (basis data)).
 What is Display and Maintenance in a dictionary ?
 It specifies whether the user can display and maintain the data; the following
options are available under display and maintenance.
 Display/Maintenance Allowed. (Users can display and maintain the data.)
 Display/Maintenance allowed with restrictions. (Some of the users can display
and maintain the data.)
 Display/Maintenance Not Allowed. (No user can display data).
 What is data class?
 It defines the exact physical area at which the data is going to be stored in the
database.
 APPL0 - Master Data.
 APPL1 - Transaction Data.
 APPL2 - Organization and Customizing.
 DDIM - Dimension tables in BW
 DFACT - Facts tables in BW.
 DODS - ODS tables in BW.
 What is Buffer ?
 Buffer is a temporary memory for storing temporary data.
 What are control tables?
 The values specified for the size category and data class are mapped to database-
specific values via control tables.
 What is the purpose of the Table Maintenance Generator
(TMG)?
 It is used to maintain (Change, create, modify) the custom tables using the
standard T-Code SM30 & the T-code SE54 is used to create TMG.
 What are the events in TMG?
 Validation can be done by Table events using SM30. A Total of 38 events are there
in TMG.
 Before saving the data in the database.
 After saving the data in the database.
 Before deleting the data display.
 After deleting the data display,
 Creating a new entry.
 What are the steps to create TMG?
 Following steps can be used to create the TMG.
 Execute SE11
 Select the Radio button DB Table
 Provide the Table name & click on change
 Click on utilities.
 Click on TMG.
 Select the auth. group as &NC& and Provide the function group as your table
name
 Select the one-step radio button.
 Enter the overview screen number (could be any). [4 digit only]
 Click on create icon (F6) & Click on save.
 Press the enter button & Click on Local Object & Click on Back.
 What are pooled tables?
 These are logical tables, which must be assigned to a table pool when they are
defined. Pooled tables can be used to store control data (such as screen
sequences or program parameters).
 What is a table cluster?
 A table cluster combines several logical tables in the ABAP/4 Dictionary. Several
logical rows from different cluster tables are brought together in a single physical
record. The records from the cluster tables assigned to a cluster are thus stored in
a single common table in the database
 What are the types of database tables and differences between
them?
 There are 3 types of database tables.
 Transparent tables: - One to One relationship – Can be Join With Other
Transparent tables
 Pooled tables: - Many to One relationship.
 Cluster tables: - Many to One relationship.

Transparent Tables Pooled Tables Cluster tables

They have a one-one relationship with Many - One Many - One


the database tables.

A Secondary Index can be Created. Not Possible Not Possible

Both open & native SQL can be used Only Open SQL Only Open SQL

The Table name, fields name and no Table names and Field names Table names and Field
of fields are similar in DDIC and are different in the database. names are different in the
Database. database.

It follows both binary and linear Binary Search Linear Search


search.

It is a mirror image of the DB Table. It is linked with another set of It is stored with another set of
tables called table pools in the tables called Table Cluster
DB. Pool.

 Open SQL: It is a set of statements which can interact with any kind of database.
 Native SQL: It is specific to the particular database & it hits the database directly.
 How data is stored in a cluster table?
 A cluster table contains data from multiple DDIC tables. It stores data as a name
value pair (varkey, vardata).
 Is it possible to create custom transaction code to maintain the
table? If yes, how to create it?
 Yes, We can create it by using the custom T-Code using SE93.
 What are the differences between Include structure and
Append structure?

.INCLUDE Structure .APPEND Structure

It can be inserted at any position It can insert only at end of the table

It is possible with the custom tables It is possible to insert structure for both
Standard & Custom Tables

All the steps of include Structure must be All the steps of the append structure must
saved in either our own package or $TMP be saved in our own package.

The table must be in change mode It can be inserted in display mode also

It is possible to add the additional fields It is not possible to add the additional fields
manually after Include Statement manually after Include Statement
 How to identify the standard tables? (Indications)
 The tables which don't start with Z or Y.
 The tables which can't be seen in the CHANGE mode.
 How many types of Indexes are there and explain about them?
 Indexes are used to avoid duplicate data while accessing the table. Indexes can
also be used for better performance while extracting the data from the tables. There
are 2 types of Indexes.
 Primary index: It is generated by the system using the key field of the tables.
Key fields hold the unique data.
 Secondary Index: These are created and maintained by the Technical
Consultants/ABAPer. We can create 9 secondary indexes per table. We can
create the secondary indexes for both custom & standard tables.
 What is Where Used List?
 It is used to list out all the dependent objects & know the usage of the particular
object.
 Can we add/Enhance additional customer specific field values
to standard domains?
 Yes, the standard domains can be enhanced to add additional customer-specific
fixed values & intervals using the Menu path: Go to ->Fixed Value Append at
Domain level.
 What is a check table?
 It is a table which contains all valid entries of a field. Check table is the dependent
table to which the relationship is defined using the foreign keys. The contents of
the check table field are shown in the input help for the referenced field.
 For example: - Check the employee master table and employee transaction table.
Whenever an employee transacts you need to check whether the employee
exists. So, for that you can refer to the employee master table. This is nothing but
a Parent child relationship. Here data is maintained at client level. No development
involved. As per DBMS, what we call foreign key table, is called a check table.
 What Is a Value Table?
 Value table is the table attached to a field at the domain level, Where the entry to
the field can be only from the value table. They are not used in the input help. The
value table is the default check table.
 This is maintained at domain level. Whenever you are creating a domain. You can
enter allowed values in the value range. For example, check the domain SHKZG –
Debit/ Credit Indicator. Here Only allowed values are H and S. Whenever you will
be using this domain then the system will force you to enter one of these allowed
values. This can be defined as value table.
 Value table is maintained at the Domain level in SAP. During domain creation, the
value range of the domain is defined by specifying a value table.
 What are the differences between Check table and Value table?

Check Table Value Table

It is maintained at the Table Level. It is maintained at the Domain Level.

It can be used to extract the data in the It can’t be used to extract data since it is linked
program. with the domain.

The search help is displayed from the check The search help is displayed on each field which
table on the foreign key field of Foreignkey is linked with the same domain of the Value Table.
table.

It forces the user to select any one of the check It does not force the user since it has an empty
table field entries. value by default.

 What are the types of Views and explain about them?


 Views are the virtual/imaginary tables. It does not contain the data permanently.
View contains the data at Run time only.
 Database View: - It is used to combine the multiple table data by joining them.
It can be used to extract the data in the programs.
 Maintenance View: - It is used to maintain multiple table data using the T-code
SM30 (TMG).
 Help View: - It is used in the selection method in an Elementary Search Help
to provide the list of possible entries from the multiple tables.
 Projection View: - It is used to HIDE the unwanted fields of the table. It can be
defined using one table only.
 What are the Search Help types and explain about them?
 It is used to provide all the possible entries to the input variable as search help.
 Elementary Search help: - It is created using one base table.
 Collective Search help: - It is the collection of Elementary Search help.
 Search Help Exit: It is a Function module to filter possible entries of a search
help.
 It is used to modify the F4 values at run time.
 Is it possible to create a table/structure without creating any
data element and domains?
 Yes, we can create using the predefined types.
 It is used to create the table without using Data Elements/Domains.
 If the table or structure is created using predefined types, the symbol ' + '
appears instead of field labels while maintaining the tables.
 Reusability is not possible with the Predefined Types.
 What are the Lock objects and explain about the different lock
modes?
 They are used to control the parallel access for the same data by multiple users. It
avoids the concurrency access of multiple users on the same Database.
 Lock object feature is used to synchronize access to the same data by one or more
programs. Lock objects are used for avoiding inconsistencies when the data is
inserted or changed.
 The custom lock object name should start with 'E' followed by the table name.
Ex: - E < ZB16_Student >.
 It generates two function modules: one starts with ENQUEUE and other starts
with DEQUEUE.
 ENQUEUE - Request for Lock
 DEQUEUE -To Release the Lock
 Types of Locks:
 Write/Exclusive: The locked data can be accessed by a single user
only. All other Lock requests are rejected.
 Read/Shared: The multiple users can access the same data at the
same time. If no user tries to edit the data, all other users cannot
access this data.
 Exclusive but not Cumulative: It can be requested only once by the
given transaction Codes. All other lock requests are rejected.
 What is Structure ?
 The structure is a list of fields that are defined under a name. Which are used to
process data at run-time in SAP ABAP.
 Structures are of two types. One is the global structure and another is the local
structure. Local structures can be created in ABAP programs and global structures
can be created in DATA-DICTIONARY and that can be reused in different objects.

 What is the difference between Table and Structure?


TABLE STRUCTURE

Table contains the data Structure does not contain the data. It is filled with single
records at runtime.

It must contain at least 1 field as the It does not contain a primary field.
Primary Key.

Database must contain Delivery class It does not contain Delivery class & Technical Settings.
&
Technical Settings.

Tables have primary and secondary Structures do not have primary and secondary indexes.
Indexes

 Explain about Data element & Domain.


 Data Element: - Data element is an object that is used to specify the semantic
information of the field. Example given. Field label, Heading. It is one of the data
dictionary objects which can be used to maintain the field labels (descriptions) of
the fields in the table or structure.
 Parameter IDs are maintained at the Data Element level under the Further
Characteristics tab.
 Domain: - Domain is an object that is used to specify the technical information of
the field. As in example- data type, visible length, decimal places, fixed values,
value range etc.
 It is one of the data dictionary objects which can be used to maintain the
technical properties of the fields in the table such as Data types (char,
numc....etc.), length of the data (10, 20...etc.)
 It can be used to maintain a Value table to provide search help on the field.
 Conversion Routines are maintained at Domain Level.
 What are the different ways to provide search help?
 We can provide in 3 ways.
 Using a value table at Domain level.
 Foreign key relationship.
 Elementary and collective search help.
 What is the type group and explain?
 It is one of the data dictionary objects.
 It is used to define the Global types, Internal tables and constants which can
be referred anywhere in the system.
 The ABAP statement TYPE-POOLS is used to define the type group.
 What is table type and explain it?
 It is one of the data dictionary objects used to define the global internal table which
can be referred across the system.
 What is the Maximum No. of structures that can be included in
a table or Structure?
 9 (Nine)
 Can you use all the Views in the ABAP Program?
 No. We can use only the Projection view or Database view in the Program.
 What is a Data Dictionary/DDIC?
 Data Dictionary is a central & structured source of data. The data objects can be
referred anywhere in the system & the data definitions are maintained in the DDIC.
 Explain about 3-Tier Architecture?
 Presentation Layer (GUI): It is an environment where all the users are sent for the
services.
 Application Layer: It receives requests from the presentation layer to get them
processed.
 It also sends back the services to the presentation layer. There are 4 types of
components in the application layer.
 Dispatcher: It is a link between the presentation layer & the work process. It
receives the request from the presentation layer & sends them to an
appropriate work process to get them processed.
 Gateway/Layer: It is a communication protocol of the cross application
components such as $, BAPI etc. It provides links between two SAP systems.
 Shared Memory: It is a common memory which can be shared by all the work
process.
 Work Process: It is a component to execute the applications.
 Database Layer: It is the central repository of the data. It provides database
services to a group of clients.
 What is the Command field?
 It is used to execute the T-codes in SAP which is located on the standard toolbar.
 /o: It is used to execute the T-code in another new session.
 /n: It is used to execute the T-code on the same session by closing the current
session.
 Differences between Types & Field Strings?

TYPES FIELD STRINGS

They can be used as reference for Work area’s & Internal They can be used to declare Work area &
tables Internal tables directly.

The ABAP statement TYPES is used to declare Types. The ABAP statement DATA is used to
declare
Field Strings.

It doesn't hold the data since they are not data objects. It holds the data since they are data
variables.
 What is Foreign Key?
 Foreign key is a concept that is used to define relations between tables in the ABAP
dictionary.
 A relationship which can be defined between tables must be explicitly defined at
field level. foreign keys are used to ensure consistency of data.
 Data entered should be checked against existing data to ensure that there is no
contradiction. While defining foreign keys, cardinalities have to be specified.
 Cardinality mentions how many dependent records or how referenced records are
possible.
 What is a Client Dependent & Client Independent table?
 The table which has the MANDT field (Client no) is called Client Dependent table.
 The table which doesn't have the MANDT field (Client no) is called Client
Independent table.
 What are Key fields & Non-key fields?
 The key fields don’t allow duplicates. It contains unique data. The key field
checkboxes are checked to make the fields as primary keys.
 The non-key fields may/mayn’t allow duplicates. The key field checkboxes are
unchecked.
 What is the Initial Value Check box?
 The Initial Value Checkbox is checked to take the default field values of the key
fields for the 1 time.
st

 Differences between the tables created using Data elements &


Pre-defined types?

DATA ELEMENTS PRE-DEFINED TYPES

Data elements can be reused Reusability is not possible

Foreign key relationships can be created since it Foreign key relationships are not created.
contains domains.

Field labels (Headings) are displayed while ‘+’ symbols appear while maintaining the table
maintaining the table. instead of field labels.

 What is a Logical Database?


 Logical Databases are special ABAP programs that retrieve data and make it
available to application programs. Use of LDB – is used to read data from database
tables by linking them to executable ABAP programs.
 What is a table buffer? Which type of tables used this buffer?
 Buffer is nothing but a memory area. Table is buffered, which means that table
information is available on the application server. When you call data from a
database table it will come from the application server. Transparent tables and pool
tables are buffered, while cluster tables cannot be buffered.
 What are different types of Data Dictionary Objects?
 Database Tables
 Domains
 Data types
 Data element
 Structure
 Table type
 Search helps
 Elementary search help
 Collective search help
 Views
 Database view
 Maintenance view
 Help view
 Projection view
 Lock objects
 Type groups
 The ObjectsViews, Match Code and Lock objects are called Aggregate Objects
because they are formed from several related tables.

 A field containing currency amounts (data type CURR) must be


assigned to a reference table and a reference field. Explain.
 As a reference table, a system containing all the valid currencies is assigned or
any other table, which contains a field with the currency key format. This field is
called a reference field. The assignment of the field containing currency amounts
to the reference field is made at runtime. The value in the reference field
determines the currency of the amount.
 A field containing quantity amounts (data type QUAN) must be
assigned to a reference table and a reference field. Explain?
 As a reference table, a system table containing all the valid quantity units is
assigned or any other table, which contains a field with the format or quantity units
(data type UNIT). This field is called a reference field. The assignment of the field
containing quantity amounts to the reference field is made at runtime. The value in
the reference field determines the quantity unit of the amount.
 What is the significance of technical settings (specified while
creating a table in the data dictionary)?
 By specifying technical settings, we can control how database tables are created
in the database. The technical settings allow us to
 Optimize storage space requirements.
 Table access behavior.
 Buffering required
 Changes to entries logged
 Difference Between Call by Value and Call By Reference?
 Call By Value: creates a new memory location for use within the subroutine. The
memory is freed once it leaves the subroutine, changes made to the variable are
not affected outside the subroutine
 Call by Reference: passes a pointer to the memory location. Changes to the
variable within the subroutine affects the variable outside the subroutine
 What Is the Basic Difference Between Internal Tables and
Database Tables?
 The basic difference is database tables are stored in DB server and the internal
tables are virtual tables these are created runtime only
 Internal tables are created dynamically, the memory of internal tables is not
permanent memory, for internal tables the memory will be created in the application
server and it is external memory and terminates after the program termination
 What Is Sql Trace?
 SQL Tracer is a tool used to measure the performance of ABAP programs.

FUNDAMENTALS
 What are the differences between a Work Area and Field
Symbol?

WORK AREA FIELD SYMBOL

It is the data variable. It is a Pointer.

The ABAP Statement is DATA is used to declare The ABAP Statement FIELD-SYMBOL is used
or Define work areas. to declare or Define work areas.

The ABAP statement INTO is used to process The ABAP statement ASSIGNING is used to
record by record through the work area. assign the FIELD-SYMBOL.

The ABAP statement MODIFY must be used to No need to modify it, Since it is Pointer.
modify the internal table.

No need to specify within the Angular Brackets It must be specified within the Angular Brackets
(<>) (<>).
 What are internal tables and work areas? Differentiate between
internal table and work area.
 Internal tables and work areas are temporary memory locations which are used to
store data of database tables at runtime and in other ways we can call them as
instances of database tables.
 Differences between Work area and internal tables?

WORK AREA INTERNAL TABLES


It holds a single record at a time Holds multiple records.

Temporary memory locations which are Temporary memory locations which are used
used to store single line data of database to store data from the database table at
tables at runtime. runtime.

It doesn’t have BODY It has BODY [].

Record by record is processed through In the case of an internal table with a header
the work area. line, the record by record is processed
through the header line.
 What are the different types of internal tables in SAP ABAP?
Differentiate between the internal table’s types in SAP ABAP.
 There are three different types of internal tables in SAP ABAP programming which
are given below.
 Standard Internal Tables
 Sorted Internal Tables
 Hashed Internal Tables

Standard Internal Tables Sorted Internal Tables Hashed Internal Tables

These are default internal These are special types of internal These are used with logical
tables. tables, where data is already databases. I.E. with all
(automatically) sorted as you insert the fields and all records.
record

To read a record we use To read a record we use either key or Here the index operation is
either key or index index operation not allowed. We can only
operation use key operation

To search for a record, we To search for a record, we use binary To search for records, we
can use either linear search search as data is already sorted. use a hashed algorithm.
or binary search.

We can use sort operations. We do not use sort operation as data is


already sorted

We can use insert or We can only use inserts. Please do not These are mainly used in
append to add records. modify it. ABAP with BI projects.

 What is the difference between an Internal Table without a


Header Line and an Internal Table with a Header Line?
 The Internal Table without Header Line creates an internal table and work area
separately. When the Internal Table with the header table is created then the work
area is created automatically with the same name as that of the internal table.
 What are the differences between PARAMETERS and SELECT-
OPTIONS?

PARAMETERS SELECT-OPTIONS

It is used to define Check boxes, Radio It is used to define Single & Range input Fields
buttons & single I/P fields.

The ABAP statement TYPE/LIKE is used to The ABAP statement FOR is used.
refer to the Data Types.

The Operator ‘EQ’ or ‘=’ is used in the The operator ‘IN’ is used in the WHERE condition.
WHERE condition.

It is used as an input data variable It is a system generated internal table with the
fields SIGN, OPTION, HIGH & LOW.

 What are the different types of internal tables and explain about
them?
 Internal Tables: -They are the intermediate tables to hold the multiple records at
run time.
 There are 3 types of internal tables.
 STANDARD Internal tables: -The standard Internal Tables are filled using the
ABAP statement 'APPEND'/’INSERT’. It accepts duplicate records. Searching
for a record is Linear Search. It is the default index table. Standard internal
tables can be sorted explicitly.
 Syntax:- DATA:<gt_dbtab> TYPE STANDARD TABLE OF
<typ_dbtab/dbstr.......................... >.
 SORTED Internal table: -The ABAP statement 'INSERT/APPEND' is used to
fill the Sorted Internal Table. It does not accept the Duplicate records.
Searching for a record is Binary Search. Sorted internal tables cannot be sorted
explicitly. An additional statement with the UNIQUE/NON-UNIQUE key must
be used to declare Sorted Internal Tables.
 Syntax:-DATA: <gt_dbtab> TYPE SORTED TABLE OF
<dbtab/dbstr............... > WITH
UNIQUE/NON-UNIQUE KEY <k-f1><k-f2>.
 HASHED Internal tables: - They are Non Index tables. The Hashed Internal
Tables hold a larger amount of data than Standard & Sorted internal tables
since they follow a ‘Hashed Algorithm’. The ABAP statement ‘WITHUNIQUE
KEY' must be used to declare Hashed Internal Tables.
 It holds a larger amount of data (2 GB) than standard & sorted internal
tables.
 Syntax:-DATA :< gt_dbtab> TYPE HASHED TABLE OF
<dbtab/dbstr............ > WITH
UNIQUE KEY <k-f1><k-f2>.
 Can we sort the internal table without using a SORT statement?
Explain?
 We can sort the internal table without using a SORT statement by declaring a
sorted internal table. Ex: DATA: IT_MARA TYPE SORTED TABLE OF MARA.
 Explain a few of the additions to PARAMETERS and SELECT-
OPTIONS statements.
 PARAMETERS
 Obligatory: It is the keyword to make the input field as mandatory
 Default: It is the keyword to pass the default values to the input fields.
 As checkbox: It is the keyword to define the checkboxes in the selection screen
 Radio button group: It is the keyword to define the radio buttons in the selection
screen
 As list box: It is used to define the dropdown list in the selection screen
 MATCHCODE OBJECT: It is used to specify DDIC search help to the input
fields
 MODIFIED: It is used to assign all the screen elements to the modification
group to format the Selection fields dynamically
 LOWER CASE: It is used to make the input fields as case sensitive to accept
both upper & Lower case letters
 Memory ID: It is the keyword to access the field value from one session to
another session
 Additions of SELECT-OPTIONS :
 NO-EXTENSIONS: This addition is used to hide the multiple selection button
in the Selection screen.
 NO-INTERVALS: This addition is used to hide the higher limit of select-options
in the Selection screen.
 DEFAULT…TO: This addition is used to pass the default values to lower &
upper limits
 Differences between Ranges & SELECT-OPTIONS?
 It is used to define range internal tables. It is similar to SELECT-OPTIONS.
 SELECT-OPTIONS are displayed in the selection screen whereas Ranges doesn’t
appear in the selection screen
 Some Keywords?
 Append: It is the keyword used to append record by record from the work area to
the last record of the internal table.
 Syntax: APPEND <gs_dbtab> TO <gt_dbtab>.
 Insert: This statement is used to insert a new record at any position of an internal
table.
 Syntax : INSERT <gs_final> INDEX <n>? SY-TABIX.
 Collect: It is also used like an APPEND statement. This statement is used to
compare character/string fields data & summarizes the numeric field data. It is used
to display subtotals.
 Syntax :COLLECT <gs_source> INTO <gs_collect>.
 Lines: It is the keyword which returns no of records available in the internal table.
 Occurs: It is the keyword; it allocates 8KB of memory for the internal table by
default. If the data in the Internal table exceeds 8KB then it will bring one more 8KB
of memory & so on up to 2GB.
 Clear: It clears the contents of the work area & internal table with header lineITAB[
]& variables.
 Refresh: It clears the contents of the internal table only.
 Free: It clears the contents of the internal table along with allocated memory.
 Explain some of the useful additions of WRITE statements?
 Some of the useful Additions to WRITE statements.
 ....WRITE: /------ >It is used to display the data in a new line.
 ....WRITE: /n (m)-------- >Displays 'm' characters from position 'n'.
 …UNDER OTHER OBJECT----------- >To display the data under the previous
displayed data.
 ....COLOR------ >It is used to display the data in different colors. color codes[0
– 7]
 …LEFT-JUSTIFIED/CENTERED/RIGHT-JUSTIFIED: These are used to
adjust the data at the left hand side, center & right hand side.
 ....AS CHECKBOX--------- >Display the checkboxes in the output.
 ....EDIT MASK------- > It is used to display the mask on confidential data.
 …INPUT: It is used to make the output list as editable.
 ....NO_GAP------ >To remove the gaps in the data.
 …CURRENCY: It is used to specify the currency keys for the currency data
variables.
 ....UNIT----- > It is used to specify the required units while displaying the
quantity data.
 …HOTSPOT : It is used to display the hand symbols on the output data when
the cursor is placed.
 What is the basic Difference between internal tables and
database tables? How can we differentiate by looking at the
tables? And how Handling of Internal Tables?
 The basic Difference is that database tables are Stored in DB Server and the
internal tables are virtual tables that are created at runtime only.
 Explain about the System Fields with which you have worked?

INDEX Index of the loop

DATUM Current system date

UZEIT Current system time

SUBRC Written code of the ABAP keywords

TABIX Index of an internal table

DBCNT The no. of extracted records from the database

BATCH Program is running in background

REPID Current program name


 Explain about String Comparison Operators and Mathematical
Functions?
 String comparison operators: -The below string comparison operators can be used
to compare the string data variables.

Operator

Contains Any (CA)

Contains Not Any (NA)

Contains Only (CO)

Contains Not Only (CN)

Contains Pattern(CP)

Contains No Pattern(NP)

Contains String (CS)

Contains No String(NS)
 CA: This condition becomes true when the source string contains any one of the
characters in the target string.
 NA: This condition becomes true if the string comparison operator CA is false.
 CO: This condition becomes true, when the source string contains only the similar
string in the target string including case.
 CN: This condition becomes true if the string comparison operator CO is false.
 CP: This condition becomes true, when the source string contains the specified
pattern in the target string.
 NP: This condition becomes true in case of Logical expressions with a string
operator CP is false. (Opposite to CP)
 CS:This condition becomes true when the source string contains a similar string in
the target in both Upper & Lower case (not case-sensitive).
 NS: This condition becomes true if the string operator CS is false (Opposite to CS).
 Mathematical Functions: - The below Mathematical operators can be used on the
numbers.

Operator Statement

Equal to EQ

Not Equal to NE

Less Than LT

Greater Than GT

Less Than or Equal To LE

Greater Than or Equal To GE


 Explain about Constants, Text Symbols, Selection Texts and
Variants?
 Constants:-They are used to avoid the hard coded text in the programs and
improve the reusability in the program. The ABAP statement ‘CONSTANTS’ is
used to define constants.
 Text Symbols: - The ABAP Statement TEXT followed by the symbol number (XXX)
can be used to define or call the text symbol.
 Selection texts: - They are used to maintain the Field labels (descriptions) of the
input fields of the selection screen. The T-code SE63 is used to translate the text
elements.
 Variants: - They are used to save the input data for further execution in the
selection screen. They can also be used to avoid the data entry errors & schedule
a program in the background.
 Explain about the useful String Operations?

Operator Description

STRLEN Returns the no of chars/length of the string

CONCATENATE To combine the multiple strings into single target string

REPLACE To replace with one string to another target string


FIND Find the string in the source String

SPLIT Separate the source string into diff strings

CONDENSE It compresses the string without any gaps

MATCH OFFSET It compresses the string without any gaps


 Explain some of the useful additions of Selection-Screen?
 SELECTION-SCREEN: - This statement is used to format the selection screen.
The default screen number for the selection screen is 1000.
 Some of the useful Additions:-
 ......BEGIN OF BLOCK.......... WITH FRAME: - It is used to define the
selection screen blocks with frames.
 .....WITH FRAME TITLE: - An additional TITLE with the selection screen
FRAMES is used to define the TITLES for the selection screen Frames.
 SKIP: - It is used to keep the blank lines in the selection screen.
 ULINE: - To display horizontal lines in the selection screen.
 BEGIN OF LINE: - It is used to define the input fields, radio buttons, push
buttons, checkboxes etc in the same line.
 …PUSH BUTTON: It is used to define the push buttons in the selection
screen.
 …LINE: It is used to define the Input fields, Radio buttons, Check boxes,
Push buttons etc in the same line.
 Explain SELECT FOR ALL ENTRIES in SAP ABAP. What are the
advantages of select for all entries in SAP ABAP
programming?
 SELECT FOR ALL ENTRIES is the best alternative for SELECT WITH JOINS. This
statement is very helpful for reading data from more than two tables. The load on
the database will be very less.
 Points to be noted before using the SELECT FOR ALL ENTRIES Statement.
 The Parent Internal table must not be empty. (If the parent internal table is
empty, where the condition fails it will get all records from the database.)
 Remove all duplicate entries in the Parent Internal Table.
 Explain Select with joins.
 The SELECT WITH JOINS statement is used to read data simultaneously from
multiple database tables. As per performance standards, SELECT with joins from
more than 3 tables is not advisable. As It puts a heavy load on the database.
 SELECT SINGLE and SELECT UPTO 1 ROWS, what is the
difference between SELECT SINGLE and SELECT UPTO 1
ROWS in SAP ABAP?
 These statements are part of reading data from database tables. By using SELECT
SINGLE and SELECT UPTO 1 ROWS. We are able to read a single record from a
database table

SELECT SINGLE SELECT UP TO 1 ROWS

SELECT SINGLE is used to read the SELECT UP TO 1 ROWS is used to read appropriate
exact record from the database table. records from the database table.
To read an exact record from the We can read appropriate records from the database
database table we need to provide all table; we may not need to provide all key fields.
key fields.

This statement should be used only if This statement should be used only if we have some
all the key fields are available. key fields or no key fields.

SELECT SINGLE * FROM SELECT * FROM DATABASETABLE INTO WA UP


DATABASE TABLE INTO WA TO 1 ROWS WHERE ALL KEYFIELDS/ SOME
WHERE ALL KEY FIELDS. KEYFIELDS.
ENDSELECT.

This is very fast when compared to This is slow.


SELECT UPTO.

 Explain SELECT INTO CORRESPONDING FIELDS in SAP


ABAP.
 Select into corresponding fields is used to read data from database tables without
even specifying the list of fields.
 As per SAP standards, SELECT INTO CORRESPONDING is not advisable as it
affects the performance of an application because it has to compare each field with
the database table’s fields which results in consuming more time.
 What is SELECT DISTINCT in SAP ABAP?
 SELECT DISTINCT is used to get distinct (unique) values of a particular column in
SAP ABAP. SELECT DISTINCT eliminates duplicate records of a column of a
table.
 Syntax: - SELECT DISTINCT <COLUMN> FROM <TABLE> INTO TABLE <ITAB>
WHERE <CONDITION>.
 Explain SELECT APPENDING.
 SELECT APPENDING query is used to append the selected query directly to some
internal table. Select for SELECT APPENDING is given as below. Where condition
is optional in a select query.
 What are the differences between Normal Search
(SELECT…ENDSELECT) and Pointer Search (INTO TABLE)?

Normal Search(SELECT...ENDSELECT) Pointer Search(INTO TABLE)

It hits the database table for each record since it is It hits the database table once to
a loop statement extract all the required data since it is a
statement.

The ABAP statement ‘APPEND’ must be used to No need to use ‘APPEND’


append record into a internal table

Sometime It gives you error in runtime while It doesn’t give you any short dump
debugging

Not advisable due to lack of performance & It is advisable since it extracts the data
database load. faster & has good performance.

 What is the difference between SY-INDEX and SY-TABIX?


 SY-TABIX: SY-TABIX is a system variable which stores the index current
processing record of an internal table.So when you are looping over an internal
table, you use SY-TABIX.
 LOOP AT ITAB INTO WA. **SY-TABIX stores the index number of the internal
table record ENDLOOP.
 SY-INDEX: SY-INDEX is a system variable which acts as a loop iteration counter,
it stores the loop iteration number.When you use DO ENDDO / WHILE for looping,
there is no table involved. So you use SY-INDEX.
 Ex: DO 10 times. **SY-INDEX stores the number of iterations of loop ENDDO.
 What are the differences between Classical Reports and ABAP
Queries?

ABAP Queries Classical Report

It is the system provided tool to generate the reports It is a Utility.

It doesn’t require any programming language. It requires the programming language.

It is not possible to change the system generated It can be changed since it is in the
program without having the Access key. Custom namespace ( Z or Y )

Column Alignment is done by the system. It is COMPLEX to Align the Columns.

 What is version management in sap abap.Do we have this


concept in scripts also?If at all then how do you handle scripts
and what's its usage?
 Version is used to differentiate the current active version and previous active
version. If our current active version is wrong we can retrieve the previous version.
 path to version management : Utilities -> versions ->version management.
 You can compare the current version and the previous active version also.
 For Script released versions ... go to T-code SE03 ---> select SEARCH FOR
OBJECTS IN REQUESTS/TASKS.
 Which are the types of messages in SAP ABAP Programming?
 I :- Information Message - The message appears in a dialog box. Once the user
has confirmed the message, the program continues immediately after the
MESSAGE statement.
 E: - Error Message - Depending on the program context, an error dialog appears
or the program terminates.
 S: - Status Message - The program continues normally after the MESSAGE
statement, and the message is displayed in the status bar of the next screen.
 W: - Warning Message - Depending on the program context, an error dialog
appears or the program terminates.
 A: - Termination Message - The message appears in a dialog box, and the
program terminates. When the user has confirmed the message, control returns to
the next-highest area menu.
 X: - Exit Message - No message is displayed, and the program terminates with a
short dump. Program terminations with a short dump normally only occur when a
runtime error occurs. Message type X allows you to force a program termination.
The short dump contains the message ID.

Modularization Techniques
 What are the Modularization techniques which you follow?
 They are used to organize the ABAP code in the proper way , make the program
more Understandable and make use of the code re-usable to avoid the duplicate
data.
 To divide the business processing logic into reusable blocks of statements.
Following are the different types of Modularization techniques:
 INCLUDES: These programs are part of another main/include
programs.Include programs can’t be executed independently whereas the
same include program can be included in any no of executable programs. The
ABAP statement INCLUDE is used to call or define the INCLUDE programs.
 Subroutines: These are local modularization techniques. The subroutines can
be debugged at run time. Calling should be 1 & Definition should be next. The
st

ABAP statement PERFORM is used to call the sub-routines &


FORM…ENDFORM is used to define the sub-routines.
 There are 2 types of subroutines.
 Internal Subroutine: These are defined & called in the same program.
 External Subroutine: These are defined in one program & called in
another program.
 Actual Parameters: The parameters which can be called while calling the
subroutines (with the PERFORM statement).
 Formal Parameters: The parameters which can be passed while defining
the subroutine (with a FORM statement).
 The no of actual parameters should be similar to the no of formal
parameters.
 The sub-routines definitions should not be nested (form within the
form) but the sub-routine can be called within the sub-routine.
 The statements between 2 sub-routines definitions cannot be accessed
 Macros: These are used for complex write statements & for long calculations.
Macros can take up to 9 place holders (&1…. &9). In macros, Definition should
be 1 & Calling should be next. The ABAP statement, DEFINE…END-
st

DEFINITION is used to define a macro. The macro definitions cannot be


debugged at run time. The standard TARMAC pooled table is used to maintain
macros.
 Function Modules: These are global modularization objects. The function
modules can be called anywhere in the same system & in another system. The
function modules are defined in the function builder.
 The T-code SE37 is used to work with the function modules & SE80 is used to
work with the function group. The function modules should be assigned to a
function group & Function group is the collection of function modules.
 The standard table ‘TFDIR’ is used to find FMs since it contains the entire
Function module in the system.
 Normal Function Module: These are defined & called in the same system
to reuse the central source code.
 Remote Function Module: These are defined in one system & can be called
another system.
 Update Function Module: This is used for SAP LUW (Logic Unit of Work).
These function modules are triggered when implicit or explicit COMMIT
work is encountered. Commit Work is used to make changes in the
database permanently.
 Message class: This tool is used to maintain the Messages in the message
pool. They are used to give messages for instructing the users.
 The standard T-Code SE91 is used to work with the message pool.
 Different types of messages are Error, Success, Warning, Information,
Abort, Exit.
 Text symbols & Constants: The ABAP Statement TEXT followed by the symbol
number (XXX) can be used to define or call the text symbol. Constants are
used to avoid the hard coded text and improve the reuse of them in the
program.
 The T-code SE63 is used to translate the different types of text elements.

 What are the differences between Subroutines and Function


Modules?

Subroutines Function Modules

These are local. We can access the These are global. We can access the function module
Subroutines within the server only. within the server as well as outside the server.

We can’t execute the subroutine We can execute function modules independently using
independently. T-Code SE37.

Subroutines can’t handle the exceptions. The Function Module can handle the errors through
exceptions.
 What are the differences between Macro & subroutine?

MACRO SUBROUTINE

Definition & Calling in the same program. Definition & Calling may / may not be in the same
program.

Definition should be 1st & Calling should be Calling should be 1st & Definition should be next.
next.

Macros can take upto 9 inputs. Subroutines can take any number of inputs.

Macros can not be debugged. Subroutines can be debugged at runtime.


 What are the different parameters in Function Modules and
Explain about them?
 Following are the different types of Parameters in Function Modules
 Attributes:
 It contains technical properties of a function module such as type of function
module, function group.
 Import parameters:
 They are imported from the calling program to the function module.
 Export parameters:
 These are used to export the data from the function module to the calling
programs.
 Changing parameters:
 These are imported from the calling program, changed in the function
modules & exported/returned to the calling program. (Import -> Change ->
Export)
 Tables:
 These can be used to import & export only for internal tables.
 Exceptions:
 They are used to raise/handle the messages in the function module based
on return code (SY-SUBRC).
 Source code:It is used to write central ABAP source code.
 Explain about different methods to pass the parameters to
subroutines?

Method Description Effect

By It is the default method. The pointer uses the same The Actual parameters
Reference memory allocation for both actual & formal are changed with the
parameters. From Calling to definition & definition formal parameters.
to calling, all parameter values are passing along
with the memory

By Value The system allocates new memory. The allocated The Actual parameters
memory is freedonce the subroutine ends. From are not changed with
calling to definition & definition to calling, the the formal parameters.
parameter values only pass.

By Value It is almost similar to by value but the only The Actual parameters
and Return difference is the formal parameter values are are changed with the
returned to Actual Parameters. formal parameters.

DEBUGGER
 Explain about Debugger, Breakpoints and Watchpoints?
 Debugger :- This tool is used to check the program line by line & block by block for
finding and rectifying errors or bugs.
 Break Points:- These are Statement based. They are used to stop the program in
the debugger tool for checking line by line or block by block.
 Breakpoints are of 4 types. We can place up to 30 break points in the program.
 Session BreakPoint: An icon set/delete breakpoint icon or click on a
statement line at gray color vertical selection in the source code.
 Static BreakPoint: The ABAP statement BREAK-POINT/BREAK
<user_name> is used to set the Static break point. In real time, the ABAP
statement BREAK-POINT should not be used since all the users are
stopped.
 Dynamic Breakpoint: They are used to check the program in case of not
being able to find a location. The command /H is used to set dynamic
breakpoints. The program is stopped at the first statement line of the
performed action.
 External Breakpoint: They are used to check the cross-application
components such as RFC, BAPI from one system to another. An icon set
or delete external break-points is used to set or delete external breakpoints.
 Watch Points: - These are Condition based. They are used to stop the program
once the set condition is reached. The Watch points can be set inside the debugger
tool. We can place up to 9 watch points in the program. We can reduce debugging
time using watchpoints.
 Differences between Classical & New debugger?

Classical Debugger New Debugger

It is an old debugger. It is introduced from ECC 5.0

It is in the same session to check & resolve It runs in a separate session.


the issues in the program.

It has lots of limitations such as different It is a very efficient tool to check lots of actions
desktops are not there, no separate such as different desktops, separate actions for
sections for local, global variables etc. local & global Variables & objects at a time.
 Single Step F5: The function key F5 is used to check Line By Line of the program.
 Execute F6: The function key F6 is used to check Block By Block of the program.
 Return F7: The function key F7 is used to Return from the source code of the
process blocks such as subroutines, function modules, methods etc.
 Continue F8: The function key F8 is used to jump from one breakpoint into the next
break point then execute once the last break point is reached & then execute.
 How to debug Background Jobs?
 The Background jobs can be debugged using the command ‘JDBG’.
 Execute the T-code SM37
 Check the required background job to be debugged.
 Enter JDBG in the Command field & Press Enter
 Keep on pressing F7 until the required program is stopped.
 Use the Function keys F5/F6/F7 to check the program Line by line/Block by
Block once it is reached.
 What are the steps to debug the Pop-up window?
 Create a text file with the required statements & save it on Local PC/Desktop.
[FUNCTION]
 COMMAND = ‘/H’
 Title = ‘Debugger’
 Type = ‘System Command’
 Minimize the SAP Pop-up window screen to appear in both Text file & Pop-up
window screen.
 Drag & drop the saved text file into the Pop-up window screen.
 Note: The system gives the success message as Debugging Switched ON.
 Perform the required action to stop the corresponding program (Yes button).
 What are the types of execution modes?
 There are 2 types of executionmode to execute a program or the transaction
codes.
 Foreground: It is used to execute the programs or the transaction codes directly by
pressing the execute icon or F8 function key. It requires user interaction.
 Background: This execution mode is used to execute the programs or the
transaction codes periodically such as Hourly, Daily, Weekly, Monthly etc in
background. It doesn’t require any user interaction. The variants must be created
before the programs are scheduled in the background.
 The T-code SM36 is used to define the background jobs &
 The T-code SM37 is used to check the status of the background jobs.
 The standard function modules
 JOB_OPEN ->To open background job
 JOB_SUBMIT ->To submit job in background
 JOB_CLOSE ->To close scheduled jobs.

REPORTS EVENTS
 What are the Selection-Screen events, explain?
 AT SELECTION-SCREEN -> This event is triggered after providing Input to the
selection screen.
 AT SELECTION-SCREEN OUTPUT ->This event is triggered while performing any
action in the selection screen. It is used to modify (format) the selection screen.
 AT SELECTION-SCREEN ON -> This event is triggered after input values provided
in the selection screen. It is used to validate/check the input data of the selection
screen.
 AT SELECTION-SCREEN ON VALUE REQUEST FOR ->This event is triggered
when the user clicks on the F4 button. The standard function module
F4_INT_TABLE_VALUE_REQUEST can be used to display the possible entries
as search help.
 The function module DYNP_VALUES _READ is used to capture the selection
field values in the same selection screen for Dynamic search help.
 At selection -screen ON HELP-REQUEST FOR ->This event is triggered when the
user clicks on the F1 button .The standard function module
‘HELP_OBJECT_SHOW’ can be used to provide the Help document to the input
variable. The T-code SE61/SO72 is used to maintain the Help documentation as
per the specification.
 Explain about the Parallel Cursor Method?
 This Method is used for better Performance in case of the nested loops (Loop within
the loop).
 Steps to use this Method:-
 Read the 2nd internal table (Item table) within the loop of the Base/Main internal
table (gt_header) with the required keys and get the index of the current record.
 Set the loop to the 2nd internal table (ITEM internal table) to process the data
from the SET INDEX and use the EXIT statement to come out of this 2nd loop
for the unmatched data.
 How many Times the Event INITIALIZATION Triggers while
displaying the list of 20 pages and also TOP-OF-PAGE?
 INITIALIZATION Triggers Only One time and TOP-OF-PAGE triggers 20 times.
 What is the prerequisite to use “FOR ALL ENTRIES”?
 The Base internal table which can be used in the 'FOR ALL ENTRIES' statement
must be checked whether it has data or not.
 What are Joins & types of Joins?
 Joins are used to fetch the data from more than one table.
 Inner join: This statement is used to extract the data from the multiple tables by
joining them. Up to 2 tables can only be joined.
 For all entries:This statement is used to extract the data from the database
table based on the entries of the Base internal table.
 Explain about Loop termination statements?
 The following statements are used to come out of the loops and continue with the
next loop statements.
 EXIT: - This statement is used to come out of the loop statement and continue
with the next statement line outside of the loop statements in the program.
 STOP: - This statement is used to stop the Loop process along with the next
part of the loop statement.
 RETURN: - RETURN is a statement which is used to stop processing of the
current block immediately.
 CONTINUE: - This statement is used to stop the current loop process and
continue with the next loop process.
 CHECK: - This statement is used to check the specified conditions and
continue with the next loop process.
 CHECK = CONDITION + CONTINUE.
 Explain about the events associated with Classical Reports?
 Following are the EVENTS associated with the Classical Reports .
 LOAD-OF-PROGRAM: This event triggers at the time of loading the program
into a memory.
 INITIALIZATION: This event is triggered before the selection screen is
displayed. It is used to clear & refresh the data variables and used to pass the
default values to the selection fields.
 AT SELECTION-SCREEN: This event is triggered after providing the input in
the selection screen.
 START-OF-SELECTION:It is the default event & mandatory to execute any
executable program. It is used to fetch the data from the DB. If no event is used
in the executable program, the entire program will be triggered under Start-Of-
Selection.
 END-OF-SELECTION: This event is triggered after the Start-Of-Selection
event is processed. It is used to specify the data process statements.
 TOP-OF-PAGE: This event is triggered with the first ULINE/WRITE/SKIP/NEW
PAGE statement in the START_OF-SELECTION event in the program. It is
used to display the column headings.
 END-OF-PAGE: This event is triggered at the end of each page. It is used to
display the footer details of a page such as totals etc..The report addition LINE-
COUNT must be specified to trigger this event.
 Which is the default event?
 The default event is START-OF-SELECTION .If no event is used in the executable
program, the entire program will be triggered by Start-Of-Selection. The main
program begins with this event.
 Is it possible to display the previous drill down list from the
current one? Ex: If I suppose I am in the 10th drill down list. Is
it possible to display the 5th drill down list from the current
list?I have 1 basic list and 15 secondary lists in the interactive
report. If I am in the 9th list, how can I come directly to the basic
list?
 Yes. By re-setting list index = 5. i.e; SY-LSIND = 5.
 System variable SY-LSIND stores the list number, by using this we can go to the
basic list.
 In an interactive report if a user 19 times double clicked, again
he wants to see the main screen.How can do this?
 If Sy-ucomm ='BACK'.
 Leave to screen 0.
 Endif.
 What are the events associated with Interactive Reports?
 Following are the EVENTS associated with the Interactive Reports .
 AT LINE-SELECTION: This event is triggered at the time a user clicks on any
record of any list. It is used to provide a detailed list based on the current list.
The system field SY-LSIND holds the Index of the next drill down list.
 AT USER-COMMAND: This event is triggered at the time a user clicks on any
menu item. This event is used to provide additional functionality based on the
selected push button.
 TOP-OF-PAGE DURING LINE-SELECTION: This event is triggered with the
first WRITE/ULINE/SKIP of the drill down list. It is used to provide the column
headings for the drill-down list.
 AT PF: This event is triggered when the function key is pressed. This event is
used to provide additional functionality based on the selected menu item.
 SET PF-STATUS: This event is triggered at the time of attaching our own GUI
to the list. It is used to call the menu status.
 Up to 35 Push buttons can be created on the Application tool bar.
 What are the differences between Classical & Interactive
reports?
 Classical reports are used to display the entire information in a single/ basic list.
 Interactive Reports are used to display the summarized information in the basic list
& detailed information in the next drill down list. Up to 20 secondary lists are
provided & the total no of lists are 21.
 Which techniques were used to identify the record which was
clicked by the user in the previous list?
 Ans: HIDE & GET-CURSOR
 HIDE: This statement is used to hide the selected field value which can be
passed to the corresponding drill down list to filter the unwanted records. It is
used to capture the selected field values to the next drill-down list. Hide
statement provides Single drill-down list.
 GET-CURSOR: This statement is used to capture the selected field values &
field names based on the cursor position. This statement provides multiple
down lists.
 What are the System Fields associated with Interactive
Reports?
 System fields associated with Interactive reports .

FIELD DESCRIPTION
NAME

LSIND Index of the next drill down - contents of the current list Index no

LISEL Selected list line value-contents of the selected record

LILLI Selected list line number – contains the exact line no of the selected
record

UCOMM Fun. Code of the selected push button/Menu item

PFKey Function Key


 What are the Control Break Statements, explain about them?
 Control Break statements: - They are used to control the data flow of an internal
table.
 The Control break statements start with AT and end with ENDAT.
 These statements should be used within the LOOP statements only
 Following are the different types of Control break statements.
 AT FIRST: - This event is triggered at the first record of an internal table. This is
used to display the Header information.
 AT NEW: - This event is triggered at the first record of each block. This is used to
display the individual headings.
 AT END OF: - This event is triggered at the last record of each block. This is used
to display the total/subtotals in the internal table.
 AT LAST: - This event is triggered at the last record of an internal table.
 ON CHANGE OF: - It is a special control break statement which can be used
outside of the loop statement also.
 It is almost similar to the AT NEW statement but it doesn't consider the
preceding fields.
 It can be used on multiple fields using SET operators (AND, OR, BETWEEN).

 What is the difference between AT NEW and ON CHANGE OF?


AT NEW ON CHANGE OF

They must be used within the loop It can be used within the loop statement outside
statements. of the loop statements also

It considers preceding fields also It doesn't consider

It can’t be used on more than one field using It can be used on multiple fields using the SET
the SET operator ‘OR’. operator ‘OR’.

The work area is impacted by replacing It doesn’t impact the Work Area.
with Asterisk (*******)marks

 What are the differences between SELECT SINGLE and UPTO


1 ROWS?

SELECT SINGLE UPTO 1 ROWS

It extracts single record from the It extracts all the records into a buffer and moves the first
database table record into an application program

It doesn’t require an END SELECT It requires END SELECT


statement

Use this one, in case all key fields Use this one, in case it is not possible to use all the key
can be considered fields

It is slower It is faster

 What are the differences between Normal Reports and ALV


Reports?

Classical reports ALV Reports

Simple reports using the WRITE statements The system generated Functions start with
within the loops. REUSE* are used to display the data.

Performance is not as good as ALV Reports Performance is good since the data is
since the LOOP statement must be used to displayed using the function modules outside
display the data of the loops.

It is not possible to edit the Fields in the Output. It can be possible to edit the Fields in the
Output.

It is difficult to display the LOGOS in the It is so EASY to display the LOGOS in the
output. output

It is COMPLEX to Align the Columns Column Alignment is done by the system


 What are Conversion Routines?
 The conversion routines are the function modules used to convert the data from
internal format to an external format & external format to internal format.
 The conversion routines are maintained at the Domain level of a field.
 How to make the field editable in ALV Grid?
 By passing the field name EDIT = ‘X’ & SAP-EDIT = ‘X’ to the Slis_Fieldcat_Alv.
 What are the events associated with ALV Reports?
 There are 17 events in ALV Reports .
 Following are some of the most useful events.
 TOP_OF_PAGE:It is an event which is triggered at the top of each page.
This event is used to display the list headings & Logos.
 PF_STATUS_SET: This event is triggered at the time of attaching our own
GUI to the program. This event is used to call the menu status for adding
menu items & push buttons.
 USER_COMMAND:It is an event which is triggered at the time a user clicks
on any record of any list as well as clicks on any menu item.This event is
used to provide an interactive functionality based on the selected
record/push button/ menu item in ALV reports.
 END_OF_LIST: It is used to display the Footer details in ALV reports.
 What are the Function Modules associated with ALV Reports?
 The standard ALV display Function module 'REUSE_ALV_LIST_DISPLAY' is used
to display the populated final internal table data in ALV LIST format.
 The Field values cannot be edited in case of ALV List format.
 Logos/Images cannot be displayed in ALV List format.
 The standard ALV display Function module 'REUSE_ALV_GRID_DISPLAY' is
used to display the populated final internal table data in ALV GRID format.
 The Field values can be edited in case of ALV GRID format.
 Logos/Images can be displayed in ALV GRID format.
 The Blocked ALV’s are used to display the data from the multiple internal tables as
separate blocks in the output.
 The standard ALV display Function module 'REUSE_ALV_BLOCK_LIST_INIT'
is used to initialize the different blocks in the output.
 'REUSE_ALV_BLOCK_LIST_APPEND' is used to append the internal tables
as separate blocks.
 'REUSE_ALV_BLOCK_LIST_DISPLAY’ is used to display the appended
blocks in the output.
 The standard ALV display Function module
'REUSE_ALV_HIERSEQ_LIST_DISPLAY' is used to display the Header &
corresponding item details in HIERARCHICAL manner.
 What are the ways to populate a Field Catalog and which one
do you prefer?
 There are two ways to populate the FIELD CATALOG .
 Using ALV Function Module 'REUSE_ALV_FIELDCATALOG_MERGE' // Not
Advisable
 Manual Population // Advisable
 Steps to Populate Field Catalog Using the Function Module:
 Define Data dictionary structure/Internal table with the required fields.
 Call the ALV function module ‘REUSE_ALV_FIELDCATALOG_MERGE’ to
populate the field catalog from the DDIC structure/Internal table.
 Modify the specified field catalog internal table ‘GT_FCAT’ as per the
specification if required.
 Pass the filled field catalog internal table to the Export parameter
‘IT_FIELDCAT’ of the ALV Display function modules.
 Steps to Insert Border Line for 72 Characters:
 Once the program is in change mode,
 Click on Utilities -> Settings -> Check the check box “Downwards-
compatible Line Length(72).
 Click on the Yes button.
 One red colored vertical border line is inserted at 72 characters position.
 Steps to Populate Field Catalog Manually:
 Populate Field Catalog Internal table with the required field values.
 Pass the populated Field Catalog Internal table to an export parameter of
the ALVṣ display function module.
 Is it possible to develop the ALV reports without populating or
using any FIELD CATALOG?
 Yes, We can develop.
 Create a DDIC structure with the required fields.
 Extract the required data from the database tables based on the given input.
 Populate the Final internal tables.
 Use the function module either ‘REUSE_ALV_GRID_DISPLAY’ or
‘REUSE_ALV_LIST_DISPLAY’ to display final data by exporting the DDIC
structure name & the Final internal table.
 What are the different ways to populate events in the ALV
report?
 Manual Population:
 Populate an internal table of the type ‘slis_t_event’ with the required events &
corresponding dynamic sub-routine.
 Define the dynamic sub-routine of an event with the required functionality.
 Pass the populated events internal table to the Export, Import parameters of an
ALV display function module ‘it_event’.
 By using the ALV function module – REUSE_ALV_EVENT_GET:
 It is not advisable since it extracts all the events & a loop is required.
 The dynamic sub-routine for each event can be populated within the loop of the
event internal table.
 Pass the populate event internal table to an export parameter.
 The call back export parameter can also be used to specify the dynamic subroutine
name of ALV events in the ALV display function module.
 Explain the steps to provide headings and logos in ALV
reports? (Or) Steps to work with an ALV event TOP_OF_PAGE?
 Use an ALV event ‘TOP_OF_PAGE’ with the corresponding dynamic subroutine
name into an internal table
 Populate the required header data into an internal table of the type
(slis_t_list_header) inbetween the definition of dynamic subroutine.
 Use the ALV Function module ‘REUSE_ALV_COMMENTARY_WRITE’ to display
the Populated header and Logos.
 How to provide custom Function (Push) Button Along with
System generated Functions in ALV? (Or) How to add push
buttons to ALV? (Or) Steps to work with PF STATUS SET in
ALV?
 Copy the system-provided generic functions/push buttons from the standard
program ‘SAP SALVi&thestatus:STANDARDin custom program &menu status
using SE41.
 Add additional customer specific ‘push buttons’ to the copied menu status.
 Use an ALV event ‘PF_STATUS_SET’ & call the copied menu status within the
dynamic subroutine of PF_STATUS_SET.
 Call the copied menu status using the ABAP statement ‘SET_PF_STATUS’.

 How to handle Interactive Functionality?


 Interactive functionality can be provided within the dynamic sub-routine of an ALV
Event USER_COMMAND.
 Provide interactive functionality such as to display another ALV drill down
report/call another program when the push buttons are selected.
 The function code for the double click in ALV reports is ‘&IC1’ and in Interactive
classical reports in ‘PICK’.
 How to capture selected rows in ALV output (or) What are the
steps to get selected rows in the next drill down list in ALV (or)
Interactive functionality based on the selected rows?
 Add a Single Character field to the Layout.
 Pass the BOX single character field name to the layout.
 Pass populated Layout to ALV display function modules.
 Copy the final internal table into the temporary internal table.
 Delete non-selected entries from a temporary internal table.
 What are the steps to display each row in different colors in the
ALV report?
 Add 4 Character fields to the final internal table from which the data should be
displayed.
 Populate color code dynamically.
 Pass the color code field name to the field ‘info_fieldname’ of the layout.
 How to display Traffic lights in ALV Report?
 Add 4 character fields to the final internal table.
 Populate traffic lights based on the status.
 Populate Field Catalog with traffic lights field name.
 Explain about some of the useful types with which you have
worked in the SLIS Type Group.

Field Name Description

Tab Name Final Internal Name

Tab Index Index no. of the selected record in the final internal table

Value Selected field value

Field name Field name of a selected row


 Explain some useful types in the type group ‘SLIS’?
 SLIS_T_FIELDCAT_ALV: It is used to format the columns in ALV reports such as
Populate column headings, Edit the columns, and Display hand symbols.
 SLIS_LAYOUT_ALV: It is used to format the entire layout in ALV reports such as
display data in different colors. Instead of a format statement we use layout.
 SLIS_T_EVENT: It is used to populate an ALV event.
 SLIS_T_LIST_HEADER: It is used to display the List Headings & Logos in ALV.
 SLIS_T_EXTAB: It is used to populate the function codes of the push buttons to
be hidden in ALV report/output.
 SLIS_T_SELFIELD: It is used to capture the selected row/line value in ALV.
 SLIS_KEYINFO_ALV: It is used to populate the key field’s information to display
Header & the corresponding Item data in Hierarchical ALV.
 SLIS_T_SORT_INFO: It is used to provide sub totals & grand totals in ALV reports.
 What are the types of Memories, explain about them?
 The Memory concept is used to access the data across the internal or External
Sessions.
 There are 2 types of memories.
 SAP Memory: - It is used to access the data from one session to another
session through Parameter ID or Memory ID.
 The ABAP statements SET PARAMETER ID and GET PARAMETER ID
are used to work with the SAP memory.
 SET PARAMETER ID is used to pass the field value from an application
program into the specified SAP Memory ID or Parameter ID.
 GET PARAMETER ID is used to get the data from the specified memory ID
or Parameter ID into the field of an application program.
 The Parameter IDs are maintained at the Data Element level under Further
Characteristics.
 ABAP memory: - It is used to access the data across internal sessions. The
ABAP statements IMPORT & EXPORT are used to work with the ABAP
Memory.
 The IMPORT statement is used to import the data from the specified
memory ID into a data variable.
 The EXPORT statement is used to export the data into the specified
memory ID from the program.
 Can we place More than one selection screen Element in one
line? If Yes, How?
 Yes.
 SELECTION-SCREEN BEGIN OF LINE.
 * List of PARAMETERS.
 SELECTION-SCREEN END OF LINE.
 How to place the PUSH buttons (Function keys) on Selection
Screens?
 Requirement:
 Three buttons display, change, and create to be created along with their respective
icons on the selection screen.
 Steps to be followed:
 Step1: Create a program in SE38 with some meaningful description.


 Step2: Create a selection screen with two or three fields.


 Write the below code in the program after the above selection screen
statement.

 Write the below code in the program in the Initialization event.


 Execute the report and you will see three push buttons on the selection screen
as below.


 Now to handle the buttons in the program, first we need to create a custom GUI
status copied from the standard GUI as below

 RSSYSTDB& %_00 refer to the standard GUI status.


 Now we need to add the function codes for the above three buttons created on
the selection screen.
 FC01, FC02 and FC03 refer to the three buttons which we have activated
above.
 Here we will add the function codes for the three buttons. These function codes
will be captured in the system variable SY-UCOMM field and this can be used
in the program logic.
 Function code ‘DISP’ is used here for the first push button (FC01), similarly
‘CHAN’ and ‘CREA’ for second and third push buttons respectively.

 After entering the function codes for all the push buttons activateṣ the pf-status.
Now come back to the program and write the below code in the
 AT SELECTION SCREEN OUTPUT event.


 Now execute the program and you can find the selection screen below.


 Summary: In this way we create buttons along with the icons on the
selection screen.

Module Pool Programming/Screen Painter


 This concept is used to maintain different types of screens & corresponding
flow logic.
 This concept contains mainly 2 parts.
 Module pool program
 Screen painter
 What is the Screen Painter (Layout) and explain the different
components in screen painter?
 Screen painter: -
 It is a tool used to maintain different types of screens.
 The T-code SE51 is used to work with screen painters.
 Normal screen:
 The normal/main screens which can be called through transaction
codes/using ABAP statement ‘CALL SCREEN’.
 Sub screen:
 The sub screens are part of main screens (normal)
 The sub screen can’t be executed independently
 The flow logic ABAP statement ‘CALL SUBSCREEN’ is used to call the
sub screen areas in the normal screens
 The push buttons/menu status is not possible on the sub screen
 It is not possible to call a subscreen within the sub screen
 Modal dialog screen:
 It is used to populate/display the data on a pop dialog box with some
generic functions ( To display icons at bottom)
 Selection screen:
 The selection screen is reserved for Reports/Executable programs.
 The screen number 1000 is reserved for the selectionṣ screen.
 Different Components/Elements :-
 Attributes: It contains the technical details of the screen such as type of the
screen, next screen number, package etc.
 Element List: It contains the screen elements, attributes & properties of the
screen elements in the normal screen & sub screen & attributes such are
general attributes, texts or input output templates, special attributes, display
attributes, modification groups.
 Make an input list as a drop down list by selecting, option under the tab
input/output.
 This component is used to make the screen elements visible, invisible,
change the dimensions etc.
 The modification groups which can be used to format the screen
dynamically are specified by using modification groups.
 Flow Logic:
 This component is used to provide the link between the module pool
program & screens.
 It can also be used to control the data flow between the screens
 Screen related ABAP statements such as modules, MODULE, CALL
SUBSCREEN, CHAIN etc. statements can be used in flow logic.
 Layout: It is used to design the screens with different screen elements
 Text fields: To define the text fields for screen field labels on the screen.
 Input/output field: It is used to define input/output fields on the screen.
 Checkbox: To define the check box on the screen.
 Push button: It is used to define the push button on the screen.
 Tab strip control: It is used to define the tab strip control to work with the
different sub areas on the screen.
 Tab strip (with wizard): it is used to define the tab strip control using the
wizard.
 Subscreen area: It is used to define the sub screen areas on the main
screen/on the tab strip control.
 Table control: It is used to define the table controls to maintain multiple line
items or records on the screen.
 Table control with wizard: It is used to define the table controls using
wizards.
 Custom control: It is used to define the custom controls in the screens.
 Status icon: It is used to define the status icons on the screen.
 Box: it is used to define the boxes around screen elements in the screens.
 What are the Screen painter attributes?
 They are used to maintain different attributes/settings of a screen element such as
function code, function type, drop down list etc.
 Drop down: There are 2 types of drop down options
 List Box: To list out only the values.
 List box with key: To list out the values with corresponding keys when the
drop down icon is pressed
 There must be foreign key relationship between value & text fields of a text table.
 Groups: They are used to specify the radio button group name or modification
group name.
 FCT code: Function code of push buttons or menu items.
 Dictionary Attributes:
 It is used to maintain the attributes of the data dictionary objects such as
table or structure fields.
 Some of the data dictionary objects are: date format, search help,
conversion exit etc.
 Program Attributes:
 It is used to maintain the different attributes of input or output fields.
 Required: To make the screen input field as mandatory
 Possible: It is the default icon to accept the input values at run time.
 Not possible: In case of this option, input is not possible but the field
can be used as an output field.
 Recommended: To make the input field optional. The symbol question
mark appears in the input or output field.
 Check the checkbox output only to restrict the input data.
 Display Attributes:To maintain different attributes such as invisible, output
styles, 2D display etc.
 What is the difference between a Flow Logic and a Module Pool
program?
 Flow Logic is used to define the Flow Logic of the screen elements. The modules
are used to communicate with the Module Pool Program.
 The Module Pool Program is used to define the modules of the Flow Logic in
screens. The T-code SE38/SE80 is used to develop & create the M.P.P.
 It can have 4 Include programs such are *TOP, *F01, *I01, *O01.
 What are the systems generated in the Include programs in the
Module Pool program?
 There are 4 Include programs in module pool programs.
 TOP Include: It is used to declare global data declarations which can be
accessed across the screens.
 F01 Include: It is used to define the FORMS (Subroutines) which can be used
in module definitions.
 O01 Include: It is used to define the PBO (Process Before Output) modules.
 I01 Include: It is used to define the PAI (Process After Input) modules.
 The module pool name 7 screen program name must be similar.
 What are the events associated with Screen Painter?
 The below events are used in the MPP.
 PROCESS BEFORE OUTPUT (PBO):
 This event is triggered before the screen is displayed.
 It can also be triggered while performing any action on the screen.
 This is used to provide the default values to the screen fields.
 It can also be used to format the screen elements dynamically.
 PROCESS AFTER INPUT (PAI):
 This event is triggered after the Input values are provided to the screen.
 This event is used to validate the input data on the screens.
 It can also be used to process the screen data based on the performed
action (pressed push button menu item etc)
 PROCESS ON HELP-REQUEST (POH):
 This event is triggered when the function key F1 or help icon (?) is pressed.
 This event is used to provide help documentation on the screen fields.
 The T-code: SE61/SO72 is used to maintain help documentation.
 The standard function module ‘HELP_OBJECT_SHOW’ is used to display
the maintenance help documentation.
 PROCESS ON VALUE-REQUEST (POV):
 This event is triggered in case the function key F4 or search help icon is
pressed.
 This event is used to populate & display the custom search help on screen
input fields.
 The standard function module “F4IF_INT_TABLE_VALUE_REQUEST” is
used to display the populated internal table data as search help.
 What are the steps to provide Search Help?
 Use an Event PROCESS ON VALUE-REQUEST.
 Specify or define the Module on the required Screen Field.
 Use the Standard Fn. Module F4IF_INT_TABLE_VALUE_REQUEST to display
the Populated data in the search help Window.
 What are the steps to provide Help Documentation?
 Use the Flow logic event ‘PROCESS ON HELP-REQUEST’.
 Specify the module name on the particular screen field.
 Use the standard function module HELP_OBJECT_SHOW (with technical
description) or DSYS_SHOW_FOR_F1HELP (without technical description) to
display the maintained Help Documentation.
 What are the different ways to execute the Screens?
 There are 2 ways to execute the screens.
 Using the T code: The screens can be executed through the T codes to which
the Module pool program & the screen no. is assigned.
 Using an Executable program: The screens can be called & defined using the
Statement ‘CALL SCREEN’. CALL SCREEN is used to call the specified screen
number.
 How to validate/check the fields (screen) in the Module Pool
program?
 Use an event Process After Input to validate the Input//screen field values.
 Once the Flow logic is in Change mode, define the module with the field statement
between the CHAIN…ENDCHAIN screen statement.
 Fetch the data from the database & give the proper message if data doesn’t exist.
 The statement CHAIN….ENDCHAIN is used to make all the screen input fields
enabled to enter input data.
 The screen validations without CHAIN….ENDCHAIN statements make the screen
input fields grayed out (display mode).
 How to make the screen field mandatory in Screen painter?
 In screen painter double click the screen field Go to ATTRIBUTES->PROGRAM
 There select input as REQUIRED
 Required: To make the screen input fields mandatory.
 How to make the Screen fields invisible based on certain
conditions dynamically and which Event should be used?
 The event AT SELECTION SCREEN OUTPUT is used to format the selection
screen dynamically by setting a loop to the screen table (field Active can be used
to Hide/Appear the screen).
 Module screen flow statements?
 This statement is used in flow logic to call the defined process module pool
programs. Syntax: [FIELD<screen-field>]MODULE<module-name>.
 Additions:
 ….AT EXIT-COMMAND: This command is used to trigger the dialogue module
when a push button or menu item with the function type ‘E’ exit is pressed.
 …AT CURSOR-SELECTION: This addition is used to trigger the corresponding
module when the cursor is placed on the input field of a screen. It can also be
used to trigger the corresponding module when a push button or menu item
with f-type ‘S’ (system) or CS (cursor selection) is pressed.
 CHAIN…ENDCHAIN:This statement is used in flow logic to define the process
chains. It can be used to make all the screen input fields enabled to enter input
data.
 Useful additions to CHAIN…ENDCHAIN statement:
 MODULE ON CHAIN-REQUEST: The module with ON CHAIN-REQUEST is
used to trigger the corresponding module on the specified screen fields (in the
sequence).
 MODULE ON CHAIN INPUT: The module ON CHAIN INPUT is used to check
the individual conditions of the screen fields in the sequence.
 What are the steps to work with Tab Strip Control?
 It is a set of pages & used to place different sub screens of applications on a single
screen.
 Each tab page contains the title & its page area.
 Create tab strip control with title on Main screen.
 Assign the subscreen area to the corresponding tab.
 Make the necessary code changes in flow logic.
 Write processing logic in the Module Pool Program.
 What are the steps to work with Table Control?
 It is used to maintain multiple entries in tabular format. Multiple rows are processed
using Loop with control.
 Define or declare tab strip control in the Module Pool program.
 Define or create Table control on screen by filling all necessary fields.
 Make necessary code changes in flow logic & write process logic in MPP.

SAP SCRIPTS
 What are the Components of SAP Script (Form Painter/Layout
set)?
 SAP Script form contains 2 parts.
 Form painter (Layout Set) 2. Print Program
 Header: It is used to maintain the Administrative & basic settings data.
 Administrative data:
 It contains the technical details such as Package name, Changed by,
Created by etc..
 Basic data:
 It is used to maintain the default settings which can be applied across
the forms.
 TheBasic settings are page format, orientation, font size etc.
 The first page & the default paragraph names must be specified once
they are created.
 Pages:
 They are the rectangular format of the documents.
 This element is used to maintain the next page, print mode, page counter
mode etc.
 Windows:
 They are the small components on the pages.
 We can place the same window in any number of pages.
 The windows are not positioned on the pages unless they are assigned to
the pages.
 Page window:
 They are used to position the window on the pages.
 Different position attributes, Left margin, upper margin, Window width,
Height are maintained. It is used to place the window on the page with
coordinates.
 Paragraph format:
 They are used to print/format the entire paragraph with a required format &
style.
 Standard Attributes: It is used to maintain the standard attributes such as
alignment, line spacing, left margin, right margin etc.
 Font Attributes: They are used to maintain the font setting such as font
family, font size, bold, italic etc.
 Character format:
 They are used to print/format the particular text/string with the required font
& style.
 They can also be used to select the Bar codes.
 Standard Attributes:It is used to select barcodes, superscript, sub scripts
etc..
 Font Attributes:They are used to maintain the font type,font size, bold, italic
etc.
 Print Program or Driver Program:
 The Driver program is used to extract the data from the database tables or
views, process the extracted data & pass the processed data to the SAP
Script form to display/print on the document.
 What are the different types of Windows?
 Windows: - They are used to define the different types of windows.
 Following are the different types of windows.
 Main Window: It is the default widow. It is used to display the continuous text
on the pages. Without the main window we can’t design SAP scripts. The
system generates the pages dynamically for the main window. Up to 99 main
windows can be created in a form. The window type is ‘MAIN’.
 Constant Window: This window contains the static content which can be
formatted only once to print/display the same contents on all the pages.
 Variable Window: It is used to print the data based on the window size. It can
be formatted for each page to print/display the different contents. Without a
variable window, we can also design the SAP script.
 Graphic Window: It is used to print/display the graphics/logos on the page.

 What are the different types of Symbols in Scripts?


 The Symbols are the constants which can be inserted in the page windows to
display/print the corresponding contents/data. Symbols are of 3 Types.
 System Symbols: They are used to display the system data such as date, time
etc … Ex: &DATE&, &DAY&, &MONTH&

Symbol Description

&DATE& System Date

&DAY& Day of the System

&MONTH& Month of the System

&YEAR& Year of the system

&TIME& System Time

&HOURS& System Hours (HH)

&ULINE& Horizontal Line


 The system-provided standard structure SAPSCRIPT contains some of the
SAP Script system fields.
 Note: Number of pages like “1 of 10” can be displayed using the system symbols
PAGE & FORM PAGE as below.
 Ex:&PAGE& of &SAPSCRIPT-FORMPAGES&
 Current Page number, Total no of pages
 Standard Symbols: They are the predefined symbols. The pooled table TTDTG is
used to maintain the standard symbols.
 Application Symbols:These are used to display/print the processed data from the
print program or database. Ex: &WA_T001-BUKRS&.
 What are the different TAG columns in SAP Script form?

TAG MEANING

* Default paragraph format

= Extended Line

/: Command Line

/* Comment Line

/E Text Element -> Display multiple entries of an internal table Paragraph format

/= Line feed & Extended line


 What are the Function Modules associated with Scripts?
 The below Function Modules are used in the Scripts.
 OPEN_FORM: (*)
 This function module is used to provide the link between the print program &
SAP script form.
 The global data variables of the print program can be accessed in SAP Script
form after this function module is called to open a form/used.
 START_FORM:
 This function module is used to specify the starting page from where the
document is to be printed or displayed.
 WRITE_FORM:(*)
 This function module is used to pass the multiple entries of an internal table
into the SAP Script form to print/display the multiple entries or line items
through the Text Elements.
 END_FORM:
 It is an optional function module which is used to End the started From. 5.
 CLOSE_FORM: (*)
 This function module is used to close the Opened Form & send the Spool
Request/Print to the device.
 It can also be used to get the SAP Script form data into OTF(Other Text) format.
 Note: The standard function module ‘CONVERT_OTF’ or
‘CONVERT_OTF_2_PDF’ can be used to convert the SAP Script OTF Data
into PDF format.
 The standard function module SO_NEW_DOCUMENT_ATT_SEND_API1 is
used to send an Email with the required attachments in different formats.
 CONTROL_FORM:
 This function module is used to control the form by creating the pages
or windows dynamically.
 Note: An icon Transport (Lorry icon) or in the menu path, Graphic -> Transport
is used to generate transport requestsṣ to release LOGO’s from one system to
another system.
 What are the different ways to debug the Script?
 There are two ways to debug the Script Form.
 The path SE71 --->Utilities --->Activate debugger.
 By executing the Standard Program/ Report 'RSTXDBUG'.
 Differentiate between Page1 & Page2 format in sapscript?
 Page1 format: In this all pages have the same format.
 Page2 format: In this there is variation in page format i.e. the first page has a
different format than the second page.
 Some of the useful Control commands/Statements in SAP
scripts?
 /:Address…Endaddress: It is used to display the address details of the given
address number in the standard format.
 Syntax: /: ADDRESS
 /: ADDRESS number &GS_KNA1-ADRNR.
 /: ENDADDRESS
 /: Set Date mask: This command is used to print/format the system Date in the
required format. Syntax: SET DATE MASK = ‘<DD.MMMM.YYYY>’.
 * Date: & DATE
 /: Set Time Mask: This command is used to print/format the system Time in the
required format. Syntax: /: SET TIME MASK = ‘ SS:MM:HH ’.
 Note: Pass blank spaces to the formatted date & time to format them into
default format.
 There are no loop statements in SAP Script forms but the text elements can be
used to communicate with the function module WRITE_FORM used within the
loop of the print program to display the multiple entries.
 Text Element: Text Element is the name given to the block of statements in the
page window. If we pass the text element name to the WRITE_FORM function
module then the WRITE_FORM function module transfers the data from the driver
program to all the statements which are available under the Text Element.
 Whenever we are working with the main window, then we must provide the
Text Element name, otherwise the 1 information is printed twice.
st
 Protect…End protect: It is used to print the continuous text without any page breaks
in SAP Script forms.1 the system checks each & every page which page has
st

enough space to print the continuous text. If no page has enough space, it simply
breaks the text & printing in different pages.
 Syntax: /: PROTECT
 /E ELE
 /: ENDPROTECT
 Define: This command is used to define/declare the symbols in SAP Script.
 Syntax: /: Define &GV_SYMBOL&
 Box: This command is used to draw the Boxes/Frames on the page windows.
Syntax: /: BOX XPOS <**> cm/mm YPOS <yy> cm/mm
 /: WIDTH <ww> cm/mm HEIGHT <yy> cm/mm
 /: FRAME <FF> TW INTENSITY <yy> TW
 Note: An additional INTENSITY is used to gray out the boxes.
 The command position & size can also be used to define the box position &
sizes.
 Top…End Top: This command is used to display/print the contents at the Top
portion/Header of the specified window.
 Syntax: /: TOP
 /* Display/Print at Top of page window.
 /: ENDTOP
 Bottom…End bottom: This command is used to display/print the contents at the
Bottom/Footer portion of the specified window.
 Syntax: /: BOTTOM
 /* Display/Print at Bottom of page window.
 /: END BOTTOM
 New-Page: This command is used to generate the next pages.
 Syntax: /: NEW-PAGE.
 New-Window: This command is used to generate the new windows.
 Syntax: /: NEW-WINDOW.
 How to add additional functionality to a script without
modifying the print (driver) program?
 The Form Routines (PERFORM.......................... END PERFORM) is used to add
the additional functionality to the SAP Script form without making any changes in
the print program.
 What are client dependent objects in abap/sap?
 SAP Script layout, text element, and some DDIC objects.
 Can we call another Form from the same print program in sap
script?
 Yes, we can call other forms in the same print program/driver program.
 How to copy the Standard Script and make the changes?
 The path SE71--->Utilities---> Copy From Client can be used to make the
necessary changes.
 How to convert the language from DE to our required
language?
 In SE71, Utilities ->Convert Original Language, Provide the To Language & press
Enter
 How to transport text elements in SAP ABAP?
 If it is the first time, they will automatically be transported along with the program.
If you change them next time, it will ask for TR.
 What are the Standard Texts?
 The Standard texts are used to maintain the Long text using the T-Code 'SO10'.
 The command INCLUDE….OBJECT is used to insert the standard text on the
page window. Syntax: /: INCLUDE <ZSTP_TEXT_NAME> OBJECT <obj-
name>
 ID <id_name> LANGUAGE <EN/..>
 The standard function module ‘READ_TEXT’ can also be used in programs to
read standard text & application text.
 By Default the System doesn't generate any transport request for standard
texts.
 The standard Report 'RSTXTRAN' is used to generate the Transport Request
number for Standard texts.
 Tell me about some of the Standard Scripts and Print
programs?
 Some of the useful Standard Script Forms and Print programs :-

Form Name Print Program Form Routine Application

MEDRUCK SAP M & SP/ SAPFM06P Entry_new Purchase order only

RVOROADDRS RVADOR01 ENTRY Sales Order

RVDELNOTE RVADDN01 ENTRY Shipping

RVADIN01 RVINVOICE01 ENTRY Billing


 How to execute the program in the background?
 Execute SE38, provide the program name & Execute, provide the Input In the
Menu bar, click on program -> Execute in Background
 Provide the output device LP01 & click on enter Click on Immediate & save.
 How to copy the SAP script from 800 clients to 810 client?
 In the Target client 810, Execute SE38 & Provide the program name: RSTXFCPY
& Execute Provide the Form name, In source client 800, Provide the Target Form
name & Execute.
 All the standard script forms are available in client 000.
 Explain about some of the Symbol Formatting Options in
Scripts?

SYMBOL FORMAT DESCRIPTION

&SYMBOL& Displays/Print the contents of symbols without any format

&SYMBOL(C)& To compress the content without spaces

&SYMBOL(Z)& To remove the unwanted preceding zeros

&SYMBOL(R)& Displays the contents by justifying the Right hand side

&SYMBOL(K)& To avoid Conversion Routine

&SYMBOL(<)& To display the symbols sign at Left hand side

&SYMBOL(S)& Display/Print the sign of the numbers


&SYMBOL(N)& Display/Print ‘N’ no of characters

&SYMBOL+N(M)& Display/Print ‘M’ no of characters from the Nth position

&SYMBOL(.D)& Display/Print ‘D’ no of Decimals


 How to format the date, time and country in Scripts?
 The commands SET DATE MASK, SET TIME MASK , SET COUNTRY can be
used to format the date ,time and country.
 How do we display the Application Texts?
 Using the Function Module 'READ_TEXT' .
 How to split the line into the next line in Scripts?
 The Function Module ' RKD_WORD_WRAP' is used to split the text into multiple
lines.

 What are the fields in ITCSY Structure?


FIELD DESCRIPTION

NAME Name of the program symbol (without &)

VALUE Text Symbol Value


 The standard structure is used as a reference Import & Export symbol with the form
routines in SAP Script form.
 How do we create/maintain different styles in Scripts?
 The T-Code SE72 is used to maintain the SAP Script Form Styles such as
Paragraph Formats, Character formats. Barcodes are maintained in the Character
Format.
 What are the ways to upload the Logos and display them?
 The T-Code SE78 (or) the standard report 'RSTXLDMC' is used to upload the
LOGOS/IMAGES
 Whenever we are working with a .BMP image then we must convert .BMP to
graphics by using SE78 T-code.
 Whenever we are working with .TIFF images then we must convert TIFF to text
images by using the RSTXLDMC standard program.
 How can you pass the data to the Script from the Print program
without using WRITE_FORM?
 After Accessing the Fun, In The Module 'OPEN_FORM' we can declare the Global
data.
 How to develop the SAP Scripts in Diff. languages?
 In SE63, Click Translation --->Long Texts --->Sap scripts---> Forms.
 How to convert sap script spool requests to PDF?
 RSTXPDFT4.
 How to convert/migrate sap scripts to Smart Forms?
 Execute SMARTFORMS & Enter the New Smart Form name
 The path SMARTFORMS --->Utilities --->Migration ---> Import SAP script Form
Enter the Existing SAP script Form name & click on the Yes button.
 How to set the output device LP01 by default on our own PC?
 Execute SU01 & provide the user name as: SAPUSER, click on change mode Click
on Default tab & provide the output device LP01.
 Select the required decimal notation (1,234,576.89) & date format & click on save.
 How to identify the driver program based on the form name?
 Execute SE11, open the Table TTXFP & Click on Display & Click on Contents
Provide the Form name & Execute, Identify the Driver program.
 What are the Transaction Codes associated with Scripts?

T-Code Description

NACE To maintain Output types

SE71 Form painter

SE72 Form Style

SE73 To Maintain different types of forms & Barcodes

SE78 Graphics or LOGO

SE63 Translations to translate the text symbols & text elements in different languages

SO10 Standard texts


 Bar codes can be selected under the ‘Standard Attributes tab.
 The T-code SLXT is used to generate Transport Requests for Translations.
 Standard reports associated with SAP scripts?

RSTXDBUG Activate/Deactivate form debugger

RSTXLDMC To upload Graphics/Logo

RSTXSCRP ->Download/Upload the Forms, Styles & Standard Text


RSTXPDFT4 -> To convert the spool job of the SAP script into PDF
format RSTXFCPY -> Copy the SAP script from one client to other

RSTXTRAN To create Transport Request for standard text


 What are the tables associated with Scripts?
 TNAPR
 How to generate Transport Requests for Translations?
 Execute the T-code SLXT
 Select the required target language (DE)
 Enter the required text element/text symbol name (%TEXT1) in description
 Select a radio button workbench request
 Click on execute

SMARTFORMS
 What are the major differences between Scripts and Smart
Forms?

SAP Script SMARTFORMS

They are Client dependent They are Client Independent

The back Ground Images are not possible Background Images are possible

It is not possible to create SAP Script It Can be created without the Main Window also.
without a Main Window.

Multiple page Formats are not possible Multiple page Formats are possible

It cannot be executed without Print/Driver It can be executed without Driver Program


Program. executing the system generated Function
Modules

Color fonts cannot be displayed Color fonts can be maintained

The data extract logic (ABAP CODE) can't be written The data extract logic (ABAP CODE) can be
written under INITIALIZATION and program lines
node

The Tables & Templates are not possible but the The Tables & Templates can be drawn to display
Command box is used to draw the static or dynamic data
boxes

By using RSTXDBUG standard program we By using BREAK-POINT keyword we can debug


can debug the SAP script the smart form
 Why are the Scripts are Client dependent and Smart Forms are
Client independent?
 SAP scripts are client dependent, that means, if we design the SAP script in one
client that is not reflected to other clients in the same server.
 The Scripts are client dependent because the contents or data displayed using the
text elements. The text elements are client dependent hence the scripts are Client
dependent.
 SMART FORMS are client dependent that means if we design the SAP script in
one client that is automatically reflected to all other clients in the same server.
 The Smart forms are client-independent because one UNIQUE FUNCTION
MODULE is generated by the system while activating the smart forms. The
generated function module is client independent, hence the smart forms are client
independent.
 What are the Transaction Codes associated with Smart Forms?
 SMARTFORMS - To maintain SMARTFORMS.
 SMARTSTYLES - To maintain the styles for smart forms.
 SMARTFORM_TRACE - To debug the SMARTFORMS and activate the database
tracer.
 Text module is used to maintain the long texts.
 How to display the Address window dynamically?
 The Path %PAGE ---> CREATE ---> ADDRESS ---> Type DETERMINE
DYNAMICALLY.
 How to print Logos in Smart Forms?
 The Path %PAGE ---> CREATE ---> GRAPHIC --->LOGO
 What are the components of Smart Form ?
 Smart Form Layout
 Function Module
 Print Program
 What are the main components in Smart Form?
 The main components are, 1. Global Settings 2. Pages &
Windows
 Global Settings: It is used to maintain the global settings, definitions which can be
applied across the mart forms. It is a collection of Form Attributes, Form Interface
& Global Definition
 Form Attributes: These are used to maintain the smart form attributes & output
such as page format, style name etc. The default style for smart form is
‘SYSTEM’.
 Form Interface: These are used to declare the variables, work areas & internal
tables which are needed to transfer the data from the print program to the
layout. It is the system-generated function module with all the parameters
except changing parameters.
 Global Definitions: It is used to maintain the global definitions which can be
used across the different Global definitions.
 Global Data: It is used to maintain the global data definitions such as
variables, work areas, Internal Tables etc.
 Types: It is used to define the types which can be used to declare internal
tables & work areas.
 Field Symbols: It is used to define the field symbols.
 Initialization: It is processed before the smart form pages & windows are
processed. It is used to extract all the required data from the database table
& process the extracted data. Import & Export parameters must be
specified before they are used.
 Form routines: It is used to define the subroutines which can be called
across the smart form. It is used to define the currency/quantity fields as
like the DDIC tables/structures.
 Currency/Quantity Field: It is used to define the Currency/Quantity Fields
as like the DDIC tables/structures.
 Pages & Windows: It is used to design the different page formats & windows.
Following are the different nodes in smart forms.
 Windows: They are positioned on the pages. Following are different types
of windows.
 Main Window: It is used to display the continuous text on the pages.
This window is the default widow. Without the main window we can also
design Smart forms.
 Secondary window: It is used to print the different contents on each
page (similar to the variable window in SAPScript).
 Copies window: It is used to print the same document with multiple
copies with different headings.
 Final window: This is used to print the total amount after all the lines or
line items are printed.
 Graphics: It is used to create a graphic node (window) to display the
graphics/logos.
 Address: It is used to define the address node/window to display/print the
organization address/personal address/workplace add/ress.
 The address can be determined dynamically also using an option
Determine Dynamically.
 Text: It is used to display/print the contents of the different symbols/fields.
 Table: A table is used to print the multiple entries/dynamic data of an
internal table. The Table node can be used as a template to display a static
record by unchecking the checkbox internal table. Line types can be
created under the Table node.
 Template: A Template is used to display the static data (single record). This
node does not have the separate header, main area & footer whereas the
table node contains the different sessions such as header, main area &
footer. The template node can be used as a table by defining it under a loop
node to display the dynamic data as like the table node.
 Flow logic: The flow logic nodes are used to control the nodes & define the
program lines in smart forms. Following are the different flow logic nodes.
 Loop: It is used to process the corresponding nodes based on the
number of entries of an internal table.
 Program lines: It is used to write ABAP source code. Input & Output
parameters must be filled with the data variables before they are used.
 Alternative: It is used to control the corresponding nodes based on the
specified condition. It is used to process the alternative True/False
process blocks based on the SET conditions.
 Command: This node is used to go to a new page based on the
specified conditions. This is used to break the page based on the
condition.
 What are the ways to debug the Smart Form?
 1St Way: - By setting the Session Break point in the Generated Function module.
 SMARTFORMS can be debugged by setting the Session Break points at the
required statement line in the system Generated Function module.
 The system generated internal table %TEXT contains the following fields which
are filled with the text node contents at Run time to debug text elements.

Field Name Description

TDFORMAT Tag column of the text elements

TDLINE Contents of the text element/text node


 2nd Way :- By setting the Static Break points in the SMARTFORMS.
 SMARTFORMS can be debugged by setting the Static Break points in the
required program lines /initialization node under global definitions of the
SMARTFORM. The statement BREAK followed by user name can be used
 What are the Smart Form events?
 Only On First Page: To Print/Display the data on the 1 page only.
st

 Not on First Page: The corresponding contents are not to Print/Display on the 1 st

page.
 Only after the end of the Main Window: To Print/Display the corresponding
contents after the MAIN window is processed.
 Before end of Main Window: To Print/Display the corresponding contents of the
node or text node before theMAIN window is ended.
 Only On page: To print/Display the data on the specified page.
 What are the differences between Template and Table?
 A Table is used to print the multiple entries/dynamic data of an internal table. The
Table node can be used as a template to display a static record by unchecking the
checkbox internal table. Line types can be created under the Table node.
 A Template is used to display the static data (single record). This node does not
have the separate header, main area & footer whereas the table node contains the
different sessions such as header, main area & footer. The template node can be
used as a table by defining it under a loop node to display the dynamic data as like
the table node.
 How to find the system generated function module?
 Execute the T-code ‘SMART FORMS’.
 Enter the required smart form & click on the Display button.
 Click on the Environment menu item.
 Click on the function module name.
 The system generated function module name for smart forms could be different
from system to system [R3D -> R3Q -> R3P].
 Hence, capture the system generated function module name dynamically
through an Export parameter ‘FM_NAME’ = lv_name to the function module
‘SSF_FUNCTION_MODULE_NAME’.
 How to find the system generated function module of the smart
form?
 Execute T-code …> SMARTFORMS, Enter the Form name & click on the Display
button
 Click on Environment …> Function module name.
 Can you move a Smartform from one SAP system to another
without using transports?
 Yes, this can be achieved using the Upload/Download feature for Smartforms.
 One can download the Smartform from one system and save it as an XML file.
 Once that is done, the XML file can be used to upload the Smartform in another
system.
 How to upload the smart form?
 Execute the T-code SMART FORMS.
 Click on the utilities menu item & click on the upload form.
 Enter a new form name to be created by uploading the existing downloaded smart
form.
 Click on the yes button.
 Select the required downloaded smart form file (xml format)
 Click on open button
 Enter package name & click on save icon.
 Create the ‘Transport request’ number by pressing the create request icon.
 Click on the yes button & click on the change button.
 Make the necessary changes if required.
 Click on activate icon 7 click on back icon.
 What are the System Fields associated with Smart Forms?
 SFSY is the system-provided structure which contains a smart form system field.

Field Description

PAGE Current page Number

FORMPAGES Total No. of pages

JOBPAGES Total No. of pages of print job

DATE Current date of Application Server

TIME Current time of Application Server


SUBRC Return value

USERNAME user name

PAGENAME page name + variant


 Note:
 Smart Styles are used to create the paragraph & character formats. The T-
code is SMART STYLES.
 SSF_FUNCTION_MODULE_NAME is the function module which is used
to generate the smart form function module not based on the smart form
name.
 SPELL_AMOUNT is the function module which is used to convert the
amount in words.
 The SWAP button is used to change the Source language to Target
Language.
 The T-code SOST is used to check the send mails & push them.
 What is the role of the TNAPR table in SAP?
 It Stores all the forms and driver programs as well as all NACE settings.
 What is the role of the NAST table in SAP?
 After the final selection of the output is done and the application document is saved,
entries are created in the NAST table with application ID, Application document
number, output type, output medium, output timing and Status code.
 How to find a print program and form if an ‘output type’ is
given?
 The T-code NACE/ NACO or the standard table TNAPR is used to find the Form
details or Output type details in the system.
 Explain about NACE transaction code?
 NACE: - It is used to maintain the Output types and find the form name and print
program names. If you create the output type using NACE then it will be
automatically visible in table NAST and TNAPR.
 The standard program TNAPR can also be used to find the form & print program
name.
 Execute theT-code NACE.
 Select an appropriate required application.
 Click On input button on toolbar
 Click on the position button.
 Enter the required Output type: NEU & Press the Enter button.
 Select the font Output type (NEU).
 Double click on the processing routines folder.
 Click on the display/change icon.
 Change processing routine details such as print program, form routine, form
name etc.
 Click on save & click on the create request icon.
 Enter a short description as per the project standards.
 Click on save icon & click on Yes button.
 What are the steps to send a FORM/REPORT as PDF/XLS/.TXT
attachment through an E-Mail?
 Pass flag ‘X’ to field ‘GETOTF’ of export parameter control_parameters.
 Get the form data in OTF format using the system generated function module of
the SMART FORM.
 Note: Use the standard function module ‘CLOSE_FORM’ to get SAP Script form
data in OTF format.
 Convert the OTF data of the forms into a PDF format using the function module
CONVERT_OTF.
 Populate the mail subject, mail body, receivers list etc.
 Use the standard function module ‘SO_NEW_DOCUMENT_ATT_SEND_API1’ to
send an email with an attachment such as PDF or Excel etc.
 How do you achieve Page Protection in Smart form?
 While one can use the PROTECT.......................... ENDPROTECT command for
SAP-Scripts, for Smartforms.
 the Page-Protection checkbox can be used to ensure page protection
 You have the Page-protection property only for Text Elements in the Main
Window.

FILE HANDLING TECHNIQUE


 What are the Function Modules associated with the Local
PC/Front End system?
 GUI_UPLOAD - To upload the flat file from the specified file path of Local PC/Front
End into an internal table.
 GUI_DOWNLOAD - To download the data from the internal table into the specified
file path of Local PC/Front End.
 How to handle the files in Application Server?
 It is used to maintain files securely.
 The T-Code ‘AL11’ is used to work with Application servers. In the application
server each file is called one Dataset. We can’t create the file directly in the
application server. Through the program only we can create the file in the
application server (download the data into the application server).
 What are the steps involved in handling an Application server?
 The T-Code AL11 is used to work with the Application server.
 The below ABAP statements are used to Download/Transfer the data from an
internal table into the specified file path of an application server.
 OPEN DATASET FOR OUTPUT: This statement is used to open the required
files in write mode in the application server.
 TRANSFER: This statement is used to transfer the concatenated data into the
opened file.
 CLOSE DATASET:It is used to close the opened file in the server.
 The below ABAP statements are used to Upload/Read the data from a file
in the application server into an internal table of the program.
 OPEN DATASET FOR INPUT: This statement is used to open files in read
mode.
 READ DATA SET: This statement is used to read record by record from the
opened file in the Application server.
 CLOSE DATASET: This statement is used to close the opened file.
 How to upload the file from the presentation server (Front end)
to the Application server manually?
 The Code 'CG3Z' is used to upload the files from the Front end system into the
specified file path of an application server.
 Once the file is open in 'AL11'.
 Execute the T-Code 'CG3Z'.
 Enter the source file name on the Front end system.
 Enter the Target file name on an application server.
 Select the required file type and file name on the front end system by pressing the
search help icon(BIN/ASC).
 Click on the Upload icon.
 What are the Function Modules to provide Search Help on
Presentation server/local PC and Application Server as well?
 The Function module ‘F4_FILENAME’ is used to provide the search help to select
the required file path of the presentation server/Local PC.
 Function module 'F4_DXFILENAME_TOPRECURSION' or
'/SAPDMC/LSM_F4_SERVER_FILE' is used to provide the search help to choose
the files from the Application server.
 NOTE: - The function module 'F4_DXFILENAME_TOPRECURSION ' can be used
for both Presentation and Application server.
 How to convert a logical file into a corresponding physical file
path?
 Using File transaction code.
 The function module ‘FILE_GET_NAME’ can be used to get the logical file path of
the physical file path.
 Note: ALSM_EXCEL_TO_INTERNAL_TABLE is the function module which is
used to upload the excel sheet information into the internal table.
 The T-code CG3Y is used to download the files from the Application server/Back
end into the specified file path of the Presentation server/Front end.
 The T-code CG3Z is used to upload the files from the Presentation server/Front
end into the specified file path of the Application server/Back end into.

DATA MIGRATION/CONVERSION
 What are the common steps involved in Data Migration/BDC?
 Common steps involved in Data Migration:-
 Record the Screen Flow of the required functional T-code using the T-Code
‘SHDB’.
 Convert the recorded screen Flow into a temporary program..
 Upload the Flat file data from the Legacy System (Local PC /Al11) into an
Internal Table.
 Convert the uploaded flat file data within the loop of the flat file internal
table(gt_flat_file).
 Copy the system generated subroutines which start with BDC_DYNPRO&
BDC-FIELD from the temporary program & paste them within the loop of the
Flat file internal table.
 Comment screen default values & pass the flat file data.
 Use any one of either session/call transaction to update/migrate the data.
 Note: An icon export is used to download the recording onto a local pc.
 An icon-read form file is used to generate a program using the given recording
file.
 What is LSMW?
 Legacy System Migration Workbench .
 It is the system-provided tool to migrate or convert the legacy system data.
 The T-Code 'LSMW' is used to work with this tool.
 An icon export is used to download the recording into a Local PC.
 An option read from file is used to generate a program using the given recording
file.\
 What are the steps for LSMW?
 There are a total of 14 steps in LSMW.
 Maintain object attributes
 Maintain source structures
 Maintain source fields
 Maintain structure relations
 Maintain field mapping conversion rules
 Maintain fixed values, translations & user-defined routines
 Specify files
 Assign files
 Read data
 Display read data
 Convert data
 Display converted data
 Create batch input session
 Run batch input session
 What are the differences between LSMW and BDC?

LSMW BDC

It is a system provided tool. It is the Utility to develop a program.

Doesn’t require any programming knowledge. It requires programming knowledge.

The data can be imported in different import The data is processed or migrated in Batch
methods such as Batch InputRecording, BAPI and IDOC. Input Method only

The Field mapping is done automatically by The Field mapping should be done manually b
the System. passing the Flat data.

The T-Code LSMW is used. The T-Code SM35 is used to develop BDC
program

Mostly used for both Huge & small amount BDC can be used for Small amount of data
(Master) of data. only.

LSMW is possible for custom screens / standards with BDC can be used for custom screens/custom
custom fields of applications. fields of application.
 SHDB: It is the T-code used to record the screen flow as the T-codes.
 What are the differences between Session Method and Call
Transaction Method?

Session Call Transaction

The standard Function modules The ABAP statement CALL TRANSACTION ….is used.
'BDC_OPEN_GROUP’, 'BDC_INSERT'
and
'BDC_CLOSE_GROUP' is used to work
with the session method.

The data is updated in Synchronously The data is updated in both synchronous and
mode (Record by Record). Asynchronous modes.

An Error LOG File is generated by the The messages/errors are manually handled explicitly using the
system to handle the errors. structure BDCMSGCOLL & the function modules
'FORMAT_MESSAGE’ or
'WRITE_MESSAGE’ or the table T100.

Session method can process any number Call Transaction can process only one transaction at a time.
of transactions at a time.

After processing the session through Immediate database updation


SM35 only, the database is updated.

Session method is slower. Call transaction method is faster

We can schedule the session method in We can’t schedule the call transaction in
background. background.
 Synchronous: In this mode, the data is not continuously updated in case of error
records. Asynchronous: It is used to update the data continuously by skipping the
error records.
 Is it possible to write an ABAP code in LSMW?
 Yes, by clicking on the change(pencil) icon that appears beside the recording
structure field.
 What are the Function Modules associated with the BDC
Session Method?
 The System provided Functional Modules are
 'BDC_OPEN_GROUP ’: It is used to create the session using the T-code
SM35.
 'BDC_INSERT’: It is used to insert the flat file data of the structure ‘BDCDATA’
with transactions into session.
 Note: An export parameter “CTUPARMS” is used to handle the screen resolution
in case of table control to process the multiple line items in the session method.
 'BDC_CLOSE_GROUP’: It is used to close the opened batch input session.
 How to handle messages in Call Transaction Method?
 Get the message details such as message type, message number into an internal
table (gt_bdcmsgcoll) of the type BDCMSGCOLL using an addition
“….MESSAGES INTO” with CALL TRANSACTION statement.
 Set a loop into an internal table (gt_bdcmsgcoll) of the type “bdcmsgcoll”.
 Use any of the function modules “FORAMT_MESSAGE”/”WRITE_MESSAGE” to
get the corresponding message text, since the structure “BDCMSGCOLL” does not
have any message text field.
 Display the populated messages with message text either list or ALV.
 Note:The standard table ‘T100’ can also be used to populate the message text.
 What is the syntax to make use of Call Transaction?
 CALL TRANSACTION '<T-CODE>' USING <gt_bdcdata> MODE <A/N/E>
UPDATE<S/A> MODE <A/N/E> UPDATE <S/A> MESSAGES INTO
<GT_BDCMSGCOLL>.
 Here <T-CODE> is the required transaction code through which the flat file data
can be migrated.
 <gt_bdcdata> is an internal table of type “bdcdata” structure
 <A/N/E> are different data process modes
 A = All screens, N = No screens, E = Error screens
 <S/A> are the different update modes
 Which method do you prefer to migrate the data if the method
is not mentioned?
 CALL TRANSACTION.
 What are the fields in the BDCMSGCOLL structure?
 BDCMSGCOLL is one structure in DDIC which contains the below fields

Field Description

TCODE BDC Transaction code

DYNAME Screen program name

**DYNUMB Screen number

**MSGTYP Message Type (E/W/I/S….)

** MSGSPRA Message language

MSGID Message ID

MSGNR Message Number


 What are the fields in BDC DATA structure?
 It is a structure in DDIC which contains 5 fields.

Field Description

PROGRAM BDC Module pool

DYNPRO BDC Screen number

DYNBEGIN BDC Screen Start

FNAM field Name of the screen

FVAL BDC Field Value(flat file)


 Can you set up background processing using CALL
TRANSACTION?
 Yes, Using No Screen Mode in 'CALL TRANSACTION'
 Can we use call transaction and session method in the same
program? Explain?
 Yes, we can call transaction and session methods in the same program, generally
we use call transaction for updating and session method for logging errors in the
same program .
 How to run the Session in Background?
 The standard report program RSBDCSUB is used to schedule the Batch Input
Sessions in Background. (OR)
 We can also SUBMIT the program RSBDCSUB within the BDC session program
itself.
 What Is BDCRECCX1?
 In a standard program, Generated from recording which contains all the re-usable
declarations and also the re-usable Subroutine Definitions for all the BDC
Programs .
 How can you PRINT a session log file?
 Execute RSBDCLOG .
 How to Export the Session?
 From SM35 ---> Utilities ---> Export Session .
 While Uploading a flat file through BDC Call Transaction , The
system(not SAP Server i.e. the currently working Machine)
suddenly gets CRASHED . How do I know how many records
have been updated ?
 Even though it is BULK Data Processing ,updating the database is always record
by record only. After Calling the Transaction, Maintain the status of the calling
transaction into one custom table including the record details. So that we can know
the custom table for the latest details.
 After running a BDC program in the background, the next
morning when you see the results, few records are not
updated(error records). What will you do then?
 We will look into the incorrect session, analyze the error screen, and reprocess the
session after correcting the data.
 You are given functional specs for a BDC program and you
need to decide whether to write a method call transaction or a
session. How will you decide?
 Based on the amount of data(number of records to update), I will decide what
method to use.
 Ex: If data is less than 5000, I will use a call transaction. If data is more than 5000
records I prefer a session method.
 How to handle screen Resolution?
 Declare a structure data variable of the type ‘CTU_PARAMS’.
 Pass the required data such as default size, display mode, update mode etc to the
defined ctu_params structure variable.
 Use the populated structure variable of type ‘ctu_params’ with CALL
TRANSACTION using an additional ‘OPTIONS’.
 How to handle Table Control in BDC?
 Table control is used to migrate/update the multiple records(line items) in BDC.
 Note: Press Page Down in the table control to record the function code for page
down.
 The next item no is the 1 item no when the Page Down is pressed.
st

 Record the Screen flow with line items using the T-Code “SHDB”.
 Convert the recording into a program using the button program.
 Make the changes in the original main program like,
 Upload the flat file data which contains both Header & Item data.
 Split the uploaded Flat file data into the Header and Item tables, using the
Control Break Statements.
 Set a loop to Header internal table then process the Header related data by
copy & paste the system generated header related sub-routines from the
temporary recording program
 Set a loop to Item table data to process the multiple line items.
 Make the Item number as dynamic by concatenating the screen field name with
the screen number.'
 Use the function code “p+” to handle page down in table control.
 Use any one of the methods with BDC_INSERT(Session) or CALL
TRANSACTION to migrate the data from internal table GT_BDCDATA.
 Note: TheHeader & Item data can be processed separately using the control break
statements without splitting the flat file data.
 The control break statements can also be used to process Header & Item data
separately by avoiding nested loops.
 What are the problems in processing batch input sessions?
How is the batch input process different from processing
online?
 If the user forgets to opt for a keep session then the session will be automatically
removed from the session queue (log remains). However, if a session is processed
we may delete it manually.
 If session processing fails, data will not be transferred to the SAP database table.

ENHANCEMENTS
 What are Enhancements and what are the different techniques
and explain them?
 Enhancements are used to add some additional customer-specific functionality to
the standard applications/programs.
 Customer Exits: These are the Function Modules available in most of the functional
areas such as SD, MM, FICO etc.They are used to add the additional functionalities
in the standard applications/programs without using an access key to break them.
The access key is the unique key provided by the BASIS consultant to break the
standard applications. The application will become custom development once it is
broken.
 Field Exits: These are used to change the field labels of the standard data
elements.
 Function Exits: These are used to add the additional functionality to the
standard programs without breaking them. Each Function Exit contains a
custom include program which starts with Z* to implement the customer-
specific additional business logic. The Function Exit is the 3 digit no which is
called using the ABAP statement CALL CUSTOMER_FUNCTION.
 Menu Exits: These are used to add the custom specific menu items &
corresponding additional functionality based on the selected menu item.
 Screen Exits: These are used to add the additional screen elements & the
corresponding additional functionality to the standard screens/transaction.
 T-Code SMOD: It is used to find the customer exits of the standard package.
 T-code CMOD: It is used to assign an enhancement/exit to a project.
 User Exits: These are the Subroutines which start with USEREXIT_*& these are
defined in the standard Include programs. They are mostly used in SD functional
areas. The Access key is required to break the standard Include programs of the
User Exits for the first time. The T-code SPRO is used to find the User Exits.
 BTE (Business Transaction Events): These are the Source code plug-ins to add
an additional functionality in the standard program.
 T-code BERE: It is used to find the BTE’s.
 T-code FIBF: It is used to work with BTE’s.
 Enhancement Framework: The enhancement framework is advanced to user exits
for adding additional functionality without breaking the standard programs. It is
used to attach/hook the source code plug-ins such as enhancement sections or
enhancement points in the standard programs.
 In User-exits we write code only in the form routines(ie., in Form...End Form). When
we go to upgrade the versions, we again need to change the code in the user-exit
which we wrote in previous versions but with Enhancement Framework there is not
much code change required when we go for upgrades.
 BADI: These are new enhancement techniques to add the additional customer
specific business logic to the standard programs.
 What are the ways to find the Exits?
 Using the T-code Package name of the applications
 Using the T-code SE84
 Find the package name of the required T-code.
 Execute the T-code SE84.
 Expand Enhancement folder
 Double click on enhancements
 Enter the required package name/Exit name
 Click on execute icon
 Using the Find function in standard programs.
 Using the standard Tables MODSAP & MODACT.
 What are the types of Enhancement Framework?
 It is an advanced enhancement concept introduced from the version ECC6.
 It is used to attach/hook the source code plug-ins such as enhancements section
or enhancement points in the standard programs.
 There are 2 types of enhancement frameworks.
 Implicit Enhancement Section/Point: They are provided implicitly at particular
locations by SAP. They are mostly presented at the beginning & end of the sub
routines (FORM-ENDFORM), beginning & end of the function modules, and
beginning & end of the programs.
 Explicit Enhancement Section/Point: They are pre coded by SAP & provided at the
specific location in the standard programs. There are 2 types of Explicit
Enhancement.
 Enhancement-Section: It is used to copy, change the existing standard source
code & add additional business logic to the standard program. The ABAP
statement ENHANCEMENT-SECTION is used to specify the Enhancement
Sections.
 Enhancement-Point: It is used to add additional customer specific business
logic to the standard program.
 What are the differences between Customer Exits and User
Exits?

Customer Exits User Exits

These are the Function modules These are the subroutines

The Customer Exit has different types such as User Exit do not have different types
function exit, menu exit, screen exit & field exit

These are available under most of the These are mostly available in SD functional
functional areas such as SD,MM,FI etc area

Access key is not required to add the Access key is required to break the standard
additional functionality program

The Customer Exits are called using The User Exit starts with
CALLCUSTOMER_Function USEREXITS(subroutines in standard include)

 What are the Transaction Codes associated with BADIs?


 T-code SE18 & SE19: are used to work with the BADI’s T-code SE18: used to
define the BADI’s
 T-code SE19: used to implement the BADI’
 What are the types & subtypes of BADIs and explain about
them?
 It is used to add the additional customer-specific business logic to the standard
programs.
 Classic/Old BADI: These are mostly used in functional areas like SD, MM, FI/CO.
The standard method “GET_INSTANCE” of the standard class
“CL_EXIT_HANDLER” is used to work with the classic BADI.
 Kernel/New BADI: The ABAP statements “GET BADI & CALL BADI” are used to
work with New BADI’s. It is faster than Classical BADI’s.
 GET BADI: This statement is used to generate a New BADI object & sets the
BADI reference to the objects in the BADI reference variables.
 CALL BADI: This statement is used to refer to the Methods of the New BADI’s.
 Subtypes:
 Single use BADI: The single use BADI can’t be implemented multiple times.
This BADI can have only one implementation.
 Multiple use BADI: The multiple use BADI can't be implemented multiple
times.
 Filter Dependent BADI: It is used to control the BADI implementation based
on the specified filter value. The system generates an Import parameter
‘FLT_VAL’ to pass the filter values for controlling the business logic of the
BADI implementation.
 Interface: It is a separate structure which can be used to extend the
scope of a class.
 What is FALL BACK class in BADI?
 If a BADI doesn’t have any active implementations, the program goes into a run
time error. The Fallback classes are used to call the default methods in case a
BADI doesn’t have any active Implementations.
 The exceptions can also be raised to avoid such kinds of errors.
 What are the differences between Exits and BADIs?

EXITS BADIs

They are procedural ABAP based They are Object Oriented ABAP based

It is not possible to assign an Exit to more The multiple use BADI can be implemented
than one project For multiple times

The Filter values can’t be set to the Exits The Filter values can be set for Filter
Dependent BADI’s

The T-codes SMOD & CMOD are used The T-codes SE18 & SE19 are used
 What are the ways to find BADIs?
 Most of the Standard BADI’s are classic BADI’s.
 They are used to add the additional customer-specific functionality/business logic
to the standard programs/T-codes.
 There are 4 ways to find the BADI’s
 Using the standard class CL_EXITHANDLER
 Execute the T-code: SE24 to maintain the global class.
 Enter the standard class name CL_EXITHANDLER
 Click on the display button.
 Double click on the method GET_INSTANCE
 Set a session breakpoint on the method
GET_CLASS_NAME_BY_INTERFACE
 Execute the required functional T-code Ex: MM02
 Perform the required action Ex: save material
 Double click on a passing parameter (EXT_NAME) to list out the
corresponding BADI. Ex: BADI_MATERAIL_CHECK
 Using the T-code SE84
 Using the T-code ST05 (SQL Tracer)
 Using the T-code SPRO
 What are the differences between Classic (Old) BADI and
New(Kernel) BADI?

Classic or Old BADI New or Kernel BADI

The standard method GET_INSTANCE of the The ABAP statements GET BADI & CALL
standard class CL_EXIT_HANDLER is used to call BADI are used to working with New BADI’s.

An interface of a BADI referred to create the The definition of a BADI is referred to create
Reference object the Reference object

It is not faster as like the Kernel BADI It is faster than the Classic BADI

It can be a multiple use BADI It must be a single use BADI

The Fall back class can’t be defined The Fall back class can be defined

It can be a Filter Dependent BADI It is not possible to maintain the Filter values
 What statements are not to be used in Exits and BADIs?
 The ABAP statements COMMIT work & ROLLBACK work should not be used in
EXITS. The ABAP statements STOP & EXIT are also not advisable.
 What are the Enhancement Spots?
 The enhancement spots are used to manage explicit enhancement options that
means you can add your code in standard ABAP code without the need of an
access key,which implies that the standard code is not disturbed.
 Enhancement spots specify the places where we can add our code in standard
SAP. Each enhancement spot element definition must be assigned to at least one
enhancement spot.
 What are the steps to insert the Enhancement Spot and work?
 ImplicitSpots are available in every program on some predefined spots as a begin
of FM, end of FM, begin of some event and so on. It means that you can easily
modify any program, FM, subroutine with some limitations.
 If you want to see all implicit spots in a program, go toSE80 -> Edit -> Enhancement
Operations -> Show Implicit Enhancement Options.

Cross Application / Interfaces (RFC, BAPI,


IDOC)
 What is the Cross Application/Interfaces concept?
 This concept is used to distribute the data between SAP to SAP systems (SAP R/3
<-> SAP CRM) &SAP to Non SAP systems (SAP <-> .NET, JAVA).
 What is Remote Function Call (RFC)& types of RFC’s?
 It is a SAP specific protocol to provide communication between different systems.
 It is the process of calling Function modules from another system.
 SAP Uses CPIC (Common Programming Interface for Communication) Protocol to
transfer data between Systems.
 Types:
 Synchronous RFC: In case of this RFC both the Sender/Source and
Receiver/Target systems should be available while distributing the data. The
next part of the calling program isn’t continued until the call function is
completed.
 Asynchronous RFC: In case of this RFC both the Sender/Source and
Receiver/Target systems should not be available while distributing the data.
The next part of the calling program is continued without completing the call
function.
 Transactional RFC (TRFC):It is almost similar to Asynchronous RFC. The
Transactional RFC is executed only once in an RFC server & saves the
corresponding data under a unique transaction ID in the Database.
 Queued RFC: In case of this RFC the multiple transactional RFCs are
serialized in the sequence using the Function module
‘TRFC_SET_QUEUE_NAME’.
 An additional statement ‘Destination’ is used while calling Remote Enabled
Functions.
 How to Debug the RFC Function module?
 SE38 -> Utilities -> Settings -> ABAP Editor -> Debugging activates the external
debugging and chooses the New Debugger option in ABAP debugger.
 Go to the particular place in the code and put a breakpoint, a popup will appear
then choose the HTTP break point.
 If you are triggering the RFC from SAP portal make sure that both the user ID
should be the same If the users are different then provide the XI/Portal User ID in
the users field.
 How do you connect to the remote server if you are working
from the office for the client in a remote place?
 WAS ->Web Application Server or ITS (Internet Transaction Server) are generally
used for this purpose. If you are sitting at your office with a server which is in the
system and the other server is at the clients place you can generate IDOC,
Intermediate Documents which carry the data you want to transfer or the
documents you want to transfer, these IDOC are interpreted by the system at the
receiving end with the message class with which it is bound with. If you want to
login to a system which is very distant, then remote login can be used. This
depends on the internet speed.
 What are the steps to work with Remote Enabled
Function/maintain RFC connection?
 An additional statement ‘Destination’ is used while calling remote enabled
functions.
 1. Define RFC Destination: 2. Creation of Remote Enabled Function:
SE80
 Execute the T-Code : SM59
 Select the required RFC connection such as ABAP connections/Type 3
connections.
 Click on create icon
 Enter RFC destination name & Description : SAP R/3 to SAP CRM
 Enter the target application server name/address in the target host field : CRM
system
 Enter the target system number Ex: 33
 Click on “Logon & Security” tab
 Enter the logon credentials of the Receiver/Target system
 Note: The check box Current user can be checked to make use of the same User
name & password for the target system
 Click on save icon & click on yes button
 Click on ‘Connection Test’ button to test RFC destination
 Click on ‘Remote Logon’ button to test the remote connection
 How to make Destination (system-id) as dynamic?
 IF Sy-sysid EQ ‘CMD.
 <gv_dest> = ‘R3D’.
 ELSEIF Sy-sysid EQ ‘CMQ.
 <gv_dest> = ‘R3Q’.
 ELSE Sy-sysid EQ
 ‘CMP.
 <gv_dest> = ‘R3P’.
 *Call RFC
 CALL FUNCTION ‘ZRFC/RFC’ DESTINATION <gv_dest> “R3D
 What are the differences between RFC and BAPI?

RFC BAPI

RFC’s are used to connecting from SAP to BAPI is used to connecting from SAP to SAP
SAP only as well as SAP to NON SAP

The T-code SE37 can be used to find RFC’s The Tcode BAPI & SE37 can be used to find the BAPI

RFC doesn’t generate any methods BAPI generates the unique method in BOR to
use in the external system directly

It doesn’t have standard RFC’s to migrate the The standard BAPI which starts with BAPI can
data be used to migrate the data
 What are the steps involved in creating Custom BAPI?
 Create the BAPI structure (SE11) starts with ZBAPI*.
 Create the BAPI function module (SE37) starts with ZBAPI* which is
 Remote Enabled
 All parameters are pass by value
 Must contain Return parameter
 Create a method & object for the BAPI remote enabled function in BOR using the
T-code ‘SW01’.
 Generate, implement & release the created BAPI to the outside using the T-code -
‘SQO1’.
 What are the ways to find Standard BAPIs?
 There are 2 ways to find BAPI.
 Using the T-code : BAPI.
 Using the T-code : SE37.

 How to find/check the Standard BAPIs?


 Execute the T-code BAPI
 Expand the required Hierarchy. Ex: Sales & Distribution etc
 Expand the required sub-functional area. Ex: Sales/Billing etc
 Double click on the required BAPI
 Corresponding BAPI details such as method name, business object name,
BAPI function module &etc are displayed under details tab
 The tab Documentation is used to know more details about the BAPI’s
(standard)
 The tab Alphabetic can also be used to find the BAPIs in the alphabetical order
 Click on back.
 What are the steps to work with standard BAPI?
 Upload the flat file data into an internal table
 Convert the flat file data into BAPI compatible Work area’s/internal tables within
the loop of the flat file internal table.
 Call the BAPI function module & pass the BAPI internal tables.
 How to handle exceptions in RFCs and BAPIs?
 You can handle the exceptions by using a structure BAPIE1RET2 which returns
the messages captured in BAPI. In the Tables parameter of your BAPI, you can
create a structure of typeBAPIE1RET2 so that you can capture the ‘RETURN'
parameters from BAPI.
 How to handle error messages in standard BAPI’s?
 Get all the message details into a written table of the type BAPIRET such as
Message ID, Message type, Message variable etc.
 Use the standard function modules ,
 MESSAGE_INITIALIZE ( Initialize messages),
 MESSAGE_STORE (To store messages) &
 MESSAGES_SHOW (To display messages in the Dialog box/Model dialog)
 What is Extended BAPI?
 Standard BAPI’s can be extended to add the customer-specific additional field.
 Standard BAPI contains table’s parameters EXTENSIONIN, EXTENSIONOUT in
case they are extended BAPI’s.
 BAPI extensionin is used to update custom fields of a table (ex: MARA).
 BAPI extension out is used to retrieve custom fields of a table.
 What are the differences between BAPI and normal BDC?

BAPI BDC

BAPI is faster than BDC. BDC is relatively slower than BAPI.

BAPI’s are used to upload the data from the flat file to the SAP BDC’s are used to upload the data fro
system directly. file to the SAP system via screens
hence it is slower.

No such processing options are available in BAPI. Background and Foreground


processing options are available for
BDC.

BAPI would generally be used for small data uploads. BDCs would be preferred for large
volumes of data upload since a
background processing option is
available.

BAPI never causes the program to terminate. Whenever an error Errors can be processed in SM35 for
occurs in the BAPI, it returns those errors through the Return the session method and in the batch
parameter. This parameter returns exception messages or input program for the Call Transaction
success messages to the calling program. method.

In BAPI recording is not required In BDC, recording is required


 What are Authorization Objects?
 These are used to protect/prevent user access to the data & T-codes/Tables.
 The authorization objects are maintained by BASIS consultants.
 The T-code: SU24 is used to find authorization objects in the system.
 The ABAP statement ‘AUTHORITY_CHECK’ or the standard Function Modules
‘AUTHORITY_CHECK*…’ are used to check the authorizations.
 What is ALE & EDI?
 ALE stands for Application Link Enabling. It is used to distribute the data between
two different SAP systems/Servers.
 EDI stands for Electronic Data Interchange. It is used to distribute the data between
SAP & non-SAP systems/servers.
 What is an IDOC?
 IDOC stands for Intermediate Document.
 IDOC is the collection of segments & each segment is the collection of fields.
 IDOC is the carrier to carry the data between the distributed systems in electronic
form without user interaction.
 What is an IDOC Structure?
 Each IDOC has 3 records
 Control Record:
 It contains IDOC type & Message type information, Partner information
such as partner system number, Port number of the sender & receiver
system.
 It also contains technical & address information of sender & recipients.
 Data Record:
 These are collections of segments. The data record of an IDOC contains
segments.
 Segment is collection of fields which can be used to distribute the data
between the systems.
 Status record:
 It contains the status of the processed IDOC to know where an IDOC has
been successful/failed.
 The standard table EDIDC contains IDOC information such as control
records, different statuses etc.
 Note:
 The Sender/Source system is also called an ‘Outbound system’.
 The Receiver/Target system is also called an ‘Inbound system’.
 The T-code ‘WE30’ is used to maintain different types of IDOC’s such as Basic
IDOC, Extended IDOC.
 The T-codes WE02/WE05 are used to list the generated IDOC.
 The T-code ‘WE19’ is used to test/check the IDOC. Custom Segments:
 The custom segments start with Z*/Y* & they are maintained by technical &
functional consultants
 Standard Segment:
 These are system provided segments
 The T-code : WE31 is used to maintain the segments
 Message Types:
 These are identifiers of the application data to be distributed between the
systems
 The T-code WE81 is used to create & WE82 is to assign the message types
to the IDOC (Data carrier)
 The standard table EDIDC contains all available message type System
provided standard message types.

Message Type Description

MATMAS Material Master

DEBMAS Customer Master

CREMAS Vendor Master


 Partner Profiles:
 These are used to maintain the partner system details with which data to
be distributed such as partner number, Partner type & Message type of
outbound parameters.
 The T-code WE20 is used to maintain partner profiles Ports:
 These are used to specify the way in which data to be distributed through
an IDOC
 The system generates one unique port number
 The T-code WE21 is used to maintain ports for IDOC process
 Customer Distribution Model:
 It is used to define a data distribution model to exchange the messages
between two logical systems (SAP – SAP/SAP – non SAP)
 The T-code BD64 is used to define/maintain customer distribution model
 Process codes:
 It is used to identify the type of the data to be distributed through an IDOC
interface.
 The T-code WE41/WE42 is used to work with the process code.
 What are the Transaction Codes/Reports to send/generate and
receive the data to an IDOCs?

OBJECT ORIENTED PROGRAMMING ABAP


 What does OOP ABAP stand for ?
 OOP ABAP stands for “Object Oriented Programming” ABAP.
 What is the main feature of OOP ABAP ?
 Represents the real-time objects in the form of class objects.
 How Many types of OOP ABAP?
 There are two types of OOP ABAP :
 Local class,
 Global class.
 What is the Global & Local class in OOP ABAP ?
 Local Class: This class is available in ABAP Programs, we can access them via
ABAP editor SE38.
 Global Class: It is an ABAP Object which can be accessible via SAP class builder,
T-Code for SAP class builder is SE24.
 What is class?
 A class is a user-defined data type with attributes , methods , events , user-defined
types. Interfaces etc for particular entities or business applications.
 What are objects, attributes, methods, events and interfaces?
 Objects: Objects are nothing but instances of classes , each object has a unique
identity that is memory and its own attributes.
 Syntax : DATA <Instances>; TYPE REF TO <CLASS NAME>.
CREATE OBJECT <INSTANCES>.
 Attributes: Attributes are variables , constants declared within a class.
 Methods: Methods are coding blocks which provide some functionalities,
 Similar to Function Modules in ABAP.
 Methods can access all attributes of their own class.
 Methods are defined in the definition part and implemented in the
implementation part.
 We can call methods using the CALL METHOD statement.
 Events: Event is a mechanism through which one method of a class can raise the
method of another class, without the hazard of instantiating that class.
 Interface: Interfaces are similar to classes which contain methods without any
implementation.
 Interfaces are mainly used to extend the functionality of a class.
 What is the constructor method in SAP classes? Explain the
use of the constructor method in OOABAP.
 Constructor is a special type of method. It is executed automatically whenever an
object Is created or instantiated. These methods cannot be called by the CALL
METHOD statement. These methods are mainly used to set default values in
classes where parameters or select options are initialized.
 There are two types of constructors in SAP Classes.
 Constructor (Instance Constructor).
 Class Constructor (Static Constructor).
 Constructor: - This method can only import parameters. There will not be any
exporting parameters. The name of the constructor method must be Constructor
only.
 Class Constructor: - It is a type of constructor, this method will be executed
automatically whenever the first call to the class is made, the first call may be
through an instance or through a class. These class constructors are mainly used
to set default values globally I.e. Irrespective of instances, this method will not have
any importing or exporting parameters. These methods will be executed only once.
 Name of the CLASS CONSTRUCTOR must be CLASS_CONSTRUCTOR.
 What is polymorphism in an Object Oriented Programming
model?
 It is a concept by which the same method names will behave differently in different
classes I.E. Each method will have its own implementation in different classes but
with the same name.
 Interface is one of the concepts in object-oriented ABAP to achieve polymorphism.
 What is Inheritance ?
 Inheritance is the concept of passing the behavior of one class to another class.
 You can use an existing class to derive a new class.
 Derived class inherits the data and methods of a superclass.
 However, they can overwrite the existing methods and also add new code.
 This means we can add additional features to an existing class without modifying
it.
 Super is the keyword that is used to represent the super class in oops, you can
access the methods and attributes of the super class using the word super.
 Redefinition is the keyword which is used to overwrite the parent class methods
with new definitions.
 Note: - In object-oriented ABAP we have only a single inheritance. There is no
multiple inheritance.
 Super class is the main class. By using this we can derive a new class which will
be called Child class.
 Final class is a class which cannot be used in inheritance. It is a class property
(checkbox under properties of class).
 What is Casting ?
 There are two types of casting.
 Narrowing Cast: - Assigning/Copying the instance of a subclass to a
superclass instance is called Narrowing Cast.
 Widening Cast: - Assigning/Copying the instance of a superclass to a subclass
instance is called Widening Cast.

CDS(Core Data Services)


 Why were CDS introduced ?
 With CDS, Data models are defined and consumed on the database rather than
on the server.
 CDS also offers capabilities beyond the traditional data modelling tools, including
support for conceptual
 modelling and relationship definitions, built in functions, and extensions.
 Originally, CDS was available only in the design time and run time environment
of SAP HANA.
 Now, CDS concept is also fully implemented in SAP NetWeaver AS ABAP,
enabling developers to work in ABAP
 layer with ABAP development tools while the code execution is pushed down to
the database.
 Why is Core Data Service (CDS) ?
 CDS is an infrastructure layer for defining semantically rich data models, which
are represented as CDS views.
 In a very basic way, CDS allows developers to define entity types (such as
orders, business partners, and
 products) and the semantic relationship between them.
 Which corresponds to foreign key relationships in entity relationship models.
 CDS is defined using SQL based DDL (Data Definition Language) that is based
on standard SQL with some
 additional concepts such as associations.
 Which defines the relationships between CDS views and annotations, which
defines the domain specific
 artifacts.
 Another example is expressions, which can be used in scenarios in which certain
CDS attributes are
 considered as measures to be aggregated.
 Features of CDS views?
 Semantically rich data models.
 Domain specific language (LINQ, QL, SQL).
 Declarative, close to conceptual thinking.
 CDS is separately based on SQL query language.
 Fully compatible with any databases.
 Generated and managed by SQL views.
 Native integration in SAP HANA.
 Common Basis for Domain Specific Framework. E.g. UI, Analytics, OData, BW.
 Built-In functions and code push down.
 Table functions and breakout scenarios.
 Rich set of built-in SQL functions.
 Extensible.
 On Model level through extensions.
 On the meta model level through annotations.
 Limitations of CDS:
 Cannot Debug,
 Only one Result Set can be returned,
 We cannot join 2 fields with Data type and length mismatches in the 2 tables;in
such scenarios we need to use AMDP.
 Components of CDS:
 There are two components of CDS views in HANA.
 DDL SQL View:- It is read only in classical database view which is read only
in ABAP dictionary (SE11). It cannot be edited in SE11.
 CDS view Entity: - It is the DDL source file and the actual CDS view. It is a
database object which is visible inEclipse/HANA Studio/ADT and we cannot
view the CDS View entity in SE11. It covers the CDS database view and
makes other attributes possible such as authorization checks defined in CDS
views. Before I Show, how the CDS view is created in HANA ADT, let me
start with how the CDS view can be deleted.
 Note: - We don’t need to delete both CDS views and Dictionary DDL SQL
individually for deleting CDS views. We will not be able to delete DDL SQL
views but we can delete CDS view entities. When the CDS view entity is
deleted then the DDL SQL view will also be deleted.
 Authorizations in CDS views ?
 DCL:- Data Control Language(DCL) is used for controlling privileges in
databases in database operation.
 Two kinds of privileges are provided to any user.
 System, and (system access taken care by SAP. We don’t need to bother
much about this)
 Object (Authorization Objects or access).
 GRANT: -Used for providing any user access privileges or the other privileges
for the database operations
 Revoke: - Used for taking back permissions from any user.
 Role:- Special permission created by system admin for accessing
(Display/Change/Create) any particular T-Code for abap objects. These shall be
maintained in T-code PFCG
 Types of Views.
 Define view: - It’s a simple view with only one table.
 Define view with joins: - This view is used to join more than 2 tables using joins.
 Define view with association: - This view is used to join more than 2 tables
using association.
 Define view with parameters: - In SE11 view can only have hard-coded
selections, By this we can make selection dynamic.
 Extend view: - This view is used to extend the standard view.
 Define table functions with parameters: - By using this we can call AMDP
methods in view.
 Advantages of CDS view.
 CDS views are like open SQL, they are database independent and run on any
sap-supported database system.
 In SE11 view field calculation is not possible whereas in CDS views we can have
calculated fields. (e.g. Adding two fields at runtime.)
 CDS views support inner join, Outer join, right outer join, full join, Cross join.
 CDS views support automatic client handling.
 CDS views support open SQL and we can call them in the same way we call the
SE11 view in the application layer.
 WHERE, GROUP BY, HAVING, UNION clauses are supported in CDS views.
 Aggregation and Numeric functions are supported in CDS views.
 We can achieve OData services directly from CDS views.
 What are the annotations in CDS views?
 @abapcatalog.compiler.comparefilter : for filtering.
 @abapcatalog.sqlviewname : can be defined as the se11 view name.
 @serch.searchable : true for search help.
 @accesscontrol.authorizationcheck : REQUIRED or NOT_REQUIRED
 @endusertext.label : - that is for labelling the text into the field.
 Differentiate between CDS views and AMDP Class.
 CDS views are based on single service logic; they return only one result set in
an output. Whereas AMDP classes can get the results of multiple entities
together by a single service call.
 A CDS view can be created to read and process the data at the database layer.
The AMDP class can be used for processing and modifying the data at the
database layer.
 CDS view supports open SQL statements. Whereas AMDP class supports native
SQL statements.
 What is the difference between association and joins?
 Join can be used when the user wants to get the data from two or more tables,
then join statements can be used. Association is a lazy join. In other words,
association can also be defined as join but on demand.
 Association does not do actual join until and unless someone triggers it.
Association defines the proper relationship between the data sources and not
just joins the data sources as in joins.
 Association keeps the relation between the data sources visible and not
concealed as in joins.
 What are the restrictions for using the AMDP class?
 AMDP doesn’t support the parameter type RETURNING. You can only pass
importing, exporting and changing parameters into the AMDP class.
 In AMDP class the parameters must be passed by value as pass-by reference
parameters are not allowed.
 Only structures, variables, and normal internal tables can be passed using AMDP
classes. Complex tales like nested tables as tables in tables cannot be passed.

ODATA (Open Data Protocol)


 What is OData ?
 OData is an Open Data Protocol.OData is an Open Data Protocol.
 It is an Open web Protocol started by Microsoft to expose data using
existing web technologies.
 This is based on the REpresentational State Transfer (REST) full
architecture.
 HTTP, Atom Pub (Similar to RSS, but specifically introduced in a special
XML format for ODATA), JSON all are supported.
 This protocol enables the clients to publish and manipulate the resources
identified by URIs and defined in the Data model using HTTP messages.
Server hosts the data and clients can call this service to retrieve the
resources and manipulate them. Servers expose one or more endpoints
which are services that refer to the resources. Clients need to know the
server-side endpoints to call this service to query or manipulate the data.
The protocol is HTTP based and it is designed with a RESTful mindset
which means it follows the constraints to be called as RESTful services.
 Since the protocol is HTTP based, any programming language with an
HTTP stack can be used to consume OData services. Existing client-side
libraries can be used to transform the JSON or ATOM Payloads from the
server into objects making programming simple. On the other hand, many
libraries exist on the server side to generate the payloads in ATOM or
JSON from the existing data.
 It is important to note that both client side and server-side development
can be in completely different programming languages till the time both
are able to communicate via HTTP.
 Clients consume the services to query and manipulate the data from
OData services and are also called Consumers of OData services.
Similarly, servers that expose the OData services via endpoints are known
as procedures of OData Services.
 OData is Open Data Protocol. The protocol is a set of rules which every
payer has to follow. To Put is straight OData interface is an Open Standard
that can be consumed by any application, program, software or device of
the Non-SAP that can connect SAP using the HTTP(s) Protocol and can
manipulate (Read, Write, Modify, Understand, i.e. parse and construct) an
XML document.Since the protocol is HTTP based.Any programming
language can be used for consuming OData services.
 What are OData Advantages ?
 OData is based on the rest of the architecture. So, we can retrieve data based
on an URL.
 It also supports HTTP. Atom Pub as well as JSON format.
 It has support for any type of data source. You can use a custom class to use a
data source.
 No need to create a proxy service object. So, it is lightweight to use.
 You can create your own custom methods and expose it.
 Since it is lightweight the interaction between server and client is fast. Thus,
Performance is good.
 It offers full CRUD support by using the different HTTP methods.
 GET: - Gets one or many entries.
(“GET is the HTTP method for all external consumer applications which calls
the URI of OData services.”)
 POST: - Creates a new entry.
 PUT: - Updates an existing entry.
 DELETE: - Remove an entry.
 A WCF (Windows Communication Foundation) Data service can expose an
entity model via URI (Uniform Resource Identifier).
 A WCF Data service could be consumed by any type of client like Windows,
Silver light, Web, AJAX and console.
 The OData interface is implemented using XML and JSON format. Both of these
formats are well known, Plain text protocols for the transmission of the
information over the web.
 The OData message is self-describing. So, any non-SAP Web developer can
understand the content of an OData message without having knowledge of ABAP
or how Sap works.
 With the advent of OData, the communication barrier between SAP and non-SAP
web developers is removed.
 It is an Open Book now. There is no cost or license agreement needed for the
use of OData.
 NOTE: - Many organizations have now started exposing data using REST based
service however, it is very difficult to write an application which works with
multiple data sources as each provider will expose the data in a slightly different
way. The OData service provider can expose its services along with metadata
which contains the semantics for consumption. OData exploits the common
formats like XML, ATOM and JSON for communication which are commonly
understood. Clients can now understand the OData services using generic tools
and can combine information from multiple data sources.
 Whenever you find a question mark “?”, You should understand, it is the
beginning of a query option.
 What are OData Disadvantages ?
 Since It is purely URL (Uniform Resource Locator) Based. It is less secure.
 As per the observations, not every query in LINQ (language Integrated Query) is
available in OData like filter, skip, take etc.
 The Project OData service is created with four subfolders. Data Model, Service
Implementation Runtime Artifacts, Service Maintenance. Data model further has
three folders which are entity types, entity sets and association.
 Entity type is our very own structure, same as the work area in the se38 custom
program. (Just one row which means it can hold only single data) Entity set is the
same as internal tables (Which can handle more data).
 What is the system alias ?
 The system alias is the result of the routing for an inbound request on the SAP
gateway. If that system alias is flagged as a local SAP Gateway Instance, it
means that the system responsible for processing (managing and storing) The
data of an inbound request is the local SAP gateway instance itself.
 How to get the URL for an expanded entity?
 <Parent Node> <$EXPAND> <NAVIGATION NAME> <PARAMETER>.
 What is a $batch?
 Batch requests allow grouping multiple operations into a single HTTP Request
Payload.
 Batch requests are submitted in a single HTTP POST request to the $batch
endpoint of a service as described in [OData-URI.]
 How do I get an expanded entity?
 We have to associate the parent entity with the child entity and we have to define
the relationship with the key field.
 What are the CRUD Operations in OData ?
 The Open Data Protocol (OData) includes standard CRUD (Create, Retrieve, Update,
and Delete) operations that map to the HTTP methods POST, GET, PUT/MERGE, and
DELETE.
 Why did SAP need OData?
 OData is used to define best practices that are required to build and consume RESTful
APIs. It helps you to find out changes, defining functions for reusable procedures and
sending batch requests etc. OData provides a facility for extension to fulfill any custom
needs of your RESTful APIs.
 What is the use of associations and navigations in ODATA?
 OData allows us to create associations between the Entity Types to show how they relate
to each other. One another. Once an association is defined, we can create Navigation
Paths. The purpose of a Navigation Path is to allow the user to navigate from one side of
an association to the other.
 What is a Function Import??
 Function Imports are actions like the release of a sales order/purchase order executed in the
back-end system. They can be used whenever the given requirement does not fit into the
CRUD-Q operations. They are defined at the service level and you can have N number of
function import functions.
 Tcodes for OData
 SEGW - Gateway Service
 /IWFND/MAINT_SERVICES - Service Maintain
 /IWFND/ERROR_LOG - Check the error log
 /IWFND/VIEW_LOG - View the log
 /IWFND/GW_CLIENT - Gateway client
 /IWFND/V4_REGISTER - For Register
 Explain some methods in OData.
 Create entity : - create entity is used for inserting the new records into the system.
 Get entity :- get entity is used for fetching the only one record. It works like a structure.
 Get entityset :- Get entityset is used for fetching more than one record. It works like an
internal table.
 Update entity:- update entity is used for updating the existing records.
 Delete entity:- delete entity is used to delete the record.
 Create stream:- create stream is used for uploading the excel file, notepad file into the
backend system. The prerequisite is I need to tick mark the media into the entity types.
 Get Stream :- Get Stream is used for reading the excel file or notepad file.
 Get Expanded Entity Set :- Get Expanded entity set is used for reading the multiple
header data and multiple item data.
 Get Expanded entity :- Get Expanded entity is used for reading single header data and
multiple item data.
 ODATA SERVICE LIFE CYCLE.
 Activation of OData service.
 Maintaining OData service.
 Maintaining models and services, up to the cleanup of the metadata cache.
 RESTful applications use HTTP requests to post data to create or update, read
data and delete data. REST uses HTTP for all four CRUD
(Create/Read/Update/Delete) operations.
 REST is a lightweight alternative to mechanisms like RPC (Remote Procedure
Calls) and Web Services.
 In which method can I apply business logic ?
 Whenever the code is required, we need to code into the DPC_EXT method
because whenever I make some changes in the services and then I generate
them again then the DPC code is refreshed.
 In which method can I apply Annotation ?
 Whenever I need to apply annotation, the search helps then I will do it in
MPC_EXT.
 What is creating a deep insert?
 When there are two or multiple entity sets in the ODATA services and the user
wants to fire only one service call which then creates or pursues data of multiple
entity sets together then it can be defined as deep insert.
SE38 Briefings::
1) What are Internal Tables and Work areas?

Internal Tables Work Areas


 Temporary memory locations which are  Temporary memory locations which
used to store the data of database table. are used to store the data of database
 Internal table is an instance of database table.
table.  Work area is an instance of database
 By default, 8kb memory will be allocated table.
and it increases dynamically (+8kb +8kb).

Internal tables can store multiple records. Work areas can store only one record.
Syntax: Syntax:
DATA: <ITAB> TYPE TABLE OF DATA: <WA> TYPE <DBTABLE>.
<DBTABLE>.

Internal Table declaration

DATA: <ITAB> TYPE TABLE OF <DBTABLE>.

Example:
DATA: IT_ITAB TYPE TABLE OF MARA.

An internal Table declaration with user defined types

DATA: <ITAB> TYPE TABLE OF <userdefinedtype>.

Example: TYPES: BEGIN OF TY_TABLE,


MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
END OF TY_TABLE.
<br>

DATA: IT_ITAB TYPE TABLE OF TY_TABLE.

Internal Table Deceleration Old Syntax (Obsolete Method)

Obsolete Syntax: DATA: IT_ITAB TYPE TABLE OF MARA occurs 0 with header line.
2) Internal Table Operations in SAP ABAP?
1. Append: - It is use to add a single record from Work area to Internal table.
The record is always added at bottom.

Syntax: APPEND <WA> TO <ITAB>.

Example:
DATA: IT_MARA TYPE TABLE OF MARA.
DATA: WA_MARA TYPE MARA.
WA_MARA-MATNR = '00001'.
WA_MARA-MTART = 'FERT'.
WA_MARA-MEINS = 'EA'.

APPEND WA_MARA TO IT_MARA. "APPEND WORK AREA TO INTERNAL TABLE

2. INSERT: - It is used to insert or add a record from work area into internal table at
the specified location.
Syntax: INSERT <WA> INTO <ITAB> INDEX <index>.

Example:
DATA: IT_MARA TYPE TABLE OF MARA.
DATA: WA_MARA TYPE MARA.
WA_MARA-MATNR = '00001'.
WA_MARA-MTART = 'FERT'.
WA_MARA-MEINS = 'EA'.

INSERT WA_MARA INTO IT_MARA INDEX 2. "The record will be inserted into
internal table at 2nd position

3. SORT: - It is used to sort the data of internal table in Ascending / Descending


Order.
By default, it is Ascending Order.
Syntax1: SORT <ITAB>. "Default sorts data in ascending order
Syntax2: SORT <ITAB> DESCENDING. " Sort in descending order
Syntax3: SORT <ITAB> BY <FIELD1> <FIELD2...ASCENDING/DESCENDING.” It
sorts data by specified fields <FIELD1>, <FIELD2>..

4. DESCRIBE TABLE: - It is used to count the no of records in an internal table.


Syntax: DESCRIBE TABLE <ITAB> LINES <Variable >. " Count the no. Of record of an
internal table,
5. READ TABLE WITH KEY (BINARY SEARCH): - It is used to read a single record
from an internal table into work area specified by field, field value.
Syntax: READ TABLE <ITAB> INTO <WA> WITH KEY <FIELD1> = <FIELD1
VALUE> <FIELD1> = <FIELD1 VALUE>
BINARY SEARCH. " Read a record into work area where some field = some value

Example:
READ TABLE IT_MARA INTO WA_MARA WITH KEY MATNR = '0001' BINARY
SEARCH. "Read a record into work area where MATNE is '0001'

6. READ TABLE WITH INDEX: - It is used to read a single record from an internal
table into work area specified by index no.
Syntax: READ TABLE <ITAB> INTO <WA> INDEX <index no>. " Read a record into
work area using index (position)

Example:
READ TABLE IT_MARA INTO WA_MARA INDEX '2'. "Read a record into work area
where index is 2.

7. Loop...End loop: - It is used to read data from an internal table into work
area, this is used to read multiple records serially one after one.
Syntax1: LOOP AT <ITAB> INTO <WA>.

ENDLOOP.

Syntax2: LOOP AT <ITAB> INTO <WA> WHERE <FIELDS1> =

<VALUE>.

ENDLOOP.

Syntax3: LOOP AT <ITAB> INTO <WA> FROM <INDEX1> TO

<INDEX2>.

ENDLOOP.
8. MODIFY: It is used to modify a single or multiple internal table records based on
condition.

TRANSPORTING: - It is a keyword which is used to specify a list of fields to be modified


instead of all fields.
Syntax 1: MODIFY <ITAB> FROM <WA> INDEX <INDEX NO> TRANSPORTING
<FIELD1> <FIELD2>.

Syntax 2: MODIFY <ITAB> FROM <WA> TRANSPORTING <FIELD1>


<FIELD2> WHERE <CONDITION>.
SY-TABIX is a key word which stores the index no of currently processed record.

Example:
DATA: IT_MARA TYPE TABLE OF MARA.
DATA: WA_MARA TYPE MARA.

SELECT * FROM MARA INTO TABLE IT_MARA. " GET DATA INTO ITAB
IT_MARA.

WA_MARA-MTART = 'FERT'; "ASSIGN A VALUE TO WORKAREA TO MODIFY


INTERNAL TABLE.

MODIFY IT_MARA FROM WA_MARA INDEX SY-TABIX TRANSPORTING MTART.


" NOW THE VALUE OF FIELD MTART WILL BE MODIFIED FOR CURRENT
RECORD IN IT_MARA.

DATA: IT_MARA TYPE TABLE OF MARA.


DATA: WA_MARA TYPE MARA.

SELECT * FROM MARA INTO TABLE IT_MARA. " GET DATA INTO ITAB
IT_MARA.

WA_MARA-MTART = 'FERT'; "ASSIGN A VALUE TO WORKAREA TO MODIFY


INTERNAL TABLE

MODIFY IT_MARA FROM WA_MARA TRANSPORTING MTART WHERE MATNR =


'0001'. " NOW THE VALUE OF FIELD MTART WILL BE MODIFIED WHERE
MATNR = '0001' IN ITAB.

9. DELETE: - It is used to delete single or multiple records from an internal table


from work area based on some condition.
Syntax1: DELETE <ITAB> INDEX <INDEX NO>.

Syntax2: DELETE <ITAB> WHERE <FIELD1> = <FIELD1 VALUE>


<FIELD2> = <FIELD2 VALUE>.
Example:
DELETE IT_MARA INDEX 3. "3rd RECORD WILL BE DELETED IN IT_MARA.

DELETE IT_MARA WHERE MTART = 'FERT'. "MATERIALS WITH MTART = 'FERT'


WILL BE DELETED.

10. DELETE ADJACENT DUPLICATES: -It is used to delete duplicate records which are
adjacent to each-other.
Pre-requisite for this is the internal table must be sorted in ascending order
Syntax 1: DELETE ADJACENT DUPLICATED FROM <ITAB>. "ADJACENT
DUPLICATED WILL BE DELETED IN INTERNAL TABLE COMPARING ALL
FIELDS.

Syntax 2: DELETE ADJACENT DUPLICATES FROM <ITAB> COMPARING <FIELD1>


<FIELD2>. "ADJACENT DUPLICATES WILL BE DELETED COMPARING
SPECIFIED FIELDS.

Example:
1. SORT IT_MARA ASCENDING.
DELETE ADJACENT DUPLICATES FROM IT_MARA. "3rd RECORD WILL BE
DELETED IN IT_MARA.

2. SORT IT_MARA ASCENDING.


DELETE ADJACENT DUPLICATES IT_MARA COMPARING MATR, MTART.
"DUPLICATES WILL BE DELETED BY COMPARING MATNR AND MTART.

11. CLEAR: - It is used to delete the data from in a work area or in a variable.
12. REFRESH: - It is used to delete the data from in an internal table.
13. FREE: - It is used to clear (free) memory of an internal table or work area. We
all know whenever we declare an internal table or work area, 8kb memory will be
allocated.
Syntax CLEAR: CLEAR <WA>."CLEAR WORK AREA OR VARIABLE

Syntax REFRESH: REFRESH <ITAB>. "CLEAR ALL RECORDS OF INTERNAL


TABLE BUT MEMORY WILL BE THERE.

Syntax FREE: FREE <WA>. “FREE INTERNAL TABLE MEMORY CLEAR


WA_MARA.

REFRESH IT_MARA.

FREE IT_MARA.
14. APPEND LINES OF: - It is used to append multiple records to an internal table
from another internal table.
Syntax: APPEND LINES OF <ITAB1> FROM <index no> TO <index no2> TO <ITAB2>.

Example:
DATA: IT_MARA TYPE TABLE OF MARA. "FIRST INTERNAL TABLE
DATA: IT_MARA1 TYPE TABLE OF MARA. "SECOND INTERNAL TABLE

APPEND LINES OF IT_MARA FROM 3 TO 5 TO IT_MARA1. "DATA IN IT_MARA


WILL BE APPENDED TO IT_MARA1 FROM INDEX 3 TO INDEX 5.

15. INSERT LINES OF: - It is used to INSERT multiple records to an internal table
from another internal table at the specified location.
Syntax: INSERT LINES OF <ITAB1> FROM <index no> TO <index no2> INTO
<ITAB2> INDEX <index no>.

Example:
DATA: IT_MARA TYPE TABLE OF MARA. "FIRST INTERNAL TABLE
DATA: IT_MARA1 TYPE TABLE OF MARA. "SECOND INTERNAL TABLE

INSERT LINES OF IT_MARA FROM 3 TO 5 INTO IT_MARA1 INDEX 3. "DATA IN


IT_MARA WILL BE INSERTED INTO IT_MARA1 FROM INDEX 3 TO INDEX 5 AT
INDEX 3 LOCATION.

16. MOVE: - Move keyword is used to move one internal table data to another.
Syntax: <ITAB1[]> = <ITAB2[]>. "Move ITAB1 to ITAB2

17. COLLECT:-It is slimier to APPEND, the difference is it (COLLECT) will check


whether the work area record already exists with the same key (only C, D, N, T),
if exists it will add numerical fields (sum) to the existing record, if the work area
record does not exist it will append a new record.
Syntax: COLLECT <WA> INTO <ITAB>.

3) System Variables?
System Variables are filled by the ABAP run-time environment and can be used in an
ABAP program to query system statuses in run-time.

Name Type Length Content


sy-mandt c 3 Client ID used by the current user to log on, for example "401" or "800".
sy-subrc i - It is a store the return code of on open sql.
If sy-subrc=0: - It means the operation is success successfully Executed.
If sy-subrc<>0: - It means the operation is Failed.
sy-dbcnt i - It is storing the no. of records successfully Processed.
4) Select Statements Type?
1. Select Single and Select up to 1 rows: -
SELECT SINGLE SELECT UP TO 1 ROWS
Used to read exact record from database table Used to read appropriate record from
database table.
To read exact record from database table we We can read appropriate record from
need to provide all key fields. database table; we may not need to provide
all key fields.
This statement should be used only if all the This statement should be used only if we
key fields are available. have some key fields or no key fields.
This is very fast when compared to SELECT This is slow.
UPTO
Syntax: - SELECT SINGLE * FROM Syntax: - SELECT SINGLE * FROM
DATABASE INTO WA ALL KEY DATABASE INTO WA UP TO 1 ROWA
FIELDS. WHERE ALL KEY FIELDS.

ENDSELECT.
EXAMPLES: -

Example SELECT SINGLE


DATA: WA_MARA TYPE MARA. " Declare work area

SELECT SINGLE
matnr ersda mtart mbrsh matkl meins
FROM MARA INTO WA_MARA
WHERE matnr in s_matnr. "Read sigle or exact record from MARA table
WRITE: / wa_mara-matnr, wa_mara-ersda,
wa_mara-mtart, wa_mara-mbrsh,
wa_mara-matkl, wa_mara-meins."Print data to screen

Example SELECT UPTO


DATA: WA_MARA TYPE MARA. " Declare work area

SELECT * FROM MARA INTO WA_MARA UP TO 1 ROWS WHERE MTART = 'FERT'.


" Read appropriate record from MARA table here MTART is not a key field.

ENDSELECT.

We can read multiple records using SELECT UPTO

DATA: IT_MARA TYPE TABLE OF MARA. " Declare internal table


DATA: WA_MARA TYPE MARA. " Declare work area
SELECT matnr mtart meins
UP TO 3 ROWS FROM mara
INTO TABLE it_mara
WHERE matnr in s_matnr. "Read 3 appropriate records from MARA table here MTA
RT is not a keyfield

LOOP AT IT_MARA INTO WA_MARA.


write :/ wa_mara-matnr, wa_mara-mtart, wa_mara-meins. " Print data to screen
ENDLOOP.

2. Select with join.


It is used to read data simultaneously from multiple database tables.
Syntax:

SELECT T1~FIELD1
T1~FIELD2
T2~FIELD1
T2~FIELD2
INTOTABLE
FROMT1INNERJOINT2ON(T1~FIELD1=T2~FIELD)
WHERET1~FIELD=.

** Here T1 and T2 are database tables, FIELD1 and FIELD2 are fields in the respective
tables
Example of using SELECT JOINS in SAP ABAP

**DATA DECLERATIONS
TYPES: BEGIN OF T_MARA,
MATNR LIKE MARA-MATNR, “FIELD1 FROM MARA TABLE
MTART TYPE MARA-MTART, “FIELD2 FROM MARA TABLE
MAKTX TYPE MAKT-MAKTX, “FIELD1 FROM MAKT TABLE
SPRAS TYPE MAKT-SPRAS, “FIELD2 FROM MAKT TABLE
END OF T_MARA.

DATA: IT_MARA TYPE TABLE OF T_MARA.


DATA: WA_MARA TYPE T_MARA.
SELECT MARA~MATNR
MARA~MTART
MAKT~MAKTX
MAKT~SPRAS
INTO TABLE IT_MARA
FROM MARA INNER JOIN MAKT ON (MARA~MATNR = MAKT~MATNR)
UP TO 50 ROWS.

LOOP AT IT_MARA INTO WA_MARA.


WRITE: / WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MAKTX,
WA_MARA-SPRAS.
ENDLOOP.

3. Select for all entries.


It is the best alternative for SELECT WITH JOINS, this statement is very helpful for
reading data from more than 2 tables.
The load on database will be very less.
Syntax:

SELECT <FIELDS> FROM <DBTABLE1> INTO TABLE <ITAB1>


WHERE <CONDITION>.
SELECT <FIELDS> FROM <DBTABLE2> INTO <ITAB2> FOR ALL ENTRIES IN
<ITAB1>
WHERE <FIELD1> = <ITAB1>-FIELD1.
**HERE WE ARE READING DATA 2 DATABASE TABLES, SEE WHERE
CONDITIONS OF SECOND SELECT STATEMENT
Note: - Ensure before using SELECT FOR ALL ENTRIES

 Parent internal table must not be empty (If it is empty, where condition fails and it will
get all records from database).
 Remove all duplicate entries in parent internal table.

Here is the example of using SELECT FOR ALL ENTRIES in real-time applications

DATA: it_mara TYPE TABLE OF mara,


wa_mara TYPE mara.
DATA: it_makt TYPE TABLE OF makt,
wa_makt TYPE makt.
SELECT *
FROM mara
INTO TABLE it_mara
WHERE mtart = 'FERT'.
IF it_mara IS NOT INITIAL.
SELECT *
FROM makt
INTO TABLE it_makt
FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr.
ENDIF.
4. Select into corresponding fields.
Select into corresponding is used to get data from a database table into a user defined
internal table or work area without specifying the list of fields.
Syntax: SELECT * FROM <DATABASE TABLE>
INTO CORRESPONDING FIELDS OF TABLE <INTERNAL TABLE>.
As per SAP standards select into corresponding statement is not advisable as it affects
the performance of an application because it has to compare each field with database.
Example using select into corresponding
The below example explains how to use select into corresponding statement to get data into
a database table without specifying list of fields in select statement.
REPORT ZSAPN_SELECT_CORRESPONDING.
TYPES: BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MEINS TYPE MARA-MEINS,
END OF TY_MARA. "USER DEFINED TYPE WITH FOUR FIELDS.

DATA: IT_MARA TYPE TABLE OF TY_MARA. "INTERNAL TABLE FOR USER


EFINED TYPE
DATA: WA_MARA TYPE TY_MARA. "WORK AREA FOR USER DEFINED TYPE
SELECT * FROM MARA
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
UP TO 50 ROWS.
LOOP AT IT_MARA INTO WA_MARA.
WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MBRSH,
WA_MARA-MEINS. "DISPLAY OUTPUT
ENDLOOP.

5. Select distinct.
SELECT DISTINCT is a SQL Select query, which is used to get distinct values of a column
from a database table.
SELECT DISTINCT eliminates duplicates records of a column of a table.
Syntax for SELECT DISTINCT in SAP ABAP
SELECT DISTINCT <COLUMN> FROM <TABLE> INTO TABLE <ITAB> WHERE
<CONDITION>.
Example for SELECT DISTINCT in SAP ABAP
The below example is used to get distinct MTART (Material type) from MARA (Material
Master) table.
TYPES: BEGIN OF ty_mtart,
mtart TYPE mara-mtart,
END OF ty_mtart.
DATA: it_mtart TYPE TABLE OF ty_mtart,
wa_mtart TYPE ty_mtart.
START-OF-SELECTION.
SELECT DISTINCT mtart FROM mara INTO TABLE it_mtart UP TO 5 ROWS.

LOOP AT it_mtart INTO wa_mtart.


WRITE:/ wa_mtart-mtart.
ENDLOOP.

6. Select Appending.
SELECT APPENDING query is used to append SELECT query result directly to some
other internal table.

SELECT <FIELD1> <FIELD2>


from <DATABASE_TABLE>
APPENDING TABLE <ITAB>
WHERE <FIELD> = <COND_VALUE>.
Note: Where condition is optional in SELECT Query
Below is the complete example program, in the below program, we will use select appending
to append records to same internal table.

TYPES: BEGIN OF ty_mara,


matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF ty_mara.
DATA: it_mara TYPE TABLE OF ty_mara.
DATA: wa_mara TYPE ty_mara.
**Get first 10 records from MARA where MTART = FERT
SELECT matnr mtart
FROM mara
INTO TABLE it_mara
UP TO 10 ROWS
WHERE mtart = 'FERT'. **Get 10 reords from MARA where MTART = HALB append
them to same internal table

SELECT matnr mtart


FROM mara
APPENDING TABLE it_mara
UP TO 10 ROWS
WHERE mtart = 'HALB'.

LOOP AT it_mara INTO wa_mara.


WRITE:/ wa_mara-matnr, wa_mara-mtart.
ENDLOOP.

7. Select with BYPASSING BUFFER.


Whenever we use open SQL statements to get fetch data in SAP, it will get data from buffer
area(depends on table buffer settings) for better performance, but in real world scenarios
some tables may updated very frequently(milliseconds), we may need to bypass buffer to
get real-time data, in that case we will bypass buffer using 'BYPASSING BUFFER'
keyword.
Syntax for SELECT WITH BYPASSING BUFFER in SAP ABAP
select * FROM <TABLE> INTO TABLE <ITAB> BYPASSING BUFFER.

Example for SELECT WITH BYPASSING BUFFER in SAP ABAP


The below example is used to fetch data from MARA (Material Master) table bypassing
buffer.
TYPES: BEGIN OF ty_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
END OF ty_mara.
DATA: it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara.

START-OF-SELECTION.
SELECT matnr mtart FROM mara INTO TABLE it_mara BYPASSING BUFFER.

LOOP AT it_mara INTO wa_mara.


WRITE:/ wa_mara-matnr, wa_mara-mtart.
ENDLOOP.

5) Selection Screen?
1. Selection- screen Parameters.
PARAMETERS statement is used to create a single input field, check box, radio buttons
on the selection screen.

Syntax:
PARAMETERS <P_NAME> TYPE <TABLE-FIELD>. " General parameter for a
input field

PARAMETERS <P_NAME> TYPE <TABLE-FIELD> OBLIGATORY. "Parameter for


mandatory input field

PARAMETERS <P_NAME> AS CHECKBOX. " Parameter for check box printing

PARAMETERS <P_NAME1> RADIOBUTTONGROUP <RADIOBUTTON GROUP>.


" Print Radio button group
PARAMETERS <P_NAME2> RADIOBUTTONGROUP <RADIOBUTTON GROUP>.
" Print Radio button group
PARAMETERS <P_NAME2> RADIOBUTTONGROUP <RADIOBUTTON GROUP>.
" Print Radio button group
Examples of using parameters in SAP ABAP
PARAMETERS: P_MATNR TYPE MARA-MATNR.
The above statement prints a input field on selection-screen like below.

PARAMETERS: P_CHK AS CHECKBOX.


The above statement prints a check box on selection-screen like below.

**Radiobutton group is nothing but a group of radiobuttons


PARAMETERS: P_RADIO1 RADIOBUTTON GROUP RG1.
PARAMETERS: P_RADIO2 RADIOBUTTON GROUP RG1.
PARAMETERS: P_RADIO3 RADIOBUTTON GROUP RG1.
The above statement prints a radio button group on selection-screen like below.

2. Select-options.
Select-Options is statement which is used to define two input fields so that users can enter a
range of values, Select-Options have below additional features.

 Accepts multiple single values.


 Accepts multiple ranges (ex: 001-020, 025-30).
 Accepts exclusion of values (ex: Exclude 0004, 007 etc).
 Accepts exclusion of ranges.

Syntax 1: SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD>. "THIS PRINTS


TWO INPUT FIELDS (RANGE) WITH EXTENSION TO ENTER MULTIPLE
RANGES

Syntax 2: SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO INTERVALS.


"THIS PRINTS ONE INPUT FIELD WITH EXTENSION\
Syntax 3: SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO-EXTENSION.
"THIS PRINTS TWO INPUT FIELDS WITH OUT ANY EXTENSION (CAN NOT
ENTER MULTIPLE RANGES)

Syntax 4: SELECT-OPTIONS <SO_NAME> FOR <TABLE-FIELD> NO INTERVALS NO-


EXTENSION. “THIS PRINTS ONE INPUT FIELD WITH OUT INTERVALS AND
EXTENSIONS
Select-Options functionality in SAP ABAP
Whenever we declare Select-Options, an internal table will be created with the following fields.

 SIGN: This field contains I or E, where I stands for an inclusive (Include that value)
and E stands for exclusive (Exclude that values), default value is I.
 OPTIONS: This field can accept values BT (Between), NB (Not Between), EQ
(Equal), NE (Not equal), GT (Greater than), LT (Less than).
 LOW: This field stores a low value of entering the range.
 HIGH: This field stores a high value of entering the range.

Select-Options design

TABLES MARA. "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-
OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR. "PRINT SELECT-OPTIONS ON
SCREEN
The above statement prints a select-options with intervals and extension.

TABLES MARA. "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-
OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO INTERVALS. "PRINT
SELECT-OPTIONS ON SCREEN
The above statement prints a select-options with no intervals.

TABLES MARA. "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-
OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO-EXTENSIONS. "PRINT
SELECT-OPTIONS ON SCREEN
The above statement prints a select-options without extension.

TABLES MARA. "SPECIFY TABLE FOR WHICH YOU ARE CREATING SELECT-
OPTIONS
SELECT-OPTIONS S_MATNR FOR MARA-MATNR NO-EXTENSION NO INTERVALS.
"PRINT SELECT-OPTIONS ON SCREEN
The above statement prints a select-options without intervals and without extensions.

3. Drop Down box in Selection Screen.


Type - pool: - It is a data dictionary object which contains all the reusable user-defined types.
TYPE-POOLS is a keyword which is used to assign the type-group to an ALV report.

 Sometimes we may need to print drop down on selection-screen, and need to catch the
selected value for execution logic, the below example will explain how to use drop-down
in selection-screen in SAP ABAP.
 To display drop down list we have to use type-group VRM as type-pools.

REPORT ZSAPN_DROP_DOWN_SS.

TYPE-POOLS: VRM. " Use type group VRM for list


DATA: IT_LIST TYPE VRM_VALUES.
DATA: WA_LIST TYPE VRM_VALUE.
DATA: IT_VALUES TYPE TABLE OF DYNPREAD,
WA_VALUES TYPE DYNPREAD.

DATA: LV_SELECTED_VALUE (10) TYPE C.


*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
PARAMETERS: COLORS TYPE C AS LISTBOX VISIBLE LENGTH 20. "Parameter
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION. "initialize values to drop down list
WA_LIST-KEY = '1'.
WA_LIST-TEXT = 'Green'.
APPEND WA_LIST TO IT_LIST.
WA_LIST-KEY = '2'.
WA_LIST-TEXT = 'Blue'.
APPEND WA_LIST TO IT_LIST.
WA_LIST-KEY = '3'.
WA_LIST-TEXT = 'Orange'.
APPEND WA_LIST TO IT_LIST.
WA_LIST-KEY = '4'.
WA_LIST-TEXT = 'Gray'.
APPEND WA_LIST TO IT_LIST.
WA_LIST-KEY = '5'.
WA_LIST-TEXT = 'White'.
APPEND WA_LIST TO IT_LIST.
WA_LIST-KEY = '6'.
WA_LIST-TEXT = 'Yellow'.
APPEND WA_LIST TO IT_LIST.

CALL FUNCTION 'VRM_SET_VALUES'


EXPORTING
ID = 'COLORS'
VALUES = IT_LIST
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.

*--------------------------------------------------------------*
*At Selection Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN ON COLORS.
CLEAR: WA_VALUES, IT_VALUES.
REFRESH IT_VALUES.
WA_VALUES-FIELDNAME = 'COLORS'.
APPEND WA_VALUES TO IT_VALUES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = IT_VALUES.

READ TABLE IT_VALUES INDEX 1 INTO WA_VALUES.


IF SY-SUBRC = 0 AND WA_VALUES-FIELDVALUE IS NOT INITIAL.
READ TABLE IT_LIST INTO WA_LIST
WITH KEY KEY = WA_VALUES-FIELDVALUE.
IF SY-SUBRC = 0.
LV_SELECTED_VALUE = WA_LIST-TEXT.
ENDIF.
ENDIF.
*--------------------------------------------------------------*
*Start of Selection
*--------------------------------------------------------------*
START-OF-SELECTION.
WRITE:/ LV_SELECTED_VALUE.

4. Selection Text
Selection texts are texts which are used to replace technical field names on selection-screen
with custom names.

In real-time business no business user (end user) can understand technical names, they just use
the applications for the business, whenever we print a input field on selection-screen, we get
technical field names by default.
PARAMETERS: P_MTART TYPE MARA-MTART. "material type input
The above code will generate below screen
But we need to replace P_MTART with our custom name, follow the below steps to change
technical name.

Go to Program Source, Select Go to-Text Elements-Selectin Texts

Replace question mark with your custom text.


In the same way you can replace radio button text, selection-options text, parameters text etc.
5. Radio Buttons.
Radio Button Group: is a group of radio buttons, one radio button can be selected in on radio
button group. To print radio button in SAP screen we use below syntax.
PARAMETERS: <RADIO> RADIOBUTTON GROUP <GROUP>.
Example program of using Radio Button in SAP
The below is the example of using radio button in SAP, the below code prints two radio
buttons. Select and Execute for testing.

REPORT ZSAPN_RADIO_BUTTON.

PARAMETERS: P_RAD1 RADIOBUTTON GROUP RB1.


PARAMETERS: P_RAD2 RADIOBUTTON GROUP RB1.

START-OF-SELECTION.
IF P_RAD1 = 'X'.
WRITE:/ 'Radio Button1 is selected '.
ELSEIF P_RAD2 = 'X'.
WRITE:/ 'Radio Button2 Is selected'.

ENDIF.

6. Check Box.
Check Box: It is a selectable input box. For printing check box in SAP screen, we use below
syntax.
PARAMETERS: <CHK> AS CHECKBOX.
Whenever we select (check) a check box, the value 'X' will be stored in it.
An example program of using check box in SAP
The below is the example of using radio button in SAP, the below code prints a check box on
the selection screen. Select and Execute for testing.
REPORT ZSAPN_CHECK_BOX.

PARAMETERS: P_CHK AS CHECKBOX.


START-OF-SELECTION.
IF P_CHK = 'X'.
WRITE:/ 'Check box is selected'.
ELSE.
WRITE: / 'Check Box is not selected'.
ENDIF.

7. Selection Screen of block: -


It is created block for single or multiple fields.
Example: --
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
"designs a block just for design double click on TEXT-001 to add text

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. " Material range input


PARAMETERS: P_MTART TYPE MARA-MTART. "material type input

SELECTION-SCREEN END OF BLOCK B1.

6) Modularization Techniques?
The concept of modularization is dividing the main program into sub-programs for better
readability and re-usability.
Modularization can be implemented in the following ways.

 Include Programs.
 Function Modules.
 Sub-routines.
 Classes.
 MACRO`s (Use in HR ABAP only).

 Include Programs:

 These are sub-programs which contains a set of re-usable statements.


 These programs cannot be executed directly.
 These include programs must be embedded inside a main program for execution.
 These programs don’t contain parameter interface, that is no importing and exporting
parameters.

Syntax: INCLUDE <include name>.


Example of using include programs:
TYPES: BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MBRSH TYPE MARA-MBRSH,
END OF TY_MARA. <br>
DATA: IT_MARA TYPE TABLE OF TY_MARA.
DATA: WA_MARA TYPE TY_MARA.
SELECT MATNR, MTART, MEINS, MBRSH FROM MARA INTO TABLE IT_MATA.
LOOP AT IT_MARA INTO WA_MARA.

WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARA-


MTART.
ENDLOOP.
To make the above program with includes, follow below steps.

INCLUDE ZDATA_DECLERATIONS. "DOUBLE CLICK ON


ZDATA_DECLERATIONS AND CREATE A INCLUDE AND ADD DATA
DECLERATIONS AND ACTIVATE
INCLUDE ZMAIN_LOGIC. " DOUBLE CLICK ON ZMAIN_LOGIC, CREATE A
INCLUDE AND ADD THE REMAINING LOGIC (FROM SELECT....TO ....
ENDLOOP).

 Function Modules

 These are also sub-programs which contains set of reusable statements for better
readability and re-usability.
 Function modules contains parameter interface, that is importing and exporting
parameters.
 These Function Modules can be executed independently.
 Function modules contains exceptions to catch certain type of errors.

Examples for Function Modules are: GUI_DOWNLOAD, GUI_UPLOAD.

T-code for Function Module explorer is SE37.

In our next chapters we will learn how to create and use a function module Creating Function
Modules in SAP ABAP.

 Sub-routines in SAP ABAP.

 Sub-routines are also sub-programs in SAP ABAP which contains certain re-usable
statements.
 Most of the times we use sub-routines for re-usability inside the program.
 We may use sub-routines for external re-usability.
 These sub-routines contain importing and exporting parameters.

Syntax:
**DEFINING SUBROUTINE
PERFORM <SUBROUTINE NAME> USING <AV1> <AV2>
CHANGING <CHANGING1> <CHANGING2>
TABLES <TABLE1> <TABLE2>.
**IMPLEMENTING SUBROUTINE
FORM <SUBROUTINE NAME> USING <FV1> <FV2>
CHANGING <CHANGING1> <CHANGING2>
TABLES <TABLE1> <TABLE2>.

ENDFORM.

**IN THE ABOVE SYNTAX <AV1> AND <AV2> ARE ACTUAL PARAMETERS AND
<FV1> <FV2> ARE FORMAL PARAMETERS
We will learn creating and using sub-routines in next chapters Using subroutines in SAP
ABAP.

 Using Classes in SAP ABAP

 Classes are Object Oriented implementations of SAP ABAP.


 Classes are used for better re-usability.

7) What are function Modules?


(https://www.sapnuts.com/courses/core-abap/modularization-in-abap.html)
Function Modules are sub-programs which contains set of re-usable statements with importing,
exporting parameters, exceptions. Unlike include programs Function Modules can be executed
independently.

Function Group in SAP ABAP


Function group is a container of Function modules, every Function Module must be saved in a
Function group. T-codes for Function Modules and Function groups are SE37 OR SE80. We
can save N number of Function Modules in a Function Group.

Components of Function Module:


 Import: These are input parameters of a Function Module.
 Export: These are output parameters of a Function Module.
 Changing: These are parameters which act as importing and exporting parameters to a
Function Module.
 Tables: These are internal tables which also acts as importing and exporting
parameters.
 Exceptions: Exceptions in Function Modules are used to catch certain type of errors.

8) Exception in Function Module?


(https://www.sapnuts.com/courses/core-abap/modularization-in-abap/function-
exceptions.html)
Exceptions: Exceptions are used to catch certain type of errors in Function Modules.
Whenever an exception is raised, it will be caught in system variable SY-SUBRC.

9) Changing and table Parameters in function?


(https://www.sapnuts.com/courses/core-abap/modularization-in-abap/tables-function-
modules.html)

Analysis: As per business a material type can have 'n' number of materials (we have to use
internal tables), so we need to get materials from MARA for a material type input, we have to
use function module tables.

As per SAP, tables in function modules obsolete, instead using them, we can create a table type
in SE11, use it as exporting parameter.

Changing and Tables are parameters of Function Modules.


 Changing: Changing parameter acts as both exporting and importing parameters.
 Tables: These are internal tables which can import and export.

10) Subroutines?

 These are also sub programs, which contains set of re-usable statements for doing some
specific task.
 These are mainly used for re-usability within the same program; however, we can re-
use these Subroutines in other programs too.
 Subroutines contains importing and exporting parameters.
Function Modules V/S Subroutines
The main difference between Function Modules and Subroutines are sub-routines does not
contain any exceptions and Subroutines are mainly used for local modularization whereas
function modules contains exceptions and used for global modularization.

sub-routines have definition and implementation parts.

Syntax: DEFINITION PART:


PERFORM <SUBROUTINE NAME> USING <V1> <V2>
CHANGING <CV1> <CV2>
TABLES <IT1> <IT2>. "DOUBLE CLICK ON SUBROUTINE NAME
TO CREATE

**<V1> <V2> (VARIABLES), <CV1> <CV2> (CHANGING VARIABLES) AND <IT1>


<IT2> (IMPORTING TABLES) ARE ACTUAL PARAMETERS

Syntax IMPLEMENTATION PART


FORM <SUBROUTINE NAME> USING <FV1> <FV2>
CHANGING <FCV1> <FCV2>
TABLES <FIT1> <FIT2>.
ENDFORM.
**<FV1> <FV2>, <FCV1> <FCV2> AND <FIT1> <FIT2> ARE FORMAL
PARAMETERS

11) Subroutines types & Passing values to Sub-routines?

Basically, there are two types of Subroutines in SAP ABAP programming.

I. Local Subroutines.
II. External Subroutines.

 Local Subroutines
These are Subroutines in which definition (perform) and implementation (from) are
available in the same program.
 External Subroutines
Subroutines which contains definition and implementation are available in different
programs are called as external Subroutines. The implemented program must be of type
sub-routine pool.
 Passing values with Subroutines
There are three ways to pass the values with Subroutines.

A. Pass by reference.
B. Pass by value.
C. Pass by value and return.

A. Pass by reference
In this type, the actual and formal parameters are referred to the same memory. If the
formal parameter is changed, the actual parameter is also changed.
PERFORM <PERFORM NAME> USING <A>. "A IS ACTUAL PARAMETER
FORM <PERFORM NAME> USING <F>. " F IS FORMAL PARAMETER

<F> = SOME IMPLEMENTATION


ENDFORM.

B. Pass by Value
In this type, the actual and formal parameters will be referring to separate memory. The
formal parameter is changed, the actual parameter will not be changed.
The key word VALUE () will identify that it is pass by value else it is pass by reference.

PERFORM <PERFORM NAME> USING VALUE (<A>). "A IS ACTUAL PARAMETER


FORM <PERFORM NAME> USING <F>. " F IS FORMAL PARAMETER

<F> = SOME IMPLEMENTATION


ENDFORM.
C. Pass by value and return
In this type, the actual and formal parameters will be referring to separate memories. If the
formal parameter is changed, the actual parameter is also changed after executing the
FORM...ENDFORM.
The key word CHANGING () will identify that it is pass by value else it is pass by reference.

PERFORM <PERFORM NAME> CHANGING VALUE (<A>). "A IS ACTUAL


PARAMETER
FORM <PERFORM NAME> USING <F>. " F IS FORMAL PARAMETER

<F> = SOME IMPLEMENTATION


ENDFORM.

Subroutines statements addition


Addition Method
using v1 Pass by reference
changing v1 Pass by reference
using value(v1) Pass by value
changing value(v1) Pass by value and result
Things to remember before creating Subroutines

 Perform and form must contain the same number of parameters.


 The syntax on the form statement alone determines the method by which a parameter
is passed.
 The 'VALUE ()' addition cannot be used on the perform statement, only be used in
form.
 'USING' must come before changing.
 The addition 'USING' can only occur once in a statement. The same rule applies to
changing.

Passage Method Description Advantages


By reference Passes a pointer to the original memory Very efficient
location.
By value Allocates a new memory location for use Prevents changes to passed
within the subroutine. The memory is variable
freed when the subroutine ends.
By value and Similar to pass by value, but the contents Allows changes and allows a
result of the new memory is copied back into the rollback
original memory before returning.

12) How to reuse Subroutine in SAP ABAP? Using external subroutines in SAP
ABAP?

Step 1: Create a program ZSAPN_SUBROUTINE_REUSE1 and create a perform to get


material details for a material type.
REPORT ZSAPN_SUBROTINE_REUSE1.

DATA: IT_MARA TYPE TABLE OF MARA.


DATA: WA_MARA TYPE MARA.
CONSTANTS: C_MTART TYPE MARA-MTART VALUE 'FERT'. "Constant declaration

PERFORM GET_MATDATA TABLES IT_MARA USING C_MTART. "Perform to get


material data by passing material type

LOOP AT IT_MARA INTO WA_MARA. "Display material


WRITE: / WA_MARA-MATNR, WA_MARA-MTART.
ENDLOOP.
FORM GET_MATDATA TABLES P_IT_MARA TYPE STANDARD TABLE "perform
implementation
"Insert correct name for <...>
USING P_C_MTART.
SELECT * FROM MARA INTO TABLE P_IT_MARA UP TO 50 ROWS WHERE MTART
= P_C_MTART.
ENDFORM. " GET_MATDATA

Step 2: Create another program ZSAPN_SUBROUTINE_REUSE2 and call perform external


program ZSAPN_SUBROUTINE_REUSE1.

The syntax for calling external subroutine is:


PERFORM <PERFORM NAME> (<PROGRAM NAME>) TABLES <TABLES> USING
<PARAMS> CHANGING <PARAMS>.

Example program 2:

REPORT ZSAPN_SUBROTINE_REUSE2.

DATA: IT_MARA TYPE TABLE OF MARA, "material internal table


WA_MARA TYPE MARA. "Work area

CONSTANTS: C_MTART TYPE MARA-MTART VALUE 'HALB'. "Constant

PERFORM GET_MATDATA(ZSAPN_SUBROTINE_REUSE1) TABLES IT_MARA


USING C_MTART. "Calling external subroutine

LOOP AT IT_MARA INTO WA_MARA. "Display data


WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS.
ENDLOOP.
13) What are the differences between Tables and Changing parameters of Function
Modules in SAP?

Changing Parameters Table Parameters


Change parameter can be used for one Tables can only be used for multiple records
record (work area) as well as multiple (internal tables).
records (internal tables).
Can be used for input and output. Can be used for input and output.
Same instance will be changed ex: If you Instance will be copied and make any changes
pass 30 as parameter, if you change that to that, original will not change
inside function, the original variable will
be changed
14) Debugging techniques in SAP ABAP programming?

Debugging is one of the important parts in trouble shooting of an ABAP application, we


can debug ABAP code by using breakpoints.

In SAP Programming there are two kinds of breakpoints.

 Static Breakpoints: These can be set by using statement BREAK-POINT in ABAP


code, these breakpoints are not user specific, these will trigger for every user. We need
to delete these breakpoints manually.
 Dynamic Breakpoints: These breakpoints are user specific; these will trigger for
specific user only. These breakpoints will be deleted automatically when you log-off
from SAP. These can be set in ABAP editor. Dynamic breakpoints can be set in active
(activated) source code only.
Dynamic breakpoints are of two types. External break-point: These is a type of break-point,
which will get activated even for Non-SAP Applications, these breakpoints will be
triggered from SAP or from Non-SAP example from portal screen.
Set it through Utilities - Setting - breakpoints.
Session break-point: This break-point will be activated for call only within SAP system and
its active till the User session is on.

E.g. SE38
These breakpoints have different behaviors in different types of coding blocks ex: Function
Modules, Sub-routines etc.

In this lesson we will discuss the behavior of breakpoints in each.


When we put break-point in some ABAP code, control will stop at the specific place when
executing the ABAP program, then it is debugging mode. We can control debugging using
function keys F5, F6, F7 and F8 or using toolbar buttons in debugging screen.

1. Working with static break point.


Go to SE38, create a program ZSAPN_DEBUGGING, add below code and activate.
REPORT ZSAPN_DEBUGGING.

SKIP.

BREAK-POINT. "Static break-point


Save, activate and execute the program.
2. Working with Dynamic Breakpoint.
Go to SE38, create a program ZSAPN_DEBUG, and add below code
REPORT ZSAPN_DEBUG.

DATA: IT_MARA TYPE TABLE OF MARA,


WA_MARA TYPE MARA.

PARAMETERS: P_MTART TYPE MARA-MTART.

SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS


WHERE MTART = P_MTART.

LOOP AT IT_MARA INTO WA_MARA.


WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL,
WA_MARA-MEINS, WA_MARA-SPART.
ENDLOOP.
Go to program source code, put cursor where you want to set break-point and click on set/delete
external break-point icon (see image below).
Now execute the program, provide input ex: FERT and execute (F8), breakpoint will trigger.

Now go to 'Desktop 3', which is friendly to see run-time variables and data, double click on
any variable to see respected value and data in right pane.

Techniques of debugging
Now, we will learn and understand the real techniques of debugging.

What are uses of F5, F6, F7 and F8 in debugging?


These are function keys, which are used to control debugging ex: go to next break-point,
execute perform/function module which out going into it etc.
F5 - When you press F5 in debugging, you will go to next step means you program control
goes to next line.
F6 - When you press F6 in debugging, it will execute the module without going into it.F6
works for performs (subroutines), Function modules, Class methods etc.

Ex for F6: we have a program, we have some function modules in the program, when we click
F5 in debugging control will go into function module source code, we don`t want to go into
function module, in that case we use F6, it will not go into function module instead it will
execute it in one step.

F7 - When you press F7 in debugging, it will complete the current module/program in a


single step.
Ex for F7: We have a program, we have a function module in the program, we have put break
point, when we press F7 it will completes the program if the control is in program, when we
press F7 it will complete the module( FM) when the control is in function module.

F8 - When you press F8 in debugging, control will go to next break point if any or completes
the program execution.

When do we use external break-point?


Whenever we want to debug a program, function module, Web Dynpro application or
any other object from external interface (other than GUI) like portal, web dynpro etc, we need
to use external break-point. We can use external break point to debug from GUI also.

15) Events in Classic Report?


1. Load-of-program
This event is used to load program into memory for execution and this is the first event
in execution sequence.
2. Initialization
This event is used to initialize variables, screen default values and other default actions.
Example: - v_land1=”in”
3. At Selection-Screen output
This event is used to modify the section screen dynamically based on user actions on
the selection screen. This event is triggered or executed for every action on the selection screen.

4. At Selection-Screen on field
This event is used to validate a single input field on the selection-screen.

Syntax: AT SELECTION-SCREEN ON <parameter name>. "Validate a input parameter

5. At Selection-Screen on value request


This event is used to provide a search help for an input field.
This event is triggered whenever the user clicks on search help Button.
Syntax: AT SELECTION-SCREEN ON VALUE REQUEST FOR <parameter name>.
"Input search help for an input parameter

6. At Selection-Screen on help request


In this event is we can provide documentation (F1) help for an input field.

Syntax: AT SELECTION-SCREEN ON HELP REQUEST FOR <parameter name>. "Input


(F1) help for a input parameters

7. At Selection-Screen
This event is used to validate multiple input fields

Syntax: AT SELECTION-SCREEN. "used to validate multiple input fields

8. Start-of-Selection
This is default event which is used to write actual business logic.
Also indicate the starting point of a program.

Syntax: START-OF-SELECTION. "Default event

9. End-of-Selection
It is used to indicate the start of selection has been ended.
It is mainly used with logical database. (HR-ABAP)
Syntax: END-OF-SELECTION. "Start of selection is ended

10. Top-of-Page
This event prints constant heading for all pages.

Syntax: TOP-OF-PAGE. “Page heading

11. End-of-Page
This event prints constant footer for all pages.
Before using this event, we need to reserve some lines for displaying footer.

Syntax: END-OF-PAGE. "Page footer


Example: REPORT ZPROGRAM LINE-COUNT 27(3). " Here we reserve 3 lines for footer

16) Event implementation Code?


(https://www.sapnuts.com/courses/core-abap/classical-reports/classical-report.html)
17) Using Selection Screen output for dynamic dynamic modifications on selection screen
in SAP ABAP?
(https://www.sapnuts.com/courses/core-abap/classical-reports/selection-screen-
output.html)
18) Difference between at selection screen on field and at selection screen events?
At Selection Screen on Field At Selection Screen
This event is used to validate a single input This event is used to validate multiple input
field. fields.
If we this event, if any, error the error field will By using this event, the error field is
be highlighted and the remaining fields will be heightened and all the remaining fields will
disabled. be enabled.

 Implementation (code)

(https://www.sapnuts.com/courses/core-abap/classical-reports/selection-screen-event.html)

19) Set default values on selection-screen using INITIALIZATION event?


(https://www.sapnuts.com/courses/core-abap/classical-reports/INITIALIZATION-event-
sap.html)

20) Declarative key words: - It is use to declare variables, constants.


{TYPES, TYPE, DATA, TABLES, CONSTANTS}

21) Database Keywords: - To work with database operations.


{SELECT, INSERT, UPDATE, DELETE}

22) Controlling Keywords: - It is used to control the default flow of a program execution.
Branching: - {IF-ELSE, ELSEIF-ENDIF}; {CASE-WHEN-ENDCASE}
Looping: - Condition{DO-ENDDO}
Un-Condition{ WHILE-ENDWHILE}

23) Definition Keywords: - It is use to define reusable module (Blocks).


{FROM-ENDFROM, FUNCTION-ENDFUNCTION, MODULE-ENDMODULE}

24) Operational keywords: -


{WRITE, MOVE, ADD}
25) Operators: -
1. Comparison: -- {< or LT; <= or LE; > or GT; >= or GE; = or EQ; < > or NE}
2. Arithmetic: -- {+, -, *, /, DIV, =}
3. Logical: -- {AND, OR, NOT}
26) Variant: - Variant is a concept of saving a set of input fields with values with a particular
name, so that we can use the same set of inputs next time.
How to Create it: - (https://www.guru99.com/what-is-a-variant.html)
27) Classes: ---

28) Form: -- SAP Smart Forms is used to create and maintain forms for mass printing in SAP
Systems. As output medium SAP Smart Forms support a printer, a fax, e-mail, or the
Internet (by using the generated XML output).
(https://www.guru99.com/smart
forms.html#:~:text=SAP%20Smart%20Forms%20is%20used,the%20limitations%20in%
20SAP%20Scripts.)
29) Attributes: -- Attributes are internal data objects of any ABAP data type within a class.
The content of the attributes specifies the state of the object. Reference variables can also
be defined, which can then be used to create and address objects. This allows objects to be
accessed within classes.
Attributes contain data. They define the state of an object (an instance of a class).
(https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-
US/abenclass_attributes.htm#:~:text=Attributes%20are%20internal%20data%20objects,t
o%20be%20accessed%20within%20classes.)
30) Documentation: -- ABAP Keyword Documentation - ABAP Keyword Documentation.
This documentation describes the syntax and meaning of the keywords of
the ABAP language and its object-oriented part ABAP Objects. Alongside this, language
frameworks and the associated system classes are also described.

31) Text element: -- Use this tool to create, maintain, and translate text elements for your
programs. Any text that a program sends to the screen can be stored as a text element in a
text pool. Text elements are: List and column headers that appear in ABAP lists.
(http://www.saptechnical.com/Tutorials/ABAP/Text/SE32.htm)

Kartik Material::
Module Pool
cl_gui_alv_grid, CL_GUI_CUSTOM_CONTAINER,fm se54 for tmg regenrate

for api and cpi cl_http_client

ASP is an acronym of Application Service Provider.


PF-status / menu painter: - SE41
Screen painter: - SE51

What are the main components of dialog programs?


- Screens
- Module pools
- Subroutines
- Menus
- Transactions
- SAPMZ
What is Screen flow Logic?
PROCESS:
- PROCESS BEFORE OUTPUT(PBO)-at selection screen output
- PROCESS AFTER INPUT(PAI) – at selection screen

- PROCESS ON HELP-REQUEST(POH)
- PROCESS ON VALUE-REQUEST(POV)
- Like field catalog display
- Chain end chain: - group of field validation (we can validate multiple value on screen.)
If any value change at a time that that code will call
- The additions ON CHAIN-INPUT and ON CHAIN-REQUEST work like the additions
ON INPUT and ON REQUEST that you use for individual fields.

- ON CHAIN-INPUT :
- ON CHAIN-REQUEST: PAI for single field validation
- Table control: - show the create manually/ using wizard
- Table control with wizard is the control provided by SAP, in which the users are not
needed to code separately for table control operations. It generates automatically system
generated code for the following table control operations

OOABAP (Object Oriented ABAP)


Returning = not null
Class: -
- Class is user define datatype which is collection of a attribute, method, events, and
interface.
Object: -
- Object is nothing but instance of the class and each object have unique identity and
memory.
Abstract Class: -
- Abstract class is class contain methods with implementation and without
implementations.
- There is one method which is not implemented that’s called abstract method.
- It can mainly be use for inheritance.
- It is only implemented on sub class (Final): e.g.: Z001_CL_GOS_RECORD_HR
Method: -
- Methods are object which can be created in class it is piece of code which contain some
functionality with importing, exporting and changing parameter.
Inheritance: -
- Inheritance is concept of passing behaviour of one class to another class/derived class.
- We can achieve multiple inheritance by interface.
Derived class/ Sub class: -
- It is nothing but sub class which access all the objects form super class.
Polymorphism: -
- Same name but different behaviour in different-different class is called polymorphism.
- Importing and exporting parameter are same.
Encapsulation: -
- Encapsulation is used to wrapping the data into single unit and help to achieve the
visibility of class, method, object, Attribute event through section that is private, public,
protected.
- Encapsulation is enhancing the security and accessibility of class.
Interface: -
- Interface are independent structure which are used in a class to extend the functionality of
a class. Interface contains methods without any implementation.
- It is implemented in many classes.
Include Class: -
- We can access all methods of included class into another class without creating Include
class Instance.
Super Keyword: -
- After defining the superclass to subclass the method of superclass can be access using
keyword super in subclass.
ME Operator: -
- ME is a keyword which is used to call method in a method of same class.
Event Handler: -
- Event Handler is a mechanism through which can call the method of one class to another
class by raising event.
Try-Catch: -
- Source code can be developing in try block by using catch block we can handle the
exception.
Casting: -
- Passing behavior of one class to another class.
1. Narrow Casting: -
o We can assign the behavior of subclass to superclass.
o Superclass = subclass
2. Widening Casting
o We can assign the behavior of super class to subclass.
o Subclass ?= superclass
Final: -
- Final class is a class which cannot be use for inheritance.
- It can be private.
Singleton: -
- It is private class.
- It does not allow you to create multiple instance.
- Singleton class called only static method without creating object.
Friends: -
- If a class is declared to be friend of some other class then it can access the nonpublic
(Private) components of that class.

Constructor Class constructor


Importing parameter only Not importing & exporting parameter
Pass default value Set the default values globally
Instance constructor is called with Static constructor calls directly using
instance of any class class name
Instance Method Static Method
We cannot call instance method directly Static method called directly using
class name
In instance method we need to create object of In static method no need to create
class object of class

Redefinition Method / (Overriding): -


- Redefinition is keyword which is used to overwrite parent class methods with new
implementation.
Reference variable: -
- Reference variable allow you to create and address object.
Alias: -
- Instead of define full name with interface-method we can assign a name to directly and
trigger that method.

Smart form
Call FM: - 'SSF_FUNCTION_MODULE_NAME' – driver program
PERFORM %GLOBAL_INIT.

Se73: - to create barcode designed.


SE78: - Use for add the graphics / logo, water mark.
SE71: - is the T-code for SAP Script forms.

SO10: - SAP script: Standard Texts Basis

Adobe Forms. SFP


A Template has fixed number of Rows and Columns whereas a Table can have variable
rows and columns.
Global setting: - 1. From attribute
2. Form interface: - importing and exporting parameter of Smart form
3. Global definitions: - global data, type, field symbol, initializations.
Types of window in smart forms:
1. Main window. - 1
 It is for the continues output like table output. Hight auto increase.
2. Secondary window. - 99
 For output with a fixed length. Fix values.

3. Final window. - 1
 This is also a special type of secondary window for the details that has to be
processed only at the end of the form processing.
4. Copies window. - 1
 This is a special type of secondary window for making pages as copy or original.

LSMW (Legacy System Migration Workbench)


SAP LSMW stands for Legacy System Migration Workbench, it is a tool that supports to
transfer the data from non-SAP systems to SAP R/3.
Limitation of LSMW

1. it will not handle the large amount of data even though it handles it is not advisable to
process large amount of data with LSMW due to performance reason.

2. it will not support the call transaction method.

3. it will not handle the dynamically calling screens.

4. Only notepad format is support.


BDC (BATCH DATA COMMUNICATION)

Batch Data Communication is technique which we use to create a recording to upload large
amount of data into the SAP System. (Master data and Transactional data we can create.)
T-code for recording method
- SHDB
Three methods: -
1. Call transaction.
2. Session method.
3. Direct input method.

1. Call transaction: - Asynchronous


- This method will update the database immediately.
- This method is used for transferring less amount of data.
- Less Time consuming

2. Session method: - Synchronous


- It contains group of records which have to be transferred into sap.
- This method is used for large amount of data.
- Time consuming
- There are 3 function module is used for Session method.

1. BDC_OPENGROUP.
- This Function module is used to create a session with the below parameter.
- Client no, username, group name, keep, hold date.
2. BDC_INSERT.
- This function module is used to transfer data from BDC Data structure into the session.
3. BDC_CLOSEGROUP.
- Once the session is created we need to close the session by BDC_CLOSEGROUP.
Update: -
1. Asynchronous update: - It immediately starts to process the next record without
waiting for the update to be finished.
2. Synchronous update: - Once the update is finished then it continues to process the
next record.
T-Code for display batch input sessions?
- SM35
CALL TRANSACTION METHOD SESSION METHOD
Asynchronous processing, Synchronous processing
No logs will be created Logs will be created
Not suitable for bulk data We can upload the buck data
We need to hander error manually
Fast processing.
Session we cannot run parallel

What is the syntax for Call Transaction?

CALL TRANSACTION <tcode>

USING <itab>

MODE <mode>

UPDATE <S, A>

MESSAGES INTO <msgtab>.

tcode: The transaction code which we are calling.

itab: The internal table from which the data is passed.

mode: In which mode the execution is done(A/N/E)

A - All Screen Mode (Shows all screens while execution)

N - No Screen Mode (Shows no screens)

E - Error Screen Mode (Shows the screens where error occurs)

S- background processing with debug

msgtab - In Call Transaction errors are handled explicitly. All

the messages are passed into this table

Update: S , A, L

BDC DATA / structure

- It is a structure which holds the information related to each screen i.e. program name,
Dyn pro- screen no, Dyn pro screen begin, field name, field values, information of
that particular screen to be transferred into the SAP
- DATA: BDCDATA TYPE TABLE OF BDCDATA.
-
- DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
-
- DATA: PROGRAM LIKE SY-REPID,
- WA_BDCDATA TYPE BDCDATA.
-
- WA_BDCDATA-PROGRAM = 'SAPMS38M'.
- WA_BDCDATA-DYNPRO = '0100'.
- WA_BDCDATA-DYNBEGIN = 'X'.
- APPEND WA_BDCDATA TO BDCDATA.
- CLEAR WA_BDCDATA.
- WA_BDCDATA-FNAM = 'RS38M-PROGRAMM'.
- WA_BDCDATA-FVAL = PROGRAM.
- APPEND WA_BDCDATA TO BDCDATA.
- ...
- "Here you use BDCDATA
- CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'
- MESSAGES INTO ITAB.
T code , D name dnumber

BDCMSGCALL: -

- It is used to collect the error message during BDC Execution.


- Session method error handle in explicitly.

BAPI BDC
Bapi is faster compare to BDC BDC is slower compare to Bapi.
Bapi is used for particular transaction like BDC can be used for any transaction which
delivery sales order have screen and fields.
Bapi has directly update the database. BDC run through the screen flow.
If in case add new field in BAPI at a time If in case add new field in BDC at a time
only that field is not update in database. BDC was failed.

BAPI (Business Application Programming Interface)


What is Bapi? --- SE37 API/RFC/Bapi/FM
API: -3rd party integration API
FM: - within Report and anywhere.
RFC: - SAP to SAP or SAP to Non - SAP. RFC radio button

Call 'RSSDK_LOGSYS_REMOTE_CHECK' destination DEST600

exporting

I_QSYSTEMNAME =

tables

E_T_MSG =
UPDATE BAPI: If transection is already available in database and update bapi is called
at a time it will update data and save transection and commit operation is their and if
transection is failed at a time all transection is rollback and delete all the entries in table
which is updated during this bapi.
It can be used for data migration and for communication between sap to sap and sap to non-
sap system.
- Bapi is function Module defined under in BOR (Business object repository).
- T-code for BOR is SWO1.
- Import: - Import data in Fm.
- Export: - To execute all logic in FM and export data in export parameter.
- Changing: - Work like import and export it’s in the form of internal table and work area.
- Returning: - Work like import and export it’s in the form of internal table and work
area.
- Table: - Like internal table
- Exception: - Incase exception is coming.
Steps for creating custom Bapi.
1. Create remote enabled function module with importing and exporting parameter.
2. Create BOR (Business object repository) In SWO1.
3. Insert RFC Function module into business object.
4. Release Business Object.
RFC BAPI
RFC is used to connecting from sap to Non- BAPI is used to connecting from sap to sap and
sap only. (sap to non-sap/IF it radio button as RFC is
marked).
RFC does not generate any method Bapi generate unique method in BOR to use in
the external system directly

It doesn’t have standard RFCS to migrate the The standard bapi is start with bapi can be used
data to migrate the data.

Badi (Business Add-In)


What is Badi? (SE18 – Badi Define and SE19 – Badi implementation)
- Badi is enhancement technique which is used to add our own business functionality to sap
standard application.
Types of Badi?
1. Filter Badi: -
Filter Badi is implemented based on specific filter value.
2. Multiple Badi: -
Badi's having multiple implementations for one definition.
3. Single Badi: -
Badi having single implementation.
How to find Badi?
1st way: - (Proper Badi for any T-code) (We get Badi and enhancement spot.)
1. Go to SE24.
2. Provide class name: - cl_exithandler
3. Select get instance method
4. Put breakpoint on GET_CLASS_NAME_BY_INTERFACE
5. Execute transaction code the breakpoint will trigger and write down value that
come to variable exit name (Changing parameter).
6. Check in SE18 Badi is multiple use or not then check methods and parameters
for that it is use full for us or not, then it is use full for us then implement using
SE19.
2nd way: - (With enhancement spot and all package related things)
1. Go to SE93 and enter T-code and find package.
2. Go in SE80 and put package name and find enhancement and extract it.
3. Then extract classic Badi definition and Badi implementations.
Sap only: It means only sap used.
Multiple used Badi we can use
SAP System Badi SAP Non-System Badi
Internal External
It can be used product system For customer

How to call custom Badi?


 Get Badi & Custom Badi.
RFC Enabled: - Bridge Between SAP to NON-Sap.
If multiple badi is there then which one is call first?
Random sequences but it should be activated.
Karnal badi (new badi) and custom badi (classical badi/ old badi)?
New badi multiple implementation is possible. Get badi and call badi
Custom/classic badi have single implementation.

What is FALL BACK class in BADI?


o If a BADI doesn’t have any active implementations, the program goes to run time
error. The Fall back classes are used to call the default methods in case a BADI
doesn’t have any active Implementations.
 The exceptions can also be raised to avoid such kinds of errors.

Enhancement
Enhancement:
SAP Enhancements are used to expand the standard functionality within SAP.
Enhancements use function modules and are called from the standard SAP code.

Enhancement T-code:
SMOD: is used to find out suitable Exit
CMOD: is used to implement the Exit
Framework of Enhancement/ Enhancement technique
1 Implicit enhancement: - (SAP is providing a particular space where we have written
code in standard)
- Implicit enhancement points are basically points within ABAP code where
an enhancement point is implied, and in which case can be created.
- Examples of implicit enhancement points are at the beginning and end of FORM's, at
the end of a program, include or function module etc.
Predefine points for Implicit enhancement
- Start and end ma
2. Explicit enhancement: - (Where we have to create enhancement spot & place &
point)
An explicit enhancement option is part of the ABAP program. It is assigned to the package of
the program and not to the package of the enhancement spot to which it belongs.
Types of enhancement: -
1. User exit
2. Customer Exit

1. User Exit: -
- User exit is implemented in form of subroutine.
- Access key is required for User Exit implementation.
- User Exit is used for only SD.
- Read and change all the global data.
2. Customer Exit: -
- Customer exit is implemented in form of function module.
- Access key is not required for customer exit implementation.
- Customer Exit is used for all modules.
Types of customer exit.
1. Menu Exit: -
- Adding items to the pulldown menus in standard R/3 applications.

2. Screen Exit: -
- Add some fields and sub screen in sap standard.
- Adding fields to the screens within R/3 applications. SAP creates screen exits by
placing special sub screen areas within a standard R/3 screen and calling a customer
sub screen from within the standard dynpro's flow logic.

3. Function Module Exit: -


- Adding functionality to R/3 applications. Function module exits play a role in both
menu and screen exits.

4. Keyword exits –
- Add documentation to the data elements of key words defined in the ABAP/4
Dictionary. The system displays this documentation whenever a user presses F1 to get
online help for a screen field.
- Insert, continue…
What is Enhancement Point?
- In enhancement point call standard and custom code.
What is Enhancement Section?
- Call only Custom code.
- Enhancement Point and section are used during explicit Enhancement.
What is Enhancement Spot?
- Enhancement spot is specifying the places where we can add our code in standard sap.

Steps for user exit.


1. GO TO SE80.
2. PROVIDE any package name eg. vmod
3. Expand include
4. Select include as per requirement
5. Copy include name and go to se38 provide include name in program name
6. Click on spiral
7. Right click and select show implicit enhancement.
Function group enhancement:
Steps for Customer Exit.
1. Go to SE84
2. Select enhancement
3. Expand customer exit enhancement
4. Provide package name and execute.
5. Select exit n ame and then select function module
6. Click on include name and enter
Type : dataelemrnt and table-field(refrence of data element).
Type ref to : class ya Interface no reference
TYPE LINE OF : Table Type

LIKE:internal table

LIKE LINE OF : work area no refrence aapi ne 2nd work area create kari
sakia.

Type box:

What is the difference between Internal Table without Header Line


and Internal Table with Header Line?
 Internal Table without Header Line creates an internal table and work area separately.
 When the Internal Table with header table is created then the work area is created
automatically with the same name as that of the internal table.

What are the types of Memories, explain about them?


 The Memory concept is used to access the data across the internal or External
Sessions.
 There are 2 types of memories.

 SAP Memory: - It is used to access the data from one session to another session
through
 The ABAP statements SET PARAMETER ID and GET PARAMETER ID are used to
work
with the SAP memory.
 SET PARAMETER ID: - It is used to pass the field value from an application program
into the
 specified SAP Memory ID or Parameter ID.
 GET PARAMETER ID: - it is used to get the data from the specified memory ID or
Parameter ID into the field of an application program.
 The Parameter IDs are maintained at Data Element level under Further
Characteristics.

 ABAP memory: - It is used to access the data across internal sessions. The ABAP
statements
 IMPORT &amp; EXPORT are used to work with the ABAP Memory.
 The IMPORT statement is used to import the data from the specified memory ID into
a data variable.
 The EXPORT statement is used to export the data into the specified memory ID from
the program.
BOPF (Business object processing framework)
BOPF: -
- BOPF is an ABAP Object Oriented -based framework that provides a set of generic
services and functionality.
Framework: -
- It is functionality created for using its methods and feature to create your own custom
application.
Advantages of BOPF.
- FPM (floor plan manager)
- Reusability
- Less implementation

FPM (floor plan manager): -


- FPM is configurable user interface framework provided by sap for easy abap web dynpro
development.

BOPF Important Transaction code.


BOBF (Business object building Framework)
- To see the entire structure of our BO in terms of Node element and structure
BOB (Business Object Builder)
- To create a Business object
BOBT (Business Object Builder Test)
- Test BO
BOBX (Business Object Enhancement workbench)
- To enhance or change any BO
There are two API.
1. Service Manager API
- Used to perform any operation (Create, Read, Update, Delete) on BO
- /BOBF/IF_TRA_SERVICE_MANAGER

2. Transaction Manager API


- This is API is used for Save and rollback Transaction.
- /BOBF/IF_TRA_TRANSACTION_MGR
There are two structure.
1. Persistent structure
- Define the attributes that are stored in the database.
2. Transient structure
- Contain Information which can derived at runtime.
Why do we need the BOPF?
- Using BOPF, you get the whole application infrastructure and integration of various
component for free. This allows you to rapidly build application on a stable and
customer- proved infrastructure.
Anatomy of Business object.
1. Node: -
- A node is structure consisting of set attributes and nodes are used to model a business
object data.
2. Action: -
- Actions define the service or behavior of business object.
3. Associations: -
- Define relationship from one business object to another.
4. Determination: -
- Determination is mostly used to compute data that can be derived from the values of other
attribute.
- Example: - Item Qty * price = total price.
5. Validation: -
- Validation can be used to check consistency of a business object.
6. Alternative Keys: -
- Alternative keys are used to identify the node instance of Business Object
7. Query: -
- Query is providing the initial point of access to business object.
SELECT_BY_ELEMENTS
 Select by elements is a query where the parameters match the node structure.
SELECT_ALL
 Select all query is a query without any parameters.

REFRESH statement CLEAR statement

It always refers to an internal It refers to an internal table


table. as well as a work area.
Header line can be cleared
Header line cannot be cleared
using the CLEAR itab
using this statement.
statement.

Vandhan Material:

DATA DICTIONARY:-
1). What is foreign key in abap dictionary?

Foreign key is a concept that is used to define relations between tables in ABAP dictionary.

A relationship which can be defined between tables must be explicitly defined at field level. foreign
keys are used to ensure consistency of data.

Data entered should be checked against existing data to ensure that there is no contradiction. While
defining foreign keys cardinalities has to be specified.

Cardinality mentions how many dependent records or how referenced records are possible.

2). What are compound foreign key in ABAP dictionary?

A compound foreign key is a foreign key composed of two or more fields. In other words, A check is
done to compare two fields in the foreign key table against two

fields in the check table. The combination of values must exist in the check table before they can be
inserted into the foreign key table. however only one field

on the screen will trigger the compound foreign key check.

3). What is delivery class in ABAP dictionary?

Delivery class defines that what kind of data that are going to be stored in the database. As in
example: - System data, Transaction data, Master data.

Options Available in the delivery class.

 A- Application table (Master and Transaction data).


 C- Customizing (Maintenance only by customer Not by SAP.)
 L- Table for storing temporary data.
 G, E, S, W- (These are used to store system data (basis data)).

->Display and maintenance.


It specifies whether the user can display and maintain the data, the following options are available
under display and maintinence.

<1>. Display/Maintenance Allowed. (User can display and maintain the data.)

<2>. Display/Maintenance allowed with restrictions. (Some of the users can display and
maintain the data.)

<3>. Display/Maintenance Not Allowed. (No user can display data).

4). What is data class?

It defines the exact physical area at which the data is going to be stored in the database.

<1>. APPL0 - Master Data.

<2>. APPL1 - Transaction Data.

<3>. APPL2 - Organization and Customizing.

<4>. DDIM - Dimension tables in BW

<5>. DFACT - Facts tables in BW.

<6>. DODS - ODS tables in BW.

5). What is size category in Data Dictionary?

It specifies the number of records that can be stored in a database table. Size category will be
incremented dynamically based on increase in records.

6). What is buffer?

Buffer is a temporary memory for storing temporary data.

It is same as cache memory.

The buffering type defines which table records are loaded into the buffer of the application server
when a table record is accessed. There are the following buffering types:

Full buffering: All the records of the table are loaded into the buffer when one record of the table is
accessed.

Generic buffering: When a record of the table is accessed, all the records having this record in the
generic key fields (part of the table key that is left-justified, identified by specifying a number of key
fields) are loaded into the buffer.

Single-record buffering: Only the records of a table that are really accessed are loaded into the
buffer.

7). What is data element in SAP ABAP?


Data element is an object that is used to specify the semantic information of the field. Example
given. Field label, Heading.

8). What is domain in SAP ABAP?

Domain in an object that is used to specify the technical information of the field. As in example- data
type, visible length, decimal places, fix values,

value range etc.

Lock object: - Lock object feature is used to synchronize access to the same data by one or more
program. Lock objects are used for avoiding inconsistences when the data is inserted or changed.

Lock Mechanism: - A program can communicate with other programs about data records that is
reading or getting changed. cds

A program can prevent itself from reading data that has been just changed by another program.

9). Why do we use data elements and domain in SAP ABAP?

Whenever we are creating a new table or adding a field to existing table, we need to specify field
labels, headings and data types for the field.

In SAP ABAP for maintaining this information we are creating data elements and domains.

10). What are the three types of database tables available in SAP, Differentiate between three
tables.

There are three types of database tables.

(I) Transparent tables

(II) Pool tables

(III) Cluster table


Transparent Pool Cluster

Contain a single table used to They are used to hold a large They are used to hold data
store master data. number of very small tables from a few numbers of large
(stores customizing data or tables (stores system data ).
system data)

It has one to one relationship It has many to one relationship It has many to one relationship
with a table in the database. with a table in the database. with a table in the database.

For each transparent table It is stored with other pooled Many cluster tables are stored
there is one associated table tables in a single table called in a single table in the
in the database. table pool in the database. database called table cluster.
The database table has the The database table has a The database table has
same name, same number of different name, different different name, different
fields and the fields have number of fields and the fields number of fields and fields
same names. have different names. have different names.

There is only a single table. Table pools contains more Table clusters contains less
tables than table clusters. tables than table pool.

Single table can have one or Primary key of each table Primary key of each table
more primary key. does not begin with same field begins with same field or
or fields. fields.

Secondary indexes can be Secondary indexes cannot be Secondary indexes cannot be


created. created. created.

They can be accessed using They can be accessed using They can be accessed using
open and native SQL. open SQL only. open SQL only.

USE: - They are used to hold USE: - They reduce the USE: - They would be used
master data. E.G. Table amount of database resources when the tables in primary key
vendors or table of needed when many small in common and data in these
customers. Example of tables have to be opened at tables are all accesses
transaction data is orders the same time. simultaneously.
placed by customers

11). Define Structures.

The structure is a list of fields that are defined under a name. Which are used to process data at run-
time in SAP ABAP.

Structures are of two types. One is global structure and another is local structure. Local structures can
be created in ABAP programs and global structures can be created in DATA-DICTIONARY and that can
be reusable in different objects.

12). What are the differences between table and structures?

Table and structures have lots of differences in the sense of behaviour and properties. The below are
the main differences between tables and structures.

Tables Structures
Tables will store data physically and Structures cannot store data physically. Data
permanently. can be hold into structures at run-time only.
Tables have primary keys. Structures does not have primary keys.
Tables have technical settings, (Data class, Structures does not have technical attributes
Delivery class, Size category, Etc.), Maintenance and maintenance attributes.
attributes (Display maintenance restrictions ).
Tables have primary and secondary Indexes. Structures does not have primary and
secondary indexes.

13). What is check table?

It is a table which contains all valid entries of a field. Check table is the dependent table to which the
relationship is defined using the foreign keys. The contents of the check table field are shown in the
input help for the referenced field.

For example: - Check the employee master table and employee transaction table. Whenever an
employee transacts you need to check whether the employee exists. So, for that you can refer to the
employee master table. This is nothing but Parent child relationship. Here data is maintained at client
level. No development involved. As per DBMS what we call foreign key table, is called as check table.

14). What is value table?

Value table is the table attached to a field at the domain level, Where the entry to the field can be
only from the value table. They are not used in the input help. The value table is the default check
table.

This is maintained at domain level. Whenever you are creating a domain. You can enter allowed values
in the value range. For example, check the domain SHKZG – Debit/ Credit Indicator. Here Only allowed
values are H and S. Whenever you will be using this domain then the system will force you to enter
one of these allowed values. This can be defined as value table.

Reporting:-
15). What are internal tables and work areas? Differentiate between internal table and work area.

Internal tables and work areas are temporary memory locations which are used to store data of
database tables at runtime and in other way we can call them as instances of database tables.

Internal Tables Work Areas


Temporary memory locations which are used to Temporary memory locations which are used
store data of database table at runtime. to store single line data of database table at
runtime.
Internal table is an instance of database table. Work area is an instance of database tables.

General Syntax: - General Syntax: -


DATA: <ITAB> TYPE TABLE OF <DBTABLE> DATA: <WA> TYPE <DBTABLE>
By default, 8KB memory will be allocated and it
increases dynamically. (8KB + 8KB)
Internal Tables can store multiple records at Work Areas can store only one record.
runtime.

16). Which are the types of messages in SAP ABAP Programming?


<1>. I: - Information Message (The message appears in a dialog box. Once the user has confirmed the
message, the program continues immediately after the MESSAGE statement.

<2>. E: - Error Message (Depending on the program context, an error dialog appears or the program
terminates.)

<3>. S: - Status Message (The program continues normally after the MESSAGE statement, and the
message is displayed in the status bar of the next screen.)

<4>. W: - Warning Message (Depending on the program context, an error dialog appears or the
program terminates.

<5>. A: - Termination Message (The message appears in a dialog box, and the program terminates.
When the user has confirmed the message, control returns to the next-highest area menu.)

<6>. X: - Exit Message (No message is displayed, and the program terminates with a short dump.
Program terminations with a short dump normally only occur when a runtime error occurs. Message
type X allows you to force a program termination. The short dump contains the message ID.)

17). What are the different types of internal tables in SAP ABAP? Differentiate between the
internal table’s types in SAP ABAP.

There are three different types of internal tables in SAP ABAP programming which are given as
below.
<1>. Standard Internal Tables

<2>. Sorted Internal Tables

<3>. Hashed Internal Tables

Differentiate between standard, sorted and hashed internal tables.

# Standard Internal Tables Sorted Internal Tables Hashed Internal Tables

(1) These are default internal These are special type of internal These are used with logical
tables. tables, where data is already database. I.E. with all fields
(automatically) sorted as you and all records.
insert the record.

(2) To read a record we use To read a record we use either Here the index operation is
either key or index operation. key or index operation. not allowed. We can only use
key operation.
(3) To search for a record, we To search for a record, we use To search for record, we use
can use either linear search binary search as data is already hashed algorithm.
or binary search. sorted.

(4) We can use sort operation. We do not use sort operation as


data is already sorted.

(5) We can use insert or append We can only use insert. Not These are mainly used in
to add records. append. ABAP with BI projects.

18). Explain SELECT FOR ALL ENTRIES in SAP ABAP. What are the advantages of select for all entries
in SAP ABAP programming?

SELECT FOR ALL ENTRIES is the best alternative for SELECT WITH JOINS, this statement is very helpful
for reading data from more than two tables. The load on the database will be very less.

Points to be noted before using SELECT FOR ALL ENTRIES Statement.

 Parent Internal table must not be empty. (If parent internal table is empty, where condition
fails and it will get all records from database.)
 Remove all duplicate entries in Parent Internal Table.

19). Explain Select with joins.

SELECT WITH JOINS statement is used to read data simultaneously from multiple database tables. As
per performance standards, SELECT with joins from more than 3 tables is not advisable. As It puts a
heavy load on the database.

Syntax: -

SELECT A~MATNR

A~ERNAM

A~PSTAT

B~MATNR

B~SPRAS

B~MAKTG FROM MARA AS A INNER JOIN MAKT AS B

ON A~MATNR = B~MATNR

INTO CORRESPONDING FIELDS OF TABLE IT_MARA_MAKT


WHERE A~MATNR IN S_MATNR

20). SELECT SINGLE and SELECT UPTO 1 ROWS, what is the difference between SELECT SINGLE and
SELECT UPTO 1 ROWS in SAP ABAP?

These statements are part of reading data from database tables. By using SELECT SINGLE and SELECT
UPTO 1 ROWS. We are able to read single record from a database table.

# SELECT SINGLE SELECT UP TO 1 ROWS


(1) SELECT SINGLE is used to read exact record SELECT UP TO 1 ROWS is used to read
from database table. appropriate record from database table.

(2) To read an exact record from database We can read appropriate record from
table we need to provide all key fields. database table; we may not need to provide
all key fields.

(3) This statement should be used only if all This statement should be used only if we
the key fields are available. have some key fields or no key fields.

(4) SELECT SINGLE * FROM DATABASETABLE SELECT * FROM DATABASETABLE INTO WA


INTO WA WHERE ALL KEY FIELDS. UP TO 1 ROWS WHERE ALL KEYFIELDS/ SOME
KEYFIELDS.
ENDSELECT.
(5) This is very fast when compared to SELECT This is slow.
UPTO.

21). Explain SELECT INTO CORRESPONDING FIELDS in SAP ABAP.

Select into corresponding fields is used to read data from database tables without even specifying the
list of fields.

As per SAP standards SELECT INTO CORRESPONDING is not advisable as it affects the performance of
an application because it has to compare each field with database table’s fields which results in
consuming more time.

Syntax: - SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA UP TO 25


ROWS.

Here IT_MARA is an internal table.

22). What is SELECT DISTINCT in SAP ABAP?

SELECT DISTINCT is used to get distinct (unique) values of a particular column in SAP ABAP. SELECT
DISTINCT eliminates duplicate records of a column of a table.

Syntax: - SELECT DISTINCT <COLUMN> FROM <TABLE> INTO TABLE <ITAB> WHERE <CONDITION>.

SELECT DISTINCT MTART FROM MARA INTO TABLE IT_MARA UP TO 5 ROWS.


23). How to bypass buffer in SAP Select statements? Explain Bypassing buffer in SAP select
statements.

Whenever we use open SQL statements to get or fetch data in SAP, it will get data from buffer area
(depends on table buffer settings) for better performance, but in real world scenarios some tables
may updated frequently (In milliseconds). We may need to bypass buffer to get real-time data, in that
case we will bypass buffer using ‘BYPASSING BUFFER’ Keyword.

Syntax: - SELECT MATNR

MTART FROM MARA INTO TABLE IT_MARA BYPASSING BUFFER.

24). Explain SELECT APPENDING.

SELECT APPENDING query is used to append select query directly to some internal table. Select for
SELECT APPENDING is given as below. Where condition is optional in select query.

Syntax: - SELECT MATNR MTART FROM MARA APPENDING TABLE IT_MARA UP TO 10 ROWS

WHERE MTART = 'HALB'.

25). Explain EXIT, STOP, CONTINUE and RETURN in SAP ABAP.

In our day to day programming implementations, we may need to use exit, continue, stop and return
statements

<1>. EXIT: - The behaviour of EXIT keyword depends on where you use it.

 If you use EXIT inside IF…. ENDIF., It will come out of the program.
 If you use EXIT inside LOOP …. ENDLOOP., It will come out of the loop.
 If you use EXIT inside FORM …. ENDFORM., It will come out of FORM (Subroutine).

<2>. STOP: - STOP is a statement which is used to stop processing an event block, Example:- If I have
two events START-OF-SELECTION and END-OF-SELECTION in my program, And if I use STOP Keyword
in START-OF-SELECTION, The keyword will exit start of selection and goes to END OF SELECTION.

<3>. CONTINUE: - CONTINUE is a statement which is used to skip the execution of a record inside the
loop… end loop, do…. End do, while... End while etc and executes the next record. This keyword will
only be used in loops.

<4>. RETURN: - RETURN is a statement which is used to stop processing of current block immediately.

Object Oriented ABAP and Concepts:-


 The main feature of Object-oriented programming is representing real-time objects in the
form of class objects.
 Object Oriented ABAP focus on real time objects of class.
 SAP ABAP Object Oriented Programming is available in two flavours.
 One is Global classes and another is local classes.

Global class: - Global class is an ABAP object which can be accessible via SAP class builder,
T-code for SAP class builder is SE24.
Local Class: - Local classes are classes which are available in ABAP programs, we can access
them via ABAP editor SE38.

26). What is class? A class is a user defined data type with attributes, methods, events, user-defined
types, Interfaces etc for particular entity or business application.

27). What are objects, attributes, methods, events and interfaces?

Objects: - Objects are nothing but instances of classes, each object has a unique identity that is
memory and its own attributes.

Syntax: - DATA <Instances> TYPE REF TO <CLASS NAME>.

CREATE OBJECT <INSTANCES>.

Attributes: - Attributes are variables, constants declared within a class.

Methods: - Methods are coding blocks which provides some functionalities.

 These methods ae similar to Function Modules in ABAP.


 Methods can access all attributes of its own class.
 Methods are defined in definition part and implemented in implementation part.
 We can call methods using CALL METHOD statement.

Events: - Event is a mechanism through which one method of a class can raise method of other class,
without hazard of instantiating that class.

Interface: - Interfaces are similar to classes which contains methods without any implementation.

Interfaces are mainly used to extend functionality of a class.

28). What is constructor method in SAP classes? Explain the use of constructor method in
OOABAP.

Constructor is a special type of method. It is executed automatically whenever an object Is created or


instantiated. These methods cannot be called by CALL METHOD statement. These methods are mainly
used to set default values in classes where parameters or select options are initial.
There are two types of constructors in SAP Classes.

<1>. Constructor (Instance Constructor).

<2>. Class Constructor (Static Constructor).

Constructor: - This method can have only importing parameters. There will not be any exporting
parameters. The name of constructor method must be Constructor only.

Class Constructor: - It is a type of constructor, this method will be executed automatically whenever
the first call to the class is made, the first call may be through instance or through class. These class
constructors are mainly used to set default values globally I.e. Irrespective of instances, this method
will not have any importing or exporting parameters. These methods will be executed only once.

Name of the CLASS CONSTRUCTOR must be CLASS_CONSTRUCTOR.

29). What is polymorphism in Object Oriented Programming model?

It is a concept by which the same method names will behave differently in different classes I.E. each
method will have its own implementation in different classes but with the same name.

Interface is one of the concepts in object-oriented ABAP to achieve polymorphism.

30). What is Interface in Object Oriented ABAP?

 Interfaces are independent structure which are used in a class to extend functionality of a
class.
 Interfaces contains methods without implementation. Whereas a class contains methods with
implementation.
 We need to define an interface with the required methods name in SE24 T-code.
 The interfaces can be used by no of classes to extend the functionality of a class.
 To implement an interface in a class just define interface name under the interfaces tab.
 All the interfaces methods will be automatically copied to the classes in a particular class
without effecting to the other class.
 The main use of interfaces is re-usability and maintain standard project framework.

31). What is Inheritance?

 Inheritance is the concept of passing the behaviour of one class to another class.
 You can use an existing class to derive a new class.
 Derived class inherits the data and methods of a super class.
 However, they can overwrite the existing methods also add new code.
 This means we can add additional features to an existing class without modifying it.
 Super is the keyword that is used to represent the super class in oops, you can access the
methods and attributes of the super class using the word super.
 Redefinition is the keyword which is used to overwrite the parent class methods with new
definition.

Note: - In object-oriented ABAP we have only single inheritance. There is no multiple inheritance.

 Super class is a main class by using this we can derive a new class which will be called
as Child class.
 Final class is a class which cannot be used in inheritance. It is a class property
(checkbox under properties of class).

33). What is Casting?

There are two types of casting.

 Narrowing Cast: - Assigning/Copying the instance of sub class to super class instance is called
Narrowing Cast.
 Widening Cast: - Assigning/Copying the instance of super class to sub class instance is called
as Widening Cast.
Business Application Programming Interface (BAPI):-
32). What is BAPI and business objects in SAP ABAP?

BAPI stands for Business Application programming Interface (B + API). BAPI’s are methods (Function
modules) defined in business object repository (BOR).

Business Object: - Business object is similar to class, which is group of attributes, methods, events,
interfaces, key fields for particular business application scenario.

Business object repository is a repository or container of business objects, T-code for BOR (Business
Object Repository) is SWO1.

BAPI is a remote enabled function module, which is used to communicate between SAP to SAP, SAP
to NON-SAP systems. BAPI RFC function module will be inserted into business objects, it will convert
into BAPI.

BAPI can be created in following way.

 Remote enable function module created.


 Remote enabled function module inserted into business objects.
 BAPI created.

Uses of BAPI: -

 Generating reports.
 For communication between SAP to SAP and SAP to NON-SAP systems.
 BAPI’s can be used for data migration.

Difference between BAPI and RFC.

# BAPI RFC
1 Used for communication between SAP to SAP Used For communication between SAP to
and Sap to NON-SAP. SAP and SAP to NON-SAP.
2 BAPI is a part of business objects. It can RFC is a standalone function module; it
communicate with other BAPIs. cannot communicate with other RFC.
3 BAPI uses object-oriented concepts. RFC uses procedure-oriented concepts.

As we know BAPI is a remote enabled function module but when we are creating BAPI, we need to
follow some rules given as below.
Rules (As per SAP) for creating a BAPI.
 Every BAPI must start with BAPI or ZBAPI (Custom BAPI).
 All importing and exporting parameters must be of type structures (Not direct type entries).
 All importing and exporting parameters must start with BAPI or ZBAPI.
 All importing and exporting parameters must pass by value, as pass by reference is not
supported for remote communications.
 BAPI must have return parameters (For returning messages like success, error, warning etc.)
of type BAPIRET2 or RETURN.
Web Service Development:-
Steps for creating web service are defined as below.

<1> Create a function module in se37 as per the requirements. Then make It remote enabled by
checking the radio button of it.

When you’re creating a remote enabled function module then pass by reference parameters are not
allowed with that. You need to make parameters pass by value. Then only the function module will be
saved and activated.

Create web service as mentioned below.

After Wizard opens. Define the web service definition name, give it a description, Give it a package
name and TR name.

In Configuration service make profile with ‘Authentication with user and password, No transport
guarantee.
After finishing the process of wizard for creating web service. Go to Transaction SOAMANAGER.

Now Go to Web Service Configuration.


In search criteria Object Type should be service definition.

Object name should be your created web service name.

Your selected record will appear there. Double click into it and Choose option Create Service.

Give service name, Service description text and new binding name.

Transport level security should be none.

Transport channel authentication should be set as given below.


After setting the authentication settings as mentioned keep the above steps as it is without making
any changes into it and finish the process of web service creation from SOAMANAGER.
Activate it and download the WSDL and copy the link of WSDL file.

Now go to SOAPUI tool.


Create New SOAP project and import WSDL file.
Go to Request 1 from that project.

In a request tab select BASIC from the AUTHENTICATION DROPDOWN and give the credentials over
there.
Input the parameter and based on that you will get the output in Response tab.
Enhancement Framework:-
 There are two types of source code enhancements are possible.
1. Implicit Enhancement Option.
Implicit enhancements are predefined enhancements that are provided by SAP
developers.
2. Explicit Enhancements Option.
Explicit enhancements can be created by customers or by partners.

Note: - There are two types of explicit enhancements options are available. For this we have now
two new abap statements.

1. Enhancement point (Syntax: - ENHANCEMENT-POINT).


2. Enhancement section (Syntax: - ENHANCEMENT-SECTION).

Enhancement section is used to replace the set of code or statements with the customer (customer
code), In this technique the original source code doe not get executed but the customer
implementation (customer code) get executed.

Note: - Explicit enhancements though can be implemented anywhere in source code but note just
anywhere except some areas where SAP would allow. (program allows).

1). What is sap Net Weaver gateway.

Ans: - SAP Net Weaver gateway provides an easier way for the consumption on business logic and
content for SAP Back-end system on web application. It also reduces the complexity to access SAP
data and provides easy interfaces to decrease development time.

In simple words NetWeaver Gateway is a set of ABAP add-ons to your existing SAP ERP system that
provides easy access to your business information in a simple, People centric manner and lowers the
data consumption barrier to the point that no prior knowledge of an SAP system’s internal working is
required. The gateway provides an API that is designed to function as easy to use, Well defined that
gives access to the rich wealth of your business data and functionality in your SAP system.

SAP Net Weaver Gateway: Capabilities and Key Benefits: -


SAP Net Weaver Gateway is a technology that provides a simple way to connect devices, environments
and platforms to SAP software based on market standards.

 Non-disruptive, Any business suite.


 Easy to develop APIs and does not require any tool knowledge.
 Based on REST (REpresentational State Transfer), ATOM /ODATA. It allows connectivity to SAP
application using any programming language or model, without the need for SAP knowledge, by
leveraging REST services and ODATA/ATOM protocols.
 It provides plug-ins for well-known IDEs such as eclipse, Visual Studio 2010 and XCODE.

What is REST and SOAP? Differentiate between them.

SOAP stands for Simple Object Access Protocol.

REST stands for Representational State Transfer. SOAP can’t use REST because It’s a protocol and
REST can use SOAP Web Service because it is a concept, it is an architecture style and can use any
protocol like HTTP, SOAP.

SOAP
No. SOAP REST

1) SOAP is a protocol. REST is an architectural style.

2) SOAP stands for Simple Object REST stands for Representational


Access Protocol. State Transfer.

3) SOAP can't use REST because it REST can use SOAP web services
is a protocol. because it is a concept and can use any
protocol like HTTP, SOAP.

4) SOAP uses services interfaces REST uses URI to expose business


to expose the business logic. logic.

5) JAX-WS is the java API for SOAP JAX-RS is the java API for RESTful web
web services. services.

6) SOAP defines standards to be REST does not define too much


strictly followed. standards like SOAP.

7) SOAP requires more REST requires less bandwidth and


bandwidth and resource than resource than SOAP.
REST.
8) SOAP defines its own security. RESTful web services inherits security
measures from the underlying
transport.

9) SOAP permits XML data format REST permits different data format
only. such as Plain text, HTML, XML, JSON
etc.

10) SOAP is less preferred than REST more preferred than SOAP.
REST.

2). What is ODATA? Advantages and Disadvantages.

OData is an Open Data Protocol. It is an Open web Protocol started by Microsoft to expose data using
existing web technologies. This is based on Representational State Transfer (REST) full architecture.
HTTP, Atom Pub (Similar to RSS, but specifically introduced special XML format for ODATA), JSON all are
supported.

This protocol enables the clients to publish and manipulates the resources identified by URIs and
defined in Data model using HTTP messages. Server hosts the data and clients can call this service to
retrieve the resources and manipulate them. Servers exposes one or more endpoints which are services
that refers to the resources. Clients need to know the server-side endpoints to call this service to query
or manipulate the data. The protocol is HTTP based and it designed with RESTful mindset which means
it follows the constraints to be called as RESTful services.

Since the protocol is HTTP based, any programming language with HTTP stack can be used to consume
OData services. Existing client-side libraries can be used to transform the JSON or ATOM Payloads from
the server into objects making programming simple. On the other hand, many libraries exist on the
server side to generate the payloads in ATOM or JSON from the existing data.

It is important to note that both client side and server-side development can be in completely different
programming languages till the time both are able to communicate via HTTP.

Clients consume the services to query and manipulate the data from OData services and are also called
as Consumers of OData services. Similarly, Server expose the OData services via endpoints are known
as procedures of OData Services.

OData is Open Data Protocol. The protocol is a set of rules which every payer has to follow. To Put is
straight OData interface is an Open Standard that can be consumed by any application, program,
software or device of the Non-SAP that can connect SAP using the HTTP(s) Protocol and can manipulate
(Read, Write, Modify, Understand, i.e. parse and construct) an XML document. Since the protocol is
HTTP based. Any programming language can be used for consuming OData services.

ADVANTAGES: -
1. OData is based on the rest architecture. So, we can retrieve data based on an URL.
2. It also supports HTTP. Atom Pub as well as JSON format.
3. It has support for any type of data source. Even you can use a custom class to use a data source.
4. No need to create a proxy service object. So, it is lightweight to use.
5. You can create your own custom methods and expose it.
6. Since it is a lightweight the interaction between server and client is fast. Thus, Performance is
good.
7. It offers full CRUD support by using the different HTTP methods.
 GET: - Gets one or many entries.
(“GET is the HTTP method for all external consumer applications which calls
the URI of OData services.”)
 POST: - Creates a new entry.
 PUT: - Updates an existing entry.
 DELETE: - Remove an entry.
8. A WCF (Windows Communication Foundation) Data service can expose an entity model via URI
(Uniform Resource Identifier).
9. A WCF Data service could be consumed by any type of client like Windows, Silver light, Web, AJAX
and console.
10. The OData interface is implemented using XML and JSON format. Both of these formats are well
known, Plain text protocols for the transmission of the information over the web.
11. OData message is self-describing. So, any non-SAP Web developer can understand the content of
OData message without having knowledge of ABAP or how Sap works.
12. With the advent of OData, the communication barrier between SAP and non-SAP web developers
is removed. It is an Open Book now. There is no cost or license agreement needed for the use of
OData.

NOTE: - Many organizations have now started exposing data exposing data using REST based service
however, it is very difficult to write application which works with multiple data sources as each
provider will expose the data in a slightly different way. OData service provider can expose its services
along with metadata which contains the semantics for consumption. OData exploits the common
formats like XML ATOM and JSON for communication which are commonly understood. Clients can
now understand the OData services using generic tools and can combine information from multiple
data sources.

Whenever you find a question mark “?”, You should understand, it is the beginning if a query option.

Disadvantages: -
1. Since It is purely URL (Uniform Resource Locator) Based. It is less secure.
2. As per the observations, not every query in LINQ (language Integrated Query) is available in OData
like filter, skip, take etc.

 The Project OData service gets created with four subfolders. Data Model, Service
Implementation Runtime Artifacts, Service Maintenance. Data model further has
three folders which are entity types, entity sets and association.
 Entity type is our very own structure same as work area in se38 custom program. (Just
one row which means it can hold only single data) Entity set is the same as internal
tables (Which can handle more data).

3). What is system alias?


The system alias is the result of the routing for an inbound request on SAP gateway. If that system
alias is flagged as a local SAP Gateway Instance, it means that the system responsible for processing
(managing and storing) The data of an inbound request is the local SAP gateway instance itself.

4). Types of CDS views and its advantages.

Types of CDS views are defined as below.

1. Define view: - It’s a simple view work with only one table.
2. Define view with joins: - This view is used to join more than 2 tables using joins.
3. Define view with association: - This view is used to join more than 2 tables using association.
4. Define view with parameters: - In SE11 view can only have hard-coded selections, By this
we can make selection dynamic.
5. Extend view: - This view is used to extend the standard view.
6. Define table functions with parameters: - By using this we can call AMDP methods in view.

Some advantages of CDS views.

 CDS views are like open SQL, they are database independent and run on any sap-supported
database system.
 In SE11 view field calculation is not possible where as in CDS views we can have calculated
fields. (e.g. Adding two fields at runtime.)
 CDS views support inner join, Outer join, right outer join, full join, Cross join.
 CDS views support automatic client handling.
 CDS views support open SQL and we can call them in the same way we call the SE11 view in
the application layer.
 WHERE, GROUP BY, HAVING, UNION clauses are supported in CDS views.
 Aggregation and Numeric functions are supported in CDS views.
 We can achieve OData services directly from CDS views.

5). Differentiate between CDS views and AMDP Class.

CDS views are based on single service logic they return only one result set in an output. Whereas
AMDP classes can get the results of multiple entities together by a single service call.

CDS view can be created to read and process the data at database layer. Whereas AMDP class can be
used for processing and modifying the data at database layer.

CDS view supports open SQL statements. Whereas AMDP class supports native SQL statements.

6). What is create deep insert?

When there are two or multiple entity sets in the ODATA services and the user wants to fire only one
service call which then creates or pursues data of multiple entity sets together then it can be defined
as deep insert.

7). What is system alias?

System alias can be defined as the result of an inbound request that is created or called on SAP
Gateway.
8). What is $expend?

$Expend can be used to get the data sources from multiple entity sets using only one single service
call instead of using two service calls then $expand can be used.

9). What are the annotations in CDS views?

@abapcatalog.compiler.comparefilter : for filtering.

@abapcatalog.sqlviewname : can be defined as in se11 view name.

@serch.searchable : true for searchhelp.

@accesscontrol.authorizationcheck : REQUIRED or NOT_REQUIRED

@endusertext.label : - that is for labelling the text into the field.

10). What is the difference between association and joins?

Join can be used when the user wants to get the data from two or more tables then join statements
can be used. Association is a lazy join. In other words, association can also be defined as join but on
demand.

Association does not do actual join until and unless someone triggers in. Association defines the
proper relationship between the data sources and not just joins the data sources as in joins.

Association keeps the relation between the data sources visible and not concealed as in joins.

11). What is the T-Code for checking the error log in OData services?

/IWFND/ERROR_LOG T code can be used to check the errors regarding OData services.

12). What are the restrictions for using AMDP class?

AMDP doesn’t support the parameter type RETURNING. You can only pass importing, exporting and
changing parameters into the AMDP class.

In AMDP class the parameters must be passed by value as pass by reference parameters are not
allowed.

Only structures, variables, and normal internal tables can be passed using AMDP classes. Complex
tales like nested tables as tables in tables cannot be passed.

In ABAP Dictionary if the structure is defined as method typing, then it cannot be implemented in
AMDP class methods.

Whatever in se11 views, structures, tables, variables can be implemented in AMDP class using
keyword USING. If the method is implemented using the keyword.

13). What are the differences between user exit and customer exit?

NO USER EXIT CUSTOMER EXIT


1. User Exits are implemented in the form of Customer exits can be implemented as
subroutine.  Function Exit
 Screen Exit
 Menu Exit
 Field Exit
2. In case of PERFORM. You have access to In case of customer exits you have only
almost all the data. So, you have better access to importing exporting and changing
control, but more risking is that making and the table parameters of the function
the system unstable. module. So, you have limited access to the
data.

3. User exit is considered as a modification A customer exit can be defined as an


and not an enhancement because we are enhancement because we are adding the
changing the existing code. custom functionality to the existing one and
not changing anything.

4. You need an access key for user exit. You need an access key for customer exit.
5. Changes are lost in case of upgrade. Customer exits came later and they
overcome the shortcomings of User exit.
6. User Exit will be activated automatically To activate a function module exit, you need
whenever we are activating the program. to create a project in CMOD transaction.
7. User exits are developed by the SAP only Whereas Customer exits are developed for
for SD module. SD, MM, PP, FI almost all modules.

14). How to get the URL for get expended entity.

<Parent Node> <$EXPEND> <NEVIGATION NAME> <PARAMETER>.

15). What is $batch?

Batch requests allow grouping multiple operations into a single HTTP Request Payload. Batch requests
are submitted in single HTTP POST request to the $batch endpoint of a service as described in [OData-
URI.]

16). How to associate in get expended entity?

We have to associate the parent entity with child entity and we have to define the relationship with
the key field.

17). What is the URL of get expended entity URL?

<entity name> $expand <navigation property name>.

18). What is the difference between the below two URIs?


URI /sap/opu/odata/sap/ZGW_PO_SRV/POHeaderSet(‘4500001729’)/HeadToItemNav
URI
/sap/opu/odata/sap/ZGW_PO_SRV/POHeaderSet(‘4500001729’)?$expand=HeadToItemNav

Ans: - First URI will get you the item data only from the Item Data source while Second URI will get
you the Item data and it also displays the header data on which Items are dependent. In short, the
$expend query option is expanding the Header information with the help of the navigation
property and showing the dependent entity type.
CDS (Core Data Services) in brief:-
 Why was CDS introduced?
With CDS, Data models are defined and consumed on the database rather than on server.
CDS also offers capabilities beyond the traditional data modelling tools, including support for
conceptual modelling and relationship definitions, built in functions, and extensions.
Originally, CDS was available only in the design time and run time environment of SAP
HANA. Now, CDS concept is also fully implemented in SAP NetWeaver AS ABAP, enabling
developers to work in ABAP layer with ABAP development tools while the code execution is
pushed down to the database.

 What is core data services?


CDS is an infrastructure layer for defining semantically rich data models, which are
represented as CDS views. In a very basic way, CDS allows developers to define entity types
(such as orders, business partners, and products) and the semantic relationship between
them. Which corresponds to foreign key relationships in entity relationship models.
CDS is defined using SQL based DDL (Data Definition Language) that is based on standard
SQL with some additional concepts such as associations. Which defines the relationships
between CDS views and annotations, which defines the domain specific artifacts. Another
example is expressions, which can be used in scenarios in which certain CDS attributes are
considered as measures to be aggregated.

 Features of CDS views.


1. Semantically rich data models.
2. Domain specific language (LINQ, QL, SQL).
3. Declarative, close to conceptual thinking.
4. CDs is separately based on SQL query language.
5. Fully compatible with any databases.
6. Generated and managed by SQL views.
7. Native integration in SAP HANA.
8. Common Basis for Domain Specific Framework. E.g. UI, Analytics, OData, BW.
9. Built-In functions and code push down.
10. Table functions and breakout scenarios.
11. Rich set of built in SQL functions.
12. Extensible.
13. On Model level through extensions.
14. On meta model level through annotations.
Limitations of CDS.
I. Cannot Debug
ii. Only one Result Set can be returned
iii. We cannot join 2 fields with Data type and length mismatches in the 2 tables. In such
scenario we need to use AMDP

There are two components of CDS views in HANA.

DDL SQL View: It is read only classical database view which is read only in ABAP dictionary (SE11).

It cannot be edited in SE11.


CDS view Entity: - It is the DDL source file and the actual CDS view. It is a database object which is
visible in Eclipse/HANA Studio/ADT and we cannot view CDS View entity in SE11. It covers the CDS
database view and makes other attributes possible such as authorization checks defined in CDS
views. Before I Show, how CDS view is created in HANA ADT, let me start with, how CDS view can be
deleted.

Note: - We don’t need to delete both CDS views and Dictionary DDL SQL individually for deleting CDS
views. We will not be able to delete DDL SQL view but we can delete CDS view entity. When the CDS
view entity is deleted then DDL SQL view will also be deleted.

Problems: -

How to add left leading zeros in CDS views?

In CDS views multiple parameters can be separated by comma ‘,’. We can have multiple parameters
in the WHERE clause separated by AND/OR. Also note that “$” sign needs to be provided with
parameters while using it in where clause.

(data display with parameters are not yet supported in ABAP dictionary).

Authorizations in CDS views:-


DCL:- Data Control Language(DCL) is used for controlling privileges in databases in database
operation.

Two kind of privileges are provided to any user.

1. System, and (system access taken care by SAP. We don’t need to bother much about this)
2. Object (Authorization Objects or access.

GRANT: -Used for providing any user access privileges or the other privileges for the database
operations

Revoke: - Used for taking back permissions from any user.

Role:- Special permission created by system admin for accessing (Display/Change/Create) any
particular T-Code for abap object. These shall be maintained in T-code PFCG

Vbak

Vbap (vbeln of vbap = vbeln of vbak)

konv (knumv of vbak)

mvke (matnr of vbap)

tvm1t (mvgr1 of mvke)

tvm2t (mvgr2 of tvm1t)


select options vbeln , erdat, ernam, audat, spart

Work Flow in SAP ABAP

What is Work Flow?

The "workflow" definition is the set of rules that determine the path that the process takes.
For example, how a purchase requisition is processed, from the initial request to the creation
of the purchase order.

 A Workflow Instance, which is often simply referred to as the workflow, is a single


workflow run. For example, the processing of a single purchase requisition for
computers.

 The Tasks are the steps in the process, which have to be performed either by people
or automatically by the software. For example, to check for the availability of the
spare computers in the company.

 A Work item is the task instance that is performed as a single workflow step. For
example, check that there are no spare computers available in the company.

 Agents are the people who process the tasks (via the work items). For example,
requisitioner and a member of the purchasing department.

 Container is the place where all the data used in the workflow is collected.

 Binding is the set of rules that define which data is passed to which part of the
process.

What are Important T-codes in SAP Workflow?

1. SWUS: Workflow Toolbox


2. SWU0: Simulate Event
3. SWI2_FREQ: Work items per task
4. SWUE: Event simulate
5. SWELS: Set event log ON
6. SWEHR2: Event linkage in HR
7. SWU3: Workflow customizing
8. SWU_OBUF: Synchronize buffers
9. SWI5: Look into other user’s SBWP
10. SWDD: Workflow builder
11. SWLD: SAP workflow easy access to all workflow related transactions
12. SW01: Maintain Business objects (add new attributes, methods, events, etc to standard
business objects)
13. SWE2: Active event linkages, addition options not available by SWDD such as setting
check function module.
14. SWWL_TOPLEVEL: Delete workflow items from SBWP.
15. SWELLS: Start/ stop event trace
16. SWEL: View event trace report
17. SWUD: Workflow diagnosis
18. SWI2_DIAG: Troubleshoot workflows in error, restart
19. SWIA: Workflow administrator
20. SWB_COND: Maintain workflow start condition (has pretty pics but is especially
rubbish, everything can be done easier via SWDD
21. SWNCONFIG: Send emails to the user with unread work items
22. SWEC: Trigger workflow on change doc
23. SWAY: Workflow wizard for message long text
24. SBWP: Business workplace
25. PFTC: Maintain (change, display, copy) WF objects including tasks, workflow
templates…
26. PFAC: Maintain Rules for workflow steps (can include ABAP code)
27. SM63: Events
28. SWI1: Work item selection
29. SWI2_DEAD: Workflow items with the monitored deadline (items that missed the
deadline)
30. SWI2_DURA: Workflow items by processing duration.
31. SWI11(Where-Used List of Task

You might also like