Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views188 pages

Data Dictionary

SAP, founded in 1972, is a leading ERP software provider that manages business operations and customer relationships. The document covers the history of SAP, its programming language ABAP, various functional and technical modules, and the importance of ERP systems in business management. It also details the creation and management of database tables, data elements, domains, and foreign key relationships within the ABAP Data Dictionary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views188 pages

Data Dictionary

SAP, founded in 1972, is a leading ERP software provider that manages business operations and customer relationships. The document covers the history of SAP, its programming language ABAP, various functional and technical modules, and the importance of ERP systems in business management. It also details the creation and management of database tables, data elements, domains, and foreign key relationships within the ABAP Data Dictionary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 188

INTRODUCTION TO SAP

What is SAP
• SAP stands for Systems Applications and Products in Data Processing. SAP, by definition, is also the
name of the ERP (Enterprise Resource Planning) software as well as the name of the company. SAP
Software is a European multinational, founded in 1972 by Wellenreuther, Hopp, Hector, Plattner, and
Tschira. They develop software solutions for managing business operations and customer relationships
• SAP is one of the world’s leading producers of software for the management of business processes,
developing solutions that facilitate effective data processing and information flow across organisations
History of SAP
• 5 IBM employees started SAP in the year 1972
• Their objective was to develop a business software or ERP software
• 1980 they released a new Software called as SAP R/2, where R stands for real time and 2 stands for 2
tier Architecture
• They released a advanced version of SAP R/2 in the year 1980 called as SAP R/3
INTRODUCTION TO ABAP
• ABAP stands for Advanced Business Application Programming language
• It is a 4th generation language, hence it is also known as ABAP/4
• Basically created by SAP earlier for the report creation later evolved in to full language
• Entire SAP ERP software is developed using single programming language i.e ABAP
Different M odules in SAP:
FUNCTIONAL MODULES:
• SD – Sales and Distribution
• MM – Material management
• FI – Finance
• Co – controlling
• HR – human resource
• CRM – Customer relation management
• SRM – supply relation management
• SCM – supply chain management
• APO – advanced planner and Optimizer
TECHNIVCAL MODULES:
• SAP Basis
• SAP Security
• Advanced Business Application Programming (SAP ABAP)
• High Performance Analytic Appliance (SAP HANA)
• SAP NetWeaver
• Information Systems Management (SAP IS)
• Customer Relationship Management (SAP CRM Technical module)
• Exchange Infrastructure (SAP XI)
• SAP Solution Manager

What is ERP?

1
• ERP is a software system that helps you run your entire business, including processes in finance, human
resources, manufacturing, supply chain, services, procurement, etc.,
Importance of ERP :
• It is the central neural system of the enterprise
• ERP system provides the automation, integration, and intelligence that is essential to efficiently run all
day to day businesses.
• The enterprise can be classified as a decentralized and centralized system as per the communication and
data exchanged is accomplished.
• DECENTRALIZED :
P

Data is maintained locally at the specific departments and also the departments will not be able to access
information and data from other sections.

2. CENTRALIZED SYSTEM :

2
SAP ERP software is a centralized enterprise management system.
The centralized system removes the duplication, gaps, and redundancy in data.
It provides information across all departments in real time.
SAP ERP system provides control on different business processes.
The centralized system enhances productivity, provides better inventory management, endorses quality,
decreases raw material cost, effective HR management, reduce expenses and enhances profits.
With a centralized system, the organizations can get better customer
Communication and thus improves throughput. It also helps to enhance customer service.
Types of Consultants
• Functional consultants
• Technical consultants
SAP HANA
• It is an in-memory Database and it is an Acronym High performance Analytical Appliance
• Hana is the core of digital enterprise, it is the core database
• Netviewer Stack – it is an application that you can deploy applications on to to talk back and forth on to
the Hana database
SAP Net viewer
• It is a technology Platform
• It is a collection of Software Applications
• It has Analytical and reporting capabilities
• Manages security
• Development tools to work with these technologies
• It also provides underlying servers with supports java and Abap
What is ABAP Dictionary
• We use Abap dictionary to create and manage data definitions
• ABAP dictionary permits a central description for all the data used in the system without redundancies
3
• New or modified data is automatically provided for all the system components
• This ensures the data integrity, data consistency and data security
• This dictionary supports user defined data types (data elements, structures, and table types)
• We can create the corresponding objects in the underlying relational database using data definitions
The most important Object types in the ABAP dictionary are:
• DATA BASE TABLES -
• VIEWS
• DATA ELEMENT
• TYPE GROUPS
• DOMAINS
• SEARCH HELP
• LOCK OBJECTS
What is SE11?
• Transactional Code SE11 – It is an ABAP dictionary, by using this transactional code you can create,
change and display the table entries and structures
What is Domain?
• A Domain defines is an Object that specifies technical information of data types and length of a field
• The existing domain can be used by multiple fields as per requirements instead of creating new domain
in SAP.
What is data element?
• Data elements describe the individual fields in the ABAP Data Dictionary. They are the smallest
indivisible units of the complex types, and they are used to define the type of table field, structure
component or row type of a table.
Steps to Create a Domain :
• Go to transactional SE11
• ABAP dictionary Initial Screen

4
• Select the domain in the initial screen of the ABAP dictionary and enter the name of the Domain and
click on the create button
• Name of the domain should always start with ‘Z’ or ‘Y’.
• Enter the Data type, length of the characters and Decimal places
• Save your changes, The create Object Directory entry pop up appears and asks for a package. You may
enter the package you are working on or else you can use Local object.
• After saving then Activate the domain
Steps to create Data element
• Enter transaction code “SE11” in the SAP command field and press enter from keyboard.
• Select data type button
• Enter the name of the data element that you wants to create.
• Click on create button to create new data element.
• Dialog box opens with three options i.e Data element, Structure and table type. As we are creating data
element, select data element radio button and press enter.
• Update the short descriptive name of the data element
Select predefined radio button and update data type, length fields.
• Click on save button to save the configured data element in a package
Steps to create Database Table
• Enter transaction code “SE11” in the SAP command field and press enter to continue.
• create domain
• create data element
• On the initial screen, select the database table option and enter the name of the database table that you
want to be created. After updating name click on create button.
• Click on Delivery and maintenance.
• Select the Application table and then select data browsing/table view editing option and then select
Display/maintenance allowed.

What is Data class in technical settings:


• Physical area of database where for database platforms Oracle and Informix the database table is stored.

The most important data classes are (other than the system data):
• APPL0 Master data
• APPL1 Transaction data
• APPL2 Organizational and customizing data

Size category in technical setting:


• Size category for reservation of initial memory space in the database
• Select utilities then select table contents then click on create entries and enter the details and click on the
save button.
• Select utilities, then click on table contents, select Display then click on execute icon(F8).
• At last table is created.

1 . Create student/employee Database for 7 field with data type as int, char, numc, string.
• Step1 : Enter transaction code “SE11” in the SAP command field and press enter to continue.

5
• Step2: Create the domain and name of the domain starting with letter ‘z’ or ‘y’ then enter the data type
and length of the character
• Save and active after each entry
• Step 3: Create the data element and name of the data element starting with ‘z’ or ‘y’ with respect to the
domain
• Click on the save button
• Save inside the local object package
• Step4: create a table and name of the table starting with letter ‘z’ or ‘y’
• Give the short description for the table
• Select the delivery class as application table
• Enter the data browser/table view editing as display/maintenance allowed
• Enter the fields one by one and check the box for the primary key and make one field as primary key
• Enter the data element data type and length for the field which using data elements to create a field
• Enter the data class and mention the size category as 0.
• Click on the save button and save inside the local object package
• After creating the fields. Click on the utilities and select table contents and enter the values by clicking
on the create entries.

2) Can we create a data base table without using domain and how?
Ye s we can create at the time of creating a table after finishing field press built-in-type directly u can assign
data type , length and description for each field. So we can create a database without using domain.

6
3)can we create database without data element and how?
yes we can create at the time of creating a table after finishing field press built-in-type directly u can assign data
type , length and description for each field. So we can create a database without using domain

4)what will happen to earlier data and updated data when we change the data length from 10 to 5.

7
5) What are the properties of Data Element
• Data Element comprises of two types 1)Elementary type 2)Reference type
• In elementary type we have to give the domain name, data type length , and length of the data type
• We also have built in type where it is basically consists of a field without data element, we have give the
type of data type and length of the data type
6) Sign and Case sensitive when we use and what it does when we select or deselect
• Case sensitive is basically used when we want to store the data in small letter or capital letters
• By default it is set to capital Letters, that is even if you type the data in small letter the database will be
recorded in the capital letters
• By checking the case sensitive option, The database will take whatever the case we are using in order to
store the data
7) What is value range and its use?
• The domain defines primarily a value range describing the valid data values for the fields referring to
this domain.

• A Domain defines a Value Range.


• The value range of a domain can be restricted by defining fixed values.
• If all the fields or components that refer to the domain should be checked against a certain table, this
table can be defined as the value table of the domain.
8
8) what is Data class
• Data class. The data class defines the physical area of the database in which your table is logically
stored. If you choose a data class correctly, your table will automatically be assigned to the correct area
when it is created on the database
• The Data class determines in which table space the table is stored when it is created in the database.

9) What is size category


• Size Category in SAP defines the expected space required for the table in the database initially and if the
initial space is not enough, the same amount of space is reallocated when required.

9
STEPS TO CREATE DATABASE TABLE WITHOUT DATAELEMENT:
Yes it's possible to create a database table without dataelements:
STEPS TO CREATE DATABASE TABLE WITHOUT DATAELEMENT:
STEP 1: Enter transaction code “SE11” in the SAP command field and press enter to continue.

STEP 2: On the initial screen, select the database table option and enter the name of the database table
that you want to be created. After updating name click on create button.

STEP 3: Then give a short description about table and add delivary class as (master data and
transection data)

STEP 4: in this step give the data class as APPL and size catagory as 0 ,then save and activate the table.

10
STEP 5: in this step add fields to the database table as required manner .

STEP 6:in this step we select the built-in-type without creating the data element and directly click on data type
column to select the data type

STEP 7:select the required data type and size (for integer data type its size select automatically)

STEP 8:this step is to show how integer datatype taken


size automatically

11
STEP 9: save the database table and activate the table

STEP 10:To Create the Entries for the Table


Utilities > Table content>Create Entries

STEP 11: TO Display The Entries


Utilites>Table content> Display>Execute

12
CAN WE CREATE A DATABASE TABLE WITHOUT DOMAIN: yes its possible to create database table
without domain(scren shots)
step 1:give table start with Z or Y
 then click on create

step 2:
 give the short description
 select the delivery class as (master data and transparent data )
 the select the data browser as Display maintenance allowed

13
step 3:then go to table fields give the field name
 select the option called in-built-type option
 then give directly data type and length and short description for fields

step 4: then go to input help check in this option we see that domain column is not having any domain name.

14
step 5: select the option on called technical setting and give data class as APPL0 and size catagory 0 .

step 7:save and activate the table we will get the database table without doamin as well as data element.

15
Q NO 5: WHAT ARE THE PROPERTIES OF DATA ELEMENT
 Data elements describe the individual fields in the ABAP Data Dictionary.
 They are the smallest individual units of the complex types, and they are used to define the type of table
field, structure component or row type of a table.

What is a Data Class and Size Category?


 The Data class determines in which tablespace the table is stored when it is created in the database.
 the data class can be assign to a table using Technical setting
 A data calss can represent a physical area in the database where all the table assigned to this data class
are stored.
 THERE ARE 4 TYPS OF DATA CLASS ARE PRESENT DDIC .
APPL0 - Master data (data frequently accessed but rarely
updated)
APPL1 - Transaction data (data that is changed
frequnetly)
APPL2 - Organisational data (customizing data that is entered when system is configured
and then rarely changed)
USR & USR1: are customer data. USR is a table namespace dedicated for user and
customer developments, i.e. Z_ and Y_ tables.
What is a Size Category?
 The Size category describes the probable space requirement of the table in the database.
How Many types of size categories and data classes are there?
There are five size categories (0-4) and 11 data classes, only three of which are appropriate for application
tables:

1. What is Foreign Key relationship?


Foreign key field is the database table column of a details table which is dependent on the
primary key field of parent table .
 Foreign keys are used to establish the relationship between the different tables present in the
ABAP Dictionary.

16
2. Create Foreign Key b/w 2 table & each table should have 5 fields.

 STEP 1: First create two tables with different name


TABLE 2:

TABLE 2:

 STEP 2:Add the Entries to the both the tables

 save both the tables and execute the tables

17
 Select the foreign Key and then add the name of the another table which we want to join with this
table

18

 and next click on create proposal and copy .

 its shows a success message like Foreign Key TABLE NAME was applied

19
 then go back home screen and type tcode as SQVI And then Enter

 then give the this page will be open


 give Quickview as we required.
 enter the create

20
 After that give the tiltle as we required (EX :demo).
 select data Source and select second option TABLEJOIN
 Click on Enter

 Then select insert table1 and add the table1

21
 again select the table 2 and add the table 2.
 if both Table 1 and table 2 are connected its shows a line in between two tables .

3. What is value table & it's uses?


 value table is the one which is define at domain level foreign key relationship is automatic in the
value table
 in check table the values is present then in value table it is allowed to update the records
4. Diff b/w check & value table check table
 check table is the one which is defined at field Level
 This Table is stores the master data
 foreign key Relationship is not Automatic

5. What is the use of Foreign Key summary? & About it's types

22
Foreign keys are used to establish the relationship
between the different tables present in the ABAP
Dictionary.
 We can create value checks for input fields using the
foreign keys. ...
 The table that contains the foreign key is called a
foreign key table and another table that contains
valid fields, known as the value table.

 It connects two tables by assigning the foreign key


field of one table to the primary key field of another
table.
Foreign key Fields Types:

1. Non key fields/candidates: The foreign key fields are


neither primary key fields of the foreign key table nor
do they uniquely identify a record of the foreign key
table (key candidates). For this reason, the foreign
key fields do not (partially) identify the foreign key
table.
2. Key fields/candidates: The foreign key fields are
either primary key fields of the foreign key table or
they already uniquely identify a record of the foreign
key table (key candidates). The foreign key fields
therefore (partially) identify the foreign key table.
3. Key fields of a text table: The foreign key table is
a text table for the check table, that is the key of the
foreign key table only differs from the key of the
check table in that it has an additional language key
field. This is a special case of the type Key
fields/candidates.
The text table contains the language description of values in a check table. It used for multi language
purposes.

6. What is cardinality & About it's types


The cardinality (n:m) describes the foreign key relationship with regard to the number of possible
dependent records of the foreign key table with records of the check table.
The left side (n) of the cardinality is defined as follows:
n=1: There is exactly one record assigned to the check table for each record of the foreign key table.

23
n=C: The foreign key table may contain records which do not correspond to any record of the check table
because the foreign key field is empty. This can occur for example if the field of the foreign key table is
optional, in which case it does not have to be filled.
The right side (m) of the cardinality is defined as follows:
m=1: There is exactly one dependent record for each record of the check table.
m=C: There is at most one dependent record for each record of the check table.
m=N: There is at least one dependent record for each record of the check table.
m=CN: There may be any number of dependent records for each record of the check table.

7. When we've 10 records in check table & when we try to add 11th records in item table what will
happens?
 in this scenario the foreign key relationship will work .
 its not allowed to add other records which is not present in check table .
 its show an error as below in screenshot

 STEP 2:Add the Entries to the both the tables

 save both the tables and execute the tables

24
 Select the foreign Key and then add the name of the another table which we want to join with this
table

25

 and next click on create proposal and copy .

 its shows a success message like Foreign Key TABLE NAME was applied

26
 then go back home screen and type tcode as SQVI And then Enter

 then give the this page will be open


 give Quickview as we required.
 enter the create

27
 After that give the tiltle as we required (EX :demo).
 select data Source and select second option TABLEJOIN
 Click on Enter

 Then select insert table1 and add the table1

28
 again select the table 2 and add the table 2.
 if both Table 1 and table 2 are connected its shows a line in between two tables .

What is view ?
view is the one which is used to summarized the data which distributed in the different database table,
Database Table has physically contains the data but view does not contain any physical data .
View is the joining of 1 or more database tables ,but view will pick the data from the database tables and
project the data on the screen.

 There are Four types of views are present in ABAP Dictonary


A. Projection view
B. database view

29
C. help view
D. Maintance view
1. projection view is used to retrive some fields of an single table its only for single table
2. database view is used to retrive the fields from 2 tables
3. it is used for the search help

create projection view


step 1: Open ABAP dictonary intial Screen by entering the Transection code se11
Then select Radio button view and give the Database table name
then Enter the Create
Step 2: In step 2 select which type of view we are going to do for that table

STEP 3: In this step give the short description and then give Basis table
name we want make view that database table that will be saved and activated mandatarely.

30
step 4: Then select the Table field select fields from given table as given in Basis table select required fields
only to show

step 5: then save and activate


then execute the tebale its shows the data which fields we selected before as shown in Screenshot

3. What is Basis Table?


Basis table is the one which one is used for the holding of database table name when we go to make
Projection view

4. Is Foreign key mandatory to create Database Table?


in creating a database table the foreign key is mandatry when we have to go with foreign key
relationship we need foreign key

31
5 Create database view for single table & two table with selection condition
data base view for two tables
step 1: first select the database view option and enter

step 2: then give the short description and go with table join/condition
step 3: add two tables in the table field and check the relation between two tables are entered,

step 4: if both the table are in foreign key relation then its show the foreign key relation with specific field as
show in screenshot

32
step 5: then select the view field and enter the table name and field which field are we have to show from
both the database table

step 6: then select the SELECTION CONDITION and give the table name and field name operator and
comparision value
then we have to show more then one field fromdatabase then select AND /OR Operator the give table name
and field name nad operator we have to use for validation of field name and dependent data that present in
database table

33
step 7:
after compliting of selection condition then select maintance status and select maintence allowed or
maintenace allowed with Restriction

step 8:
then save and execute the table its gives the result as per the jion condition as given by us.

34
6. Create Help view for 2 table
Create Help view for 2 table.
Steps to Create Help View for 2 table are
STEP 1 :- To Create View We use Tcode (se11)
STEP 2 :- Give the name to view and enter create button.
STEP 3 :- Select the view type And After enter the Short Description .

STEP 4 :- Enter the Table name and find The Relationship.

35
STEP 5 :- Select the related Relationship And Apply the join Condition.
STEP 6 :- Enter to View field and Select table fields and select first table.

STEP 7 :- Select Fields and Enter Copy.


STEP 8 :- Next Select The Second table and Select the fields.

36
STEP 10 :- we can not Display The output it will not displayed.

QUESTION 7 :-
what are the uses of maintenance status in SAP ABAP
The maintenance status of a view controls whether data records can also be changed or inserted in the tables
contained in the view.
The maintenance status can be 2 Types as follows:
Read only : Data can only be read through the view.
Read and change : Existing view entries can be changed. However, records cannot be deleted or inserted.

1.What is Structure in DDIC & it's types


 Structure is the one it will stores the number of Fields or

37
 structure is the composite of fields.
 and it will stores the different Fields with different data element with different datatypes .
2. Diff b/w append & Include structure:
APPEND STRUCTURE: append structure is the one which is add the fields in the end of all the fields and
append structure is not possible to Reuse .
: An append structure is a structure that is assigned to exactly one table or structure. There can be more than
one append structure for a table or structure.
Append structure is used to add additional fields to standard SAP tables.
Append structure cannot be used with cluster and pooled tables.
Append structure is included in a table/structure using .APPEND
The name of a append structure can begin with Z* / Y* .
INCLUDE STRUCTURE :
 In this structure it is possible to add the structure in any were of the table like in between any
fields and it is possible to reuse the include structure .
 it possible to add an include structure for custamizing table
 it is [possible to add more then one include structure in an table
 include structure is that assigned for one or more table

3. Can we create structure inside structure ? If yes in how many ways we can create the same?
 yes we create a structure inside a another structure
as per the normal structure creation method
 step 1:first we create an structure
 enter the Tcode se11
 then select the data type and enter create


 step 2: select the radio button structure and enter

38

 step 3: then select the components of (field name from another table ) and then select typing method
types and Componenet type from same database table same field select in the component then press
enter.


 STEP 3 : in this step select the EDIT => APPLY FIELDS => GIVE STRUCTURE NAME i.e table name that
we want to select the fields

39

 select the fields and select the radio button copy.


 then again open structure tab and past that copied fields by selecting the paste option .
 then save and activate. the structure .

40

 then go back to se11 open database table
 then select EDIT=>INCLUDE=>INSERT
 then select the position where we make include structure then press enter after giving the structure
name .then structure will allocate any where in the ddatabase table


 after executing the table that table will shows the fields of structure that we added into the existing
database table .

41

 THEN WE CAN ADD THE STRUCTURE INSIDE THE ANOTHER STRUCTURE
 STEP 1: first we create two or more structure .


 then add the structure 1 inside the another structure by this process EDIT=>INCLUDE=>INSERT
 then enter the structure 2 inside the structure 1.

42

 after compliting of these process the structure is shosws like this.

4. Try to include same include structure twice in same table & check what will happen ? If any error occurs
then how to overcome on it
 it is not possible to add same Structure inside an Database table its shows an ERROR like as shown in
screen shot

43

 if we have to over come this we must change the Structure name .
5. How many include structure can be include in single table ?
 we can include only 9 structure include the Structures That can be Added for the particular table but
The name of the Structure must be different From Each other.
6. Create Append structure & create one more append structure then see where it will appear ?
STEP 1: in this step we create the append structure for an table table select first give short description and
add the the fields we want to add at the end

step 2:open table and select the append Structure option


 after that select the specific structure and add into the table

44
step 3:we create the fields for the specific append structure
and save and activate the append structure

step 4: then open the table that is append structure is applied


its taken append structure as .append and there fields end of the table

45
 if we try to add more then one append for a same table that will take at one after the other as we
applied .

1. What is TMG? Create TMG for 1 & 2 steps with separate TMG Create TMG with 5 events which
include date, time, username & rest 2 anything as per requirement.
TMG (Table Maintenance Generator) in SAP ABAP is a tool to generate table maintenance program to
maintain table entries in sap
Sometimes the End user also required maintain Table fields manually in this case we will generate TMG(Table
maintenance Generator).
STEPS TO Create TMG for 1&2 steps :
Step 1: Enter TCODE SE11 IN ABAP Dictonary
 and select radio button view
 enter the name its should be start with Z or Y.
 then enter create after that select MAINTENANCE VIEW then click on enter

46
STEP 2: Give short description and then select the table column enter the table table name which is already
created
 and its mandatory to make foreign key relationship between two tables for two table maintenance
view
step 3:in this step we select view field which we select the
fields for the purpose of to Edit the data and Read the
data and delete the data.
 first we select the table after that we need to select the fields then click on copy save and activate the
view.

STEP 4: After actiavting the view select the utilities and select
 the option called (TMG) Table Maintenance Generator
 then give the authorization group as per required .
 and select function group that is same as the table/view
47
 then select maintance type there are two types of maintainanve types available in abap dictonary
 ONE STEP AND TWO STEP
 if programer select the ONE STEP then Maintanance screen select only one screen i.e overview screen
 (i.e key fields and normal fields are show in same view)
 if programer select the TWO STEP then this will shows the Maintenance Screen as single screen and i.e
two
 (in this scenario key fields and normal fields are shows saparetaly i.e first key fields and then normal
fields).

STEP 5: Again select Environment option


 inside that select Events and click

STEP 6: in this step select new entries option and add some data into the table

48
STEP 7: there are more the 30 maintenance views are present in SAP ABAP dictonary select as per required
 in our case we select 05 option that is CREATE A NEW ENTRY
 Then give form routine as same as view name.

 then click on enter then one editor is open as shown in below figure
 then click on enter and save and activate

49
 step 8 : after that the the code Editor will open then write a simple code as per The required as
shown in figure
 then save the code and activate the code without any error.

STEP 9: if add any data that will be updated in table with out any restriction as shown in figure
 and the key fields and then non key fields are appear in saparate view

50
if we select the maintainance type as omne step
it will show key fields and normal fields are in the same screenwithout any saparation

3.Explore option button in TMG


 An authorization group comprises of views and tables with similar security requirements. In the Table
maintenance dialog, the user maintains the same group for tables which require a like authorizations.
 A Function Group is a primarily a collection of function modules which shares global data with each
other. When an ABAP/4 program encompasses of a CALL FUNCTION statement, at runtime the system
loads the entire function group in with the program code
4.Create TMG table with diff data browser
 In display/maintenance with restriction you can create new event but you cant give new entry to the
table
5.What is overview screen & single screen
 over view : overview screen contains only the key fields and texts longer than 20 characters
51
 single screen : Single screen will contain all the other fields.
 we can't update the records using single screen ,
 only possible to create and delete is possible by using the single screen
6.Can we delete record present in the table after creating TMG ?
 it is possible to delete the records from a database table after creating the TMG .
7. After creating TMG can we make particular records non editable ?
 A field can be made Non editable by clicking the checkbox of the Input option of that particular field
 i.e uncheck the checkbox of the respective field. like which field we want to make non Editable.
8.Diff b/w Database view, Projection view, Maintenance view & Help view
1.PROJECTION VIEW:
 A projection view contains exactly one table.
 You cannot define selection conditions for projection views.
 Projection views are used to hide fields of a table.
 It is also possible to access pooled tables or cluster tables with a projection view.
 We can access the projection view from the program with Open SQL statement..
 This means that only the data that is actually required is exchanged when the database is accessed.
2.DATABASE VIEW :
 Database views implement the inner join.
 We can define the selection conditions in the view
 We can join 1 or multiple tables in the database view
 Foreign key relationship is not required between the tables for joining the tables
 If database view contains one table, we can read and write the data to the view
 If database view contains multiple tables, we can only read the data.
 We can access the database view from the program with Open and native SQl statments
3.MAINTENANCE VIEW :
 Created by joining two or more related tables.
 Join conditions are always using the foreign key. Data can be changed, viewed and created using such
maintenance views.
 where the user Also possible to edit the records which have a corresponding to.at the same time,
making it possible to maintain the data involved.
 Data from several tables can be summarized in a maintenance view
 Mantainance views implement the outer join.
 We can define the selection conditions in the view
 If maintanance view contains one or multiple table, we can read and write the data to the view
 We can not access the maintance view from the program.We can maintain the data from the SM30
transaction
4.HELP VIEW:
 it is used for the search help.
 and this will not be executed because its not allowed to show and read option
 Help views are used to output additional information when the online help system is called
 Help views implement the outer join.
52
 We can define the selection conditions in the view
 We can join 1 or multiple tables in the help view
 Foreign key relationship is required between the tables for joining the tables
 If we need a view with outer join for the data selection in the search help, we have to use a help view
as selection method.

What is Index ?
i. index is the one which is used to improve the Performance of the Data base table
ii. in SAP ABAP, indexes are used to avoid the duplicate data and improve the performance,
What is Primary & Secondary Index
Primary Index:
i. Primary indexes in SAP are created automatically by the SAP system using key fields of database tables.
Secondary Index:
i. Secondary indexes in sap are created by the Programer to Avoide the duplication and improve the
performance of an database table.
 Steps to create an Secondary index.
step 1: First we open the any database table and activate the table and select
the option INDEXES.

 in the below screen select the option create option

53
After selecting the create index option it will ask for which type of index we have create then select any
one option
 Normal index
 Extention Index

54
Again this page will asks for the index name give the index name and then enter

 then select the option NON-UNIQUE INDEX and then select the fields from a particular table then
save and activate.

 After the activating the index Go Back and Cheack weather Index is Activated or Not.in the status.

55
Diff Between index And extension index ?
index :
i. this is the one type of index that the SAP consultent can be possible to create this
ii. it we can modify the index.
iii. when the version is changed (or) updated at that time the data will be lasted in the normal index.
extension index :
i. This is one type of Index that the SAP consultent can be possible to create this also.
ii. AND this one can not be modified
iii. when the version is changed (or) updated at that time the data will be updated (no data lost ) in the
Extension index.
How many index can be created for particular table ?
i. As per the the Requirment its possible to create an indexes as we want
ii. but when we Create more then 9 indexes in a particular table Then performance of an Table will be
Reduces due to more number of Searching oprations.
What's the use of index
 in SAP ABAP, indexes are used to avoid the duplicate data and improve the performance,
 Index is help to searching the the record from an database table.
What are the Disadvantage of index
 indexes are updated when table is changed, i.e. the additional index makes other operations slower.
 Additional indexes can place a load on the system since they must be adjusted each time the table
contents change. Each additional index therefore slows down the insertion of records in the table

Do R&D in index option part


UNIQUE :
 It does not show data base Index name.
NON-UNIQUE:
 1.Index in all database systems: The index is always created in the database.
56
 2. In selected database systems: The index is created depending on the database system used. In this
option, you must specify the databases in which the indexes are to be created. You can do this either
on an inclusive (list of systems on which it should be created) or an exclusinve (list of systems on which
it should not be created) basis. In either case, you can list up to four different database systems.
 3. No database index : The index is not created in the database. If you set this option for an index that
already exists in the database, it is deleted when you activate the table in the ABAP Dictionary.

1.what is search help and types of search help?explain them in a table? how many ways we can do it? and
try to do it to assign search help to the field
 Search helps are objects that you can use to assign input help (F4 Help) to screen fields
 search help will provide possible Entries to the Particular Elemantry
THERE ARE TWO TYPES OF SEARCH HELPS ARE THERE
A. ELEMENTRY SEARCH HELP: elementry search help means we can create an elementry search help for
the single table
B. COLLECTIVE SEARCH HELP : collective search help means That we can create More Then one
Elementry Search Help. for an table
STEP 1 :First step we need to select se11 and open this screen
 then select the Select Search Help option
 give an Name for seaech help.
 then click on create .

STEP 2:
 Then select the type of search help that we are going to create
 then press enter

57
STEP 3:
 give short description
 Go to Data collection select selection method
 give the table name which table we need create search help
 Then move into Dialog Behaviour
 Dialouge Type as DISPLAY VALUE IMMEDIATLY.
 if we give the standerd table then it automatically takes text table in the data collection.

STEP 4:
 in this step go to Parameter section
 select Search help parameter for selecting the fields from an particular table which one is given in the
seelection method

58
 Then select option IMP(import) to retrive the data from an particular table and EXP(export) for the
display the data which is already Retrived from an database table
 and select Lpos and Spos to display the retrived data.

STEP 5 :
 Then select the data from an particular database table
 then press Enter for the Execution data

STEP 6 : Then it will be show the data from an database table which field we selected in the search box.

59
STEP 7: Give the values to the its dispaly the corresponding values in the below screen.

3.Explore SDis, Dialog type, LPOS, SPOS, IMP, EXP, Default value
 SDis : displays field in a dialog box of an elementary search help
•The search help parameter appears in the selection popup window for restricting values as a pure display
field.
2. Dialog type : You use the dialog type of an elementary search help to define how the hit list is displayed
when the input help is called
• You can specify one of the following dialog types for an elementary search help:
1. Display values immediately:
 The hit list is immediately displayed when the input help is called. This is rational only if the hit list
contains a few entries.
60
2. Dialog with value restriction:
 The dialog window for restricting values is offered immediately. Choose this option if the list of
possible entries is large. If the user limits the amount of data to be processed, the hit list becomes
more comprehensible and the system load during value selection is reduced.
3. Dialog depends on set of values:
 If the hit list contains less than 100 entries, it is displayed immediately. If the hit list contains more than
100 entries, the system displays the dialog box for restricting values.
3.Lpos : Position in the hit list of an elementary search help
• If the parameter should not appear in the hit list, leave this field empty. No position number may
occur more than once in this column, but gaps are allowed. They do not affect the design of the hit list.
4. Spos : Screen Position. It is used for arranging the fields in popup screen.
5. IMP : Indicates whether value is imported from selection screen into search help
6. Exp : EXP. Indicates whether value is exported back to selection screen.
4.what is search help exit?
 A search help exit is a function module that has a predefined interface. A search help exit is called at
certain times by the help processor. The administrative data of the help processor is passed to the
search help exit using the interface.
5.what is append search help?
 You use an append search help to enhance a collective search help, which is not the original in
the current system, with further search paths (elementary search helps) without modifications. This
technique can be used for example by special developments, country versions, SAP partners and SAP
customers to add further search paths to a collective search help in the SAP standard version.
6.what is the use of hot key?
The hot key is used to
-> select the elementary search help from the collective search help and
-> To enter the restrictions in the dialog box for restricting values directly from the entry field.
Advantage:
If the user often searches for values using the same search help, this procedure can save time.
7.Steps to create Hot key? and show specific elementory search help with the help of hot key.
 The hot key functionality makes SAP search help more flexible by giving you a shortcut to select an
elementary search help from the collective search help directly in the input field. Find out how you can
apply this functionality to your SCM tasks in your SAP system. Key Concept Hot keys is an SAP
functionality

8.create elementary search help and collective search help


 Steps to create elementary search help
Step 1: Go to transaction se11

Step 2: select the search help radio button and give a starting with the ‘z’ or ‘y’ alphabet and click on the
create button

61
Step3: choose the radio button Elementary Search help and press enter

 Step 4: Give the short description and Press enter


 Step 5 : Select the Selection method and choose your Database table and press enter
 Step 6 : Click on the drop down menu and select the any one of the value present in the dialog box
 Step 7 : click on the hot key box and give any alphabet to represent the hot key.
Step 8: In the parameter table click on the search help parameter and enter your field

Click on the check IMP and EXP in order to import and export the fields into your selection table.

62
Step 9 : Give the values to LPos and SPos , values should in the form of number LPos represents LPos
represents the position of fields in the hit list and SPos represents the position of fields in the Dialog box.
Step 10 : Give the respective Data elements for your Fields and press enter
Step 11 : Save and Activate your Search help
Step 12 : Now Press F8 and enter your respective Fields and Press enter

If the entered values are present in the respective table, if the given value is present in the Hit list output is
shown in the dialog box, else it throws an error saying ‘no value for the selection’.
 Steps to create Collective search help
Step 1: Go to transaction se11

Step 2: select the search help radio button and give a starting with the ‘z’ or ‘y’ alphabet and click on the
create button
63
Step3: choose the radio button Collective search help and press enter

Step 4 : Give the name for the collective Search help and press enter
Step 5 : give the short description and press enter
Step 6 : Click on the definition and give the name for search help parameter
Step 7: click on the check box and check both imp and exp in order to import and export to the selection
table respectively

Step 8: click on the Included search help and enter your elementary search helps,
Step 9 : enter the reference parameter and click on the copy button

64
Step 10: Save and Activate your collective search help
Step 11: press F8 and enter the fields

65
Step 12: If the entries are found in the respective elementary search help, it will collectively display in the 2
different dialog box with the respective elementary search help.

9.RND dialog type


You can specify one of the following dialog types for an elementary search help:
Display values immediately:
 The hit list is immediately displayed when the input help is called. This is rational only if the hit list
contains a few entries.
Dialog with value restriction:
 The dialog window for restricting values is offered immediately. Choose this option if the list of
possible entries is large. If the user limits the amount of data to be processed, the hit list becomes
more comprehensible and the system load during value selection is reduced.
Dialog depends on set of values:
 If the hit list contains less than 100
 entries, it is displayed immediately. If the hit list contains more than 100 entries, the system displays
the dialog box for restricting values.

•WHAT IS SNRO AND HOW TO CREATE A SNRO ?


•SNRO transaction to maintain number ranges for business objects like accounting
documents (FI), controlling documents (CO), sales orders (SD), etc. In addition, there are
other transactions available to maintain application specific number ranges.
Step 1: Enter the tcode SNRO and open number range object maintenance
Screen
• Then Give the name for and click in create

66
Step 2 :give the short text and long text
• Save in the specified package
• Then select the option number length domain
• And warning % 10.0 %
• Then save the object

Step 3:

67
• In this step we select the radio button called interval editing
• Then open intervals

Step 4 :
• Add the values from number as 00000001 and to number 99999999 or as we required
• It is gives the number from 01 to as we given in the to number range
• Save the object and come back

68
Step 5: then go to option called NR STATUS
• NR STATUS gives the increment of each execution of program
• i.e if we give NR STATUS as 01 every time the number will incresses by 1 .

Step : 6
• Then enter the transection code se38 and open the screen and give program name
• Give the program name and click on create

69
Step 7: then give Title
• And select the program type as Executable program
• Save and activate the object

Step 8 :
• Select the pattern option and give the function name as NUMBER_GET_NEXT
• This function gives the next value every time after its execution.

70
Step 8:
• Create an variable to store the values
• Give the NR_RANGE And Object as same as the function created
• Un comment all the member is under Exception
• After the ENDIF statement print the variable
• Save and execute activate the program

Step 9 :
• Execute the program directly then its gives the output as show in below Screenshot
• Each execution of same program it increses the value by 1.

71
• APPLICATION OF SNRO?
• SNRO is used to create unique invoice/document numbers. Custom Sequence Number
can be created by transaction code SNRO
• To maintain number ranges for a business objects like accounting documents,controlling
documents, sales order etc...

1. what is pool table? steps to create pool table.

Pool table is a type of table which stores less amount of data in large no of table
• Go to ddic, click on utility, select another dictionary object
• Choose radio button pool and cluster Give a suitable name
• Choose pool or cluster as per requirement
• Select on create
• In the change pool page, give sd, go to environment setting choose size category, save and
activate
• Come to ddic create a table: Znv_p, give a suitable name, give delivery class and data browser
and give the pool table name here ZPOOLS
• As like transparent table give field name, save and activate

72
Step2: for creating the pool table

73
2. Cluster table: ZNV_CT
• It is a type of table which is store the large no of data in less amount a size.
• Same as like pool table we have to create the cluster table first by choosing cluster option
• Then save and activate
• Come back to ddic, assign table type(in the technical setting ) give field type and save and
activate

• NOTE:-If table type is not working then click on extra and choose display/table type change

• NOTE:- YOU HAVE TO COPY GENERIC KEY MEANS(TABLE FIELD ID NAME) AND
PASTE IN THE CLUSTER CREATION PAGE IN THE ID NAME OTHERWISE YOU WILL
GET ERROR THAT GENERIC KEY FIELD IS MISSING FROM THE TABLE

1.What is a lock object and what are the types of locks?


• Lock object is nothing but It is used to avoid the concurrent access By the Multiple user on the same
database table.
• TYPES OF LOCK OBJECT:
TABLE LEVEL LOCK
ROW LEVEL LOCK
2.Explain types of lock object?
TABLE LEVEL LOCK:
74
• In This type of Lock, we have possible
To lock the whole table,
ROW LEVEL LOCK :
• In this type of Lock, we have only Lock the
Particular row in an specified table.
3. Explain modes of lock object
1. Read/Shared Lock
• This lock allows read-only access to the object shared
• One can edit and multiple can read
• It allows programs and users to read the data or object but not write/modify/update the same
• Thus it protects ‘read’ access to data or object
2. Write/Exclusive Lock
• This lock allows neither read nor write access to shared objects by other transactions or users
• Thus it protects ‘write’ access to data or object
• One can edit and one can read.
3. Enhanced/Exclusive without Cumulating Lock
• This lock works similarly to write/exclusive lock
• Enhanced lock includes additional features like protecting the object or data from further access
attempted by same program, transaction or user
• Whereas exclusive locks can be requested several times by the same transaction and
released one by one, an exclusive, non-cumulative lock can only be requested once by the
same transaction. Each further lock request will be rejected.
4. Set Optimistic lock:
• Optimistic locks initially behave like shared locks and can be converted into exclusive
locks.
4.What are function modules are generated after activating the lock object?
When you create a lock object System automatically create two function modules
1. ENQUEUE => Lock object name to insert the object in a queue and one to lock the
data.
2. DEQUE => Lock object name. To remove the object is being queued through above Function Module
and one to release the lock

5.Practice whatever taught in today’s session


Step 1: Enter the Tcode se11
• Select redio button LOCK OBJECT
• Give the name for the lock object
• Name must start with E –followed by Z & Y
• The enter create button

75
Step 2: Give the short Desription for the lock object
• Then enter the table name which table we neeed to lock.
• Then select the lock mode I.e which type of lock we have to made for that particular table.
• Then save and activate the Lock object.

Step 3:
• Enter the Tcode SE38 Then enter

76
Step 4:
• Give the program name as given In the lock object name.
• Select source code
• Then create

77
Step 5:
• Select the option called pattern
• Give the lock object function name :ENQUEUE_E_TABLE
• Then enter the lock object function is called and show it in the page

Step 6:
• In this step uncomment the

78
• EXPORTING ,MODE_RSTABLE, AND TABLE NAME
• Then give the table name which is used in the creation of lock object.
• Then select the time period how much seconds we are going to lock the table .

Step 7:
• After creating a lock object again select the pattern option to call an unlock function
• Type an Function name to call DEQUEUE_E_TABLE .
• Then click on enter

79
Step 8:
• After calling the function it display some code
• Remove comment For EXPORTING ,MODE_RSTABLE AND RTABLE NA,ME
• Then save and activate,
• This functiuon is Removes the lock from a table which is locked by the function ENQUEUE_E_TABLE.

80
Q. 1. What’s Structure & it’s Types explain ?types of structure.
Structure is a similar to user defined data type in DDIC & it’s a reusable component that contain fields,
Data Element, Table types, tables and holds records at runtime & it can be nested with another structure.
It is used to define the same work area in multiple programs.
We can create it similarly to a table

Types of Structures
• Local Structures - Structures created in the ABAP programs that are local to the program.

• Global Structures - Structures created in ABAP dictionary that are globally available to all the
programs. Because Global structure is created in DDIC (i.e., global place which comes with
APPEND & INCLUDE Structure)

NOTE: Flat Structure, Nested Structure, Deep Structures are belongs to Local structure bcz they are

created by SE38 T-Code.

Local Structures are three types based on how they created and those are –

• Flat structures do not contain any deep components. They only contain components with flat data types,

such as elementary types c, n, d, t, decfloat16, decfloat34, f, i, int8, p, x, plus b, s (or structures with these

types).

• Flat character-like structures are flat structures that contain only character-like components.

Ex: we have four

simple fields

• Nested structures contain at least one substructure. A nested structure is flat or character-like, depending

on the attributes of all of the components.

Example: Diagram

81
• Deep structures contain at least one deep component, at any nesting level. Possible deep components

include strings, internal tables, boxed components, data references, or object references.

A structure that contains static or dynamic components is (formally) a static or dynamic data object,
respectively.

• Que .. difference between Type and Data ?


Types :
TYPES statement defines the structure without allocation of memory,
• Create a structure by using types statement and refer it by using the DATA statement
• Each ABAP program define its own data types using the type statement

DATA :
• DATA STATEMENT you can define data statement with physical memory.
• declare its own variables or instance attributes of classes using the statement DATA

• What is Local Structure and Global Structure ?


Ans :-
Local structure :- Structure created in the abap program(reports ) that are local to program

Global Structure :- Structure created in ABAP dictionary that are globally available to the all
program .

• Que what is Flat structure and nested structure and create flat and nested struct in the reports ?
Ans :-

82
• How many Ways We can create nested structure ?
Ans :-
• Using type to nesting

TYPES : BEGIN OF EMP_DETAILS ,


NEST_TY_EMP TYPE TY_EMP ,
NEST_TY_EMP_DEPT TYPE TY_EMP_DEPT ,
BEGIN OF EMP_MORE_DETAILS ,
EMP_SALARY TYPE i ,
83
END OF EMP_MORE_DETAILS ,
END OF EMP_DETAILS .
(2)using include structure keyword

DATA : BEGIN OF TY_STUDENT,


STUD_SCHOOL_NAME(30) TYPE C .
INCLUDE STRUCTURE TY_STUD_DETAILS .
DATA : STUD_PRINCIPLE TYPE C LENGTH 22 ,
END OF TY_STUDENT .

• . Create Deep structure , DO R&D ?


Ans :-

• . create a nested structure with 8 fields without using global structure and assign the value To all the
fields in the structure and print them in output screen ?

84

8) Difference between work area and Internal table ?

Work-Areas − Work area is basically variables used to store a single row of data. It is similar to
Ans:-

structure apart from the fact that it can only be used at program level whereas structure can be used
at data dictionary level as well.

Internal tables − Internal tables are a means of storing data in the fixed format in working memory of
ABAP. The data is stored line by line. So it is necessary for the data to be in a fixed format. Generally,
they are used to store data in database tables to be used in ABAP programs.

85
9) How many ways we can create reports program ?
In Two ways we can create Nested Structure. ist way is first you have creat a structure then call
that structure using .INCLUDE <STRUCTURE NAME> keyword. Another way ...

Q. 1. Create a standard internal table with unique key, fill the values and display them.


Ans: Steps to create a standard internal table with unique key:


Go to SE38.


Enter Program name as ‘ZNV_INTERNAL_TABLE_WUK’ & Click on Create.
Write the following program.

⦁ The output will be displayed.

86
Q. 2. Create a standard internal table with non – unique key, fill the values and display them.


Ans: Steps to create a standard internal table with non – unique key:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_WNUK’ & Click on Create
Write the following program.

87
⦁ The output will be displayed.

Q. 3. Create a standard internal table, fill the values, refresh it and again display the values.


Ans: Steps to create a standard internal table with refresh:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_WREF’ & Click on Create.
Write the following program.

88
⦁ After testing, no output will be displayed.

Q. 4. Create a sorted internal table, fill the values and display them.
Ans: Steps to create a sorted internal table:
GO TO SE 38 AND give the program name

89
.

⦁ The output will be displayed.

90
Q. 5. Create a hashed internal table, fill the values and display them.


Ans: Steps to create a hashed internal table:


Go to SE38.
Enter Program name as ‘ZNV_HA_INTERNAL_TABLE’ & Click on Create.

⦁ Write the following program.

91
⦁ The output will be displayed.

92
Q. 6. Transfer the data from one internal table to another internal table.


Ans: Steps to create a transfer data from one internal table to another internal table:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_WNUK’ & Click on Create.
Write the following program.

93
⦁ The output will be displayed.

94
Q. 7. Create any internal table, fill the values and read with data without and with binary search.


Ans: Steps to read data without binary search from a standard internal table:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_RWOBS’ & Click on Create.
Write the following program.

95
⦁ The output will be displayed.

96

Steps to read data with binary search from a standard internal table:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_RWBS’ & Click on Create.
Write the following program.

97
⦁ The output will be displayed.

98
Q. 8. Create an internal table, fill the values, read the data based on condition and modify the record (R&D)
question.


Ans: Steps to read data with binary search from a standard internal table:


Go to SE38.


Enter Program name as ‘ZNV_ST_INTERNAL_TABLE_RBCAMR’ & Click on Create.
Write the following program.

99
⦁ The output will be displayed if the record is found.

100
⦁ The output will be displayed before modification.

⦁ The output will be displayed after modification

101
 What's the use of header line demonstrate with one program
When we don’t want to write work area on that time we have to use the header line header line acts as a
both work area as well as internal table,

102
 How to change specific field value
If we want to change specific field value then use MODIFY statement in the report program

103
 How to find 'n' no of records present inside Internal Table
First we Declaire an variable with name NUM in the work space
After the loop we use one statement DESCRIBE TABLE
Table name then variable name.

104
the output will be
displyed how many records present in the internal table

 Work on Collect statement, Adjacent, Duplicate & Deleting specific records from Internal Table.
Collect Statement:
This statement inserts the content of a work area wa either as a single row in an internal table itab or adds the
values of its numeric components to the corresponding values of existing rows with the same primary table key.
Syntax:
COLLECT wa INTO itab.
Delete, Adjacent & Duplicate:
The system deletes all adjacent entries with the same key field contents apart from the first entry.
· You can prevent the system from only comparing the key field using the COMPARING addition.
· If you sort the table by the required fields beforehand, you can be sure that only unique – entries will remain in
the table after the DELETE ADJACENT DUPLICATES statement.
Syntax:
DELETE ADJACENT DUPLICATES FROM <itab>

105
[COMPARING<f1>..<fn>[ALL FIELD<fn>][ALL FIELDS]]

 For standard table both with & without key field use clear statement & check what'll happens to
previous data & Do more R&D on the same question
For standard table both with and without key field, there will be no difference in output.
If the user uses clear statement, then the previous data present in the work area will be erased.

106
If the user does not uses clear statement, then the previous data present in the work area will replace it with new

data

ASSIGNMENT ON CONTROL BREAKE STATEMENT


What is control break statement & what are the statements we can use inside loop explain them?
Control break statements are used to sequantial execution of Statement using inside the loop
THERE ARE 5 CONTROL STATEMENHERTS ARE THERE IN
 AT FIRST: This is triggered for the first row of internal table or the first iteration of loop (both are
same). As soon it is hit (AT FIRST), the value of work area are filled by ‘*’....
 At First Will trigger at the first run of the loop.
it means At First triggers at the first loop iteration
The main purpose of this control break is to write some header information.
We can write some header info by using AT FIRST statement

107
 AT NEW: This is triggered for First row of a group with the same content of internal table based on a
field
 At New is one of a control break statements.
It works inside the LOOP – ENDLOOP.
When we use At new for a field, it will trigger whenever there is any change of fields’ data.
This statement triggers at the new occurrence of that value.

 AT LAST: This is triggered for the last row of internal table or the last iteration of loop (both are same).
 At Last triggers at the last loop iteration.
it means At Last will trigger at the last run of the loop.
The main purpose of this control break is to write some footer information.
We can write some footer info by using AT LAST statement

108
END AT: At End OF statement always triggers when there is any change of fields’ data.
This statement triggers at the last occurrence of that value.

 Diff b/w At new & On change.


AT NEW ON CHANGE
At New is one of a control break On change of it triggers only when
statements. there is any change in the particular
It works inside the LOOP – field.
109
ENDLOOP. On change of can be used outside
When we use At new for a field, it the loop too.
will trigger whenever there is any it actually works like AT NEW
change of fields’ data. statement.
This statement triggers at the new If there is any change of the value of
occurrence of that value. the mentioned field then ON
CHANGE OF will trigger.
When we use At new for a field, it will when we use On change of it
trigger whenever triggers only when there is any change in
there is any change in al lthe fields from the particular
the left to that field.
of the particular field.
At new can only be used inside loop. On change of can used
outside the loop.
No logical Expressions can be added Logical
with at new. expressions like AND OR can be used
with on change of.
When AT NEW occurs, the alpha- where as in case of On Change, the
numeric fields have * in alphanumeric
their value fields have their Corresponding value, of
that particular
record, where the Event gets fired.
At new not executes for the first value On Change of executes for the first value
of the field of field too

110
 Practice on today's session

111
112
113
 In "SPFLI" DBT take Conid, Period,Cityfrom, CharID, Cityto,Distance,Fltime & print it's short description
and also print perticular carid distance & fltime as explained in today's session

114
115
116
OUTPUT :

117
When AT NEW occurs, the alpha- where as in case of On Change, the
numeric fields have * in alphanumeric
their value fields have their Corresponding value, of
that particular
record, where the Event gets fired.
At new not executes for the first value On Change of executes for the first value
of the field of field too

ASSIGNMENT ON DEBUGGING.

 What is debugging and types of debuggers in sap ?


SAP debugger is a tool to check your lines of codes and examine error during runtime. Debugging in SAP
ABAP helps a programmer to check his program flow at runtime.
Debugger is a wonderful tool used by ABAP programmers to track down an issue in a given piece of code and
also to understand the logic used by other programmer in writing that program.
Types of debugger in sap abap.
 CLASSICAL Debugger.
 NEW ABAP Debugger.
 difference between classical and new ABAP debugger ?
CLASSICAL NEW ABAP DEBUGGER
In this we have no desk In this we have desktop 1,desktop 2,
desktop3, and standard
The classic ABAP Debugger runs in the By using this we can debug the object
same roll area as the tops analyzed oriented programs
application

In this we can’t compare any two field In this we can compare Any two fields
values values

118
In this it won't show Global and Local In this it provides the global and local
variable of the program variable of the program

3. Difference between static and dynamic break point ?


STATIC BREAK POINT DYNAMIC BREAK POINT
Static These are user independent , set Dynamic breakpoints are user-specific.
directly into a program’s code with the therefore, use them when you only
editor. want the program to be interrupted
when you run it yourself
A non-user specific breakpoint is set You can set them even when the
in the ABAP Editor using the BREAK program is locked by another
user name statement. programmer
Once a user has inserted the Dynamic breakpoints are more flexible
statement BREAK-POINT or BREAK than static breakpoints, because you can
name in an ABAP program, the deactivate or delete them at runtime.
system always interrupts the program
at that point for that user or only for
the user name

4. what is the Use of function key f5 , f6 , f7 , f8 ,shift + f8 , shift+ f12 ?


F5: executes the current statement enters the procedures and routines,
F6: executes the current statement and does not enter procedure but completes it in one step.
F7: helps you to come out of a procedure.
F8: executes the program completely unless there is any break point set.
SHIFT + F8: Execute the program in between Two Break points .
SHIFT + F12 : IT Will not execute the program Between two break points
5.how we can change internal table data in debugging ?
STEPS TO CHANGE THE INTERNAL TABLE DATA IN DEBUGGING
step 1: first we open the program in debugger mode
then select the option called table as show in figure
And give the internal table name and execute

119
Step 2: then select the field which we want to edit the data in the internal Table.
Wright click on the selected field and then
CHANGE SELECTED ROWS =>CHANGE TABLE CONTENT

STEP 3: after this the selected fiels will be in Editable mode, then change the record on that particular field.

120
6.How many Ways We can set Breaking points
1st way: Just Double click on the Left side of the Line where u want to put the breakpoint and Click Save.
2nd way: Place the Cursor on the Line and Click the Breakpoint Icon.
3rd way: Goto Utilities --> Breakpoints --> Set / Delete
If u r already in the Debugging Mode Dont forget to click save once u set the Break point to get the breakpoint
next time when u execute.

ASSIGNMENT ON BREAKE POINT AND WATCH POINTS


ASSIGNMENT - 18

1. What is breakpoints and What are the types of breakpoints explore more on it

A Break-point is a signal in a specific line of the Abap program that interrupts the normal execution of
the program.
Break-point helps in debugging and Analyzing ABAP Objects, Abap Programs and Evaluating only the
concerned section of ABAP code while skipping the other lines.

There are Basically 4 Types of Breakpoints.


1.Session Breakpoint: A session breakpoint is attached to a user’s session, which exists from the point
in time where the user logs into SAP until they close their last SAP dialog window.
2.External Breakpoint: An external breakpoint is attached to the user that set it, and behaves similarly
to a session breakpoint. The icon looks like a person set in front of a stop sign. The major difference is
that it exists for a 2 hours and can launch the debugger when triggered by an external process.
121
3.Debugging Breakpoint: debugger breakpoint that you can only set after the debugger has already
started. The debugger breakpoint icon looks like a stop sign.
4.Hardcore Breakpoint: Static breakpoints are always user-independent if there is no specification of a
user name. Once a user has inserted the statement BREAK-POINT or BREAK name in an ABAP
program, the system always interrupts the program at that point for that user or only for the user name.

2. What is watch-point ? How to create watch-point?

Watch-point is a conditional Breakpoint that is used only in Abap Debugger. It is one of the runtime
utility components provided to debug SAP Application and serves as an indicator to the ABAP runtime
processor to interrupt further program processing from the Specified point or relation. They are
Dynamic in nature
Watch-point help application developers monitor the contents or specified variables and the change of
their values associated during runtime processing.

STEPS TO CREATE WATCH-POINT


Go to Transaction SE-38
Enter the Program Name and open your Program, Now get into Debugging by creating break-points,
Now You can create watch-points by click on the create button present in the Application tool bar or by
clicking on the break/watch-point Tab or we can even create watch-point by using New Tool.

In order to create a watch-point, Give the variable name and we have to give the condition in-order to
reach the particular watch-point.
By giving the condition we can reach that particular watch-point and debugging start from that point.
Now if we press ‘F8’, if the particular watch-point is reached, we get an message saying that ‘watch-
point is reached’ and sy-tabx value also changes.
3. Create report program in that create watch point for variable and explore more on it?

122
Go to transaction SE38
Enter and Name of the Program and click on the create button.
Now we have to create a structure in order to take fields from two tables , i.e, EKKO and EKPO.
We have taken fields from two tables, Now we have to declare our work Area and internal Table, My
work area is wa_ekko and my internal table is it_ekko and name of the structure is ts_ekko.
REPORT ZNV_DEBUGGING.
TYPES: BEGIN OF TS_EKKO,
EBELN TYPE EKPO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,

EBELP TYPE EKPO-EBELP,


MATNR TYPE EKPO-MATNR,
MENGE TYPE EKPO-MENGE,
MEINS TYPE EKPO-MEINS,
NETWR TYPE EKPO-NETWR,
END OF TS_EKKO.

DATA: WA_EKKO TYPE TS_EKKO,


IT_EKKO TYPE TABLE OF TS_EKKO.

SELECT-OPTIONS : S_MATNR FOR WA_EKKO-MATNR.

************BUSINESS LOGICS***************************
*BREAK-POINT.
START-OF-SELECTION.
* BREAK-POINT.

PERFORM GET_DATA.
BREAK-POINT.
PERFORM DISPLAY.

FORM GET_DATA.
SELECT A~EBELN
A~BUKRS
A~BSTYP
A~BSART

B~EBELP
B~MATNR
B~MENGE
B~MEINS
B~NETWR
123
FROM EKKO AS A
INNER JOIN EKPO AS B
ON A~EBELN = B~EBELN
INTO TABLE IT_EKKO
WHERE B~MATNR IN S_MATNR.
ENDFORM.

FORM DISPLAY .
LOOP AT IT_EKKO INTO WA_EKKO.
WRITE: WA_EKKO-EBELN,
WA_EKKO-BUKRS,
WA_EKKO-BSTYP,
WA_EKKO-BSART,

WA_EKKO-EBELP,
WA_EKKO-MATNR,
WA_EKKO-MENGE,
WA_EKKO-MEINS,
WA_EKKO-NETWR.
ENDLOOP.
ENDFORM.
Now in order to Create a watch-point, we have to go into Debugging mode.
Now click on the watch point to create a watch-point or we can make use of new tool in-order to create a
watch-point.
After creating watch-point, we have to enter the variable name and the condition to be entered to create
a watching to the particular variable.
After successfully creating watching, we can see an message saying watch-point is created.
After creating watch-point if we press ‘F8’, then sy-tabx value changes to the row corresponding to the
entered value. This is how we get to know that our watch-point is reached.
We can create upto 30 watch-points.
The debugging starts from that watch-point where we have create and rest of the line are ignored.
4. Explore on all tabs in debugging tool.

Desktop 1: In this ABAP source code is displayed in the left side, global & local variables & their values are
displayed in right side.

124
Desktop 2: In this ABAP source code is displayed in the left side, ABAP stack is displayed in
right side (currently which block is executed under which event).

Desktop 3: In this source code is displayed in the top & global & local variables & their values are
displayed in bottom.

125
Structures: This is used to identify the work area fields & their values & also change the values.

Tables: This is used to display the internal table fields & their values & also perform the internal
table operations.

126
Details: This is used to identify the detailed information of any particular field.

Data Expolrer: This is used to display the name of the object, type of the object and alias name which we
have given.

127
Break/watch-point: This given us the information about the type of breakpoint we are using.

Diff: This is used to compare the any two field values & also display their history.

128
5. Difference between Breakpoints and Watchpoints

BREAKPOINT WATCHPOINT
It is signal in a specific line of abap It is also a type of breakpoint basically
Program that interrupts the normal which will provide us to monitor the
execution of the program variable.

This is used to identify all the breakpoints This is used to identify all the watch points
available in program and line number present in the program and also we can
change based on condition
We can create upto 30 break-points No restriction for creation of watch-points

1) Difference between select single and select up to 1 row.

Select single Select upto 1 row


Select Single * will pickup only one matching Select upto 1 rows will pickup all the records
record from the database into the buffer, and matching the condition into the buffer, but
returns the same to the internal table return the top record to the internal table.

SELECT SINGLE is slow because we are not According to SAP Performance course the
129
using all the primary key fields. SELECT UP TO 1 ROWS is faster
select single is a construct designed to read whereas the select up to 1 rows may assume
database records with primary key. In the that there is no primary key supplied and will
absence of the primary key, it might end up try to find most suitable index.
doing a sequential search,
The 'SELECT SINGLE' statement selects the The 'SELECT .... UP TO 1 ROWS' statement
first row in the database that it finds that fulfils is subtly different. The database selects all of
the 'WHERE' clause If this results in multiple the relevant records that are defined by the
records then only the first one will be returned WHERE clause, applies any aggregate,
and therefore may not be unique. ordering or grouping functions to them and
then returns the first record of the result set

2) disadvantages of inner join and advantages of for all entries ?


INNER JOIN FOR ALL ENTRIES
Use inner join when you join two DATABASE .Use FOR ALL ENTRIES when you use an
tables with a common field. internal table as a selection criteria for
populating data into another itab. But before
using FOR ALL ENTRIES check if ITAB1 is
not initial.
You will have to use Primary key - .FOR ALL ENTRIES does not have this
Foreign Key relation when you want to use a restriction as you pass some internal table and
join. not a db table.
.Join will fetch the records based on the FOR ALL ENTRIES will fetch the records on
equality of keys. the equality of any fields (key as well as non-
key).

3) practice select query using 3 table and using inner join


*&---------------------------------------------------------------------*
*& Report ZNV_SELECT_FORALLENTRY
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_SELECT_FORALLENTRY.

TYPES: BEGIN OF ts_vbak,


TYPE vbak-vbeln,
TYPE vbak-erdat,
TYPE vbak-erzet,
TYPE vbak-ernam,
END OF ts_vbak.

DATA : lt_vbak TYPE TABLE OF ts_vbak,

130
ls_vbak TYPE ts_vbak.
TYPES : BEGIN OF ts_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matwa TYPE vbap-matwa,
END OF ts_vbap.
DATA : lt_vbap TYPE TABLE OF ts_vbap ,
ls_vbap TYPE ts_vbap.
select vbeln
erdat
erzet
ernam
FROM vbak INTO TABLE lt_vbak UP TO 10 rows .
sort lt_vbak BY vbeln.
DELETE ADJACENT DUPLICATES FROM lt_vbak COMPARING vbeln.
IF lt_vbak is NOT INITIAL.
SELECT vbeln
posnr
matnr
matwa
FROM vbap INTO TABLE lt_vbap
FOR ALL ENTRIES IN lt_vbak
WHERE vbeln = lt_vbak-vbeln.

IF sy-subrc = 0.
LOOP AT lt_vbak INTO ls_vbak.
LOOP AT lt_vbap INTO ls_vbap WHERE vbeln = ls_vbak-vbeln.
WRITE :/ ls_vbak-vbeln , ls_vbak-erdat , ls_vbak-erzet
,ls_vbak-ernam ,
ls_vbap-posnr , ls_vbap-matnr ,ls_vbap-matwa .
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.

4) practice select query using 3 table using for all entries


*&---------------------------------------------------------------------*
*& Report ZNV_FORALL_DEMO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_FORALL_DEMO.
131
DATA : LT_EKKO TYPE TABLE OF EKKO.

TYPES : BEGIN OF ts_STR,


MANDT TYPE EKKO-MANDT,
EBELN TYPE EKKO-EBELN,
AEDAT TYPE ekko-aedat,
* AEDAT TYPE EKPO-AEDAT,
TXZ01 TYPE EKPO-TXZ01,
MATNR TYPE EKPO-MATNR,
EMATN TYPE EKPO-EMATN,
BUKRS TYPE EKPO-BUKRS,

ZEKKN TYPE EKBE-ZEKKN,


VGABE TYPE EKBE-VGABE,
GJAHR TYPE EKBE-GJAHR,
BELNR TYPE EKBE-BELNR,
END OF TS_STR.

DATA : lt_IT TYPE TABLE OF TS_STR ,


LS_WA TYPE TS_STR.
SELECT-OPTIONS : LV_EBELN FOR LS_WA-EBELN.

SELECT A~MANDT,
A~EBELN,
A~AEDAT,
B~TXZ01,
B~MATNR,
B~EMATN,
B~BUKRS,
C~ZEKKN,
C~VGABE,
C~GJAHR,
C~BELNR

FROM EKKO AS A
INNER JOIN EKPO AS B ON A~EBELN = B~EBELN
INNER JOIN EKBE AS C ON A~EBELN = C~EBELN
* INTO TABLE LT_IT
WHERE A~EBELN IN @LV_EBELN INTO TABLE @LT_IT .
132
LOOP AT LT_IT INTO LS_WA.
WRITE: / LS_WA-AEDAT, LS_WA-BELNR, LS_WA-BUKRS, LS_WA-EBELN, LS
_WA-EMATN, LS_WA-MANDT.
ENDLOOP.

5) Practice what ever taught in session on select single and select upto 1 row.

*&---------------------------------------------------------------------*
*& Report ZNV_FORALLENTRY_UPTOROW
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_FORALLENTRY_UPTOROW.
TYPES: BEGIN OF ts_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
END OF ts_vbak.

DATA : lt_vbak TYPE TABLE OF ts_vbak,


ls_vbak TYPE ts_vbak.

TYPES : BEGIN OF ts_vbap,


vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matwa TYPE vbap-matwa,
END OF ts_vbap.

DATA : lt_vbap TYPE TABLE OF ts_vbap ,


ls_vbap TYPE ts_vbap.
select vbeln
erdat
erzet
ernam
FROM vbak INTO TABLE lt_vbak UP TO 1 ROWS.

sort lt_vbak BY vbeln.


DELETE ADJACENT DUPLICATES FROM lt_vbak COMPARING vbeln.

IF lt_vbak is NOT INITIAL.


SELECT vbeln
133
posnr
matnr
matwa
FROM vbap INTO TABLE lt_vbap
FOR ALL ENTRIES IN lt_vbak
WHERE vbeln = lt_vbak-vbeln.

IF sy-subrc = 0.
LOOP AT lt_vbak INTO ls_vbak.
LOOP AT lt_vbap INTO ls_vbap WHERSE vbeln = ls_vbak-vbeln.
WRITE :/ ls_vbak-vbeln , ls_vbak-erdat , ls_vbak-erzet ,
ls_vbak-ernam ,
ls_vbap-posnr , ls_vbap-matnr ,ls_vbap-matwa .
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.

6) Retrive Specific Data and Retrive single record based on given input from sales order header
*&---------------------------------------------------------------------*
*& Report ZNV_FORALL_DEMO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_SELECT3TABLES.
TYPES: BEGIN OF TS_EKKO,
EBELN TYPE EKKO-EBELN,
MANDT TYPE EKKO-MANDT,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
END OF TS_EKKO.

DATA: LT_EKKO TYPE TABLE OF TS_EKKO,


LS_EKKO TYPE TS_EKKO.

TYPES: BEGIN OF TS_EKPO,


EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
MATNR TYPE EKPO-MATNR,
END OF TS_EKPO.

DATA: LT_EKPO TYPE TABLE OF TS_EKPO,


134
LS_EKPO TYPE TS_EKPO.

TYPES: BEGIN OF TS_EKBE,


EBELN TYPE EKBE-EBELN,
ZEKKN TYPE EKBE-ZEKKN,
VGABE TYPE EKBE-VGABE,
BELNR TYPE EKBE-BELNR,
END OF TS_EKBE.

DATA: LT_EKBE TYPE TABLE OF TS_EKBE,


LS_EKBE TYPE TS_EKBE.

SELECT-OPTIONS LV_EBELN FOR LS_EKKO-EBELN.

SELECT EBELN
MANDT
BUKRS
BSTYP
BSART
FROM EKKO INTO TABLE LT_EKKO UP TO 10 ROWS.

DELETE ADJACENT DUPLICATES FROM LT_EKKO COMPARING EBELN.

IF LT_EKKO IS NOT INITIAL.


SELECT EBELN
EBELP
LOEKZ
MATNR
FROM EKPO INTO TABLE LT_EKPO
FOR ALL ENTRIES IN LT_EKKO
WHERE EBELN = LT_EKKO-EBELN.

IF LT_EKPO IS NOT INITIAL.

SELECT EBELN
ZEKKN
VGABE
BELNR
FROM EKBE INTO TABLE LT_EKBE
FOR ALL ENTRIES IN LT_EKBE
WHERE EBELN = LT_EKBE-EBELN.
135
IF SY-SUBRC = 0.
LOOP AT LT_EKKO INTO LS_EKKO.
LOOP AT LT_EKPO INTO LS_EKPO.
loop at lt_ekbe into ls_ekbe.
WRITE:/ LS_EKKO-EBELN,
LS_EKPO-EBELP,
LS_EKBE-BELNR.
ENDLOOP.
ENDLOOP.
endloop.
ENDIF.
ENDIF.
ENDIF.

ASSIGNMENT ON PARALLEL CURSUR

1. Retrive Data From Purchase Order Header Table And Item Table To Create Purchase Order By Inner Join.
*&---------------------------------------------------------------------*
*& Report ZNV_PURCHASEORDER_DEMO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_PURCHASEORDER_DEMO.
TYPES: BEGIN OF TS_EKKO,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
STATU TYPE EKPO-STATU,
END OF TS_EKKO.

DATA : LT_EKKO TYPE TABLE OF TS_EKKO,


LS_EKKO TYPE TS_EKKO.

SELECT-OPTIONS : LV_EBELN FOR LS_EKKO-EBELN.

SELECT EKKO~EBELN,
136
EKKO~BUKRS,
EKKO~BSTYP,
EKKO~BSART,
EKPO~EBELP,
EKPO~LOEKZ,
EKPO~STATU
FROM EKKO INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
*INTO TABLE lt_ekko
WHERE EKKO~EBELN IN @LV_EBELN INTO TABLE @LT_EKKO.

LOOP AT LT_EKKO INTO LS_EKKO.


WRITE:/ LS_EKKO-BSART,LS_EKKO-BSTYP,LS_EKKO-BUKRS,LS_EKKO-EBELN,LS_EKKO-
EBELP,LS_EKKO-LOEKZ
,LS_EKKO-STATU.
ENDLOOP.

2.Retrive Data from Purchase Order Header table And Item table To Create Purchase Order For All Entries.

*&---------------------------------------------------------------------*
*& Report ZNV_PURCHASEORDER_FORALL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_PURCHASEORDER_FORALL.
TYPES : BEGIN OF TS_EKKO,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
END OF TS_EKKO.
DATA : LT_EKKO TYPE TABLE OF TS_EKKO,
LS_EKKO TYPE TS_EKKO.
TYPES : BEGIN OF TS_EKPO,
MANDT TYPE EKPO-MANDT,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
END OF TS_EKPO.
DATA : LT_EKPO TYPE TABLE OF TS_EKPO,
LS_EKPO TYPE TS_EKPO.
SELECT EBELN,
BUKRS,
BSTYP,
BSART
FROM EKKO INTO TABLE @LT_EKKO UP TO 15 ROWS.

137
IF LT_EKKO IS NOT INITIAL .
SELECT
MANDT
EBELN
EBELP
LOEKZ
AEDAT
MATNR

FROM EKPO INTO TABLE LT_EKPO


FOR ALL ENTRIES IN LT_EKKO
WHERE EBELN = LT_EKKO-EBELN.
IF SY-SUBRC = 0 .
LOOP AT LT_EKKO INTO LS_EKKO.
LOOP AT LT_EKPO INTO LS_EKPO WHERE EBELN = LS_EKKO-EBELN.
WRITE:/ LS_EKKO-BSART,LS_EKKO-BSTYP,LS_EKKO-BUKRS,LS_EKKO-EBELN.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF

3. Retrive Data From Purchase Order Header table And Item Table to Craete Purchase Order By Parallel
Curser Tech.
*&---------------------------------------------------------------------*
*& Report ZNV_PARALLEL_DEMO1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_PARALLEL_DEMO1.
TYPES: BEGIN OF ts_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
erzet TYPE vbak-erzet,
ernam TYPE vbak-ernam,
END OF ts_vbak.

DATA : lt_vbak TYPE TABLE OF ts_vbak,


ls_vbak TYPE ts_vbak.

TYPES : BEGIN OF ts_vbap,


vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
matwa TYPE vbap-matwa,
END OF ts_vbap.

138
DATA: lt_vbap TYPE TABLE OF ts_vbap,
ls_vbap TYPE ts_vbap.

SELECT vbeln
erdat
erzet
ernam FROM vbak
INTO TABLE lt_vbak UP TO 10 ROWS .

SORT lt_vbak BY vbeln.


DELETE ADJACENT DUPLICATES FROM lt_vbak COMPARING vbeln .

IF lt_vbak IS NOT INITIAL.


SELECT vbeln
posnr
matnr
matwa FROM vbap INTO TABLE lt_vbap
FOR ALL ENTRIES IN lt_vbak
WHERE vbeln = lt_vbak-vbeln.

SORT lt_vbap BY vbeln.


IF sy-subrc = 0.
DATA: lv_index TYPE sy-tabix.

LOOP AT lt_vbak INTO ls_vbak.


READ TABLE lt_vbap INTO ls_vbap WITH KEY vbeln = ls_vbak-vbeln BINARY
SEARCH.
IF sy-subrc = 0.
lv_index = sy-tabix.
LOOP AT lt_vbap INTO ls_vbap FROM lv_index.
IF ls_vbap-vbeln <> ls_vbak-vbeln.
EXIT.
ELSE.
WRITE: / ls_vbak-vbeln , ls_vbak-erdat, ls_vbak-erzet , ls_vba
k-ernam,
ls_vbap-matnr ,ls_vbap-posnr ,ls_vbap-matwa.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.

139
4.Explore On the Exact Difference Between All Of The Above techniques.

INNER JOIN :- The inner join combines data from both tables if all the specified criteria are met. If one or
more criteria are not met, no data records are created in the result set. Inner join is used to join two different
tables by relating them by comparing one of their common fields

FOR ALL ENTRIES :-


Outer join can be created using this addition to the where clause in a select statement. It speeds up the
performance tremendously, but the cons of using this variation are listed below
Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique
key of the detail line items should be given in the select statement.
If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination
table. Hence it is advisable to check before-hand that the first table is not empty.
If the table on which the For All Entries IN clause is based is very large, the performance will go down instead
of improving. Hence attempt should be made to keep the table size to a moderate level.

PARALLEL CURSOR TECHNIQUE :- Parallel Cursor in ABAP is a way to modify the conventional nested
loop in such a way that the overall performance of the ABAP program gets improved.
Parallel Cursor is a technique to increase the performance of the program when there are nested loops.
Parallel cursor is the technique to increase the perforamance of the program. For example if we use nested
select in our program instead of For all entries addition, then definetly performance going down. In the same
way the if we use nested loops in the program it will also leads to down the performance.
I will give you one example like take billing document header details in one table and item details in other table
let say the header table have 1000 records and the item table have 1 lakh records. If you want to make an output
then you need to put nested loops first loop at header table then next loop at item table. For each entry of header
record the item table loops 1 lakh times. calculate the total. so instead of we develop parallel cursor technique,,

1.How many watch points can be created?


We can Create as many watch-points we want there are no restrictions to create the number of watch-points
but as per the performance issue it is recommended to create up-to 9 watch-points

2.How to add your data from desktop to your internal table in debugging?
Go to Transaction se38
Open your Program in Debugging Mode
Now click on the Desktop 3 and Enter Your Internal Table Name
Now Select any row and Right click and Select change Table content and select Insert Row(Using Index)
And Enter the values of the column.

140
3.How to check write statements in debugging?
Go to Transaction SE38
Open your Program in Debugging Mode
Now click on the Desktop 3 Tab Present in the Debug Mode and click on the New Tool option present at the
right side of the table
Now Select the Special Tool and open the Drop Down Menu and Now Select the The Console: XML and List
Preview

4.How to insert data to internal table in debugging?


Go to transaction se38
Open your Program in Debugging Mode
Now click on the desktop 3 and Enter Your Internal Table Name
Now select any row and right click and select change table co ntent and select Row (using index) and enter the
value of the column

141
5.How to compare variables inside debugging?
Go to transaction se38
Open your Program in Debug Mode
Click on the Diff Tab and enter the values of the two variables which we want to compare
Now click on the start comparing
If the entered two variables has any differences it will be shown in the diff table.

6.What are the function keys used in debugging?


The Function keys used in Debugging are:-
F5 - Use this option to execute the program statement by statement or line by line .

F6 - Use this option to process a program line by line. All of the statements on the current line are
processed in a single step.F6 will skip the subroutine without going inside, but the subroutine will get
executed .

142
F7 - The Debugger returns to the point at which control is passed back to the main program. Come out
of the current subroutine .

F8 - it will execute the whole program. Not stopped in between .

SHIFT F8 - if we set 2 breakpoint in a program and wants to execute the set of codes that present in
between the breakpoints then we use shift f8 .

SHIFT F12 - if we set 2 breakpoint in a program and wants to skip the set of codes for that present in
between the breakpoints then we use shift f12.

7.diff between external and session breakpoints?


External breake point Session breake point
.Session Breakpoint: A session breakpoint is An external breakpoint is attached to the user
attached to a user’s session, which exists from that set it, and behaves similarly to a session
the point in time where the user logs into SAP breakpoint. The icon looks like a person set in
until they close their last SAP dialog window. front of a stop sign. The major difference is
that it exists for a 2 hours and can launch the
debugger when triggered by an external
process.
Breakpoints are created in ABAP editor. It is It is valid for all user logons on the current
valid for a logon session and for all external server of the current system. We can convert
modes of this logon session. Debugger breakpoints and Session Breakpoints
into External Breakpoints within the debugger.
All the External Breakpoints are valid for
2hours only.

8.how many external breakpoint is possible in session?


We Can create up-to 30 external breakpoints in an session
9.how to deactivate breakpoint in runtime and how to delete breakpoint at runtime?
Go To Transaction se38
Open your Program in debugging Mode
Now select the Breakpoint/watch-point in the Debug mode
After opening the tab, Now we can see the sessions which are Active . If we want to deactivate the session, we
can click on the deactivate Breakpoint.

143
10.what is the use stack?
It is used to display the Current ABAP stack and screen stacks.
It gives us the Information about the type of Event that we are executing and line we are executing.

1.What are aggregate functions and its use?

Aggregate functions return a single value from the values in several lines of a column in a database table.

These functions can be used with SELECT statement by specifying a column of a database table as an
argument.

Following are the aggregate functions available :

Average(AVG)

MAXIMUM(MAX) ,

Minimum(MIN)

Total(SUM)

144
Count(COUNT)

Average(AVG) :

Syntax : AVG( [DISTINCT] col ) AVG determines the average value of the column col
specified. It can only be applied to a numeric field.

2.what are the types of aggregate functions and explain?

Maximum(MAX) :
Syntax : MAX( [DISTINCT] col )
MAX determines the maximum value of the contents of the column col specified.

Minimum(MIN) :
Syntax : MIN( [DISTINCT]
MIN determines the minimum value of the contents of the column col specified.

Total(SUM) :
Syntax : SUM( [DISTINCT] col )
SUM determines the sum of contents of the column col specified.This can only be applied to a
numeric field.
To avoid overflows it is recommended to make data type of target field greater than that of the source
field.

Count(COUNT) :
1. Syntax : COUNT( DISTINCT col )
It determines the number of different values in the column col .

SELECT COUNT( DISTINCT matnr ) FROM vbap INTO lv_countmatnr WHERE vbeln EQ p_vbeln.

2. Syntax : COUNT( * )
It determines the number of rows in the result set. No column identifier col is specified in this case.

Average(AVG) :

Syntax : AVG( [DISTINCT] col ) AVG determines the average value of the column that
specified. It can only be applied to a numeric field.

3.Create all types of aggregate functions using a custom table?

145
*&---------------------------------------------------------------------*
*& Report ZNV_AGGRIGATE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_AGGRIGATE.
TYPES : BEGIN OF TS_ZNV_IPLTABLE,
FIFTIES TYPE ZNV_IPLTABLE-FIFTIES,
HUNDERDS TYPE ZNV_IPLTABLE-HUNDERDS,
STRIKE_RATE TYPE ZNV_IPLTABLE-STRIKE_RATE,
END OF TS_ZNV_IPLTABLE.

PARAMETERS : P_HUND TYPE znv_ipltable-HUNDERDS .

SELECT AVG( HUNDERDS ) FROM ZNV_IPLTABLE INTO p_HUND.


WRITE: / 'avarege of HUNDREDS ' ,P_HUND.

PARAMETERS : P_SUM TYPE Z_FIFTY.


SELECT SUM( FIFTIES ) FROM ZNV_IPLTABLE INTO P_SUM.
WRITE: / 'THE TOTAL SUM IS' ,P_SUM.

PARAMETERS : P_LV TYPE ZNV_IPLTABLE-HUNDERDS.


SELECT COUNT( * ) FROM ZNV_IPLTABLE INTO P_LV.
WRITE: / 'TOTAL COUNT IS :' ,P_LV.

PARAMETERS : P_NV TYPE ZNV_IPLTABLE-STRIKE_RATE.


SELECT MAX( STRIKE_RATE ) FROM ZNV_IPLTABLE INTO P_NV.
WRITE :/ 'THE MAXIMIMUM STRIKE RATE IS' ,P_NV.

PARAMETERS : P_MIN TYPE ZNV_IPLTABLE-STRIKE_RATE.


SELECT MIN( STRIKE_RATE ) FROM ZNV_IPLTABLE INTO P_MIN.
WRITE :/ 'THE MINIMU STRIKE RATE IS' ,P_MIN.

4.which data types are not used in aggregate functions?

The data type of the column must be numeric. The data types INT8, DF16_RAW, and DF34_RAW plus the
obsolete types DF16_SCL and DF34_SCL are not allowed. The data type of the result for decimal floating point
numbers is the corresponding data type (DF16_DEC or DF34_DEC) and otherwise FLTP. SQL expressions
cannot be specified as arguments..

146
5.Create a program by adding all aggregate functions in single select statement using
any standard data base table?

*&---------------------------------------------------------------------*
*& Report ZNV_AGGRIGATE_DEMO1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_AGGRIGATE_DEMO1.
DATA: CARRID TYPE SFLIGHT-CARRID,
MINIMUM TYPE P DECIMALS 2,
MAXIMUM TYPE P DECIMALS 2,
SUM TYPE I,
AVAREGE TYPE P DECIMALS 2,
COUNT TYPE I .
SELECT CARRID MIN( PRICE ) MAX( PRICE )
COUNT( * ) SUM( PRICE ) AVG( PRICE )
INTO (CARRID, MINIMUM, MAXIMUM ,COUNT, SUM, AVAREGE)"",COUNT, AVAREGE)
FROM SFLIGHT
GROUP BY CARRID.
WRITE: / CARRID, MINIMUM , MAXIMUM , COUNT ,AVAREGE ,SUM . ""COUNT,AVAREG
E,SUM.
ENDSELECT .

1. Retrieve data from sales order header(VBAK) & item(VBAP) by for all enteries & use inline
declaration.
ZNV_INNERJOIN_PURCHASEORDER.
TABLES: vbak, vbap.
SELECT-OPTIONS : S_VBELN FOR vbak-VBELN.

SELECT POSNR,
MATNR,
MATWA,
PMATN,
CHARG,
vbeln
FROM VBAp
INTO TABLE @DATA(LT_VBAp) WHERE vbeln in @s_vbeln.
SORT lt_vbap by vbeln.
DElete ADJACENT DUPLICATES FROM lt_vbap COMPARING vbeln.

IF lt_vbap is NOT INITIAL .


147
SELECT VBELN,
ERDAT,
ERZET,
ERNAM,
ANGDT
FROM vbak INTO TABLE @data(lt_vbak)
FOR ALL ENTRIES IN @lt_vbap
WHERE vbeln = @lt_vbap-vbeln.
ENDIF.

*CL_DEMO_OUTPUT=>DISPLAY(
* EXPORTING
* DATA = LT_Vbap ""lt_vbak
* NAME = 'seles order report'
*).

LOOP AT LT_VBAP INTO DATA(LS_VBAP).


LOOP AT LT_VBAK INTO DATA(LS_VBAK).

WRITE: / LS_VBAP-VBELN, LS_VBAP-CHARG,LS_VBAP-MATWA,LS_VBAP-


POSNR,LS_VBAP-PMATN,
LS_VBAK-ERDAT, LS_VBAK-ERNAM.
ENDLOOP.
ENDLOOP.

2. Check all select statement by inline declaration.


*&---------------------------------------------------------------------*
*& Report ZNV_ALL_SELECT_STATEMENT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_ALL_SELECT_STATEMENT.
*IF WE WANT TO DISPLAY FULL TABLE DATA.

SELECT * FROM VBAK INTO TABLE @DATA(LT_VBAK).

LOOP AT LT_VBAK INTO DATA(LS_VBAK).


WRITE :/ LS_VBAK-VBELN.
ENDLOOP.

TABLES VBAK.
PARAMETER : LV_NEW TYPE VBELN_VA.
148
SELECT SINGLE MANDT FROM VBAK INTO @DATA(LS_VBAK) WHERE VBELN = @LV_NEW .

WRITE :/ VBAK-VBELN, VBAK-ERZET.


*

TYPES : BEGIN OF TS_VBAK,


MANDT TYPE VBAK-MANDT,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERZET TYPE VBAK-ERZET,
ERNAM TYPE VBAK-ERNAM,
END OF TS_VBAK.

PARAMETERS : P_VBELN TYPE VBELN_VA.


SELECT * FROM VBAK INTO TABLE LT_DATA UP TO 10 ROWS.
LOOP AT LT_DATA INTO LS_DATA.
WRITE :/ LS_VBAK-MANDT , LS_VBAK-ERDAT.
ENDLOOP.

TYPES: BEGIN OF TS_VBAK,


MANDT TYPE VBAK-MANDT,
VBELN TYPE VBAK-VBELN,
ANGDT TYPE VBAK-ANGDT,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
AUART TYPE VBAK-AUART,
AUGRU TYPE VBAK-AUGRU,
END OF TS_VBAK.

* SELECT-OPTIONS : P_VBELN FOR VBELN.


PARAMETERS : P_VBELN TYPE VBELN_VA.
SELECT MANDT,
VBELN,
ANGDT,
AUDAT,
VBTYP,
AUART,
AUGRU
149
FROM VBAK INTO CORRESPONDING FIELDS OF TABLE @DATA(LT_VBAK) WHERE VBE
LN = @P_VBELN.

Tables vbak.
SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.
SELECT A~VBELN, A~ERZET, A~ERNAM, A~ANGDT, B~MANDT, B~MATWA, B~PMATN, B~
ARKTX, B~POSAR
FROM VBAK AS A INNER JOIN VBAP AS B ON A~VBELN = B~VBELN INTO TABLE @DATA
(LT_VBAK) WHERE A~VBELN IN @S_VBELN.
CL_DEMO_OUTPUT=>DISPLAY( LT_VBAk
).

TABLES : VBAP,VBAK.
types : BEGIN OF TS_VBAK,
VBELN TYPE VBAK-VBELN,
ERNAM TYPE VBAK-ERNAM,
ANGDT TYPE VBAK-ANGDT,
BNDDT TYPE VBAK-BNDDT,
TRVOG TYPE VBAK-TRVOG,
END OF TS_VBAK.
types: BEGIN OF TS_VBAP,
VBELN TYPE VBAP-VBELN,
PMATN TYPE VBAP-PMATN,
MATKL TYPE VBAP-MATKL,
POSAR TYPE VBAP-POSAR,
END OF TS_VBAP.
data : ls_vbak type ts_vbak,
lt_vbak type table of ts_vbak.

data : ls_vbap type ts_vbap,


lt_vbap type table of ts_vbap.

SELECT-OPTIONS : s_vbeln for vbak-vbeln.

select VBELN,
ERNAM,
ANGDT,
BNDDT,
TRVOG from vbak into table @DATA(lt_vbak)
150
WHERE VBELN IN @S_VBELN.

IF LT_VBAK IS NOT INITIAL.

SELECT VBELN,
PMATN,
MATKL,
POSAR FROM VBAP INTO TABLE @DATA(LT_VBAP)
FOR ALL ENTRIES IN @LT_VBAK
WHERE VBELN = @LT_VBAK-VBELN.

LOOP AT LT_VBAK INTO DATA(LS_VBAK).


LOOP AT LT_VBAP INTO DATA(LS_VBAP) WHERE VBELN = LS_VBAK-VBELN.

WRITE :/ LS_VBAK-VBELN ,LS_VBAK-ANGDT, LS_VBAK-BNDDT, LS_VBAK-ERNAM


,LS_VBAK-TRVOG,LS_VBAP-MATKL,LS_VBAP-PMATN,LS_VBAP-POSAR.

ENDLOOP.
ENDLOOP.

).

3. Diff b/w left outer & right outer join with practically by using purchase order header (EKKO) & item
(EKPO) table
ENDIF. REPORT ZNV_LEFTANDWRIGHT.

*TYPES : BEGIN OF TS_EKKO,


* EBELN TYPE EKKO-EBELN,
* BUKRS TYPE EKKO-BUKRS,
* BSTYP TYPE EKKO-BSTYP,
* BSART TYPE EKKO-BSART,
* EBELP TYPE EKPO-EBELP,
* AEDAT TYPE EKPO-AEDAT,
* END OF TS_EKKO.
*
*DATA : IT_EKKO TYPE TABLE OF TS_EKKO,
* LS_WA TYPE TS_EKKO.
DATA :V_EKKO TYPE EKKO-EBELN.
SELECT-OPTIONS : S_EBELN FOR V_EKKO.
SELECT A~EBELN ,
A~BUKRS ,
A~BSTYP ,
151
A~BSART ,
B~EBELP ,
B~AEDAT
FROM EKKO AS A
RIGHT OUTER JOIN EKPO AS B
ON A~EBELN = B~EBELN
INTO TABLE @data(IT_EKKO)
WHERE A~EBELN IN @S_EBELN. "WE CAN USE WHERE CONDITION ALSO

CL_DEMO_OUTPUT=>DISPLAY(
EXPORTING
NAME = 'EMP DATA'
DATA = IT_EKKO " Text or Data

REPORT ZNV_LEFTANDWRIGHT.

*TYPES : BEGIN OF TS_EKKO,


* EBELN TYPE EKKO-EBELN,
* BUKRS TYPE EKKO-BUKRS,
* BSTYP TYPE EKKO-BSTYP,
* BSART TYPE EKKO-BSART,
* EBELP TYPE EKPO-EBELP,
* AEDAT TYPE EKPO-AEDAT,
* END OF TS_EKKO.
*
*DATA : IT_EKKO TYPE TABLE OF TS_EKKO,
152
* LS_WA TYPE TS_EKKO.
DATA :V_EKKO TYPE EKKO-EBELN.
SELECT-OPTIONS : S_EBELN FOR V_EKKO.
SELECT A~EBELN ,
A~BUKRS ,
A~BSTYP ,
A~BSART ,
B~EBELP ,
B~AEDAT
FROM EKKO AS A
left OUTER JOIN EKPO AS B
ON A~EBELN = B~EBELN
INTO TABLE @data(IT_EKKO)
WHERE A~EBELN IN @S_EBELN. "WE CAN USE WHERE CONDITION ALSO

CL_DEMO_OUTPUT=>DISPLAY(
EXPORTING
NAME = 'EMP DATA'
DATA = IT_EKKO " Text or Data

153
ASSIGNMENT ON GENERIC FIELD SYMBOLS 25/05/2022

1) Retrive data from purchase order header table and try to access by field symbol
REPORT ZNV_ACCESS_FIELD_SYMBOL_25_1.
SELECT EBELN,
BUKRS,
BSTYP,
BSART,
BSAKZ,
LOEKZ,
STATU FROM ekko INTO TABLE @data(lt_ekko).
FIELD-SYMBOLS : <fs_nv> TYPE ANY TABLE.
ASSIGN :lt_ekko to <fs_nv> .
LOOP AT <fs_nv> ASSIGNING FIELD-SYMBOL(<fs_nv1>).
WRITE :/ <fs_nv1>.
ENDLOOP.

2) Modify internal table field without FS and with FS


REPORT ZNV_ACCESS_FIELD_SYMBOL_25_2.

TYPES : BEGIN OF TS_ZNV_IPLTABLE,


P_NAME TYPE ZNV_IPLTABLE-P_NAME,
ORIGIN TYPE ZNV_IPLTABLE-ORIGIN,
FIFTIES TYPE ZNV_IPLTABLE-FIFTIES,
HUNDERDS TYPE ZNV_IPLTABLE-HUNDERDS,
STRIKE_RATE TYPE ZNV_IPLTABLE-STRIKE_RATE,
P_TIME TYPE ZNV_IPLTABLE-P_TIME,
END OF TS_ZNV_IPLTABLE.

"" modification usfsing work area

SELECT * FROM ZNV_IPLTABLE INTO TABLE @DATA(LT_IPL) UP TO 10 ROWS .


LOOP AT LT_IPL INTO DATA(LS_IPL).
ls_ipl-ORIGIN = 'india'.
WRITE : / ls_ipl-ORIGIN,ls_ipl-P_NAME.
ENDLOOP.
skip 2.
WRITE : / 'using field-SYMBOLS'.
WRITE : /'======================================================'.

154
" modification using field-symbol
FIELD-SYMBOLS : <FS_IPl> TYPE ANY .
ASSIGN : lt_ipl to <fs_ipl>.

LOOP AT lt_ipl ASSIGNING FIELD-SYMBOL(<fs_ipl1>).


<fs_ipl1>-ORIGIN = 'india'.
WRITE :/ <fs_ipl1>-P_NAME, <fs_ipl1>-HUNDERDS , <fs_ipl1>-ORIGIN.

ENDLOOP.

3) Perform any operation and calculate time required for both (Without
FS and with FS).

*&---------------------------------------------------------------------*
*& Report ZNV_FIELD_SYMBOL_25_3
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_FIELD_SYMBOL_25_3.

TYPES: BEGIN OF ts_ekko,


ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
aedat TYPE ekko-aedat,
ernam TYPE ekko-ernam,
END OF ts_ekko.

DATA : LT_EKKO TYPE TABLE OF ts_ekko.


FIELD-SYMBOLS : <FS_EKKO> TYPE ts_ekko.

SELECT ebeln
bukrs
aedat
ernam FROM EKKO
INTO TABLE lt_ekko UP TO 10 ROWS .

* CL_DEMO_OUTPUT=>display(
*EXPORTING
*data = lt_ekko " Text or Data
*name = 'RECORDS FROM PURCHASE ORDER TABLE'
*).
"==========================================================
* TIME CALCULATION
155
DATA: lv_time TYPE REF TO if_abap_runtime."interface

lv_time = cl_abap_runtime=>create_hr_timer( ).

"WITHOUT USING FIELD-SYMBOL


DATA(LV_START_TIME) = lv_time->get_runtime( ).
"===========================================================

LOOP AT lt_ekko INTO DATA(LS_WA).


IF LS_WA-ERNAM = 'HUETT'.
LS_WA-ernam = 'JACK'.
MODIFY lt_ekko FROM ls_wa.
WRITE : / ls_wa-ERNAM.

ENDIF.
ENDLOOP.

*CL_DEMO_OUTPUT=>display(
* EXPORTING
* data = lt_ekko " Text or Data
* name = 'WITHOUT USING FIELD SYMBOL'
* ).
"===========================================================
DATA(LV_END_TIME) = lv_time->get_runtime( ).
DATA(LV_TOTAL) = LV_END_TIME - LV_START_TIME.

WRITE:'TOTAL TIME WITHout USING FS :',LV_TOTAL.

"USING FIELD SYMBOL

DATA(LV_START_TIME1) = lv_time->get_runtime( ).
"===========================================================
LOOP AT lt_ekko ASSIGNING <FS_EKKO>.

IF <FS_EKKO>-ernam = 'ROSE'.
<fs_ekko>-ernam = 'ram'.
ENDIF.
WRITE : / <fs_ekko>-ERNAM.
ENDLOOP.
156
*CL_DEMO_OUTPUT=>display(
* EXPORTING
* data = lt_ekko " Text or Data
* name = 'USING FIELD SYMBOL'
* ).
"==========================================================
DATA(LV_END_TIME1) = lv_time->get_runtime( ).
DATA(LV_TOTAL1) = LV_END_TIME1 - LV_START_TIME1.

WRITE: /'TOTAL TIME USING FS :',LV_TOTAL1.

*
*DATA(LV_SAVETIME) = LV_TOTAL1 - LV_TOTAL.
*WRITE:/'SAVING TIME :' ,LV_SAVETIME.

4) Practice on Typed field symbol and generic Field symbol

*&---------------------------------------------------------------------*
*& Report ZNV_ACCESS_FIELD_SYMBOL_25_4
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZNV_ACCESS_FIELD_SYMBOL_25_4.

SELECT * FROM ZNV_IPLTABLE INTO TABLE @DATA(LT_IPL) UP TO 10 ROWS .


*"" generic field symbols
*FIELD-SYMBOLS : <FS_IPl> TYPE ANY .
*ASSIGN : lt_ipl to <fs_ipl>.
*
*LOOP AT lt_ipl ASSIGNING FIELD-SYMBOL(<fs_ipl1>).
* <fs_ipl1>-ORIGIN = 'india'.
* WRITE :/ <fs_ipl1>-P_NAME, <fs_ipl1>-HUNDERDS , <fs_ipl1>-ORIGIN.
*ENDLOOP.

"" typed field symbols


FIELD-SYMBOLS : <FS_IPl> like lt_ipl .
ASSIGN : lt_ipl to <fs_ipl>.

LOOP AT lt_ipl ASSIGNING FIELD-SYMBOL(<fs_ipl1>).


<fs_ipl1>-ORIGIN = 'india'.

157
WRITE :/ <fs_ipl1>-P_NAME, <fs_ipl1>-HUNDERDS , <fs_ipl1>-ORIGIN.
ENDLOOP.

1) What Classical report and what are the events in that s?

The report which have only one input screen and one ouput screen is called as classical report

THERE ARE 11 EVENTS ARE THERE IN CLASSICAL REPORT :

1. LOAD-OF-PROGRAM

2. INTIALIZATION

3. TOP-OF-PAGE

4. AT – SELECTION SCREEN OUTPUT

5. AT – SELECTION SCREEN

6. AT –SELECTION SCREEN-ON-FIELDS

7. AT – SELECTION SCREEN ON VALUE – REQUEST

8. AT – SELECTION SCREEN ON HELP-REQUEST

9. START – OF – SELECTION

10. END – OF - PAGE

11. END – OF - PAGE

LOAD – OF – PROGRAM : This event is used to load the program into memory for execution . this is an
internal event which we can’t see ,

Its automatically triggers when the program will goes to execution..

INITIALIZATION : This events is used to initialize the default values to program variable and selection –
screen variables as parameters and selection - option ,

TOP – OF – PAGE : This event is used to display constant page heading of the page in the output screen
when the first WRITE statement is triggered on that time top of page will triggers .

158
AT – SELECTION SCREEN OUTPUT : this event is used to modify the screen dynamically based on the user
action on the selection screen this event is triggered at every action of the selection screen ..

AT – SELECTION – SCREEN : This event is used to validate the multiple fields of a selection screen (we
validate the input given by the user in the selection screen )..

AT – SELECTION – SCREEN – ON FIELDS : This event is used to validate the single field on the selection
screen

AT – SELECTION – SCREEN – ON – VALUE REQUEST :

This event is used to provide the search help for an input field this event is triggered whenever the user click
on help button ...

START - OF – SELECTION – ON HELP REQUEST :

This event is used to provide help information for the for an input field this event is triggered whenever the
user clicks on help button that is F1 button …

START – OF – SELECTION :

This event is used to write the original business logic statements i.e. all the select statements it is also used to
indicate the starting point of a program .this also default event

END – OF – PAGE : This event is used to provide constant footer information across all the pages of list
screen.

END – OF –SELECTIOIN : This event is used to indicate the start of selection has been ended .

2 Difference between Initialization and at selection screen event?


INITIALIZATION AT SELECTION SCREEN
This event is used initialize the default values This event is used to validate the multiple
and variables dynamically fields of selection screen in the output screen
This event keyword defines an event block It triggered before leaving the selection
whose event is triggered by the ABAP runtime screen. And validate the the input
environment during the flow of an executable
program,
Values set dynamically to the variables and This ABAP at run time only controls the flow
selection screen can’t be change in the output logic of Selection-screens. The PBO and PAI
screen triggers the num of. selection-screens.

159
3) What is the use of start-of-selection event & can we create program without start-of-
selection ?

This event keyword defines the standard processing block of an executable program. The associated event is
raised by the ABAP runtime environment during the running of an executable program after any standard
selection screens have been processed.

Its is used to write the original business logics i.e. all select statement

Yes it is possible to create a program without mention start of selection but, it is a good practise to use them.
START-OF-SELECTION marks the start of the program whereas END-OF-SELECTION is generally used to
output the list.

4)which event will trigger first at selection screen and at selection output?

at selection screen output is triggered first.

REASON

AT SELECTION-SCREEN OUTPUT ACTS LIKE AN INITIALIZATION WHEN YOU CLICK ON THE


EXECUTE BUTTON.

5) Difference between at selection screen and at selection screen output


selection screen selection screen output
It is used when using an element on the OPTION It is used as an event, This event is
screen...parameter...select options radio triggered at the screen event PBO of a selection
button...etc screen.
AT SELECTION-SCREEN - Used for AT SELECTION-SCREEN OUTPUT - used
validation purpose to alter / add properties of selection screen
elements
when user enters the values in the fields of the This event is executed at PBO of the selection
selection screen and clicks on execution screen every time the user presses
button,this event gets triggered

6) Create a report which consist all classical reports events and debug it 25 times

ZNV_REPORT_EVENTS ….

7) What is the triggering sequence of classical report events


 Load-of-program
 Initialization
160
 At Selection-Screen output
 At Selection-Screen on field
 At Selection-Screen on value request
 At Selection-Screen on help request
 At Selection-Screen
 Start-of-Selection
 End-of-Selection
 Top-of-Page
 End-of-Page

ASSIGNMENTS ON INTERECTIVE REPORT

1)what is get cursor field technique and its use?


Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output field or output line on which
the cursor was positioned during the interactive event to the ABAP program
2)List down the system variables available in interactive report and its uses( you need to show practically )?
SY-LSIND Index of the list created during the current event (basic list = 0)
SY-LISTI Index of the list level from which the event was triggered
SY-LILLI Absolute number of the line from which the event was triggered
SY-LISEL Contents of the line from which the event was triggered
SY-CUROW Position of the line in the window from which the event was triggered (counting starts with 1)
SY-CUCOL Position of the column in the window from which the event was triggered (counting starts with 2)
SY-CPAGE Page number of the first displayed page of the list from which the event was triggered
SY-STARO Number of the first line of the first page displayed of the list from which the event was triggered
(counting starts with 1). This line may contain the page header.
SY-STACO Number of the first column displayed in the list from which the event was triggered (counting starts
with 1)
SY-UCOMM Function code that triggered the event
SY-PFKEY Status of the list currently being displayed

3)How many lists are available for the system variables.


1. LINE-SIZE writes the page width into the variable .
2. LINE-COUNT writes the page length into the variable .
3. LINES writes the number of displayed lines into the variable .
4. FIRST-LINE writes the absolute number of the first line into the variable .
5. TOP-LINES writes the number of page header lines into the variable .
6. TITLE-LINES writes the number of list header lines of the standard page header into the variable .
7. HEAD-LINES writes the number of column header lines of the standard page header into the variable .
8. END-LINES writes the number of page footer lines into the variable .

161
9. Use DESCRIBE LIST for completed lists only, since for lists in creation (index is SY-LSIND) some attributes
are not up to date.

4)What system fields do we use for interactive reporting?

System fields are set at the PAI event for every screen. These can be also used for interactive list
processing, except for SY-DATAR, SY-LOOPC, and SY-STEPL.

SY-CUCOL

Horizontal cursor position Counting starts at column 2

SY-CUROW

Vertical cursor position Counting starts at row 1

SY-DATAR

Set to X at time of PAI if at least one screen input field was changed by the user or other data
transfer, otherwise empty.

SY-LOOPC

Number of rows currently displayed in a screen table (table control).

SY-PFKEY

GUI status of current screen. Can be set at PBO using SET PF-STATUS.

SY-SCOLS

Number of columns in current screen.

SY-SROWS

Number of rows in current screen.

SY-STEPL

Index of current row in a screen table (table control). Is set at every loop pass. Outside a loop, for
example during the POV event for a table row, SY-STEPL is not set appropriately.

SY-TITLE

Text that appears in the title bar of the screen. For selection screens and lists this is the program
name, otherwise SAP R/3. Can be set during PBO using SET TITLEBAR.

162
SY-UCOMM

Function code that triggered the event PAI. Every user action that triggers PAI is assigned a unique
function code, with one exception: Choosing Enter triggers PAI and different function codes can be
transferred to SY-UCOMM:

· If there is an entry in the command field of the standard toolbar, this is transferred to SY-UCOMM as
the function code.

· If there is no entry in the command field and a function code is assigned to the ENTER key, this
function code is transferred to SY-UCOMM.

· If the command field does not contain an entry and no function code is assigned to the ENTER key,
it is empty and the content of SY-UCOMM is not affected.

5)Create the interactive report by using get cursor technique and use top of page and end of page events, for
example it is a basic list it shows the VBRK(Master Data)
table and if it is a secondary list it is showing a VBRP(Item data). In each page show only 15records see the
example in below picture show the out put by using colours and borders
and it is in a tabular format. maintain the top-of-page during line selection and end-of-page during line
slection. in end of page display user name, time, date.
Note : VBRK-> HEADER, VBRP->ITEM. Use New syntax don't create unwanted structures.
REPORT ZNV_GET_CURSUR_REPORT01 NO STANDARD PAGE HEADING LINE-COUNT 32.

DATA :LV_VBELN TYPE VBRK-VBELN.


DATA : LV_FNAME TYPE STRING,
LV_FVAL(40) TYPE C.

DATA : L_VBELN TYPE VBRP-VBELN.

DATA : LT_VBRK TYPE TABLE OF VBRK,


LS_VBRK TYPE VBRK,
LT_VBRP TYPE TABLE OF VBRP,
LS_VBRP TYPE VBRP.

TOP-OF-PAGE.
WRITE : 40 'Billing Document Header Data'.
ULINE (102).
WRITE : / SY-VLINE, 'billing no' COLOR 4,
SY-VLINE, ' billing type' COLOR 4,
SY-VLINE, ' billing cat' COLOR 4,
SY-VLINE, ' billing date' COLOR 4,
SY-VLINE, ' sales org' COLOR 4,
SY-VLINE, ' Distr chanes' COLOR 4,
163
SY-VLINE, ' shipping cond' COLOR 4,
SY-VLINE.
ULINE (102).

END-OF-PAGE.
WRITE :/ SY-VLINE, 'USER NAME : ' COLOR 1, SY-UNAME,
SY-VLINE, 35 'TIME : ' COLOR 1, SY-TIMLO,
58 SY-VLINE, 69 'DATE : ' COLOR 1, SY-DATUM,
101 SY-VLINE.
ULINE (102).

TOP-OF-PAGE DURING LINE-SELECTION.


WRITE : 10 'Billing Document item data' COLOR 3.
ULINE /(99).

START-OF-SELECTION.

SELECT * FROM VBRK INTO TABLE LT_VBRK UP TO 75 ROWS.

LOOP AT LT_VBRK INTO LS_VBRK.


WRITE :/ SY-VLINE, LS_VBRK-VBELN COLOR 3,
SY-VLINE,LS_VBRK-FKART ,
29 SY-VLINE, LS_VBRK-FKTYP,
43 SY-VLINE,LS_VBRK-FKDAT COLOR 2,
58 SY-VLINE,LS_VBRK-VKORG,
70 SY-VLINE, LS_VBRK-VTWEG,
85 SY-VLINE, LS_VBRK-VSBED,
102 SY-VLINE.
ULINE (102).
ENDLOOP.
AT LINE-SELECTION .
GET CURSOR FIELD LV_FNAME VALUE LV_FVAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = LV_FVAL
IMPORTING
OUTPUT = L_VBELN.

IF LV_FNAME = 'LS_VBRK-VBELN'.
SELECT * FROM VBRP INTO TABLE LT_VBRP WHERE VBELN = L_VBELN.
ULINE /(46).
LOOP AT LT_VBRP INTO LS_VBRP .
WRITE :/ SY-VLINE, LS_VBRP-VBELN,
sy-VLINE,LS_VBRP-VBELV,
164
sy-VLINE, LS_VBRP-ABRBG,
sy-VLINE ,LS_VBRP-ALAND,
sy-VLINE.
ULINE /(46).
ENDLOOP.
ENDIF.

Output

ASSIGNMENTS ON VARIENTS AND SUB - ROUTINES

1.what is variant ? how to create variant , explain it?


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.
Select report program name Click on direct processing then select go to option select variants and select
save variants give the variant name and description then click on save

165
166
2. what is modularization technqiues and types of it?
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 can not be executed directly.
 These include programs must be embedded inside a main program for execution.
 These programs dosen`t contain parameter interface, that is no importing and exporting parameters.
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.
T-code for Function Module explorer is SE37 .

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 contains importing and exporting parameters .
Using Classes in SAP ABAP
 Classes are Object Oriented implementations of SAP ABAP.
 Classes are used for better re-usability.
3. what is syntax of include and create one include and use it in program?

Go to se38 and create a report znv_include and type include prgrm


Pgm :

SELECT * from vbap INTO TABLE @data(lt_vbap) up to 20 ROWS.

LOOP AT lt_vbap INTO data(ls_vbap).


WRITE :/ ls_vbap-ABDAT,ls_vbap-ABGRS.
ENDLOOP.

Then create a new program using executable statement and call that include program inside the
executable program using include key word..

167
REPORT ZNV_INCLUDE_TEST.

INCLUDE ZNV_INCLUDE_PROGRAM.

4. can we use includes in FM ?

>> Yes we can use includes in FM.

4) what is subroutine and use of it?


A subroutine is a reusable section of code. It is a modularization unit within the program where a function is
encapsulated in the form of source code.
Subroutines are normally called internally, i.e. called from the same program in which it is defined. But it is
also possible to call a subroutine from an external program. Subroutines cannot be nested and are usually
defined at the end of the program.
A subroutine can be defined using FORM and ENDFORM statements.
A subroutine can be called using PERFORM statement.

5. what are the key word used in subroutine?


Subroutines can be defined using FORM and ENDFORM statements. PERFORM statement used to call
the subroutine. PERFORM and FORM must contain the same number of parameters.

6) Create one subroutine example in program using vbap to fetch the data.
REPORT ZNV_SUBROUTINE3.

DATA : lt_vbap TYPE TABLE OF vbap,


ls_vbap TYPE vbap.

PARAMETERS : p_vbeln TYPE vbap-vbeln.

PERFORM get-data.
PERFORM write-data.

FORM GET-DATA .
select * FROM vbap INTO ls_vbap where vbeln = p_vbeln.
ENDSELECT.
ENDFORM.

FORM WRITE-DATA .

WRITE : / ls_vbap-MATNR,
ls_vbap-MATWA,
ls_vbap-POSNR,
ls_vbap-VBELN.
168
ENDFORM.
7) after endform can we access write statement. if yes how if no why?

No we cannot access write statement.


1)What is function module and function group?
FUNCTION MODULE : Function modules are sub-programs that contain a set of reusable statements with
importing and exporting parameters.
FUNCTION GROUP : The function group that are acts like a container for a number of function module that
are logically belong together…

2)Types of function module?

Regular Function Module :


A Regular Function Module is the default option. This kind of Function Module is executed
immediately and synchronously on your current SAP system.
Remote-Enabled Function Module : Remote Function Modules can be called by other SAP
and non-SAP systems utilizing the RFC protocol.
Update Function Module : Update Function Modules are not executed immediately. They
are scheduled for execution in an update work process. This update process is triggered
by the statement COMMIT WORK. The statement ROLLBACK WORK deletes all update
function module registrations.

3) Explore all the tabs present in function module?


Attributes : it holds the information of function group name
And processing type :
 Regular Function Module
 Remote- Enabled Module
 Update Module

Start update immediately

The function module is processed immediately in the update task.

Update is started immediately, no restart possible

The function module will be edited in the update task. It cannot be updated subsequently.

Start of update delayed

169
The function module is processed in the update task as a low priority item. You use delayed update
primarily for database changes that are not time-critical (e.g. statistical updates).

Update triggered by collector

- For internal use only -

Definition

A number of similar function modules that previously used to run individually in the V2 update process
can be grouped together and run collectively.

The reasons for processing them collectively are as follows:

 the data of all the calls are read and processed internally.
 database updates are not made until the internal processing is complete

 Import - input parameter of a function module .


 Export - output parameter of a function module
 Changing – Specifies the parameter act as importing ` ` and exporting parameter
to a function module.
 Tables - Specifies internal tables acts as importing and ` exporting parameters.
 Exceptions – Specifies exception in Function Modules.

4) Create a function module and fetch the records using se38. using vbap or vbak.
FUNCTION ZNV_FN_MD1.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(P_VBELN) TYPE VBAP-VBELN
*" EXPORTING
*" REFERENCE(WA) TYPE VBAP
*"----------------------------------------------------------------------

select * FROM vbap INTO CORRESPONDING FIELDS OF wa WHERE vbeln = p_vbeln.


ENDSELECT.

ENDFUNCTION.
Report program..
REPORT ZNV_FUN_MODULE.
PARAMETERS: P_VBELN1 TYPE VBAP-VBELN.
DATA: wa1 TYPE VBAP.

CALL FUNCTION 'ZNV_FN_MD1' “calling function module inn report progarms


EXPORTING
P_VBELN = p_vbeln1

170
IMPORTING
WA = wa1
.
WRITE :/ wa1-VBELV,
wa1-VBELN,
wa1-ABFOR.

5) what is pass by value and pass by reference

PASS BY VALUE PASS BY REFERENCE


in pass by value only a copy of the parameter is in pass by reference you are passing the original
passed so wht ever change you have made in the parameter that means the memory of that
FORM for that parameter does not reflect in the main parameter so what ever changes you have made in
program. the FORM it will reflect in the main program.

formal and actual parameter will point different formal and actual parameter will point same
memory address memory address
When you pass by reference, no local data object is a local object with the same data type as the
specified for the actual parameter, but the procedure corresponding actual parameter is created in the
receives a reference to the actual parameter during subroutine and filled with its values. A change to
call and works with the actual parameter itself. A the formal parameter in the subroutine does not
change to the formal parameter in the subroutine also change the value of the actual parameter. The
changes the value of the actual parameter. actual parameter also retains its original value
even after the subroutine has ended.

6) How many FM are possible to create in one Function Group

The numbering XX indicates the chronological order in which the function modules were created.

So, as XX contain two digits - 99 functional modules is limit.

7) Difference between FM and subroutine


Function Module Subroutine

function modules have uniquely Subroutines do not return values.


defined interface.

171
Function module return exception Sub routines do not return exceptions

Function modules are stored in a Sub routines cannot be tested


central library. independently.

The function group of the function module is Subroutines are procedures that you can
loaded into an internal session of the define in any ABAP program and also call
context, and is retained from any program

8) Create Exception and call ur program based on condition


FUNCTION ZNV_EXCEPTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(NUM1) TYPE I
*" REFERENCE(NUM2) TYPE I
*" EXPORTING
*" REFERENCE(RESULT) TYPE I
*" EXCEPTIONS
*" ZERO_REF
*"----------------------------------------------------------------------

IF NUM2 = 0.
RAISE ZERO_REF.
ELSE.
RESULT = NUM1 / NUM2.
ENDIF.

ENDFUNCTION.

REPORT ZNV_EXCEPTION_CALL.

DATA: K TYPE I.
PARAMETERS: P_NUM1 TYPE I,
P_NUM2 TYPE I.
CALL FUNCTION 'ZNV_EXCEPTION'
EXPORTING
NUM1 = P_NUM1
NUM2 = P_NUM2
* IMPORTING
* RESULT =
* EXCEPTIONS
ZERO_REF = 1
OTHERS = 2
.
IF SY-SUBRC = 1.
* Implement suitable error handling here

172
MESSAGE A001(ZMSG).
ENDIF.

9) Go through Rfc function module

1) what is rfc function module and what is the use of rfc function module?
RFC is a mechanism that allows business applications to communicate and exchange information (in
pre-defined formats) with other systems. RFC stands for ‘Remote Function Call’
Uses of RFC function module:

 Convert the data into the format understandable by the remote (target) system.
 Convert the data into the format understandable by the remote (target) system.
 Call up certain routines which are necessary to start communication with the remote system.
 Handle errors that might occur in the process of communication.

2) What are the parameters are allowed while creating rfc function module?
In RFC function module, data will be passed through parameters using "Pass by Value" concept.
3) Create one structure in se11 with 3 to 4 field from table EKPO, after that you will develop a RFC function
module in hana server and calling system will be ECC.
4) types of rfc , explain it?

Types of RFC:

Synchronous
Requires both the systems (client and server) to be available at the time of communication or data transfer. It is
the most common type and is required when the result is required immediately after the execution of sRFC.

173
sRFC is a means of communication between systems where acknowledgments are required. The resources of
the Source System wait on the target system and ensure that they deliver the message/data with ACKD. The
Data is consistent and reliable for communication.
The issue is if the target system is not available, the source system resources wait until target system is
available. This may lead to the Processes of source system to go into Sleep/RFC/CPIC Mode at target systems
and hence blocks these resources.
Used for

 For communication between systems


 For communication between SAP Web Application Server to SAP GUI

Asynchronous
It is communication between systems where acknowledgments are not required (it is similar to postcard
delivery).It doesn’t require both the systems to be available at the time of execution and the result is not
immediately required to be sent back to the calling system.
The Source System resource does not wait for the target system as they deliver the message/data without
waiting for any acknowledgment. It is not reliable for communication since data may be lost if the target system
is not available. Used for –

 For communication between systems


 For parallel processing

5) what is luw and use of luw?


Logical unit of work in SAP.
USES OF LOGICAL UNIT OF WORK :
A database LUW is work unit consisting of database operations (INSERT, UPDATE,
MODIFY & DELETE) that it used to make the database changes.
The final database LUW of a SAP LUW is used to make the changes to the database, the
changes to the database is not made until after the database commit.

The database LUW is executed in a special kind of work process called the update work
process.

6) Difference between Database luw and SAP luw?


Database luw SAP luw
Database LUW also known as DB LUW, each SAP LUW consists of several dialog steps and
dialog step has its own DB LUW that is used all the changes to database are written in a
to ensure data consistency. single DB LUW. We must note that the
database changes are always written in the
final database LUW.

The SAP Luw combines all DB


The DB Luw happens for each Luw’s of the Transaction into a
individual screen. Single LUW.
174
7) what is update FM ? why we go for update function module?
An update function module is a function module, for which in the Function Builder the property
'Update Module' is marked as processing type.
The main update technique for bundling database changes in a single database LUW (Logical Unit of Work) is
to use CALL FUNCTION <update_function> IN UPDATE TASK.

8) which parameters support in update fm? and why?


Pass by value is taken in update function module by default …

9) what are V1 and V2 types of update function module?


An update is divided into different modules. Each module corresponds to an update function module.

There are various types.

 V1 modules describe critical or primary changes; these affect objects that have a controlling function in
the SAP system, for example, creation of orders and changes to material stock.
 V2 modules describe less critical secondary changes. These are pure statistical updates, for example,
such as result calculations.

10) Create update function module with CRUD(create ,read,update and delete) operations?
REPORT ZNV_CRUD_FM.

TABLES : SSCRFIELDS.
DATA : LT_NV TYPE TABLE OF ZNV_CRUD.
DATA : LS_NV TYPE ZNV_CRUD.
DATA : LV_NV(10) TYPE C .

DATA : LV_VAR TYPE ZNV_ID.


SELECTION-SCREEN BEGIN OF BLOCK NAVEEN WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 2.
PARAMETERS: SID TYPE ZNV_CRUD-SID,
NAME TYPE ZNV_CRUD-NAME,
PNUMBER TYPE ZNV_CRUD-PNUM.

SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN PUSHBUTTON 5(8) TEXT-002 USER-COMMAND SA1.
SELECTION-SCREEN PUSHBUTTON 15(8) TEXT-003 USER-COMMAND SA2.
SELECTION-SCREEN PUSHBUTTON 25(8) TEXT-004 USER-COMMAND SA3.
SELECTION-SCREEN PUSHBUTTON 35(8) TEXT-005 USER-COMMAND SA4.
175
SELECTION-SCREEN END OF BLOCK NAVEEN.

*
*DATA : SNV TYPE ZNV_CRUD.
*DATA : LS TYPE ZNV_CRUD.

AT SELECTION-SCREEN.

IF LV_VAR IS NOT INITIAL .


SCREEN-ACTIVE = 0.
ENDIF.
CASE sscrfields-UCOMM.
WHEN 'SA1'.
LV_NV = 'INSERT'.
MESSAGE 'DATA INSERTED SUCCESSFULLY' TYPE 'S' .
WHEN 'SA2'.
LV_NV = 'MODIFY'.
MESSAGE 'DATA MODIFY SUCCESSFULLY' TYPE 'S' .
WHEN 'SA3'.
LV_NV = 'UPDATE'.
MESSAGE 'DATA UPDATED SUCCESSFULLY' TYPE 'S' .

WHEN 'SA4'.
LV_NV = 'DELETE'.
MESSAGE 'DATA DELETED SUCCESSFULLY' TYPE 'S' .

ENDCASE.
START-OF-SELECTION.
IF LV_NV = 'INSERT' .
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'ZNV_CRUD'
IMPORTING
NUMBER = LV_VAR.

.
IF SY-SUBRC <> 0.
** Implement suitable error handling here
ENDIF.
ENDIF.
IF LV_NV = 'INSERT' .
176
LS_NV-SID = LV_VAR .
ELSE .
LS_NV-SID = SID.
ENDIF.
LS_NV-NAME = NAME.
LS_NV-PNUM = PNUMBER .
LS_NV-SID = SID.
CALL FUNCTION 'ZNV_UPDATE_CRUD' IN UPDATE TASK
EXPORTING
OPERATION = LV_NV
ZEMP_WA = LS_NV
* ID =
* NAME =
* PNUMBER =
* TABLES
* ZEMP =
EXCEPTIONS
NODATA = 1
OTHERS = 2
.
COMMIT WORK.

PERFORM ASSIGN_PAR.

FORM ASSIGN_PAR .
* SELECT * FROM ZNV_CRUD INTO CORRESPONDING FIELDS OF TABLE LT_NV
LS_NV-NAME = NAME.
LS_NV-SID = SID.
LS_NV-PNUM = PNUMBER.
* LS_NV-PNUMBER = PNUMBER.
ENDFORM.

11)what is commit work and commit work and wait.


COMMIT WORK : This is the standard form, which specifies asynchronous processing. Your program does
not wait for the requested functions to finish processing.
COMMIT WORK AND WAIT : This form specifies synchronous processing. The commit statement waits
for the requested functions to finish processing. Control returns to your program after all high priority (V1)
function modules have run successfully.
The AND WAIT : form is convenient for switching old programs to synchronous processing without having to
re-write the code. Functionally, using AND WAIT for update-task updates is just the same as dialog-task
updates with PERFORM ON COMMIT.
177
12) how to debug update FM?
As we know update function module is called when a commit work is happend.
To Debug an update function put a break-point just above the update function module and executes the
program. Go to the property of the debugger (Setting-> Display/change debugger setting) and select the
flag “Update Debugging”.

13)Diffrence between commit work and roll back?


COMMIT WORK :
 when in program it reaches COMMIT WORK statement, it looks into that table and calls each
registered functions and updates the database tables (for the corresponding
INSERT/MODIFY/UPDATE/DELETE statements written in the function module).
 The actual execution is triggered by the statement COMMIT WORK. The formal parameters of the
function module receive the values of the actual parameters from table VBLOG.

 ROLLBACK :
 ROLLBACK erases the modifications made by the current transaction
 Once ROLLBACK is executed database reaches its previous state, i.e. before the execution of the first
statement of the transaction.
 Once ROLLBACK is executed database reaches its previous state, i.e. before the execution of the first
statement of the transaction.

14)Diffrence between Normal,rfc and update function module?


Normal Function Rfc function Update function
1.it can be called inside the 1.you can call some system or 1.this is generally used to
system. another possible. update the database record.
2.Here pass by value and pass 2.in rfc function module you 2.update function module can
by reference both is fine can only have pass by value. be called from the same system.
3.in the same system if you are 3.the is used to achive
going to add the destination generally sap luw.
none while calling the rfc
Then it will be called in
separate session.
4.some time we use from
performance perspective also.

178
1)Explore and go through each radio button while creating tcode and how to create t code?

Transaction type: Dialog transaction


In a dialog transaction, the program flow is determined by the sequence of screens. The screens
that you call within a transaction are all part of a shared module pool (program with type 'M').
You must specify the initial screen of the transaction when you define a transaction code.
Transaction type: Report transaction
In a report transaction, you start a program with type 1 using a transaction code. A report usually
receives data at the beginning (using a selection screen), processes it (for example, using a logical
database), and then outputs data (a list).
When you define the transaction code, you can specify a selection screen and a report variant.

Transaction type: Object transaction


Starts a method of a class using a transaction code

Transaction type: Variant transaction


In the SAP Reference IMG, under "Basis Components" -> "Application Personalizaion" -> "Tailoring
of Application Transactions", you can define transaction variants. These allow you to preassign
values to fields within a transaction, define field attributes, or hide entire screens.
To run a transaction variant, you define a variant transaction. On the next screen, enter the name of
the transaction and the name of the variant.
Note
Variant transactions are client-specific.
If you try to start a variant transaction and the corresponding variant does not exist, the transaction
runs without a variant.

Transaction type: Parameter transaction


Parameter transactions allow you to preassign values to the fields on the initial screen.
If you supply all of the necessary entries for the initial screen in this way, you can suppress the
screen when the transaction is executed.

Variant Name
Name of the variant you want to edit.

Procedure
Enter a variant name.
If you want to change an existing variant, you can display a list of all variants by selecting
Environment -> Directory. From this list, you can choose a variant for editing.
179
Dependencies
For background requests, a report must have at least one variant.

Authorization Object
Element of the authorization system.
An authorization object combines up to 10 authorization fields, which are checked using the AND
connective.
Authorizations are checked against objects in the system. Authorization objects enable complex
checks (linked to several conditions) of an authorization. For the authorization check to be successful,
the user must pass the check for each field contained in the object.

Procedure
In the Authorization Object field, enter the name of the authorization object that is checked against
the authorizations of the calling user when a transaction is started.
Enter a value in the list of all fields of the authorization object to be checked, which you can call by
choosing Values. Fields of the authorization object for which no value is specified are not checked.
• The check is performed for calls as a result of LEAVE TO TRANSACTION and for calls as a
result of the entry of the transaction code in the command field in the toolbar.
• In the case of CALL TRANSACTION, the check depends on the use of the addtion WITH
AUTHORITY-CHECK or WITHOUT AUTHORITY-CHECK. For more information, see CALL
TRANSACTION.
If the user does not have the necessary authorizations, the start of the transaction is cancelled.
Note
You should normally specify an object that is also checked within the program.

2) Can we create variant for T Code? If Yes Then How ?


Yes we create an tcode by using the transaction code SHD0 to create the transaction variant.
Enter the transaction code and add the transection varint as start with z or y then click on create tab on
above

Then that particular output screen will be appear agaim click on create button as in shown in screenshot
Then this screen will appear give short text for and select the option called menu function and select the
option change ..
give the short text save the object in local storage

Then enter the transaction code SE93 and press enter then it will open above screen give the
transaction code name and press the create

In this option give the short text and select the option called Transaction type: Variant transaction …
Then give transaction name as SE11 and transaction variant as we created in the tcode SHD0
Then save the object..
180
Then Enter the new tcode and press enter
Then se11 output screen will be Appears

3) Difference between pass by value and pass by reference?


PASS BY VALUE PASS BY REFERENCE
in pass by value only a copy of the parameter in pass by reference you are passing the
is passed so wht ever change you have made original parameter that means the memory of
in the FORM for that parameter does not that parameter so what ever changes you have
reflect in the main program. made in the FORM it will reflect in the main
program.
formal and actual parameter will point formal and actual parameter will point same
different memory address memory address
When you pass by reference, no local data a local object with the same data type as the
object is specified for the actual parameter, corresponding actual parameter is created in
but the procedure receives a reference to the the subroutine and filled with its values. A
actual parameter during call and works with change to the formal parameter in the
the actual parameter itself. A change to the subroutine does not change the value of the
formal parameter in the subroutine also actual parameter. The actual parameter also
changes the value of the actual parameter. retains its original value even after the
subroutine has ended.

4) Difference Between Actual parameters and formal Parameters?


Actual parameters formal Parameters
actual parameters which are used in parameters which are defined in form are
subroutine calling called formal parameters.
the actual parameters are the actual values The formal parameters are the parameters that
passed to the subroutine while calling the you define in the subroutine declaration
subroutine..
When you call a subroutine, you must fill all The formal parameter has no memory of its
formal parameters with the values from the own. During a subroutine call, only the
actual parameters. address of the actual parameter is transferred
to the formal parameter

5) Create a Subroutine by key words like using and changing?


REPORT ZNV_SUBRTN_USING_CHANGING_KEYW.
"Subroutine with keyword:-'USING'"
**--------------------------------------

*DATA: LS TYPE MARA.


*
*PARAMETERS : P_MATNR TYPE MARA-MATNR.
*
*PERFORM GET_DATA.
**PERFORM WRITE_DATA.
*

181
*FORM GET_DATA.
*
*DATA: COUNT TYPE I.
*
*SELECT SINGLE * FROM MARA INTO LS WHERE MATNR = P_MATNR.
*COUNT = 1.
*
*PERFORM WRITE_DATA USING COUNT SY-REPID. "SY-REPID=>Repr current
prgrm name" "ACTUAL PARAMETER"
*
*ENDFORM.
*
*FORM WRITE_DATA USING COUNT PROG.
*
*IF SY-SUBRC = 0.
* WRITE: / 'MATERIAL NO :',LS-MATNR,
* / 'DATE :', LS-ERSDA,
* / 'MATERIAL :', LS-MEINS,
* / 'TYPE :', LS-MBRSH,
* / 'COUNT :', COUNT,
* / 'PROGRAM NAME :', PROG.
* ENDIF.
*
*ENDFORM.

*"-------------------------------------------------------------------------
--------------------
*Subroutine with keyword:-'CHANGING'"

*"-------------------------------------------------------------------------
--------------------

PARAMETERS : P_MATNR TYPE MARA-MATNR.

PERFORM GET_DATA.
*PERFORM WRITE_DATA.

TYPES: ABC TYPE TABLE OF MARA.

FORM GET_DATA.

DATA: COUNT TYPE I.


DATA: LS TYPE MARA,
LT TYPE TABLE OF MARA.
182
SELECT * FROM MARA INTO TABLE LT WHERE MATNR = P_MATNR.
COUNT = 1.

PERFORM WRITE_DATA USING COUNT LS CHANGING LT .


"ACTUAL PARAMETER"

ENDFORM.

FORM WRITE_DATA USING COUNT LS TYPE MARA CHANGING LT TYPE ABC. "FORMAL
PARAMETER"

IF SY-SUBRC = 0.
LOOP AT LT INTO LS.
WRITE: / 'MATERIAL NO :',LS-MATNR,
/ 'DATE :', LS-ERSDA,
/ 'MATERIAL :', LS-MEINS,
/ 'TYPE :', LS-MBRSH,
/ 'COUNT :', COUNT.
ENDLOOP.
ENDIF.

6) Practice on actual formal and pass by value pass by reference in program?


TYPES: BEGIN OF LT_EMP,

NAME(10) TYPE C,
DEPT(10) TYPE C,

END OF LT_EMP.

DATA: LS_PERSON TYPE LT_EMP.

LS_PERSON-NAME = 'ABC'.
LS_PERSON-DEPT = 'XYZ'.

PERFORM PASSREF USING LS_PERSON. "Actual Parameter"


WRITE: / LS_PERSON-NAME,
LS_PERSON-DEPT.

FORM PASSREF USING LS1 TYPE LT_EMP. "Formal Parameter"


WRITE: / LS1-NAME,
LS1-DEPT.

LS1-NAME = 'BBB'.
183
LS1-DEPT = 'BASIS'.

WRITE: / LS_PERSON-NAME,
LS_PERSON-DEPT.

WRITE: / LS1-NAME,
LS1-DEPT.

ENDFORM.
7) How to create subroutine pool practically?
REPORT ZNV_SUBROUTINE_POOLS.
TYPES:
source_line(72) TYPE c.

DATA:
src TYPE TABLE OF source_line,
msg(120) TYPE c,
line(10) TYPE c,
word(10) TYPE c,
off(3) TYPE c.

CONSTANTS:
prg_name(30) VALUE 'ZDYNGENPGM1'.

APPEND 'PROGRAM ZDYNGENPGM1.' TO src.


APPEND 'WRITE / '' sub routine pool ''.' TO src.

INSERT REPORT prg_name FROM src.

GENERATE REPORT prg_name


MESSAGE msg LINE line WORD word OFFSET off.

IF sy-subrc <> 0.
WRITE: / 'Error during generation in line', line,
/ msg, / 'Word:', word, 'at offset', off.
ELSE.
SUBMIT (prg_name) AND RETURN.
ENDIF.

The above code, first the program source is created and stored in the internal table SRC.
The special command INSERT REPORT inserts the program into the program database
table of the SAP application server. The command GENERATE REPORT generates a
program that already exists in the program database table.

184
6)Explain the difference between classical,interactive and alv?
Classical Report Interectoive Rport Alv Report
Classical reports are Interactive records first to use ALV. by using ALV
executed based on events, and provide basic list and then a we can display in Grid as
not executed on a line-by-line detail list depending upon the well as list format.
basis. user interaction for one or
more fields.
Classical reports are non- if we cliack on some field it Output format will be good.
interactive reports. Basically, will display one more list. Sorting, Filtering facilities are
they consist of one program provided by itself. We can
that creates a single list. have column headings also.
A classical report is created . its having one primary list In ALV reports SAP has
by using the output data in and 20 secondary list for the provided some function
the WRITE statement inside a outputs. modules to display output.
loop.

7)Explain the diffrence between List and Grid display?


List Grid

1.list display does not support oops alv. 1.grid display supports oops alv.
2.Alv list can be display hireaichery and 2.Alv grid cannot be display hirearichery
block and block.
3.alv list it consumes more memory on the 3.alv grid uses Active x controls present on
presentation server. presentation server.
4.list display is faster. 4. grid display is slower.

1.Difference between BDC and LSMW


BDC LSMW
BDC is mainly for any customized LSMW is generally for normal SAP
applications. applications,
BDC is a SAP to SAP communication LSMW is a Non-SAP to SAP
UTILITY. communication TOOL,
BDC(Batch Data Communication) is LSMW(Legacy System Migration
basically a program which is either Workbench) is a more user-friendly
generated by SAP after a recording tool, through which one can do the
or programmed by a abaper same work as the BDC

2.what is call transaction and session and how it's wokring? and why we going for that?.
-> SESSION :
· Session: a session contains a group of records, which have to be transferred into SAP.
· To create a session, we use the below function modules.
o BDC_Opengroup

185
o BDC_Insert
o BDC_Closegroup

· CALL TRANSACTION :

· It is the process of transferring the data from flat file into SAP by calling a transaction through a
series of sequence of steps.

· Properties:
o This method is used for transferring less amount of data(<10,000 records).
o This method uses Synchronous and Asynchronous updates.
o This method will update the DB immediately.
o We need to handle the errors and the success messages by declaring an internal table of type
BDCMSGCOLL.
o This method is very fast.

3. Go through BDCDATA structure and SHDB T-code.


Batch Input Transaction Recorder (SHDB) in batch data communication (BDC)
Step1:
Create a BDC Recording using transaction SHDB.
Step2:
Create a ZProgram from the Recording (from tcode SHDB).
Step3:
Upload the legacy data.. Use FM GUI_UPLOAD.
Step4:
Loop at the internal table (with legacy data)
Put the BDC code inside the loop and replace the values which you gave while recording
with the internal table fields respectively.
Step5:
Activate the program and execute.
here is the brief description of the same...
The SAP system offers two primary methods for transferring data into SAP systems. From
non-SAP systems or legacy system. These two methods are collectively called “batch
input” or “batch data communication”.
1. SESSION METHOD.
2. CALL TRANSACTION.
3. DIRECT INPUT.

· BDC DATA :

186
· It is a structure defined in a data dictionary with the below fields.
· Program -> Name of the program of a screen
· Dynpro -> Screen number
· Dynbegin -> Start the Process
· Fnam -> Field name on the SAP screen
· Fval -> Field value on to the field name of SAP screen

· USE OF BDC DATA:


· It is a structure which holds the information related to each screen i.e. program name, screen no,
field name, field values, information of that particular screen to be transferred into the SAP.

5.Explore Syntax for call transaction method?


· -> Syntax:
· Call Transaction <Tcode>
· Using <BDC DATA>
· UPDATE <A/S>
· MODE <A/E/N>
· MESSAGES INTO <Message Internal Table>.

6.How we are handling errors in call transaction and practice it ?.


->

7.What's an inbound and outbound data transfer ?


· -> There are two techniques available for transferring data.
o Outbound process
o Inbound process
· OUTBOUND PROCESS:
· The process of transferring the data from SAP to NON-SAP or another SAP server is called “Outbound
Process”.
· INBOUND PROCESS
· The process of receiving the data from NON-SAP to SAP server is called as “Inbound Process”.

8.What are the modes available in call transaction?


· -> MODE:
· It specifies the type of the mode to execute the transaction.
· There are 3 options for mode :
· A -> All screen mode(Foreground)
· E -> Error screen mode (only error screens will be displayed)

187
· N -> No screen mode (Background)

9.difference between COMMIT WORK and COMMIT WORK AND WAIT?


· -> ASYNCHRONOUS UPDATE (COMMIT):
· In this type the call transaction screens will communicate with the update work process to update
the data into database.
· It doesn’t wait for the update to be finished.
· It immediately starts to process the next record without waiting for the update to be finished.
· That’s why this process is very fast.
· It is generally not recommended for the large amount of data, because the called transaction doesn’t
return any success or error messages.
· SYNCHRONOUS UPDATE (COMMIT & WAIT):

· In this mode, the called transaction communicates with the update work process to update the data
into database.
· It will wait for the update to be finished.
· Once the update is finished, then it continues to process the next record.
· That’s why this process is very slow.
· It is generally recommended for large amount of data because it returns success and error messages.

188

You might also like