Abap Babu PDF
Abap Babu PDF
Abap Babu PDF
BABU
OASIS
SIDDHARTH XEROX
Behind mitryvanam,Gayatry nagar,ameerpet, HYD.
CELL:89859 28289, 9959 702469
SOFTWARE INSTITUTES MATERIAL AVAILABLE
01ERP_SAP_ABAP_Introduction.pdf 02Data_Dictionary.pdf 03Modularization techniques.pdf
04)Events_Classical_Interactive_Reports.pdf 05(2)Reports_ABAP_Queries_Fundamentals-15.pdf
Chapter-1
SAP-ERP INTRODUCTION
Table of Contents-Chapter: 1
SAP-ERP Introduction ................................................................................................................................... 2
Enterprise Resource Planning ................................................................................................................... 2
Uses of ERP................................................................................................................................................ 3
Client Server System ................................................................................................................................. 4
SAP People ................................................................................................................................................ 5
Three Tier Architecture ............................................................................................................................. 6
Different Components of 3 Tier Architecture ........................................................................................... 9
ABAP/4 Introduction ............................................................................................................................... 11
Open and Native SQL .............................................................................................................................. 12
Some Configuration Details for ECC 6.0 Installation .............................................................................. 13
Initial Screen of SAP ................................................................................................................................ 16
Transaction Codes ................................................................................................................................... 17
ABAP Workbench .................................................................................................................................... 19
Object Navigator ..................................................................................................................................... 19
1
BY MR. BABU (OASIS TECHNOLOGIES)
SAP-ERP Introduction
SAP- Systems Applications & Products in Data processing
About SAP:
• SAP was found in June 1972 as “System Analysis and Program Development”.
• The name was later changed as “Systems Application and Products in Data processing”.
• SAP is a Germany based company. It was named as SAP-AG.
• SAP is world number one in ERP and third highest revenue independent software
provider.
• SAP is into almost all the industries such as Automobiles, Banking, Electronics etc….
• Impherical Chemical Industries (ICI) was the first customer of SAP.
2
BY MR. BABU (OASIS TECHNOLOGIES)
Uses of ERP:
• It is the centralized system to provide the strong integration between the different
business or functional areas.
• It provides the correct information on time to take the business decisions.
• The higher management (Directors, Managers, Leads etc…) with the knowledge of ERP
will be able to achieve their goals and targets using proper implementation of ERP.
• Better business plan and resource utilization.
• On time delivery and customer satisfaction.
There are more than 150 ERP vendors in market. Among them SAP is the best vendor. Few
other vendors are:
• Oracle
• PeopleSoft
• Microsoft etc….
• In business point of view ERP is expanded from the co-ordination of the manufacturing
process to an Enterprise wide backend integration process.
• In technical point of view, ERP is expanded from the legacy implementation to more
flexible tires architecture.(Client-Server Architecture)
3
BY MR. BABU (OASIS TECHNOLOGIES)
Client:
It is a software or hardware combination which can send the requests for services from the
central respiratory system.
Server:
It is a software or hardware combination which can provide the services to a group of clients in
the shared environment.
4
BY MR. BABU (OASIS TECHNOLOGIES)
SAP People:
5
BY MR. BABU (OASIS TECHNOLOGIES)
Three Tier Architecture:
It is an arrangement of the systems or layers. There are three layers involved in SAP
architecture.
1. Presentation Layer
2. Application Layer
3. Database Layer
1. Presentation Layer:
• It is an environment from where all the requests are sent for the services from the
central respiratory system.
• The services or results are displayed in the presentation layer.
2. Application Layer:
• It receives the requests from the presentation layer to get them processed in the work
process.
• It also sends back the services to the presentation layer
• There will be more than one application layer.
3. Database Layer:
• It is a central depository of the data. It provides the data base services to a group of
clients in the shared environment.
6
BY MR. BABU (OASIS TECHNOLOGIES)
• In this architecture, all the three layers are in the same system.
System
Presentation Layer
Application Layer
Database Layer
• In this architecture, there is a separate system for Presentation layer. Application layer
and Database layers are in another system.
System-1
Presentation Layer
Application Layer
System-2
Database Layer
7
BY MR. BABU (OASIS TECHNOLOGIES)
System-1
Presentation Layer
System-2
Application Layer
System-3
Database Layer
8
BY MR. BABU (OASIS TECHNOLOGIES)
Different Components of Three Tier Architecture:
9
BY MR. BABU (OASIS TECHNOLOGIES)
1. Presentation Layer:-
• It is an environment from where all the users requests are sent and display the results
or services.
2. Application Layer:-
• It receives the request from the presentation layer to get them processed.
• It also sends back the services (result) to a presentation layer.
• Following are the different components in application layer:
a. Dispatcher.
b. Gate way.
c. Shared Memory.
d. Work Process.
a. Dispatcher:
• It is a link between the presentation layer and the work process. It receives the request
from the presentation layer and sends them to an appropriate relevant work process to
get them processed.
• It also sends back the services (result) to the presentation layer.
b. Layer:
c. Shared Memory:
• It is a common main memory which can be shared by all the work process.
d. Work Process:
10
BY MR. BABU (OASIS TECHNOLOGIES)
Background Work Process: It takes care of all the background job requests. Background
jobs are scheduled to execute the application without user interaction periodically (hours,
daily, monthly)……
Enqueue Work Process: All the lock requests are handed by this work process.
Message Work Process: All the message requests are processed in this work process.
Spool Work Process (print): All the print requests are processed in this work process.
Update Work Process: All the database update requests are processed in this work
process.
• It converts all ABAP open SQL statements in to the database compatible statements to
access or to maintain the data in any database.
Note: SAP is database independent software because of the database interface layer in the
architecture.
ABAP/4 Introduction:
11
BY MR. BABU (OASIS TECHNOLOGIES)
Open and Native SQL:
• Open SQL is a set of SQL statements which can interact with any kind of database.
• Native SQL is specific to the particular database.
• The ABAP statement EXEC……..ENDEXEC are used to specify native sql.
Example: EXEC
*Native SQL
.
.
.
END EXEC
Note:
In ABAP we mostly work with open SQL.
The statements mentioned with in EXEC and ENDEXEC cannot be syntaxically checked.
The table which is not available in SAP (specific to database) can be accessed using
native SQL.
12
BY MR. BABU (OASIS TECHNOLOGIES)
Some Configuration Details for ECC 6.0 Installation:
Note: Wait until the color of the system icon changes to green.
(Grey Yellow Green)
Note: Wait until the color of the system icon becomes grey color.
(Green Yellow Gray)
13
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to add the system to login pad:
Example:
Description – ( )
Application server – ( )
System number – ( )
System ID – ( )
Note:
The button change item is used to change the existing system details.
The button delete item is used to delete the unwanted system from logon pad.
14
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
The client no’s will be specific for the projects in the real time. The client no could be
100/200/300…………….. But not 8* series number.
In the real time the user names will be unique in each project. The usernames could
be the combination of our names.
Example: (NAME) or (Z50074) (up to 12char)
But not SAPUSER
Note:
The below logon details can be used to logon to IDES (Internet Demonstration and
Evaluation System).
Client : 800
Username : sapuser
Password : india123
(For practice session only)
15
BY MR. BABU (OASIS TECHNOLOGIES)
Initial Screen of SAP:
• The initial screen of SAP is divided into the following different paths.
Command Field:
• The command field on the standard tool bar is used to execute or access the transaction
codes in SAP.
16
BY MR. BABU (OASIS TECHNOLOGIES)
Transaction codes:
• The transaction codes are the commands or short cuts to execute or access the
corresponding predefined applications.
• In Sap each screen is linked with the unique transactional code.
• The transactional codes are mainly categorized in to two:
1. Standard transaction codes
2. Custom transaction codes
• The standard transactional code is the system provided transaction codes which are
linked with the predefined standard applications.
• The standard transaction codes could be the combination of only alphabets and the
alpha numericals.
Example: SQVI, SE11, SM30,……..etc.
SQ* SAP Query
SE* System Engineering
SM* System Machine
Note: The ABAP technical consultants mostly work with the transaction codes starts with SE*
and rarely work with SM*.
Note: In most of the projects the custom object names start with ‘Z*’.
• The custom transaction codes could also be combination of only alphabets and alpha
numerals.
17
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
• There should not be any space or special characters in the custom object names but
can be separated with underscores (_).
Example: ZCUST _CUST ZCUSTCODE
ZCUST$CODE ZCUST_CODE
(Not preferable) (Preferable)
• The underscores (_) must not be a second character in the custom object names.
Example: Z_CUSTCODE ZCU_STCODE
(Preferable) (Preferable)
• The below shortcuts are used to work with the transaction codes in the system:
1) /o + transaction code + enter to execute the transaction code in another new system.
Example: /ose11 (enter)
18
BY MR. BABU (OASIS TECHNOLOGIES)
ABAP work bench:
• The ABAP work bench is a set of tools which can be used to develop the applications,
change the existing applications and implement the customer specific business
requirements in the SAP environment.
• Data Dictionary (DDIC – SE11): To maintain central depository of the data and data
definitions. DDIC is independent to the data base.
• ABAP Editor (SE38): To maintain the different types of programs.
• Message Class (SE91): To maintain the global messages.
• Function Builder (SE37): To maintain global functions.
• Menu painter (SE41): To maintain customer specific menu items and push buttons.
• Screen painter (SE51): To maintain the screens.
• Form painter (SET1 or SMARTFORMS): To maintain the different types of forms.
• It is the central point of entry to work with any kind of work bench objects such as data
dictionary objects, programs, function groups……… etc.
• The transaction code or SE80 or SE84 is used to work with an object navigator.
• The object navigator look as below
19
BY MR. BABU (OASIS TECHNOLOGIES)
Chapter-2
Data Dictionary
Table of Contents: Chapter-2
Data Dictionary..................................................................................................................................... 21
Database Tables ............................................................................................................................ 22
Domain.......................................................................................................................................... 25
Data Types .................................................................................................................................... 25
Currency and Quantity Fields........................................................................................................ 32
Table Maintenance Generator...................................................................................................... 33
Primary and Foreign Key Relationship .......................................................................................... 38
Technical Properties of a Table..................................................................................................... 46
Structures...................................................................................................................................... 50
Predefined Types .......................................................................................................................... 51
Include and Append Structure ...................................................................................................... 52
Search Help ................................................................................................................................... 55
Views ............................................................................................................................................. 58
Lock Objects .................................................................................................................................. 62
20
BY MR. BABU (OASIS TECHNOLOGIES)
• The transaction code SE11 is used to work with the data dictionary.
• Following are the different types of data dictionary objects
1. Database Tables.
2. Domains.
3. Data types
a. Data element.
b. Structure.
c. Table type.
4. Search helps
a. Elementary search help.
b. Collective search help.
5. Views
a. Database view.
b. Maintenance view.
c. Help view.
d. Projection view.
6. Lock objects.
7. Type groups.
21
BY MR. BABU (OASIS TECHNOLOGIES)
1. Database tables (Data Dictionary tables)
Introduction
• They are the small data storage components in the data base.
• Tables are the collection of fields which contain the physical data.
• The tables are made up of rows by columns.
Transparent tables:
• The transparent tables have one-one relationship with the database tables, that
means, the table names, field names and the number of fields are similar in both
data dictionary and database.
22
BY MR. BABU (OASIS TECHNOLOGIES)
Note: In the real time we mostly work with the transparent tables.
Pooled tables:
• The pooled tables have many to one relationship with the database tables, that
means one table on the data dictionary is liked with another set of tables called
TABLE POOL in the data base.
• The pool tables follow the binary search while accessing data.
• Key field names are different in DDIC and table Pool
Cluster tables:
• The cluster tables also have many to one relationship with the database tables, that
means one table in the data dictionary is stored with another set of tables called
cluster pool.
• Key field names are same in DDIC and cluster Pool
23
BY MR. BABU (OASIS TECHNOLOGIES)
• There are two approaches to create the transparent database or data dictionary
tables.
1. Top down approach.
2. Bottom up approach.
• In this approach the required data elements and domains are created while creating
the tables.
2. Bottom up approach:
• In this approach the required domains and data elements are created first then they
can be used at the time of creation the tables or structures.
Note: In the real time the top down approach is advisable since the bottom up approach
take more time and difficult to remember to create a data element and domains.
24
BY MR. BABU (OASIS TECHNOLOGIES)
Domain
Introduction:
• It is also one of the data dictionary objects which can be used to maintain the
technical properties of field such are data types, length of the data……..etc.
• It can also be used to maintain the value tables to provide search help on the field.
Data Elements:
• The domains, data elements and tables or structures can be reused as below
Mandatory fields:
• The mandatory fields are the compulsory fields to be filled if the data.
25
BY MR. BABU (OASIS TECHNOLOGIES)
• The tick marks are appeared on the mandatory fields
• It is used to display all the system provided possible entities and select any one of
them.
• The function key ‘f4’ or a search help icon is pressed to display the search help
windows.
• The tables which have the field name will have MANDT (client no) are called client
dependent tables.
• The table which does not have the field MANDT is called client independent table.
Note: In the real time we mostly work with the client dependent tables.
Key fields:
• Key fields are used to maintain the unique data by avoiding the duplicate data.
• In SAP the key field check boxes are checked to make the fields as primary key fields.
Note: If there are more than one field the data will be checked row level.
• It is checked to take the default field values of the key fields for the first time.
26
BY MR. BABU (OASIS TECHNOLOGIES)
Example: integer :0
Character : space…………..etc.
Note: If a data element exist in the system, the corresponding details such are data
types, length etc. are displayed.
• Click on save icon.
• Click on local object button (F7).
• Enter the next field name ‘EMP_NO’.
27
BY MR. BABU (OASIS TECHNOLOGIES)
• Press the ‘Enter’ button.
Note: If the domain is already available in the system, the corresponding details such as
data type, data length………….. Etc.
Note:
Press F4 function key to see all the system provided data types in the search help.
The decimal places should be filled for the decimal data types such are currency,
quantity………..etc.
The field output length is used to restrict the data output length.
The check box sign is checked to return sign of the number.
The check box lower case is checked to make the character fields as a case
sensitive to accept both upper and lower case letters. Since the system takes the
character data as uppercase letters by default.
Example: Data type : (NUMC)
No of characters : (10)
Decimal places : ( )
…………………………………………
Note: If an object is activated directly, the corresponding object will be saved, checked
and activated.
Activate = Save + Activate
28
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
Check the check boxes key and initial value to make the fields of the table as key
field.
Follow the similar steps to create any number of required data elements and
domains.
(Refer ‘creation of data elements’ and ‘creation of domains’ )
29
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
The transaction codes SE16or SE16N can also be used.
The button number of entries is used to know the total number of recordings in
the table.
Note:
Check is to add input fields and uncheck is to hide input fields.
An icon find (ctrl + f) can be used to find the required fields.
(Find icon enter a field name or field label in the find string press enter)
An icon select all (F9) is used to select all the fields.
An icon deselect all (shift + F2) is used to deselect all the fields.
30
BY MR. BABU (OASIS TECHNOLOGIES)
• Press the ‘Enter’ button.
• Click on the required highlighted field name or field label (yellow background).
• Check the check box that appeared beside a fieldname.
• Click on yes button.
• Once the table is displayed either in ALV list format or ALV grid format.
• Click on an icon local file (ctrl + shift + F9).
• Select the required file format such as ‘spread sheet’ or ‘rich text’ or ‘html
format’……etc.
• Click on yes button.
• Select the required directory by pressing the function key ‘F4’ or search help icon.
• Enter the file name (download_excell.xls).
• Click on back icon.
Note: The system generated program name is appeared in the program field under SAP
data block.
31
BY MR. BABU (OASIS TECHNOLOGIES)
Currency or Quantity fields:
• In SAP the currency and quality fields are required currency key and quantity unit.
Hence, the reference table and the reference field must be specified for currency
and quantity fields.
• The data type for the currency field is ‘CURR’ and the data type for the currency key
is ‘CUKY’.
• The data type for the quantity is ‘QUAN’ and the data type for quantity key is ‘UNIT’.
Note:
The reference table could be any table which has the currency key and quantity
unit fields.
The same table can also be used as a reference table if it has the currency key or
quantity unit fields.
• The number of decimal places at domain level must be specified for currency and
quantity fields.
Example: <ZCUST_TAB>
• Once the currency and quantity fields are inserted in the table or structures.
• Click on the tab currency or quantity fields.
Note: The columns reference table and reference fields are enabled for the currency and
quantity fields only.
• Specify the reference tables and reference fields as like the above example.
• Click on activate icon.
• Press the ‘Enter’ button.
32
BY MR. BABU (OASIS TECHNOLOGIES)
Example: 50,784.50 RS/USD……….
100.50 pieces/kgs/grams……..
Note: In the real time the custom tables and the maintenance views are maintained using
the transaction code SM30 only.
• Once the custom table or maintenance view is in change mode or in display mode.
Note: The custom table is maintenance view must be activated before Table Maintenance
Generator is created.
Note: The function group must be specified. Since, the system generates the screen and
the corresponding source code for the table maintenance under the function group.
• Select the radio button one step maintenance.
33
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
In case of one step maintenance the system generates single over view screen to
maintain and display the data.
Example: In case of one step
EMP_NO EMP_NAME --------------
1 A B
2 C D
| | |
| | |
Over-view screen – 1 (display / change mode)
In case of two step maintenance the system generates two screens to create a
single entry at a time and display to create a data in another screen. Two step
maintenance is the default option.
Example: In case of two steps
EMP_NO : _______________
EMP_NAME : _______________
|
|
|
SINGLE SCREEN
Overview screen – 1
In the real time the option one step maintenance is preferable. Since, the multiple
entries can be maintained at a time.
34
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to maintain the custom table or maintenance view:
Note: Select an entry and click on delete (shift + F2) icon to delete the table / view entries.
• Click on save icon.
• Click on back icon.
Deletion of TMG:
• If any changes are made in custom table after TMG is created then the TMG must be
deleted and recreated again without getting any run time error.
35
BY MR. BABU (OASIS TECHNOLOGIES)
Table Adjustment:
• If the key fields are changed as non-key fields by unchecking key check boxes, the
system gives an error to convert the table.
Note:
The TMG is not copied while copying the table.
The data of an existing table is not copied while copying the table.
36
BY MR. BABU (OASIS TECHNOLOGIES)
Note: It is not possible to delete a DDIC objects if they are already used in another
dependent objects.
• Click on yes button.
Steps to create the custom transaction code to maintain tables or maintenance views:
Note: If a checkbox step initial screen is check, an initial screen of SM30 can be skipped.
• Scroll down and check all GUI supported checkboxes.
• Maintain the default values as below.
Name of screen field Value
VIEW NAME <ZCUST_TABLE>
UPDATE X
• Click on save icon.
• Click on local object button.
• Execute the above created transaction code to maintain the table.
Indexes:
Primary Index:
• The primary indexes are generated automatically by the system using all the key
fields of a table.
Secondary Index:
37
BY MR. BABU (OASIS TECHNOLOGIES)
Note: Secondary indexes cannot be defined on pooled and cluster tables.
Note: In the real time the secondary indexes are not advisable since the data is filtered at
database level for all the users.
• The indexes are represented as below.
• In each RDBMS (Relational database management system) all the tables are linked
together through primary and foreign key relationship.
• It is used to execute the correct data from the multiple tables by joining them.
• In SAP the master tables (primary tables) are called check tables, the child tables are
called foreign key tables.
Note: The domain name of a check table field should be similar to a domain name of the
foreign key field in the child table to create foreign key relationship, but the field name is
different.
38
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
Here domain name of EMP_NO and EMPNO should be similar.
It is not possible to join pooled and cluster tables, since they are already set of
tables.
A search help is displayed to see the possible entries of a check table field on the
foreign key field when the foreign key table or child table are executed.
39
BY MR. BABU (OASIS TECHNOLOGIES)
• Maintain the foreign key fields and select the radio button key field or candidates as
below.
<ZCUST_TABLE> EMP_NO
|
|
|
Key fields / candidates
Different ways to check table relationships (or) link between the tables:
There are two ways to check the relationship between the tables:
40
BY MR. BABU (OASIS TECHNOLOGIES)
• Enter the required table name (<ZCUST_TABLE2>) or standard table name.
• Press the ‘Enter’ button.
Note:
Follow the similar steps to insert any number of transparent tables.
The button delete table is used to remove the tables from the join.
Note: If the system given an error message as ‘entry xxxx does not exists in the check
table’, the relationship is working fine.
Value table:
• The value is maintained at domain level to provide the possible maintained entries
as a search help.
• It does not force the user to select any one of to maintain entries in the value table
at the time of maintaining the custom table.
Intervals:
Lower Limit Upper Limit Short Text
A S
T X
41
BY MR. BABU (OASIS TECHNOLOGIES)
Standard Tables:
42
BY MR. BABU (OASIS TECHNOLOGIES)
Example:
• Most of the FICO tables start with BS*, PR* and CS*
Note:
• In fico some of the tables are cluster tables which start with BSE*
Example: BSEG – Accounting Document Segment.
BSEC – Accounting Data Document Segment.
BSET – Tax Data Document.
…….
43
BY MR. BABU (OASIS TECHNOLOGIES)
Vendor Tables:
Customer tables:
44
BY MR. BABU (OASIS TECHNOLOGIES)
Example: DD02L – SAP Tables.
DD02T – SAP Table texts (to find the table names using short
description).
DD01L – Domain.
DD01T – Domain texts.
DD04L – Data elements.
DD04T – Data elements text
|
|
b) Transaction codes table:
o The standard table ‘TSTC “contains all the transaction codes in the system.
45
BY MR. BABU (OASIS TECHNOLOGIES)
Differences between Transparent, Pooled and Cluster tables:
4. The table name, field 4. Table names and field 4. Table names and field
name, of fields is names are different names are different
similar in both DDIC in database. in database.
and database.
5. Both open and native 5. Open SQL statements 5. Open SQL statements
SQL can be used. can only be used. can only be used.
• In case of linear search the search criteria is started for the first record and stopped
once the required record is found.
Example: 1, 2, 3,……75,……100.
Linear search
46
BY MR. BABU (OASIS TECHNOLOGIES)
• In case of binary search total number of records are split in to two equal parts (n/2)
then the search criteria is started in the second half.
Note: In case of the required record id not found in the second half, a system will search in
the first half.
Example: 1, 2, 3……, 50,………., 100
(n/2)
Binary search
Note: in case of delivery class ‘A’ the table or maintenance view can be maintained in any
system (Development Quality Production) using SM30.
Note:
In the real time n option display or maintenance allow is mostly used.
In case of the option display or maintenance allowed with restrictions and display
or maintenance not allowed the custom table or maintenance views cannot be
maintained.
47
BY MR. BABU (OASIS TECHNOLOGIES)
o Transaction data.
o Organization and customer data.
Master data:
Transaction data:
Note:
There are two more data classes USR and USR1 which are reserved for user specific
developments.
In the real time the data class APP0 (master data) or APPL1(transaction data) is
mostly used.
• This property is used to reserve the initial space required for the table data in the
database.
• The size categories from 0 to 7 are available from the version ecc6.
• In the real time the size category ‘0’ is mostly used (0 to 7100).
Note: If the user tries to enter a record over that the selected range, the system will
increase the size category in to a next category (0 to 1).
e.) Buffering:
• It is used to reduce the traffic in the database in case of the table is accessed by
multiple users for number of times.
• There are three buffering modes
o Buffering not allowed – The table cannot be buffered.
o Buffering allowed but switched off – Buffering allowed but not activated.
48
BY MR. BABU (OASIS TECHNOLOGIES)
o Buffering switched on – The table can be buffered. In case of this option any
one of the buffering types should be selected.
• Buffering types are of three types:
o Single record buffering.
o Generic area buffering.
o Fully buffered.
• In case of this buffering type a record by record is buffered from the database tables.
• It is used to buffer the table data based on the specified key fields.
• In case of this buffering type the number of key fields must be specified.
Example: Number of key fields: 2
49
BY MR. BABU (OASIS TECHNOLOGIES)
Fully buffer:
Note: In the real time an option “can be enhanced (DEEP)” is mostly selected.
• This property is used to maintain the multiple entries and validate the table data.
Structures:
Introduction:
• It is almost similar to a table but only the difference is the structures do not have any
physical data. Whereas, tables have physical data.
• The structure is filled with a single record at runtime only.
• The structure can be referred across the system.
50
BY MR. BABU (OASIS TECHNOLOGIES)
• Execute the transaction code SE11.
• Select a radio button data type.
• Enter the structure name (<zcust_dd_structure>).
• Click on the create button.
• Select a radio button structure.
• Click on yes button.
• Enter short description
• Enter the required field name.
Example: EMP_CITY
Creation of domain:
51
BY MR. BABU (OASIS TECHNOLOGIES)
• Enter the required number of characters.
• Click on save icon.
• Click on the button local object button.
• Click on checkbox lowercase to accept both lowercase and uppercase letters.
• Click on activate icon.
• Press the ‘Enter’ button.
• Click on an icon back (F3).
• Click on activate icon to activate data element.
• Press the ‘Enter’ button.
• Click on back icon.
Note: Follow the similar steps (creation of data element and creation of domain) to
create any number of required data elements and domains.
• Click on the menu icon ‘extra’.
• Click on enhancement category.
• Click on yes button.
• Click on enhancement category (can be enhanced deep).
• Click on yes button.
• Click on active icon to activate structure.
• Click on back icon.
Pre-defined types:
• They are used to created table or structure without using data element or domains.
Steps to make use of the predefined types while creating the table or structure:
Note: The data element or component column is disabled in case of predefined types.
Note: Follow the similar steps to make use of pre-defined types for any number of fields.
Example:
Component Component type Data Length Short description
type
52
BY MR. BABU (OASIS TECHNOLOGIES)
EMP_CITY <ZCUST_EMP_CITY> CHAR 30 Employee city
Differences between the tables created using data elements and using predefined types:
3. Field labels are displayed while 3. ‘+’ symbols are appeared while
maintaining the table. maintaining the table instead of field
labels.
• The table or structure can be enhanced to add additional fields using include
structure or append structure.
Include structure:
Note: The structure can also be created by double clicking on the specified structure
name.
Append structure:
53
BY MR. BABU (OASIS TECHNOLOGIES)
• The append structures are specific to a table or structure. Hence, they cannot be
used for the multiple tables or structures.
• An append structures can be inserted in display mode also.
Note: Fields for include and append structure are in blue color.
Example: The custom table looks as below on the structure is appended or included.
54
BY MR. BABU (OASIS TECHNOLOGIES)
• Cancel the append structure window.
INCLUDE APPEND
4.Search Helps
Introduction:
• These are used to display all the possible entries in the search help window.
• The function key (F4) or search help icon () is pressed to display the search help
window.
• The DDIC search helps are of two types.
o Elementary search help.
o Collective search help.
55
BY MR. BABU (OASIS TECHNOLOGIES)
Elementary search help:
• An elementary search help is defined using one base table or help view
Example:
Search help IMP EXP LPOS SPOS
parameter
NAME1 * * 2 2
NOTE:
The checkboxes IMP and EXP must be check to import all the possible entries from
the specified table or help view and export the selected entry to the screen fields.
The position numbers LPOS and SPOS must be filled with the same number to
position the search help window on a screen field.
The search help exit is used to control the possible entries of a search help.
56
BY MR. BABU (OASIS TECHNOLOGIES)
• Execute the transaction code SE11.
• Select the radio button search help.
• Enter the collective search help name.
• Click on create button.
• Select a radio button collective search help.
• Click on yes button.
• Enter short description.
• Enter the search help parameter names, check the check boxes imp, exp and enter
the data element names as below.
KUNNR * * KUNNR
• Click on the tab included search helps.
• Enter the required elementary search helps.
• Place the cursor on the 1st search help name.
• Click on the button parameters assignment.
• Click on yes button.
• Click on copy button.
Note: Follow the similar steps to assign the parameters for any number of search helps.
• Click on activate icon.
• Click on local object button.
• Click on yes button.
• Click on test icon.
• Press F4 function key.
• Click on an appropriate tabs to see the possible entries.
• Cancel the search help window.
• Click on back.
• In case of this option the system gives restrictions window to filter the possible
entries in the search help.
57
BY MR. BABU (OASIS TECHNOLOGIES)
Note: An icon ‘Multiple Selection’ is used to choose the different single values and range.
4. Hot key:
• The hot key property is used to display the elementary search help entries. By
default in case of collective search help.
• The domain name of the table or structure field should be similar to the domain
name of search help parameter to assign a search help.
5.VIEWS
Introduction:
58
BY MR. BABU (OASIS TECHNOLOGIES)
1. Database view:
2. Maintenance view:
• The maintenance view is defined to maintain multiple table’s data using the
transaction code SM30.
3. Help view:
59
BY MR. BABU (OASIS TECHNOLOGIES)
• It is used as a selection method in an elementary search help to provide the possible
entries from the multiple tables.
4. Projection view:
Note: The transaction code SQVI can also be used to know the join conditions.
Example:
60
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
Follow the similar steps for any number of base tables.
The field names should not be duplicate in the tables or structures or views.
Note:
Follow the similar steps to create the help view by selecting a radio button help
view.
Help views cannot be executed.
Note: Follow the similar steps to select the fields for any number of tables by clicking on
‘Table Fields’ button.
• Click on maintenance status tab.
• Change the delivery class if required.
• Click on activate icon.
61
BY MR. BABU (OASIS TECHNOLOGIES)
• Click on local object button.
• Click on yes button.
• Click on utilities menu icon.
• Click on TMG.
• Enter authorization group (&NC&).
• Enter functional group name (could be same as table name).
• Select one step maintenance type.
• Enter overview screen number (could be any number).
• Click on create icon.
• Click on local object button.
• Press the ‘Enter’ button.
• Click on back icon.
Note: Transaction code SM30 is used to maintain the data in the maintenance views as
like the custom table.
6.LOCK OBJECTS
Introduction:
62
BY MR. BABU (OASIS TECHNOLOGIES)
• They are used to control the parallel access for the same data by the multiple users.
i.e., the synchronous access to the same data is provided using lock objects.
• The lock object name should start with ‘E’ followed by the table name.
Example:
E<ZCUST_DBNAME> EVBAP
Custom table standard table
• Following are different types of lock modes:-
1. Write lock.
2. Read lock.
3. Exclusive not cumulative.
1. Write lock:
• It is also called an exclusive lock. In case of this lock mode the locked data can be
accessed or processed by single user only. All other lock requests are rejected.
2. Read lock:
Note: All other write locks are rejected but read locks are accepted.
• It can be requested only once by the given transaction codes. All other lock requests
are rejected.
63
BY MR. BABU (OASIS TECHNOLOGIES)
Note: The system generated two function modules one starts with ENQUEUE* and
another one with DEQUEUE* once the lock object is activated.
• The transaction code SM12 is used to list out the locked objects and to delete locked
objects.
64
BY MR. BABU (OASIS TECHNOLOGIES)
Modularization Techniques
They are used to organize ABAP code, make the program more understandable and make use of
code re-usable to avoid the duplicate code.
1. Include program
2. Sub routines
3. Macros
4. Function modules
5. Message class.
6. Constants and text symbols
diagram:
Note: In the real time each main program should have two include programs one with *TOP and
*FORMS.
• In some of the projects there may be separate include *SEL for selection screen.
* TOP Include: It is used for global data declarations such are global types, work areas, internal
tables, variables..etc. It can also be used to specify the selection fields (input fields).
INCLUDE <ZREP_NAME_TOP>
“”
DATA : <GS_DBTAB>…..
<GT_DBTAB>……
INCLUDE<ZREP_NAME_SEL>
SELECT OPTIONS….
PARAMETERS…
INCLUDE<ZREP_NAME_FORMS>
FORM <F_SUB_NAME>………..
* Process Block
……………………….
ENDFORM.
INCLUDE<ZREP_NAME_TOP>.
Note: once the main program is in change mode use ABAP statement
‘INCLUDE’ to call the above created include program where ever it is required.
BY MR. BABU (OASIS TECHNOLOGIES)
2. Sub Routines
→ The sub-routines are used to define the reusable functions in the programs.
→ The ABAP statement ‘PERFORM’ is used to call the sub-routines.
→ The ABAP statements ‘FORM….ENDFORM’ are used to define sub-routines.
→ Sub-routines are of two types:
1. Internal sub-routines.
2. External sub-routines.
The internal sub-routines are defined and called in the same program.
Syntax to call:
CHANGING <CHG_PARAM>..]
syntax to define:
CHANGING <P_CHA_PARAM>..]
*Process Block
ENDFORM.
BY MR. BABU (OASIS TECHNOLOGIES)
2. External sub-routines:
The external sub-routines are defined in one program and called in another program.
REPORT<zcalling> REPORT<zcalled>
“ “
“ “
Note: The function key F6 is used to skip or return the subroutine definitions in the debugger.
Actual parameters:
Actual parameters are the parameters which can be called while calling the sub routines (with
PERFORM statement).
Formal parameters: Formal parameters are parameters which can be passed while defining
sub-routines (with FORM statement).
Note:
• The number of actual parameters should be similar to the number of formal parameters.
• The sub-routines definitions should not be nested (form within the form) but, the sub-
routine can be called within the sub-routine.
Ex: FORM<f_sub1>..
ENDFORM.
FORM <F_SUB1>
*call sub-routine
PERFORM <F_SUB1>..
“ Right
ENDFORM.
FORM <F_SUB2>
ENDFORM.
ENDFORM….FORM)
FORM<F_SUB2>
ENDFORM.
Note: The internal tables can also be passed to sub-routines using below syntax.
syntax:
PERFORM<F_SUB>TABLES<INT_TAB_NAME>……
LIKE <dbstr/dbtab/..>
*Process Block
ENDFORM.
Demo program on all the methods and internal and external sub-routines
‘ZINCL_SUB_ROUTINES’.
BY MR. BABU (OASIS TECHNOLOGIES)
3. Macros
They are the place holders which can be replaced with the corresponding parameter
Values at runtime.
→ The macros are used for the complex write statements and for long calculations.
→ Up to 9 place holders can only be used with a macro.
→ The ABAP statement “DEFINE……END-OF-DEFINITION” is used to define a macro.
DEFINE <macro_name>
END-OF-DEFINTION.
<macro _name><pass_param1><pass_param2>.
Note:
Ex: the place holders are replaced with the corresponding passing parameters as below.
4. Function modules
Diagram:
EXPORTING
IMPORTING
CHANGING
TABLES
BY MR. BABU (OASIS TECHNOLOGIES)
Int_Tab = “Import and Export Internal Tables”
EXCEPTION
FUNCTION <FUNCTION/ZFUNCTION>.
*Process Block
ENDFUNCTION.
a. Attributes:
It contains technical properties of a function module such are type of function
module, function group.
b. Import parameters:
The import parameters are imported from the calling programs.
→ The import parameters are mandatory fields unless the optional check boxes are
checked.
→ They cannot be changed in the function modules.
c. Export parameters:
The export parameters are used to export the data from the function modules to the
calling programs.
→ The export parameters always optional parameters.
d. Changing parameters:
The changing parameters are imported from the calling programs, changed them in
the function modules and returned to calling programs.
BY MR. BABU (OASIS TECHNOLOGIES)
e. Tables parameters:
They are used to import and export the internal tables.
f. Exception:
They are used to raise the messages in the function modules.
→ The system generates the messages automatically when CALL FUNCTION is failed.
g. Source code:
It is used to write central ABAP source code.
Note: the parameters of function module are import, export, changing tables, exceptions.
Note: The customer specific include programs can also be defined such as “*FORMS’ include for
Defining sub-routines.
Note: The import parameters are optional parameters in case of the default values.
→ Click on the tab export and define the below export parameters.
Export
Parameter name Type Associate type Pass value
Ex_add Type I
Ex_sub Type I “
Ex_mul Type I “
Ex_div Type I “
Ex_rem Type I “
Note: The long text of an exception can also be maintained by clicking on button under long
Text column.
→ Click on ‘save’ icon.
→ Click on ‘source code’ tab
→ Implement the required business logic within the system generated statements within
function and end function after the system generated comments.
BY MR. BABU (OASIS TECHNOLOGIES)
Ex :
FUNCTION <ZMATH_OPS>
“
IF IM_INPUT1 EQ SPACE AND IM_INPUT2 EQ SPACE.
*Raise Exception
RAISE NOT FOUND
*Mathematical Calculations
EX_ADD = IM_INPUT1 + IM_INPUT2,
EX_SUB = IM_INPUT1 - IM_INPUT2,
EX_MUL = IM_INPUT1 * IM_INPUT2,
EX_DIV = IM_INPUT1 / IM_INPUT2,
EX_REM = IM_INPUT1 MOD IM_INPUT2.
ENDIF.
ENDFUNCTION.
Note: The denominators value must be checked when the division calculation is done otherwise
The program may got to short dump or runtime error in case of null value.
Ex: IF <GV_STR> NE 0 OR NE SPACE.
GV_RESULT = <GV_NUM/GV_DENOM>.
ENDIF.
Raise statement:
This statement is used to raise the exception in function module.
Syntax:
RAISE <NOT-FOUND>.
Here <not-found> is the maintained exception.
BY MR. BABU (OASIS TECHNOLOGIES)
Different types of data declarations:
There are two types of data declarations.
1. Global data declarations.
2. Local data declarations.
1. Global data declarations:
All the global data variables, work areas, internal tables etc. are declared after the
REPORT statement or in the “*TOP” Include programs.
→ The global data variables can be accessed anywhere in the program or function Modules
Note: In most of the projects the global data declarations should start with ‘G*’.
………………………………….
…………………………
BY MR. BABU (OASIS TECHNOLOGIES)
Note: Use the local data variables as much as possible in the real time, since the allocated
INCLUDE <zrep_name_top>.
DATA: gv_variable……
gt_dbtab……….
DATA: lv_variable…………
ENDFORM.
BY MR. BABU (OASIS TECHNOLOGIES)
5. Message class
Messages: They are used to give messages for instructing the users.
• The users and analyze messages and re-enter the input values.
Following are different types of messages.
Message type Description
*E-Error Gives Message with ‘X’ mark on the status bar and stops the next part
of program (Message + STOP).
*S-Success Continuous with the next part of program by giving message with tick
‘√’ mark on status bar.
W-Warning Gives message with an explanatory mark ‘!’ on the status bar and
continues with the next part of program once enter button is pressed.
Note: Warning messages can be ignored by pressing enter button.
*I-Information Gives message on information pop up with a symbol ‘I’ and continues
with the next part of program or source code once ‘YES’ button is
pressed.
A-Abort Gives message on cancel pop-up window with stop icon and exits out of
the program to an initial screen of sap once exit button is pressed.
X-eXit This message terminates the program by giving short dump or runtime
error
→ The ABAP statement “MESSAGE” is used to give the messages or raise the message.
Syntax to give message without using message class.
MESSAGE ‘<Message text>’ ‘TYPE’ ’E/I/S/W..’.
BY MR. BABU (OASIS TECHNOLOGIES)
Message class: It is used maintain the messages centrally.
→ The message classes can be used anywhere in the system.
→ The T-code ‘SE91’ is used to maintain message classes.
Note: up to 1000 (0-999) messages can only be maintained in each message class.
Note: The button long text is used to maintain long message text.
Ex:
Message no: Message text
001 Please provide a valid input.
002 &1, &2, &3.
Message no.
→ 2nd way-by specifying message-id:
syntax: MESSAGE E/I/S<xxx>(ZXX_MSG_CLASS).
→ The difference between constants and text symbols is the text symbols can be translated
in different languages, but CONSTANTS cannot be translated.
Note: In the real time the hard coded text are not preferable.
Syntax for constants:
CONSTANTS: <GC_TEST> TYPE<I/C/…..> VALUE ‘<VALUE>’.
Syntax for text symbols:
TEXT-<XXX>.
Here <XXX> is the text symbol name.
Selection texts: The selection texts are used to maintain the descriptions or labels for the
Input fields of the selection screen.
→ Click on activate.
→ Press enter.
BY MR. BABU (OASIS TECHNOLOGIES)
→ Click on back.
→ Activate the program.
Events
The ABAP is an event driven programming language with events are triggered in the particular
order by driver program.
An event start with the event name and ends with the next event beginning.
INITIALIZATION
*Process block
AT SELECTION - SCREEN…….
*Process block
*Process block
NOTE: The Default event for each executable program is START -OF- SELECTION.
Classical Reports
Classical reports are the simple repots to extract the data from the data
and display the process the database table or data base view, process the extracted
data and display the processed final data using the WRITE statements within the loop
statements.
Following are the different types of events of classical reports which are triggered in the
same order.
1. LOAD-OF-PROGRAM
2. INITIALIZATION
B) AT-SELECTION-SCREEN ON VALUE
D) AT SELECTION SCREEEN ON
E) AT-SELECTION-SCREEN
4. START-OF-SELECTION
5. END-OF-SELECTION
6. TOP-OF-PAGE
7. END-OF-PAGE
1. LOAD-OF-PROGRAM:
LOAD-OF-PROGRAM
2. INITIALIZATION:
This event is triggered before the selection screen or input screen is displayed.
2, it can also be used to pass the default values to the selection fields or input fields and data
variables.
INITIALIZATION
*Default values
ENDFORM
3. AT-SELECTION-SCREEN Event:
They are triggered while performing any action in the selection screen.
They can also be triggered after input value or data is provided in the selection screen.
The AT -SELECTION- SCREEN events are used to format the selection-screen dynamically
and validate or check the input data.
a) AT SELECTION-SCREEN OUTPUT
b) AT SELECTION-SCREEN ON HELP-REQUEST FOR
c) AT SELECTION-SCREEN ON VALUE HELP-REQUEST FOR
d) AT SELECTION-SCREEN ON
It can also be triggered while performing any action in the selection screen.
SYNTAX:
AT SELECTION-SCREEN OUTPUT
MODIFY SCREEN.
ENDIF
ENDLOOP
ENDFORM
This structure is field with all the attributes or the properties of all selection field or the input
field in the selection screen.
It behaves like an internal table since it holds each selection field properties at run-time.
FIELD DESCRIPTION
1->Mandatory
0-> Optional
1->output
1->appear
2-> hide.
NOTE:
SYNTAX: :
AT-SELECTION-SCREEN-ONVALUE-REQUEST FOR<S_FIELD-LOW/S_FIELD-HIGH/P_FIELD>.
PERFORM <F_SEARCH_HELP>.
FORM <F_SEARCH_HELP>.
EXPORTING
: RETURN
SELECT <F1>,
<F2>,
EXPORTING
: ret_field = <s_field-low/…………..>.
: value_org = ‘s’.
TABLES
ENDFORM.
This event is triggered when the function key F1 (or) help icon is pressed. It is used to provide
The transaction code ‘SE61’ (or) ‘SO72’ is used to maintain the help documentation as per
The specification.
SYNTAX: :
PERFORM <F_HELP_DOCU>…..
FORM <F_HELP_DOC>.
(OR)
ENDFORM.
AT-SELECTION-SCREEN-ON:
This event is triggered after the input values provided in the selection screen .
SYNTAX: :
AT-SELECTION-SCREEN ON <S_FIELD/P_FIELD>.
PERFORM <F_VALIDATE_FIELD>;
FORM <F_VALIDATE_FIELD>.
SELECT……………
Into ………………..
(or)
<f2> = p_field.
IF SY-SUBRC NE 0.
*Give message*
ENDIF.
START-OF-SELECTION:
It is the default event and mandatory event to execute any executable program (or) report.
This event is triggered after all the selection screen events are processed.
SYNTAX : :
START-OF-SELECTION.
PERFORM <F_GET_DATA>.
FORM<F_GET_DATA>.
SELECT <f1>
<f2>
From <dbtab>
<condition2>……..
NOTE: If no one event is used in the executable program, the entire program will be triggered
END-OF-SELECTION:
SYNTAX: :
END-OF-SELECTION.
PERFORM<F_PROCESS_DATA>.
FORM<F_PROCESS_DATA>.
*read table*
IF SY-SUBRC = 0.
ENDLOOP.
TOP-OF-PAGE:
This event is triggered with the first ULINE (or) WRITE statement in the program.
SYNTAX: :
ULINE/WRITE………..
TOP-OF-PAGE.
PERFORM<F_POP_HEADER>.
FORM<F_POP_HEADER>.
ENDFORM.
END-OF-PAGE:
This event is triggered after the current page is ended before the new page is
displayed.
The report addition LINE COUNT must be specified to trigger this event.
NOTE:
This event can also be triggered with an ABAP statement ‘NEW PAGE’.
The output list should have more than 67 records (or) lines to trigger this event.
SYNTAX: :
* triggers after the current page is ended before the new page is displayed*
END-OF-PAGE.
PERFORM<F_FOOTER_DATA>.
FORM<F_FOOTER_DATA>.
WRITE’<footer data>’.
INCLUDE<ZREP-NAME>-TOP.
INCLUDE<ZREP-NAME>-SEL.
INCLUDE<ZREP-NAME>-FORMS.
INITIALIZATION.
PERFORM<F_CLASS_REFRESH>.
AT SELECTION-SCREEN OUTPUT.
PERFORM<F_FORMAL_SCREEN>.
AT SELECTION-SCREEN ON <S_FIELD/P_FIELD>.
PERFORM<F_VALIDATE_INPUT>.
START-OF-SELECTION.
END-OF-SELECTION.
PERFORM<F_PROCESS_DATA>.
NOTE:
1. Up to END-OF-SELECTION events are common for any type of report (or) migration.
2. Display data in the first basic list and TOP-OF-PAGE and END-OF-PAGE events are
TOP-OF-PAGE.
PERFORM<F_DISPLAY_DATA>.
END-OF-PAGE.
PERFORM<F_DISPLAY_FOOTER>.
INNER JOINS:
It is used to extract the data from the multiple tables by joining them.
NOTE:
<a~f2>
<b~g1>
<b~g>
<b~g1> in <s-g2>
Here ‘<a>’ is an alias name for the first database table <dbtab1>.
NOTE: The database name can also be used instead of alias name.
<dbtab1~f2>
<dbtab2~g1>
<dbtab2~g2>
This statement is used to extract the data from the database table based on the entries of the
base internal table. It is advisable instead of joining more than two tables.
2. The SELECT statement extracts all the data without considering ‘FOR ALL ENTRIES’.
SYNTAX: :
SELECT <h1>
<h2>
From <dbtab3>
<f2> IN <s-f2>………..
ENDIF.
NOTE: The ‘FOR ALL ENTRIES’ statements can also be used by inner join.
SYNTAX:
SELECT <a~f1>
<a~f2>
<b~g1>
<b~g1> IN <s_g2>
ENDIF.
NOTE:
Use ‘READ TABLE’ statement within the base internal table loop.
SYNTAX:
(OR)
IF SY-SUBRC = 0.
ENDLOOP.
*Display data - - - - -- *
WRITE: / <gs_final-f1>,
CLEAR : <gs_final>.
ENDLOOP.
DESCRIBE TABLE:
SYNTAX:
NOTE:
The statement field sy-dbcnt holds the total no of extracted records from the
database tables (or) database views.
INTERACTIVE REPORTS
They are used to provide the detailed drill down list based on the current output list.
Up to 20 Secondary (or) drill down lists can only be provided including basic list, the total
no. of lists are 21.
Note:-
The program goes to runtime error (or) short dump in case of more than 20 Secondary
lists are provided.
The system field SY-LSIND holds the index of next drill down list.
1. AT LINE-SELECTION.
2. TOP-OF-PAGE-DURING LINE-SELECTION.
3. AT USER-COMMAND.
4. AT PF.
AT LINE-SELECTION :-
This event is triggered when the record (or) list line is selected (click (or) double click)
in the current list.
The system field SY-LSIND holds the index of the next drill down list of the current list.
SYNTAX: - :
WRITE: _ _ _ _ _ _ _ _ .
CASE SY-LSIND.
WHEN '1'.
WRITE: _ _ _ _ _ _ _ _ _ _ .
ENDLOOP.
HIDE STATEMENT :-
The statement is used to hide the selected field / row value which can be passed to the
corresponding drill down list to filter the unwanted records.
SYNTAX :- :
:
BY MR. BABU (OASIS TECHNOLOGIES)
BY MR. BABU (OASIS TECHNOLOGIES)
AT LINE-SELECTION.
CASE SY-LSIND.
WHEN '1'.
PERFORM <f_display_first>.
FORM <f_display_first>.
ENDLOOP.
This event is triggered with First "WRITE" (or) "Value" statement of the detailed
lists (or) drill down list.
It is used to provide the column headings for the drill down list (or) secondary
list.
SYNTAX :-
WRITE / ULINE.
* Triggers when the record (or) field is selected in the current list.
AT LINE-SELECTION.
CASE SY-LSIND.
WHEN '1'.
WHEN '1'.
ENDFORM.
AT PF :-
This event is triggered when the menu item (function key) is pressed.
This event is used to provide the additional functionality based of the selected menu
item.
The system field SY-PFKEY holds the selected function key of the menu.
SYNTAX :-
AT PF.
CASE SY-PFKEY
* Additional functionality
WHEN '<CRT>'.
WHEN '<DEL>'.
ENDCASE.
SET PF-STATEMENT :-
SYNTAX :-
Here <zmenu_status> is the custom menu status name '(Should be mentioned in uppet case)'.
- - - - EXCLUDING addition :-
NOTE :-
AT USER COMMAND :-
This event is used to provide the additional functionality based on the selected push
button.
The system field SY-UCOMM holds the function code of (FCT code) the selected push
button.
SYNTAX :-
AT USER COMMAND.
CASE SY-UCOMM.
WHEN '<DELT>'.
* Delete functionality
ENDCASE.
NOTE :-
The additional functionality can be provide using only the system fields SY-PFKEY or SY-
UCOMM without using Events 'AT PF and AT USER COMMAND.
Contents ......................................................................................................................................................
REPORTS-ABAP Queries .......................................................................................................................
Programming in ABAP Editor .........................................................................................................................
Different types of ABAP Programs ..............................................................................................................
REPORT Statement ......................................................................................................................................
Some useful additions to REPORT Statement .............................................................................................
Comments ...................................................................................................................................................
WRITE Statement ........................................................................................................................................
Some useful additions to WRITE Statement ..............................................................................................
Data Types...................................................................................................................................................
Pretty Printer...............................................................................................................................................
Elementary Data Types ...............................................................................................................................
Mathematical Operations ...........................................................................................................................
DATA Statement..........................................................................................................................................
TYPE and LIKE Statements...........................................................................................................................
MOVE Statement ........................................................................................................................................
CLEAR Statement ........................................................................................................................................
ULINE Statement .........................................................................................................................................
ABAPDOCU Transaction Code .....................................................................................................................
PARAMETERS Statement.............................................................................................................................
Some useful additions to PARAMETERS Statement ...................................................................................
Mathematical Functions .............................................................................................................................
String Operators ..........................................................................................................................................
Condition or Control Statements ................................................................................................................
Numeric Comparison Operators .................................................................................................................
String Comparison Operators .....................................................................................................................
Loop Statements .........................................................................................................................................
1
BY MR. BABU (OASIS TECHNOLOGIES)
Work Areas, Field Strings, TYPES ................................................................................................................
Internal Tables ............................................................................................................................................
Operations on Internal Tables ....................................................................................................................
SELECT-OPTIONS Statement .......................................................................................................................
RANGES Statement .....................................................................................................................................
SELECTION-SCREEN Statement ..................................................................................................................
Difference between Normal Search and Pointer Search ...........................................................................
Reports
Introduction:
Reports are used to extract the data from the multiple database tables or database views, process
the extracted data and display the processed final data in the required format
Data Extraction
Data Process
Data Display
1. ABAP Queries
2. Classical Reports
3. Interactive Reports
4. ALV (ABAP List Viewer) Reports
5. LDB (Logical Data Back) Reports-HR ABAP
2
BY MR. BABU (OASIS TECHNOLOGIES)
1. ABAP Queries
Note: In real time the data source option ‘Table Join using Basis Table’ is mostly used
Note: The hierarchy of the User group, Info sets, and Queries is as below
3
BY MR. BABU (OASIS TECHNOLOGIES)
User
Group
Query-1 Query-2
*****************Refer Notes**********************
*****************Refer Notes**********************
ABAP Programming
1. Executable Programs:
• The Executable programs can be executed directly to display the output either in the
foreground or background.
• The program type “ID” for an executable program is “1”
2. INCLUDE Programs:
4
BY MR. BABU (OASIS TECHNOLOGIES)
3. Sub Routine Pool Programs:
5
BY MR. BABU (OASIS TECHNOLOGIES)
• Enter the short description as per the project standards
• Click on ‘Save’ icon
• Click on ‘Yes’ button
• Write the below program after the system generated statement ‘REPORT’
Program
REPORT ZB20_DEMO1
*Enter Line Comment
WRITE ‘Welcome’. “Partial Line Comment
WRITE 5 ‘To’.
WRITE ‘OASIS’.
*Or Combine multiple statements as a single unit using the operator ‘:’
*Preferable
WRITE: ‘Welcome’, 5 ‘To’, ‘OASIS’.
Note:
If an object is directly activated, it will be saved, checked then activated.
All the custom code should be written after the first system generated statement
‘REPORT’/’PROGRAM’ etc.
The custom code can be written in either upper or lower case since ABAP is not a case
sensitive language.
The best practice is to keep keywords in uppercase.
There must be a space before and after the keywords in statement line.
Each statement line must be ended with a period (.)
Note: Fill the required Input fields in the selection screen then execute
6
BY MR. BABU (OASIS TECHNOLOGIES)
REPORT Statement
2. …LINE-SIZE:
• This addition is used to specify the width of a list in the output.
4. ….MESSAGE ID:
• This addition is used to specify message classes
Comments:
• The comments are used to document each block of the program to make it more
understandable.
• The comments are of two types
1. Entire Line Comment
2. Partial Line Comment
1. Entire Line Comment: An asterisk mark ‘*’ at the left most side as a first character makes
the entire line as comment
7
BY MR. BABU (OASIS TECHNOLOGIES)
Shortcuts:
2. Partial Line Comment: It is used to comment any part of the statement line. The double
quote symbol makes rest of the line comment.
Note: The partial line comment can be used to comment entire line but the Entire comment
line cannot be used as partial line comment
WRITE Statement:
• This statement is used to display the data in the required format
• This statement can also be used to move the data from the source data variable to
destination without missing conversations.
Note: In Real time use the WRITE statement to move currency and quantity fields or Data
Variables.
1. WRITE/: The forward slash with WRITE statement is used to display data in a new line.
Syntax: WRITE/ ‘<Display in a new line>’.
WRITE/ ‘<next line>’.
Output: Display in a new line
next line
8
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
The position number and the no of characters to be displayed are specified with the
WRITE statement as below:
Syntax: WRITE/<n(m)> ‘<Display m number of characters from n>’.
Here <n> is the position number from which the data to be displayed.
<m> is the number of characters can be displayed.
Only Numbers can be displayed as below
Syntax: WRITE/(<m>) ‘<Display (m) number of characters>’
2. …COLOR:
• This addition is used to display the data with different background colors.
• This addition is used to display data under the previous displayed data.
9
BY MR. BABU (OASIS TECHNOLOGIES)
4. ….LEFT-JUSTIFIED/CENTERED/RIGHT-JUSTIFIED:
• These additions are used to justify (adjust) the data at left hand side, center and right
hand side.
5. ---CURRENCY:
• This addition is used to specify the currency keys for the currency data variables while
displaying.
6. …UNIT:
• This addition is used to specify the required units while displaying the quantity data.
7. DECIMALS:
• This addition is used to specify the required number of decimal places to be displayed in
the output
8. …EDIT MASK:
9. …NO-GAP:
• This addition is used to display the text data without any gaps.
10
BY MR. BABU (OASIS TECHNOLOGIES)
10. …NO-ZERO:
• This addition is used not to display only the zeros. (Null Values).
Syntax: …NO-ZERO.
11. …NO-SIGN:
• This addition is used to hide the sign of the data variables or fields.
Note: This addition is effected for the fields or data variables which are referred to the
domains with the “Sign” Checkbox.
Syntax: ….NO_SIGN.
• This addition is used to display the symbols such as hand symbol. Dollar, etc. in the
output.
Note: The standard include program <LIST> contains all the available icons, symbols, Lines
and Colors in the system.
Example: INCLUDE <LIST>.
14. …HOTSPOT:
• This addition is used to display the hand symbols on the output data when the cursor is
placed.
11
BY MR. BABU (OASIS TECHNOLOGIES)
DATE Format:
a. DD/MM/YY 02/01/14
b. MM/DD/YY 01/02/14
c. DD/MM/YYYY 02/01/2014
d. DDMMYY 020114
e. MM/DD/YYYY 01/02/2014
f. MMDDYY 010214
Syntax: WRITE <gv_data> <DD/MM/YY>.
Example:
*Not Advisable
WRITE ‘<Display First line>’
WRITE ‘<Display Second line>’
*OR Advisable
WRITE: ‘<Display First line>’ , ‘<Display Second line>’.
Elementary Data Types:
• They are used as the reference in the program.
• Following are different data types.
12
BY MR. BABU (OASIS TECHNOLOGIES)
Hexa Type (Not Advisable)
X Hexa Number 4 4 0X….
XSTRING String in Binary 1 Dynamic Space-“ “
Format
Note:
Default Date format is: YYYYMMDD
Default Time format is HHMMSS
Default data type is C-Char and Length is 1 (One)
Number data types can be used for different types of calculations.
Character or string types are used to hold character or string or Numeric data
Hexa data types (X and XSTIRNG) are not advisable from the version ECC 6.0. Since it is
the unique code system.
Mathematical Operations:
• Below mathematical operations are used for different calculations in the programs.
Note: In ABAP there must be a space before and after the symbol or key word
Example: P = a + b
P = ADD a TO b
13
BY MR. BABU (OASIS TECHNOLOGIES)
Pretty Printer:
• This function is used to align a program and convert the keywords or source code upper
or lower case.
Note: In most of the projects it would be preferable to convert the keywords into uppercase.
• The source code can be implemented by switching between old and new editors.
Note: The New editor is advisable than old editor from version ECC 6.0
Note: ABAP is a line by line compiler. Hence the syntax errors are also shown statement line
by statement line.
14
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to maintain the default settings for Pretty Printer
Note: In the real time the pretty printer function must be applied for any source code.
DATA Statement:
• This statement is used to declare the data variables such as variables, work areas,
internal tables, etc. in an application program.
15
BY MR. BABU (OASIS TECHNOLOGIES)
Syntax:
Note: The fields of a table or structure or dbview can be referred using the symbol ( - )
Hyphen.
Example: <dbtab/dbstr/dbview-fieldname>
• The ABAP statement “TYPE” is used to refer both elementary data types and DDIC
objects. It does not copy the properties of DDIC objects.
• The ABAP statement “LIKE” is used to refer only the data objects. It copies the
properties of a data object.
Note: In Real time use ‘TYPE’ statement as much as possible, since the system allocates more
Memory for ‘LIKE’.
….VALUE Addition:
• This addition is used to pass the default values into the data variables.
Syntax:
Note:
The default data type is “CHAR” and the length is “1”
The “CHAR” data variable length is fixed, where as the “STRING” variable length is
dynamic. (Any number of Characters)
16
BY MR. BABU (OASIS TECHNOLOGIES)
MOVE Statement:
• This statement is used to move the data from source to destination data variables.
Note: The Symbol “=” can also be used to move the data.
CLEAR Statement:
• This statement is used to clear (remove) the contents of the data variables and reset to
the initial default value.
Syntax:
CLEAR: <gv_var>,
<gv_string>,
<gv_dbtab>.
Note: In the real time it would be better to clear the data variables before they are used.
17
BY MR. BABU (OASIS TECHNOLOGIES)
• Create T.R by pressing ‘Create Request’ icon.
• Click on ‘Yes’ button.
ULINE Statement:
• This statement is used to display the horizontal lines in the output.
Syntax: ULINE
Note: The pipeline symbol ( I ) with the WRITE statement can be used to display the vertical
lines in the output.
Example: ULINE.
The button “TAB” is pressed to get the keyword written automatically while displayingit.
NOTE:- Use the short cut “ctrl+Space ‘ ’ to get all the relevant keywords then select appropriate
keyword.
Find and Replace Function:-This function is used to find for the required strings to be replaced
with the new strings.
18
BY MR. BABU (OASIS TECHNOLOGIES)
Check the check box that appears beside the program name.
Place a cursor on font location from which the string to be replaced.
Click on the button “from cursor everything without dialogue”.
Help Documentation:
• It is used to know more details about the particular keywords or fields, examples and
additions.
• It can also be used to know the technical information of the screen fields.
• The Help documentation window is displayed when the function key “F1” (or) an icon
[?] is pressed.
Note:
The corresponding keyword help documentation is displayed.
Go through the system given documentation, additions and make use of the examples
• This Transaction Code is used to analyze the system given example programs.
• It can also be used to get the keyword help documentation.
19
BY MR. BABU (OASIS TECHNOLOGIES)
Note: The corresponding help documentation is displayed to make use of additions and
Examples.
PARAMETERS Statement:
• This statement is used to define the single input fields, check boxes, radio buttons, list
boxes etc. in the selection screen (Input Screen).
20
BY MR. BABU (OASIS TECHNOLOGIES)
• The default system generated screen number for selection screen is 1000
Syntax: PAREMETERS: <P_NUM1> TYPE <I/C/data element/dbtab_field>.
1) ….OBLIGATORY:
Note: The system gives an error message as “Fill in all the required entry fields” if the
OBLIGATORY input field is empty.
2) …...DEFAULT:
• This addition is used to pass the default values to the selection fields or Input fields.
Syntax: PAREMETERS: ……….. DEFAULT <def_value>.
3) …...AS CHECKBOX:
• This addition is used to define the check boxes in the selection screen.
Syntax: PAREMETERS: <p_chk> AS CHECKBOX.
<p_chk1> TYPE C AS CHECKBOX.
Note:
The parameter LENGTH and TYPE should be a single character to define the
checkboxes.
The selected parameter of the check box contains the value ‘x’.
4)…..RADIOBUTTON GROUP:
• This addition is used to define the radio buttons in the selection screen
Syntax: PAREMETERS: <p_rad1> TYPE C RADIOBUTTON GROUP <grp>,
<p_rad2> RADIOBUTTON GROUP <grp>,
• Here <grp> is a Radio Button Group Name.
Note:
The parameter LENGTH and TYPE should be a single character to define the
checkboxes and Radio Buttons
21
BY MR. BABU (OASIS TECHNOLOGIES)
The selected parameter value of the check box and Radio Button is ‘X’.
An additional statement DEFAUL with value ‘X’ is used to make the check boxes or
radio buttons as Default.
Example: PARAMETES: <P_RAD1> RADIOBUTTON GROUP <GRP> DEFAULT ‘X’
5) …..VISIBLE LENGTH
• This addition is used to specify the required visible length of the Input fields or selection
Field.
Syntax: ....VISIBLE LENGTH <N>
• This addition is used to define a Drop down list boxes in the selection screen. This
addition must be used with VISIBLE LENGTH only.
Syntax: …VISIBLE LENGTH <N> AS LISTBOX.
7) …...MATCHCODE OBJECT:
• This addition is used to specify DDIC search help to the selection fields or Input fields
Syntax: ....MATCHCODE OBJECT <DDIC_SERARCH HELP>.
• This addition is used to make the Input fields as case sensitive to accept both upper and
lower case letters.
Note: Effect of their addition is similar to Lower case Check Box at Domain level.
9) …...MODIF ID:
22
BY MR. BABU (OASIS TECHNOLOGIES)
• This addition is used to assign all the screen elements to the modification Group to
modify the selection fields dynamically.
Syntax: PAREMETER: <p_param> TYPE <C/I/…./dataelement/dbtab-field/..> MODIF ID <mid>.
• Here <mid> is modification id
System Fields:
The system fields are used to access the system provided data such as system date, time, user
name etc. in an application program.
The standard structure “SYST” contains all the system provided fields.
The standard structure “SYST” is filled with a single record at run time.
There are around ‘171’ system fields .following are some of useful system fields.
FIELD DESCRIPTION
23
BY MR. BABU (OASIS TECHNOLOGIES)
the DB
24
BY MR. BABU (OASIS TECHNOLOGIES)
PFKEY Current GUI status
Variants: - The variants are used to save a input data for further execution in the selection
Screen.
They can also be used to avoid the data entry errors and schedule a program in the back
ground.
Note:-The standard table “VARI” contains all the created variants in the system.
25
BY MR. BABU (OASIS TECHNOLOGIES)
Note:-The system provided fields “SLSET” of the standard structure “SYST” holds the selected
Variant
Once the program (or) t-code (or) table (or) application is executed.
Fill the required fields.
Click on save icon.
Enter variant name meaning (could be any)
Click on save icon.
Note:-An icon “get variant” is appeared beside an execute icon in case of a program (or) T-code
has variants.
Execution Modes: - There are two types of execution modes to execute a program (or)
transaction code.
1) Fore ground.
2) Back ground.
Fore Ground Execution Mode: - It is used to execute the program (or) transaction codes
directly by pressing execute icon (or) F8 function key.
Back Ground Execution Mode:- This execution mode is used to execute the programs (or)
transaction codes periodically such as hourly ,daily, weekly, monthly etc. in back ground.
It does not require any user interaction to provide the input data.
The variants must be created before the programs are scheduled in back ground.
The T-code SM36 and SM37 are used to work with the back ground jobs.
26
BY MR. BABU (OASIS TECHNOLOGIES)
JOB_SUBMIT->to submit job in back ground,
Are used to schedule the programs in back ground through source code.
T-codeSM37:-It is used to check the status (or) overview of the back ground jobs.
Note:-The menu bar program ->execute->background Can also be used to work with the back
ground jobs.
Note:-1.The system generates unique spool request number for each back ground job.
2. The transaction code SP01 and SP02 are used to work with spool request (print
Request).
3. An icon delete is used to delete the back ground job from the data base.
27
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to Check or Over view of Back ground Jobs:-
Check all the job status such are scheduled, released, ready, active, finished.
Mathematical Functions:-
28
BY MR. BABU (OASIS TECHNOLOGIES)
Mathematical functions are used on the decimal and numeric data variables.
FUNCTION DESCRIPTION
SIGN It returns sign of the number such as ‘-1’ and ‘1’.
ULINE statements:-This statement is used to display the horizontal lines in the output.
Syntax:- ULINE.
String Operators:- They are used on the string (or) character data variables.
OPERATOR DESCRIPTION
STRLEN It returns the number of characters in the string.
Syntax:-<gv_length> = STRLEN(gv_string>).
29
BY MR. BABU (OASIS TECHNOLOGIES)
SPLIT It splits the string into the different strings at the
specified symbol (or)character.
Syntax:-SPLIT<gv_target>AT< comma/space/…>
Into <gv_s1><gv_s2>…
Note:-an addition into table is used to handle any
no.of
Splitters.
Syntax:- SPLIT<gv_target>AT<comma/space/..>
INTO TABLE <gt_itab>.
Syntax:FIND<gv_find>IN<gv_source>MATCHOFFSET
<gv_pos>.
30
BY MR. BABU (OASIS TECHNOLOGIES)
Conditions:
1. IF------condition statement:
• It is used to check all the specified conditions and process the corresponding process
block of satisfied condition
Syntax: IF <cndition1> AND <condition2>
* Process block1
ELSE IF <condition3> OR <condition4>
*process block 2
|
|
|
ELSE
*ELSE BLOCK
|
|
|
END IF
2. CASE-------condition statement:
• It is used to cross the process block of the specified data variables or field variable of the
specified condition.
• This statement does not check all the data variables/field variables.
Syntax: CASE <gv_var/field>
WHEN <value1> AND <value2>
* Process block 1
|
|
WHEN <value3> OR <vaue4>
*process block 2
|
|
WHEN OTHERS
*other process block
END CASE.
31
BY MR. BABU (OASIS TECHNOLOGIES)
Note: In the real time use ‘case….condition’ statement than ‘if.…conditions’ as much as
possible since the case statement does not check the unwanted values (faster).
• They are used to compare numeric (or) Number data variable and fields.
• Following are the different types of numeric comparison operators.
• They are used to avoid the “hard coded texts” in the programs.
• ABAP statement ‘CONSTANTS’ is used to define the constants.
Equal to = EQ
Not Equal to <> NE
Less Than < LT
Less than/Equal to <= LE
Greater Than > GT
Greater Than/Equal To >= GE
OPERATORS DESCRIPTION
CA-contains Any The condition becomes true in case of the some string
contains any one of the character in the target string.
NA-Contains Not Any The condition becomes true in case of a string comparison
operator CA is false(opposite to CA)
CO-Contains Only The condition becomes true in case of the source string
contains only the similar string in the target
CN-Contains Not Only The condition becomes true in case of the string comparison
operator CO is false(opposite to CO)
CS-Contains String The condition becomes true in case of the source string
contains similar string in the target in both upper &lower
32
BY MR. BABU (OASIS TECHNOLOGIES)
case(not a case sensitive)
NS-Contains NO String The condition becomes true in case of a string operator CS is
false(opposite to CS)
CP-Contains Pattern The condition becomes true in case of the source string
contains the specified pattern in the target string
NP-Contains Not Pattern The condition becomes true in case of the logical expressions
with a string operator CP is false(opposite to CP)
LOOPS
They are used to process stamen block or Process block multiple times.
1) DO ….. ENDDO
2) WHILE ….ENDWHILE
4) LOOP……. ENDLOOP.
DO…END DO:- This loop is also called un conditional loop. It can be used to process the loop for
any no.of times any one of the loop termination statements such as “EXIT” and “STOP” should
be used to come out of this loop.
>Syntax:-DO
*Process block
IF<condition>……
EXIT/STOP.
ENDIF.
ENDDO.
NOTE:-This loop statement can also be used to process for the specified number of times.
33
BY MR. BABU (OASIS TECHNOLOGIES)
>DO<n>Times
ENDDO. <
>WHILE<condition1><condition2>
*process block
ENDWHILE
Loop Termination And Continue Statements:- They are used to come out of the loop
statements and continue with the next loop process.
Following are the different types of loop termination and continue statements.
1) EXIT
2) STOP
3) CONTINUE
4) CHECK.
EXIT statement:- This statement is used to come out of the loop statement and continue with
the next statement line out side of the loop statements in the program.
34
BY MR. BABU (OASIS TECHNOLOGIES)
NOTE:- If this statement is used outside of the loop statement, the program will be stop and
display the output.
DO.
IF<condition>.
EXIT.
ENDIF.
ENDDO.
STOP Statement:- This statement is used to stop the loop process along with the next part of
the loop statement.
NOTE:- It does not make any difference inside of the loop statements and outside of the loop
statements.
DO
IF<condition>
STOP
ENDIF.
END DO.
WRITE<outside of loop>
>Output list.
CONTINUE Statement:- This statement is used to stop the current loop process and continue
with the next loop process.
>Syntax:-
35
BY MR. BABU (OASIS TECHNOLOGIES)
DO…..
*stops current loop process and continue with the next loop process.
CONTINUE.
WRITE:…………..
ENDDO. <
CHECK Statement:- This statement is used to check the specified conditions and continue with
the next loop process (or) next program part.
>Syntax:-
DO
CHECK <condition>
WRITE…..
ENDDO. <
This loop statement is used to extract record by record from the database tables (or)
database views into a work area (or) variable.
36
BY MR. BABU (OASIS TECHNOLOGIES)
Syntax:- SELECT *
<condition2>..
END SELECT.
Comes out of this loop after last record is extracted and processed.
NOTE: In the real time this loop statement is not advisable as it fits the database for each
SELECT Clause:-It is used to specify the required fields to be extracted from the database tables
(or) database views.
Syntax:-
* Not advisable
* SELECT *
* Advisable
SELECT <f1>
<f2>
<f3>
NOTE: - In the real time SELECT * is not advisable unless all the fields are required.
37
BY MR. BABU (OASIS TECHNOLOGIES)
NOTE: - It is advisable to specify the required fields in the similar order of the data base tables
(or) database views as per the specifications.
FROM Clause: - It is used to specific source of the data. Such as database tables (or) data base
Fields.
<f2>..
FROM <dbtab/dbview>….
INTO … (OR) INTO TABLE Clause:- It is used to specify the data structure variable (Work area),
variables and internal tables (holds multiple records) for holding the extracted data from
database tables (or) database views.
<f2>
<f3>
FROM <dbtab/dbview>
WHERE Clause: - It is used to filter the data while extracting from the database tables (or)
Database views.
<f2>...
INTO <gs_dbtab/(gv_var1,gv_var2..)>
<condition2>…
38
BY MR. BABU (OASIS TECHNOLOGIES)
Functionality of SELECT..ENDSELECT Loop:
******************Refer Notes********************
WORK AREAS
Introduction:
Syntax:
DATA: <Gs_dbtab> TYPE <typ_dbtab/dbtab/dbstr…..>
* OR
DATA: <WA_dbtab> LIKE LINE OF <gt_dbtab>
TYPES Statement:
• This statement is used to declare or define the local types in an application program.
• The TYPES can be used as a reference to declare the Data variables such as Variables,
Work Areas, Internal Tables etc….
Syntax:
*Single Field
TYPES: <gv_ret> TYPE <Dataelement/dbtab_field/…..>
*With Multiple Fields
TYPES: BEGIN OF <typ_dbtab>,
<f1> TYPE <dataelement>,
<f2> TYPE <dbtab_f1/dbstr_f1>,
………….END OF <typ_dbtab>
Note: The entire structure of the table or DDIC structure can be included along with the
additional fields as below
39
BY MR. BABU (OASIS TECHNOLOGIES)
<f2> TYPE <dbtab_f1/dbstr_f1>,
*INCLUDE Structure
INCLUDE STRUCTURE <dbtab/dbstr>
TYPES: END OF <typ_dbtab>
• This statement is used to include the entire structure of the data dictionary table or
DDIC structure to the local types.
TYPE GROUP:
Example:
TYPE-POOL ztypg.
*TYPES
TYPES: BEGIN OF ztypg_ekpo.
ebelp TYPE ekpo_ebelp.
……
*INCLUDE STRUCTURE
40
BY MR. BABU (OASIS TECHNOLOGIES)
INCLUDE STRUCTURE VBAK.
TYPES: END OF typ_ekpo.
END OF ztypg_ekpo.
Field Strings:
• They are used to declare or define Work Areas and Internal Tables.
• Field Strings are Outdated.
Syntax:
DATA: BEGIN OF <gs_dbtab>,
<F1> TYPE <dataelement/dbtab_F1/dbstr_F1>,
------
END OF <gs_dbtab>
FIELD SYMBOLS:
Syntax:
FIELD-SYMBOLS: <<fs_dbtab>> TYPE ANY
<<fs_any>> TYPE ANY
41
BY MR. BABU (OASIS TECHNOLOGIES)
<<fs_dbtab>> TYPE <typ_dbtab/dbtab/dbstr>
ASSIGNING Statement:
This statement is used to assign the field symbols to the internal tables.
Syntax:
-----ASIGNING <<fs_dbtab>>.
UNASSIGN Statement:
Syntax:
UNASSIGN <<fs_dbtab>>.
Internal Tables:
Introduction:
• They are the intermediate tables which can be filled with the multiple rows at runtime.
• The data of an internal table can be processed in an application program or source code.
• The Internal Tables can be categorized as 2 tables as below:
1. Index Tables
2. Non-Indexed Tables
42
BY MR. BABU (OASIS TECHNOLOGIES)
Internal Tables
Non-Index
Index Tables
Tables
Note: In real time the Standard Internal Tables are mostly used and the Sorted Internal Tables
are rarely used.
Syntax:
DATA: <gt_dbtab> TYPE STANDARD TABLE OF <typ_dbtab/dbtab/dbstr/ztypg_dbtab>.
(Or)
<gt_dbtab> TYPE TABLE OF <typ_dbtab/dbtab/dbstr/ztypg_dbtab>.
43
BY MR. BABU (OASIS TECHNOLOGIES)
• The ABAP statements “APPEND/INSERT” is used to fill Sorted Internal Tables.
• They are accessed based on Index and Key Fields.
• An additional statement with UNIQUE or NON_UNIQUE Key must be used to declare or
define Sorted Internal Tables.
Syntax:
DATA: <db_dbtab> TYPE SORTED TABLE OF <dbtab/typ_dbtab/ztyp_dbtab/dbstr> with
UNIQUE/NON UNIQUE KEY <K-F1>
Note:
The Sorted Internal Tables cannot be sorted explicitly where as Standard Internal
Tables can be sorted.
The program goes to run time error (short dump) in case the Sorted Internal Table
when it contains any duplicate data.
Specify all the key fields of the data base tables using an addition “WITH UNIQUE KEY”
to declare or define Sorted Internal Tables.
Syntax:
DATA: <gt_dbtab> TYPE HASHED TABLE OF <dbtab/dbstr/typ_dbtab/typg_dbtab> WITH
UNIQUE KEY <K-F1><K-F2>….
44
BY MR. BABU (OASIS TECHNOLOGIES)
Functionality of Internal Table:
Note:
Internal Tables can also be declared with Header line but not advisable.
DATA : <gt_dbtab> TYPE TABLE OF <typ_dbtab/dbtab/dbstr/ztypg_dbtab> WITH HEADER
LINE.
Note:
Hashed Internal tables consume some static process time while accessing first and last
record since they follow Hash algorithm
Indexed Internal Tables can hold upto 2GB of data.
Note: Internal tables can also be declared using “OCCURS” addition statement but not advisable
Syntax: DATA: <gt_dbtab> LIKE <dbtab/dbstr> OCCURS <n>
*<n> is a number to allocate required space.
TABLE TYPES:
45
BY MR. BABU (OASIS TECHNOLOGIES)
• They are one of the dictionary objects
• They are used to define central internal Table Types (internal tables).
• Table Types can be referred across the system.
Note: Data dictionary object Table Types can be referred to declare Internal tables and work
areas.
Syntax: <gt_itab> TYPE <ZDDIC_TABLE_TYPE>. “Internal Table
<gs_line> LIKE LINE OF <gt_itab>. “Work Area.
46
BY MR. BABU (OASIS TECHNOLOGIES)
It is used to extract all required data item from database tables or database views into an
internal table body.
This statement is used to append record by record from a Work Area (or) Header line (or) Field
Symbol into an Internal Table body.
This statement is used to append multiple lines of an internal table into another target internal
table at the end
Syntax:
APPEND LINES <gt_source> TO <gt_target>
d.) …INSERT:
This statement is used to insert a new record at any position of an internal table.
Syntax:
INSERT <gs_final> INDEX <n>? SY-TABIX
This statement is used to insert multiple lines of a source internal table into a target internal
table at any position.
Syntax:
47
BY MR. BABU (OASIS TECHNOLOGIES)
INSERT LINES OF <gt_dbtab> INTO <gt_final> INDEX <n>/SY_TABIX
This statement is used to compare character (or) string fields data and summarize (or) collect
numeric fields data.
Internal tables can be copied from body of source internal table into the body of target internal
table.
48
BY MR. BABU (OASIS TECHNOLOGIES)
Example:
*Advisable
<gt_target>[] = <gt_source>[]
*Not Advisable
LOOP AT <gs_source> INTO <gs_source>
------
<gs_target>=gs_source>,
APPEND <gs_target> to <gt_target>
------
END LOOP
This loop statement is used to process record by record of an internal table through its header
line or work area or field symbol.
Syntax:
*Using Work Area
LOOP AT <gt_final> INTO <wa_dbtab> WHERE <CONDITION1> AND….
*Process Data
Loop Process
WRITE: ….
-------
END LOOP
Comes out of loop after last record is processed.
*[OR] Using Field Symbol
LOOP AT <gt_final> ASSIGNING <<fs_final>>
49
BY MR. BABU (OASIS TECHNOLOGIES)
Syntax:
SORT <gt_dbtab2 >
LOOP AT <gt_base> into <gs_base>
------
*Read Another Internal Table Data.
READ TABLE <gt_dbtab2 > INTO <gs_dbtab2 > WIH KEY
<f1> = <gs_base_f1> [BINARY SEARCH]
IF SY-SUBRC EQ 0
*Process 2nd Internal Table data
-----
END IF
-----
*Read 3rd Internal Table
-----END LOOP.
NOTE:
The Internal Tables must be sorted before an additional statement “BINARY SEARCH”
is used.
In real time, use an addition “BINARY SEARCH” while reading the internal tables for
better performance
Comparison operator statement cannot be used with READ TABLE statement since the
symbol ‘=’ should only be used.
The Index Internal tables can also be read using their indexes.
Example:
*Read Internal Table using Index.
READ TABLE <gt_dbtab2 > INTO <gs_dbtab2 >
INDEX <n>/ SY-TABIX
The ABAP statement MODIFY is used to modify an internal table with new data.
Note:
An additional statement “TRANSPORTING” is used to modify an internal table data
with the specified fields.
No need to use “MODIFY” statement to modify same internal table using “FIELD
SYMBOLS”
3.) Delete Internal Table Data:
50
BY MR. BABU (OASIS TECHNOLOGIES)
a.) DELETE Statement:
Note: It is advisable to delete internal tables or database tables outside of loop statements
for better performance.
This statement is used to delete adjacent duplicates or corresponding duplicate records from
the internal table.
This statement is used to free contents of an internal table along with allocated memory.
This statement is used to clear or remove contents of work areas, header lines and variables.
51
BY MR. BABU (OASIS TECHNOLOGIES)
This statement is used to sort internal table’s data either in ascending order or descending
order.
SETECT-OPTIONS Statement:
• This statement is used to define the range input fields and single input fields in the
selection screen.
• The system generates an internal table with the below fields for ranges or “SELECT-
OPTIONS”
Filed Description
SIGN I-Include
E-Exclude (Sign of input data)
OPTION EQ-Equal To
BT-Between (Option of Input Data)
LOW Lower Limit of Range or Select-Options
HIGH Higher Limit of Range or Select-Options
Note:
Standard structure “SELOPT” is referred for SELECT-OPTIONS or ranges implicitly or
explicitly.
The ‘OPTION’ field of the RANGE Internal Table holds ‘EQ’ in case of only lower limit is
filled.
The ‘OPTION’ field would be ‘BT’ in case of both the lower and upper limits are filled.
The SELECT statement extracts all the records in case of the SELECT-OPTIONS or
RANGE is empty(optional input field)
If only upper limit is filled, the data will be extracted from the initial record to
specified upper limit.
52
BY MR. BABU (OASIS TECHNOLOGIES)
The lower limit of the range input field should always be less than the upper limit.
Otherwise the system will throw an error message.
Syntax:
*Specify Tables
TABLES: <dbtab>
SELECT-OPTIONS: <s_range> FOR <dbtab_field>
Note:
In real time, the tables statement is not advisable since it creates unnecessary work
area as like specified table name
The “TABLES” statement can be avoided by declaring or defining the required data
variable.
Syntax:
DATA: <gv_field> LIKE <dbtab_field>
SELECT-OPTIONS: <s_range> FOR <gv_field>
Example:
DATA: gv_ebeln LIKE ekpo_ebeln
SELECT-OPTIONS: s_ebeln FOR gv_ebeln
Note:
The ABAP Statement FOR is used to refer the data variables or table abd structure
fields for SELECT-OPTIONS or RANGES.
The ABAP statement IN is used to make use of “SELECT-OPTIONS” or RANGES in
WHERE condition while extracting data.
Syntax:
SELECT <f1>
<f2>
--------
FROM <dbtab>
INTO TABLE <gt_dbtab>
WHERE <f1> EQ <parameter> AND
<f2> IN <s_option>…
53
BY MR. BABU (OASIS TECHNOLOGIES)
SELECT-OPTIONS Screen:
• Once the report or Transaction code or table is executed, click on Multiple Selection
Button.
• Enter the required single values under “Select Single Value” Tab
• Click on Copy icon (Execute)
Note:
The tab “Select Ranges” is used to specify multiple ranges
The tab “Exclude Single Values” is used to exclude single values or ranges
An icon “Import from File” (Shift+F11) can be used to import the input data from the
text file.
Click on ‘Copy’ icon(Execute)
1. ….DEFAULT…TO:
It is used to pass the default values to Lower and Upper limits of the “SELCT-OPTIONS”
2. ….NO EXTENSION:
This addition is used to hide the multiple selection buttons of the SELECT-OPTIONS
3. …NO INTERVALS:
54
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
The Select Options should only be used to define optional single input fields using the
additions NO-EXTENSIONS and NO-INTERVALS.
Syntax:
SELECT-OPTIONS: <s_selopt> FOR <gv_var> NO EXTENSION NO INTERVAL “Optional Single
input field
Note:
The SELECT statement does not extract all the records in case of optional single input
field using PARAMETERS statement since it is considered as EQ space.
The SELECT statement extracts all the records in case of SELECT OPTIONS single input
field since it is considered as *
In real time, use “Parameters” statement for defining checkboxes and radio buttons
and use “SELECT-OPTIONS” statement for defining single and range input fields in the
selection screen.
Refer PARAMETERS statement additions for MODIFID, OBLIGATORY, etc. which has
similar functionality.
PARAMETERS SELECT-OPTIONS
1. It is used to define Check boxes, Radio 1. It is used to define Single and Range
buttons and Single input fields input fields
2. It is used as an input data variable 2. It is system generated internal table
with the fields SIGN,OPTION,HIGH and
LOW
3. ABAP statements TYPE or LIKE is used 3. ABAP statement FOR is used
to refer Data types or Data Objects
4. The operator RQ or symbol ‘=’ is used 4. The ABAP statement IN is used to
in WHERE condition make use of SELECT-OPTIONS in
WHERE condition
5. In case of optional, the SELECT 5. It extracts all the data in case of Single
statement does not extract ant data Input field
RANGES statement
55
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
In real time RANGES statement is not advisable. Use RANGE INTERNAL TABLES instead
of RANGES.
Example:
DATA: r_range TYPE RANGE OF ebeln
The RANGE table can be populated and used ad below
Syntax:
RANGES: <r_range> FOR <gv_var> “Not Advisable
DATA: <r_range> TYPE RANGE OF <field>
*Populate range table
r_range – Sign = I
r_range – Option = ‘BT’
r_range – Low - <3000>
r_range – High - <5000>
SELECT
….
<BUKRN> IN <r_range>
SELECTION-SCREEN Statement:
This addition is used to define the selection screen blocks with frames
Syntax:
SELECTION-SCREEN BEGIN OF BLOCKS <blk> WITH FRAME
PARAMETERS…
SELECT-OPTIONS…
SELECTION-SCREEN END OF BLOCK <blk>
56
BY MR. BABU (OASIS TECHNOLOGIES)
2. FRAME TITLE:
An addition TITLE with the selection screen FRAMES is used to define TITLES for the selection
screen FRAMES
Syntax:
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE Text_h01.
Note:
TEXT SYMBOLS should only be used with the addition TITLE.
In real time the selection screens must be defines with FRAMES along with TITLES.
3. …PUSHBUTTON:
This addition is used to define the push buttons in the selection screen.
Syntax:
SELECTION SCREEN: PUSHBUTTON 2(8) <but 1> USE-COMMAND CLIL,
PUSHBUTTON 12(10) <but 2> USER-COMMAND <cmd>.
Note:
The TAB STRIP control can also be defined in the selection screen using an addition
TABBED BLOCK
Syntax:
SELECTION-SCREEN: BEGIN OF TABBED BLOCK <tabname> FOR <n> LINES,
TAB (20) <button1> USER-COMMAND <cmd1>,
TAB (20) <button2> USER-COMMAND <cmd1>,
END OF BLOCK <tabname>.
4. …ULINE:
Syntax:
SELECTION-SCREEN ULINE
5. …SKIP:
57
BY MR. BABU (OASIS TECHNOLOGIES)
Note: The ABAP statement SKIP is used to keep blank lines in the output.
Syntax:
SKIP <n> (Here <n> is no of lines to skip)
6. …LINE:
This addition is used to define the input fields, radiobuttons, push buttons, check boxes etc. in
the same line.
Syntax:
SELECTION SCREEN: BEGIN OF LINE,
PARAMETERS: <p_rad1> RADIOBUTTONGROUP <grp1>
<p_rad2>
….
END OF LINE
7. …COMMENT:
This addition is used to provide labels or comments for the selection screen or input fields.
Syntax:
SELECTION-SCREEN COMMENT <comment/label>.
58
BY MR. BABU (OASIS TECHNOLOGIES)
Conversion Routines:
• The conversion routines are used to convert the data from internal format to external
format and external format to internal format.
• The conversion routines are maintained at the domain level of a field.
• The standard function module which ends with “*INPUT” and “*OUTPUT” are attached
to the maintained at conversion routines.
Example: 4970000000….4970.
Example: 00000……49704970.
NOTE: The conversion routine name is appeared in the conversion routine field at domain level
• Double click on conversion routine name to find the attached conversion routine
function modules (*input, *output).
• Click on back.
Note: 1. The ABAP statement UNPACK can also be used to convert data from Internal to External and
2. The ABAP statement WRITE can also be used to convert date, time, currency and Quantity formats
Menu Painter
It is used to maintain the menu statuses for defining push buttons and menu painter.
The ABAP statement 'SET PF STATUS' is used to call (or) define the menu statuses.
Here exclude is used to hide the unwanted pushbuttons and menu items.
Status : ZMENU_STATUS.
8) Enter the function codes for the required items ( EX: CALL .....ETC).
Note: At run-time the system field SY-UCOMM holds the function code when the corresponding push
Buttons and menu items are selected.
Note: The function type 'T- call a transaction' is used to call a required transaction code directly without
writing CALL TRANSACTION statement but the function code of push button (or) menu item should be
same as the transaction code.
Note: Follow the similar steps to create any no of push buttons and menu items.
22) Enter the function codes for the standard bar icons.
BACK
EXIT
CANCEL
3) Enter the source & target program name & menu statuses.
BY MR. BABU (OASIS TECHNOLOGIES)
EX:
FROM:
PROGRAM: ZPROGRAM1.
STATUS : ZSTATUS1.
TO:
PROGRAM: ZPROGRAM2.
STATUS : ZSTATUS2.
8) Create the additional push buttons (or) menu items by double clicking on the function code.
CALL TRANSACTION Statement: It is used to call transaction codes from program or Source code
SUBMIT STATEMENT:-
SUBMIT <ZCALLED_PROGRAM>.
:
BY MR. BABU (OASIS TECHNOLOGIES)
:
SYNTAX:-
This addition is used to pass the input data from the calling program into the called program
using range internal table.
SYNTAX:-
.........................WITH SELECTION-TABLE<gt_range>.
3) ...............................USING SELECTION-SET:-
This addition is used to pass the created variant from the calling program into the called
program.
SYNTAX:-
.........................WITH SELECTION-SET<variant-name>.
MEMORY Concept:-
This concept is used to access the data across internal (or) external sessions.
1) SAP memory
2) ABAP memory
SAP memory:-
It is used to access the data from one sessions to another session through parameter (or) SAP
memory ID.
BY MR. BABU (OASIS TECHNOLOGIES)
The ABAP statements 'SET 'PARAMETER ID' & 'GET PARAMETER ID' is used to work with SAP
memory.
This statement is used to pass the field (or) variable value from an application program into the
specified SAP memory ID (or) parameter ID.
SYNTAX:-
This statement is used to get the data from the specified memory 'ID' (or) parameter ID into
variable (or) field of an application program (or) source code.
SYNTAX:-
NOTE:-
The parameter 'ID' (or) SAP memory 'ID' are maintained at data element level.
PROGRAM:-
:
BY MR. BABU (OASIS TECHNOLOGIES)
Transaction Code
SAP Memory
ID
FIELD1 4970
SET/GET Parameter
ID ↔ ↔
FIELD2
4970 :
:
ABAP MEMORY:-
It is used to access the data across internal sessions. The ABAP statements EXPORT AND IMPORT are
used to work with ABAP memory.
EXPORT Statement:-
It is used to export the data into the specified ABAP memory ID from the program.
SYNTAX:-
IMPORT Statement:-
It is used to import the data from the specified ABAP memory ID into data variable.
SYNTAX:-
NOTE:-
EX:-
PROGRAM:-
* Call function*
source code
Control-Break Statements:
2) The control break statements starts with 'AT' and ends with 'ENDAT'.
AT FIRST.
AT NEW.
AT END OF.
AT LAST.
1) AT FIRST:-
Syntax:
LOOP At<GT_ITAB>.....
*Process block*
END AT.
ENDLOOP.
2) AT NEW:-
This statement is triggered when the specified field contains a new value.
LOOP AT <gt_itab>....................
AT NEW <F1/F2>.
*Process block
END AT.
ENDLOOP.
3) AT END OF:-
LOOP AT <gt_itab>…..
*Process block*.
*Subtotals*.
SUM.
END AT......
ENDLOOP.
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
* An internal table must be sorted before AT NEW and AT END OF statement are used.
* Control break statements AT NEW and AT END OF considers the preceding fields values also
GT_ITAB GT_ITAB
F1 F2 F3 F1 F2 F3
1 A P 1 A P
2 A Q 1 A Q
2 : : 2 B R
4) AT LAST:-
SYNTAX:-
LOOP AT <gt_itab>.....
AT LAST.
*Process block*.
SUM.
END AT…..
ENDLOOP.
NOTE:-
In case of the control-break statement the original work areas (or) field values are impacted by
replacing with '* * * * * *'. This issue can be overcome by copying the original work areas into
temporary work area before the control-break statements are used.
SYNTAX:-
<gs_itab> = <ls_itab>.
AT NEW..............
WRITE <gs_itab-f1>........
END AT.
ENDLOOP.
SUM Statement:-
This is used to summaries the numeric data such as currency, Quantity etc.
SYNTAX:-
LOOP AT gt_itab..............
AT END OF <F1>.
SUM.
END AT.
ENDLOOP.
ON-CHANGE OF Statement:-
This statement is almost similar to 'AT NEW' control-break statement but only the difference is
the 'ON-CHANGE OF' statement can be used within the loop statement & outside of loop statements
also whereas 'AT NEW' statement must be used within the loop statement only.
SYNTAX
BY MR. BABU (OASIS TECHNOLOGIES)
LOOP AT <gt_final> into <gs_final>..….
* Process block*
END ON.
ENDLOOP.
AT NEW ON CHANGE OF
1. They must be used within the loop It can be used within the loop statement &
2. This statement considers the preceding this statement considers the preceding fields values
3) The original work areas (or) field values It doesn't impact the original work areas.
4) It can't be used be on more than one It can be used be on multiple fields using
• The system provided standard function module which starts with 'REUSE' is used to
work with ALV Reports.
• The standard type-Group 'SLIS' contains all the Types, Constants and Internal tables
which are related to ALV Reports.
BY MR. BABU (OASIS TECHNOLOGIES)
• The system provides the generic function (or) push buttons, to sort the data, change
the layout, and Download the data….etc in case of ALV reports.
3) Blocked ALV
4) Hierarchical ALV
NOTE: In real time, ALV grid format are mostly used & the default report format is ALV Grid
Grid Format
→ Generic Function
Pushbutton
3) BLOCKED ALV:
• They are used to display the data from the multiple internal tables as separate
block in the Output.
The below standard function module of ALV reports are used to work with blocked ALV'S.
Blocked ALVs
4) Hierarchical Alv:
• It is used to display the header & the corresponding item details in Hierarchical
format.
10 P A
20 Q B → Item of Header record '1'
30 R C
10 A E
20 C F → Item of Header record '2'
30 D G
2. Extract the required data from the database tables (or) database views based on the given
input.
'REUSE_ALV_LIST_DISPLAY' to display final data by exporting data dictionary structure name &
the final internal table.
EXPORTING
……………….
TABLES
FIELD DESCRIPTION
2. Manual population.
1. Define data dictionary structure (or) internal table with the required fields.
i_program_name = SY-REPID.
CHANGING:
ct_fieldcat = <gt_fcat>.
EXCEPTIONS:
inconsistent_interface = 1.
BY MR. BABU (OASIS TECHNOLOGIES)
program_error = 2.
others = 3.
TABLES
Note: 1.Fields of the internal table must be declared using the keyword LIKE only.
3. Modify the specified field catalog internal table 'GT_FCAT' as per the specification if required.
EX:-
CASE <gs_itab>-fieldname.
WHEN '<field>'.
'<gs_fcat>'-edit = 'X'…….
ENDCASE.
ENDLOOP.
4. Pass the filled field catalog internal table to an export parameter 'IT_FIELDCAT' of the ALV
OR
'REUSE_ALV_LIST_DISPLAY'….
EXPORTING
…………
2. Click on utilities --> Settings --> Check the check box “Downwards comp the length (72).
Note: One red color vertical border line is inserted at 72 character position.
EX :
Perform <f_pop_fieldcat>.
.
.
.
Form <f_pop_fieldcat>.
*First field
*2nd field
BY MR. BABU (OASIS TECHNOLOGIES)
CLEAR <gs_fcat>.
<gs_fcat> - field name = ‘<field2>’.
<gs_fcat> - col_pol =’<2>’.
.
.
ENDFORM.
Note: Duplicate block of code to populate afield catalogue can be avoided using subroutine as below.
EX :
Perform <f_pop_fieldcat>.
.
.
.
FORM <f_pop_fieldcat>.
*First field
*2nd field
ENDFORM.
.
BY MR. BABU (OASIS TECHNOLOGIES)
APPEND <gs_fcat> TO <gt_fcat>.
ENDFORM.
2.Slis _layout_alv :
• It is used to format entire layout in alv reports such as display data in different data in color
Confirmation prompt _ _ _ etc.
Note:
• The populate structure variable of the type slis_layout_alv should be passed to an export
parameter of ALV display function module.
Ex :
EXPORTING
EX :
3. Pass color code field name to the field ‘info_fieldname’ off the layout data structure
variable (work area - gs_layout)
EX :
.
.
• Add color code field
END OF <typ_final>.
<1- 7><1><1>
<lv_col> = <lv_col> + 1.
BY MR. BABU (OASIS TECHNOLOGIES)
• Reset color code
IF<lv_col> = 7.
ENDIF.
ENDLOOP.
3.slis_t_event :
It is used to populate an alv event
This type contains following fields
Eventname description
Note:
2. Pf_status_set - the call menu status for adding menu ite and push buttons in
alv reports.
3. User_command - to provide an interactive functionalaity based on the
selected record are push button are men itom in alv reports.
1. Manual population
2. By using alv function madule (reuse_alv_event_get)
3. Using call back parameters
Steps :
1. Populate an internal table of the type “slis_t_event” with the required events and their
corresponding dynamic subroutine.
2. Define the dynamic subroutine of an event with the required functionality or business logic.
3. Pass the populated events internal table to export, import parameters of alv display function
module it_event.
EX :
PERFORM <f_pop_events>.
FORM <f_pop_events>.
ENDFORM.
FORM <f_pop_of_page>.
ENDFORM.
FORM <f_user_command>------
ENDFORM.
EXPORTING
It_fieldcat = <gt_fact>.
Is_layout = <gs_layout>.
The standard ALV function module ‘REUSE_ALV_EVENT_GET’ is used to populate all the ALV events.
Note:
• The dynamic subroutine for each event can be populated with in the loop of event internal
table.
Ex:
WHEN ‘ USER_COMMAND’.
ENDCASE.
ENDLOOP.
Note:
• Pass the populate event internal table (gt_event) to an export parameter (it_events ) of alv
display function module.
The call back export parameter can also be used to specific the dynamic subroutine name
of alv events in alv display function modules.
EX:
Exporting
Note :
I_callback_pf_status_set = f_pf_status_set.
I_callback_user_command = f_user_command.
Populate ALV event ‘TOP_OF_PAGE’ with the corresponding dynamic subroutine name
(f_top_of_page) into an internal table of the type (slis_t_event ) (gt_event).
Note: Call back export parameter “ i_callback_top_of_page” can also be used to specify
BY MR. BABU (OASIS TECHNOLOGIES)
Dynamic subroutine name in alv grid format. But not possible in List format
Populate the required header data into an internal table of the type (slis_t_listheader)
in b/w the definition of dynamic subroutine .
Use the standard ALV function module “REUSE_ALV_COMMENTARY_WRITE” to display
the populated header data and logos.
Note :
Field description
…………………….
………………………
Perform <f-pop-events>
…………………………………..
……………………………………
Form <f-pop-events>.
<gs_event>-name = ‘top-of-page’
<gs_event>-form = ‘<f_top_of-page>’
BY MR. BABU (OASIS TECHNOLOGIES)
Append <gs_event> to <gt-events>
…………............
………………………
Endform.
<gs-header>-typ = “H / S / A”
Exporting
It-list-commentary = <gt-listheader>
…………………………….
Endform.
1) Copy the system provided generic functions (push button) from the standard program ‘SAPLSALV’
and the status 'STANDARD' into the required custom program and menu status.
2) Add additional customer specific 'push buttons' and generic functions to copied status.
3). Populate an ALV event PF_STATUS_SET and its dynamic sub routines into an internal table 'gt_event'
EX:- FROM:
PROGRAM : SAPLSALV.
STATUS : STANDARD.
TO:
BY MR. BABU (OASIS TECHNOLOGIES)
PROGRAM : ZALV_REPORT.
STATUS : ZMENU_STATUS.
Call the copied menu status using the ABAP statement 'SET_PF_STATUS' within the definitions of the
dynamic sub routine 'PF_STATUS_SET'.
EX: :
FORM <F_POP_EVENT>.
*TOP_OF_PAGE*
*PF_STATUS_SET EVENT.*
<gs_event-name> = 'pf_status_set'.
ENDFORM.
ENDFORM.
NOTE:-Above same steps can be explained in case of a question as ' Steps to add custom generic
functions ' push buttons in ALV reports.
TYPE : SLIS_T_EXTAB :-
It is used to populate the function codes of the unwanted generic functions (or) push
buttons to be excluded in ALV reports (or) output.
This type has a field 'FCODE' which can be filled with the unwanted function code of the
push buttons.
Steps To Work With ALV Events USER_COMMAND (Or) Steps To Provide Interactive Functionality:-
1. Populate an ALV event user_command & its dynamic sub routine (F_USER_COMMAND) into an
internal table (gt_event) of the slis_t_event.
2) Provide the required interactive functionality such as 'to call another transaction code'(or) to display
another ALV drill down report (or) call another program or form when the push buttons are selected (or)
the current record (or) field value is clicked (or) double-clicked in ALV output.
EX:-
BUT
BY MR. BABU (OASIS TECHNOLOGIES)
F1 F2 F3 F4 F5 F6
4970
: FIELD1
:
: FIELD2
: :
:
CALL ANOTHER T-
CODE
DRILL DOWN
BUTTON2
F1 F2 F3 F4 F5
10
20
INTERACTIVE ALV
:
:
:
:
NOTE:- Function code for the double click functionality in ALV reports ‘&IC1’ and in Interactive classical
Report is ‘PICK’
Sample Code:-
FORM <F_POP_EVENT>.
:
BY MR. BABU (OASIS TECHNOLOGIES)
:
<gs_event-name> = 'USER_COMMAND'.
ENDFORM.
TYPE SLIS_SELFIELD.
*Interactive functionality*
CASE F_UCOMM.
WHEN '&IC1'.
BY MR. BABU (OASIS TECHNOLOGIES)
*Interactive functionality.....................*
CALL TRANSACTION......../SUBMIT..............
WHEN '<BUT>'.
ENDCASE.
6) TYPE:- SLIS_T_SELFIELD:-
It is used to capture the selected row (or) line value in ALV reports.
NOTE:-
FIELD DESCRIPTION
Use a selection screen event AT SELECTION SCREEN ON VALUE REQUEST FOR on the change
layout variant input field.
pass an input field name to a field VARIANT of the structure variable of the type DISVARIANT.
Pass the populated structure variable of the type DISVARIANT to an export parameter
IS_VARIANT of ALV display function module either list (or) grid.
EX:- :
PERFORM F_LAYOUT_SHELP.
FORM <F_LAYOUT_SHELP>.
<wa_variant>-variant = <p_var>
EXPORTING
IS_VARIANT = <wa_variant>
IMPORTING
ES_VARIANT = <wa_variant_c>.
:
BY MR. BABU (OASIS TECHNOLOGIES)
:
FORM <f_display_alv>.
EXPORTING
IS_VARIANT = <WA_VARIANT_C>.
8) TYPE: SLIS_KEYINFO_ALV:-
It is used to populate the key fields information to display header and the corresponding
item data in (hierarchical format) hierarchical ALV.
FIELD DESCRIPTION
NOTE:-
EXPORTING...............
TABLES
NOTE:-
EXPORTING.
TABLES
This concept is used to maintain different types of screens and corresponding flow logic.
This concept contains mainly two parts
1. Module pool program.
2. Screen painter.
The module pool programs are used to define the modules of the flow logic in screens.
The program type for module pool is ‘M’.
The transaction code SE38 is used to maintain module pool program
It can have 4 Include programs such are * TOP, *F01, *I01 and *O01
*TOP Include: It is used to declare global data declarations which can be accessed across screen
* F01 Include: It is used to define sub routines which can be used in module definitions
Note:-The module pool program must be created first before the screens are designed.
*Data declarations
|
|
*Business logics
|
|
PERFORM <f_subroutine>……..
ENDMODULE.
Note:- The module pool name and screen program name must be similar.
BY MR. BABU (OASIS TECHNOLOGIES)
Screen painter:-
a) Normal screen:-
The normal screens or main screens which can be called through transaction
codes or using ABAP statement ‘CALL SCREEN’.
b) Sub screen:-
The sub screens are part of main screens which can be main screen (normal).
The sub screens can’t be executed independently.
The flow logic ABAP statement ‘CALL SUBSCREEN’ is used to call the sub screen
areas in the normal screen.
Note:-
It is used to populate (or) display the data on popdialog box with some genric
functions.
d) Selection screen:-
The selection screen is reserved for reports (or) executable programs.
The screen number 1000 is reserved for selection screen
BY MR. BABU (OASIS TECHNOLOGIES)
NORMAL SCREEN
NORMAL SCREEN
TAB1 TAB2
Sub Screen
SUB SCREEN
Push Button
BUTTON BUTTON
F1 F2 F3
10 A B
ICON1 ICON 2
i. Attributes
ii. Element list
iii. Flow logic
iv. Layout
Attributes:-
It contains the technical details of the screen such are type of the screen, next screen
number, package etc………
BY MR. BABU (OASIS TECHNOLOGIES)
Element list:-
It contains the screen elements, attributes and properties of the screen elements in the
normal screen and sub screen and attributes such are general attributes, texts or input output
templates, special attributes, display attributes, modification groups
Note:- Make a input list as drop down list by selecting option under the tab input or output.
This component is used to make the screen elements visible, invisible change the
dimensions and etc..
Note:- The modification groups which can be used to format the screen dynamically are
Layout:-
It is used to define the tablecontrols to maintain multiple line items (or) records on
the screen.
TEXT FIELD
CUSTOM GBB
INPUT/OUTPUT
TAB 1 TAB 2 F1 F2 F3 F4
FIELD 1
FIELD 2
TTab
CHECK BOX
o RADIO BUTTON 1
o RADIO BUTTON 2
BUTTON 1 BUTTON 2
BY MR. BABU (OASIS TECHNOLOGIES)
They are used to maintain different attributes or setting of a screen elements such are
function code, function type, dropdown list etc……..
Note:- There must be foreign key relationship between value and text fields of a text
table.
b) Groups:- They are used to specify the radio button group name (or) modification
group name.
c) FCT code:- Function code of a push buttons or menu items.
d) Dictionary Attributes:-
It is used to maintain the attributes of the data dictionary objects such are table
(or) structure fields.
Some of the dictionary objects are: data format, search help, conversion exit
etc….
e) Program Attributes:-
It is used to maintain the different attributes of input (or) output fields.
Following are different types of inputs:
i. Required:-
To make the screen input field as mandatory.
ii. Possible:-
It is default action to accept the input values at runtime.
iii. Not possible:-
In case of this option input is not possible but the field can be used as output field.
iv. Recommended:-
To make the input fields as optional. The symbol question mark is appeared in the
input or output field.
Note:- Check the checkbox output only to restrict the input data.
v. Display Attributes:-
BY MR. BABU (OASIS TECHNOLOGIES)
To maintain different attributes such are invisible, output styles, 2d display etc…….
4) Flow logic:-
This component is used to provide the link between the module pool program and screens
It can also be used to control the data flow between the screens.
The screen related ABAP statements such are modules, MODULE, CALL
SUBSCREEN, CHAIN etc… statements can be used in flow logic.
Events associated with screen painter (or) module pool program are
1. PROCESS BEFORE OUTPUT (PBO).
2. PROCESS AFTER INPUT(PAI).
3. PROCESS ON HELP-REQUEST (POH).
4. PROCESS VALUE-REQUEST (POV).
1. PROCESS BEFORE OUTPUT (PBO):-
This event is triggered before the screen is displayed.
It can also be triggered while performing any action on the screen.
This event is used to provide the input data on the screen fields (default values).
It can also be used to format the screen elements dynamically.
Syntax:-
MODULE <def_val>
*FORMAT screen
MODULE <format-screen>
SELECT
BY MR. BABU (OASIS TECHNOLOGIES)
|
<screen-field> = <def_val>.
ENDMODULE.
LOOP AT SCREEN.
Screen-active = ‘1/0’.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE..
CHAIN
ENDCHAIN.
MODULE <process-data>
SELECT……………
IF sy-subrc NE 0.
MESSAGE ……………..
ENDIF.
ENDMODULE.
BY MR. BABU (OASIS TECHNOLOGIES)
*module <process-data> pool program.
CASE SY-UCOMM
WHEN ‘<DELT>’
WHEN ‘<UPDT>’
ENDCASE.
ENDMODULE.
FLOW LOGIC
PROCESS ON HELP-REQUEST
*help documentation
EXPORTING
(or)
EXPORTING
ENDMODULE.
BY MR. BABU (OASIS TECHNOLOGIES)
4. PROCESS ON VALUE-REQUEST:-
This screen event is triggered in case of function key F4 (or) search help icon is
pressed.
This is event is used to populate and display the custom search help on screen input
fields.
The standard function module “F4IF_INT_TABLE_VALUE_REQUEST” is used to
display the populated interval table data as search help.
Syntax:- FLOWLOGIC
PROCESS ON VALUE-REQUEST
*search help
*Data declaration
SELECT <field1>
FROM <dbtab>
|
BY MR. BABU (OASIS TECHNOLOGIES)
TABLES
Value-tab = <lt_shelp>
Value-tab = <lt_return>
ENDMODULE.
Module Pool program, Flow logic and screen elements communicate as below
*Default value and format screen. MODULE <def_format> SCREEN FIELD 123
END MODULE.
MODULE<search_help>INPUT
MODULE<Search_help>
*Display search help.
END MODULE.
BY MR. BABU (OASIS TECHNOLOGIES)
This statement is used in flow logic to call the define process module pool programs.
Syntax:-
i. ……..AT EXIT-COMMAND:-
This command is used to trigger the dialogue module in case of push button (or)
menu item with the function type ‘E’ exit is pressed.
Syntax:-
…….. AT EXIT-COMMAND.
iii. CHAIN……..ENDCHAIN:-
This statement is used in flow logic to define the process chains.
It can be used to make all the screen input fields enables to enter input data.
Note:-
Syntax:- CHAIN.
ENDMODULE.
BY MR. BABU (OASIS TECHNOLOGIES)
Usefull additions to CHAIN….ENDCHAIN statements:-
i. MODULE ON CHAIN-REQUEST:-
Syntax:-
CHAIN
ENDCHAIN.
Field statement:-
This statement is used in flow logic to trigger corresponding module on the specified
field.
It can also be used to combine multiple screen fields in to process chains.
Sysntax:-
*or
CHAIN
FIELD : <screen-field1>
|
BY MR. BABU (OASIS TECHNOLOGIES)
ENDCHAIN.
MENU. . . . . . . . . .
CUSTOMER DATA
TEXT FIELD
TETECCXC
CUSTOMER NO.
CITY
EXIT
Note:- The screen elements are in pink color background until the required information or
fields are filled.
Double click on push button and fill the required fields such are name, text, function
code…
Note:- Follow the similar steps for any number of push buttons.
BY MR. BABU (OASIS TECHNOLOGIES)
Display DISP
Update UPDT
Delete DELT
Exit EXIT
‘ ‘
‘ ‘
Ex:-
Function code Icons
BACK
EXIT
CANCEL
Note:- Uncomment the system generated statement ‘SET-TITLE BAR’ and provide title.
1. Database Update: the below statements are used to update the database tables.
i. MODIFY Statement:
This statement is used to create (or) modify the data in the database tables.
Note: The modify statement modifies the data in case of entry available in DB tables.
The modify statement creates (or) inserts a new record in case of an entry is not available
in the DB Tables.
ii. UPDATE Statement: This statement is used to update dbtab with new data.
Syntax: UPDATE <dbtab>FROM <gs_dbtab>.”single records.”
(or)
UPDATE <dbtab>FROM <gt_dbtab>.”multiple records.”
Note: This statement can also be used with an addition ‘SET’ statement.
<f1> = <gs_dbtab-f1>
[where<condition>…]
BY MR. BABU (OASIS TECHNOLOGIES)
iii. INSERT Statement: This statement is used to insert a new record into dbtab.
Syntax: INSERT <dbtab>FROM <gs_dbtab>.”single records.”
(or)
INSERT<dbtab>FROM <gt_dbtab>.”multiple records.”
2. DELETE Statement:
The ABAP statement DELETE is used to delete the data from the dbtab.
Syntax: DELETE <dbtab>FROM <gs_dbtab>.”single records.”
(or)
DELETE<dbtab>FROM <gt_dbtab>.”multiple records.”
[Where<conditions>…]
IF sy-subrc = 0.
*commit the changes.
COMMIT WORK.
ELSE.
*revert the changes.
ROLL BACK WORK.
ENDIF.
Note:
COMMIT WORK:
or
UPDATE <dbtab>….
or
DELETE <dbtab>….
BY MR. BABU (OASIS TECHNOLOGIES)
IF sy-subrc = 0.
ENDIF.
Note: An additional statement ‘WAIT’ is used to wait until the high property or update task
or SAPLUW requests are finished.
This statement is used to revert the changes from update work process.
This statement is used to close the current SAPLUW (database-logical unit of work)
And opens a new task.
or
UPDATE <dbtab>….
or
DELETE <dbtab>….
IF sy-subrc = 0.
ROLLBACK WORK
ENDIF.
BY MR. BABU (OASIS TECHNOLOGIES)
Tab Strip Control
It is a set of tab pages and used to place different sub screens of application on single screen.
Example:-
a) Flow Logic:
b) Process Logic-MPP
<tab_control>-activetab = ‘<FCT_CODE>’.
Note: Define Tab strip control using wizard since it generates the necessary flow logic and
Process logic in MPP
BY MR. BABU (OASIS TECHNOLOGIES)
Creation of screen:
-> Right click on MPP name [ex: ZB23_TAB_STRIP]
BY MR. BABU (OASIS TECHNOLOGIES)
-> Click on create
-> Click on screen
Note: different modules can be defined directly by right clicking on Module pool program
name.
-> Enter screen number [ex: 0100]
-> Click on YES button
-> Enter short text
-> Click on layout button
Note: Define text field for screen title and define input, output screen fields using an icon
'Dictionary or program fields' OR using screen elements input or output field.
'
'
'
CASE SY-UCOMM.
WHEN 'DISP'.
PERFORM f_get_data. " get data from LFA1,KNA1.
'
'
'
ENDCASE.
Vendor sub screen
Uncomment PBO module [STATUS_0101] and define with required business logic.
'
'
'
MOVE-CORRESPONDING gs_lfa1 TO lfa1.
'
'
'
Customer sub screen:
Uncomment PBO module[STATUS_0102] and define with required business logic.
'
'
MOVE-CORRESPONDING gs_kna1 TO kna1.
'
'
BY MR. BABU (OASIS TECHNOLOGIES)
Table Control:
It is used to maintain multiple entries in tabular format. Multiple rows are processed using
Loop with control.
• It can be resized to display, change and save data.
• System provides Vertical, Horizontal strollers
Below steps are used to work with table control
Define or declare tab strip control in Module Pool program
Define or create Table control on screen by filling all necessary fields
Make necessary code changes in flow logic and write process logic in MPP
Example:-
a) Module Pool Program
Flow Logic
PROCESS BEFORE OUTPUT.
*Process each row of table control with control
LOOP AT <gt_itab> INTO <gs_itab> WITH CONTROL <table_control>
CURSOR <table_control>-current_line.
………………….
ENDLOOP.
Note: Define table control using wizard since system generates all necessary flow logic
and process logic in MPP
• These techniques are used to upload the data from the specified file path from legacy
system into an internal table of the programs.
• They are also used to download data from an internal table of program into the
specified file path of Legacy system.
• There are 2 types of file handling techniques:
a. Front End System/Local PC
b. Application Server -AL11
Note:
Files from Local PC cannot be processed in back ground since standard FMs give run
time errors.
BY MR. BABU (OASIS TECHNOLOGIES)
The function module which starts with GUI* are advisable since it has a Delimiter
parameter (Has field separator) and support any format from ECC6.0
The function modules UPLOAD and DOWNLOAD are outdated.
The standard function module “ALSM-EXCEL_TO_INTERNAL_TABLE” is used to upload
the excel file data into an internal table.
• It is used to provide the search help to select the required file path of the Front end
system/Local PC.
Example:
AT SELECTION SCREEN ON VALUE-REQUEST FPR <P_FILE>.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
Program_name = sy-repid.
Dynpro_number = sy-dynnr.
Field_name = <‘P_FILE’> “only in uppercase
IMPORTING
file_name = <P_FILE>
• This statement is used to move corresponding field data from the source to the
destination work areas or field symbols and internal tables.
•
Syntax: MOVE-CORRESPONDING <wa_source> TO <wa_destination>. “ While processing
SELECT <f1>
<f2>
…..
INTO CORRESPONDING FIELDS OF TABLE <gt_itab> …. “ While Extracting
b. Application Server:
Download / Transfer:
• The below ABAP statements are used to transfer the data from an internal table into the
specified file path of application server (AL11).
1. OPEN DATASET FOR OUTPUT….
2. TRANSFER …..TO
3. CLOSED DATASET…
• This statement is used to open the required files in write mode in Application server.
Syntax:
OPEN DATASET <p_file> FOR OUTPUT IN TEXT/BINARY MODE ENCODING DEFAULT [MESSAGE
<gv_msg_text>]
2. TRANSFER Statement:
• This statement is used to transfer the concatenated data (String Line-gv_line) into the
opened file.
Syntax:
LOOP AT <gt_final> INTO <wa_final>.
*Convert numeric data into Character.
<gv_char> = <gv_numeric>. “ Convert Number type
WRITE <wa_final-currencyt> TO <gv_amnt_c>. “ Convert Currency data type
*Concatinate the data
CONCATENATE <wa_final.field> ----<gv_char> <gv_amnt_c>
INTO <gv_line>.
BY MR. BABU (OASIS TECHNOLOGIES)
*Transfer the concatenated data
TRANSFER <gv_line> TO <P_File>.
CLEAR <gv_line>.
END LOOP.
3. CLOSED DATASET Statement:
Upload:
• The below ABAP Statements are used to read or upload data from the file in an
application server into an internal table of the program.
1. OPEN DATASET.. FOR INPUT
2. READ DATASET
3. CLOSE DATASET
Note:
2. READ DATASET:
BY MR. BABU (OASIS TECHNOLOGIES)
• This statement is used to read record by record (line by line) from the opened file in
Application Server.
Syntax:
DO.
*Read Record by record.
READ DATASET <P_File> INTO <wa_final>.
IF sy-subrc EQ 0.
*Append Internal Table
APPEND <wa_final> TO <gt_final>.
ELSE.
*Exit out of the loop.
EXIT.
ENDIF.
CLEAR: <wa_final>.
ENDDO.
3. CLOSE DATASET:
1. Download or Transfer:
BY MR. BABU (OASIS TECHNOLOGIES)
2. Upload:
• The transaction code CG3Y is used to download the files from an application server into
the presentation server or front end system or local pc.
• The transaction code ‘CG3Z’ is used to upload files from the presentation server / front
end system / Local PC into an application server (AL11).
Steps to Upload:
Note:
Make sure the directory in an application server is not opened while writing /
transferring the data.
The transaction code ‘FILE’ is used to maintain logical and physical file paths.
The standard function module ‘FILE_GET_NAME’ can be used to get the logical file
path of the physical file.
Data migration/conversion
Introduction:
• This concept is used to migrate or convert a flat file data from the legacy system into sap
data base.
• Following are the different methods or techniques to migrate or convert the
Flat file data.
1. LSMW (Legacy system migration work bench).
2. BDC (Batch data communication).
3. Using standard BAPI (Business application programming interface).
4. Direct input method using standard programs.
[DIAGRAM]-Refer Notes
BY MR. BABU (OASIS TECHNOLOGIES)
SD Flow and MM flow:
Refer Notes
• It is the system provided tool to migrate/convert a flat file data from the legacy system
into sap data base.
• The legacy system data can be imported in different import methods using LSMW.
• The T-code LSMW is used work with LSMW
• Following are different import methods:
a) Standard batch or direct input.
B) Batch input recording.
c) Business object method (BAPI).
d) IDOC (Intermediate document).
NOTE:
An import method batch input recording is mostly used with LSMW.
NOTE: All the process steps can be performed (14-17) are appeared.
NOTE: In the real time the functional transactional codes screen fields recordings can be done
By functional consultants.
• Click on ‘Yes’ button.
• Enter valid from ____ to _____ .
• Enter cost center.
• Press ‘Enter’ button.
• Fill all the required mandatory fields such are: name, person responsible, hierarchy area,
company code and profit center.
• Click on save icon.------- Related to “ks01”.
• Click on save icon to save the recording.
• Double click on the screen field(csksz-kokrs).
• Remove the default values.
• Enter the field name.
• Click on yes.
NOTE: Follow the similar steps for any number of screen fields to which the data to be
Transferred from the flat file.
Example:
Screen field Default value Name
Csksz-kokrs Kokrs
Csksz-kostl Kostl
Csksz- 18:03:2014
dbtab_anb
Csksz-ktext Kyext
BY MR. BABU (OASIS TECHNOLOGIES)
Csksz-verak Verak.
• Click on save.
• Click on back.
• Click on back.
• Click on save icon to save maintain attributes step.
• Click on back.
• This step is preformed to maintain the structure name of the flat file.
Steps to perform:
• It is performed to maintain the fields of the source structure to hold the flat file data.
Steps to perform:
NOTE:
Refer the given flat file (or) DBTAB to know field type and length.
The field type “character” is mostly used to define the source fields.
BY MR. BABU (OASIS TECHNOLOGIES)
NOTE: Follow the similar steps for any number of source fields.
• This step is performed to maintain the relationships with the BDC structure.
NOTE: This step is performed by the system automatically, hence no need to perform this
Step manually.
• This step is performed to map the fields and maintain the conversations.
Steps to perform:
Recording
ZB_REC_KS01
BY MR. BABU (OASIS TECHNOLOGIES)
Ktext Source structure
Kokrs ZB_SOURCE_STRCTR
Kostl Kokrs
Verak Ktext
prctr Prctr
Kostl
Verak
NOTE: ABAP source code can also be written in “LSMW” using the change icon that appears
besides recording structure field.
• Click on save.
• Click on back.
• It is performed to maintain default values, transactions and user defined routines for
the screen fields of the recording.
NOTE: This step can be skipped in case of not required to maintain any fixed values and
Translations.
• It is performed to specify the flat file and the data separators from which the data to be
migrated.
Steps to perform:
NOTE: Length of the file under imported and converted data should not exceed 45 characters.
• This step is performed to assign the flat files to the source structure.
NOTE: This step is performed by the system automatically hence it can be skipped.
Steps to perform:
Steps to perform:
BY MR. BABU (OASIS TECHNOLOGIES)
• Select a radio button “convert data”.
• Click on execute icon.
• Click on execute.
• Click on back.
• Click on back.
Steps to Perform:
• This step is performed to create a batch input session which can be processed to
migrate the converted flat file data into data base tables through screens.
Steps to Perform:
NOTE: The check box “Keep Batch Input Folders” can be checked to keep the processed
session in the system, otherwise the processed session is deleted by the system
automatically.
• It is performed to run the Created batch input session to migrate or update the data
through the screens of the t-codes.
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to Perform:
NOTE: The button “log” is used to analyze the created log file while migrating the data.
NOTE: Tick mark is appeared for all the processed sessions under status column.
• It is a utility to develop programs /reports to migrate or convert the flat file data into the
data base tables.
• The BDC has two methods.
a)Session method.
b) Call transaction method.
Session Method:
• This function module is used to create or open the batch input session which can be
processed using the t-code SM35.
• The below parameters can be passed:
CALL FUNCTION ‘BDC_OPEN_GROUP’
EXPORTING
*client = sy-mandt “system client number.
Group = <p_group> “session name to be created in SM35.
BY MR. BABU (OASIS TECHNOLOGIES)
keep = ‘X’ “Xkeep the processed session in SM35.
*user = sy_uname “user name who executed the program .
*prog= sy_cprog “ system program name.
* indicates optional.
• This function module is used to insert the screen table data of the structure ”BDCDATA”
with Transaction into session.
• The screen table (GT_BDCDATA) can be processed to migrate the corresponding data
into data base tables through the specified t-code by processing the created session.
• The below parameters can be passed:
CALL FUNCTION ‘BDC_INSERT’
EXPORTING
T-code = ‘<t-code>’ “required functional t-code.
*CTUPARMS =<wa_ctu_parms> “handles screen resolution of table control in session.
TABLES
Dynprotab =<gt_bdcdata> “screen table of type bdc data with flat fuile data.
NOTE: An export parameter “CTUPARMS” is used to handle the screen resolution in case of
table control to process the multiple line items in session method.
• This function module is used to close the opened batch input session.
• No need to pass any parameters to this function module.
• It is used to update / migrate/ convert the data in both synchronous and asynchronous
mode from flat file into data base tables through screens.
• This method is faster than the session method.
• The ABAP statement “CALL TRANSACTION” is used to work with this method.
Synatx:
CALL TRANSACTION ‘<TCODE>’ USING <GT_BDCDATA> MODE
BY MR. BABU (OASIS TECHNOLOGIES)
<A/N/E>UPDATE<S/A>[messages into <gt_bdcmsgcoll>].
Here:
• <TCODE> is the required transaction code through which the flat file data to be
migrated/converted.
• <gt_bdcdata> is an internal table of type “bdc data” structure.
• <A/N/E> are different data process modes.
A = All screens.
N = No screens.
E = Error screens.
• <S/A> are the different update modes.
S = Synchronous mode.
A = Asynchronous mode.
NOTE: The screen resolution of the table controls is maintained in call trans action method
using the below
Syntax:
CALL TRANSACTION ‘<TCODE>’USING<GT_BDCDATA> OPTIONS FROM
<wa_ctu_params>[Message INTO <gt_bdcmsgcoll>].
Here:
<wa_ctu_params> is a structure data variable of the type “CTU_PARMS” DDIC structure.
• Following are the different modes to process the data in call transaction method.
I. A-All Screens:
• This data process mode displays all the screens while migrating/converting a flat
file data.
• This data process mode is used to process the data without showing any screens
(background).
• It is almost similar to no-screens mode. But only the difference is the no-screens
mode does stop the break points in called transactions. Whereas the process mode
stops at the break points.
• There are 3modes to update the data into data base tables through the required t-code
screens.
a.)S-Synchronous Mode:
NOTE: The synchronous update mode is stopped with an error record whereas the
asynchronous mode skips the error records.
c.)L-Local Update:
• It is used to update/migrate the data with local update task.(Set update task local).
Field Description
BY MR. BABU (OASIS TECHNOLOGIES)
Program BDC module pool
DYNPRO BDC screen number
DYN BEGIN BDC screen start
FNAM Field name
FVAL BDC field value(flat file).
• Record screen flow of the required functional t-code using the t-code “SHDB”.
NOTE: In the real time screen flow recording is mostly given by the functional consultants.
• The t-code SHDB is used to record the screen flow as the t-codes.
NOTE: An icon export is used to download the recording into local pc.
• An icon import is used to upload the recording file into an transaction recorder.
• Keep on pressing enter button until the recording process is done.
• Click on back.
NOTE: An option read from file is used to generate a program using the given recording file.
Scenario on BDC:
Change the sales document data using the given flat file.
T-code: VA02.
BY MR. BABU (OASIS TECHNOLOGIES)
Tables: VBAK, VBAP.
• The t-code SM35 is used to work with the created batch input session to process
session, check the log file etc.
NOTE:
The button log is used to check the system generated log file analysis the
messages.
The session can be scheduled in background to migrate the data without user
interaction using the tab “In Background”.
NOTE: Remove the processed records from the flat file, rectify error record then re process
Session in case of error record in session method.
• Click on back.
• Get the message details such are, message type message number into an internal table.
(gt_bdcmsgcoll) of the type BDCMSGCOLL using an addition “…..MESSAGES INTO” with
CALL TRANSACTION statement.
• Set a loop into an internal table (gt_bdcmsgcoll) of the type “bdcmsgcoll”.
• Use any of the function modules “FORMAT_MESSAGE”/ “WRITE_MESSAGE” to get the
corresponding message text, since the structure “BDCMSGCOLL” does not have any
message text field.
NOTE: The standard table “T100” can also be used to populate the message text.
• Display the populated messages with message text either list or ALV
LSMW BDC
1.It is system provided tool 1. It is utility to develop a program.
BY MR. BABU (OASIS TECHNOLOGIES)
2. The data can be imported in different 2. The data is processed or Migrated in batch
import methods such as batch input recording, input method only.
BAPI, IDOC.
4. It is compatible for both large and small 4. It is compatible for small amount of data
amount of data. only.
5. The field mapping is done automatically by 5. The field mapping should be done manually.
the system.
6. It is not possible for custom 6. Can be used for custom screens or custom
screens/standard with custom fields of fields of applications also.
applications.
7. It cannot be used for new functional t-codes
7. It can be used for enjoy (new t-codes) (enjoy t-codes).
transaction codes also(ends with *N)
8. The t-code SM35 is used to develop BDC
8. The t-code LSMW is used to work with this program.
tool.
2. The flat file data is processed 2. The flat file data is processed
asynchronously. synchronously.
3. The log file is generated by the system. 3. The messages should be handled explicitly
using the structure “BDCMSGCOLL”, and the
function modules “FORMAT_MESSAGE” /
“WRITE_MESSAGE”.
BY MR. BABU (OASIS TECHNOLOGIES)
4. The standard function modules 4. The ABAP statement CALL TRANSACTION is
“BDC_OPEN_GROUP”, “BDC_INSERT”, used to work with the call transaction method.
“BDC_CLOSE_GROUP” are used to work with
the session method.
5. It is not as fast as call transaction method. 5. It is faster than the session method.
6. One batch input session is created which 6. The t-codes are called for each record while
can be processed using the t-code SM35 after executing the program.
the program execution.
• The table control is used to update or migrate the multiple records (line items) in BDC.
Header data:
Doc No: 1
Line Items
• Record screen flow with line items using the t-code “SHDB”.
NOTE:
Press page down in the table control to record the function code for page down.
In the real time the recording is given by the functional consultants.
BY MR. BABU (OASIS TECHNOLOGIES)
[diagram]-Refer Notes
NOTE: The header and item data can be processed separately using the control break
statements without splitting the flat file data.
• Set a loop to header internal table then process the header related data by copy and
paste the system generated header related subroutines from the temporary recording
program.
LOOP AT <gt_header> INTO <wa_header>.
REFRESH:<gt_bdcdata>.
• Set a loop to item table data to process the multiple line items.
• Make the item number dynamic by concatenating the screen field name with the screen
number.
BY MR. BABU (OASIS TECHNOLOGIES)
* Process the Line Items
• Use the function code “p+” to handle page down in table control.
< lv_counter = lv_counter + 1.
IF lv_counter EQ <2>.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
CLEAR lv_counter.
ENDIF. >
ENDLOOP.
NOTE: The control break statements can also be used to process header and item data
separately by avoiding nested loops.
• Pass the required data such are default size, display mode,update mode and etc to the
defined ctu_params structure variable.
<wa_ctu_params>-updmode = <p_umode>.
<wa_ctu_params>-defsize = <gc_x>.
<wa_ctu_params>-dismode = <p_pmode>.
• Use the populated structure variable of type ctu_params (gs_ctu_params) with CALL
TRANSACTION using an addition “OPTIONS”.
Conversion Routines:
• The conversion routines are used to convert the data from internal format to external
format and external format to internal format.
• The conversion routines are maintained at the domain level of a field.
• The standard function module which ends with “*input” and “*output” are attached to
the maintained at conversion routines.
Example: 4970000000….4970.
Example: 00000……49704970.
NOTE: The conversion routine name is appeared in the conversion routine field in case of
available
• Double click on conversion routine name to find the attached conversion routine
function modules (*input, *output).
• Click on back.
• Read an internal table with in the loop of base internal table and get an index of current
record.
• Set a loop to second internal table (item table) to process from the set index(lv_index)
• Use an “EXIT” statement to come out of second loop for unmatched records.
1) Classic Debugger
2) New Debugger
1) Classic Debugger:
• It is also called old debugger.
• This debugger opens on same session.
• It has lots of limitations such as different desktops are not there, no separate sections
for local, global variables etc.
2) New Debugger:
• This debugger is available from sap version ECC 5.0.
• This debugger opens in another new session.
• This debugger is user friendly with lots of actions such as different desktops ,
separate actions for local and global variables and objects.
• New debugger is default debugger from sap version ECC 6.0 and 5.0.
Note: The program or source code is stopped in classic debugger in case of maximum number
1) Desktop 1:
The variables section is displayed vertically to the source code or program in case of
this desktop.
2) Desktop 2:
It contains all the events used in source code or program.
Note: An icon ABAP source code under stack type is used to open source code or program from
The Debugger.
3) Desktop 3:
It is used to arrange variables section horizontally to source code or program.
4) Standard: It is a combination of desktop1 &2.
Following Are Different Sub tabs Under Desktop1 &3 Are Standard:
They are used to check different data variables, values such as variables, work areas etc
and at a run time 16 data variables can be checked (2*8).
Note: In case of classic debugger 4 data variables at a time and maximum 8 variables then only
can be check.
B) Local Tab:
It contains all the local data variables and their values used in the function modules , sub
routines , methods etc.
C) Global:
It contains all the global data variables and their values in the program or source code.
6. Structures Tab:
It is used to check data structures, variables such as work areas, structure type, and field .
7. Tables:
8. Objects:
It is used to check objects of the program or source code such as work flow objects etc.
Following are the different short cuts to check program or source code in debugger tool.
1) Single Step:
The function key F5 or single step icon is used to check line by line of the program or
source code.
EX:
F5 WRITE : ………….
2) Execute :
The function key F6 or execute icon is used to check block by block of program or source
code.
Write
F6 ENDFORM.
WRITE…………………
3) Return:
The function key F7 or an icon Return is used to return from the source code of the
process blocks such as sub-routines, function modules, methods etc.
4) Continue:
The function key F8 or an icon continue is used to jump from one break point into the
next break point then execute once the last break point is reached.
Note: F5 -> Line By Line.
F6 -> Block By Block.
F7 -> Return From Source Code Of Blocks such as Sub routines, FM,
Modules..etc
F8 -> Jump From One Break Point To Another Then Execute
Break Points
They are used to stop the program or source code in the debugger tool for checking line
By line or block by block.
Note: In the real time session break points are mostly used and external break points are used
rarely
Note: The Program or Source Must Be Activated Before Session Or External Break Points Are
Set.
Click on STOP icon (session break point) or click on the statement line at gray color
vertical section to set or delete the session break points up to 30.
Note: The STOP icons are appeared beside the statement line once they are set.
Note: The program or source is stopped in the debugger at the first set break point.
Use the function keys F5/F6/F7/F8 to check line by line or block by block.
* Or
Note: In the real time the ABAP statement BREAK-POINT should not be used since all the
users are stopped.
Once the program or source code is in change mode click on find icon.
Enter required find string
EX:WRITE:…………
Note: program or source code is stopped at the first set static break-point.
Use the function keys f5/f6/f7/f8 to check line by line or block by block.
• They are used to check the program or source code in case of not possible to
find a location
• The program or source code is stopped at the first statement line of the
performed action in case of dynamic point.
• The command /H is used to set dynamic break-points.
Note: program or source code is stopped at the first statement line of performed action.
7) Use the function keys F5/F6/F7/F8 to check line by line or block by block.
• They are used to check cross application component such as RFC-remote function
call, BAPI, business applications programming interface from another system.
• An icon set or delete external break-points is used to set or delete external break-
point.
Steps To Maintain External Break-Point Settings:
Watch Points
They are used to stop the programs or source code once the set condition is reached or
true.
Note: Up to 9 watch points can only be created & up to 30 break-points can only be set in a
system.
Note: The system gives a success message as watch point created once watch point is
created.
Note: The program or source code is stopped once the set condition of watch point is
reached.
8) Use the function keys F5/F6/F7/F8 to check line by line or block by block.
Steps To Switch From New Debugger<--------->Classic Debugger
Note: The System gives a success massage as ‘watch point created’ once the watch point
is created.
Note: The program or source code is stopped once the set condition of created watch
point is reached.
7) Use the function keys F5/F6/F7/F8 to check line by line or block by block.
1) Once the program is stopped in debugger double click on the data variable name such
as variables, work areas, internal tables etc..
2) Once the compiler icon is crossed the statement line.
Note: The corresponding data variables, type & length are displayed when the cursor is
3) The corresponding values are displayed under value field or field contents.
EX: Field names : gv_char
Field contents : m
Note: Double click on the data structure variables (work area, internal tables) under variable
column to check
1) Once the program or source code is stopped in new debugger double click on data
variable name such as variable name, field name or field value of an internal table (scrolls
the data variable section in right hand side).
Note: Data variable values can be change while debugging in development systems only.
2) Double click on change contents icon that appears beside value column change data
variable value.
3) Press enter.
4) Use the function keys f5/f6/f7/f8 to check line by line or block by block.
Classic Debugger:
Each organization or company needs to print their documents such are Orders, Bills, and
Invoices…etc in their day to day business process.
The forms concept is used to design the documents or pages in the customer’s specific
format.
Following are the different types of techniques to develop the forms.
1) SAP Script forms.
2) Smart Forms.
3) Adobe Forms.
They are the client dependent since the contents are displayed or printed through text
elements.
SAP Script forms is the text management system to design the documents or pages in
the required format.
SAP Script form mainly contains two parts.
1. Form Painter (Layout set).
2. Print Program.
1. Header:
a) Administrative data:
BY MR. BABU (OASIS TECHNOLOGIES)
It contains the technical details such are Package name, Changed by, Created by
and etc…
It can also be used to maintain language attribute to translate a form into
different languages.
Note:
b) Basic data:
It is used to maintain the default basic settings which can be applied across
the forms.
The different basic setting one page format, orientation, font size etc.
Note: The first page and the default paragraph names must be specified once they are created
CH Characters
CM Centimeters
MM Millimeters
IN Inches
PT Point
TW Twips (1/20 point)
BY MR. BABU (OASIS TECHNOLOGIES)
Page format
DINA 4
Orientation
2. Pages:
MAIN Window It is the default window to display or print the main content of the
document continuously.
Note: 1). The system generates the pages dynamically for main
window.
2). Up to 99(099=100) main windows can only be created.
3). It is not possible to create SAP Script form without main
Window.
CONSTant Window The constant window can be formatted only once to print or
display the same contents on all the pages.
VARiable Window The variable window can be formatted for each page to print or
display the different contents.
GRAPHic Window It is used to print or display the graphics or logos.
4. Page Window:
Variable LOGO
Window
MAIN Window
Footer Window
a).Standard Attributes:
It is used to maintain the standard attributes such are alignment, line spacing,
left margin, right margin etc.
b).Font Attributes:
They are used to maintain the font setting such are font family, font size, bold,
italic etc.
Tabs: The numbers of characters of tab position are maintained under tab attributes.
6. Character Formats:
a).Standard Attributes:
They are used to select required barcode, super script, subscripts …. Etc.
b).Font Attributes:
They are used to maintain the font type, font size, bold , italic …. Etc.
Tag Meaning
Continues text
= Extended line
( Raw line
/ Line feed
/: Command Line
/* Comment Line
/E Text element
P Paragraph format
Symbols: The symbols are the constants which can be inserted on the page windows to
display or print the corresponding contents or Data.
Ex: &<Symbol>&
1. System Symbols.
2. Standard Symbols.
3. Application Symbols.
BY MR. BABU (OASIS TECHNOLOGIES)
1) System Symbol:
The system symbol are used to display or print the system data such are date, time etc..
Symbol Description
DATE System Date DD/MM/YYYY
DAY Day in DD (01, 02…)
number
MONTH Month in
number
YEAR The current YYYY
system year
TIME Time of the (HH:MM:SS)
current
system
HOURS The current (HH)
system Hours
MINUTES The current (MM)
system
minutes
SECONDS The current (SS)
system
Seconds
PAGE The Current
Page number
NEXTPAGE Next page
number
ULINE Horizontal
Line
VLINE Vertical Line
The system provided Standard Structure SAPSCRIPT contains some of the SAP Script
system fields.
Following are some of the useful system fields in the structure SAP SCRIPTS.
BY MR. BABU (OASIS TECHNOLOGIES)
FIELD Description
Note:- Number of pages like “1 of 10 ” can be displayed or printed using the system symbols
page and form pages as below.
&PAGE& of &SAPSCRIPT-FORMPAGES&
2).Standard Symbols:
They are used to display or print the processed data from the print program or
database.
Ex:-- &<WA_DBTAB-FIELD>&
&<DBTAB-FIELD>&
Note:-- It is not possible to execute SAP Script form without Print program of driver
program.
1. OPEN_FORM.
2. START_FORM.
3. WRITE_FORM.
4. END_FORM.
5. CLOSE_FORM.
6. CONTROL_FORM.
1) OPEN_FORM:
This function module is use to provide a link between Print program and SAP
Script form.
It can also be used to specify the default device name,
Control the dialog pop to choose the device etc.
Note:-- All the global data variables of the Print programs can be accessed in SAP Script form
after this function module is called to open a form.
BY MR. BABU (OASIS TECHNOLOGIES)
Below parameters can be passed
EXPORITNG
2) START_FORM: This function module is used to specify the starting page from which the
document to be printed, the below parameters can be pass.
EXPORTING
3) WRITE_FORM: This function module is used to pass the multiple entries of an internal
table from print program into “SAP Script form” to Print or display the multiple entries or line
items.
BY MR. BABU (OASIS TECHNOLOGIES)
Below parameters can be passed.
PAGE WINDOW
LOOP AT <gt_itab> INTO <wa_itab>.
**************************Refer Notes*************************
Logo Upload:
The transaction code SE78 or standard program RSTXLDMC is used to upload graphics or logos.
Once SAP Script form is in change mode click on settings menu item click on settings
menu item click on form painter.
Check the check box Graphical form painter.
Click on yes button.
Click on layout button.
Right click on the page layout.
Click on create graphic.
Select or enter the required logo name.
Select type of a logo either color/Black & White.
Note: An icon import can also be used to import the graphic directly.
Note: In the real time the form debugger is activated by using menu path.
Note: The system gives a success message to inform ‘Form Debugger is activated ’.
Note: Double click functionality cannot be used to check the symbol values like source code
Debugger.
The system provided standard program ‘RSTXSCRP’ is used to download and upload SAP Script
form.
Execute standard program ‘RSTXXSCRP’ enter SAP Script form name as object name.
Enter the mode IMPORT.
Note: The Standard program ‘RSTXXSCRP’ can also be used for standard texts and script form
Styles also.
Note: 1). the command /: SETSIGN RIGHT/LEFT can also be used to display or print sign of the
number symbols at Right or left hand side.
2) The check box sign at domain level should be checked to return sign of the number
field.
1. /:ADDRESS…..ENDADDRESS:
This command is used to display or print the address details of the given address
number in the standard format.
Syntax /: ADDRESS
/: ADDRESS number & GS_KNA1-ADRNR&.
/: ENDADDRESS
* OR
* Name: &GS_KNA1-NAME1&
* City: …………
This command is used to format the system date in the required format.
Syntax
BY MR. BABU (OASIS TECHNOLOGIES)
/: SET DATE MASK = ‘<DD.MMMM.YYYY>’
* Date: &DATE&
FORMAT DESCRIPTION
This command is used to format the system time in the required format.
Syntax
Note: Pass blank spaces to the formatted date and time to format them into default format.
1. IF…..ENDIF:
/: IF <condition1> AND <condition2>
/* Process Block
/: ELSE IF <condition5> OR <condition4>
/* Process Block2
.
.
.
BY MR. BABU (OASIS TECHNOLOGIES)
/* ELSE
/* ELSE Block
/* ELSE IF.
2. CASE…..ENDCASE:
/: CASE &FIELD_NAME/VARIABLE&
/: WHEN ‘<VALUE1>’
/* Process Block1
/: WHEN ‘<VALUE2>’
/* Process Block2
.
.
.
/: WHEN OTHERS
/* OTHER BLOCK
/: END CASE
Note:
There is no loop statements in SAP Script forms but the text elements can be used to
communication with the function module WRITE_FORM used within the loop of the print
program to display or print the multiple entries.
. *&GS_VBRP-POSNR&
ENDLOOP .
3. PROTECT…..END PROTECT:
This command is used to avoid page breaks in SAP Script forms.
BY MR. BABU (OASIS TECHNOLOGIES)
Syntax /: PROTECT
/E ELE
/: ENDPROTECT
DEFINE: This command is used to define the symbols in SAP Script the symbols in SAP Script
form.
BOX: This command is used to define the Boxes or frames on the page windows.
• The command position and size can also be used to define the box position and
sizes.
TOP…….ENDTOP: This command is used to display or print the contents at the Top portion of
specified window.
Syntax /: TOP
/: ENDTOP
/: BOTTOM
/: ENDBOTTOM.
BY MR. BABU (OASIS TECHNOLOGIES)
NEW-PAGE: This command is used to generate the new pages.
/: NEW-PAGE.
/: NEW-WINDOW.
PERFORM……ENDPERFORM(FORM ROUTIENS):
Form Routines are used to add additional functionality to SAP Script form without making any
changes in the print program.
/: USING <&IM_SYMBOL&>……
/: CHANGING <&Ex_SYMBOL&>……
/: END PERFORM.
* In program pool/Report.
FORM <FORM_NAME> TABLES <in_tab> STRUCTURE ITCSY
<out_tab> STRUCTURE ITCSY.
*Local Data declarations.
DATA: <ls_itcsy> TYPE ITCSY
*Get data from FORM.
READ TABLE <in_tab> INTO <ls_itcsy> INDEX <1>.”1st import symbol.
*Get data from DB table
SELECT…..
*out TAB.
READ TABLE <out_tab> INTO <ls_itcsy> WITH KEK name = ‘<EX_SYMBOL>’.
<ls_itcsy>-value = <lv_new>
*Modify <out_tab> FROM <ls_itcsy> INDEX <1>. “1st symbol.
.
.
ENDFORM.
ITCSY Structure:
This standard structure is use as a reference Import and Export the symbol with the form
routines in SAP Script form.
BY MR. BABU (OASIS TECHNOLOGIES)
Following are the field in the field in the structure.
FIELD DESCRIPTION
Standard Text:
The standard structure texts are used to maintain the long text.
NOTE: Standard function module READ_TEXT can also be used in the programs to read
standard text.
NOTE: The menu path GOTO Change editor is used to change the text editor.
NOTE: The system does not generate the TR number directly while saving the standard
texts.
The system provided standard report ‘RSTXTRAN’ is used to generate a transport request
number for standard text.
Once SAP Script form is in change mode click on page window button.
Double click on required page window.
Click on text elements icon.
Click on ‘Goto’ menu item.
Click on change editor Place a cursor on a line where the standard text to be
inserted.
Click on insert menu item.
Click on text.
Click on standard.
NOTE: The menu path INSERTTEXTHypertext is used to insert the Hypertext (web link)
on the document.
Application Texts:
The application texts are maintained for long free text in each functional transaction codes.
The standard function module READ_TEXT is used to read the application and standard
text.
BY MR. BABU (OASIS TECHNOLOGIES)
The standard tables STXH and STXL contain the application text data on technical
information such are text object name, text ID and etc.
Ex: Application
Text
From
VF02
Once the application text is displayed after text tab is selected in any function T-Code.
Note: 1. Corresponding technical details such as textID, text object etc are displayed in text
header window.
2. The technical field value should be passed “READ_TEXT” to read corresponding text
or application text.
Demo program on (sub routine pool) On Form routine ZB20_SUB_ROUTINE .
Transaction code SE72 is used to work with SAP Script form styles.
The command STYLE is used to specify the style name in SAP Script form.
Note: The menu path FORMAT CHANGE STYLE in the page menu can also be used to
change styles.
BY MR. BABU (OASIS TECHNOLOGIES)
Steps to create a style:
Note: Create any number of paragraph formats by pressing an icon create element or menu
path EditCreate element.
All the standard SAP Script forms are available in the client no. 000.
Following are some of the useful standard script forms and print programs.
Note: The standard table TNAPR (or) NACE T-Code can be used to find from details (or)
output type details.
The standard script forms are generally copied and made the changes to add an additional
functionality.
NOTE:-- Copied standard script form design must be changed by logging in original language
only i.e. DE-German Language.
NOTE:-- The copied custom Script form should be assign to an output type using the T-Code
“NACE”.
T-code Description
SE71 To maintain form painter.
SE72 To maintain SAP Script form style.
SE73 To maintain different types of forms and bar
codes.
SE78 To maintain graphics or Logo’s.
SO10 To maintain standard texts.
SE63 Translations to translate text in different
languages.
NACE To maintain output types.
Some of the useful Standard reports:
The reports which are related to SAP Script forms start with RSTX.
Smart Forms
Global settings:-
It is used to maintain the global settings, definitions which can be applied across the
smart forms.
Following are the different global settings.
BY MR. BABU (OASIS TECHNOLOGIES)
a) Form attributes.
b) Form interface.
c) Global definitions.
Form Attributes:-
It is used to maintain the general smart form attributes and output such are, page
format, style name etc……
Form Interface:-
It is the system generated function module with all the parameters except changing
parameters.
Global definitions:-
It is used to maintain the global definitions which can be used across the different
Global definitions.
i. Global data:-
It is used to maintain the global data definitions such are internal tables, work areas,
variables etc…………..
ii. Types:-
It is used to define the types which can be referred to declare internal tables and work
areas.
iv. Initialization:-
It is processed before the smart form pages and window are processed.
It is used to extract all the required data from the database table or views and process
the extracted data.
Note:- Import and export parameters must be specified before they are used
Ex:-
<LS_DBTAB> <GT_DBTAB>
BY MR. BABU (OASIS TECHNOLOGIES)
| |
| |
CLEAR: <LS_dbtab>
*Extract data
SELECT <f1>
SELECT<f2>
FROM <dbtab>
WHERE <__>
*Process data
END FORM
v. Form Routines:-
It is used to define the subroutines which can be called across the smart form.
It is used to define the currency or quantity fields as like the DDic tables or
structures.
vi. Currency or quantity fields:-
It is used to define the currency or quantity fields as like the DDIC tables or structures.
b) Graphics:
It is used to create a graphic node (window) to display or print the graphics or logos.
c) Address:
It is used to define the address node or window to display or print the organization
address or personal address or workplace address.
Note:- The address can be determined dynamically also using an option determine
Dynamically.
d) Text: It is used to display or print the contents of the different symbols or fields.
e) Table:
It is used to display print the dynamic data of an internal table
It can also be used as a template to display or print style static record by unchecking the
checkbox internal table.
Dynamic data-Table
Internal table <gt_tab> INTO <gs_tab>
F1 F2 F3
1 A B
2 C D
| | |
| | |
Static data-template
BY MR. BABU (OASIS TECHNOLOGIES)
( ) Internal table <> INTO < >
F1 F2 F3
1000 P Q
f) Template:-
It is used to display or print the static data(single record)
This node does not have the separate header, main area and footer whereas, the
table node contains the different sessions, and such are header, main area and
footer.
Note:-The template node can be used under loop node to display or print the dynamic data
Template as table:-
Ex: Loop_node………..
Template
Loop_node:-
Loop_node
BY MR. BABU (OASIS TECHNOLOGIES)
Internal table < gt_tab > into < gs_tab >
Template
Text node
Window
SELECT
|
|
Alternative Node:-
Command Node:-
BY MR. BABU (OASIS TECHNOLOGIES)
This node is used to go to a new page based on the specified conditions
i. Output options:-
It is used to maintain the required output options such are smart form style, frames, colors
etc.
Note:-The checkbox ‘page protection’ is used to avoid page breaks in smart forms.
Following are the different additional events which can be maintained under condition
The corresponding contents are not displayed or printed on the first page.
It is used to print or display the corresponding contents of the text nodes on the
specified page.
**********************Refer Notes***************
BY MR. BABU (OASIS TECHNOLOGIES)
Note:- An icon can also be used to see and execute the system generated function module.
Note:-
Ex:-
EXPORTING
Formname = <zsmart_form>
IMPORTING
steps to debug a smart form using the system generated function module:-
Note:- The system generated internal table %TEXT contains following fields which are filled
with the text node contents at run time.
Enter %TEXT.
Press enter button.
BY MR. BABU (OASIS TECHNOLOGIES)
Double click on an internal table %TEXT to check the corresponding contents of the text
node under TDLINE column.
The system generated internal table %TEXT contains following fields which are filled with the
text node contents at runtime.
Note:
SF_EXAMPLE _ 01
SF_ EXAMPLE _ 02
SF _EXAMPLE _03 |
Note: They can be maintained by selecting a radio button style in the transaction code
‘SMARTFORMS’
Note:-
Print preview of the paragraph and character formats can be seen in smart styles but
not possible in script form styles.
Follow the similar steps to create any number of paragraph formats by pressing create
node icon.
Note:- The font effects superscript and subscript are possible in smart styles and can be
maintained with character formats in SAP script forms.
Ex:
Note: Enter the smart style name under output option of the form attributes to apply the
styles for entire smart form.
Text module:
SFSY structure:
It is the system provided standard structures which contain a smart form system fields.
Field Description
PAGE Current page number
DATE
TIME
SUBRC
USERNAME
PAGENAME
WINDOWNAME
BY MR. BABU (OASIS TECHNOLOGIES)
Forms execution process in the real time:
The forms are mostly executed through the output types as below.
NOTE: In the real time the output types are maintained by the functional or basis consultants
V1-Sales
NOTE: Follow the above similar steps to find the form and print program details of the given
Output types.
Processing routines:
NOTE: The system proposes the customizing request since the maintenance view VN_T685B is
maintained.
NOTE: The button new entry is used to create new output types.
Click on Back.
NOTE: Standard table “TNAPR” contains all the output type and form details in the system.
ENTRY_NEU
BY MR. BABU (OASIS TECHNOLOGIES)
Form routine
FORM ZB20_SCRIPT_OR_SMF
Note: Use the standard function module CLOSE_FORM to get SAP Script form data in OTF
format.
*Pass flag to get smart form data in OTF then get it in OTF format
<gs_parameters>-getotf = ‘X’.
EXPORTING
….
Control_parameters = <gs_parameters>
IMPORTING
Job_output_into = <gs_otf_data>
*or
.
BY MR. BABU (OASIS TECHNOLOGIES)
*CLOSE_FORM
* TABLES
Convert the OTF data of the forms into a PDF format using the function module
CONVERT_OTF.
Populate the mail subject, mail body, receives list etc.
Use the standard function module.
SO_NEW_DOCUMENT_ATT_SEND_API1 to send an email with an attachment such as
PDF or excel etc.
Translations:
The T-Code “SE63” is used to translate the text symbols and text elements in different
languages.
Note: The menu item short text is used for repository text, ABAP text such are text element
messages text translation.
BY MR. BABU (OASIS TECHNOLOGIES)
Expand and hierarchy forms and style (FS).
Double click on SAP SMART FORMS (SSF) item.
Note: The sub item (forms) is used for SAP Script forms.
Note: Use any one of the translator to translate the required text of the source language into
a target language.
Copy and paste the translated text under the corresponding text element of the target
text section.
Ex: Source
/E &%TEXT
/* Date: &SFSY-DATE&
Target
/E &%TEXT1&
Note: 1. the system does not propose the transport request number for translations, hence
2. The object names in the translator are case sensitive (Only in upper case).
Note: The system generated TR is displayed against the line Transport request used:
DEVK900058.
Differences:
1. Customer Exits.
2. Business Transaction Events (BTE).
3. Enhancement frame work.
4. User Exits.
5. Business ADdIns (BADI).
6. Functional Routines
1).Customer Exits:
Customer Exits are available in most of the functional areas such are SD- Sales
and Distribution, Material Management (MM), Finance and Controlling (FI/CO)….
Etc.
They are used to add the additional functionalities in the standard applications or
programs, without using access key to break them.
Access key:
It is the unique key provided by the basis consultant or SAP People to break the
standard applications or programs.
The application or program will become custom development once they
are broken.
a) Field Exits.
b) Function Exits.
c) Menu Exits.
d) Screen Exits.
a).Field Exits:
They are used to change the field labels of the standard data elements.
b).Function Exits:
They are used to add an additional functionality to the standard applications or program
without breaking them.
BY MR. BABU (OASIS TECHNOLOGIES)
Each Function Exit contain a custom include program which starts with Z* to
implement the customer specific additional business logic.
The Function Exit is the three digit number which is called using the ABAP
statement
CALL CUSTOMER_FUNCTION.
Ex:
*Function Exit
IMPORTING
im_param =
..
TABLES
FUNCTION <funct_exit_name>.
Z<INCLUDE_NAME>
SELECT….
ENDFUNCTION.
Note: In the real time we mostly work with function exits.
c).Menu Exits: They are used to add the custom specific menu items and
corresponding additional functionality based on the selected menu item.
d).Screen Exits: They are used to add the additional screen elements and the
corresponding additional functionality to the standard screens, or application or
transaction codes.
The T-Code SMOD and CMOD is used to work with the Customer Exits.
T-Code SMOD: It is used to find the Customer Exits of the standard package.
Note: It is not possible to assign an enhancement or exit to more than one project.
BY MR. BABU (OASIS TECHNOLOGIES)
Different ways to find Exits: Following are different ways to find Exits.
a)Finding Packages:
Ex: VA02/VL02.
Ex: VA/MGA…
Click on execute.
2) Find the correct exit by analyzing the system given short text or by using
Note: All the Exits which are called using the statement
Note: Set the session break points for all the found locations up to 30 only at a time.
Perform the required action in the T-Code to stop the correct Exits.
The standard table MODSAP or MODACT can also be used to list out the
enhancement projects.
Scenario on Field Exit: Change the field table of the standard data element
DWERK_EXT – Deliver plant in the T-Codes VA01, VA02, VA03.
2. Finding Exit:
Execute the T-Code SMOD.
Click on utilities menu item.
Enter the required found package name.
Ex: SEDT/MGA/VA…..
Click on execute icon.
Click on find icon.
BY MR. BABU (OASIS TECHNOLOGIES)
Enter the required find string.
Ex: Attributes/check/save/function.
Press enter button.
Copy the font Exit names by pressing (Ctrl + Y).
Cancel the find windows.
Click on back.
Note: 1.Color of the traffic light will become green, once the project is activated.
Red – Inactive.
Green – Active.
2. The tick marks are appeared under Impl. Column once the Exits are implemented.
Note: Follow the similar steps to implement any number of Exits by double
clicking on them.
Scenario on MENU Exits: Add an additional custom menu item and the
corresponding additional functionality to the standard T-Code MC94 – Change plan.
2. Find Exits:
3. Project Creation:
Note: 1.An Icon undo activation is used to de-activate the enhancement project.
2. Click on back icon then use activate icon in case of not appeared in the
Components Screen.
Note: Press enter button then create an include program name for the first time.
Note:- The additional functionality such as call another T-code (SE11) is happened
Scenario on Screen Exits: Add the additional screen fields with the transaction
code MP01 (Maintain Approved manufacture parts).
Once the package name of the application or T-code is found then execute
SMOD.
Click on utilities menu item.
Click on find icon.
Enter the required found package name (ME).
Click on execute icon.
Click on find icon.
Enter appropriate find string (screen).
Press enter button.
Click on required found string.
Read the system given short text.
Copy the found exit name.
Note: -- Activate and Deactivate project in an initial screen of CMOD if they are not
appeared.
Double click on the system provided sub screen number of screen exit.
Press enter button.
Enter short description.
Click on layout button.
Click on dictionary or program fields windows (F6).
Enter the required table or structure name.
Ex: AMPL
Select the required additional field.
Ex: MATKL
Press enter button.
Place if on the screen by pressing left mouse button.
Click on activate icon.
Enter the package name.
Click on save icon.
Click on yes button.
BY MR. BABU (OASIS TECHNOLOGIES)
Click on the button maintain original language.
Click on back.
Click on flow logic and add the additional functionality.
Note: -- Use the system provided for exits.
Make sure the screen type ‘Sub screen’ is selected under attributes tab while
defining the sub screen.
The Business Transaction Events are also called Source code plug-ins to add an
additional functionality in the standard program or T-Code.
Each BTE is linked with the system provided interface to which the custom
function module can be assign.
The BTE are called using the function
OPEN_FI_PERFORM* and OUTBOUND_CALL*.
Ex:--
Standard program.
.
CALL FUNCTION ‘OPEN_FI_PERFORM
(or) OUTBOUND_CALL’…
BTE-0001490
ZCUSTOM_FUNCTION
The T-Code BERE and FIBF are used to work with BTE’s.
BY MR. BABU (OASIS TECHNOLOGIES)
T-Code BERE: It is used to find the BTE’s.
Scenario on BTE: It gives an information message while saving the vendor data (or)
sends a purchase order as a PDF attachment to an Email of the vendor.
T-code—XK02/XK01
Tables – LFA1/LFB1
Find BTE:
TO FM: ZB20_CUST_INTERFACE_00001400
*Give message.
1. Create Product:
They are pre coded by SAP and provided at the specific location in the standard
programs.
There are two types of Explicit Enhancement.
1. ENHANCEMENT-SECTION.
2. ENHANCEMENT-POINTS.
1. ENHANCEMENT-SECTION:
It is used to copy, change the existing standard source code and add additional
business logic to the standard program.
BY MR. BABU (OASIS TECHNOLOGIES)
The ABAP statement ENHANCEMENT-SECTION is used to specific the
enhancement sections.
2. ENHANCEMENT-POINT:
It is used add or plug-in the additional customer specific business logic to the
standard program.
Make the physical file path name in the standard migration program.
Ex: RMDATIND/etc.
Note:-- The system inserts the double coated lines (“ ” ” ”) in the certain locations
in the standard program.
Right click on the system inserted double coated line at the required location
such as beginning of the program or end of the program or end or beginning of
the subroutine… etc.
Click on enhancement implementation.
Click on create.
Click on create enhancement implementation icon (F8).
Enter the enhancement implementation name.
Enter short text.
Click on yes button.
Enter the package name.
Click on save icon.
Create TR by pressing create request icon.
Click on yes button.
Select the created enhancement name.
Click on yes button.
Implement the required customer specific additional business logic within the
system generated statement.
BY MR. BABU (OASIS TECHNOLOGIES)
Ex: -- “”””””””””””””””””””””””””””””””””””””””””””””””
ENHANCEMENT <n> <ZB20_IMPLICIT_ENHANCEMENT>
*Implement customer specific additional business logic
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = “%%%_PHY”.
SCREEN-REQUIRED = ‘1’.
MODIFY SCREEN.
EXIT.
ENDIF.
ENDLOOP.
ENDENHANCEMENT.
Click on activate enhancement buttons.
Press enter button.
Change the default value for an input field “Transactions per commit unit from
500 to 1000” in the standard report (RMDATIND) material master data upload.
Once the standard program is in display mode.
Right click on the system provided explicit enhancement section or point.
After an icon enhance is pressed.
Click on enhancement implementation.
Click on create.
Click on create enhancement implementation (F8).
Enter enhancement implementation name.(ZB20_EXPLICIT_ENHANCEMENT)
Enter short description.
Click on yes button.
Click on save icon.
Create the TR by pressing create request icon.
Click on yes button.
Select the created enhancement implementation name.
Click on yes button.
Implement the required customer specific additional business logic.
Note:-- Change the existing standard source code in case of enhancement
section.
BY MR. BABU (OASIS TECHNOLOGIES)
Sample:
“or ENHANCEMENT-SECTION
*$*$....start: BMVDEF00_03….
ENHANCEMENT 30 ZB20_EXPLICIT_ENHANCEMENT
MAX_COMM = 1000.
ENDENHANCEMENT.
USER EXITS
Note:The enhancement frame work is advanced to user exits for adding an additional
functionality without breaking the standard programs.
BADI’S
Business ADdIns:
These are the new enhancement techniques to add the additional customer specific business logic
to the standard programs.
The T-Code’s ‘SE18 & SE19’ are used to work with the BADI’s.
Subtypes are:
This is used to generate a new BADI object and sets the BADI reference to the objects in the
BADI reference variables.
Syntax :--
EXPORTING
Im_param
IMPORTING
.TABLES]
Note:
1. The multiple use option is not possible with the new BADI’s.
2. The filter dependent and multiple use options are possible with the classic BADI’s.
3. The BADI’s implementations are triggered in the specified order in case of the multiple
use BADI with different implementations.
BY MR. BABU (OASIS TECHNOLOGIES)
Object: It is a runtime instance of a class to provide the services.
Method:
Syntax:--
“Instance method.
“Static method.
Interface: It is a separate structure which can be used to extend the scope of a class.
1. Define BADI:
Note:
1. The check box multiple use can be unchecked for single use BADI.
2. The check box filter dependent BADI’s can be checked & specified the filter type in case
of filter dependent BADI’s.
3. Click on interface tab.
METHOD LEVEL
GET_DATA Instance method
Click on active.
Press enter button.
Click on methods button.
Note:
Follow the similar steps to assign the parameters for any number of methods.
Click on back icon.
2. Implement BADI:
Note:
Note:
This statement is used to refer the data objects such as class, interface, BADI definitions… etc.
*create an object
Click on activate.
Press enter.
Click back.
Note: Follow the similar steps to define the parameters for any number of methods.
Activate an interface.
Click on back.
Click on activate to activate an enhancements spot.
Click on back.
Note: Replace CALL METHOD statement with CALL BADI statement to call the methods
from a new BADI.
Program goes to runtime error (or) short down in case of a BADI does not have active
implements.
The fall back classes are used/defined to call the default methods in case of a
BADI doesn’t have any active implementations.
Note: The exceptions can also be raised to avoid such kind of errors.
Note: Define the parameters by placing a cursor on the method name if required.
Note: The system generates an import parameter FLT_VAR to pass the filter values for
controlling the business logic of the BADI.
Click on back.
Ex:
Standard BADI:
Note: An implementation selection/icon is used to list out the BADI implementation of the
package.
Note:
Note: Skip the break point for the unwanted action by pressing F8 function.
It contains the BADI interface name, class name, implementation name, definition name &
etc,Following are some of the useful fields:-
Field Description
INTER_NAME Interface name
FLT_VAL Filter value for filter dependent BADI
implementation
IMP_CLASS Object type name
IMP_NAME Business Add-in implementation
EXIT_NAME Business Add-in definition
Steps to implement a standard BADI:
Exits BADI’s
These are procedural ABAP based. These are OOABAP based.
It is not possible to assign an Exit to more than The multiple use BADI can be implemented
one project. for multiple types.
Filter values can be set to the Exits. Filter values can be set for filter dependent
BADI’s.
T-Codes CMOD & SMOD are used. T-Codes SE18 & SE19 are used.
NON SAP
SAP Interface
.Net/Java
1. RFC.
2. BAPI.
3. ALE/EDI/IDOC.
1
BY MR. BABU (OASIS TECHNOLOGIES)
RFC (Remote Function Call):
Note: SAP uses CPI-C (Common Programming Interface for Communication) protocol.
CPI-C
SAP CRM
SAP R/3 RFC-Interface
(or) Non
SAP
Synchronous RFC.
Asynchronous RFC.
Translation RFC.
Qued RFC.
1. Synchronous RFC:SRFC
In case of synchronous RFC both the systems (Sender or Source and Receiver or
Target)should be available while distributing the data. The next part of calling
program isn’t continued until call function is completed.
2
BY MR. BABU (OASIS TECHNOLOGIES)
2. Asynchronous RFC:ARFC
In case of asynchronous RFC both the systems need not to be available while
distributing data.
The next part of calling program is continued without completing call
function.
Note:In case of this RFC data may be lost since if target system is not available.
3. Transaction RFC:TRFC
It is almost similar to asynchronous RFC.
The transactional RFC is executed only once in an RFC server and save the
corresponding data under unique transaction ID (TID) in the DB.
4. Qued RFC:QRFC
In case of this RFC the multiple transactional RFC’s are serialized in the
sequence using the FM (TRFC_SET_QUEUE_NAME).
The multiple logical units of works (LUW) are processed in the sequence.
Syntax:
3
BY MR. BABU (OASIS TECHNOLOGIES)
.
CALL <ZREMOTE_FUNCTION/BAPI…>
*DESTINATION <DEV/QAS/PAS>
DESTINATION <gv_sysid>
IMPORTING
Ex_param =
EXPORTING
Im_param =
CHANGING
Chg_Param =
TABLES
Itab =
4
BY MR. BABU (OASIS TECHNOLOGIES)
User SAPUSER currentuser
Password INDIA123
Note:-- the check box current user can be checked to make use of the same user name
and password for the target system.
Click on save icon.
Click on remote login button to test the remote connection.
Click on back.
Distribute billing data from SAP R/3 system into CRM system through remote function call.
5
BY MR. BABU (OASIS TECHNOLOGIES)
ET_VBAP LIKE ZB20_STRCTR_VBAP
6
BY MR. BABU (OASIS TECHNOLOGIES)
2. The remote enabled functions can be used as normal function modules but the
normal functions can’t be used as a remote enabled function.
3. The external break points can be used to debug cross application components such as
RFC, BAPI across the system.
1. Custom BAPI:
7
BY MR. BABU (OASIS TECHNOLOGIES)
Note:-- the system purpose the meaning full field names while creating BAPI
structure.
Ex:-- MATNR MATERIAL
WERKS PLANT
Component field Component type Description
IMPORT:
Parameter Name Type Associated type Optional Pass value
TABLES:
Parameter Name Type Associated type
Note: The RETURN parameter must be defined for Remote enabled functions
since the expectations are not raised in the third party system (Non SAP).
Note: Release Remote enabled BAPI Function module using the menu path
Release Release before it is placed in BOR
8
BY MR. BABU (OASIS TECHNOLOGIES)
Place BAPI remote enabled function in BOR:
9
BY MR. BABU (OASIS TECHNOLOGIES)
Generate, implement and release custom BAPI:
Standard BAPI:
They are the system provided which can be used to distribute the data between
two SAP and Non SAP systems.
Some of the standard BAPI’s can also be used to migrate legacy system data
into SAP.
The standard BAPI function modules start with BAPI*.
10
BY MR. BABU (OASIS TECHNOLOGIES)
Different ways to find standard BAPI’s:
11
BY MR. BABU (OASIS TECHNOLOGIES)
Click on test sequences.
Enter the required BAPI to be tested along with the standard BAPI.
Ex:-- BAPI_TRANSACTION_COMMIT {fonction modules}.
Click on execute icon.
Click on details view or edit to fill the required fields of the structure under import &
tables parameters.
Note: --- Use an icon single entry to convert the fields arrangement vertically.
Click on yes button.
Click on back.
Click on execute icon after the required data is provided to the BAPI.
Click on back.
Execute the BAPI_TRANSACTION_COMMIT to commit the changes in the data base.
Click on back.
Note: -- Check the updated data in the corresponding data base table. Ex:
VABK/MARA…etc.
Scenario on Data Migration to create or change using the standard BAPI’s.:
Create or change the cost centers using the standard BAPI’s.
T-Code: KS01—create cost centers.
KS02—change cost centers.
Tables: CSKS,….
BAPI: BAPI_COSTCENTER_CREATEMULTIPLE_CREATE –Create Cost centers
: BAPI_COSTCENTER_CHANGEMULTIPLE_CHANGE- Change cost centers
12
BY MR. BABU (OASIS TECHNOLOGIES)
*OPEN DATA SET
* DO
*READ DATA SET…
.
*END DO
*Convert, Translate flat file data into BAPI compatible
LOOP AT <gt_file> INTO <gs_file>
*Convert and translate flat file data if required
*CONCATENATE …
*TRANSALATE…
*CALL FUNCTION ‘<CONVERSION_ROUTINE>’
MOVE: <gs_file_f1> TO <gs_bapi>
.
.
ENDLOOP.
.
*CALL BAPI function to Migrate flat file data
CALL FUNCTION <BAPI_...>
.
TABLES
<bapi_tab> = gt_bapi>
Return = <gt_return>
.
Steps to handle message in standard BAPI’s
1). Get all the message details into a written table of the type BAPIRET such as Message
ID.
Messages type, message variable … etc.
2). Use the standard function modules MESSAGES_INITIALIZE (Initialize messages),
MESSAGE_STORE (to store the messages) and MESSAGES_SHOW (to display messages is
the Dialog box/Model dialog).
Sample code:
.
.
CALL FUNCTION ‘BAPI*’
.
.
TABLES
Return = <gt_return> “type BAPI RETZ
13
BY MR. BABU (OASIS TECHNOLOGIES)
IF NOT <gt_return> [ ] IS INITIAL.
PERFORM <F_messages>
ENDIF
FORM <f_message>
*initialize message
CALL FUNCTION ‘MESSAGES_INTIALIZE’
*store messages
LOOP AT <gt_return> INTO <gs_return>.
CALL FUNCTION ‘MEESAGE_STORE’
EXPORTING
Arbgb = <gs_return>- id
Msgty = <gs_return>- type
Txtnr = <gs_return>- message-V1
.
.
ENDLOOP
*display messages
CALL FUNCTION ‘MESSAGE_SHOW’.
ENDFORM.
3). Extended BAPI:
Standard BAPI’s can be extended to add the customer specific additional field.
Standard BAPI contains tables parameter EXTENTIONIN, EXTENTIONOUT in case
of they are extended BAPI’s.
1. Add the additional customer specified into the relevant required tables and
structures using APPEND structure.
2. Create a custom structure for the check boxes.
3. Add the additional check box fields to the corresponding structure.
Ex: VBAP
VBAP KOZ customer modification structure
VBAP KOZX
BAPE_VBAP structures for BAPI’s.
BAPE_VBAPX
4. Populate an internal table (extension table) of the type BAPIPAREX with the
customer specific additional field and their data before BAPI is called.
5. Pass the populated extension table to the tables parameters EXTENTIONIN (or)
EXTENTIONOUT of the standard BAPI’s.
14
BY MR. BABU (OASIS TECHNOLOGIES)
Scenario on extended BAPI:
1. Add an additional field E-mail address using .APPEND structure into the required
tables and structures.
Ex: VBAP
VBAP KOZ
BAPE_VBAP
Field Data element Description
EEMAIL_ADDR AD_SMT PADR Email address
*APPEND
.
.
*Pass Extension table to BAPI
CALL FUNCTION ‘BAPI_SALESORDER_CREATEFORMDAT2’.
.
.
TABLES
EXTENSION = <gt_extension>.
15
BY MR. BABU (OASIS TECHNOLOGIES)
*Difference between RFC and BAPI:
RFC BAPI
1. The system does not generate any method 1. The system generates the unique method in
for remote enabled functions. BOR for BAPIs.
2.These can’t be used in all third party systems 2. The system generated method of the BAPIs
such as VB…etc. can be used in ant third party systems.
3. There are no standard remote enabled 3. Some of the standard BAPIs can be used to
functions to migrate the data. migrate the data from legacy system.
Authorization Objects:
These are used to protect user access to the data and T-Codes.
The authorization objects are maintained by BASIS consultants.
The T-Code ‘SU24’ is used to find authorization objects in the system.
The ABAP statement ‘AUTHORITY_CHECK’ OR the standard Function Modules
‘AUTHORITY_CHECK*…’ are used to check the authorizations.
Syntax:
.
.
AT SELECTION-SCREEN
PERFORM<f_auth_check>
.
.
AUTHORITY_CHECK OBJECT ’<OBJECT_NAME>’
ID’<ID_NAME>’FIELD<p_input/s_input/low..>
ID ‘ACTVT’ FIELD’<01/02/03>’.
*OR
*CALL FUNCTION ‘AUTHORITY_CHECK’.
.
.
IF sy-subrc NE 0.
MESSAGE ‘<Not authorized>’ TYPE ‘<E>’.
ENDIF.
16
BY MR. BABU (OASIS TECHNOLOGIES)
ENDFORM.
Note: Find an appropriate relevant authorization object by analyzing their object descriptions
and field name.
Double click on an authorization object to check the corresponding activity and field names.
EX:
OBJECT FIELD NAME ACTIVITY
K_CSKS KOKRS 01
KOSTL
3. ALE/EDI/IDOC’S:-
ALE: Application Linking Enabling.
EDI: Electronic Data Interchange.
IDOC’s: Intermediate Document.
A. ALEInterface: It is used to distribute the data between two different SAP system or
servers.
B. EDI Interface: It is used to distribute the data between SAP and non-SAP systems or
servers.
C. IDOC: It is a data carrier to carry the data between the distributed systems. Each IDOC
has three records
1. Control Record
2. Data Record
3. Status Record
1. Control Record:It contains IDOC type and Message type information, Partner
information such as partner system number, Port number of the sender and receiver
system.
It can also contain technical & address information of sender & recipients.
2. Data Records:These are the collection of segments.
17
BY MR. BABU (OASIS TECHNOLOGIES)
Segment is the collection of field which can be distributed between the systems.
Data Records
Segment1-EXXX
Segment2-E1XXX
.
.
3. Status Record: The status records contain the status of the processed IDOC to know where
an IDOC has been successful or failed.
The standard table EDIDC contains an IDOC information such as control records, different
statuses etc.
Following are some of famous message statuses:
TABLE DESCRIPTION
01 IDOC generated
02 Error while passing data to port
03 Data is passed successfully to port
04 Error within control information of EDI sub
system
20 Error while triggering EDI sub system
18 EDI sub system is triggered successfully
26 Error during syntax check of IDOC(Outbound)
32 IDOC was edited
34 Error in control record of IDOC
37 IDOC added incorrectly
50 IDOC added successfully
56* IDOC with error added
60 Error during syntax check of IDOC(Inbound)
63 Error passing IDOC to application
64 IDOC ready to be distributed to application
65 Error in ALE service
18
BY MR. BABU (OASIS TECHNOLOGIES)
75 IDOC is inbound queue
Note:
1. The sender system or source system is also called as ‘Outbound system’.
2. The receiver system or target system is also called as ‘Inbound system’.
3. The T-Code ‘WE30’ is used to maintain different types of IDOC such as basic IDOC, Ended
IDOC.
4. T-Codes ‘WE20’/’WE05’ are used to list out the generated IDOCs.
5. T-Codes ‘WE19’ are used to test or check IDOC.
Segment:It is a collection of fields with the data to be distributed between the systems.
The data record of an IDOC contains the segments.
Following are different types of segments:
Segments
Custom segments standard segments
Client& Version Dependent Client& version Independent
Following are some of the useful system provided standard message types:
Message Type Description
MATMAS Material Master
DEBMAS Customer Master
CREMAS Vendor Master
. .
19
BY MR. BABU (OASIS TECHNOLOGIES)
Note:
1. The standard table ‘EDIDC’ contains all available message type.
2. Standard maintenance view VEDI_EDMSG contains the maintain message type.
It is used to transfer data to the external system through Communication Layer(Out going
IDOC)
20
BY MR. BABU (OASIS TECHNOLOGIES)
Inbound IDOC Process
It is used to recieve data from sender sysem through communication Layer (Incoming IDOC)
Partner Profiles: These are used to maintain the partner system details with which data to be
distributed such as partner number, Partner type, and Message type of outbound parameters.
The T-Code ‘WE20’ is used to maintain partner profiles.
Ports: These are used to specify the way in which data to be distributedthrough an IDOC.
The systemgenerates one unique port number.
The T-Code ‘WE21’ is used to maintain ports for IDOC process.
Customer Distribution Model: It is used to define data distribution model to exchange the
messages between two logical systems.
T-Code ’BD64’ is used to define or maintain customer distribution model.
Some of useful Transaction Codes or Reports to send and receive the data to an IDOC:
Following are some of the useful T-Codes or Reports to send or receive the data through an
IDOC.
T-Code Description
BD10 Send Material
BD11 Get Material
BD12 Send Customer
BD13 Get Customer
21
BY MR. BABU (OASIS TECHNOLOGIES)
BD14 Send Vendor
BD15 Get Vendor
BD16 Send Customer
BD17 Get Cost Center
BD87 Reprocess IDOC
T-Code Description
SALE Basic configuration of ALE/IDOC
WE30 Maintain IDOC’s
WE02/WE05 Display generated IDOC’s
WE20 Maintain Partner Profiles
WE21 Maintain ports in IDOC processing
WE31 Maintain Segments
WE41 Maintain process codes
(Outbound system)
WE42 Maintain process codes
(Inbound systems)
WE81 Maintain Logical Message types
WE82 Assign message type to IDOC type
NACE Maintain output type
Note: Most of the T-Codes which are related to ALE/IDOCs start with WE* and BD*.
Process Codes: It is used to identify type of the data to be distributed through an IDOC
interface.
The process code can only be used with applications which perform outbound processing
message control(NAST-Structure).
T-Code WE41/WE42 is used to work with the process codes.
Through ALE/IDOC
Client: 800 Client : 810
22
BY MR. BABU (OASIS TECHNOLOGIES)
System ID: ECC System ID: ECC
Logical Systems:
LOG System Name
CLNT 800 Outbound system-India
CLNT810 Inbound system-US
23
BY MR. BABU (OASIS TECHNOLOGIES)
Click on save icon.
Click on Yes button.
Click on back icon.
Click on back icon.
c. Steps to create RFC Connections:
Expand an item communication.
Click on IMG Activity of ‘create RFC connections’ in the T-Code ‘SALE’.
Note: T-Code SM59 can also be used to maintain RFC destination or connection.
Select the RFC connection type ‘ABAP connections’.
Click on create icon.
Enter RFC destination name.
Enter description.
Enter application server of the target system and the system number.
EX: Target Host gcecc62 System number 00.
Click on logon and security tab.
Enter logon credentials of the target system/ destination.
EX: Language:
Client: 810
User: SAPUSER
PW status: IS initial
Password: india123.
Click on save icon.
Click on Yes button.
Click on Remote Logon button to test the Remote connection.
Click on back button.
Note: The RFC connections to be maintained in the target system or Inbound system also(810).
24
BY MR. BABU (OASIS TECHNOLOGIES)
Enter Sender Logical system name, Receiver Logical system name and enter an
appropriate message type name(MATMAS).
Click on Yes button.
Click on Environ ment menu item.
Click on Generate Partner Profile to generate Partner Profile and Port number.
Enter Partner logical system name. Ex: CLNT810.
Click on execute icon.
Click on back.
Click on back.
Click on edit menu item in an initial screen of ‘BD64’.
Click on model view.
Click on distribute after model view is saved.
Click on Yes button since the receiver logical system is selected.
Note:The system gives a message ‘Model view has been created’.
The distributed model view is appeared in the target system or client ‘Inbound system’.
EX: Client: 810
25
BY MR. BABU (OASIS TECHNOLOGIES)
EX: Material: OASIS MATERIAL
Industry Sector: Service Provide
Material Type: Competitive
Press Enter button.
Select the basic view. Ex: Basic View
Press Enter button.
Select Material description.
Enter an appropriate base unit of measure.
Click on save icon.
26
BY MR. BABU (OASIS TECHNOLOGIES)
1. The generated IDOC is listed IDOC 0000000000757745.
2. Check the distributed material in the target system(‘Outbound’ system)using MM03.
Standard Reports of ALE/IDOC: Most of the useful standard report which are related to RBD*.
Following are some of the useful Reports or Programs.
Report Name Description
RBDAGAI2 Reprocess IDOC after Inbound ALE/ IDOC
RBDAGAIN Reprocess outbound error IDOC
RBDAPP01 Inbound processing of IDOC ready for
transfer
RBDCHECK Check IDOC structure against database tables
RBDCVS15 Generate Partner Profile
RBDOUTPU Process outbound IDOC
RBDPROCESS IDOC Processing
RBDMOIND Status conversion with successful TRFC
execution
Extended IDOC:
Extended IDOC can also be extended with the additional fields in the segments.
2. Creation of segment:
Execute the T-Code ‘WE31’.
Enter the custom segment name (ZE1LFA1).
Click on create button.
27
BY MR. BABU (OASIS TECHNOLOGIES)
Enter short description.
Define the required fields.
Click on save icon.
Click on Yes button.
Enter the Package name.
Click on save icon.
Create the TR by passing create request number.
Field Data Element
VEN_EMAIL AD-SMTPADR
. .
. .
28
BY MR. BABU (OASIS TECHNOLOGIES)
ZE1LFA1
E1LFA18
Click on back icon.
29
BY MR. BABU (OASIS TECHNOLOGIES)
Expand custom exits.
Double click on enhancements.
Enter an appropriate short text. (Customer / vendor).
Note: Use search pattern *SAPLKD* in SE37 to find the function exits foe vendor master IDOCs.
EX: EXIT_SAPLKD01_001-> Create vendor segment exit.
EXIT_SAPLKD02_002-> Read and Post vendor segment entry.
EXIT_SAPLKD03_003-> User Exit customer & vendor distribution.
Execute the T-Code -SE37.
Enter an appropriate Exit name.
EX: EXIT_SAPLKD01_001.
Click on display button.
Double click on the custom include program name.
Press Enter button for the first time in case.
Click on display or change icon.
Add the additional business logic to populate the IDOC with the required data.
30
BY MR. BABU (OASIS TECHNOLOGIES)
Lv_tabix = sy-tabix.
Ls_idoc_data-sdata = ls_ZE1LFA1.
*modify an IDOC with additional data
MODIFY idoc_dataFROMls_idoc_data INDEX lv_tabix.
ENDIF.
ENDIF.
Click on pretty printer button.
Click on activate icon.
Press enter button.
Click on back button.
31
BY MR. BABU (OASIS TECHNOLOGIES)
Click on save and click on back.
Get the vendors using the T-Code BD15.
Custom ALE/IDOC:
Refer the document, demo program on function module to practice custom IDOC.
Note: The function module ‘MASTER_IDOC_DISTRIBUTE’ is used to generate the IDOC in the
custom report.
32
Opportunity Processing - General
Status: In Process
1. Requirements/Expectations
a. Demonstration
b. Initial Need analysis
c. Go/No decision
d. Develop solution proposal
e. Quotation
f. Customer decision
2. General Explanations
With opportunity processing in SAP CRM, LG ELEC can perform the following.
The Opportunity describes the customers (sales prospects), their requested products and services,
the total volume of the customer project, the potential sales volume, and an estimated sales
probability. This information becomes more and more concrete throughout the sales course, and
should be updated regularly by the sales employee.
• Sales cycle
• Current phase within the sales cycle and date on which this phase began
• Status of the opportunity and the date since the opportunity has had this status
Forecast Data
• Expected net value of products or services (this is the cumulated, expected product
value from the items)
• Budget which the customer (sales prospect) has access to for the project
In each phase of the sales cycle, LG ELEC users can decide whether or not the data for the
expected sales volume should be entered for the sales volume forecast. LG ELEC users can carry
out an evaluation of all opportunities belonging to the group "New Customers", or an evaluation
of all opportunities belonging to the group "Longstanding Customers" – even when LG ELEC
users work globally, and, for example, if a different transaction type is used in the USA than in
Europe.
In the opportunity, create, change or display different text types for own use or for
correspondence with business partners.
For the qualified leads, CRM user can proceed for opportunity processing.
• CRM user will check for contact person details, if not identical through account
processing new BP with category Person will be created
• CRM user will check the role of business partner and status of business partner if the
role of the business partner is maintained as sold to party and status as registered /
incorporated, CRM user will precede for creation of quotation.
• If business partner role is still in prospect level CRM user will extend the business
partner master data to the respective unit.
• Finance will notify the about the status of the business partner.
• CRM user will create quotation and forward to customer for approval.
• Based on customer approval, respective CRM user will update opportunity won/lost
and close the opportunity.
Data relevance for opportunity process.
CRM user will maintain sales cycle and proceed in accordance with sales phases suitable
for the respective opportunity.
Sales Phases
• Identify Opportunity
• Value Preposition
• Qualification
• Exchange Information
• Quotation
• Decision
• Close
1. With movement of one sales phase to another sales phase system will capture the Phase
History (Duration in no of days)
2. CRM user will assign the respective Product / Service to the opportunity.
• Demonstration (Date)
• Initial need analysis (Date)
• Go/No decision (Date)
• Develop solution proposal (Date)
• Quotation (Date)
• Customer decision (Date)
4. At the end of opportunity CRM user will maintain the following status and reason code
for the status.
a. Won
b. Lost
c. Stopped by Us
d. Stopped by Customer
7. Description of Improvements
With establishment of opportunity process LG ELEC users can have a framework for
displaying sales cycle from the beginning, to ending. This process will allow LG ELEC
users to monitor their success to identify number of opportunities won / lost.
Syntax:
1. Global class
2. Local class
The global class and the attributes can be referred across the system
The T-code SE24 is used to work with global class.
2. Local Class: The local class are defined and implemented in the same program.
Definition section
Implementation section
a)Classdefinition: This section is used to define (or) declare the different attributes such
as data objects, constants, methods etc.,
Syntax:
CLASS<class_name>DEFINTION
*visibility section
PUBLIC CLASS
BY MR. BABU (OASIS TECHNOLOGIES)
DATA:<gv_var(10)> TYPE c,
METHODS:<method_name>,
ENDCLASS.
Syntax:
*class implementation
CLASS<class_name> IMPLEMENTATION.
METHOD:<method_name>...
*get data.
SELECT
........................
ENDSELECT.
ENDMETHOD
ENDCLASS
The internal tables must not be declared with header line (or) occurs in the class.
The ABAP statement ‘LIKE’ cannot be used to define the data objects in the
classes
The selection-screens of the report statementcannot be defined within the class.
TYPEREFTOstatement: this statement is used to define the different type of objects such as
classes, interfaces, BADI definitions etc.,
i. PUBLIC SECTION .
ii. PROTECTED SECTION .
iii. PRIVATE SECTION .
Public Section.
Protected Section
Private Section
VISIBILITY SECTION SAME SUBCLASS ANOTHER
CLASS EXTERNAL CLASS
Public section. YES YES YES
ENDCLASS.
BY MR. BABU (OASIS TECHNOLOGIES)
i. Instance Attributes
ii. Static Attributes
1. Instance Attributes:
SYNTAX:
CLASS<class_name>DEFINITION.
* Visibility section
PUBLIC SECTION
* Define IntanceAttibuttes
.......................
PROTECTED SECTION.
EXPORTING
DATA:........
..............
ENDCLASS.
...............
BY MR. BABU (OASIS TECHNOLOGIES)
START OF SELECTION
* Reference
* CREATE OBJECT
CREATE OBJECT<REF_CLASS>.
syntax:
2. Static Attributes :
They are existed only once but can be used for any number of instances.
The ABAP statement “CLASS --” is used to prefix to plain ABAP data declaration (or)
definitions statements to define static attributes.
The class name should only be used to access the static attributes but not class
reference.
The static attributes connector symbol (===>) is used to refer the static attributes.
syntax:
CLASS-DATA:<gv_static>....
CLASS-METHODS: <static_meth>....
METHOD:
METHOD<meth_name>.
*Process Block
.
.
.
SELECT ..............
.
.
.
ENDMETHOD.
NOTE: The function method have only one return parameter without any importing and
exporting parameters.
syntax:
IMPORTING<Im_param>...,
EXPORTING<Ex_param>...,
They are the special methods and named as CONSTRUCTOR (Instance) and
CLASS_CONSRUCTOR (Static).
BY MR. BABU (OASIS TECHNOLOGIES)
Constructors are called at run time automatically while creating an object.
The constructors should be defined under PUBLIC SECTION only.
The instance constructor can have only Importing and exceptions but not Exporting
parameters.
The static constructor cannot have any Importing and Exception parameters.
syntax:
* Instance constructor
METHODS: CONSTRUCTOR IMPORTING......., .
*Static constructor
CLASS_CONSTRUCTOR,
.
.
.
EVENTS IN OOABAP:
SYNTAX:-
CLASS<class_name> DEFINITION.
EVENTS : ,event_name>.
ENDCLASS.
IF SY-SUBRC NE 0.
* Raise Event.
Raise<Event_name>.
.
BY MR. BABU (OASIS TECHNOLOGIES)
ENDIF.
Event Handler:
It is used to call method of one class in another class to make use of same
functionality.
The additional statement" FOR EVENT" is used to define the methods with event.
The ABAP statement " SET HANDLER" is used to access attributes of event
handler.
SYNTAX:-
CLASS<cl_event_handler> DEFINITION.
PUBLIC SECTION.
ENDCLASS.
* IMPLEMENT <cl_event_handler>.
CLASA<cl_event_handler> IMPLEMENTATION.
METHOD<event_handler>.
*Bussiness logic
ENDMETHOD.
ENDCLASS.
TRY....CATCH...statements:
BY MR. BABU (OASIS TECHNOLOGIES)
This statements are used to try the specified bussiness logic (or) methods and
catch the specified messages in case of fail.
SYNTAX:
TRY
CALL METHOD..............
CATCH <message>.
ENDTRY.
Properties OfOoabap:
Class, objects,etc.
3.Inheritance:
This property is used to adopt the properties of a parent class to the child classes
(subclasses).
The ABAP statement “INHERITING FROM" is used to define the subclass by adopting
the properties of parent class.
CLASS<class_name> DEFINITION....
.
BY MR. BABU (OASIS TECHNOLOGIES)
.
ENDCLASS.
ENDCLASS.
METHODS:<final_meth>.....FINAL.
ENDCLASS.
4.Polymorphism:
SYNTAX:
BY MR. BABU (OASIS TECHNOLOGIES)
* SUBCLASS
METHOD: <meth_name>............REDEFINITION.
5. Interfaces InOOABAP:
They are the independent structures which can be used to extend the scope of the
classes
The ABAP statement “INTERFACE" is used to define the interfaces.
The interfaces do not have their own implementation sections.
The ABAP statement “INTERFACES" is used to access the interfaces in a class.
The symbol "~ (tilt)" is used to refer the attributes of the interfaces.
Syntax:
*Define interfaces
INTERFACE<int_name>.
METHODS:<inter_meth>
ENDINTERFACE.
* Specify Interface
CLASS<class_name> DEFINITION.
PUBLIC SECTION.
ENDCLASS.
METHOD<int_name> ~ <int_meth>.........
ENDMETHOD.
ENDCLASS.
Up Casting:
Eg:-<cl_superclass> =<cl_subclass>.
NOTE: It is not possible to access the sublcass own methods incase of upcasting.
Down Casting:
NOTE:Incase of Down casting the subclass own methods can also be accesed.
Create one new instance to access the attributes of a super class after up casting.
BY MR. BABU (OASIS TECHNOLOGIES)
GLOBAL CLASS:-
NOTE:
1. Use the button create inheritance to create the subclass by inherting the existing
super class.
2. The default class is final class.
3. Uncheck the checkbox "FINAL" to create normal global class.
4. In case of persistent class no need to create an object and the sysytem generates
the defaults class.
Click on yes button.
Enter the package name.
Click on save button.
Create the "TR" by pressing an icon create request.
Define the required methods.
EG:
NOTE:-Follow the similar steps to define the parameters for any number of methods.
STEPS TO CALL THE METHODS FROM THE GLOBAL CLASS (OR) INTERFACE:
EG:
CREATE OBJECt<cl_ref>.
The data types of the method parameters and data types by passing parameters
variables should be similar. Otherwise program goes to short dump.
USES OF OOABAP:-
It can be started with any letter. It should start with Z*/Y* in case of
custom.
It can be defined and implemented It must be defined and
in any source code. implemented using t-code se24.
1. The system provided standard classes which start with "CL_GUI" are used in OOALV
reports.
EG:
CL_GUL_CUSTOM*/DOCKING.............
2. The system provided standard table types and structures with start with "LVC*" are
used for different types which can be used for OOALV reports.
NOTE:
The standard type group "SLIS" is used in case normal ALV reports.
3. The custom control in screen painter to be created to display the data in OOALV
reports.
BY MR. BABU (OASIS TECHNOLOGIES)
SOME OF THE USEFULL STANDARD CLASSES TO DISPLAY AND FORMAT:-
NOTE:
In the real time the standard system provided class "CL_GUL_ALV_GRID" is mostly
used to work with grid format.
DOUBLE_CLICK:- This event handler method is used to provide the double click
functionality in OOALV reports.
HOTSPOT_CLICK:-This event method is used to provide double click functionality
based on the hand symbol click.
TOP_OF_PAGE:-It is used to populate and display header data in OOALV reports.
MENU_BUTTON: It is used to call the menu status to define the pushbuttons in
OOALV.
USER_COMMAND:- It is used to provide an interactive functionality based on the
performed active.
SET_TABLE_FOR_FIRST_DISPLAY: This method is used to display the final data in grid
format.
3. Splitting container: It is used to split the container into different parts to display the
multiple grids in OOALV.
I t is not possible to display the data in any position (Docking) in normal ALV
reports.
It is not possible to display multiple grids in normal ALV reports
BY MR. BABU (OASIS TECHNOLOGIES)
The standard class “CL_GUI_SPLITER_CONTAINER" OR
"CL_GUI_EASY_SPLITER_CONTAINER". Is used to work with Splitter Container.
1.LVC_T_FCAT: This table type can be used for filed catalogue for OOALV.
NOTE: It can be compared with the type SLIS_LAYOUT_ALV of the type group SLIS in
normal ALV.
EXECUTE
Input/output field
Custom Control
BY MR. BABU (OASIS TECHNOLOGIES)
Ex:
CREATE OBJECT<rf_grid>
EXPORTNG
SYNTAX:
CREATE OBJECT<rf_split>
EXPORTING
PARENT = <rf_split>bottom_right_container
ORIENTATION = CL_GUI_EASY_SPLTTER_CONTAINER →
ORIENTATION_HORIZONTAL/ ORIENTATION_VERTICAL.
BY MR. BABU (OASIS TECHNOLOGIES)
NOTE: the instance method ‘TOP_LEFT_CONTAINER’
‘BOTTOM_RIGHT_CONTAINER’ as the splitter class
‘CL_GUI_SPILTTER_CONTAINER’ to be passed to an export parameter I_PARENT
as the split class.
SYNTAX:
CREATE OBJECT<rf_grid>
EXPORTING
This method is used to generate dynamic internal table based on the fields
populated in a filed catalogue of the type "LVC_T_FCAT".
Eg:
*field symbols.
FILED-SYMBOLS: <<gs_line>>,
Populte filed catalog with fixed and dynamic fileds by setting a loop.
Fixed coloumns.
<gs_dyn_fcat>-col_pos = '1".
.
BY MR. BABU (OASIS TECHNOLOGIES)
APPEND <<gs_dyn_fcat> to <gt_dyn_fcat>.
*dynamic coulmns
<gs_dyn_fact>-filedname= <gs_data-filed>.
ENDLOOP.
EG:
EXPORTING
IMPORTING
Eg:
<<gfs_tmp>> = "profit".
Note: The sandbox system or client is optional. That means it may or may not be there in the project
Land scape.
Note: The learning system (ides) is not part of real time system land scape.
Development system:
It is used to develop objects, change existing objects and maintain configuration changes.
It can also be used to perform unit test or self-test, release the objects and functional configuration.
This system contains at least 2 clients and an optional sand box client.
The system id and client numbers could be different from project to project.
It is used to develop objects, change existing objects and maintain configuration changes.
It is used to perform unit test or self-test for preparing unit test documents (utd).
Note:
Note: The custom table or maintenance view with the delivery class ‘A-Application table’ can be
Quality system:
It is an environment where all the developments, changes and configurations are tested without any
errors by the consultants, testing team and by the customers or end users.
The system ids and client numbers will be different in each project.
This system contains a single client number.
Production system:
It is an environment where the customers or end users maintain live data or original data.
It also called live system.
The system contains a single client.
The system id and the client numbers are different in each project.
Note:
1. The consultants are not authorized to execute any transaction codes unless the authorizations are
given in between special cases and unless the project is production support project.
2. In some of the projects there may be pre-production system (optional).
BY MR. BABU (OASIS TECHNOLOGIES)
3. The developments, changes and configurations are released from one system to another
system (Development Quality Production) by releasing corresponding transport request (TR)
using Transport organizer or correction and transport system (CTS).
It is an environment to develop the objects, make the changes and maintain configurations at initial
stages of the projects.
All the consultants are authorized for any transaction code in this system.
This system is an optional system.
Note: In most of the projects 3rd party security gateway tools either VPN or CITRIX is used to connect the
Different Objects:
i. Local objects
ii. Transportable objects
Local objects:
Note: Create local objects for practice or R&D in case of the project land scape does not have sandbox system.
Transportable objects:
Package:
It is a collection of transportable objects.
The package must be used to save all the transportable objects and generate TR.
BY MR. BABU (OASIS TECHNOLOGIES)
ii. Correction and transportation system (or) transport organizer:
This tool is used to record the changes made in the system.
It can also be used to release or maintain the transport request.
T-codes: SE09/ SE10/ SE01 are used to work with transport organizer.
Transport Request-TR:
It is the unique number generated by a system for all transportable objects and Configurations.
The transport requests are generated in development client only then release them from development
client.
Transport request number starts with development system id followed by K-series number.
Ex: <R3D>K9<*****>
i. Workbench
ii. Customizing
iii. Transport of copies
iv. Relocations
Workbench request:
They are used to record the changes or workbench objects such as DDIC objects, programs, function
modules etc. and release them from one system to another system.
Customizing request:
They are used to record and release the customization or configuration changes in the system.
Transport of copies:
They are used to transport the sub objects of the main object from one system to another system.
Relocations:
They are used to change the objects from one package to another package.
Note: 1.In the real time the technical consultants mostly work with work bench requests and rarely work
Ex: ZDEV/ZSD/ZMM….
Note: The objects are saved as local objects under the temporary package $TMP in case of the button
Note: The system generated TR number which starts with the development system id followed by
K-Series number.
Ex: R3DK900028.
Note: The button own requests is used to make use of the existing transport request numbers.
Click on yes.
Note:
1. The objects under the TR must be activated before the transport requests are released.
2. The tick marks are appeared beside the task numbers once they are released.
3. Place a cursor on the TR number after all the corresponding tasks are released.
Click on release directly icon.
Note: 1. one tick mark is appeared beside the released transport request.
2. The released TRs are moved from modifiable status into released status.
Note: follow the similar steps to remove any number of objects from the task or TR.
Place the cursor on the task number after all the corresponding objects are deleted.
Click on delete and click on yes button.
Place the cursor on tr after all the corresponding tasks are deleted.
Click on delete icon click on yes button.
Steps to change short description of TR:
Once the transport requests are displayed in transport organizer.
Note:
1. The transport request is moved from the previous owner into new owner list.
2. Change the previous owner in initial screen of transport organizer (SE09) into new user name then
release the tasks and transport requests.
3. The system proposes new task number in case of the TR is already created by another user on same
subject.
4. The system proposes new TR to make the changes in the objects in case of the existing TR is
released to quality system.
5. Multiple TR can be merged using the function ctrl+F12 by right clicking on corresponding TR.
Steps to import client dependent changes into unit test client:
Execute T-code ‘SCC1’ in unit test client.
Enter the required transport request number from which the client dependent changes to be imported.
Note:
1. The script form changes the table entries, maintenance views entries, standard test etc must be
imported into unit test client to perform self-test and prepare unit test document.
2. In case of the custom tables or maintenance views with delivery class ‘a’ can be maintained in the
unit test client, quality system and production system directly.
Up gradation: - In case of this project customers or clients will go for new versions of SAP since they might be
Using older versions.
Ex: - SAP 4.6 / SAP 4.7 /SAP ECC 5.0 / SAP ECC 6.0.
Note: - The T-codes “SPDD & SPAU” are used to compare 2 different versions in up gradation project.
Note: - Any one of the tools such as ‘PANAYA’ or ‘SAP SOLMAN’ is used in up gradation project.
Support & Maintenance: - The customers or end users need support in their day to day issues.
In this kind of projects the consultants provides support to resolve the issues of the
Customers.
Note:- In support cum maintenance projects Tickets or Change requests are resolved as per SLA.
SLA: - Service Layer Agreements
Note: - The highest priority tickets ‘P1’ are mostly related to functionality and servers but not ABAP changes.
Roll Out: - In this kind of projects the existing SAP implemented business process will be extended into another
country or company code or plant.
BY MR. BABU (OASIS TECHNOLOGIES)
Phases in SDLC (Software Development Life Cycle) : -
A. Waterfall methodology: -
• It is also called sequential methodology.
• In this methodology phase by phase is performed.
• It is not possible to go back previous phase unless the testing is done.
• Process starts with the below phases in the same order
B. Agile Methodology: -
• In case of this methodology the customers can change their requirements without impacting timelines.
• It is more flexible to prioritize requirements
• It is better interactive methodology
BY MR. BABU (OASIS TECHNOLOGIES)
Different methodologies in SAP streamlined projects : -
Following are different methodologies used for SAP streamlined projects such as
Implementation & Up gradation.
1. ASAP Methodology.
2. Scrum Agile Methodology.
ASAP Methodology : - ASAP stands for “Accelerated SAP Methodology”. It is the SAP provided standard
Methodology to implement or upgrade SAP projects.
Note: - Functional consultants will provide the application training to customers or end users.
BY MR. BABU (OASIS TECHNOLOGIES)
Go live & Support: - In this phase below activities are performed.
• Hand over the implemented business process in SAP.
• Release all the configurations, customization, developments & enhancements.
• Provide the limited post-production support.
Run: - The implemented business process is shown by running it in the live system.
Scrum Agile: -
• In this methodology the customers or end users are also part of each phase of the project.
• The customers may change the requirement while implementing also.
• Following phases are involved in scrum agile.
Sprint planning: -
In this phase the task or work is assigned for 2 weeks or one month based on the resources availability.
Note : -
• Resources availability will be considered 65% to 70% during sprint planning .
Sprint Retrospective: - In this phase each resource is asked for their comments.
BY MR. BABU (OASIS TECHNOLOGIES)
• What went wrong or good?
• What are the improvements?
Note: - This methodology can be used for both implementation & support or Manianence projects.
The below steps are involved in getting & delivery the objects.
BY MR. BABU (OASIS TECHNOLOGIES)
Note: - client interview may be happened to get the project once we join in the company.
Offer letter
BY MR. BABU (OASIS TECHNOLOGIES)
Note: Complete below task immediate after you get into company.
o Upload resume in company format in their job portals (In case of Permanent )
o Declare Investments in their tools to save Income tax (In case of Permanent)
o Put hours (9 hours a day) against the given charge code or WBS (Work Breakdown Structure)
of the Project.
Note: - Each client or project is assigned to one unique charge code from which the chargeability or billing will
Be collected.
Note: One unique mail-id is given with the combination of our name.
Ex : - <your_name>@company.com
Microsoft communicator: -
It is used to communicate the company people voice calls, video calls, screen sharing.
• Knowledge transfer (K.T) is given to understand the system landscape, tools, programming standards,
release process and etc.
Note: - Some of the K.T documents such as programming standards etc. are provided during K.T.
• The logon credentials such as user name, initial password different tools and SAP system are provided.
Project M.S Outlook / M.S Communicator – client people.
Work-> F.S/F.D
BY MR. BABU (OASIS TECHNOLOGIES)
Some of useful tools in the projects: -
System Access: - The below third party security gateway tools are used to connect into client desktop or
SAP systems.
Your Desktop
Citrix
Client Desktop
SAP
PW
SAP
Connect to VPN
SAP
Tools for ticket handling: - Any one of below tools are used in support and maintenance project to maintain
Note: - The data migration tool ‘Panaya’ is used for migration projects.
Share Point.
Document Explorer.
TFS - .Net.
Note: - The task or work is assigned through mails (M.S Outlook) by team lead or Functional Consultant.
iv Performance tools
Perform before the objects are given for code review or before the
This tool is used to list out the errors, warnings, messages in the programs or source code and rectify them.
The T-code “SLIN” or the menu path.
Program -> Check -> Extended program check is used to work with this tool.
Code inspector: -
This tool is used to perform the different types of checks such as Security checks, performance checks &
Syntax checks.
It can also be used to perform different checks for all the objects under one T.R.
The T-code “SCI” or Menu path.
Program -> check -> code inspector is used to work with tool.
Steps to perform with this tool : -
Enter the required program name in ‘SE38’.
Click on program menu item -> Check -> Code inspector.
Expand appropriate checks such as Syntax checks or performance checks or Security checks.
Read & understand the system given messages rectify them.
Analysis: -
Click on ‘Hit List’ icon.
Place a cursor on ‘NET’ column.
Click on an icon sorting descending order.
Place a cursor on a required statement or called which is consuming more time in our program.
Click on ‘Display or Source code’ icon.
Make the necessary changes to improve the performance of the program by using the performance tips.
Activate the program or source code.
Click on ‘back’ icon.
Note: - Follow the similar steps for any No of statements or calls which are related to our standards.
Note: - Perform Runtime Analysis too again to refresh the list by deleting existing Runtime.
Steps to know performance tips & tricks in SE30: -
Execute T-code SE30.
Click on the button “Tips & Tricks”.
Expand the required performance Tips.
Ex: - SELECT vs SELECT LIST.
Double click on performance example.
Go through the system given documentation to know which statement is advisable.
Click on the ‘Measure Runtime’ button to check the Runtime different.
SQL Tracer : -
BY MR. BABU (OASIS TECHNOLOGIES)
This tool is used to know the indexes either primary or secondary which are consider while extracting the
data.
The T-code “ST05” or menu path
System -> Utilities -> Performance trace is used to work with this tool.
Steps to perform SQL Tracer : -
Execute the T-code “ST05”.
Click on ‘Activate Trace’ button.
Execute the required T-code or program in another new session.
Perform the required action such as save data or execute button.
Open SQL tracer session.
Click on the ‘Deactivate Trace’ button.
Click on ‘Yes’ button.
Note: - Use an icon ‘Find’ to find the tables which are related to particular field.
Click on ‘Find’ icon.
Enter the required table or field name press ‘Enter’ button.
Click on any one of open cursor statement.
Ex: - MARA_OPEN.
Click on ‘Explain’ button.
Click on the considered index.
Ex : - <dbtab>~o Primary index
<dbtab>~zin Secondary index.
Click on ‘Analyze’ button.
Click on ‘Execute’ button.
Note: - Make sure index analysis is in green.
v. Performance tips
a. Data extraction point of view:
SELECT *………………..
* Advisable
SELECT <f1>
BY MR. BABU (OASIS TECHNOLOGIES)
<f2>
SELECT <f1>
<f2>
FROM <dbtab>
INTO <gs_dbtab>
WHERE <condition>
*Append data
ENDSELECT.
*Advisable.
SELECT <f1>
<f2>
FROM <dbtab>
Note:
Use key fields as many as much as possible in indexes order in WHERE conditions for better performance.
Note:
1. The base internal table must be check whether it has data before it is used in for all entries.
2. All the records from the database table or database view are extracted incase of base internal table
in for all entries is empty and not check.
3. FOR ALL ENTRIES with INNER JOINS are advisable since FOR ALL ENTRIES are another extra
filter criteria as like select options
SELECT <a~f1>
<a~f2>
<b~i1>
<b~i2>
SELECT <j1>
<j2> ------
FROM <dbtab3>
Ex:
SELECT <f1>
INTO <gv_var>
FROM <dbtab>
UPTO 1 ROWS
ENDSELECT.
Ex:
* Not advisable.
LOOP AT <gt_base> INTO <gs_base>
SELECT-------
ENDLOOP.
*Advisable.
<f2>
FROM <dbtab>
ENDIF.
IF sy-subrc EQ 0.
MOVE -----
ENDIF.
ENDLOOP.
Note:
1. Use as many number of key fields as possible in where condition for better performance.
2. Avoid using negative where conditions while extracting data.
3. Avoid using aggregate functions such as MAX, MIN, AVG while extracting data.
Delete duplicate records from an internal table in case of not possible to use all the key fields in where
condition while extracting the data.
Note: Internal tables must be sorted before delete adjacent duplicates statement is used.
Read second internal table to get index of current record within the loop of base internal table.
Set a loop to second internal table (item table) to process the data from the set index
Come out of the second loop for the unmatched records.
Ex: <gt_item>
F1 F2 F3
1 10 A
1 20 B
2 10 P
2 20 Q
LOOP AT <GT_BASE> INTO <GS_BASE>
*Not advisable.
BY MR. BABU (OASIS TECHNOLOGIES)
*LOOP AT <GT_ITEM> INTO <GS_ITEM> WHERE ---------
IF SY-SUBRC EQ 0.
<lv_index> = sy-tabix.
EXIT.
ENDIF.
*process data
ENDIF.
Delete and copy internal tables outside of loop statements as much as possible.
Copy and Delete Internal tables outside of loop statements for better performance
Note:
a. Add an additional fields (deletion flag ) to the required internal table, set the flag value as ‘X’ for the
unwanted records
b. Delete an internal table outside of the loop statements where the deletion flag is ‘X’.
*not advisable
<gs_temp> = <gs_base>
ENDLOOP.
*advisable
gt_temp [] = gt_base[]
IF SY-SUBRC EQ 0.
ELSE.
*not advisable
<gs_final-del_flag> = ‘X’
TRANSPORTING <DEL_FLAG>
ENDIF.
ENDLOOP.
Modify , delete, update and insert database tables outside of loop statements for better
performance.
Modify, Update, Insert and Delete data base tables outside of loops for better performance
BY MR. BABU (OASIS TECHNOLOGIES)
LOOP AT <GT_BASE> INTO <GS_BASE>
*Read tables
IF SY-SUBRC EQ 0.
*process data
ELSE.
MOVE:<GS_BASE-F1> TO <GS_DBTAB-F1>
ENDIF.
ENDLOOP.
IF SY-SUBRC EQ 0.
COMMIT WORK
ENDIF.
Data declarations:
Avoid using TABLES statement as much as possible since it creates unwanted work areas.
Avoid declaring or defining internal tables WITH HEADER LINES and OCCURS statement.
Avoid declaring field strings since they are outdated.
Note:
a. Declare types with the required fields, declare Work areas or field symbols and internal tables by
referring the defined types.
b. Declare internal tables without HEADER LINES and without OCCURS statements.
END OF <GS_DBTAB>.
BY MR. BABU (OASIS TECHNOLOGIES)
TYPES: BEGIN OF <TYP_DBTAB>.
ENDOF <TYP_DBTAB>.
MM01-Create Material
………………………
MM02-Change Material
………………………
MM03-Display Material
………………………