Escolar Documentos
Profissional Documentos
Cultura Documentos
INSTITUTIONAL PROFILE
TERAS CONSULTING:
Teras Consulting is established for fulfillment of the need of IT Industry. Company is growing
from last decade and deliver IT training and Development solution to both Public and Private
sector Organizations. Teras Consultants Noida have invested significantly in this sector to
develop
their
own
methodology
and
way
of
teaching
and
training.
The specialized area of our Institute training is SAP ERP (Enterprise Resource Planning),
Language Training, Database and other IT skills. We have excellent well equipped labs or
classrooms, and first class support for students and trainees
Course Structure
Course content are specially designed according to current trends and need of the IT industry
which offers unique opportunity to the students who are looking for Job or for higher
Education classes are tailored made to suit Individual requirements on weekdays and weekend
classes Saturday/Sunday.
Best Trainers
The Trainers in our Institute are highly qualified and have practical experience of their
respective field .The are hired from different houses, universities, professions and service for
their expertise. Our Faculty is used world class modern tools & Approach in delivering
technical contents.
Training
With years of Experience in both national & International level in Technology and functional
domains related to ERPs, we are capable and confident in designing Delivering substantial
training to Corporate and Individual in these areas.
A one stop shop for all your training and documentation needs. Provide best in class training
through experienced and integrated team. Keep improving our service in training and content
development. Our trainers and consultants can work closely with your users and experts to
develop and document the content and curriculum for training. Our training team will keep
providing support throughout the training periods and beyond that.
1240998
Page 1
Placements:
Arrangements for Pre-Placement Talks, Written Tests, Interviews and Group Discussions are
made as per the requirement of the visiting companies.
Key Recruiters for Teras Consulting
SAP Labs
IBM
Orange
Accenture
Business
Services
Infosys
SVAM
SunLife
Wipro
Financial
Cognizant Technologies
Nirma Cement
CSC
ERA Group
Abyeti
TCS
Technologies
Our Placement cell gives job in top MNC of India and abroad with complete satisfaction to
the students.
Training courses
SAP/ERP
CLOUD COMPUTING
HADOOP
ASP .NET
JAVA/J2EE
SOFTWARE TESTING
ANDROID/IPHONE
EMBEDED
SAS BI
ORACLE/ORACLE DBA
PHP TRAINING
CCNA/CCNP
1240998
Page 2
SERVICES
Teras Consulting provides Education, personality development, IT staffing and KPO Services.
Where you can learn, you can improve yourself, get a job & job opportunity.
Education
Teras Consulting is a place where you can improve your IT skills and SAP Knowledge. We
hire consultants to give a practical knowledge to improve yourself and get a good opportunity
in market. We provide you a good place for work. We are providing education and placed you
in our own organization.
Personality Development
Teras Consulting also increase your personality. Where we can improve your body language,
Communication skills and build up leadership
attitude.
After that we also dealing with IT Staffing an KPOs
IT STAFFING
Teras Consulting concern to customers to understand their overall skill set requirements for
company. Our employee Augmentation Model offers such things. we basically provide
solution for small ,mid-size and large enterprises. We understand the companies & Industry
need and full fill this with talented professionals.
We Focus on:
Estimating man power requirement, recruiting, selection, placement and orientation and
finally provide training and development.
2. HISTORY:
1240998
Page 3
ABAP (Advanced Business Application Programming, originally Allgemeiner BerichtsAufbereitungs-Prozessor German for "general report creation processor") is a high-level
programming language created by the German software company SAP. It is currently
positioned, alongside Java, as the language for programming the SAP Application Server,
which is part of the NetWeaver platform for building business applications.
ABAP is one of the many application-specific fourth-generation languages (4GLs) first
developed in the 1980s. It was originally the report language for SAP R/2, a platform that
enabled large corporations to build mainframe business applications for materials
management and financial and management accounting.
ABAP used to be an abbreviation of Allgemeiner Berichts Aufbereitungs Prozessor, German
for
"generic
report
preparation
processor",
but
was
later
renamed
to
the
English Advanced Business Application Programming. ABAP was one of the first languages
to include the concept of Logical Databases (LDBs), which provides a high level of
abstraction from the basic database level(s).
The ABAP language was originally used by developers to develop the SAP R/3 platform. It
was also intended to be used by SAP customers to enhance SAP applications customers can
develop custom reports and interfaces with ABAP programming. The language is fairly easy
to learn[opinion] for programmers but it is not a tool for direct use by non-programmers.
Knowledge of relational database design and preferably also of object-oriented concepts is
necessary to create ABAP programs.
ABAP remains as the language for creating programs for the client-server R/3 system, which
SAP first released in 1992. As computer hardware evolved through the 1990s, more and more
of SAP's applications and systems were written in ABAP. By 2001, all but the most basic
functions were written in ABAP. In 1999, SAP released an object-oriented extension to ABAP
called ABAP Objects, along with R/3 release 4.6. SAP's current development platform Net
Weaver supports both ABAP and Java.
ABAP has an abstraction between the business applications, the operating system and
database. This ensures that applications do not depend directly upon a specific server or
database platform and can easily be ported from one platform to another.
SAP
Netweaver
currently
runs
Windows, i5/OS on IBM System i (formerly iSeries, AS/400), and z/OS on IBMSystem
z (formerly zSeries, S/390). Supported databases are IBM DB2, Informix, MaxDB, Oracle,
and Microsoft SQL Server (support for Informix was discontinued in SAP Basis release 7.00).
1240998
Page 4
Page 5
developers from changing the same code at the same time), version management, and
deployment of programs on the QA and production systems.
The Web Application Server consists of three layers: the database layer; the application layer;
and the presentation layer. These layers may run on the same or on different physical
machines. The database layer contains the relational database and the database software.
The application layer knowledge contains the instance or instances of the system. All
application processes, including the business transactions and the ABAP development, run on
the application layer. The presentation layer handles the interaction with users of the system.
Online access to ABAP application servers can go via a proprietary graphical interface, which
is called "SAP GUI", or via a Web browser.
2.3. Transactions
A transaction in SAP terminology is the execution of a program. The normal way of executing
ABAP code in the SAP system is by entering a transaction code (for instance, VA01 is the
transaction code for "Create Sales Order"). Transactions can be called via system-defined or
user-specific, role-based menus. They can also be started by entering the transaction code
directly into a command field, which is present in every SAP screen. Transactions can also be
invoked programmatically by means of the ABAP statements CALL TRANSACTION and
LEAVE TO TRANSACTION.
The term "transaction" must not be misunderstood here; in the context just described, a
transaction simply means calling and executing an ABAP program. In application
programming, "transaction" often refers to an indivisible operation on data, which is either
committed as a whole or undone (rolled back) as a whole. This concept exists in SAP and is
called a LUW (Logical Unit of Work). In the course of one transaction (program execution),
there can be different LUWs. Transaction for ABAP Workbench could be invoked using
transaction code SE80 to work on all ABAP development related activities
3. Introduction to ABAP
1240998
Page 6
ERP (Enterprise Resource Planning) systems around. Similar products are Oracle and
People soft. ERP is used by companies to plan, organize, integrate and manage their various
operations like accounting, finance, manufacturing and human resources. The main aim is to
improve efficiency and accuracy.
1240998
Page 7
3.4.
Custom reports a program that reads specific data from the database and then
displays the data via the computer screen or printer. The purpose of a report is to
read data from the database and write it out. It consists of mainly two screens. The
first screen is called the selection screen. It contains input fields allowing the user
to enter criteria for the report. For example, the report may produce a list of sales
for a given date range, so the date range input fields would appear on the reports
selection screen. The second screen is the output screen. It contains the list. The
list is the output from the report, and usually does not have any input fields. In our
example, it would contain a list of the sales that occurred within the specified date
range. The selection screen is optional. Not all reports have one. However, all
Page 8
All development objects created with the development tools found in the ABAP Workbench
are classified as Repository Objects and are stored centrally in the R/3 Repository. The R/3
Repository is a special part of the SAP systems central database. The Repository is organized
according to application. Each application is further divided into logical subdivisions called
development classes.
Repository objects are often made up of sub-objects that are themselves Repository objects.
Each Repository object must be assigned a development class when it is created.
1240998
Page 9
Navigator calls the ABAP Editor and, after creating the program, returns back to the Object
Navigator screen. An entire application can be created using the Object Navigator without
directly calling any of the other tools. In fact, the recommended method for creating an
application is from the Object
Navigator because you can see what you build. The Object navigator provides an overview of
all the elements in an application and access to all necessary administration tools from one
single interface.
Object Navigator can be accessed in 2 ways:
SAP Main Screen > Tools > ABAP Workbench > Overview > Object Navigator
(Double Click)
Another way to reach the Object Navigator is to from the SAP Main Screen enter the
transaction SE80 into the transaction field and press Enter
1240998
Page 10
Either way the Object Navigator is displayed. There are two input fields on this screen. Object
List Group This contains a list of the objects contained within this environment: Local
Objects,
Application
Hierarchy
Program,
Development
Class,
Function
Group,
If you select the down-arrow key in the second input field, object group selected in the first
field will be displayed. Click on the Display input field.
1240998
Page 11
If the program already exists, it will be display under the object list. If it doesnt exist, a
dialog box pops open, click the YES pushbutton for SAP to create the program.
As soon as you click on YES another dialog box pops open querying about the program
structure either as an individual file or a framework program for includes. Large programs can
be split up into several sub programs (includes).
For now deselect the With TOP INCL flag. Click on tick Enter to continue
1240998
Page 12
If this is the first time ever you are creating an ABAP program, another dialog window will
pop open requesting you to enter the Access Key so this user can be added as a Developer.
Enter your 20 Character access key here and click on continue. ( Note: this dialog only pops
up once. )
A new template pops up where you will define the important attributes of the new application.
There are three important fields that must be maintained. And these are;
Title: Short description of the program. The program name comes up as default in this field.
You can add more text to it. For example Khans First ABAP Program
Program Type: Chose Executable program. Reports are usually this type.
Application: Which the program will be assigned to. Select Cross-application.
Other fields are optional: status, authorization groups, logical database. After entering all the
values, click on SAVE.
1240998
Page 13
When you save a new object for the first time, the system displays a correction and transport
dialog box. Here the Development Class field needs to be maintained. For now click the local
object pushbutton.
You will be returned to the opening screen of the object navigator. Go to the course code
screen by double clicking on the object name.
1240998
Page 14
Source code appears in display mode with just one line of code report and report name.
To switch from display mode to change mode click on the pencil mark
Place cursor after the period at the end of first sentence and press enter to get you to the next
line. Type WRITE Hello World!
1240998
Page 15
1240998
Page 16
A list is produced. To go back to the editor from the report output window, click on the back
arrow or F3 function key.
SAP Main Screen > Tools > ABAP Workbench > Development > ABAP Editor
(Double Click)
1240998
Page 17
Page 18
In the front-end editor, the ABAP source code is loaded onto the front-end and edited locally.
The advantage of this is that all editing functions that do not require communication with the
backend can be performed very quickly
Back-end Editor
The back-end editor allows you to use the traditional back-end editor for editing your ABAP
code. The editor is line-based, and to use normal editor functions such as cut, copy and paste,
you must first select a block of lines. If is often useful to use the clipboards in this mode. If
you have a very long program (and specially if you are working in a WAN environment), the
back-end editor can produce better performance than the front-end editor.
Furthermore, back-end editor allows you to edit any development object that is based on the
ABAP Editor. You can change the mode from front-end to back-end by doing the following
steps. To change the editor mode from anywhere in the ABAP workbench: Chose utilities >
settings
The User Specific Settings dialog box appears. Choose ABAP Editor. Set the editor mode to
back-end editor.
1240998
Page 19
5. Enter the path and filename of the file you want to read in the dialog box, then choose
copy.
1240998
Page 20
Page 21
Use Type 1 (report) to declare your program as executable. This means that program can run
on its own, and that you can start it in the R/3 system without a transaction code. You can also
run executable programs (reports) in the background.
Use Type M to declare your program as a module pool. This means that your program cannot
run on its own, but serves as a frame for program modules used for dialog programming.
User Type I for include program. An include program is an independent program with two
main functions: On one hand, it contains program code that can be used by different
programs. On the other hand, it modularizes source code, which consists of several different,
logically related parts. Each of these part is stored in different include program. Include
programs make your source code easier to read and maintain.
Status
This entry describes the status of the program development, for example, T for test program.
Application
This field contains the short form of your application, for example, F for Financial
accounting. This required entry enables the system to allocate the program to the correct
business area.
Authorization Group
In this field, you can enter the name of a program group. This allows you to group different
programs together for authorization checks. The group name is a field of the two authorization
objects S_DEVELOP (program development and program execution) and S_PROGRAM
(program maintenance). Thus you can assign authorization to users according to program
groups. For more information about creating function modules, refer to the Users and
Authorization documentation.
Development Class
The development class is important for transports between systems. You combine all
Workbench objects assigned to one development class in one transportation request. If you are
working in a team you may have to assign your program to an existing development class, or
you may be free to create a new class on Workbench Organizer covers this. All programs
assigned to the development class $TMP are private objects and cannot be transported into
1240998
Page 22
other systems. You can enter the development class directly into this field. Otherwise, the
system prompts for it when you save the attributes.
Choosing Local Objects is equivalent to entering $TMP in the field Development Class. You
can change the development class of a program later on by choosing Object Directory Entry
from the GOTO menu, click change, type in the desired development class.
Logical Database From Application
(Only for Executable Programs Reports)
These attributes determine the logical database used by the executable program (report) to
read data, and the application to which it belongs. Logical databases have unique names
within their application. However, system wide, you can have more than one logical database
with the same name. This is why you also need to specify the application. If you read data
directly in your program instead of using a logical database, you should enter an application,
but leave the logical database field empty.
Selection Screen Version
(Only for Executable Programs Reports)
If you do not specify a selection screen version, the system automatically creates a selection
screen based on the selection criteria of the logical database and the parameters and select
options statement in the program.
If you want to use a different selection screen, enter the number here (not 1000, since this is
reserved for the standard selection screen). The number must be smaller than 1000 and
correspond to an additional selection screen of the logical database. The possible values help
displays a list of available selection screens. You can also look in the selection include of the
logical database (Program DBxxxSEL, where xxx is the name of the logical database).
4. DATA DICTIONARY:
A data dictionary is a central source of information for the data in a information management
system. Its main function is to support the creation and management of data definitions (or
"metadata").
Data dictionary used for:
1240998
Page 23
Objects in the ABAP Dictionary resided on three levels that support their re-usability. These
levels are:
1. Tables and structures
2. Data elements
3. Domains
Domains:
1240998
Page 24
Data Elements:
Fields of same semantic meaning can refer to the same data element
Tables:
Represent the Database Tables where data actually resides.
Tables can be defined independently of the database in the ABAP Dictionary.
The fields of the table are defined with their (database-independent) SAP ABAP data types
and lengths.
1240998
Page 25
1240998
Page 26
Views:
Views in SAP _ ABAP are used to summarize data which is distributed among several
tables
The data of a view is not actually physically stored. The data of a view is instead
derived from one or more other tables
Search Help
A Search help is a tool to help you search for data records in the system
An efficient and user-friendly search assists users where the key of a record is
unknown
1240998
Page 27
Lock Objects:
Simultaneous accessing of the same data record by two users in the SAP system is
synchronized by a lock mechanism.
Locks are set and released by calling certain function modules. These function
modules are generated automatically from the definition of so-called lock objects in the
ABAP/4 Dictionary
1240998
Page 28
5. INTERNAL TABLES
Internal tables are used to obtain data from a fixed structure for dynamic use in ABAP.
Each line in the internal table has the same field structure. The main use for internal tables
is for storing and formatting data from a database table within a program.
Work area:
Work areas are single rows of data. They should have the same format as any of the
internal tables. It is used to process the data in an internal table one line at a time.
1240998
Page 29
It is here that all the changes or any of the action on the contents of the table are done.
As a result of this, records can be directly inserted into the table or accessed from the
internal table directly.
tables.
Hence these tables cannot be accessed directly.
Macros If you want to reuse the same set of statements more than once in a
program, you can include them in a macro. You can only use a macro within the
program in which it is defined.
1240998
Page 30
Include Programs Include programs allow you to use the same source code in
different programs. They are mainly used for modularizing source code and have no
parameter interface.
Subroutines Subroutines are normally called internally i.e. called from the same
program in which it is declared. But subroutines can also be called from external
programs. A subroutine can be defined using FORM and ENDFORM statements.
ENDFORM.
Function Modules Function Modules are stored in the central library and can be
called from any program. Even the function modules (RFC enabled) can be called
from non-SAP systems
1240998
Page 31
STEP: 1
1240998
Page 32
STEP: 3 Select Import tab and enter IM_MATNR under Parameter name, TYPE under
typing and MARA-MATNR under Associated Type, enter.
STEP: 4 Select Export tab and enter EX_MARA under Parameter name, TYPE under
typing and MARA under Associated Type, enter.
1240998
Page 33
STEP: 5 Select Source Code tab and write below code to get material details, save as local
object and activate.
STEP: 6 Click on Execute icon (F8), and give a material no, execute (F8).
1240998
Page 34
= P_MATNR
IMPORTING
EX_MARA
= WA_MARA .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
WRITE: WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARAMBRSH . "Display result
1240998
Page 35
AT FIRST - ENDAT
AT NEW - ENDAT
AT END OF - ENDAT
AT LAST - ENDAT
ON CHANGE OF
1240998
Page 36
1240998
Page 37
OUTPUT:
1240998
Page 38
8. Comparison String:
<operator>
Meaning
CO
Contains Only
CN
CA
Contains Any
NA
CS
Contains String
NS
contains No String
CP
Matches pattern
NP
There are no conversions with these comparisons. Instead, the system compares the characters
of the string. The operators have the following functions:
CO (Contains Only)
The logical expression
<f1> CO <f2>
is true if <f1> contains only characters from <f2>. The comparison is case-sensitive. Trailing
blanks are included. If the comparison is true, the system field SY-FDPOS contains the length
of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that does not
occur in <f2>.
CN (Contains Not only)
The logical expression
<f1> CN <f2>
is true if <f1> does also contains characters other than those in <f2>. The comparison is casesensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS
contains the offset of the first character of
<f1> that does not also occur in <f2>. If it is false, SY-FDPOS contains the length of <f1>.
CA (Contains Any)
The logical expression
1240998
Page 39
<f1> CA <f2>
is true if <f1> contains at least one character from <f2>. The comparison is case-sensitive. If
the comparison is true, the system field SY-FDPOS contains the offset of the first character of
<f1> that also occurs in <f2> . If it is false, SY-FDPOS contains the length of <f1>.
NA (contains Not Any)
The logical expression
<f1> NA <f2>
is true if <f1> does not contain any character from <f2>. The comparison is case-sensitive. If
the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false,
SY-FDPOS contains the offset of the first character of
<f1> that occurs in <f2> .
CS (Contains String)
The logical expression
<f1> CS <f2>
is true if <f1> contains the string <f2>. Trailing spaces are ignored and the comparison
is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset
of <f2> in
<f1> . If it is false, SY-FDPOS contains the length of <f1>.
NS (contains No String)
The logical expression
<f1> NS <f2>
is true if <f1> does not contain the string <f2>. Trailing spaces are ignored and the
comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS
contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1>.
CP (Contains Pattern)
The logical expression
<f1> CP <f2>
is true if <f1> matches the pattern <f2>. If <f2> is of type C, you can use the following
wildcards in <f2>:
1240998
Page 40
Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true,
the system field SY-FDPOS contains the offset of <f2> in
<f1> . If it is false, SY-FDPOS contains the length of <f1>.
If you want to perform a comparison on a particular character in <f2>, place the escape
character # in front of it. You can use the escape character # to specify
NP (contains No Pattern)
The logical expression
<f1> NP <f2>
is true if <f1> does not match the pattern <f2>. In <f2>, you can use the same wildcards and
escape character as for the operator CP.
Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true,
the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the
offset of <f2> in <f1>
CODE OF PROGRAM:
1240998
Page 41
1240998
Page 42
1240998
Page 43
OUTPUT:
9. JOINS In ABAP:
The data that can be selected with a view depends primarily on whether the view implements
an inner join or an outer join. With an inner join, you only get the records of the crossproduct for which there is an entry in all tables used in the view. With an outer join, records
are also selected for which there is no entry in some of the tables used in the view.
The set of hits determined by an inner join can therefore be a subset of the hits determined
with an outer join.
Database views implement an inner join. The database therefore only provides those records
for which there is an entry in all the tables used in the view. Help views and maintenance
views, however, implement an outer join.
1240998
Page 44
Code Of Program
1240998
Page 45
1240998
Page 46
10. REPORTS:
CLASSICAL REPORTS:
These are the most simple reports. Programmers learn this one first. It is just an output of
data using the Write statement inside a loop. Classical reports are normal reports. These
reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR
OUTPUT.
Events in Classical Reports:
INTIALIZATION: This event triggers before selection screen display.
AT-SELECTION-SCREEN: This event triggers after processing user input still
selection screen is in active mode.
START OF SELECTION: Start of selection screen triggers after processing selection
screen.
END-OF-SELECTION: It is for Logical Database Reporting.
SOURCE CODE:
1240998
Page 47
1240998
Page 48
1240998
Page 49
OUTPUT SCREEN:
OUTPUT:
1240998
Page 50
AT USER-COMMAND
1240998
Page 51
SOURCE CODE:
1240998
Page 52
SUBROUTINE
OUTPUT SCREEN:
1240998
Page 53
OUTPUT:
Page 54
ALV provides a lot of inbuilt functions to our reports and some of the functions are listed
below.
Sorting of records
Filtering of records
Totals and Sub-totals
Download the report output to Excel/HTML
Changing the order of the columns in the report
Hide the unwanted columns from the report
Because of the above functions, ALV substantially decreases the report development time.
ALV takes care of rendering the list and we can concentrate only on the data retrieval part.
SOURCE CODE:
1240998
Page 55
SUBROUTINE:
1240998
Page 56
1240998
Page 57
1240998
Page 58
OUTPUT:
1240998
Page 59
SOURCE CODE:
1240998
Page 60
1240998
Page 61
SUBROUTINES:
1240998
Page 62
1240998
Page 63
1240998
Page 64
1240998
Page 65
1240998
Page 66
1240998
Page 67
User exits: These are technically modifications. SAP provides many subroutine(s)
with name USEREXIT_ * (i.e ex: FORM USEREXIT_001 ). These are saved in many
includes which can be found via SE80 >> Search for Package VMOD. These are also
called as Form exits. Custom coding can be done in the subroutine. But the main
1240998
Page 68
disadvantage of these exits are It requires Access key and only SD module supports
this kind of enhancements.
Customer exits: Technically enhancements. Will not affect the source code of
SAP program and hence no problem during upgrade. There are 3 kinds of Customer
exits:
Function exits:
Provided by means of FM's (Function modules) .The code for the function module is written
by the developer. You are not writing the code directly in the function module, but in the 'Z'
include that is implemented in the function module.
Ex: open any Function module EXIT_* in se37
Ex: EXIT_SAPMF02K_001. but in the SAPMF02K program you will see this as
CALL CUSTOMER-FUNCTION '001'. It will have a Z include file , just edit the file directly
. No Access key required.
Menu Exits:
Enhances the menu available in standard SAP program. Developer can add his/her own text
and logic for the menu. Function codes for menu exits all start with "+". Format: +CUS
(additional item in GUI status).
Screen exits:
Used to enhance the screen, add elements in screen etc. Format: CALL CUSTOMERSUBSCREEN CUSTSCR2.
Page 69
Explicit enhancement:
It can be anywhere in your source code. You need to explicitly have a enhancement point. It is
of two types:
a) Enhancement spot: It is the point where you can add your code. It can have
multiple implementations. All the implementations can active at a time but the
sequence of executions of the implementations can be anything.
b) Enhancement section: If you want to execute your own code instead of some
portion standard code. Only the active implementation is execute. Only one
implementation is active at a time.
Page 70
SAP-ABAP supports two types of programs - Report Program and Dialog Program. If your
ABAP program demands user input Dialog programming is used. A user dialog is any form of
interaction between the user and the program and could be any of the following
Entering data
Clicking a button
Dialog program is also used when we need to navigate back and forth between screens.
Dialog programs are created with type as 'M' - Module Pool. They cannot be executed
independently and must be attached to at least one transaction code in which you specify an
initial screen.
1240998
Page 71
Dialog Program:
A dialog program allows you to work interactively with the system and to change the contents
of the database tables. Each dialog program has a certain sequence of screens that are
processed by the system one after the other.
transaction SE51
Each screen belongs to an ABAP program.
These screens consist of a "screen mask" or "layout" and its flow logic. The screen has
a layout that determines the positions of input/output fields and other graphical
elements such as checkboxes and radio buttons. A flow logic determines the logical
Page 72
The ABAP program contains the dialog modules that are called by the screen flow
logic, and also process the user input from the GUI status.
ABAP programs that use screens are also known as dialog programs.
In a module pool (type M program); the first processing block to be called is always a
dialog module. However, you can also use screens in other ABAP programs, such as
executable programs or function modules. The first processing block is then called
differently; for example, by the runtime environment or a procedure call. The screen
7)
Process Before Output (PBO) event: which is processed before the screen is displayed
Process After Input (PAI) event: which is processed after a user action on the screen
Process on help request (POH): which is processed when F1 is pressed
Process on value request (POV):which is processed when F4 is pressed
Dynpro:
A screen together with its Flow logic is called a Dynpro ("Dynamic Program" since
statically-defined next screen from within the dialog modules of the ABAP program.
8) ABAP Module Pool:
On a PBO or PAI event a Dynpro calls an ABAP dialog program. Collection of such
1240998
Page 73
1240998
Page 74
EXECUTE:
1240998
Page 75
DYNBEGIN-
FNAM-
Field name
FVAL-
A BDCDATA structure can contain the batch input data for only a single run of a transaction
In CALL TRANSACTION method, we need to create Log for the Error Message, for this we
use structure BDCMSGCOLL. For our demo purpose, we would be considering the file
format.
Define the internal table structure as per the above file structure.
1240998
Page 76
DATA:
BEGIN OF fs_field,
bsart TYPE eban-bsart,
Document Type.
" Plant.
END OF fs_field.
Recoding is done using the Transaction SHDB.
Here we have done Recording for the transaction- ME51.
The Recording which you get will be in following format.
1240998
Page 77
" Mode
END OF fs_field.
*Internal table decleration
DATA:
t_field
Page 78
TYPE c,
wa_cnt1(2) TYPE n,
it_output type table of ty_s_error,
wa_output like line of it_output.
AT SELECTION-SCREEN.
* Mode 'A' = Foreground mode
* Mode 'N' = Background mode
IF p_mode = 'A' OR p_mode = 'N' .
w_mode = p_mode.
ELSE.
*Error Message
MESSAGE 'PLEASE ENTER THE MODE A or N' TYPE 'E'.
ENDIF.
* Opening window for path selection
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name
=''
IMPORTING
file_name
= p_file.
TYPES:
fs_struct(4096) TYPE c OCCURS 0 .
1240998
Page 79
DATA:
w_struct TYPE fs_struct.
* Uploading excel file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator
= 'X'
* I_LINE_HEADER
i_tab_raw_data
i_filename
= w_struct
= p_file
TABLES
i_tab_converted_data
= t_field
EXCEPTIONS
conversion_failed
OTHERS
=1
=2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Opening window for Error file download
AT SELECTION-SCREEN ON VALUE-REQUEST FOR e_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name
=''
IMPORTING
file_name
= e_file.
Page 80
*********************(populate_bdcdata)***********************
* part 1
FORM populate_bdcdata.
PERFORM :
fill_bdc_data USING 'SAPMM06B' '0100' 'X' ' ' ' ',
fill_bdc_data USING '' '' ' 'EBAN-BSART' fs_field-bsart, " Document Type.
fill_bdc_data USING '' '' '' 'BDC_OKCODE' '/00',
" Enter.
" Enter.
* part 2
FORM fill_bdc_data USING value(p_program)
value(p_dynpro)
value(p_dynbegin)
value(p_fnam)
value(p_fval).
CLEAR fs_bdcdata .
1240998
Page 81
" Save.
IF p_dynbegin = 'X' .
fs_bdcdata-program = p_program .
fs_bdcdata-dynpro = p_dynpro .
fs_bdcdata-dynbegin = p_dynbegin .
APPEND fs_bdcdata TO t_bdcdata.
ELSE.
fs_bdcdata-fnam = p_fnam.
fs_bdcdata-fval = p_fval.
CONDENSE fs_bdcdata-fval.
APPEND fs_bdcdata TO t_bdcdata.
ENDIF.
" IF p_dynbeg..
ENDFORM .
" Fill_entry
*********************(insert_data)****************************
FORM insert_data.
*Data decleration for Error Message
DATA:
t_msg TYPE TABLE OF bdcmsgcoll, " Collecting Error messages
w_msg TYPE bdcmsgcoll,
w_msg1(51).
* Call transaction 'ME51'
CALL TRANSACTION 'ME51' USING t_bdcdata
MODE w_mode
UPDATE 'S'
MESSAGES INTO t_msg.
IF sy-subrc EQ 0.
*
1240998
Page 82
Error Found
LOOP AT t_msg INTO w_msg WHERE msgtyp EQ 'E'.
Format Message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid
= w_msg-msgid
msgnr
= w_msg-msgnr
msgv1
= w_msg-msgv1
msgv2
= w_msg-msgv2
msgv3
= w_msg-msgv3
msgv4
= w_msg-msgv4
IMPORTING
message_text_output = w_msg1.
wa_output-msg_err = w_msg1.
*Error message in downloaded file
data:
wa_string(10) type c.
wa_string = fs_field-matnr.
concatenate wa_string wa_output-msg_err into wa_output-msg_err separated by space.
APPEND wa_output-msg_err TO it_output.
wa_error = e_file.
BIN_FILESIZE
1240998
=
Page 83
filename
= wa_error
FILETYPE
= 'ASC'
APPEND
=''
write_field_separator
= 'X'
TABLES
data_tab
= it_output
*
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM.
"insert_data
Page 84
1240998
Page 85
Connecting:
New R/3 components, for example, Advanced Planner and Optimizer (APO) and
Business Information Warehouse (BW).
Non-SAP software
Legacy systems
Isolating components within the R/3 System in the context of Business Framework
Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
1240998
Page 86
PC programs as frontends to the R/3 System, for example, Visual Basic (Microsoft) or
Visual Age for Java (IBM).
1240998
Page 87
Step 3: A message will be displayed Function module name is reserved for SAP. Just click
continue.
1240998
Page 88
Step 4: A screen will be displayed as below. In the attributes tab, make the processing type as
Remote-Enabled Module.
1240998
Page 89
Step 5: Now go to the Import tab and enter the details as follows or as per your requirement.
Here I am giving the associated type as ZBAPISTRT001-BUKRS that we have created in
previous stage.
1240998
Page 90
Step 8: Now go to the source code tab and enter the code as shown below.
1240998
Page 91
1240998
Page 92
Step 11: In the resulting screen click on the methods to drop down and see what methods are
provided by default. There would be two methods, showing in red color which comes by
default while creating the BAPI. Now select Add Method from Utilities > API Methods >
Add Method.
Step 12: On the screen that follows, provide the function module name that we just created in
the previous stage and click on the continue icon. In the coming pop-up, click the next step
icon. We observe that the information is predefined in the fields.
1240998
Page 93
Step 13: This is the next screen where you would just click on the next icon.
1240998
Page 94
Click on Yes. You can see an information message reading ZBAPIT001 inserted.
Step 15: Now save after you add the method. Select & Double click on the API method.
Go to Tab: ABAP Check 'API Function' as shown below.
1240998
Page 95
Select the Radio button reading API Function as already said above.
Step 17: Now Go to : Edit > Change Release Status > Object type > To Modeled.
Step 18: The below shown screen will be displayed. Click on yes.
1240998
Page 96
The message shows, The object type status set to modeled. ( or already modeled )
Step 19: Now go to: Edit > Change Release Status > Object type >To Implemented. You can
see a message reading Object type status set to implemented.
Step 20: Now, go to: Edit > Change Release Status > Object > To Released. There would be
two pop ups coming up. Click continue on the Pop Ups.
Step 21: Keep the cursor on the 'Method'. Now go to: Edit > Change Release Status > Object
type component > To Modeled. (Shown as below).
1240998
Page 97
Step 22: Now, go to: Edit > Change Release Status > Object type component > To
Implemented. You can see the message reading status for method zbapifmt001 set to
implemented.
Step 23: Now go to: Edit > Change Releasse Status > Object type component > To Released.
You can see the message reading status for method zbapifmt001 set to Released.
Step 24: Click on Generate from Object Type as shown below.
After clicking on the generate button, you can see the message reading Object type
'ZBAPI_ABY' generated successfully. Now we are done with the creation of a BAPI.
Stage 4: Viewing the created BAPI in BAPI Explorer
Step 25: Go to BAPI Explorer (Transaction code is BAPI) there we can find the BAPI (our
BAPI). You can click on the Alphabetical tab so that you can browse the BAPIs in an
alphabetical order. Find your BAPI as shown.
1240998
Page 98
Step 27: The below screen is displayed. Click on the Execute icon (circled in red) against the
BAPI as shown
1240998
Page 99
Step 28: The below screen will be displayed where you would require entering the data
against the empty input fields.
Step 29: You could use the input help as shown below; here I have selected 0001. And click
the execute button.
1240998
Page 100
Step 30: The resulting screen is displayed below, where you can see 1 Entry (circled in red)
against ITEMTAB. Double click on 1 Entry.
1240998
Page 101
Page 102
sender will be performed by the receiving system, using the information contained in the
IDoc.
Changes made to fields in master data tables can be set to trigger distribution of the changes
to slave systems, so that multiple database servers can update the same information
simultaneously. IDocs carry information directly between SAP systems. In order to
communicate with a non-SAP system, an IDoc is first transmitted to an intermediary system
that translates the data to a format that will be understood by the receiver. Return data also
passes through the translating system, where it is again encapsulated into an IDoc.
2.
Styles and layout sets for print layout. These are created independent of the individual
texts using the corresponding maintenance transactions and are allocated to the texts later
3.
The composer is a central output module. The SAP script composer is invisible to the
outside
1240998
Page 103
4.
A programming interface that allows you to include SAP script components into your
own application programs and to control the output of layout sets from within the
programs
5.
Several database tables for storing texts, styles and layout sets.
Layout Set:
To output documents using the programming interface, R/3 application programs need socalled layout sets (a kind of form).In SAP script a layout set describes the layout of the
individual print pages and uses text elements to supply definable output blocks, which a print
program can call. A layout set can be defined as a page design for a document.
Layout set on its own doesn't contain any data. The selection of data for the document is done
through the print program. The print program selects the data from database table and feeds
it to the layout set. When the print program is executed the document is printed on the screen,
printer. Usually a SAP Script Layout consists of following components:
1.
Header Data: Header data is used for information and control of SAP printing. The
header data comprises of 2 parts - Device Independent - Stores information like Start
page , Default paragraph ,Language Attributes etc. And Device Dependent stores
information like Page format ,Orientation Lines per inch etc
2.
3.
Windows and Text Elements: Windows are individual text areas (header address,
date, footer) in a page. It helps combine the information contained in a document into
certain groups and make each group appear on the printed page in an individual area.You
can define text elements (window texts) for each window. The print program accesses text
elements by name, formats them and prints them in the respective window. The paragraph
and the character formats used must be defined in the form.
1240998
Page 104
4.
Pages: They are individual pages of a document and must have a unique name. You
will often find different layouts for individual pages: The first page of an invoice differs
from the subsequent pages, on which you need not repeat general information, such as
address or customer data.
5.
Page Windows: While defining windows and pages, you do not yet determine the
position and spacing of the texts to be output. A page window defines the rectangular
output area in the output medium by specifying the left upper edge of the output area and
its width and height.
Print Program:
The execution of script is done through an ABAP program, which is referred as Print
Program. Each print program should have an ENTRY form, which will be called from
customization.
For a standard configuration we can see the form name (script name), print program name and
output type in the table TNAPR. The print program uses the Form control functions to call the
script.
The print program call either all or some of the form control functions to execute the script
1240998
Page 105
SMARTFORMS IN SAP:
SAP Smart Forms is used to create and maintain forms for mass printing in SAP Systems. As
output medium SAP Smart Forms support a printer, a fax, e-mail, or the Internet (by using the
generated XML output). SAP introduced Smart Forms in 1998 to overcome the limitations in
SAP Scripts. Smart Forms are easier to develop, maintain and transport than SAP Script.
1240998
Page 106
They help adapting forms without any programming knowledge due to entirely
graphical user interface
When activating the smart form the system automatically generates the function
module and at the runtime .
To make any changes we have to use the Drag & Drop, Cut & Paste. These actions do
not include writing of coding lines or using a script language.
We can insert static and dynamic tables. These include the line feeds in the individual
table cells, triggering events for table headings and subtotals and sorting data before
output.
The smart forms allow the user to include graphics, which can be displayed as a part
of the form or as background graphics. During printout the user can suppress the
background graphic as and when necessary.
1240998
Page 107