ABAP: Refresher Course

Course Content
Table of Contents

Topic 1

INTRODUCTION TO ABAP
Sap Netweaver: An overview Navigation in R/3 system Overview of ABAP

Topic 2

ABAP WORKBENCH BASICS
Data types and data objects Internal tables Modularization of R/3 : Subroutines, Macros , Passing Data, Terminating Subroutines etc. ABAP runtime system : Debugging Function g groups p and function modules

Topic 3

ABAP DICTIONARY
Introduction Database Tables Domains Views Search helps Locking Concept

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Course Content
Topic

Topic 4

ADVANCED ABAP
O Open SQL Dynamic programming

Topic 5

ABAP OBJECTS
Cl Classes and d objects bj t Inheritance Polymorphism (casting) Interfaces Events Global classes and interfaces Exception handling

Topic 6

LIST CREATION TECHNIQUES
Extract Datasets List ( Standard, Self defined, List with several pages ) Interactive lists( At line selection, At user-command ) List creation with the ALV grid control

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Course Content
Topic

Topic 7

DIALOG PROGRAMMING
Screen (basics) Screen logic, Screen Painter , Menu Painter Input checks, changing of input values Error handling Step loops Table Control Field help and value help

Topic 8

DATABASE CHANGES
Database updates with open SQL LUW Processing Update Bundling Techniques Programming Bundling Updates. Updates Unbundled Updates Local Updates

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Course Content
Topic
Topic 9 ENHANCEMENTS & MODIFICATIONS
Enhancements to SAP Objects E h Enhancements t via i Menu M Exits E it / Screen S Exits E it / Function F ti Module M d l exits it Business Add-Ins Modifications via Registering the Modifications in SSCR, Modification Adjustment, Rules for Modifications

Topic 10

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS
Introduction to BAPI BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps p for BAPI Creation List of Macros

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Course Content
Topic
Topic 11 ADDITIONAL TOPICS : SMART FORMS
Introduction to Smart Forms Structure of a form Windows Architecture Forms Nodes Form Painter Table Painter PC Editor Style Builder Driver Program

Topic 12

ADDITIONAL TOPICS : SAP SCRIPTS
Standard Text Layout Set Print Program

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Course Content
Topic

Topic 13

ADDITIONAL TOPICS : WORKFLOW BASICS
B i Business W Workplace k l Workflow Builder Tasks Business Object Repository (BOR)

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Sap Netweaver: An overview Navigation in R/3 system Overview of ABAP

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

1. INTRODUCTION SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Sap Netweaver: An overview Navigation in R/3 system Overview of ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Sap Netweaver: An overview Navigation in R/3 system Overview of ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .1.

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1. INTRODUCTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP WORKBENCH BASICS Data Types & Data Objects Internal Tables Modularization of ABAP R/3 ABAP Runtime system : Debugging Function Module & Function Groups p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .2.

Data types Elementary Predefined C.T.D.Data Types The e following o o g list st is s an a overview o e e o of the t e main a features eatu es o of data types a and d objects: •Data types: A data type describes the technical attributes of all the objects with that type.F.P. Reference Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .I.N. Structured TABLE : This predefined structured data type is used for the typing of formal parameters and field symbols Reference types describe data objects You will have to create your own that contain references (pointers) to references other objects (data objects and objects in ABAP Objects).X ABAP/4 Contains eight predefined elementary data yp types User-defined User defined elementary data yp based on the typesare predefined Elementary data types Field Strings and internal tables : These structured data types can be used for data objects and are user defined. There is no memory associated with data types.

and Time (T). They can be grouped as those with fixed length and those with variable length. Integer (I).Elementary Data Types. Numeric character (N). Date (D). •Variable-Length Elementary Types: There are two predefined types in ABAP with variable length: STRING for character strings Satyam SAP PMG SAP PMG XSTRING for byte strings Delivering Solution Excellence and Innovation . g •Fixed-Length Elementary Types: There are eight predefined types in ABAP with fixed length: A)Four character types: B)One hexadecimal type: C)Three numeric types: Character (C). Floating-point number (F) and Packed number (P).Predefined: •Predefined: Predefined elementary types are the smallest indivisible unit of types. Byte field (X) (X).

To define your own elementary data types. DATA: NO_FLIGHTS TYPE NUMBER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .User Defined User-defined: elementary data types are based entirely on predefined elementary data types. you use the TYPES statement Example: TYPES: NUMBER TYPE I TYPES I.Elementary Data Types .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . There are two kind of structured data types. •Field Strings: A field string is a collection of other data types types. Internal Table also extends vertically. structures as components.Structured Data Types: Structured Data types are made up of other types and generally are user defined. Unlike field strings.You define Internal Table with occurs parameter of the types p yp or Data statement Internal tables are characterized by: The line type The key and The access method.You You Define Field string with the TYPES statement or with the DATA statement. Internal Tables: Internal tables consists of a several lines that all have the same data type. which extends only horizontally.

You should observe these standards as soon as you start defining your data.ABAP/4 Program Layout To o write te a high g quality qua ty program p og a you should s ou d keep eep certain ce ta Layout ayout standards for ABAP/4 Programs. use the following Techniques: Indenting statement blocks Using Modularization Tools Inserting Program comments Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Follow when structuring your program flow. and use as many as informative comments as possible. If you follow these suggestions your program will be • more readable • easier to test and change • more reliable • To improve the quality of your programs.

Using Modularization Tools To produce good programs you should use modularization tools. Inserting g Program g comments Correctly y You should avoid placing comments on statement line. the logical structure of your program becomes b easier i to t identify.To insert subroutine headings and comments in your program use the ready-made ready made structures available in ABAP/4 Editor. Indent each block by at least two columns. Pretty Printer: The ABAP/4 Editor includes a tool which helps you to design the Layout of your program more easily. It follows ABAP/4 Layout guidelines Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .It id tif It also l allows ll you to t sort t the th subroutines according to the tasks they perform. Placing them on separate comment lines improves the readability of the program.ABAP/4 Program Layout Indenting statement blocks You should combine statements that belong together into a single block . If you write larger processing blocks as subroutines.

They provide the exact syntax and follow the ABAP/4 layout guidelines.Inserting ready-made structures Ready-made structures simplify the coding of ABAP/4 Programs Programs. Field: To display a list of all available ready-made keyword structures. instruct field and click the possible entry button to the right of the input field.Choose EDIT --> Insert statement or select Pattern. place the cursor in other instruct. 3 appears choose a statement with radiobutton or enter it in the other instruct . 3. proceed as follows: 1. In the dialogue Box that appears. You can insert Y i t two t kinds ki d of f ready-made d d structures t t into i t your program code when using the ABAP/4 Editor: A) Ready-Made Keyword Structures To insert a ready-made keyword structure into your code. 2. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Place the cursor on the line where you want to insert the structure.

Inserting ready-made Comment Lines B) Inserting Ready-Made Comment Lines: To insert ready-made comment lines into your code. instruct field. 2.Follow steps 1 to 2 in inserting Ready-Made Ready Made keyword structures.The system inserts comment lines into your program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Select a structure with an asterisk(*) as a first structure from the other instruct. proceed as follows: 1. field 3.

Data Objects Data objects contain the data with which ABAP programs work at runtime. Hence they are also referred to as unnamed data objects. they exist in the program code. ABAP contains the following kinds of data objects: A) Literal They are not created by declarative statements statements. Instead Instead. ABAP contains the following kinds of named data objects: Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Their technical attributes are always fixed. B) Named Data Objects You declare these data objects either statically or dynamically at runtime. They have fixed technical attributes but no name.

Interface work areas are special variables that serve as interfaces between programs. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Dynamic Data Objects You create them dynamically using data references. t t t Constants are data objects whose contents cannot be changed. and logical databases. Predefined Data Objects They do not have to be declared explicitly .Data Objects Text symbols are pointers to texts in the text pool of the ABAP program.they are always available at runtime. They do not have a name. screens. Variables are data objects whose contents can be changed using ABAP statements.

They have no validity outside that program.1415926536’.Numeric literals (using type n) Example: Data Pincode(10) type n value '600024'.Text literals (using type c) Example: Data name(10) type c value ‘SATYAM’.Internal Data objects •Internal data objects are created for use in one particular program. . B)Variables Example: DATA: S1 TYPE I. C)Constants Example: CONSTANTS PI TYPE P DECIMALS 10 VALUE '3. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Internal data objects include: A)Lit A)Literal l . SUM = S1 + 10.

but you y can copy py them to internal data objects j and write them back when you have finished.Data Objects External data objects External data objects exist independent of programs. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . External data objects can be used globally throughout the system environment. you declare the tables in the program with the TABLES statement . . ABAP/4 stores external data objects in tables defined in the ABAP/4 Dictionary. To access this data from within a program. You cannot work directly y with them.

To display a list of available system fields in the ABAP/4 Editor Editor. These are called System-defined data objects. They include: Space: The data Object SPACE is a constant of type C. where <name> specifies an individual field. It is one character long and contains a space.Data Objects : Contd. When you start an ABAP/4 program.. some data objects are available automatically and do not need to be declared. System-defined data objects Besides user-defined data objects. some data objects are defined automatically by the system. System fields: All System fields have names with the format SY-<name>. type SHOW SY in the command line. line Example: SY-UNAME : login name of the user SY-DATUM : current date SY-UZEIT : current time Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

namely: Parameters Parameters are variables which are linked to a selection screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . They can accept values after a program is started.Special data objects ABAP/4 includes some data objects with special features features. Selection criteria Selection criteria are special internal tables used to specify value ranges. They are linked to a selection screen.

te a s. either directly.you assign the data type of another data object<data object> to the declared data object. In declarative statements. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. using <declaration>…………TYPE<datatype>…………. using <declaration>like<dataobject>…………. Indirectly. you assign the data type<datatype>directly to the declared data object object.. •With the like option. you must ust declare dec a e each eac data object with t a dec declarative a at e statement .Creating Data Objects and Types Apart pa t from o literals. you must specify the data type of all data objects You define the data type of an object in the declarative statement statement. •Type yp and like are optional p additions to most of the data declaration statements listed below. •With the TYPE option.

.you you use the additional statements PARAMETERS SELECT-OPTIONS to create Data objects with special function Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .COLLECT and INSERT to create lines of an Internal Tables dynamically. In case of selection screens screens. you y use the operational p statements APPEND. but are only visible in a procedure The Tables system The Type statement for creating table work areas for creating user-defined data types In the context of Internal Tables.Creating Data Objects and Data Types: ABAP/4 includes the keywords for creating Data objects and Data types statically: The Data statement Th Constants The C t t statement t t t The Statics statement for creating variables f creating for ti constants t t for creating variables which exist as long as the program runs runs.

In its basic form. the keyword DATA has the following parameters: <f> f <length> <type> <value> <decimals> Naming a Variable Specifying the Data Type and the Length of the Variable Specifying p y g a Start Value Specifying the Number of Digits after the Decimal Point Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Basic Form of the DATA Statement •Data Statement •Syntax S t DATA <f>[(<length>)] <type> [<value>] [<decimals>].

og a . d you define d fi the th variable i bl with ith STATICS St Statement t ti in th that t procedure. you can create a data object called a table work area. Syntax: Statics<s>[<Length>]<type>[<Value>][<decimals>] Tables statement With the TABLES statement statement.Constants.Static and Tables If you use a constant co sta t frequently eque t y in a p program. you can ca declare dec a e it t as a Fixed value variable with the CONSTANTS statement as follows: Syntax: Constants<c>[<length>]<type><value>[<decimals>] Statics Statement If you want to retain the value of variable beyond the runtime of a procedure. A Table work area is a field string which refers to ABAP/4 dictionary objects. Syntax: Tables<dbtab> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

You can use data types defined by the TYPES statement in the same way you use predefined data types for d l i data declaring d t objects.The Types Statement You use the TYPES statement to create user-defined elementary data types and structured data types. bj t Syntax: Types<t>[<length>]<<type>[<decimals>] Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

In your ABAP/4 program. you declare type groups with the TYPE-POOLS statement as: S t Syntax: Type-Pools<name> T P l Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .TYPE GROUPS You use Type-Groups to store user-defined data types or constants in the ABAP/4 Dictionary for cross program use.

Determining the Decimal Places To determine the number of decimals for a Type P field. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you use the DECIMALS parameter with the DESCRIBE FIELD statement as follows: Syntax: Describe Field<f>Decimals<d>.

You can then use the field <m> directly as a format template in a write statement .Determine the conversion routine To determine whether a conversion routine exists for a field in ABAP/4 Dictionary use the EDIT MASK parameter with the Describe Field statement as follows: Syntax: Describe Field<f>EDIT MASK<m> If a conversion routine exists for the field <f> in the ABAP/4 Dictionary. as below: Write<f>using EDIT MASK<m> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . th system the t writes it it to t the th field fi ld <m> and d sets t the th return t code d value l in i the System Field SY-SUBRC equal to 0.

2. ABAP WORKBENCH BASICS Data Types & Data Objects Internal Tables Modularization of ABAP R/3 ABAP Runtime system : Debugging Function Module & Function Groups p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Internal Tables Objective: The following section explains : • Defining Internal Tables • Processing Internal Tables • Accessing A i Internal I t l Tables T bl • Initializing Internal Tables Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

• The number of lines in an internal table is not fixed. ABAP/4 Internal tables cannot be accessed outside the program environment.Internal Tables Internal I t l tables t bl are structured t t d data d t types t provided id d by b ABAP/4. fixed • Internal tables exist only during the run time of a program. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Purpose of internal tables • Internal tables are used to reorganize the contents of database tables according to the needs of your program • Internal tables are used to perform calculations on subsets of database tables.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the contents of the addressed t bl line table li overwrite it the th contents t t of f the th work k area..Accessing Internal Tables •You access internal tables line by line. •When you read data from an internal table. • When you write data to an internal table. you must first enter the data in the work area from which the system can transfer the data to the internal table. You must use a work area as an interface for transferring data to and from the table.

· Internal tables without header line Internal tables without a header line do not have a table work area which can be used implicitly you must specify a work area explicitly.Types of internal tables There are two kinds of internal tables in ABAP/4: · Internal tables with header line If you create an internal table with header line. the system automatically creates a work area with the same data type as the lines of the internal table. Note : Work area has the same name as the internal table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Creating Internal Tables Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Creating Internal Tables Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Creating Internal Tables Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Filling Internal Tables Appending Lines: To append a line to an internal table. COL2 TYPE N. Eg: TYPES : BEGIN OF LINE. LINE-COL2 = ‘1’. COL1 TYPE C. TAB1 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . APPEND LINE TO TAB1. DATA TAB1 TYPE STANDARD TABLE OF LINE. LINE-COL1 = ‘A’. N END OF LINE. use the APPEND statement as follows: Syntax APPEND [<wa> TO] <itab>.

Filling Internal Tables Appending Lines depending on the Standard Key (COLLECT STATEMENT) To fill an internal table with lines which have unique standard keys. Syntax S t COLLECT [<wa> INTO] <itab> If an entry with the same key already exists(all non non-numeric numeric fields) the collect statement does not append a new line but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

COLLECT TAB1. This Produces the output as follows: A 2 B 2 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COL2 TYPE I. ITAB1-COL2 = ‘1’. COLLECT TAB1.Filling Internal Tables Eg: TYPES : BEGIN OF LINE. ITAB1-COL1 = ‘B’. ITAB1-COL2 = ‘2’. ITAB1-COL1 = ‘A’. ITAB1-COL2 ITAB1 COL2 = ‘1’ 1. ITAB1-COL1 ITAB1 COL1 = ‘A’ A . END OF LINE. LINE DATA ITAB1 TYPE STANDARD TABLE OF LINE. COLLECT TAB1. COL1 TYPE C.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . INSERT LINE INTO TAB1 INDEX 2. COL1 TYPE C. LINE-COL1 = ‘A’.Filling Internal Tables Inserting se t g lines es : To insert a new line before a line in an internal table. id ] Eg: TYPES : BEGIN OF LINE. LINE-COL2 = ‘1’. you use the INSERT statement as follows: Syntax INSERT [<wa> [ INTO] <itab> it b [INDEX <idx>]. END OF LINE. C COL2 TYPE N. DATA TAB1 TYPE STANDARD TABLE OF LINE LINE.

LINE-COL2 = ‘1’. COL2 TYPE N. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DATA TAB2 TYPE STANDARD TABLE OF LINE. use the MOVE statement. MOVE TAB1[ ] TO TAB2.Filling Internal Tables COPYING CO G INTERNAL TABLES S: To copy the entire contents of one internal table into another. Syntax: MOVE <itab1> to <itab2> Eg: TYPES : BEGIN OF LINE. COL1 TYPE C. DATA TAB1 TYPE STANDARD TABLE OF LINE. APPEND LINE TO TAB1. N END OF LINE. LINE-COL1 = ‘A’.

WRITE: / ITAB-CONNID. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . all lines from the database table SPFLI in which CARRID field contains "LH" are read into the internal table ITAB. ENDLOOP. LOOP AT ITAB. In this example. ITAB-CARRID. where they can be processed further. SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = 'LH'.Filling Internal Tables Filli I Filling Internal t lT Table bl from f Database D t b Table: T bl Example DATA : ITAB TYPE STANDARD TABLE OF SPFLI WITH HEADER LINE.

t bl In this example. all lines from the database table SPFLI in which CARRID field contains "LH" are read into the internal table ITAB1 one by one. where they can be processed further.Filling Internal Tables T read To d data d t component t by b component t into i t the th internal i t l table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Reading Internal Tables Line by Line You use the the LOOP statement to read internal tables line by line. APPEND LINE TO TAB1.. LOOP AT <itab> [INTO <wa>] [WHERE <condition>] <condition>]. . ENDDO.. LOOP AT TAB1 WHERE COL1 > 2. WRITE : / TAB1-COL1.. ENDLOOP.. ENDLOOP. you can use either the LOOP or the READ statement. Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . Eg: DO 3 TIMES. LINE-COL1 = SY-INDEX.Reading Internal Tables To read the contents of internal tables for further processing. LINE-COL2 = SY-INDEX * SY-INDEX.

LINE DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. LINE-COL1 LINE COL1 = SY SY-INDEX INDEX. COL2 TYPE N. Eg: TYPES : BEGIN OF LINE LINE. COL1 TYPE C. LINE LINE-COL2 COL2 = SY SY-INDEX INDEX ** 2. READ TABLE TAB1 INTO LINE WITH KEY COL2 = 4. DO 3 TIMES. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 2 APPEND LINE TO TAB1.Reading Internal Tables You ou can ca select se ect a single s g e line e by the t e READ statement: state e t Syntax: READ TABLE <itab> [INTO <wa>] WITH KEY<key> [BINARY SEARCH]. END OF LINE. ENDDO.

LINE-COL2 = SY-INDEX ** 2. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. ENDDO. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COL2 TYPE N. READ TABLE TAB1 INTO LINE INDEX 2 COMPARING COL1 COL2. it returns the value 2. APPEND LINE TO TAB1.Reading Internal Tables The e CO COMPARING G addition. COL1 TYPE C. the t e specified spec ed table tab e fields e ds <f i > o of the t e structured st uctu ed line type are compared with the corresponding fields of the work area before being transported. SY-SUBRC is set to 0. TIMES LINE-COL1 = SY-INDEX. Syntax: READ TABLE <itab> [INTO <wa>] INDEX <idx> COMPARING <fields>. Eg: TYPES : BEGIN OF LINE. If the contents of the compared fields are the same. If the contents of the compared fields are not the same. add t o . N END OF LINE. DO 3 TIMES.

LINE-COL2 = SY-INDEX ** 2. END OF LINE. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE LINE. COL1 TYPE C. LINE-COL1 = SY-INDEX. APPEND LINE TO TAB1. LINE-COL1 = ‘A’. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . TAB1 ENDDO. Eg: TYPES : BEGIN OF LINE.Modifying Internal tables You can modify single line using MODIFY statement: Syntax : MODIFY itab [FROM wa] [INDEX idx]. DO 3 TIMES. MODIFY TAB1 FROM LINE INDEX 2. C COL2 TYPE N.

fn [WHERE cond]]. LINE-COL1 = ‘A’. LINE COL1 TYPE C. DO 3 TIMES. ENDDO. END OF LINE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Eg: TYPES : BEGIN OF LINE. MODIFY O TAB1 FROM O LINE TRANSPORTING S O G COL1 CO WHERE COL2 CO = 4..Modifying Internal tables Syntax : MODIFY itab [FROM wa] [TRANSPORTING f1 . LINE-COL2 = SY-INDEX ** 2. APPEND LINE TO TAB1.. LINE-COL1 = SY-INDEX. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. COL2 TYPE N.

. LOOP AT TAB1.ENDLOOP block. LINE-COL2 = SY-INDEX * SY-INDEX. <itab> Note: The System can process this statement only within an LOOP. IF TAB1-COL1 TAB1 COL1 > 2 2.Deleting Internal tables T delete To d l t lines li from f an internal i t l table t bl in i a loop: l Syntax: DELETE <itab>. APPEND LINE TO TAB1. ENDIF. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Eg: DO 3 TIMES. TAB1 ENDDO. DELETE TAB1. ENDLOOP. LINE-COL1 = SY-INDEX.

LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX * SY-INDEX. APPEND LINE TO TAB1. I d Syntax: DELETE <itab> INDEX <idx>. END OF LINE. ENDDO. DELETE TAB1 INDEX 2. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. COL2 TYPE N. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Deleting Internal tables TO delete d l t the th lines li using i Index. DO 3 TIMES. COL1 TYPE C. <idx> Eg: TYPES : BEGIN OF LINE.

LINE-COL2 = ‘1’. DELETE ADJACENT DUPLICATE ENTRIES FROM TAB1 COMPARING COL1. APPEND LINE TO TAB1. END OF LINE. Syntax: DELETE ADJACENT DUPLICATE ENTRIES FROM <itab> it b [ COMPARING <comp>] Eg: TYPES : BEGIN OF LINE. LINE-COL1 = ‘A’.Deleting Internal tables TO delete the Adjacent Duplicates from the Internal Table. APPEND LINE TO TAB1. LINE COL1 TYPE C. LINE-COL1 = ‘A’. COL2 TYPE N. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. LINE-COL2 = ‘2’. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

LINE-COL1 = ‘A’. T bl Syntax: DELETE ADJACENT DUPLICATE ENTRIES FROM <itab> [ COMPARING <comp>] Eg: TYPES : BEGIN OF LINE. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. DELETE ADJACENT DUPLICATE ENTRIES FROM TAB1 COMPARING ALL FIELDS FIELDS. COL2 TYPE N. LINE-COL2 = ‘2’. COL1 TYPE C. END OF LINE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LINE-COL2 = ‘2’. APPEND LINE TO TAB1. APPEND LINE TO TAB1. LINE-COL1 = ‘A’.Deleting Internal tables TO delete d l t the th Adjacent Adj t Duplicates D li t from f the th Internal I t l Table.

APPEND LINE TO TAB1. LINE-COL1 = ‘A’. LINE-COL2 = ‘1’. END OF LINE. DELETE TAB1 WHERE COL2 = 2. Syntax: DELETE <itab> it b [FROM <n1>] 1 ] [TO <n2>] 2 ] [WHERE <condition>]. diti ] Eg: TYPES : BEGIN OF LINE. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE.Deleting Internal tables TO delete a set of selected lines from the Internal Table. 2 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . APPEND LINE TO TAB1. LINE-COL2 = ‘2’. TAB1 LINE-COL1 = ‘A’. COL2 TYPE N. COL1 TYPE C.

COL2 TYPE N. APPEND LINE TO TAB1. . <fn> [<order>] [AS TEXT] ] . SORT TAB1 BY COL2 ASCENDING . LINE LINE-COL2 COL2 = ‘2’ 2. APPEND LINE TO TAB1. LINE-COL1 LINE COL1 = ‘A’ A . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COL1 TYPE C. LINE-COL1 = ‘A’. N END OF LINE. LINE-COL2 = ‘1’.Sorting Internal Table TO Sort an Internal Table . DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. Syntax: SORT <itab> [<order>] [AS TEXT] [BY <f1> [<order>] [AS TEXT] . Eg: TYPES : BEGIN OF LINE.

COL1 TYPE C. END OF LINE. LINE DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. COL2 TYPE I. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LINE COL1 = SY LINE-COL1 SY-INDEX. ENDDO. SUM. DO 3 TIMES. APPEND LINE TO TAB1.Loop Processing Calculating Ca cu at g the t e totals tota s within t loop…endloop. ENDLOOP. LOOP AT TAB1 TAB1. TYPES : BEGIN OF LINE. oop e d oop Syntax: SUM Eg. INDEX LINE LINE-COL2 COL2 = SY-INDEX SY INDEX ** 2 2.

Syntax: AT <line> <statement block> ENDAT.Using Control Levels This s top topic c describes desc bes how o to use control co t o level e e statement state e t b blocks oc s which c process only specific values within loop…endloop. at which the statement block within ATENDAT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . <Line> Meaning FIRST First line of the internal table LAST Last line of the internal table NEW <f> Beginning of a group of line with same contents in the fields <f> & in the fields of <f>. You should sort the internal table in the same order as its columns are defined. The line condition <line>. Note: Before working with control breaks. END OF <f> E d of End f a group of f line li with ith same contents t t in i the fields <f> & in the fields of <f>.

< l2> ENDAT AT END OF <col1>……ENDAT. AT NEW <col2>……ENDAT. the loop is to be programmed as f ll follows: LOOP AT <itab>. ENDLOOP.<col2>.… and if it is sorted by the columns as they are defined. <single line processing> ……. AT END OF <col2>…..ENDAT. AT FIRST.. …..ENDAT.. If the internal table has the columns <col1>.ENDAT. AT LAST……ENDAT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ……. AT NEW <col1>….Using Control Levels Hierarchy of AT-ENDAT statement statement.

LINE-COL2 = ‘2’ 2. LINE-COL1 = ‘B’. LINE-COL1 = ‘A’.Using Control Levels Example: TYPES : BEGIN OF LINE. COL2 TYPE I. SORT TAB1 BY COL1. LINE-COL1 = ‘C’. APPEND LINE TO TAB1. LINE-COL2 = ‘3’. COL1 TYPE C. APPEND LINE TO TAB1. APPEND LINE TO TAB1. I END OF LINE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LINE-COL2 = ‘4’. LINE-COL1 = ‘A’ A . LINE-COL2 = ‘1’. DATA TAB1 TYPE TABLE OF LINE WITH HEADER LINE. APPEND LINE TO TAB1.

Using Control Levels Cont. COL2. AT AT SUM. TAB1 TAB1-COL2. ENDAT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . WRITE:/ TAB1-COL1. LAST. Cont LOOP AT TAB1. ENDLOOP. TAB1-COL2. NEW COL1. AT END OF COL1. WRITE:/ TAB1-COL1. ENDAT. COL1. SUM.. AT FIRST. ENDAT. . ENDAT. WRITE:/ ‘HEADING’. WRITE:/ TAB1 TAB1-COL1.

CLEAR <itab>[ ]. li Syntax : REFRESH <itab>. the clear statement clears only the table work area resetting to initial values. FREE <itab>. This statement resets an internal table. You can release the memory with the FREE statement once initialized. CLEAR <itab>. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If you are working with an internal table with a header line .Initializing Internal Tables T initialize To i iti li an internal i t l table t bl with ith or without ith t header h d line. The square bracket after the name of the internal table refer to the body of the internal table.This statement also resets an internal table.

TAB1 ENDIF. IF TAB1 IS INITIAL.Initializing Internal Tables Example: TYPES : BEGIN OF LINE. END OF LINE. FREE TAB1. LINE-COL1 = ‘A’. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COL1 TYPE C. LINE-COL2 = ‘1’. LINE-COL1 = ‘B’. WRITE:/ ‘TAB1 IS EMPTY’. LINE-COL2 = ‘2’. CLEAR TAB1. REFRESH TAB1 TAB1. APPEND LINE TO TAB1. COL2 TYPE I. DATA TAB1 . APPEND LINE TO TAB1.

ABAP WORKBENCH BASICS Data Types & Data Objects Internal Tables Modularization of ABAP R/3 ABAP Runtime system : Debugging Function Module & Function Groups p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .2.

Modularizing ABAP/4 Programs Objective: The following section explains : • Include Programs • Macros • Subroutines • Passing Data • Terminating Subroutines • Field Symbols • Clusters Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Modularizing ABAP/4 Programs Each ac ABAP/4 / p program og a has as a modular odu a structure. st uctu e ABAP/4 programs are divided into: · Processing blocks that are controlled by events when the program is a report program ( program of type 1). M) You can modularize either your source code or tasks which are to be performed repeatedly. · Modules that are controlled by the screen flow logic when the program is an dialog program (module pool of type M).

Include programs b Macros b. To modularize tasks the following two methods apply: a. Subroutine b.Source Code Modularization To modularize source codes the following two methods apply: a. Functional modules Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

you can code them once in an include program. How to create include programs ? How to use Include programs ? Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .In the case of lengthy data declarations.Include Programs If you want to use the same sequence of statements in several programs. Example .

Defining and Calling Macros You can create callable modules of program code within your ABAP/4 program by defining macros. macros To define a macro which contains part of the source code. <statements> END-OF-DEFINITION. Macro Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . This defines f the macro <macro>. Note : Debugger does not stop at break break-points points applied at Macro. You must specify f complete statements between DEFINE and END-OF-DEFINITION. you use the DEFINE statement as follows: Syntax: DEFINE <macro>.

· External subroutines: The source code of external subroutines is in an ABAP/4 program other than the calling procedure (external call). There are two types of subroutines. · I t Internal l subroutines: b ti The source code of internal subroutines is in the same ABAP/4 program as the calling procedure (internal call). call) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Subroutines Subroutines are program modules which can be called from ABAP/4 programs.

<statement block> ENDFORM. <subr> <pass> The name of the subroutine. You specify how to pass data to and from the subroutine { {mainly y for external call}.Defining Subroutines A subroutine is a block of code introduced by FORM and concluded by ENDFORM To ENDFORM. b ti use the th following f ll i syntax: t Syntax: FORM <subr> [<pass>] [<pass>]. T define d fi a subroutine. } Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

2.] [CHANGING a1 a2 . Calling Internal Subroutines: To call an internal subroutine.Calling Subroutines 1 1. use the PERFORM statement as follows: Syntax: PERFORM <subr>(<prog>) [<pass>] [IF FOUND]..] [USING a1 a2 .. use the PERFORM statement as follows: Syntax: PERFORM <subr> [<pass>].. [<pass>] can be interpreted as : [TABLES itab1 itab2 .. Calling External Subroutines: To call an external subroutine.] Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ...

you do not have to use the <pass> option. y you must decide whether to use the <pass> option or declare data objects in common parts of the memory. · In the case of external subroutines.Calling Subroutines Note: · In the case of internal subroutines. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . because the subroutine can access all data objects declared in the main ABAP/4 program.

Passing Data Passing Data Between Calling Programs and Subroutines: 1. Passing Data by Parameters Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Declaring Data as Common Part 2.

. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can use several common parts in one program..... <data d t declaration>.. you must assign a name <name> to each common part.. In this case. use the DATA statement as follows: Syntax: DATA: BEGIN OF COMMON PART [<name>].. If you use only one common part per program..Declaring Data As Common Part To declare data objects as common part.. d l ti .. END OF COMMON PART [<name>]. the name <name> is optional...

Passing Data By Parameters You can pass data between calling programs and subroutines by using parameters. Syntax: PERFORM <subr>[(<prog>)] [TABLES <actual table list>] [USING <actual t l input i t list>] li t ] [CHANGING <actual output list>] FORM <subr> [TABLES <formal table list>] [USING <formal input list>] [CHANGING <formal output list>] Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . · Parameters which are defined during g the definition of a subroutine with the FORM statement are called formal parameters. · Parameters which are specified during the call of a subroutine with the PERFORM statement are called actual parameters.

Calling by Value : During a subroutine call. If you change h the th formal f l parameter. the formal parameters are created as copies p p of the actual parameters. The formal parameter t h has no memory of f its it own. only the address of the actual parameter is transferred to the formal parameters. p The formal parameters have their own memory space. Changes to the formal parameter have no effect on the actual parameter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Different Methods Of Passing Data Calling by Reference : During a subroutine call. The formal parameters have memory of their own. call the formal parameters are created as copies of the actual parameters. t the field contents in the calling program also change. Calling by Value and Result : During a subroutine call. Changes to the formal parameters are copied to the actual parameter at the end of the subroutine.

[USING <fi1> ... <fin>] [CHANGING <fo1> . <aon>] … FORM . <fon>] . <ain>] [CHANGING <ao1> ... You specify the formal and actual parameters in the list behind USING and CHANGING without any addition..Passing By Reference To pass data between calling programs and subroutines by reference..... Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ...... [USING <ai1> . use USING or CHANGING for the <pass> option of the FORM and PERFORM statements as follows: Syntax: PERFORM...

....VALUE(<fii>) .. use USING for the <pass> option of the FORM and PERFORM statements as follows: Syntax: PERFORM. even if it is changed in the subroutine. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ..<aii> . FORM ...... USING ...... you can pass data to a subroutine by value. USING .Passing By Value To ensure that an input parameter is not changed in the calling program program. For this.

..... CHANGING . PERFORM CHANGING .<aii> PERFORM.....Passing By Value And Result If y you want to return a changed g output p parameter p from a subroutine to the calling program only after the subroutine has run successfully.. < ii> .. use CHANGING for the <pass> option of the FORM and PERFORM statements as follows: Syntax: FORM .. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .VALUE(<fii>) .....

STRING1(6) TYPE C. C STRING2(8) TYPE C. DATE2 TYPE T. PERFORM TYPETEST USING DATE1 STRING1 NUMBER1 COUNT1. COUNT2 TYPE I. DATA: DATE1 TYPE D. NUMBER2 TYPE P. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COUNT1 TYPE I. COUNT1 PERFORM TYPETEST USING DATE2 STRING2 NUMBER2 COUNT2.Example REPORT FORMTEST. C NUMBER1 TYPE P DECIMALS 2.

FORM TYPETEST USING NOW TXT TYPE C VALUE(NUM) TYPE P INT TYPE I.. DATA: T. WRITE: / 'Length of TXT is'.Example Cont. T. WRITE: / 'Type of INT is'. DESCRIBE FIELD INT TYPE T. ENDFORM ENDFORM. WRITE: / 'Type of NOW is'. T. T. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DESCRIBE FIELD NOW TYPE T. DESCRIBE FIELD NUM DECIMALS T. WRITE: / 'Decimals of NUM are'. are' T T. DESCRIBE FIELD TXT LENGTH T.

DATA: BEGIN OF LINE. PERFORM OUT USING ITAB. COL1 COL2 TYPE I. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Example Example of passing internal tables: PROGRAM FORM_TEST. PERFORM FILL CHANGING ITAB ITAB. DATA ITAB LIKE STANDARD TABLE OF LINE. CO 1 TYPE I. END OF LINE.

ENDFORM. F_LINE-COL2 = SY-INDEX ** 2.Example Cont. DATA F_LINE LIKE LINE OF F_ITAB. Co t FORM FILL CHANGING F_ITAB LIKE ITAB. DO 3 TIMES. ENDFORM. F_LINE-COL1 = SY-INDEX. FORM OUT USING VALUE(F_ITAB) LIKE ITAB. ENDLOOP. LOOP AT F F_ITAB ITAB INTO F_LINE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . F LINE WRITE: / F_LINE-COL1. F_LINE-COL2. ITAB ENDDO. APPEND F F_LINE LINE TO F F_ITAB.. DATA F_LINE LIKE LINE OF F_ITAB.

you can proceed in a similar way as for terminating a loop by using the EXIT or CHECK statements. · Use EXIT to terminate a subroutine unconditionally. the system terminates the processing of the subroutine at this point point. passes the parameters. · Use U CHECK t to t terminate i t a subroutine b ti according di to t a condition. diti If you terminate a subroutine using EXIT or CHECK.Terminating Subroutines To terminate the processing of a subroutine. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . and continues with the statement after the PERFORM statement.

Syntax: FIELD-SYMBOLS <FS> <type> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . fi ld but b t point i t to t its it contents.Field Symbols Field symbols are placeholders or symbolic names for other fields. Typing Field Symbols: The <type> addition allows you to specify the type of a field symbol. use the statement. They d not do t physically h i ll reserve space for f a field. FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>]. t t A field symbol can point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program. To declare a Field Symbol.

COL3(5) END OF LINE1. LINE2 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . COL1(2). COL1(3). DATA: BEGIN OF LINE2 LINE2. COL2 LIKE SY-DATUM. COL3(5). END OF LINE2.Field Symbols E Example: l DATA: WA(10) VALUE '0123456789'. DATA: BEGIN OF LINE1. COL2(2).

WRITE: / <F1>-COL1.Field Symbols Cont. FIELD-SYMBOLS: <F1> STRUCTURE LINE1 DEFAULT WA. <F2>-COL2. The output is: 012 34 56789 01 2345/67/89 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . <F1>-COL3.. <F2> STRUCTURE LINE2 DEFAULT WA. / <F2>-COL1. <F1>-COL2.

ASSIGN TEXT TO <F1>. Eg: FIELD-SYMBOLS: <F1> .Field Symbols Static Assign: The name of the data object you want to assign to a field symbol before run time. TEXT(10) TYPE C VALUE ‘HELLO’. WRITE: / <F1> . ASSIGN NUM TO <F2>. <F2> OUTPUT: HELLO Satyam SAP PMG SAP PMG 5 Delivering Solution Excellence and Innovation . <F2>. <F2> TYPE I. S t Syntax: ASSIGN <f> TO <FS>. DATA : NUM TYPE I VALUE 5.

Eg: PROGRAM SAPMZTST. Syntax: ASSIGN (<f>) TO <FS>. FORM FORM1.Field Symbols Dynamic y a c Assign: ss g The name of the data object you want to assign to a field symbol only at run time. WRITE: / <F1>. FIELD-SYMBOLS <F1>. PERFORM FORM1(SAPMZTST1). ENDFORM ENDFORM. * Calling Subroutine PROGRAM SAPMZTST1. ASSIGN (NUM) TO <F1>. DATA : NUM TYPE N VALUE 5. OUTPUT: 5 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Clusters Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

For example. you can pass data between: · Reports and other Reports called with SUBMIT · Transactions and Reports · Programs and Function Modules Note : The memory is released again when you leave the transaction. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Clusters You can store data clusters in ABAP/4 memory. ABAP/4 memory is not dependent on the ABAP/4 program or program module which generates it during a transaction. This means that an object stored in ABAP/4 memory can be read again by any ABAP/4 program during the same transaction.

TO MEMORY ID <key>...Storing Data Objects In ABAP/4 Memory To write data objects from an ABAP/4 program to ABAP/4 memory. you use the following statement: Syntax: EXPORT <f1> <f2> . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Reading Data Objects From Memory To read data objects from ABAP/4 memory into an ABAP/4 program. FROM MEMORY ID <key>... you use the following statement: Syntax: IMPORT <f1> [TO <g1>] <f2> [TO <g2>] .

ABAP WORKBENCH BASICS Data Types & Data Objects Internal Tables Modularization of ABAP R/3 ABAP Runtime system : Debugging Function Module & Function Groups p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .2.

OBJECTIVES The slides for the ABAP/4 Development Workbench’s on line Debuggers C t i th Contain the following f ll i topics: t i •Online debugging tools •Starting the debugger •The debugger’s views •Using break points •Setting static break points •Setting dynamic break points •Setting watch points •Setting g breakpoints p at keywords y or events •Deleting and deactivating breakpoints •Stepping through program codes •Displaying field contents Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Debugging •Displaying Internal tables •Displaying ABAP/4 lists •Replacing field values at runtime •Changing internal tables at runtime •Switching S it hi to t the th ABAP/4 Editor Edit •Releasing the database during debugging Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

St Stepping i th through h a program with ith the th debugger d b h l helps you to t detect d t t and d correct errors in your code. effectively Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Debugging •Online debugging tools : A review The ABAP/4 Debugger lets you stop a program during runtime and examine the flow and results of each statement during execution.This documentation is designed for developers new to the Workbench’s debugging facilities or for those who want to learn the tool to use the tool more effectively.

Debugging After working through this slides . With this slides. you will learn how to •Switch on the debugger •Set and delete static and dynamic break points. you should be able to debug both familiar and unfamiliar programs effectively. •Display field contents during runtime. •Change g field contents for testing g purposes. p p •Change the contents of an internal table. •Display and use debugger’s views. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Set watch points •Stop a program at specific key words or events or when a field contents change. •Continue processing after an interrupt. •Display the contents of an internal table.

Setting break points is a good strategy if we want to examine a program: After the system has already processed certain events Just before a specific event is carried out By y skipping pp g q quickly y to a specific p routines or calls. We can set tb breakpoints k i t i in a program and d th then start t t the th program within ithi the th Debugger.Alternatively. we can run the program in the debugger without any breakpoints. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . A Breakpoint is a signal within a line of code that tells the ABAP/4 runtime processor to interrupt the program at the line.Debugging Debugging Strategies form within ABAP/4 Development Work bench.

Debugging •Starting the Debugger On running a program in the debugging mode the following steps can be followed. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Debugger’s views A debugger gg selects different views . by y selecting g appropriate pp p view name in debugger’s menu. Choose debugging in the ABAP/4 editor initial screen Choose Program ÆExecute ÆDebugging or choose debugging. From any screen . Choose SystemÆUtilities ÆDebug ABAP/4. In the object browser . Select a report or transaction.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Displays an active event chain and the call sequence up to the current breakpoint. Fields .Debugging Th These buttons b tt has h following f ll i specific ifi meaning.Displays the content of an internal table. Table .Displays the structure of the program to be debugged. i Overview . debugged Call stack .Displays the fields content and technical characteristics.

gg g Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Each debugging view has the same structure.Debugging •Structure of the Debugging view. which tells the ABAP/4 processor to interrupt the program at a particular point. The type of breakpoint p depends p on the p purpose p of debugging. The lower half shows i f information ti specific ifi to t that th t particular ti l view i . The top half of the screen displays a portion of the programs source code.A A small stop sign appears to the left of each dynamic break point . Using Breakpoints A breakpoint is a signal within a program’s code . The line currently ready for processing is indicated by “>” > .At At the th Line Li ‘S ‘Source C d of’ Code f’ appears two push buttons to scroll through the program code.

Debugging ABAP Debugging Screen Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

•Static Th These are user independent i d d t .Debugging Following are the types of breakpoints. User dependent breakpoints also is possible. This is used to observe changes g to a particular p field .Watch points are field-specific. set t directly di tl into i t a program’s ’ code d with ith the th editor. This type is visible when the program is displayed in the editor. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .The debugger gg interrupts p the program when fields content change. •Watch points Set within the ABAP/4 debugger . •Dynamic Set within the ABAP/4 debugger or editor.

Debugging •Key word (statement) or event breakpoints Set within the ABAP/4 debugger. we use dynamic break-point. If we want to interrupt a program when we execute and while others are running. On setting this breakpoint . D namic breakpoints are more flexible Dynamic fle ible than static breakpoint . •When a static breakpoint is used? Static break point are generally user-independent. they the can be removed or deactivated during runtime. This is used when several developers are working in the same program. The debugger interrupts the program when the ABAP/4 processor comes in contact with a specific key word (statement) or event in program’s code. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . These breakpoints are visible in the programs code. and all wants to the program to interrupt at the same place during g execution. every use who executes the program encounters the breakpoint. •When a dynamic breakpoint is used? Dynamic break point is user-specific.

Place the break point on the line where to interrupt the program: Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . we can allocate breakpoint for specific ABAP/4 keywords or program events. p •Setting To set a static break point use ‘BREAK-POINT’ keyword. We can set and remove watch points as Needed . ts We can set watchpoints only from within the debugger. but still want the program to be interrupted just before the command or event is carried out. does not disturb the other users of the same program.They are useful if we want to interrupt a program only when there is a change in a particular field or a field string. This is useful if we do not know exactly where a key word or event occurs . as dynamic breakpoint . g Static Breakpoints. From within debugger .Debugging •When e to use watch atc po points.This . •When to use breakpoints at Keywords (statements) or Events.

for POINT2... It is necessary to remove breakpoints since it may cause serious disruptions in productive process. BREAK-POINT. …….BREAK . ENDIF.Debugging REPORT RSDEBUG1 …………… CHECK ACCOUNT IF SY SY-SUBRC SUBRC NE 0 0. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Removing g Breakpoints. p It is necessary to remove the breakpoints after debugging . When we start the report .BREAK-POINT2.Use function Utilities Æ Global search to help in locating break-points in larger programs. ABAP/4 interrupts the processing at the break point.for easier identification. We can number breakpoints like BREAK BREAK-POINT1 POINT1 .

Following are the steps to set a breakpoint in ABAP/4 Editor. Choose Utilities --> > Breakpoint ÆSet or press the ‘stop’ stop pushbutton at the top. without changing the program’s code. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Debugging •Setting Dynamic Breakpoints We can set dynamic breakpoint . The dynamic breakpoint display leads to navigate to a certain breakpoint or delete one or all breakpoints from the program code. Place the cursor on the line where to position the breakpoint. A display of all breakpoints in a program can be obtained by selecting UtilitiesÆBreakpointÆDisplay .

asking for the ‘local local watch point point’. p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Fill the appropriate value in the text field next and press the tick . •Press the pushbutton ‘Watchpoint’ on the top left . •A display of watch points can be viewed by goto-->Control debugging--> gg g Watchpoint. A watch point is set to interrupt a program when the contents of a specific field or a string change. i t •On the Debugging editor.Debugging •Setting Watchpoints. •A dialog box appears . relational operator and comparison field . F ll i are the Following th steps t t set to t a watch t h point.Fill in as per requirement. enter the table-field.

If we want to interrupt the program directly before a certain keyword event or a subroutine . as per requirement. W can achieve We hi thi with this ith the th following f ll i steps t i the in th editor. it is possible to access the current program . module •The system will display a small screen prompting to enter statement keyword or subroutine etc. not external subroutine calls. dit •Choose either Breakpoint ÆBreakpoint at ÆStatement or subroutine or function module. or subroutine appears pp in the p program. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ..Debugging •Setting Breakpoints at (statements) keywords or subroutines. we use this facility. g •For break point in form routines . The system will set a breakpoint each time the statement .

Temporary deleting of Dynamic breakpoint is possible by selecting the appropriate line and select BreakpointÆ Deactivate/Activate in the abap Debugger. •Select one breakpoint. li From within the editor. •The System will list all the breakpoints. place the cursor in a line and choose BreakpointÆSet/Delete or Delete. steps •Choose Goto--> Control Debugging-->Breakpoint. Deleting this breakpoint is also possible by double clicking the appropriate i t line. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Debugging •Deleting a dynamic Break-point. deleting the dynamic breakpoint is done by the following steps. To delete a dynamic breakpoint . •Choose individual by double clicking on the icon ‘Stop’ and it deletes .

it is p possible to set or delete individual breakpoints. and can be deleted by pressing ‘delete’ checkbox at the end of each Watchpoint . Select Goto--> Control Debugging -->Breakpoints to get an overview of all existing breakpoints in a program’s code. To remove a watch point .Debugging •Deleting Watchpoints. Watch points are special break points set for specific fields. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . d b i W t h i t A display of the watch point occurs . the following steps will do. Choose Goto Ch G t --> Control C t l debugging-->Watchpoint. •Displaying the Location of breakpoints. From the breakpoint p display p y .

If no further breakpoints exists. Thus this skips over the lines of the subroutine itself. If single step is chosen while on a line that calls a FORM routine . that calls a FORM routine. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Continue: Processes the program up to the next active dynamic or static break point.Debugging •Stepping through program code. Single step : Execute a program statement by statement.After routine After stepping the way through the subroutine. the debugger executes the subroutine subroutine and halts at the line of code directly y following g the call. for example the next mouse click carries to the called routine. Execute : Process a program line by line. returns to the line of code directly following the subroutine call. From within the debugger several options for stepping through the program. the system executes the report in its entirety without stopping. On choosing Execute while on a line.

Can be used from within a subroutine call. We can use the variable screen to display the contents of any system field or all field that a p program g references. t t While debugging display of the critical of the critical contents of the fields are possible. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Also the debugger gg to display p y fields defined in the ABAP/4 Dictionary can be used. To display the contents of dictionary fields. we must define relevant table in the TABLES statement of the current program. We can enter the field names directly in the spaces provided or double click the field in the code display and the system lists it as a variable automatically.Debugging Return: Returns the debugger to where a calling program resumes control. possible Display of the contents up to eight fields or field strings possible can be done. •Displaying Di l i the th field fi ld contents.

Debugging Additionally the contents of the fields from external programs can be displayed. For this we need to place the name of the external program in brackets in front of the field name. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

we can display the contents of an internal table by choosing the Table pushbutton. If we remove a field name from the column header line. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . i S Specify if a table bl name in i the h Internal I l table field or double click on the table. numbered We can scroll through the table display using the Index field or the scroll icons. the system displays a string of question marks.The >>>>>>> The table rows are numbered. this line appears before the actual table contents and is marked in the display by >>>>>>>. If we want to see those parts of the tables that are not visible on the left or right of the screen . we can also change g the sequence q of the fields we want to see. If the internal table contains a header line. then the system deletes the field from the display. Within the debugger . . Using g the column header line. use the push buttons for horizontal scrolling or simply shift the title bar of the table. Th system displays The di l the h Table T bl view. If we specify an incorrect field name.Debugging •Displaying Internal tables.

Debugging A View e o of internal te a tab table ed display sp ay Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The system displays all the lines generated so far in their respective formats. we can display p y this list in the debugger. Note : The current list line is formatted only after completion (NEW-LINE). return to the screen with the field display and program code by selecting the program button. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Debugging If the space you leave to display a field is too small . the display list pushbutton appears. You Y can change this to an X for hexadecimal or a C for character display. As soon as this list is started. the system truncates the display and indicates this by a “<” character. As with the field display . If we are debugging gg g an online report p that g generates a list. •Displaying ABAP/4 Lists. we can customize the display format for internal t bl tables. Choose Display list to switch to the list display. . Once we have finished examining the internal table . Th standard The t d d entry t in i the th Format F t field fi ld is i an E (for (f edited) dit d) .

We can change the values of all fields . we can replace l th the faulty value at run time to determine if the program then runs correctly. database tables (with offset) and internal tables referenced in a report . for f example l . If error analysis reveals th t a field that fi ld contains t i a wrong value l . but only in the work area ABAP/4 provides for one run of the report . we do not change them in the database itself . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If we alter the values of database fields . While we are debugging a program . we might want to change the content of specific fields to influence our program’s flow.The system displays an appropriate message if any format errors occur.Debugging •Replacing fields at Runtime.

Note: ABAP/4 accepts p our entries in the contents column exactly y as we specified them. 4.Choose the ‘Change field content’ button. right justified output with packed numbers). Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If we forget to click on the ‘Change Change field content content’ push push-button button . the system ignores the values we entered. This is the Debugger’s default view.Debugging To replace the value . You need to pay special attention to the correct format. we can do the following steps.Go to the variable display screen.Double li k on a variable i bl to t place l it in i the th variables i bl display. ABAP/4 writes the new value back to the program field or fields and the system notes the change in the system log. 1. di l 3. 2 D bl click 2.( Upper or lower case .Enter a new value in the field contents row .

3. The line disappears from the table and the system adjusts the line numbering accordingly. edit or add a row to an internal table. Go to the table display screen 2. Enter the table name in the internal table field. 4.Debugging •Changing Internal Tables at Runtime The debugger allows to manipulate the contents of an internal table during runtime. We can delete. The system displays the table’s contents.Place the cursor on the line y you wish to remove from the table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Choose Enter. 5.Press ‘Delete’ pushbutton. •Deleting a row To delete an entry from an internal table: 1.

1. we first need to decide which field to change. 2. 4. Insert and append are field-specific in the Debugger and can be carried out only one field at a time by pressing the respective pushbuttons.Choose Change. Then the following steps must be done.If we want to edit the following line: LH001 FRANKFURT NEWYORK 145400 400 X.Enter a new value for the field. For example . 3.Choose Enter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Place the cursor on the row and field we want to edit. The system updates the line and displays the new contents in the table.Debugging •Editing a row The functions Change .

Choose Insert button and proceed as we want to append the line. anywhere To add a new row to the end of the table .position the cursor on y following g the line where we want the new row to appear. Append places the new line at the end of the table.Choose append. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Insert lets us to position the line anywhere.Enter the remaining fields of the line by following the procedure for editing a row as described above. the following steps will do. 2.Enter a value for the first field in the line. Adding a Row We can add a new row to an internal table by using either Append or the Insert function. pp the line directly Then .Debugging • . To insert a new line anywhere in the internal table . 3. 1.Choose Enter. The system adds a line to the table and fills in the first field. 4.

for example. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If we discover a program error during the debugging process .Debugging •Switching to the ABAP/4 Editor . We can switch from the Debugger to ABAP/4 Editor at any time.Then the breakpoints appear in the debugger. After we set static breakpoints in the editor. To return to the Editor for the program currently being debugged .they editor they are not active in the debugger when we switch back.We must re-generate the program. Select Development-->ABAP/4 Editor.we can enter the ABAP/4 Editor to immediately correct the error in the program’s code. We can also switch back to the editor in order to set new static break-points.

. Debugging gg g Program B170D051 Breakpoints Program . ... System Help /h Satyam SAP PMG SAP PMG ..... .. Object List Development object . Utilities ... . .... . Any screen .Debugging SYNOPSIS A representation of Debugging Process -Branching to Debugging Mode ABAP/4 Debugger ABAP/4 Editor .. Breakpoint .. Test/execute / ... .......... .. Debug ABAP/4 . Delivering Solution Excellence and Innovation ..

COMPUTE DATE_1 = SY-DATUM. DATA: DIFF TYPE P. . . . .Debugging Debugging Mode Execute Single step Execute Continue Table PROGRAM B170D051. . V i bl Variables DATE_1 SY-DATUM 00000000 19940223 O S V F T P View pushbuttons R R R R X R Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . .

Displays the contents of internal tables. Data contents can be displayed in hexadecimal format. You go to the ABAP/4 editor. Table Breakpoint Editor Hexadecimaldisplay Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . In contrast to the single step. executes all p a processing ocess g steps belonging be o g g to one o e line.Debugging The e Most ost Important po ta t Debugging ebugg g Functions u ct o s Single Step Execute Continue Processes the next program line line. e Processing continues until the next breakpoint or until the end of the program. With the functions of this menu you define breakpoints.

Debugging Setting Breakpoints 1 ABAP/4 Editor Menu Utilities -> Breakpoints Keyword BREAK-POINT BREAK POINT 2 Debugging mode Line selection (double-click) Menu: Breakpoint -> Set/delete Goto -> Breakpoints Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Debugging General Ge e a Que Queries es Question •Static Break-point are user independent (YES/NO) YES •Dynamic Breakpoints are not user-specific(YES/NO) NO •Dynamic breakpoints are visible in the program(YES/NO) YES •Dynamic Breakpoints are more flexible than Static Breakpoints(YES/NO) YES •Static Breakpoints are hard-coded in the program(YES/NO) YES •Temporary deletion of dynamic breakpoints are not possible(YES/NO) NO Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

YES •How can a temporary deletion of dynamic Breakpoints are done? Temporary deletion of Breakpoints are ACTIVATE/DEACTIVATE in the debugging editor.Debugging •Watchpoints can be set only from within the debugger (YES/NO).it is impossible to correct wrong values in a table’s field dynamically during runtime (YES/NO) NO Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . done by option •What are the different options to step through the program in the debugger? Single Step Execute Continue Return •While debugging .

switching it hi to t ABAP/4 Editor Edit is i not t allowed. YES •From F th ABAB Debugger the D b .Debugging •Addition and deletion Debugger(YES/NO). ll d (YES/NO) NO of fields in a table is possible in Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

the debugging tools for various operations like usage of breakpoints .Debugging Summary The above slides have given an idea of debugging .internal t bl display. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . d switching it hi to t ABAP editor and associated utilities.stepping tables di l t i through th h a program code. watch points .

2. ABAP WORKBENCH BASICS Data Types & Data Objects Internal Tables Modularization of ABAP R/3 ABAP Runtime system : Debugging Function Module & Function Groups p Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Function Modules Object e Objective The following section is intended to explain: • • • What function modules are Components of function modules Testing and releasing of function modules Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Lib Function F ti groups act t as containers t i for f function f ti modules that logically belong together. We can also create your own function modules using Function Builder. • Function modules allow us to encapsulate and reuse global functions in the R/3 System. • The R/3 System provides numerous predefined function modules that we can call from your ABAP/4 programs.Function Modules • Function modules are special external subroutines(program type F) • Function modules are classified in function groups and stored in the F Function ti Library. • Function modules also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system. (Transaction Code SE 37) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . that is. they are always called from a different program. p g • Subroutines are defined in ABAP programs while Function modules are defined within function groups • Function modules have clearly defined data interfaces to the calling program.Function Modules vs Subroutines • Subroutines are principally for local modularization while Function modules are for global modularization. • We can test function modules in a stand-alone mode independent of the calling program.

modules We cannot execute a function group. t ti ll • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . d d) Function group names are freely definable up to a maximum length of p characters.Function Groups • • Function groups are containers for function modules. 26 alphanumeric When we create a function group or function module in the Function Builder . the main program and include programs are generated automatically. When we call a function module. the system loads the whole of its function group into the internal session i of f the th calling lli program (if it h has not t already l d b been l loaded).

Creating Function Groups New function groups can be created from the menu Goto .Create Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Function Group .

Programming Function Modules To o program p og a a function u ct o module.Pattern Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . odu e. we e must ust include c ude our ou statements state e ts between the FUNCTION and ENDFUNCTION statements as follows: Syntax : FUNCTION <module> <statements> ENDFUNCTION An existing Function Module can be inserted into ABAP Code using Edit .

The internal table's contents are transferred from the calling program to the function module. Changing :Values that act as import and export parameters simultaneously. The function module can alter the contents of the internal table and then send it back to the calling program. Tables are always passed by reference. Th original The i i l value l of f a changing h i parameter t is i transferred t f d from f the th calling lli program to the function module. Tables: Internal tables that can be imported and exported. p Error situations that can occur within the function module. Export: Values transferred from the function module back to the calling program. The function module can alter the initial value and send it back to the calling program. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Exceptions: The calling program uses exceptions to find out if an error has occurred in the function module. It can then react accordingly.You odu e ou cannot overwrite the contents of import parameters at runtime.Components of Functional Modules Import: po t Values a ues transferred t a s e ed from o the t e calling ca g p program og a to t the e function u ct o module.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Import Parameters Import parameters : These must be supplied with data when we call the function module. unless they are flagged as optional. We cannot change them in the function module.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Export parameters are always optional. We do not have to receive them in our program.Export Parameters Export parameters: These pass data from the function module back to the calling program.

Changing parameters act simultaneously as import and export parameters.Changing Parameters C a g g parameters Changing pa a ete s : C Changing a g g pa parameters a ete s a are e passed by reference e e e ce o or by value and result. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . They change the value passed to the function module and return it to the calling program.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Tables Parameters Tables parameters :We use these to pass internal tables. The use of these exists in earlier FM definitions. we can also pass internal tables with other parameters if you specify the parameter type appropriately. as they are considered obsolete now . They are treated like CHANGING parameters. However.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . we can define exceptions.Exceptions • When creating function modules. The calling program determines whether and which exceptions it is to handle itself. • We can assign the same error number to several exceptions exceptions. • The OTHERS clause covers all exceptions not explicitly specified.

We can work with the source code in the same way as is done for normal ABAP/4 programs opened via forward navigation. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Source Code Tab This tab shows the source of the function module in the ABAP/4 editor.

• Define the function module interface by entering its parameters and exceptions. If not. • Create the function module. • Write the actual ABAP code for the function module. if no appropriate group exists yet. create one as follows. • Document the module and its parameters for other users. • Release the module for general use use. • Activate the module. adding any relevant global data to the TOP include. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • Test the module.Creating Function Modules • Check whether a suitable function module already exists. • Create a function group.

Otherwise. • At runtime.Runtime Considerations • The CALL FUNCTION statement can pass import. lt you should h ld plan l carefully f ll which functions really belong in a group and which do not. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the system checks the type and length when the parameters are transferred. • If you declare the parameters with reference to ABAP Dictionary fields or structures. the calling program terminates. export and changing parameters either by value or by reference. all function modules belonging to a function group are l d d with loaded ith the th calling lli program. As A a result. import export. calling your function modules will unnecessarily increase the amount of memory required by the user user. If the parameters from the calling program do not pass this check. Table parameters are always transferred by reference.

and administer function modules in an integrated environment. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Function Builder The Function Builder allows us to create. test.

Function Builder Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Function Module Attributes Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

It cannot be updated subsequently. g statistical updates).g. • Immediate Start. p ) • Collective Run :A number of similar function modules that previously used to run individually in the V2 update process can be grouped together and run collectively. You use delayed update primarily for database changes g that are not time-critical ( (e.Processing Types • Normal Function Module : Indicates that the function is a normal one • Remote-enabled Module : Shows that the function is remote enabled • Update Module • Start Update Immediately :The function module is processed immediately in the update task task. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . No restart : The function module will be edited in the update task.Function Module Attributes . • Start Delayed :The function module is processed in the update task as a low priority item.

The system displays the standard Function Module search screen. screen Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . choose Find from the initial screen of the Function Builder.Finding Function Modules • U Using i th the Repository R it Information I f ti System S t To search for a module.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can use this hierarchy to display function modules associated with particular applications applications.Finding Function Modules • U Using i th the Application A li ti Hierarchy Hi h The Application Hierarchy provides an overview of all the applications in your R/3 system.

..... f n = a n] [EXCEPTIONS e1 = r 1..... f n = a n] [IMPORTING f1 = a 1.Calling Function Modules CALL FUNCTION <module> < d l > [EXPORTING f1 = a 1.. e n = r n [ERROR_MESSAGE = r E] [OTHERS = ro] ]. f n = a n] [TABLES f1 = a 1. f n = a n] [CHANGING f1 = a 1..... Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ..

WHEN 3. WRITE 'Target field 1 too short!'. CALL FUNCTION 'STRING_SPLIT_AT_POSITION' EXPORTING STRING = TEXT POS = POSITION IMPORTING STRING1 = TEXT1 STRING2 = TEXT2 EXCEPTIONS STRING1_TOO_SMALL = 1 STRING2_TOO_SMALL = 2 POS_NOT_VALID = 3 OTHERS = 4. Delivering Solution Excellence and Innovation . WRITE 'Other errors!'. WHEN 4. WRITE: / TEXT. CALL FUNCTION DATA: TEXT(10) TYPE C VALUE '0123456789'. TEXT2(6) TYPE C. TEXT1(6) TYPE C. WRITE 'Target field 2 too short!'. WHEN 1. / TEXT1.Example PROGRAM CALL_FUNCTION. / TEXT2. WHEN 2. ENDCASE. PARAMETERS POSITION TYPE I. WHEN 0. WRITE 'Invalid split position!'.CALL FUNCTION . Satyam SAP PMG SAP PMG CASE SY-SUBRC SY-SUBRC.

A detailed documentation will help us to understand the function module without having to examine its source code. There are two kinds of documentation .parameter documentation.Documenting function modules The documentation Th d t ti for f the th function f ti module d l is i done d in i the th Function F ti Builder. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • The parameter documentation must provide users with information f about the different parameters and exceptions. • Function module documentation contains important p detailed information about the task of the function module. and full function module documentation.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Activating Function Module Function Module can be activated from the menu as shown below below.

Activating Function Group Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The system also identifies the time required to execute the module in microseconds. Fiscal Year Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the system displays any exceptions.Initial Screen • We can test function modules without having to include them in a program using the Function Builder. Fiscal Period.Testing Function Modules . Example Function : BAPI_CCODE_GET_FIRSTDAY_PERIOD Import Parameters: Company Code. When we test a function module.

It also shows the time required for executing the function module.Result Screen The e function u ct o BAPI_CCO CCODE_G GET_FIRSTDAY S _PERIOD O when e e executed ecuted with t values given in the previous screen gives the following output.Testing Function Module . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

kli t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Releasing function modules Releasing a function module is a purely administrative gesture with no effect on the function or its usability. When a function module is released its documentation is released for translation and appears in the relevant t translator's l t ' worklist. Releasing a function module signals that a developer has tested it.

Function Modules Summary This section explained : • • • The creation of function modules Components of function modules Releasing and activation of function modules Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .3.

structures. All the other components of the Workbench can actively access the definitions stored in the ABAP Dictionary Dictionary.Data Dictionary The ABAP Dictionary centrally describes and manages all the data definitions used in the system. The most important object types in the ABAP Dictionary are :1> Tables 2> Views 3> Types (data elements. The ABAP Dictionary is completely integrated in the ABAP Development Workbench. table types) 4> Domains 5> Search helps 6 L 6> Lock k objects bj t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

A view on the database can then be created from this structure. The structure of a type can be defined globally in ABAP programs. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Changes to a type automatically take effect in all the programs using the type. A table having the same structure is then created from this table definition in the underlying database.Data Dictionary Tables are defined in the ABAP Dictionary independently of the database. Types are used in ABAP program. The structure of the view is defined in the ABAP Dictionary. Views are logical views on more than one table table.

A domain defines the value range of all table fields and structure components that refer to this domain. The ABAP Dictionary also contains the information displayed with the F1 and F4 help for a field in an input template. Function modules that can be used in application programs are generated from the definition of a lock object in the ABAP Dictionary. Different fields having the same technical type can be combined in domains. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary Lock Objects are used to synchronize access to the same data by more than one user.

Data Dictionary The documentation about the field is created for a data element that describes the meaning of the contents of a table field. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The list of possible input values that appears for the input help is created by a foreign key or a search help.

Data Dictionary ABAP Dictionary (Transaction se11): Initial Screen Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

3. ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Data Dictionary/ Table Technical Settings Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

address and telephone number. APPL1 (transaction (t ti data): d t ) Data D t th that t is i frequently f tl changed. Each data class corresponds to a physical area in which all the tables assigned to this data class are stored. An example of master data is the data contained in an address file. h d Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . stored There are the following data classes: APPL0 (master data): Data which is seldomly changed. your table is automatically assigned i d to t the th correct t area (tablespace (t bl or DBspace) DB ) of f the th database d t b when it is created.Data Dictionary/ Table Data Class If you choose the data class correctly. such as the name.

Data Dictionary/ Table An example of transaction data is the goods in a warehouse. these data classes are stored in a tablespace for user developments. These are for user developments. Two further data classes. USR and USR1. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . are provided for the p The tables assigned g to customer. An example is the table with country codes. which change after each purchase order. APPL2 (organizational data): Customizing data that is defined when the system is installed and seldomly changed.

Data Dictionary/ Table Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

additional memory will be added depending on the selected size i category. t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Each category is assigned a certain fixed memory size in the database. which depends on the database system used. If more space is required at a later time due to data entries. initial space (an Initial Extent) is reserved in the database.Data Dictionary/ Table Size Category The size category defines the expected space required for the table in th database. When a table is created. the d t b You Y can choose h a size i category t from f 0 to t 4 for f your table.

Data Dictionary/ Table Selecting the correct size category prevents a large number of very small extents from being created for a table. It also prevents space from being wasted if extents which are too large are created. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

bl There Th are three th possibilities ibiliti h here: 1> Buffering not permitted: Table buffering is not permitted. 2> Buffering permitted but not activated: Buffering is permitted from the business and technical points of view. for example because application programs always need the most recent data from the table or the table is changed too frequently. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Table Buffering You must define whether and how a table is buffered in the technical settings tti f for th the t table. Applications which access the table execute correctly with and without table buffering.

In this case you must specify a buffering type. If table buffering would be advantageous for the table size and access profile of the table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Table Whether or not table buffering will result in a gain in performance depends on the table size and access profile of the table (frequency of the different types of table access). 3> Buffering activated: The table should be buffered. you can activate it in the customer system at any time. Table buffering is deactivated because it is not possible to know what these values will be in the customer system.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . however. only the records that are actually read are loaded into the buffer. The administrative costs in the buffer. are greater than for generic or full buffering. Single-record buffering therefore requires less storage space in the buffer than generic and full buffering. Considerably more database accesses are necessary to load the records than for the other buffering types types.Data Dictionary/ Table Buffering types: 1> Single-Record buffering With single-record buffering.

Data Dictionary/ Table In this example. only the record that was read is loaded into the buffer. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the record highlighted in red is read by a program from table SCOUNTER. If single-record buffering is selected for the table.

whereas several database accesses are necessary for single-record buffering. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The size of the records being accessed should be between 100 and 200 KB KB. This is because only one database access is necessary to load such a table with full buffering. Full buffering is usually more suitable for smaller tables that are accessed frequently.Data Dictionary/ Table When Should you Use Single-Record Buffering? Single-record buffering should be used particularly for large tables where only a few records are accessed with SELECT SINGLE.

The generic key is a part of the primary key of the table that is left-justified. all the records in the buffer whose generic key fields match this record are loaded when one record of the table is accessed. left justified Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Table 2> Generic buffering With generic buffering.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the record highlighted in red is read by a program from table SCOUNTER.Data Dictionary/ Table In this example. If the table is generically buffered. all the records read whose generic key fields (MANDT and CARRID) agree are loaded into the buffer.

Client specific fully-buffered Client-specific. The client field is the generic g key. the generic key i l d all includes ll the th key k fields fi ld up to t and d including i l di the th language l field. fi ld Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Language-specific tables are another example where generic buffering is recommended.Data Dictionary/ Table When Should you Use Full Buffering? A table should be buffered generically if only certain generic areas of the table are normally needed for processing. In this case. In general. fully buffered tables are automatically generically buffered since normally it is not possible to work in all clients at the same time on an application pp server. only records of one language will be needed on an application server.

All the records of the table are loaded into the buffer when one record of the table is read. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . either the entire table is in the buffer or the table is not in the buffer at all.Data Dictionary/ Table 3> Full buffering With full buffering.

Data Dictionary/ Table In this example. If the table is fully buffered. a program reads the record highlighted in red from table SCOUNTER. all the records of the table are loaded into the buffer. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

q y. read frequently frequently. the number of read accesses. this value can be exceeded. written Full buffering is recommended in the following cases: Tables up p to 30 KB in size. If a table is accessed frequently.Data Dictionary/ Table When Should you Use Full Buffering? When deciding whether a table should be fully buffered. Tables best suited to full buffering are small small. Larger tables where large numbers of records are frequently Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you should always pay attention to the buffer utilization. and rarely written. and the number of write accesses. However. but all accesses are read accesses. you should take into account the size of the table.

Data Dictionary/ Table accessed. Tables for which accesses to non non-existent existent records are frequently submitted. the system can determine directly in the buffer whether or not a record exists. it could be better to dispense with buffering. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Since all the table records reside in the buffer. If these mass accesses can be formulated with a very selective WHERE condition using a database index.

First of all. Note: Activating logging slows down accesses that change the table. Secondly. a record must be written in the log table for each change. DELETE) to an existing data record by a user or an application program is recorded in a log table in the database. activated every change (with UPDATE. logged If logging is activated.Data Dictionary/ Table Logging The logging flag defines whether changes to the data records of a table should be logged. t bl Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . many users access this log table in parallel. This could cause lock situations even though the users are working ki with ith different diff t application li ti tables.

Data Dictionary/ Table Dependencies Logging only takes place if parameter rec/client in the system profile is set correctly correctly. Setting the flag on its own does not cause the table changes to be logged. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The existing g logs g can be displayed p y with Transaction Table history y (SCU3).

L: Table for storing temporary data. maintenance There are the following development classes: A: Application table (master and transaction data). C: Customer table.upgrade. d client li t copy and d when h transporting t ti between b t customer t systems. data is only maintained by the customer. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Table Delivery class The delivery class controls the transport of table data for installation . The delivery class is also used in the extended table maintenance.

SAP may insert new data records but may not overwrite or delete existing ones. The customer namespace must be defined in table TRESC. data changes have the status of program changes changes.Data Dictionary/ Table G: Customer table. R3TR PROG.).g. R3TR TABL. etc. W: System table (e.g. table of the development environment) whose data is transported with its own transport objects (e. E: System table with its own namespace for customer entries. S: System table table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .3.

d i these th are used d in the input check in screen templates. length 1) in the flight model describes the possible classes of a flight booking. F and Y may be entered in screen templates for all the fields that refer to this d domain. i Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . F (first class) and Y (economy class). ) the fixed values are also offered in the input (F4) help.Data Dictionary/ Domain Fixed values for a domain The value range of a domain can be further restricted by defining fi d values. The value range of domain S_CLASS is defined by the fixed values C (business class).foreign help foreign key ). If no other means of help is defined for a field ( search help. fixed l If fixed fi d values l are defined d fi d for f a domain. Only the values C. Domain S_CLASS (data type CHAR.

You can enter an explanatory text for every single value or interval. NUMC. There is only an input check of the template for data types CHAR and NUMC. it is displayed in the input help. help It is only possible to define fixed values for domains of data types CHAR.Data Dictionary/ Domain You can define fixed value intervals either by entering upper and lower limits or by specifying single values. INT2 and INT4. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DEC. INT1. Value ranges and single values can be combined as required.

Data Dictionary/ Domain Fixed values for a domain Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

p This proposal p p can be overridden. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . All the airlines are listed together with their codes in table SCARR. table The system proposes the value table as check table when you try to define a foreign g key y for the field or component. Domain S_CARR_ID (data type CHAR. length 3) in the flight model describes the three-place code of the airlines.Data Dictionary/ Domain Value Table for a domain In some cases you can see when you define a domain that all the table fields or structure components referring to this domain should be checked against a certain table. This information can be stored in the domain by entering a value table.

Data Dictionary/ Domain It is generally advisable to check fields referring to domain S_CARR_ID against table SCARR. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . table A check is not implemented by simply entering a value table! The check against the value table only takes effect when a foreign key has been defined. If you want to define a foreign key for a field referring to S_CARR_ID. SCARR is proposed as the check table. SCARR is therefore entered as value table for domain S_CARR_ID.

Data Dictionary/ Domain Value table for a domain Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Procedure 1> Select object type Domains in the initial screen of the ABAP Dictionary. In this case you should use the existing domain if possible. You can for example find the domain at a later time using this short text. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Enter an explanatory short text in the field Short text.Data Dictionary/ Creating Domain Before creating a new domain. enter the name of the domain and choose Create. 2> The maintenance screen for domains appears. check whether a domain that defines the same value range already exists.

FLTP. choose the data type. If you enter an invalid number of p places for such a data type. the system y corrects this automatically after issuing a warning. the data type CLNT (client) always has 3 places. 4> If only certain input values are valid for the domain.Data Dictionary/ Creating Domain 3> On the Data type tab page. Y can also You l define d fi a value l table t bl as proposed d value l for f foreign f i Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you can enter them in the Value range tab page as fixed values. Note that some data types have a fixed length length. QUAN and CURR). yp . For example example. number of places (valid positions without editing characters such as comma or period) and number of decimal places (only needed for data types DEC.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You are asked to assign the domain a development class. 6> Choose Activate icon. the activation log is automatically displayed. Result The domain is activated. If errors occurred when the domain was activated. which you can call with Utilities ® Activation log.Data Dictionary/ Creating Domain key checks on this tab page. You can find information about the activation flow in the activation log. 5> Save the domain.

If the domain does not have a value table or if y you reject j the proposal. The check table must have a key field to which the domain of the check field is assigned. In this case. the screen for foreign key maintenance appears without proposals. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . in the foreign key.Data Dictionary/ Creating Foreign Key Procedure 1> In the field maintenance screen of the table. select the check field and choose If the domain of the check field has a value table. enter the check table and save your entries. you can have the system create a proposal with the value table as check table In this case a proposal will be made for the field assignment table.

The short text provides a technical documentation of the meaning of the foreign key. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 3> Choose Copy Copy.Data Dictionary/ Creating Foreign Key 2> Enter an explanatory short text in the field Short text. The foreign key is saved and you return to the maintenance screen for the table.

3. ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

you only get the records of the cross cross-product product for which there is an entry in all tables used in the view.Data Dictionary/ Views Inner Join and Outer Join The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . With an outer join. The set of hits determined by an inner join can therefore be a subset of the hits determined with an outer join. records are also selected for which there is no entry in some of the tables used in the view. With an inner join join.

Data Dictionary/ Views Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

data The structure of such a view is defined by specifying the tables and fields used in the view.Data Dictionary/ Views Data about an application object is often distributed on several tables. thereby minimizing interfaces. A view can be used in ABAP programs for data selection. you can define an application-dependent view that combines this data. By defining a view. Fields that are not required can be hidden. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Data Dictionary/ Views Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

database Projection j views are used to hide fields of a table ( (only yp projection). Maintenance views permit you to maintain the data distributed on several l tables t bl for f one application li ti object bj t at t one time.Data Dictionary/ Views Four different view types are supported. Database views are implemented with an equivalent view on the database. These differ in the way in which the view is implemented and in the methods permitted for accessing the view data. ti Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . j ) Help views can be used as selection method in search helps.

A database view is automatically created in the underlying database when it is activated. A database view provides an application-specific view on such distributed data. Database D t b views i implement i l t an inner i join.Data Dictionary/ Views. you can minimize the number of database accesses in i this thi way. j i Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. the data is actually selected in the database. Database views are defined in the ABAP Dictionary. Since the join operation is executed in the database in this case.Database Views Data about an application object is often distributed on several database tables. However. Application pp programs p g can access the data of a database view using g the database interface.

If the database view contains more than one table. you o can only onl read the data.Data Dictionary/ Views. data Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Views If the database view only contains a single table. the maintenance status can be used to determine if data records can also be inserted with the view.

Place the cursor on a table name and choose Relationships.Data Dictionary/ Views. 2> Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.Creating Database Views Procedure 1> Enter an explanatory short text in the field Short text. All foreign keys to other tables defined for this table are di l displayed. 3> Link the tables with join conditions. C Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Keep p in mind that you y can only y include transparent p tables in a database view. You can for example find the view at a later time using this short text. d Select S l t the th foreign f i keys k and d choose h Copy.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . select the fields that you want to copy to the view. Choose Table fields fields. All the tables contained in the view are displayed in a dialog box.Creating Database Views The join condition is now derived from the definitions in the foreign key. you can (optionally) formulate restrictions for the data records to be displayed with the view .Data Dictionary/ Views. 5> On the Selection conditions tab page. 4> On the View fields tab page. All the fields contained in this table are displayed. Select a table. p y You can copy py fields by y selecting g them in the first column and choosing Copy.

8> Save your entries. you can (optionally) maintain the technical settings of the database view. You are asked to assign the view a development class. h Proceed P d as for f the h technical h i l settings i of f a table bl 7> On the Maintenance status tab page.Data Dictionary/ Views. view If the view contains more than one table. You can define whether and how the database view should be b ff buffered d here.Technical settings . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 9> Choose Activate . select the maintenance status of the database view. the maintenance status read only y cannot be altered. 6> With Goto .Creating Database Views The selection conditions define the data records that can be selected with the view.

A projection view contains exactly one table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you only read and write the field contents actually needed. The R/3 System maps the access to a projection view to the corresponding access to its base table table. There is no corresponding object in the database for a projection view. You can also access pooled tables and cluster tables with a projection view.Data Dictionary/ Views.Projection View Projection views are used to hide fields of a table. for example when you access the database. This can minimize interfaces. You cannot define selection conditions for projection views.

Projection View Projection View Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Views.

Creating Projection View Procedure 1> Enter an explanatory short text in the field Short text. A projection view always contains exactly one table. You can for example find the view at a later time using this short text. Choose Table fields. You can copy fields by selecting them in the first column and choosing Copy. 3> Select the fields of the base table that y you want to include in the view.Data Dictionary/ Views. 2> Enter a table name in the field Base table table. 4> Save your entries.You are asked to assign the view a development class. l Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The fields of the table are now displayed in a dialog box.

Data Dictionary/ Views. it can be displayed with Utilities ® Activation log. At activation.Creating Projection View 5> Choose Activate. If errors or warnings occurring when the view was activated. they are displayed directly in the activation log. a log is written. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Result The help view is activated.

Data Dictionary/ Views-Help View You have to create a help view if a view with outer join is needed as selection method of a search help. a database view always implements an inner join. you have to use a help view as selection method method. However. you should generally use a database view as selection method. The creation method for Help p view is similar to that of Database view. If you need a view with outer join for the data selection. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . p The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help.

Data Dictionary/ Views-Help View Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .3.

This search help only has to be assigned g to the screen fields in which they y should be available. There are two types of search help: Elementary search helps describe a search path. This standard process can be completely defined by creating a search help in the ABAP Dictionary. how the exchange of values between th screen template the t l t and d selection l ti method th d is i implemented i l t d Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The user can display the list of all possible input values for a screen field with the input help. The elementary search help must define where the data of the hit list should be read from (selection method).Data Dictionary/ Search Help The input help (F4 help) is a standard function of the R/3 System.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Search Help (interface of the search help) and how the online input help should be defined (online behavior of the search help). A collective search help thus can offer several alternative search paths paths. Collective search helps Combine several elementary search helps.

such as the name and address. address 2>The user should be able to search for the customer number using g existing customer bookings. Two elementary search helps SCUSTOM_NAME (for searching with the customer data) and SCUSTOM_BOOK (for searching with ith th the existing i ti bookings) b ki ) are created t d for f the th actual t l search h paths.Data Dictionary/ Search Help. The user must be offered two different search paths. 1> The user should be able to search for the customer number using the customer data data. th Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You want to find a search option for this customer number.Examples Each customer of a carrier or of a travel agency has a customer number.

All this data is contained in table SCUSTOM. These are the fields that should appear either in the dialog box for restricting values or in the hit list. You now have to decide which fields of the selection method are needed for the input help process. city country) country). Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Search Help. Elementary Search Help SCUSTOM_NAME This elementary search help should enable you to search for the customer number using the name and address (street. Table SCUSTOM must therefore be selected as the selection method of the elementary search help.Examples These elementary search helps are included in the collective search help SCUSTOM. (street city.

Data Dictionary/ Search Help. STREET CITY and COUNTRY of table SCUSTOM must be included in the search help as parameters. These fields as well as the customer’s number (the information to be found must always be in the hit list) should appear in the hit list. Restrictions for the other parameters of the search help must be entered in the dialog box for Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the fields for the street. city and country.e. The parameter ID is declared to be an import parameter. A pattern entered in the corresponding field of a screen template can therefore be used directly for the value selection. the user should be able to restrict values with the customer’s name and address.Examples In the dialog box for restricting values. NAME STREET. ID NAME. list The fields ID. i.

Examples value selection. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . all the parameters of the hit list can be returned to the screen template if the corresponding fields are available there.All the parameters of the search help are declared to be export parameters. As a result.Data Dictionary/ Search Help.

Data Dictionary/ Search Help.Examples Elementary Search help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

t t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . enter the name of the search help and choose Create. 3> Enter an explanatory text in the field Short text. You can for example find the search help at a later time using thi short this h t text. help 2> Select Elementary y search help p and choose .Data Dictionary/ Creating Search Help Procedure 1> In the initial screen of the ABAP Dictionary. The maintenance screen for elementary search helps appears. select object class Search help. A dialog box appears in which you must select the type of search help.

You can enter the name of a table or a view (database view . field 5> Using g the input p help p (F4 ( help). projection view or help view) here. Select the fields that should be used in the dialog box for value selection or in the hit list. If you enter a table that has a text table. select fields of the selection method as parameter in the Search help parameter area. the name of the text table is automatically entered in the corresponding field. If the selection method is a table that has a text table. p).Data Dictionary/ Creating Search Help 4> In the Definition tab page enter the selection method of the search help. both the fi ld of fields f the th table t bl and d the th fields fi ld of f the th text t t table t bl are offered ff d in i the th Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

To do so. Only data elements whose data type. The data element defines the output attributes and the F1 help of the parameter in the hit list and in the dialog box for value selection. selection You can assign the parameter another data element.Data Dictionary/ Creating Search Help input help. g The Data element field is now ready y for input. p Then select a data element with the input help (F4 help). This removes the link between the data element of the search help parameter t and d the th data d t element l t of f the th selection l ti method th d field fi ld having h i Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The data element of the parameter is automatically copied from the selection method. select the Mod flag. length and number of decimal places is the same as those of the previous data element can be assigned.

Select the IMP flag if it is an import parameter parameter. Enter the parameter position in the dialog box for value selection i SPos. in SP If you enter t nothing thi or the th value l 0 here. the parameter is not displayed in the hit list. You can define the dialog g for the input p help p with the fields LPos. SPos and SDis. If you enter nothing or the value 0 here. If you cancel the Mod flag. . the data element of the assigned table field is used again. h the th parameter t is i Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Select the EXP flag if it is an export parameter. 6> Define the attributes of the search help parameters.Data Dictionary/ Creating Search Help the same name. Enter the parameter position in the hit list in LPos.

Set the SDis flag if the parameter should be a pure display field in the dialog box for value selection. You can assign g the parameter p a default value in the Default value field. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The user is thus informed that the contents of the parameter restrict the value. but he cannot change this restriction. restriction This makes sense for example when the parameter is an import parameter or if it has a default value. 7> Select the dialog type of the search help.Data Dictionary/ Creating Search Help not displayed in the dialog box for value selection. The dialog type defines how the hit list is displayed in the input h l help.

9> Choose Activate . A dialog box appears in which you have to assign the search help a development class. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Creating Search Help 8> Save your entries.

d the th hit list li t will ill become b more Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ll d The following dialog types are possible: 1> Immediate value display: The hit list is immediately displayed when the input help is called. Choose this option if the list of possible entries is usually very large. If the user limits th amount the t of f data d t to t be b processed.Data Dictionary/ Creating Search Help Dialog types for a Search help The dialog type of an elementary search help defines how the hit list i displayed is di l d when h the th input i t help h l is i called. 2> Complex dialog with value restriction: The dialog window for restricting values is offered immediately. This is only meaningful if the hit list usually only contains a few entries.

entries it is displayed immediately.Data Dictionary/ Creating Search Help comprehensible and the system load during value selection will be reduced. 3> Dialog depending on number of values: If the hit list contains less than 100 entries. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . immediately If the hit list contains more than 100 entries. the dialog box for restricting values is displayed.

Data Dictionary/ Collective Search Help Collective Search Help SCUSTOM Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Data Dictionary/ Collective Search Help F4 for Collective Search Help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

enter the name of the search help and choose Create.You can for example find the search help at a later time using this short text. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/Creating Collective Search Help Procedure 1> In the initial screen of the ABAP Dictionary. 3> Enter an explanatory text in the field Short text. select object class Search help. help 2> Select Collective search help and choose . 2 The maintenance screen for collective search helps is displayed. A dialog box appears in which you must select the type of search help.

Select the Exp flag if it is an export parameter parameter. You can implement the deviation from the standard using a search help exit. In this case enter the name of the search help exit in the corresponding field. You can assign the parameter a default value in the Default value field. Select the Imp flag if it is an import parameter.Data Dictionary/Creating Collective Search Help 4> In the Definition tab page enter the parameters of the collective search help. 5> In exceptions it could be necessary to change the standard process defined by the search help. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Define the types for the parameters of a collective search help by assigning a data element. Enter the name of the data element that describes the contents of the search help parameter in the Data element field.

h l Use U the Hide flag to control whether an included search help should appear in the dialog box for selecting the elementary search help. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . define the search helps that you want to include in the collective search help. If the flag is set set. 8> Choose Activate. A dialog box appears in which you have to assign a development class to the search help. the search help is not offered. offered 7> Save your entries.Data Dictionary/Creating Collective Search Help 6> On the Included search helps tab page.You can i l d elementary include l t search h helps h l and d collective ll ti search h helps.

ABAP DATA DICTIONARY Introduction Database tables Domains Views Search Helps p Locking Concept Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .3.

l ti hi Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Dictionary Structure of a Lock Object j The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. one table (the primary table) is first selected. When interactive transactions are programmed. When tables are selected. Further tables (secondary tables) can also be added using f foreign i key k relationships. These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary. locks are set and released by calling function modules .Data Dictionary/ Lock Objects The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism.

Data Dictionary/ Lock Objects Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The lock argument fields therefore define which subset of the table rows should be locked.Data Dictionary/ Lock Objects Lock Arguments The lock argument g of a table in the lock object j consists of the key y fields of the table. The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. These values can also be generic generic. When these function modules d l are called. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ll d the th table t bl rows to t be b locked l k d or unlocked l k d are specified by defining certain values in these fields.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a position table. A lock request therefore can lock an entire logical object object. t bl Several tables can also be included in a lock object.Data Dictionary/ Lock Objects The simplest case of a lock object consists of exactly one table and th l the lock k argument t of f th the t table bl i is th the primary i k key of f thi this table.

Data Dictionary/ Lock Objects Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

A request for another shared lock is Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . When the lock is set.Data Dictionary/ Lock Objects Lock Mode The lock mode controls whether several users can access data records at the same time time. Access by more than one user can be synchronized in the following ways: Exclusive lock: The locked data can only be displayed or edited by a single user. The lock mode can be assigned separately for each table in the lock object. A request for another exclusive lock or for a shared h d lock l k is i rejected. the corresponding lock entry is stored in the lock table of the system for each table. j t d Shared lock: More than one user can access the locked data at the same time in display mode mode.

In contrast.Data Dictionary/ Lock Objects accepted. even if it comes from another user. An exclusive lock is rejected. Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . All other lock requests are rejected rejected. exclusive but not cumulative locks can be called only once from the same transaction.

Data Dictionary/ Creating Lock Object 1> Select object type Lock object in the initial screen of the ABAP Dictionary. enter an object name and choose Create. 2> Enter an explanatory short text in the field Short text. You can then use the short text to find the lock object j at a later time. k Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The maintenance screen for lock objects is displayed. The name of a lock object should begin with an E (Enqueue). for example with the R/3 Repository Information System. All other tables in the lock object must be linked with the primary t bl using table i foreign f i keys. 3> Enter the name of the primary table of the lock object.

Select the appropriate table.Data Dictionary/ Creating Lock Object 4> Select the lock mode of the primary table in the field below it. 5> Choose Add if you want to lock records in more than one table with the lock object. The lock mode is used as the default value for the corresponding parameters of the function modules generated from the lock object. for example you can assign the lock mode separately t l for f each h table. t bl Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The lock mode of the primary table is copied as lock mode. You can change this setting as required. j A list of all the tables linked with the primary table using valid foreign keys is displayed.

called You should not assign a lock mode if a secondary table was only used to define a p path between the primary p y table and another secondary y table with foreign keys. To do this.Data Dictionary/ Creating Lock Object Similarly. l Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 6> Save your entries. A dialog box appears in which you have to assign the lock object a development d l t class. no lock is set for the entries in this table when the generated function modules are called. If no lock mode is assigned to a table. place the cursor on the name of the secondary table and choose Add. you can add a table linked with the secondary table just added with foreign keys.

you must ensure that the g y generated function modules are called from within an ABAP program with parameters appropriate for the type. If you set the Allow RFC flag. the generated function modules can be called from within another system with Remote Function Call. Call If you permit Remote Function Calls for an existing lock object. 8 Ch 8> Choose A Activate. ti t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You should therefore check all programs that use the associated function modules before activating the lock object with the new option.Data Dictionary/ Creating Lock Object 7> You can define whether the function modules generated from the lock object should be RFC-enabled on the Attributes tab page.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Creating Lock Object Result When you activate the lock object. the two function modules ENQUEUE_<lockobjectname> and DEQUEUE_<lockobjectname> are generated from its definition to set and release locks.

Lock object E_BOOKING must therefore contain table SFLIGHT as primary table and table SBOOK as further table.Data Dictionary/ Function Modules for Lock Requests When booking flights it is important to prevent flights from being overbooked. you have to lock the particular flight as well as all the bookings existing for this flight during processing. You can do this with lock object E_BOOKING. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The flights are recorded in table SFLIGHT and the bookings for the flights in table SBOOK. For this reason. The two tables are linked with a foreign key.

Data Dictionary/ Function Modules for Lock Requests Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

and FLDATE. CONNID. CARRID. Select exclusive lock mode. FLDATE. that is the locked data can only be displayed and edited by one user. BOOKID and CUSTOMID.Data Dictionary/ Function Modules for Lock Requests The lock argument of table SFLIGHT thus contains the fields MANDT. The lock argument of table SBOOK thus contains the fields MANDT. the following function modules are generated from its definition: ENQUEUE_ E_BOOKING (set locks) DEQUEUE_ E_BOOKING (release locks) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . CONNID. When the lock object is activated. CARRID.

Data Dictionary/ Function Modules for Lock Requests Calling Enqueue Function module Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 29. .Data Dictionary/ Function Modules for Lock Requests With this call. If there is a lock conflict.1998 is exclusively (lock mode E) locked in table SFLIGHT together with all the bookings entered in table SBOOK for this flight (since the initial value 0 is transferred for BOOKID and CUSTOMID). The lock is sent to the update program (_SCOPE = ‘2’). flight LH 400 on Nov. another attempt p is made to set the lock after a certain time (_WAIT = ‘X’).

Data Dictionary/ Function Modules for Lock Requests Calling Dequeue Function module Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The request to delete the lock entries is passed on to the update program (_SCOPE = ‘3’). Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Function Modules for Lock Requests The existing exclusive lock entries for flight LH 400 are deleted in table SFLIGHT and the bookings for this flight are deleted in table SBOOK.

the lock is set with exactly y the initial value of <field>. A further parameter X_<field> that defines the lock behavior when the initial value is passed exists for every lock field <field>. If <field> is assigned the initial value and X_<field> is defined as X. ll d Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If the initial value is assigned to <field> and X X_<field>. Parameters for Passing Locks to the Update Program A lock is generally removed at the end of the transaction or when th corresponding the di DEQUEUE f function ti module d l i is called. <field> then a generic lock is initialized with respect to <field>. .Data Dictionary/ Parameters of Function modules Field Names of the Lock Object The keys to be locked must be passed here.

The update program is responsible for removing the lock. The lock must be removed in both the interactive program and in the update program. d l Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The lock is removed when the transaction is ended.Data Dictionary/ Parameters of Function modules Parameter _SCOPE controls how the lock or lock release is passed to the update program. This is the standard setting for the DEQUEUE f function ti module. _SCOPE = 3: The lock or lock release is also passed to the update program. You have the following options: _SCOPE = 1: Locks and lock releases are not passed to the update program. _SCOPE SCOPE = 2: The lock or lock release is passed to the update program. The interactive p program g with which the lock was requested q no longer g has an influence on the lock behavior.

Data Dictionary/ Parameters of Function modules Controlling Lock Transmission Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. X : The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by b calling lli the th function f ti module d l FLUSH_ENQUEUE. This parameter can have the following values: Initial value: The lock request or lock release is sent directly to the lock server. FLUSH ENQUEUE Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The waiting time and the time li it are defined limit d fi d by b profile fil parameters. the exception p FOREIGN_LOCK is triggered.Data Dictionary/ Parameters of Function modules Behavior for Lock Conflicts (ENQUEUE only) The ENQUEUE function module also has the parameter _WAIT. the lock attempt is repeated after waiting for a certain time. This parameter determines the lock behavior when there is a lock conflict. gg X : If a lock attempt fails because there is a competing lock. t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You have the following options: Initial value: If a lock attempt fails because there is a competing lock. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt.

.Data Dictionary/ Parameters of Function modules Controlling Deletion of the Lock Entry (DEQUEUE only) The DEQUEUE function module also has the parameter _SYNCHRON. the entry y in the lock table may y still exist. You can find out the name of the user holding the lock by looking at system variable i bl SY-MSGV1. table Otherwise it is deleted asynchronously. asynchronously that is. SY MSGV1 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the DEQUEUE function waits until the entry has been removed from the lock table. If X is passed. if the lock table of the system is read directly after the lock is removed. Exceptions of the ENQUEUE Function Module FOREIGN_LOCK: A competing lock already exists.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/ Parameters of Function modules SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case. the lock could not be set.

( Tables are defined in the ABAP Dictionary independently of the database. The ABAP Dictionary is completely integrated in the ABAP Development Workbench.Data Dictionary/Summary SUMMARY ( The ABAP Dictionary centrally describes and manages all the data definitions used in the system. ( Views Vi are logical l i l views i on more than h one table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ( Lock Objects are used to synchronize access to the same data by more than one user. bl ( A domain defines the value range of all table fields and structure components that refer to this domain domain.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Data Dictionary/Exercise EXERCISE Using SE11 create an user defined table with the following fields. N t Follow Note: F ll the th steps t explained l i d in i the th presentation t ti for f the th creation ti of f the table. No (Primary Key) Name Designation Salary Try to add few records into that table. Employee No.

ADVANCED ABAP Open SQL Dynamic Programming Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .4.

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADVANCED ABAP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .5.

Course Contents Course Contents : Module I ABAP Objects Overview Classes and Objects Visibility sections Methods C Constructors t t Inheritance Module II Interfaces Module III Events handling in classes Module IV Friends Persistent Classes Theory Test Practical Test Course Duration : 5 working days Module V Global classes Module VI Report development using ALV Module VII Exception handling in classes M d l VIII Module Casting Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects About ABAP Objects ABAP Objects Obj t is i fairly f i l a new concept t in i R/3. R/3 Th The t term h has t two meanings. i • It stands for the entire ABAP runtime environment environment. and • It represents the object-oriented extension of the ABAP language Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects • ABAP Runtime Environment The ABAP Workbench Th W kb h allows ll you to t create t R/3 Repository R it objects bj t such as •programs •authorization objects •lock objects •Customizing objects. etc.

You can use ABAP Obj Y Objects t in i existing i ti programs. and d can also l use "conventional" ABAP in new ABAP Objects programs. and is fully compatible with it.ABAP Objects The Object-oriented Language Extension • ABAP Objects is a complete set of object-oriented statements that has been introduced into the ABAP language. language This object-oriented j extension of ABAP builds on the existing g language. • • Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

It is compatible with external object interfaces such as DCOM and CORBA Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects The Object-oriented Language Extension • ABAP Objects supports object-oriented programming • The object-oriented enhancement of ABAP is based on the models of Java and C++.

ABAP Objects Object-Orientation Object o orientation e tat o (OO). object object-oriented o e ted programming. •Objects • An object is a section of source code that contains data and provides services. is a problem-solving method in which the software solution reflects objects in the real world . • The services are known as methods (also known as operations or functions). i • The data forms the attributes of the object. ec se. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . or o to be more oep precise.

t Thi reduces This d the th overall ll amount t of f maintenance i t required i d. since object-oriented structuring provides a closer representation of reality than other programming techniques. without having to make alterations at other points in the system. • This Thi requirement i ti is met tb by object bj t orientation. since many problems can be detected and corrected in the design phase Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . it cannot work with several instances of a single function group. Using classes. y . object-oriented programming allows you to reuse individual components. •Through polymorphism and inheritance. j system. an ABAP program can work with any number of instances (objects) based on the same te p ate template.ABAP Objects Advantages of OO •The main difference between real object j orientation and function g groups p is that although a program can work with the instances of several function groups at the same time. it should be possible to implement changes at class level. •Complex software systems become easier to understand. i t ti ABAP Obj Objects t allows ll you t to d define fi data and functions in classes instead of function groups. the amount of work involved in revising g and •In an object-oriented maintaining the system is reduced. •In a well-designed object-oriented system.

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . objects are runtime instances of a class.ABAP Objects Classes • Classes describe objects. • Classes are templates for objects • From a technical point of view.

•A class can have any number of objects (instances). •Each object j has a unique q identity y and its own attributes. •All transient objects reside in the context of an internal session (memory area of an ABAP program).ABAP Objects Objects •Objects are instances of classes. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

Classes Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Overview Graphic .

ABAP Objects Structure of a Class • A class contains components • Each component is assigned to a visibility section • Classes implement methods Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

• All of the components of a class are visible within the class.ABAP Objects Class Components • All components t are declared d l d in i the th declaration d l ti part t of f the th class. l p define the attributes of the objects j in a class. All components are in the same namespace. each component is assigned to one of th three the th visibility i ibilit sections. • This means that all components of the class must have names that are unique within the class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . • The components • When you define the class. ti which hi h define d fi the th external t l interface i t f of f the th class.

• Reference variables allow you to create and address objects objects.ABAP Objects Attributes •Attributes are internal data fields within a class that can have any ABAP data type. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . allowing you to access objects from within a class. Reference variables can be defined in classes. • One kind of attribute is the reference variable. • The state of an object is determined by the contents of its attributes.

•They also have a parameter interface. and receive values back from them •The p private attributes of a class can only y be changed g by y methods in the same class.ABAP Objects Methods •Methods are internal procedures in a class that define the behavior of an object. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . with which users can supply them with values when calling them. •They can access all of the attributes of a class. This allows them to change the data content of an object.

. ..syntax • The definition and parameter interface of a method is similar to that of function modules. ENDMETHOD. ENDMETHOD • You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules).ABAP Objects Methods . • You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block: METHOD <meth>. • CALL METHOD <ObjName> -> <Method> Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . ) You call methods using the CALL C METHOD O statement.

and can trigger all of the events of the class • Static Methods You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events. They can access all of the attributes of a class.ABAP Objects Methods . Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .types • Instance Methods You declare instance methods using the METHODS statement.

cannot be accessed outside your program.local and global • Local classes . • Global classes .are defined d fi d i in your program.ABAP Objects Types of classes • Types of classes .Are defined in the repository using either transaction SE80 or SE24 . .Can be accessed by all programs Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

PRIVATE SECTION.Classes Visibility •Encapsulation: capsu at o •Objects restrict the visibility of their resources (attributes and methods) to other users. which determines how other objects can interact with it... . i. . Every object has an interface. •Encapsulation is implemented using class visibility sections. •Classes Visibility Sections •You can divide the declaration part of a class into up to three visibility areas: PUBLIC SECTION..ABAP Objects Encapsulation .. The implementation of the object is encapsulated. PROTECTED SECTION SECTION. ..e. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . invisible outside the object itself..

•The public components of the class form the interface between the class and its users. but can be modified by only methods of the class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Public Section Public Section •All of the components declared in the public section are accessible to all users of the class. and to the methods of the class and any classes that inherit from it. This implies that the public attributes can be read from outside the class. •READ-ONLY addition can be used for public attributes.

class •The private components are not part of the external interface of the class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Private Section •Private Section •Components that you declare in the private section are only visible in the methods of the same class.

ABAP Objects Protected Section • Protected Section All components in the protected section can be accessed by all methods of the same class as well as all methods of its sub-classes sub-classes. they can be accessed by the components of the private section section. All of the components in the protected section can access the components from the public section. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . In turn.

GET_VALUE = COUNT. PRIVATE SECTION. COUNT = SET SET_VALUE. CLASS C_COUNTER IMPLEMENTATION. ENDMETHOD ENDMETHOD. ADD 1 TO COUNT. DATA COUNT TYPE I. INCREMENT_COUNTER. METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I. METHOD SET_COUNTER. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Introductory Example CLASS C C_COUNTER COUNTER DEFINITION DEFINITION. ENDCLASS. ENDMETHOD. METHOD GET_COUNTER. METHOD INCREMENT_COUNTER. GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I. ENDCLASS. VALUE ENDMETHOD. PUBLIC SECTION.

they are always contained in reference variables. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . •A reference variable that points to an object knows the identity of that object.ABAP Objects Object references •To access an object from an ABAP program. In ABAP. •The identity of an object depends on its reference. you use object references. •Object Object references are pointers to objects. •A reference variable is either initial or contains a reference to an existing object.

TYPE REF TO <class> •LIKE may not be used.ABAP Objects Data Types for References •You define class references using the . •LIKE can be used for local data types... Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects

Creating Objects

•Before you can create an object for a class, you need to declare a reference variable with reference to that class. •DATA: <obj> TYPE REF TO <class> •Once you have declared a class reference variable <obj> for a class <class>, you can create an object using the statement CREATE OBJECT <obj>. •This statement creates an instance of the class <class>, and the reference variable <obj> contains a reference to the object.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Addressing the Components of Objects

•Programs can only access the instance components of an object using references in reference variables. •To access an attribute <attr>: <obj>-><attr> •To call a method <meth>: CALL METHOD <obj>-><meth>

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Addressing the Components of Objects

•You can access static components using the class name as well as the reference variable. •It is also p possible to address the static components p of a class before an object has been created. •Addressing a static attribute <attr>: <class>=><attr> •Calling a static method <meth>: CALL METHOD <class>=><meth>

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Self references

•Within a class, you can use the self-reference ME to access the individual components: •To access an attribute <attr> in the same class: ME-><attr> •To call a method <meth> in the same class: CALL METHOD ME-><meth> •Self references allow an object to give other objects a reference to it. •You can also access attributes in methods from within an object even if they are obscured b db by l local l attributes tt ib t of f th the method. th d

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects
REPORT zharesh .

Self references- Example

CLASS lcl DEFINITION. PUBLIC SECTION. METHODS: m1. PRIVATE SECTION. DATA: v1 VALUE 'a'. ENDCLASS. "lcl lcl DEFINITION CLASS lcl IMPLEMENTATION. METHOD m1. DATA v1 DATA: 1 VALUE 'b' 'b'. WRITE v1. "This will print 'b' since it is local data and has more precedence than global data *Now how do we p print the g global data v1 ( (which has vale 'a')? ) *We use the self-reference "ME" WRITE me->v1. "Now this will print ‘a' ENDMETHOD. "m1 ENDCLASS ENDCLASS. "lcl lcl IMPLEMENTATION

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Overview Graphic - Objects

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 1

The DATA statement creates a class reference variable CREF1 with type C_COUNTER. This variable can contain references to all instances of the class C_COUNTER. The class C_COUNTER must be known to the program when the DATA statement occurs. You can either declare it locally before the data statement in the same program, or globally using the Class Builder. The contents of CREF1 are initial. The reference does not point to an instance.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 2

The CREATE OBJECT statement creates an object (instance) of the class C_COUNTER. The reference in the reference variable CREF_1 points to this object. This instance of the class C_COUNTER is called C_COUNTER<1>, because this is how the contents of the object variable REF_COUNTER_1 are displayed in the debugger after the CREATE OBJECT statement has been executed.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 3

The ABAP program can access the public components of the object using the reference variable CREF1, that is in this case, it can call the public methods of the class C_COUNTER. After the program on the left-hand side has been executed, the program variables NUMBER and the private object attribute COUNT both have the value 8.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 4

This declares three different class reference variables for the class C_COUNTER. All of the references are initial.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 5

The system creates three objects of the class from the three class reference variables. The references in the three reference variables each point to one of these objects. In the internal program management, the individual instances are called C_COUNTER<1>, C_COUNTER<2>, and C_COUNTER<3>. They are named in the order in which they were created.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 6

The ABAP program can use the reference variables to access individual objects objects, that is in this case, to call the public methods of the class C_COUNTER. Each object has its own state, since the private instance attribute COUNT has a separate value for each object. The program on the left-hand side administers several independent counters.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 7

Here, three class reference variables are declared for the class C Here C_COUNTER, COUNTER and two objects are created for the class. The references in the reference variables CREF1 and CREF2 each point to one of these objects. The reference in CREF3 is initial.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 8

After the MOVE statement, statement CREF3 contains the same reference as CREF2 CREF2, and both references point to the object C_COUNTER<2>. A user can thus use either reference to address the object C_COUNTER<2>.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 9

The CLEAR statement resets the reference in CREF2 to its initial value value. The reference variable CREF2 then contains the same value as it did immediately after its declaration, and does not point to an object any more.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Example - Step 10

The effect of the assignment statement is to copy the reference from CREF1 to CREF2. As a result, the reference in CREF3 also points to the object C_COUNTER<1>. No more references point to the object C_COUNTER<2>, and it is automatically deleted by the Garbage Collection. The internal name C_COUNTER<2> is now free again.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Declaring Methods

You can declare methods in the declaration part of a class or in an interface interface. To declare instance methods, use the following statement: METHODS <meth> IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL].. EXPORTING.. [VALUE(]<ei>[)] TYPE type [OPTIONAL].. CHANGING.. [VALUE(]<ci>[)] TYPE type [OPTIONAL].. RETURNING VALUE(<r>) EXCEPTIONS <ei>.. EXCEPTIONS.. <ei> and the appropriate additions. To declare static methods, use the following statement: CLASS METHODS <meth>... CLASS-METHODS th Unlike in function modules, the default way of passing a parameter in a method is y reference. by To pass a parameter by value, you must do so explicitly using the VALUE addition. The return value (RETURNING parameter) must always be passed explicitly as a value.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Implementing Methods

You must implement all of the methods in a class in the implementation part of the class in a METHOD <meth> <meth>. ... ENDMETHOD. block.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects

Calling Methods

To call a method method, use the following statement: CALL METHOD <meth> EXPORTING... <ii> =.<f i>... IMPORTING... <ei> =.<g i>... CHANGING ... <ci> =.<f i>... RECEIVING r=h EXCEPTIONS... <ei> = rc i... Within t the t e implementation p e e tat o part pa t of o ac class, ass, you ca can ca call t the e methods et ods o of t the e sa same e class directly using their name <meth>. CALL METHOD <meth>... Outside the class, class the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using CALL METHOD <ref>-><meth>... where <ref> is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using CALL METHOD <class>=><meth>... where <class> is the name of the relevant class class.

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

ABAP Objects
C Constructors

Constructors

•Constructors are special methods that cannot be called using CALL METHOD. •Instead, they are called automatically by the system to set the starting state of a new object or class. •Executed E t d only l once per i instance t at t th the ti time of f creating ti an object bj t •Constructors initialize objects •Constructors are methods with a predefined name. •To use them, you must declare them explicitly in the class. •Only has IMPORTING parameters and EXCEPTIONS •METHODS CONSTRUCTOR IMPORTING param TYPE type EXCEPTIONS exception.
Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation

ABAP Objects

Static Constructors

Static Constructors S C •CLASS-METHODS: CLASS_CONSTRUCTOR •Only Only accessed once per program •Automatically called before the class is first accessed Eg: •Creation C ti of f 1st object bj t •1st access of static method •1st access of static attribute •Cannot have parameters and exceptions

Satyam Satyam SAP SAP PMG PMG SAP PMG

Delivering Solution Excellence and Innovation

•Only 1 parameter can be RETURNING parameter and this has to passed BY VALUE •Can have importing parameters •No N EXPORTING and d CHANGING parameters t Format: Eg: g a = b + function_name(). () Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Functional Methods Functional Methods These are methods which can be called like functions.

5. ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects Inheritance . The new class is called the subclass of the class from which it is derived derived. You can declare private components in a subclass that have the same names as private components of the superclass. The original class is called the superclass of the new class. You do this using the INHERITING FROM addition in the CLASS <subclass> DEFINITION INHERITING FROM <superclass>. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .1 Inheritance allows y you to derive a new class from an existing g class. Each class works with its own private components. Only the public and protected components of the superclass are visible in the subclass. The new class <subclass> inherits all of the components of the existing class <superclass>. <superclass> statement.

This is called single inheritance. but it may only have one direct superclass.ABAP Objects Inheritance .2 A class can have more than one direct subclass. This is the most generalized class possible. The root node of all inheritance trees in ABAP Objects is the predefined empty class OBJECT. since it contains neither attributes nor methods. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects Inheritance .Example Inheritance Example Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

However. method overloading is not allowed. even if the reference was defined with reference to the superclass superclass.1 All subclasses contain the components of f all classes between themselves and the root node in an inheritance tree.ABAP Objects Inheritance – Redifining Methods . Any reference that points to an object of the subclass uses the redefined method. method overloading is allowed in case of constructors. but has a new implementation. i. th d you cannot t change h its it interface i t f . When you redefine Wh d fi a method. The visibility of a component cannot be changed.e. you can use the REDEFINITION addition in the METHODS statement to redefine an inherited public or protected instance method in a subclass and make its function more specialized. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . The Th method th d retains the same name and interface. However.

and calling M1 from an instance of the subclass will cause the redefined method M2 to be called.2 Within a redefined f method. This enables you to use the existing function of the method in the superclass without having to recode it in the subclass. you can use the pseudoreference f SUPER-> S to access the obscured method. The method declaration and implementation in the superclass is not affected when you redefine the method in a subclass. a superclass method M1 contains a call CALL METHOD ME->[M2].ABAP Objects Inheritance – Redifining Methods . Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . calling M1 from an instance of the superclass will cause the original method M2 to be called. even if the reference was defined with reference to the superclass. p If. Any reference that points to an object of the subclass uses the redefined method. for example. and M2 is redefined in a subclass subclass.

Incase the super-class does not have a constructor. (which will do nothing) • If you don don’t t have a constructor in the sub sub-class class but if you have a constructor in the super-class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . you need to explicitly call the constructor of the super-class using the statement CALL METHOD SUPER->CONSTRUCTOR.ABAP Objects Inheritance – Constructors • If you define d fi a constructor t t in i the th sub-class. and if you create an object of the sub-class. then the default constructor of the sub-class will call the constructor of the super-class. b l th then i irrespective ti of f whether h th you h have defined a constructor in the super-class or not. the default constructor will be called by the system.

ABAP Objects Redefining Methods .Example Method Redefinition Example Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

Abstract – •Abstract classes cannot be instantiated. •A final method cannot be redefined in a subclass. •They y conclude an inheritance tree. •An abstract method is defined in an abstract class and cannot be implemented in that class. Final and Singleton The ABSTRACT S C and FINAL additions to the METHODS O S and CLASS C SS statements allow you to define abstract and final methods or classes. it HAS to be implemented in the subclass.ABAP Objects Abstract. Instead. Final – •Final classes cannot have subclasses. Singleton Classes – •Classes that are both abstract and final are known as Singleton classes •Only static components can be used. •Only 1 instance (“single”) of such a class may be defined •This instance needs to be defined within the class itself Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . •All methods in final classes are automatically final.

ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .5.

g Polymorphism Example Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Polymorphism If f you redefine f a method of f a superclass in a subclass.g. Using U i a single i l reference f variable i bl to t call ll identically-named id ti ll d methods th d that th t behave differently is called polymorphism. but when you address the subclass. e. you can use a reference f variable defined with reference to the superclass to address objects with different method implementations. the method has the original implementation. When you address the superclass. the method has the new implementation.

you need a Narrowing cast Also used to access interface components • • • • • Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . After Narrowing cast cast. you can use the super class reference to access the components of the subclass instance that were inherited from super class The components inherited from the superclass can be addressed Also called “Up-Cast” Use: A user who is not interested in the finer points of subclasses subclasses. Hence in order to allow the user to work with subclass objects. does not need to know about them. Obj_super = obj_sub.g. The user only wants to work with references to the superclass.ABAP Objects • Narrowing Cast Getting g a super p class variable to refer to a subclass variable is called Narrowing g Cast • E. but only in the attributes of the superclass.

-----------------------------------------------------------------------------------------------------The solution (Widening cast): Data: r_vehicle TYPE REF To lcl_vehicle. *processing for trucks CATCH CX_SY_MOVE_CAST_ERROR INTO r_exception. *processing for error situation CLEANUP. vehicle *Only for trucks * ENDLOOP. r_truck ?= r_vehicle.ABAP Objects Widening Cast Getting g a sub class variable to refer to a superclass p variable is called Widening g Cast The problem (Need for widening cast): Data: r_vehicle TYPE REF To lcl_vehicle. r truck TYPE REF TO lcl_truck. r_truck lcl truck LOOP AT vehicle_list INTO r_vehicle. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . TRY. ENDLOOP. LOOP AT vehicle_list vehicle list INTO r r_vehicle. ENDTRY.

ABAP Objects Widening Cast Widening Cast Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

5. ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

end of year method for all accounts. you might have two similar classes. without having to worry about the actual type of each individual account. Interfaces. but the actual implementation is different The user of the classes and their instances must also be able to run the different.ABAP Objects Interfaces •It is often necessary for similar classes to provide similar functions that are coded differently in each class but which should provide a uniform point of contact for the user. along with inheritance. •This allows users to address different classes via a universal point of contact. both of which have a method for calculating end of year charges. •Interfaces extend the scope of a class by adding their own components to its public section. The interfaces and names of the methods are the same. •ABAP ABAP Objects Obj t makes k this thi possible ibl b by using i i interfaces. •For example. t f I Interfaces t f are i independent d d t structures that you can implement in a class to extend the scope of that class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . savings account and check account. provide one of the pillars of polymorphism. since they allow a single method within an interface to behave differently in different classes.

•The definition contains the declaration for all components (attributes.. since their methods are implemented in the class that implements the interface. .Defining Interfaces •Like Lik classes. events) of the interface.. l you can d define fi i interfaces t f either ith globally l b ll i in th the R/3 R Repository it or locally in an ABAP program. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Interfaces . •The components of interfaces do not have to be assigned individually to a visibility section. ENDINTERFACE. •Interfaces do not have an implementation part. methods. since they automatically belong to the public section of the class in which the interface is implemented. •The definition of a local interface <intf> is enclosed in the statements: INTERFACE <intf>.

However However. A component <icomp> of an interface <intf> can be addressed as though it were a member of the class under the name <intf~icomp>. interfaces are implemented by classes.ABAP Objects Interfaces . . i tf in the declaration part of the class. use the statement CLASS <class> l DEFINITION INTERFACES <intf>.Implementing Interfaces •Unlike Unlike classes classes. Interfaces can be implemented by different classes. The class must implement the methods of all interfaces implemented in it. Each of these classes is extended by the same set of components components. •To implement an interface in a class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . ENDMETHOD. interfaces do not have instances instances. Instead Instead.. The implementation part of the class m must st contain a method implementation for each interface method <imeth>: METHOD <intf~imeth>. This statement may only appear in the public section of the class.. the methods of the interface can be implemented differently in each class.

•It allows the user to access all of the components of the object that were added to its definition by the implementation of the interface interface. i bl or i interface t f reference f f for short. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . •A reference variable with the type interface reference is called a interface reference variable. you can also define them with reference to an interface.ABAP Objects Interfaces . •To To define an interface reference. use the addition TYPE REF TO <intf> intf in the TYPES or DATA statement. h t •An interface reference <iref> allows a user to use the form <iref>-><icomp> to address all visible interface components p <icomp> p of the object j to which the object j reference is pointing.Interface References •Instead of creating reference variables with reference to a class.

<i tf> you can use th the following f ll i assignment between the class reference variable <cref> and an interface reference <iref> to make the interface reference in <iref> point to the same object as the class reference in <cref>: <iref> = <cref> If the interface <intf> contains an instance attribute <attr> and an instance method <meth>.ABAP Objects Addressing Objects Using Interface References If the th class l <class> < l > implements i l t an i interface t f <intf>. you can address the interface components as follows: Using the class reference variable <cref>: To access an attribute <attr>: <cref>-><intf~attr> To call a method <meth>: CALL METHOD <cref>-><intf~meth> Using the interface reference variable <iref>: To access an attribute <attr>: < iref>-><attr> To call a method <meth>: CALL METHOD <iref>-><meth> Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

you can only use the interface name to access constants: Addressing a constant <const>: < intf>=><const> For all other static components of an interface. you can only use object references or the class <class> that implements the interface: Addressing a static attribute <attr>: < class>=><intf~attr> Calling a static method <meth>: CALL METHOD <class>=><intf~meth> Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Addressing Objects Using Interface References As far as the static components of interfaces are concerned.

1 Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Interfaces – Overview Graphics .

2 Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Interfaces – Overview Graphics .

INTERFACE I_COUNTER. CLASS C_COUNTER1 IMPLEMENTATION. GET_VALUE = COUNT. METHOD I_COUNTER~SET_COUNTER. ENDMETHOD. ENDCLASS. ENDMETHOD. INCREMENT_COUNTER. PRIVATE SECTION. MESSAGE I042(00). METHOD I I_COUNTER~INCREMENT_COUNTER. METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I. DATA COUNT TYPE I. METHOD I_COUNTER~GET_COUNTER. COUNT = ( SET_VALUE / 10) * 10. ENDCLASS. GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.ABAP Objects Interfaces – Introductory Example – Part 1 CLASS C_COUNTER2 DEFINITION. ENDMETHOD. ENDMETHOD. COUNTER INCREMENT COUNTER ADD 1 TO COUNT. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . PRIVATE SECTION. CLASS C_COUNTER2 IMPLEMENTATION. INTERFACES I_COUNTER. GET_VALUE = COUNT. ENDMETHOD. CLASS C_COUNTER1 DEFINITION. ENDMETHOD. ENDINTERFACE. ENDIF. DATA COUNT TYPE I. METHOD I_COUNTER~INCREMENT_COUNTER. COUNT = 0. INTERFACES I_COUNTER. ENDCLASS. ELSE. ENDCLASS. METHOD I_COUNTER~SET_COUNTER. PUBLIC SECTION. PUBLIC SECTION. COUNT = SET_VALUE. METHOD I_COUNTER~GET_COUNTER. IF COUNT GE 100. ADD 10 TO COUNT.

It is fully y defined by y the interface in both cases. INCREMENT_COUNTER. Both classes must implement the three interface methods in their implementation part. C_COUNTER1 is a class for counters that can have any starting value and are then increased by one. The classes C C_COUNTER1 COUNTER1 and C C_COUNTER2 COUNTER2 implement the interface in the public section. The following sections explain how a user can use an interface reference to address the objects of both classes: Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Interfaces – Introductory Example–Part 2 The interface I_COUNTER contains three methods SET_COUNTER. C_COUNTER2 is a class for counters that can only be increased in steps p of 10. and GET_COUNTER. Both classes have an identical outward face.

two class reference variables CREF1 and CREF2 are declared for the classes C_COUNTER1 and C_COUNTER2. All of the reference variables are initial.ABAP Objects Interfaces – Introductory Example–Part 3 First. An interface reference IREF is also declared for the interface I_COUNTER. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects Interfaces – Introductory Example–Part 4 The CREATE OBJECT statement creates an object for each class to which the references in CREF1 and CREF2 point. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

the reference in IREF also points to the object with the internal name C_COUNTER<1>. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Interfaces – Introductory Example–Part 5 When the reference of CREF1 is assigned to IREF.

5. ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

This occurrence must be of sufficient importance for the ABAP program to take a special action.ABAP Objects Events An “event” “ ” is the occurrence of f a special condition during the execution of f an ABAP program. The following steps are required in an ABAP program in order to handle events: •Triggering Ti i E Events t •Handling Events Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects Triggering Events Triggering Events To trigger an event. a class must · Declare the event in its declaration part · Trigger the event in one of its methods Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

.ABAP Objects Declaring Events You declare events in the declaration part of f a class or in an interface. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . use the following statement: EVENTS <evt> evt EXPORTING. The parameters are always passed by value. ... use the following statement: CLASS-EVENTS <evt>.. Both statements have the same syntax. you y can use the EXPORTING addition to specify p y parameters that are passed to the event handler.. which has the type of a reference to the class or the interface in which the event is declared. f To declare instance events. Instance events always contain the implicit parameter SENDER. VALUE( VALUE(<ei>) ei ) TYPE type [OPTIONAL]. To declare static events. When y you declare an event.

.ABAP Objects Triggering Events An instance event in a class can be triggered by any method in the class.. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .. <ei> = <fi>. To trigger an event in a method.. Static events can be triggered by any static method. use the following statement: RAISE EVENT <evt> EXPORTING.

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . a method must · be defined as an event handler method for that event · be registered at runtime for the event.ABAP Objects Handling Events Events are handled using special methods. To handle an event.

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . <ei>. you must list it in the interface.ABAP Objects Declaring Event Handler Methods Any y class can contain event handler methods for events from other classes.. in principle. If you want the implicit parameter SENDER to be used as well. <evt> is an event declared in the class or interface <cif>. If you declare an event handler method in a class. for example. For a static method. to allow it to return results. of course. also define event handler methods in the same class as the event itself. •The interface of an event handler method may only contain formal parameters defined in the declaration of the event <evt>. use CLASS-METHODS instead of METHODS. use the following statement: METHODS <meth> FOR EVENT <evt> OF <cif> IMPORTING IMPORTING. it means that the instances of the •If class or the class itself are. •The event handler method does not have to use all of the parameters passed in the RAISE EVENT statement. The attributes of the parameter are also adopted by the event. You can.. able to handle an event <evt> triggered in a method. This parameter allows an instance event handler to access the trigger. <ei> for an instance method. To declare an event handler method.

<hi>... In the case of interfaces... The registration applies automatically to the whole class. or to all of the classes that implement the interface containing the static event... For an instance event..... It links a list of handler methods with corresponding trigger methods methods... [FOR]. You cannot use the FOR addition for static events: SET HANDLER...FOR FOR ALL INSTANCES INSTANCES. You can either specify a single instance as the trigger... or you can register the handler for all instances that can trigger the event: SET HANDLER. HANDLER <hi> <hi>. the registration also applies to classes that are not loaded until after the handler has been registered.FOR <ref>. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . .. you must use the FOR addition to specify the instance for which you want to register the handler. you y must determine at runtime the trigger to which it is to react. You can do this with the following statement: SET HANDLER. The registration then applies even to triggering instances that have not yet been created when you register the handler. <hi>. <hi>. using a reference variable <ref>: SET HANDLER.ABAP Objects Registering Event Handler Methods To allow an event handler method to react to an event..

ABAP Objects Overview Graphic .Events Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects Example – Events Events Example Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

Events lcl vehicle lcl_vehicle Class-data: count Class-methods: class_constructor. increment lcl-car Class-data: count Class-methods: Class methods: class class_constructor. constructor increment Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . constructor increment lcl-truck Class-data: count Class-methods: class class_constructor.ABAP Objects Class Practice .

•A class offering friendship is not automatically a friend of its friends.ABAP Objects Friends •A A class can offer friendship to other classes or interfaces interfaces. •Sub-classes of friends automatically become friends of the class offering friendship •Advantages: Advantages: •Unrestricted access •Fast access Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . •Friends have access to all components of a class and can always instantiate a class.

It exists in the internal program session only from the time it is generated (using CREATE OBJECT) until it is deleted by the Garbage g Collector.ABAP Objects Persistent Classes Transient and persistent data •ABAP programs work with local program data. The Persistence Service allows y you to do exactly y that. •Ideally you could save the encapsulation of data and functions persistently within the object instead. This data lives only as long as its context – that is. Data that can be preserved beyond the runtime of the program is known as persistent. as long as its associated procedure (for local procedure data). which resides in the program’s internal session. This data is known as transient. appropriate Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . A program could then leave an object in a certain state and a second p program g could continue working g on the object j in that state. but you need some way of saving the attributes of an object persistently and then make reference to the pp p class. its object (for attributes of classes). Data in object-oriented object oriented programming •An object in ABAP Objects is transient. or its program (for global program data). •Classes of objects are already persistent anyway.

just like the data objects in ABAP programs. and saves the state of that object when required. but only after the appropriate request has been made (that is. the database). •Put simply. However. The Persistence Service can be thought of as a software layer between the ABAP program and the data repository (that is.ABAP Objects Persistent Classes The Persistence Service for Persistent Objects •ABAP Objects are always transient. the COMMIT WORK statement has been executed). Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . the Persistence Service ensures that an object is initialized in a specified state. The state of the object when it is instantiated reflects the state of the data in the database at that time time. the Persistence Service within Object Services allows application developers to work with persistent objects objects. Thus a persistent object exists as an original in the database and as a copy in one or more ABAP programs. executed) Thus. which allows you to save the attributes of objects with a unique identity. There are no persistent objects in ABAP Objects. and then load them again when you need d th them. •The relationship between the object and the description of its state in the database is similar to the relationship between transient and persistent data outlined above. •Changes to the object state in the ABAP program are not written to the database immediately.

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . •The term persistent class does not imply that a class is persistent. •For example. •When the Class Builder creates a persistent class. •Rather. whose methods manage the objects j of p persistent classes. the classes of these objects must be created as persistent classes in the Class Builder. known as the class actor or class agent. (As a template for objects. which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). every class is persistent). it automatically generates an associated class. it means that the objects of that class and their state are managed by the Persistence Service.ABAP Objects Persistent Classes Persistent Classes •To use the Persistence Service for objects. the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service.

5. ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

1 • To Create a Class •Go to Transaction SE80 or SE24 Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Global Classes .

ABAP Objects Global Classes . Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .2 • To Create a Class… •Then specify whether you want to create a class or interface.

ABAP Objects Global Classes .3 • To Create a Method. Description etc. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . visibility. where you define the level. •Double click on the object Name(ZNDC) and it will take you the following Screen. for particular method in a class.

4 • To Implement your method. Click to implement your method Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . Double click on the Method to implement your method.ABAP Objects Global Classes .

5 • To Implement your method. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Global Classes .

ABAP Objects Global Classes . •Public Section Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .6 • Classes Visibility Section.

ABAP Objects Global Classes . C which is visible & accessible to all users of f the class. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .7 Public Section S of f the Class.

The ALV Grid control is used to build non-hierarchical. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . interactive. and modern-design lists.1 The ALV Grid G control is a flexible f tool for f displaying lists.ABAP Objects ALV Grids . it is a component that is installed on the local PC. As a control. The tool provides common list operations as generic functions and can be enhanced by selfdefined options.

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .g. Step 3: In PBO of screen: create objects for the above 2 reference variables IF container IS INITIAL INITIAL. CALL METHOD grid->refresh_table_display ENDIF. ELSE . CREATE OBJECT container EXPORTING container_name = ' CC_ALV '. grid TYPE REF TO cl_gui_alv_grid. CC_ALV) Step 2: In Screen logic: Create TYPE REF’s to cl_gui_custom_container and cl_gui_alv_grid DATA: container TYPE REF TO cl_gui_custom_container.ABAP Objects ALV Grids .2 Step 1: S 1 In Screen Painter: Create a screen with a custom control object on it and give the custom control a name (e.

3 CREATE O C OBJECT C grid EXPORTING i_parent = container. Step 4: In PBO of screen or start-of-selection: -Create an internal table having structure same as what you want to display -Populate internal table with data to be displayed Step 5: In PBO of screen: Transfer data to the grid CALL METHOD grid->set_table_for_first_display EXPORTING i_structure_name = '‘ “structure name CHANGING it_outtab = . “internal table name Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects ALV Grids .

free. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects ALV Grids – 4 Step 6 S 6: Before LEAVE PROGRAM: Free the container call method custom custom_container1 container1->free. call method cl_gui_cfw=>flush.

ABAP Objects ALV Grids – 5 ALV grids with Field Catalog *ITAB & W. APPEND WA_FCAT WA FCAT TO ITAB_FCAT. DATA WA_FCAT LIKE LINE OF itab_fcat. “Database field name WA_FCAT-REF_TABLE = 'SBOOK'. CTYPE . ITAB FCAT *Call method “set_table_for_first_display”. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .A FOR FIELDCATLOG DATA ITAB_FCAT TYPE LVC_T_FCAT. *POPULATE ITAB WA FCAT-FIELDNAME WA_FCAT FIELDNAME = ‘CTYPE'. passing the name of the field catalog CALL METHOD r_alv_g grid->set_table_for_first_display p y EXPORTING I_STRUCTURE_NAME = 'SBOOK' CHANGING IT OUTTAB = ITAB IT_OUTTAB IT_FIELDCATALOG = ITAB_FCAT. “Database table name WA_FCAT-COL_POS = 27. WA_FCAT-REF_FIELD = 'CUSTTYPE' .

Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . Display only the following fields: Material number (MARA-MATNR) Material Group (MARA-MATKL) Material Description (MAKT-MAKTX) Create GUI status for proper navigation. (MARA-MTART) ( ) Create an ALV on another screen in the same module pool program and display 100 records. read the value of f material type.ABAP Objects Class Practice – ALV Grids Using a selection screen.

CX_ROOT. If a class-based exception occurs.ABAP Objects Class-Based Exceptions . The caller can either handle the exception or forward it. If it does not find a handler. Class-based exceptions can. Exceptions that are raised in procedures but are not handled in the procedure itself are forwarded to the caller. be raised and handled in all ABAP contexts (programs. 2. Class-based exception handling is based on exception classes. processing blocks). All exception classes are part of an inheritance hierarchy with a common superclass. Automatically by the ABAP runtime environment. a runtime error occurs.Overview The occurrence of an exception p is normally y used to display p y an error situation. the system interrupts the normal program flow and tries to find a suitable handler. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . therefore. Class-based exceptions are either raised 1 Explicitly by the ABAP statement RAISE EXCEPTION or 1.

cx_... ... the program is ended with a runtime error.. . " CATCH block (exception handler) CATCH cx_... " TRY block (application coding) CATCH cx_.. CLEANUP... .. or (if this is not possible) at least bring the affected context into a consistent state and then forward the error.. If a call hierarchy does not contain a handler for an exception. find f an alternative solution. ...... " CLEANUP block (cleanup context) ENDTRY.ABAP Objects Class-Based Exceptions–Handling Exceptions The handler of f an exception must try to correct the error that has occurred.. . ... Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . Class-based Cl b d exceptions ti are h handled dl d i in th the f following ll i control t l structure: t t TRY.. cx_.. " CATCH block (exception handler) .

there is no handler for it in the same TRY-ENDTRY block. but there is a handler for it either in the enclosing TRY-ENDTRY block or the calling procedure ⇒Program flow is interrupted ⇒CATCH is not executed for the current TRY-ENDTRY block ⇒CLEANUP is executed in the current TRY-ENDTRY block if it exists ⇒CATCH gets executed in the enclosing/calling block Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Class-Based Exceptions–Handling Exceptions Case 1 C 1: An exception occurs and there is no handler defined f f for it either in the current TRY-ENDTRY block or in the caller blocks ⇒Runtime error occurs Case 2: An exception occurs and there is a handler for it in the same TRY-ENDTRY block ⇒Program flow is interrupted ⇒Corresponding C di CATCH bl block k gets t executed t d ⇒CLEANUP is not executed ⇒Program flow continues after the TRY-ENDTRY block Case 3: An exception occurs.

in which exceptions can occur. TRY-ENDTRY structures can be nested in any statement blocks. A TRY-ENDTRY structure must not contain more than one CLEANUP block in precisely this position position. in which three statement blocks can be listed in a specified order. 1.ABAP Objects Class-Based Exceptions – Handling Exceptions The TRY statement opens a control structure to be ended with ENDTRY. A TRY block. This statement block is initiated by CLEANUP and ended with ENDTRY. CLEANUP. ti These exception blocks are initiated with CATCH and ended with a further CATCH. or ENDTRY. 3. A CLEANUP block for cleanup work after the exceptions have been caught. O or more CATCH bl One blocks k f for catching t hi exceptions. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . This exception block consists of all the statements between the TRY and the CATCH statement. 2 2.

• If an exception occurs in the TRY block or in a procedure called up here here. This statement block is processed sequentially. A runtime error occurs immediately if the handler is missing.ABAP Objects Class-Based Exceptions – Try Block The TRY block contains the application pp coding g whose exceptions p are to be handled. It can contain further control structures and calls of procedures or other ABAP programs. dialog modules). the system starts by searching for a CATCH statement of the same TRY-ENDTRY structure. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . The system may call this handler. If no exceptions occur in the TRY block. • If the system does not find a handler. program execution is continued directly after ENDTRY after the block has been completed. • It then searches from the inside out for a CATCH statement in any enclosing TRY-ENDTRY structures that handle the event. but the TRY-ENDTRY structure is contained in a procedure. Exceptions cannot be propagated in any processing blocks without a local data area (event blocks. it tries to propagate the exception to the caller.

5. ABAP OBJECTS Classes and objects I h it Inheritance Polymorphism (casting) Interfaces Events Gl b l classes Global l and d interfaces i t f Exception handling Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

the order of the different exception handlers within a TRY-ENDTRY structure must be based on the inheritance hierarchy of the specified exception classes. • After an exception occurs.. occurs the system searches through the listed exception handlers in the specified order. For this reason. • This defines an exception handler for all the specified exception classes and their subordinate classes. • No subsequent exception handlers are considered. The first exception handler whose CATCH statement contains the corresponding exception class or one of its superclasses is executed. • The system then continues program execution directly after ENDTRY.. cx_. handlers The syntax for introducing an exception handler is: CATCH cx_. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects • Class-Based Exceptions – Catch Block A catch block contains the exception p handler that is executed when a particular exception has occurred in the TRY block of the same TRY-ENDTRY structure. • A TRY-ENDTRY TRY ENDTRY structure can contain several exception handlers.. INTO ref..

ABAP Objects Class-Based Exceptions – Catch Block • The syntax check ensures that the handlers for f more specific f exceptions (subordinate classes) can only be listed before the handlers for more general exceptions (superclasses). a reference to the exception object can be placed into a reference variable. • The reference variable must be suitable for the exception. This enables the attributes of the exception object to be accessed in the handler. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . • With the INTO addition. Its static type must be the exception class itself or one of its superclasses.

to which an external handler no longer has access. are forbidden. and screen sequences if the system returns to the CLEANUP block. The runtime environment always recognizes that a CLEANUP block is being exited illegally and then reacts with a runtime error.ABAP Objects • Class-Based Exceptions – CleanUp Block If the system y has not found a handler for an exception. permissible to leave the overall program (LEAVE PROGRAM) or call up procedures. p . objects often have to be brought into a consistent state or external resources. but the exception p is handled in an enclosing TRY-ENDTRY structure or is propagated to a caller. however. All the exceptions that occur within a CLEANUP block must also be handled here. Precisely one CLEANUP block can be defined in each TRY TRY-ENDTRY ENDTRY structure structure. have to be released. All the statements that change the control flow. the CLEANUP block is executed before the TRY-ENDTRY structure is exited. STOP. programs. It is. Delivering Solution Excellence and Innovation • • • • • • Satyam Satyam SAP SAP PMG PMG SAP PMG . This applies to statements such as RETURN. which cause the CLEANUP block to be exited and would initiate a processing block of the same program program. For example. for example.

ABAP Objects Class-Based Exceptions – Example Class based exceptions Example Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

they are passed along automatically. They cannot be passed explicitly using the RAISING addition. Not part of syntax check Part of syntax check Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . If you don’t. Not part of syntax check Sub-Classes of CX_ROOT CX DYNAMIC CHECK CX_DYNAMIC_CHECK CX STATIC CHECK CX_STATIC_CHECK You MUST handle these exceptions or pass them along explicitly using the RAISING addition.ABAP Objects CX NO CHECK CX_NO_CHECK You CAN handle these exceptions.

Likewise. event blocks or dialog modules. . caller The highest level to which exceptions can be propagated is processing blocks without a local data area. Both the exceptions forwarded from called procedures and the exceptions that have occurred in the individual coding must be handled here. . subroutines) do not necessarily have to be handled here. They can be propagated to the caller of the procedure. If the caller is a procedure and the call takes place in a TRY block. a runtime error will occur. To propagate exceptions from procedures. in other words. Delivering Solution Excellence and Innovation • • • • Satyam Satyam SAP SAP PMG PMG SAP PMG . the RAISING addition must usually be used for the definition of the interface of a procedure (except for static constructors and event handlers). Otherwise.ABAP Objects • Class-Based Exceptions – Propagating Exceptions Class-based exceptions p that occur in p procedures ( (methods. the caller can handle the exception or propagate it to its caller. event handler methods cannot propagate exceptions. since a user of a class does not know whether it is the first user and whether or not it has to handle any exceptions that are propagated by the static constructor. function modules. A static constructor of a class cannot propagate exceptions.

ABAP Objects Propagating Exceptions Example Propagating Exceptions Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .

ABAP Objects • Class-Based Exceptions – Exception Texts The most important p feature of a caught g exception p is the fact that it has occurred and that it is handled in the program. It is left to the handler to decide how the exception situation is dealt with. however. The exception text describes an error situation from a mostly technical view view. It should. If an exception is described to a user. an explanatory text is assigned to each exception. This text describes the exception situation more precisely and is output as an error message if the exception is not handled. • • • Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation . it should be described from the user's perspective. It is not up to the exception itself to interact with the program user. only be used sparingly during exception handling for communication with the user. Nevertheless.

Example Exception Texts Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Exception Texts .

write “Bingo” else handle the exception. If successful successful. Satyam Satyam SAP SAP PMG PMG SAP PMG Delivering Solution Excellence and Innovation .ABAP Objects Class Practice Class Based Exceptions + Widening cast Create a super class and its sub class. Try to assign the object of the superclass to the object of the subclass subclass. Create objects of both classes.

Self-defined. Lists with several p pages g ) Interactive lists( At line-selection . LIST PROCESSING TECHNIQUES Extract datasets Data output in lists( Standard. At User-command) List creation with the ALV grid control Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6.

sequential files or u can create generic report. The refining process is independent of the process of retrieving data. you can read the data to be refined from database tables or from .LIST PROCESSING Refining Data A report t must t sort td data.calculate t l l t totals. Create data set Refine the data set Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .count t t l t item it in i lists li t and d so on.

Extract datasets Internal tables : If you want the datasets to map the underlying data structures as closely as possible and if you want to access individual data directly.LIST PROCESSING Creating and Refining datasets: Abap/4 offers two methods of creating datasets in the storage Internal tables . Extract datasets : An extract is a sequential dataset you can create with a report.Use e tracts if you extracts o want ant to process large amo amount nt of data as a whole hole several times Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

dataset As for internal tables the size of the extract data set is principally unlimited.since the system rolls it out if necessary.this means that you can access its data only within a loop.the system can create exactly one extract dataset. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . In one extract dataset.you can store records of different length and structure one after the other.LIST PROCESSING Refining data using EXTRACT DATASETS: An Extract is a sequential dataset in the report’s storage area. . During the report’s run time.

LIST PROCESSING Declaring Extract Records as Field Groups An extract dataset consists of a sequence of records. using the FIELD-GROUPS statement. Syntax FIELD-GROUPS <fg>. All records with the same structure form a record type type. You must define each record type of an extract dataset as a field group. These records may . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . have different structures.

LIST PROCESSING Filli an Extract Filling E t t with ith Data D t Once you have declared the possible record types as field groups and defined their structure. the new extract record is added to the dataset Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the system creates t th the extract t t dataset d t t and d adds dd the th first fi t extract t t record d to t it. Syntax g EXTRACT <fg>. When the first EXTRACT statement occurs in a program. you can fill the extract dataset using the following statements: . it In I each h subsequent EXTRACT statement.

] ... … [AT FIRST | AT <fgi> [WITH <fg j>] | AT LAST. ENDLOOP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ... .LIST PROCESSING R di Reading an Extract E t t Like internal tables. syntax . you can read the data in an extract dataset using a loop loop. ENDAT. LOOP. ENDLOOP.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .LIST PROCESSING Sorting an Extract You can sort an extract dataset in much the same way as an internal table by using the following statement: . syntax SORT [ASCENDING|DESCENDING] [AS TEXT] [STABLE] BY <f1> [ASCENDING|DESCENDING] [AS TEXT] ... <fn> [ASCENDING|DESCENDING] [AS TEXT].

. you can use the AT statement within a loop to program statement blocks that the system processes only at a control break. ENDAT. Syntax AT NEW <f> | AT END OF <f>. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . For general information about control levels. After sorting. The control level hierarchy of an extract dataset corresponds to the sequence of the fields in the HEADER .. when the control level changes. field group.LIST PROCESSING Processing Control Levels When you sort an extract dataset. that is. control levels are defined in it..

LIST PROCESSING TECHNIQUES Extract datasets Data output in lists( Standard. At User-command) List creation with the ALV grid control Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6. Lists with several p pages g ) Interactive lists( At line-selection . Self-defined.

Structure and the options of a list are The Standard List The Self-Defined List Lists with Several Pages Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Each program can produce up to 21 lists: one basic list and 20 secondary lists.BASIC LISTS Lists Lists are the output medium for data from ABAP/4 report programs.

This Thi list li t is i called ll d standard t d d list. SKIP.BASIC LISTS The standard list If an ABAP/4 report makes use only of the WRITE. li t The standard list consists of: Standard Page Header Standard Page User Interface of the Standard List The next slide shows a standard list. and ULINE output t t statements t t t . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS The Self-Defined List Self defined list is a list created by modifying the standard list by Self-defined using options of the REPORT statement and using event keywords TOP-OF-PAGE and END-OF-PAGE. The possible modifications that can be performed in a standard list are : Page Header List Width Page Length Page Footer Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

.. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the NO STANDARD PAGE HEADING option of the REPORT statement. you must define it in the processing block following the event keyword TOP TOP-OF-PAGE: OF PAGE: Syntax TOP-OF-PAGE. Note : The self-defined self defined page header appears beneath the standard page header header. If you want to suppress the standard page header. The TOP-OF-PAGE event occurs as soon as the system starts processing a new page of a list and before outputting the first line on a new page.. WRITE: .BASIC LISTS Page Header To layout a page header individually.

sy datum. WRITE: / 'SAP SAP AG'. WRITE / sy-index. '. ULINE. HEADING TOP-OF-PAGE. AG . ULINE.BASIC LISTS REPORT demo_list_page_heading d li t h di NO STANDARD PAGE HEADING. / 'Neurottstr. 29 'Walldorf. / '69190 Walldorf/Baden'. sy-pagno. Walldorf.sy-datum. ENDDO. 40 'Page'. WRITE: sy-title. START-OF-SELECTION. 16'. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DO 5 TIMES. .

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS List Width To determine the width of the output list. use the LINE-SIZE option of the REPORT statement. Syntax REPORT <rep> LINE-SIZE <width>. 0 the system uses the width of the standardlist . Note : •If you set <width> to 0. •The system field SY-LINSZ contains the current line width Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Page Length To determine the page length of an output list. the system uses the standard page length . use the LINE-COUNT option ti of f the th REPORT statement. <n> ---->The >The system reserves <n> lines of the page length for the page footer. t t t Syntax REPORT <rep> LINE-COUNT <length>[(<n>)]. Note : •If you set <length> to zero. •The system field SY-LINCT contains the current number of lines per page Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . WRITE: 'SY-LINCT:'. DO 6 TIMES.BASIC LISTS REPORT demo_list_line_count LINE-SIZE 40 LINECOUNT 4. SKIP. ENDDO. WRITE / sy-index. sy-linct.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

.BASIC LISTS Page Footer To define a page footer.. Note : The system only processes the processing block following END-OF-PAGE if you reserve lines for the footer in the LINE-COUNT option of the REPORT statement . use the END-OF-PAGE event. END OF PAGE WRITE: .. or if the RESERVE statement triggers a page break. This event occurs when the system reaches the lines reserved for the page footer. Syntax END-OF-PAGE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .BASIC LISTS REPORT demo_list_end_of_page LINE-SIZE 40 LINE-COUNT 6(2) NO STANDARD PAGE HEADING. WRITE: 'Page with Header and Footer'. WRITE: /30 'Page'. WRITE / sy-index. DO 6 TIMES. sy-pagno. ENDDO. ULINE AT /(27). ULINE. /(27) END-OF-PAGE. TOP OF PAGE TOP-OF-PAGE. START-OF-SELECTION.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Lists with Several Pages If in your report has more number of lines than defined in the LINECOUNT option of the REPORT statement. you can use the NEW-PAGE and RESERVE statements to code page breaks explicitly. Apart from automatic page breaks. explicitly Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the system automatically creates t a new page .

Before starting a new page. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the RESERVE statement: Syntax RESERVE <n> LINES LINES.Conditional To execute a page break under the condition that less than a certain number of lines is left on a page. the system processes the END-OF-PAGE event. This statement triggers a page break if less than <n> free lines are left on the current list page between the last output and the page footer.BASIC LISTS Page Break.

WRITE / sy-index. ENDDO. DO 4 TIMES. START-OF-SELECTION. ULINE. / 'LINE 3'. WRITE: / 'LINE 1'. WRITE / sy-index. ENDDO. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DO 2 TIMES. / 'LINE 2'.BASIC LISTS REPORT demo_list_reserve LINE-SIZE 40 LINE-COUNT 8(2). END-OF-PAGE. RESERVE 3 LINES.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

* The system then increases the SY-PAGNO system field by one. NEW-PAGE LINE-SIZE <width>.BASIC LISTS Page Break. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . NEW-PAGE LINE-COUNT <length>. * Ends the current page.Unconditional Syntax NEW-PAGE. Variants in NEW_PAGE are: NEW-PAGE [NO-TITLE|WITH-TITLE] NO-HEADING|WITH-HEADING]. * Does not trigger the END-OF-PAGE END OF PAGE event. All other output appears on a new page.

WRITE: 'TOP-OF-PAGE'. WRITE / 'Loop:'. ENDDO. NEW-PAGE. ULINE AT /(17). DO 2 TIMES. TOP-OF-PAGE. sy-pagno. WRITE / sy-index. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .BASIC LISTS REPORT demo_list_new_page LINE-SIZE 40. ENDDO. START-OF-SELECTION. DO 3 TIMES.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Scrolling from within the Program From within the program. t ll The SCROLL statement allows you: Vertical Scrolling Scrolling Window by Window Scrolling by Pages Horizontal Scrolling g Scrolling to the List's Margins Scrolling by Columns Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you can scroll through lists vertically and h i horizontally.

BASIC LISTS Scrolling Window by Window To scroll through a list vertically by the size of the current window use this statement: Syntax SCROLL LIST FORWARD|BACKWARD. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . This statement scrolls forward or backward through the current list by the size of the current window.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ENDDO. DO 3 TIMES. ULINE. ENDDO. START-OF-SELECTION. WRITE: 'Top of Page'. sy-srows. WRITE / sy-index. sy-pagno. DO 100 TIMES. TOP-OF-PAGE.BASIC LISTS REPORT demo demo_list_scroll_1 list scroll 1 NO STANDARD PAGE HEADING LINE LINE-SIZE SIZE 40. SCROLL LIST FORWARD. 'SY-SROWS:'.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

the SCROLL statement t t t offers ff t two options. ti Scrolling to Certain Pages Scrolling by a Certain Number of Pages Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .BASIC LISTS Scrolling by Pages To scroll a list vertically depending on the page length.

to the last. or to the page numbered <page> .BASIC LISTS Scrolling to Certain Pages To scroll to certain pages. use the TO option of the SCROLL statement: Syntax SCROLL LIST TO FIRST PAGE | LAST PAGE | PAGE <page> . This statement scrolls the current list to the first. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

This statement scrolls forward or backward <n> pages.BASIC LISTS Scrolling by a Certain Number of Pages To scroll a list by a certain number of pages. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the following options of th SCROLL statement: the t t t Syntax SCROLL LIST FORWARD | BACKWARD <n> PAGES.

use the following options of the SCROLL statement: Syntax SCROLL LIST LEFT | RIGHT.BASIC LISTS Scrolling to the List's Margins To scroll horizontally to the left or right margin of a list. This statement scrolls to the left or right margin of the currentlist. currentlist Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS REPORT demo_list_scroll_3 NO STANDARD PAGE HEADING LINE-SIZE 200. WRITE sy-index. sy-scols. sy-pagno. TOP-OF-PAGE. 'SY SY-SCOLS: SCOLS:'. START OF SELECTION START-OF-SELECTION. sy index ENDDO. SCROLL LIST RIGHT. DO 200 TIMES. sy scols ULINE. WRITE: AT 161 'Top of Page'. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Scrolling by Columns To scroll a list horizontally by columns. the SCROLL statement offers two options. A column in this case means one character of the list line. •Scrolling to Certain Columns •Scrolling by a Certain Number of Columns Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

BASIC LISTS Scrolling to Certain Columns To scroll to certain columns. use the TO COLUMN option of the SCROLL statement: Syntax SCROLL LIST TO COLUMN <colm> . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . This system displays the current list starting from column <colm>.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . This system scrolls the current list to the left or right by <n> columns.BASIC LISTS S Scrolling lli by b a Certain C t i Number N b of f Columns C l To scroll a list by a certain number of columns columns. use the following option of the SCROLL statement: Syntax SCROLL LIST LEFT | RIGHT BY <n> PLACES.

TOP OF PAGE TOP-OF-PAGE. sy-pagno. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 'SY SY-SCOLS: SCOLS:'. SCROLL LIST TO COLUMN 178. DO 200 TIMES. sy-scols. START-OF-SELECTION. WRITE: AT 161 'Top of Page'. y ENDDO. START OF SELECTION. WRITE sy-index. sy scols ULINE.BASIC LISTS REPORT demo_list_scroll_4 NO STANDARD PAGE HEADING LINE-SIZE 200.

BASIC LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .BASIC LISTS Left Boundary for Horizontal Scrolling To determine the left boundary of the horizontally scrollable area. use: Syntax SET LEFT SCROLL-BOUNDARY [COLUMN <col>].

a header or comment line) from horizontal scrolling.BASIC LISTS Excluding c ud g Lines es from o Horizontal o o ta Scrolling Sc o g To exclude a line (for example. define the line feed for that line as follows: Syntax NEW LINE NO NEW-LINE NO-SCROLLING. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SCROLLING The line following the statement cannot be scrolled horizontally. horizontally However. it can be scrolled vertically.

Lists with several p pages g ) Interactive lists( At line-selection . LIST PROCESSING TECHNIQUES Extract datasets Data output in lists( Standard. Self-defined. At User-command) List creation with the ALV grid control Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6.

Instead of one extensive and detailed list. All lists li t created t d during d i an interactive i t ti list li t event t are secondary d lists. Detailed information is presented in secondary lists. li t Interactive lists enhance the classical type of output list with dialog functionality.thus coming close to dialog programming.INTERACTIVE LIST A list is an interactive list if the user interface allows actions that trigger events and if the corresponding interactive event keywords occur in the report.with interactive reporting you create a condensed basic list from which the user can call detailed information by yp positioning g the cursor and entering g commands. Interactive lists provide the user with so so-called called “interactive interactive reporting” reporting facility. Interactive reporting thus reduces information retrieval to the data actually required. facility Interactive reporting allows the user to participate actively in retrieving and presenting data during the the session. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTERACTIVE LISTS Interactive Reporting Secondary List Interactive List REPORT TRANSACTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTERACTIVE LISTS E Events t for f Interactive I t ti Lists Li t •AT LINE-SELECTION •AT PF<nn> PF •AT USER-COMMAND Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

<statements>. Edit --> Choose and F2 are assigned to PICK.INTERACTIVE LISTS All i Li Allowing Line Selection S l ti To allow the user to select a line from the list. In the predefined interface. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . define and write a processing block for the AT LINE LINE-SELECTION SELECTION event in your program: Syntax AT LINE-SELECTION.

the system does not trigger the event TOP-OF-PAGE.INTERACTIVE LISTS Page age Headers eade s for o Secondary Seco da y Lists sts On secondary lists. list Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The system triggers this event for each secondary list. To create page headers for secondary list: Syntax TOP-OF-PAGE DURING LINE-SELECTION.

AT LINE-SELECTION. WHEN OTHERS. WRITE 'First Secondary List'. TOP-OF-PAGE DURING LINE-SELECTION. ENDCASE ENDCASE. CASE sy-lsind. WHEN 1. sy-lsind. START-OF-SELECTION. WRITE: 'Secondary List. Level:'. WRITE 'Second Secondary List'. WRITE 'Secondary List'.INTERACTIVE LISTS Program which shows At LINE-SELECTION & TOP-OF-PAGE DURING LINE-SELECTION. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . REPORT demo_list_interactive_3 . WRITE 'Basic List'. ULINE. WHEN 2 2.

• Next Slide shows the modified Page Header and Text of the Secondary List Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .INTERACTIVE LISTS Page Header in Basic List This is the basic list • When clicked on the basic list Event AT LINE-SELECTION is triggered.

INTERACTIVE LISTS Changed Page Header in secondary list This is the secondary list Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

t t t <nn> is a number between 1 and 24. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SY-UCOMM returns the function code PF<nn>. Syntax AT PF<nn>.INTERACTIVE LISTS Allowing o g Function u ct o Key ey Selection Se ect o To allow the user to select an action by pressing a function key. <statements>.

ENDFORM. AT pf5. WRITE 'Basic List. sy-lsind. t AT pf6. AT pf8. WRITE: 'Secondary List by PF-Key PF Key Selection' Selection'. sy-ucomm. pf8 PERFORM out. PERFORM out. FORM out. PF6. PERFORM out. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . or PF8'. / 'SY-LSIND ='. PERFORM out. AT pf7.INTERACTIVE LISTS START-OF-SELECTION. Press PF5. / 'SY-UCOMM ='. PF7.

INTERACTIVE LISTS If any function keys f5.f7 & f8 are pressed it will take you to the relavent secondary list Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .f6.

INTERACTIVE LISTS Secondary list when function key(f5) is pressed Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTERACTIVE LISTS S tti a St Setting Status t You set the status with the SET PF PF-STATUS STATUS statement. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The system then automatically loads function codes predefined for list processing into the Menu Painter. statement Syntax SET PF-STATUS <stat> [EXCLUDING <f>|<itab>]. choose List or List in dialog box. Note: For the Status type of interactive lists.

The AT USER-COMMAND event occurs whenever the user selects a selfdefined function code from a self-defined user interface. which always triggers the AT LINE SELECTION e LINE-SELECTION event.INTERACTIVE LISTS Th AT USER-COMMAND The USER COMMAND Event E t To allow your program to react to a user action triggering a self-defined function code Syntax AT USER-COMMAND. ent Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The event does not occur if the user selects function codes predefined for system functions or the function code PICK. <statements>.

INTERACTIVE LISTS
REPORT demo demo_list_at_user_command list at user command NO STANDARD PAGE HEADING HEADING. START-OF-SELECTION. WRITE: 'Basic List', / 'SY-LSIND:', 'SY LSIND:' sy sy-lsind. lsind TOP-OF-PAGE. WRITE 'Top-of-Page'. ULINE. ULINE TOP-OF-PAGE DURING LINE-SELECTION. CASE sy-pfkey. WHEN 'TEST' TEST . WRITE 'Self-defined GUI for Function Codes'. ULINE. ENDCASE. AT LINE-SELECTION. SET PF-STATUS 'TEST' EXCLUDING 'PICK'. PERFORM out. sy lsind = sy sy-lsind sy-lsind lsind - 1. 1

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

When clicked on the Basic list AT LINE-SELECTION event i t is triggred i d and d secondary d li list ti is di displayed l d which hi h h has pff status.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

At USER-COMMAND when any of the button in application pp tool bar are p pressed it will take to relavent lists.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
I Important t t System S t Fields Fi ld for f Secondary S d Lists Li t SY LSIND SY-LSIND SY-LISTI SY LISTI SY-LILLI triggered gg SY-LISEL SY-UCOMM SY-PFKEY Index of the list created during the current event (basic list = 0) Index of the list level from which the event was triggered Absolute number of the line from which the event was Contents of the line from which the event was triggered Function code that triggered the event Status of the displayed list

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
M Messages in i Lists: Li t They are grouped by language, a two-character ID, and a three-digit number From your program, number. program you can send a message with different qualifications: A E I S W Abend; the current transaction is stopped Error; the system waits for new input data Information; after pressing ENTER, the system continues processing Confirmation; the message appears on the next screen Warning; you can change the input data or continue by pressing ENTER

You must specify the MESSAGE-ID behind the REPORT statement of your program program.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
REPORT demo_list_interactive_4 d li t i t ti 4 NO STANDARD PAGE HEADING HEADING. START-OF-SELECTION. WRITE 'Basic List'. MESSAGE s888(sabapdocu) WITH text-001. AT LINE-SELECTION. IF sy-lsind = 1. MESSAGE i888(sabapdocu) ( p ) WITH text-002. ENDIF. IF sy-lsind = 2. MESSAGE e888(sabapdocu) WITH text-003 sy-lsind text-004. ENDIF. WRITE: 'Secondary List, SY-LSIND:', sy-lsind.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Popup window showing the message in the lists

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Defining e g Titles t es for o Interactive te act e Lists sts By default, the system uses the program title as the title of the output screen of a report. To choose another title for the output screens, use this statement: Syntax SET TITLEBAR <tit> [WITH <g1> ... <g9>].

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Displaying sp ay g Lists sts in Dialog a og Windows do s To display a secondary list in a dialog window use the WINDOW statement: Syntax WINDOW STARTING AT <left> l ft <upper> [ENDING AT <right> i ht <lower>]. l ] The WINDOW statement takes effect only within the processing block of an interactive event event, that is is, only for secondary lists lists. Note: Dialog windows have no menu bar and no standard toolbar

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
REPORT demo_list_window NO STANDARD PAGE HEADING. START-OF-SELECTION. SET PF-STATUS 'BASIC'. WRITE 'Select line for a demonstration of windows'. AT USER-COMMAND. CASE sy-ucomm. WHEN 'SELE'. IF sy-lsind l i d = 1. 1 SET PF-STATUS 'DIALOG'. SET TITLEBAR 'WI1'. WINDOW STARTING AT 5 3 ENDING AT 40 10. WRITE 'Select line for a second window'. indo ' ELSEIF sy-lsind = 2. SET PF-STATUS 'DIALOG' EXCLUDING 'SELE'. SET TITLEBAR 'WI2'. WINDOW STARTING AT 45 10 ENDING AT 60 12 12. WRITE 'Last window'. ENDIF. ENDCASE.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Triggering Events from within the Program Instead of letting the user trigger an interactive event by an action on the output t t screen, you can yourself lf t trigger i events t f from within ithi th the program. Syntax SET USER-COMMAND <fc>. This statement takes effect after the current list is completed. Before the system displays the list, it triggers the event that corresponds to the function code stored in <fc>,independent of the applied user interface. Note: Function code PICK triggers an event only if the cursor is located on a list line .
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Passing ass g data from o list st to report epo t To effectively use interactive lists for interactive reporting, it is not sufficient for the program to react to events triggered by user actions on the output list. You must also be able to interpret the lines selected by the user and their contents. F ll i options Following ti are available: il bl Passing data automatically using system fields Using statements in the program to fetch data

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Using Us gS SY-LISEL S The SY-LISEL system field is a field of type C with a length of 255 characters. It contains the selected line as one single character string, thus making ki it difficult diffi lt for f you to t retrieve ti the th values l of f individual i di id l fields. fi ld To process certain parts of SY-LISEL, you must specify the corresponding offsets

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
REPORT demo_list_sy_lisel demo list sy lisel NO STANDARD PAGE HEADING HEADING. DATA num TYPE i. SKIP. WRITE 'List of Quadratic Numbers between One and Hundred'. SKIP. WRITE 'List of Cubic Numbers between One and Hundred'. TOP-OF-PAGE. WRITE 'Choose a line!'. ULINE. TOP-OF-PAGE DURING LINE-SELECTION. WRITE sy-lisel. sy-lisel ULINE.
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
AT LINE-SELECTION. LINE-SELECTION IF sy-lisel(4) = 'List'. CASE sy-lilli. sy lilli. WHEN 4. DO 100 TIMES. num = sy-index ** 2. WRITE: / sy-index, num. ENDDO. WHEN 6. DO 100 TIMES. num = sy-index ** 3. WRITE: / sy-index, num. ENDDO. ENDDO ENDCASE. ENDIF.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Passing Data by Program Statements HIDE The moment you create a list level you can define which information to pass to the subsequent secondary lists. READ LINE Use the statements READ LINE and READ CURRENT LINE to explicitly read data from the lines of existing list levels. GET CURSOR Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the processing block.
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
The e HIDE Technique ec que You use the HIDE technique while creating a list level to store linespecific information for later use. Syntax HIDE <f>. This statement stores the contents of variable <f> in relation to the current output line (system field SY-LINNO) internally in the so-called HIDE area. area The variable <f> need not necessarily appear on the current line. As soon as the user selects a line for which you stored HIDE fields fields, the system fills the variables in the program with the values stored.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
REPORT Z_HIDE1 . TABLES : SPFLI, SFLIGHT. SELECT-OPTIONS SELECT OPTIONS : CARR FOR SPFLI-CARRID. SPFLI CARRID. SELECT * FROM SPFLI WHERE CARRID IN CARR. WRITE :/ SPFLI-CARRID , SPFLI-CONNID. HIDE SPFLI-CARRID. ENDSELECT. AT LINE-SELECTION. CASE SY-LSIND. WHEN '1'. SELECT * FROM SFLIGHT WHERE CARRID = SPFLI-CARRID. WRITE :/ SFLIGHT-FLDATE, SFLIGHT-SEATSOCC. ENDSELECT. ENDSELECT ENDCASE.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTERACTIVE LISTS Value is stored Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

INTERACTIVE LISTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. <fn> [INTO <gn>]]..INTERACTIVE LISTS Reading Lines from Lists To read a line from a list after an interactive list event occurred. . The statement without any options stores the contents of line <lin> from the list on which the event was triggered (index SY SY-LILLI) LILLI) in the SY-LISEL SY LISEL system field and fills all HIDE information stored for this line back into the corresponding fields . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the READ LINE statement: Syntax READ LINE <lin> [INDEX <idx>] [FIELD VALUE <f1> [INTO <g1>] .

use the GET CURSOR statement to refer to either the field or the line. Syntax GET CURSOR FIELD <f> f [VALUE <val>] l ]. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .INTERACTIVE LISTS Reading ead g Lists sts at t the e Cu Cursor so Position os t o To retrieve information on the cursor position during an interactive event.

INTERACTIVE LISTS

REPORT demo_list_get_cursor NO STANDARD PAGE HEADING LINE-SIZE 40. DATA: hotspot(10) TYPE c VALUE 'Click me!', f(10) TYPE c, off TYPE i, lin TYPE i, val(40) TYPE c, len TYPE i. FIELD-SYMBOLS <fs> TYPE ANY. ASSIGN hotspot TO <fs>. WRITE 'Demonstration of GET CURSOR statement'. SKIP TO LINE 4. POSITION 20. WRITE <fs> HOTSPOT COLOR 5 INVERSE ON.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

AT LINE-SELECTION. WINDOW STARTING AT 5 6 ENDING AT 45 20. GET CURSOR FIELD f OFFSET off LINE lin VALUE val LENGTH len. WRITE: 'Result of GET CURSOR FIELD: '. ULINE AT /(28). WRITE: / 'Field: ', f, / 'Offset:', off, / 'Line: ', lin, / 'Value: ', (10) val, / 'Length:', len. SKIP. GET CURSOR LINE lin OFFSET off VALUE val LENGTH len. WRITE: 'Result of GET CURSOR LINE: '. ULINE AT /(27). /( ) WRITE: / 'Offset:', off, / 'Value: ', val, / 'Length:', len.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
C lli Reports Calling R t To call a report from with in other report,use the SUBMIT statement. To set the name of the called program statically in the programcoding. programcoding Syntax : SUBMIT <rep> [AND RETURN] [<options>]. The first statement starts the report<rep>,the p p second statement starts the report whose name is stored in field<rep>.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
In this I thi program we r calling lli a program zsapmztst1 t t1 next t slide lid shows h the th zsapmztst1. REPORT ZSAPMZTST . DATA : ITAB TYPE I OCCURS 10, NUM TYPE I. SUBMIT ZSAPMZTST1 AND RETURN. IMPORT ITAB FROM MEMORY ID 'HK'. LOOP AT ITAB INTO NUM. WRITE / NUM. ENDLOOP. WRITE 'REPORT 1'. ULINE.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
REPORT ZSAPMZTST1 . DATA : NUMBER TYPE I, ITAB TYPE I OCCURS 10. SET PF-STATUS PF STATUS 'MYBACK' MYBACK . DO 5 TIMES. NUMBER = SY-INDEX. APPEND NUMBER TO ITAB. WRITE : 'NUMBER'. ENDDO. TOP-OF-PAGE. WRITE 'REPORT 2'. ULINE. AT USER-COMMAND. CASE SY-UCOMM. WHEN 'MYBACK'. EXPORT ITAB TO MEMORY ID 'HK'. LEAVE LEAVE. ENDCASE.
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS

Called Report

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Exercise 1 Create an interactive list using hide technique based on tables ekko and ekpo. Output the following field in the basic list. EKKO-EBELN. Based on the output of the basic list I.e., EKKO-EBELN, output the following fields in the secondary list by passing the field EKKO EKKO-MATNR MATNR by HIDE Technique. EKPO-BUKRS EKPO-WERKS EKPO-LGORT EKPO-MENGE

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Solution TABLES: EKKO, EKPO. DATA: BEGIN OF ITAB1 OCCURS 0, EBELN LIKE EKKO EKKO-EBELN, EBELN END OF ITAB1. DATA : BEGIN OF ITAB2 OCCURS 0, MATNR LIKE EKPO EKPO-MATNR, MATNR BUKRS LIKE EKPO-BUKRS, WERKS LIKE EKPO-WERKS, LGORT LIKE EKPO-LGORT, EKPO LGORT, MENGE LIKE EKPO-MENGE, END OF ITAB2. SELECT EBELN FROM EKKO INTO ITAB1-EBELN. WRITE :/ ITAB1-EBELN HOTSPOT. HIDE ITAB1-EBELN. ENDSELECT.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
TOP-OF-PAGE DURING LINE-SELECTION. WRITE:/ 'MATERIAL' ,12 'COMPANY',18 'PLANT',28 'STORAGE',38'QUANTITY'. AT LINE-SELECTION. LINE SELECTION * Interactive event, details list * Read data corresponding to the selection criteria and * display SELECT MATNR BUKRS WERKS LGORT MENGE FROM EKPO INTO CORRESPONDING FIELDS OF ITAB2 WHERE EBELN = ITAB1 ITAB1-EBELN. EBELN. WRITE: / ITAB2-MATNR, * Material Number 12 ITAB2-BUKRS, * Company code 18 ITAB2-WERKS, , * Plant 28 ITAB2-LGORT, * Storage Location 38 ITAB2-MENGE. *Quantity ENDSELECT.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Exercise NO: 2 Task: Create a list of all flight connections for each airline carrier. carrier Output the following fields: SPFLI-CARRID SPFLI CARRID, SPFLI-CONNID SPFLI CONNID, SPFLI-CITYFROM SPFLI CITYFROM, SPFLI-CITYTO, SPFLI-DEPTIME, SPFLI-ARRTIME. Define a selection screen on which the user can enter selections for the airline carrier (SPFLI-CARRID) and the connection ID (SPFLI-CONNID). Read the data from table SPFLI in accordance with this selection. When the user selects a line line, the system should display a secondary showing the flights (table SFLIGHT) available for the flight connection concerned (see example list). Output the selected line as the header of the secondary list. Calculate and output the number of vacant seats for each h flight. fli ht Make M k sure that th t the th program can handle h dl invalid i lid line li selection.
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Example list AA 0017 Date 10.29.1995 NEW YORK Price 666.67 USD SAN FRANCISCO Seats max. 660 660 660 11.11.1995 666.67 USD 11.16.1995 666.67 USD occupied free 10 20 38 650 640 622 13:30:00 16:31:00

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Solution REPORT ZABCD00111 . TABLES: SPFLI, SFLIGHT. * Report defined selection criteria for airline and for * connection id SELECT-OPTIONS: SELCARR FOR SPFLI-CARRID, SELCONN FOR SPFLI-CONNID. *A Auxiliary ili fi field: ld number b of f free f seats t DATA: SFREE LIKE SFLIGHT-SEATSMAX. START-OF-SELECTION. START OF SELECTION * Read data corresponding to the selection criteria and * display SELECT * FROM SPFLI WHERE CARRID IN SELCARR AND CONNID IN SELCONN. WRITE: / SPFLI-CARRID, SPFLI-CONNID, , SPFLI-CITYFROM, SPFLI-CITYTO,
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
SPFLI-DEPTIME, SPFLI-DEPTIME SPFLI-ARRTIME. HIDE: SPFLI-CARRID, SPFLI-CONNID. ENDSELECT. END-OF-SELECTION. CLEAR SPFLI-CARRID. "initialization AT LINE-SELECTION. * Interactive event, details list CHECK NOT SPFLI-CARRID IS INITIAL. * Display detail list only if valid line-selection WRITE SY-LISEL. WRITE: /5 TEXT-001, 29 TEXT-002, 49 TEXT-003, / TEXT-004 TEXT 004 UNDER TEXT TEXT-003, 003 60 TEXT TEXT-005, 005 70 TEXT TEXT-006. 006 * D: TEXT-001: Date * D: TEXT-002: Price * D: TEXT-003: Seats * D: TEXT-004: Max * D: TEXT-005: occupied TEXT-006: free
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
ULINE. ULINE SELECT * FROM SFLIGHT WHERE CARRID EQ SPFLI-CARRID AND CONNID EQ SPFLI-CONNID. * Read data for details list using the hided key fields, * list output WRITE: /5 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-CURRENCY. SFREE = SFLIGHT-SEATSMAX - SFLIGHT-SEATSOCC. WRITE: SFLIGHT-SEATSMAX, SFLIGHT-SEATSOCC, SFREE. ENDSELECT. CLEAR SPFLI SPFLI-CARRID. CARRID "initialization

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Summary Extract datasets : An extract is a sequential dataset you can create with a report.Use extracts if you want to process large amount of data as a whole several times Declaring Extract Records as Field Groups Filling an Extract with Data Reading an Extract Sorting an Extract Lists Lists are the output medium for data from ABAP/4 report programs. program g can produce p up p to 21 lists: one basic list and 20 Each p secondary lists.
Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation

INTERACTIVE LISTS
Structure and the options of a list are The Standard List The Self-Defined List Lists with Several Pages Interactive List A list is an interactive list if the user interface allows actions that trigger events and if the corresponding interactive event keywords occur in the report. Events for Interactive Lists AT LINE-SELECTION AT PF<nn> AT USER-COMMAND

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

6. LIST PROCESSING TECHNIQUES

Extract datasets Data output in lists( Standard, Self-defined, Lists with several p pages g ) Interactive lists( At line-selection , At User-command) List creation with the ALV grid control

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

6. LIST PROCESSING TECHNIQUES

INTRODUCTION
• The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV). • Using ALV, we can have three types of reports: 1 Simple 1. Si l Report R t 2. Block Report 3. Hierarchical Sequential Report

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

6. LIST PROCESSING TECHNIQUES

There are some function modules which will enable to produce the above reports without much effort. All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

LIST PROCESSING TECHNIQUES SIMPLE REPORT 1. Simple Report The important function modules are: ¾ ¾ ¾ ¾ ¾ Reuse_alv_list_display Reuse_alv_fieldcatalog_merge R Reuse_alv_events_get l t t Reuse_alv_commentary_write Reuse_alv_grid_display Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6.

I_callback_user_command : routine where the function codes are handled. I_callback_pf_status_set Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . c. a. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD…. A. Export: : report id : routine where a user can set his own pf status or change g the functionality y of the existing gp pf status.6. REUSE_ALV_LIST_DISPLAY: This is the function module which prints the data. I_callback_program b. The important parameters are: 1.

. t_outtab : internal table with the data to be output g.6. It_fieldcat : name of the dictionary table : structure to set the layout of the report : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE) : internal table with a list of all possible events of ALV and their corresponding routine names. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD.. It_events Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 2. d. I_structure name e. Is_Layout f. Tables: a.

If the output data is from a single dictionary table and all the columns are selected.. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD. then we need not exclusively create the field catalog. parameter(I_structure_name) REUSE ALV LIST DISPLAY But in other cases we need to create it. REUSE_ALV_FIELDCATALOG_MERGE: This function module is used to populate a fieldcatalog which is essential to display the data in ALV. Its enough to mention the table name as a parameter(I structure name) in the REUSE_ALV_LIST_DISPLAY.. B.

h dl d 2.6. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . I_internal_tabname c. Export: a. The important parameters are: 1. I_program_name b. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD. Changing ct_fieldcat yp SLIS_T_FIELDCAT_ALV : an internal table with the type which is declared in the type pool SLIS.. I_inclname : report id : the internal output table : include or the report name where all the dynamic f forms are handled..

. their ‘FORM’ field must be filled.. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD. For events to be processed by the Callback. If the field is initialized. the event is ignored.6. C . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Import: Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column ‘NAME’). table the field ‘FORM’ filled and the entry modified using constants from the type pool SLIS. The entry can be read from the event table. REUSE_ALV_EVENTS_GET: Returns table of possible events for a a list type 1 1.

. Export: I_list_type: I list type: 0 = simple list 1 = hierarchical-sequential list 2 = simple block list 3 = hi hierarchical-sequential hi l ti l block bl k list li t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. 2. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD.6.

REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.action ti Key : only when typ is ‘S’. It_list_commentary : Internal table with the headings of the type slis_t_listheader. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD. l ti ‘A’ .header..6. This internal table has three fields: T : ‘H’ .. Info : the text to be printed Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . slis t listheader. Typ h d ‘S’ . 1.selection. D.

Parameters : same as reuse_alv_list_display Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6... E. REUSE_ALV_GRID_DISPLAY: A new function in 4. to display the results in grid rather than as a list. LIST PROCESSING TECHNIQUES SIMPLE REPORT CONTD.6 version.

6. LIST PROCESSING TECHNIQUES The example of a simple list is as follows: Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Export: a. REUSE_ALV_HIERSEQ_LIST_DISPLAY 1. I_CALLBACK_PF_STATUS_SET c I_CALLBACK_USER_COMMAND c. I CALLBACK USER COMMAND d. The f function nction mod module le is A. I_CALLBACK_PROGRAM b.6. LIST PROCESSING TECHNIQUES HIERARCHICAL REPORTS Hierarchical sequential list output. IS_LAYOUT Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

e. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . I_TABNAME_ITEM : Name of the internal table in the program containing the output data of the lowest hierarchy level. h. IT_FIELDCAT f. IS_KEYINFO : This structure contains the header and item table field names which link the two tables (shared key).6. I_TABNAME_HEADER : Name of the internal table in the program containing the output data of the highest hierarchy level. IT_EVENTS g. LIST PROCESSING TECHNIQUES Hierarchical Reports Contd.…. i.

6. 2.…. Tables a. T_OUTTAB_ITEM : Name of the internal table in the program containing p data of the lowest hierarchy y level. T_OUTTAB_HEADER : Header table with data to be output b. LIST PROCESSING TECHNIQUES Hierarchical reports p Contd. the output Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

LIST PROCESSING TECHNIQUES Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6.

6. LIST PROCESSING TECHNIQUES BLOCK REPORT This is used to display multiple lists continuously. REUSE_ALV_BLOCK_HS_LIST_APPEND C. REUSE_ALV_BLOCK_LIST_INIT B REUSE_ALV_BLOCK_LIST_APPEND B. REUSE_ALV_BLOCK_LIST_DISPLAY Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . REUSE ALV BLOCK LIST APPEND D. continuously The important functions used in this report are: A.

etc Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . A. REUSE_ALV_BLOCK_LIST_INIT Parameters: a.6.. I_CALLBACK_PF_STATUS_SET _ _ _ c. I_CALLBACK_PROGRAM I CALLBACK PROGRAM b. LIST PROCESSING TECHNIQUES BLOCK REPORT CONTD. I_CALLBACK_USER_COMMAND This function module is used to set the default GUI status etc.

LIST PROCESSING TECHNIQUES BLOCK REPORT CONTD. REUSE_ALV_BLOCK_LIST_APPEND Export : a.6. T OUTTAB : internal table name with all possible events : internal table with output data data. IS_LAYOUT : layout settings for block b. This function module adds the data to the block. I_TABNAME : Internal table name of the output data d.. IT_EVENTS Tables : a T_OUTTAB a. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . B. IT_FIELDCAT : field catalog c.

bl k Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LIST PROCESSING TECHNIQUES REUSE ALV LIST HS APPEND : REUSE_ALV_LIST_HS_APPEND I used Is dt to append d the th Hierarchical Hi hi l Sequential S ti l blocks.6.

function Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . C. This function module display the list with data appended by the above function..6. LIST PROCESSING TECHNIQUES BLOCK REPORT CONTD. REUSE_ALV_BLOCK_LIST_DISPLAY Parameters : All the parameters are optional.

ALV FIELDCATALOG MERGE REUSE_ALV_EVENTS_GET. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LIST PROCESSING TECHNIQUES Here the functions REUSE REUSE_ALV_FIELDCATALOG_MERGE. REUSE_ALV_COMMENTARY_WRITE can be used.6.

ref_tabname f. tabname d. key(1) g. hotspot(1) : : : : : : : : position of the column i t internal l fieldname fi ld internal table name fieldname (dictionary) (dictionary) y) table ( column with key-color icon hotspot Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . col_pos b fieldname b. LIST PROCESSING TECHNIQUES INTERNAL TABLES IN SLIS Slis_t_fieldcat_alv : This internal table contains the field attributes. . icon(1) h.6. Important Attributes: a. This internal table can be populated automatically by using ‘REUSE REUSE_ALV_FIELDCATALOG_MERGE ALV FIELDCATALOG MERGE’. fi ld c. ref_fieldname e.

Symbol(1) i S b l(1) j. (X)no out output length long key word middle key word short key word heading(ddic) (S)hort (M)iddle (L)ong datatype Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .6. datatype : : : : : : : : : : : : symbol b l checkbox (R)ight (L)eft (C)ent sum up p (O)blig. Checkbox(1) k. seltext_s r. outputlen o. seltext-l p seltext_m p. reptext_ddic s. do_sum(1) ( ) m. just(1) l. no_out(1) n. ddictxt(1) t. seltext m q. LIST PROCESSING TECHNIQUES i.

SLIS_T_EVENT : Internal table for storing all the possible events of the ALV. LIST PROCESSING TECHNIQUES 2.6. This can be populated by the function module Reuse_alv_events_get Reuse alv events get The columns are : •name •form : : name of the event name of the routine Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The structure rs_selfield has the details about the current cursor position. interface • I_CALLBACK_USER_COMMAND Syntax : FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . LIST PROCESSING TECHNIQUES SYNTAXES FOR THE ROUTINES • I_CALLBACK_PF_STATUS_SET Syntax : FORM set_pf_status USING rt_extab TYPE slis_t_extab The table RT_EXTAB contains the function codes which are hidden in the standard interface. The parameter r_ucomm contains the function code.6.

Menu Painter Input checks. changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic. g . Screen Painter .7.

7. DIALOG PROGRAMMING • A Transaction is a program that conducts a dialog with the User • In a typical dialog. • As per the user input or request. the system displays the screen on which the user can enter or request information. transaction is used to – Branch to the next Screen – Display an output – Change/Update the database Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Central Components of an Online Program ABAP/4 Development Workbench ABAP/4 Dictionary Screen Painter ABAP/4 Editor Menu Painter Runtime environment Online processor ABAP/4 Processor Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Transactions • • • • • • • • • Structure of the Dialog Programming SCREEN Painter MENU Painter I Input t Checks Ch k Error Handling Flow Logic Screen Modification Table Control and Step Loop Branching to List Processing Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Structure of the Dialog Programming Program Name – Dictionary Structure – Global data – PBO modules – PAI modules – Subroutines – Screens – GUI Status – Transaction code Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Transactions.Structure Define screens Attributes Att ib t Fullscreen ABAP/4 Dict. fields Field list Fl Flow logic l i Screen Painter Online program Program module d l pool l ABAP/4 Global data PBO modules PAI modules Subroutines Define call Transaction code Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

define screen templates and field texts .Summary Program S Screen 100 Creating module pool and maintaining attributes Creating screen 100: .maintain field list .define attributes .define flow logic see screen 100 Defining ABAP/4 fields (same name as screen fields!) Defining processing (before screen is displa displayed) ed) Defining processing after the user has pressed ENTER Defining the code you use to call the online program Delivering Solution Excellence and Innovation Screen 200 Gl b l data Global d t PBO Module PAI Module Transaction code Satyam SAP PMG SAP PMG .

Input/Output fields. The fields can be text Sting. Radio Buttons. E h screen consists Each i t of f • • • • Screen Attributes Screen Elements Screen Fields Screen Flow Logic Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Check boxes or Pushbuttons .Screen Painter Each Screen contains fields used to display or request Information Information.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . •Hold H ld Data D t : If th the user calls ll th the screen more than th once during d i a terminal t i l session. that identifies the screen within the program. •Next Screen : Specifies the next screen. unique within the ABAP program.Screen Attributes •Program P (type (t M) •Screen Number : A four-digit number. Modal dialog boxes only cover a part of a GUI window. A subscreen is a screen that y you can display p y in a subscreen area on a different screen in the same ABAP program. he or she can retain changed data as default values. •Screen Type : A normal screen occupies a whole GUI window.

Pushbuttons: Elements on the screen that trigger the PAI event of the screen flow logic when chosen by the user user. There is a function code attached to each pushbutton. only a single button can be selected at any one time. which cannot be changed either by the user or by the ABAP program. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Screen Elements Text Fields: Display elements. which is passed to the ABAP program when it is chosen. Within a radio button group. Input/Output I t/O t t Fi Fields: ld Used U d to t display di l data d t from f the th ABAP program or for f entering data on the screen. Linked to screen fields Radio Buttons: Special input/output fields that are combined into groups. Check boxes: Special input/output fields which the user can select (value ‘X’) or deselect (value SPACE).

User actions that trigger the PAI event also place the corresponding function code into this field. p g You can also use the command field in the standard toolbar to enter the function code. which is not displayed on the screen. Tab T b Strip St i Controls: C t l Areas A on th the screen i in which hi h you can switch it h between b t various pages. Table Controls: Tabular input/output fields. You must assign a name to the OK_CODE field to be able to use it for a particular screen.Screen Elements Subscreen: Area on the screen in which you can place another screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Ok_Code Field: Every screen has a twenty-character OK_CODE field (also known as the function code field). Status Icons: Display elements. from where it is passed to the ABAP program. indicating the status of the application program.

Their contents are passed to identically-named fields in the ABAP program in the PAI event.Screen Fields Screen fields are fields in the working memory of a screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The screen fields are linked with the input/output fields. and filled from the same identically-named fields in the program in the PBO event.

Screen Fields(Attributes) C t Cont.. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Screen Painter . changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .7. DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic. g . Menu Painter Input checks.

.It serves as a container for processing i blocks. PROCESS AFTER INPUT. each of which is introduced with the screen y PROCESS: keyword PROCESS BEFORE OUTPUT.. bl k There are four event blocks.. .It is otherwise referred to as Screen Language.Screen Flow Logic Screen flow logic contains the procedural part of a screen. g must contain at least the two statements PROCESS The screen flow logic BEFORE OUTPUT and PROCESS AFTER INPUT in the correct order. but is not part of ABAP itself. PROCESS ON HELP-REQUEST... PROCESS ON VALUE-REQUEST. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ..It contains no explicit data declarations. The language used to program screen flow logic has a similar syntax to ABAP.. INPUT .

At the end of the PBO processing. PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. the system carries on processing the current screen. Co t PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed You can program the PBO processing of the screen in this displayed. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . called PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUEREQUEST (POV) are triggered when the user requests field help (F1) or possible values help (F4) respectively. the system either calls the next screen or carries on processing at the point from which the screen was called. the screen is displayed.. At the end of the PAI processing.Screen Flow Logic Cont. You can program the appropriate coding in the corresponding event blocks. screen You can program the PAI processing of the screen in this block. At the end of processing. block.

Screen Flow Logic Keyword MODULE FIELD ON VALUES CHAIN ENDCHAIN CALL LOOP ENDLOOP Function Calls a dialog module in an ABAP program Specifies the point at which the contents of a screen field should be transported Used in conjunction with FIELD Used in conjunction conj nction with ith FIELD Starts a processing chain Ends a processing chain Calls a subscreen Starts processing a screen table Stops processing a screen table Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Screen layout Text Fields Input/Output templates Field attributes Field Name Data Type Length I Input/Output t/O t t .. Flow logic PROCESS BEFORE OUTPUT.. MODULE READ. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ..Screen Painter Screen attributes Screen number Short description Screen type Follow up screen Follow-up .. MODULE CLEAR.. PROCESS AFTER INPUT INPUT.

.. SELECT . . ABAP/4 Editor Global data DATA: NUMBER(10) TYPE C. . . PBO module MODULE CLEAR OUTPUT OUTPUT. MODULE CLEAR. Screen layout Text Fields Input/Output templates Field attributes Field Name Data Type Length I Input/Output t/O t t .. ENDMODULE. . PROCESS AFTER INPUT INPUT. . SCREEN PAINTER Flow logic PROCESS BEFORE OUTPUT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. . PAI module MODULE READ INPUT INPUT. . . MODULE READ. ...Screen Painter S Screen P Painter i t To T ABAP/4 Edit Editor Screen attributes Screen number Short description Screen type Follow up screen Follow-up . CLEAR NUMBER. ENDMODULE.. . ..

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . This includes the contents of the system fields (for example. which contains the current function code). occurs If you only use simple modules in the screen flow logic. all of the data from the screen is transported to the ABAP program (as long as there are program fields with the same names as the screen fields) after the automatic input checks and before the first PAI module is called. • At the end of the last PBO module. use the flow logic statement MODULE <mod>. . The system starts the module <mod>. the data transport between the ABAP program and the screen is as follows: • In the PAI event. SY-UCOMM. all of the data is transported from the ABAP program to any identicallynamed fields in the screen. p y .Screen Painter To call a module. which must have been defined for the same event block in which the call occurs. and before the screen is displayed.

FI Financial accounting ABAP/4 PBO PAI AREA DATA: AREATEXT OK-CODE(4). Screen work area SAREA-AREA FI Screen Painter Module pool work area TABLES: SAREA. SAREA-AREATEXT Financial accounting OK-CODE OK CODE Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Screen Painter Data Transfer within the Screen and Module Pool work Area .

PROCESS AFTER INPUT. MODULE D.Sequence of operation Screen Painter Sequence of operations Execute module Execute module A B PROCESS BEFORE OUTPUT. MODULE A. A MODULE B. MODULE C. Data transport from the ABAP/4 work area to the screen work area Send screen ENTER Data transport from the screen work k area t to th the ABAP/4 work area Execute module Execute module Satyam SAP PMG SAP PMG C D Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Overview SET SCREEN CALL SCREEN . . .

. LEAVE SCREEN. PROCESS AFTER INPUT. . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . . . Screen Painter PROCESS BEFORE OUTPUT. . .Set Screen / Leave Screen Screen attributes Screen number 100 . SET SCREEN 201. . . ABAP/4 MODULE OK_CODE INPUT. . . . . . MODULE OK_CODE. Follow-up screen 301 Screen Painter Screen Painter PROCESS AFTER INPUT. Follow-up screen 200 Screen Painter Screen attributes Screen number 201 .

. . . . Screen PROCESS BEFORE OUTPUT. . MODULE OK_CODE. SET SCREEN 0. . . . . LEAVE SCREEN. MODULE OK_CODE. PROCESS AFTER INPUT. Satyam SAP PMG SAP PMG ABAP/4 MODULE OK_CODE INPUT. . CALL SCREEN 201 STARTING AT 30 10 ENDING AT 60 20. Follow-up screen 200 Screen Painter Screen attributes Screen number 201 . . ABAP/4 MODULE OK_CODE INPUT. Delivering Solution Excellence and Innovation . Follow-up screen 301 Screen Painter Screen Painter PROCESS AFTER INPUT.Inserting a Screen as a Screen Sequence Screen attributes Screen number 100 . . . . Modal pop-up window . . . Painter . .

– From called screen – From main screen Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • LEAVE TO SCREEN 0. LEAVE SCREEN.Leaving Screen S t Syntax: • • LEAVE TO SCREEN <screen number>. (or) SET SCREEN <screen number>.

• • SET PF-STATUS ‘xxxxxxxx’. Example: Module Status_100 Status 100 on input. input SET PF-STATUS ‘PF0100’. SET PF-STATUS ‘xxxxxxxx’ EXCLUDING <itab>. End Module.Menu Painter • SET TITLEBAR ‘T01’ WITH v1 1 v2 2 v3 3 v4 4 Example: Module status_100. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Endmodule. SET TITLEBAR ‘T01’ with EKKO-EBELN’. status 100.

changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Menu Painter Input checks. Screen Painter .7. g . DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic.

valid Required Check : In the screen painter you can set a field’s required Input Attribute . All char must be numbers . P i Foreign Key Check:The field can have a foreign key relationship with another table or its domain can specify p y a fixed value list for the field. the system checks that the day value is valid.The system checks the user input value can be found in the related check table or in the fixed-value lists. lid For ex.Input Checks Field Fi ld f format t Ch Check k :This Thi format f t limits li it the th kind ki d of f input i t that th t is i valid. The system requires the user to enter the input b f before entering t i PAI Processing. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . . a DATS field (Date field) is an 8 char string in YYYYMMDD format. For the given value entered.

11. . .Field Format Check Screen Painter Field list Field name DATE . AMOUNT Format DATE DEC Date Amount 31.1993 11.1996 Date Amount 3A9Y 12A3 E: Please enter numeric value E: Invalid date Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .13.

Required Field Screen Painter Field list Field name OBLIGATORY TEST FIELD X ? ? Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. . . FIELD1 . P1 Screen Painter Field list Field FIELD1 Foreign key X Check Field1 C Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Foreign Key Check Field name . . ABAP/4 Dictionary Check table P1 Check table KEY A B C . . .

FIELD <screen field> VALUES [<value list>] Screen Painter PROCESS AFTER INPUT.. FIELD SCOUR-COURSE VALUES ('01'..Changing Input Values Use the FIELD. .). Copy: <value> NOT <value> BETWEEN NOT BETWEEN <value1> AND <value2> <value1> AND <value2> Screen Painter PROCESS AFTER INPUT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. FIELD <screen field> VALUES (<copy1>. 'ABC').VALUES to check the field values in Screen Flow Logic. <copy2>. BETWEEN '20' AND '30'.

.Message Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. FIELD <screen field> MODULE <module>. . MODULE <module> INPUT. . . MESSAGE E .. 1 1 E M E... Screen Painter ABAP/4 PROCESS AFTER INPUT.Input Check in Module Pool The FIELD. .MODULEstatement checks the validity for a particular screen field. ENDMODULE.

Screen Painter MODULE CHECK_SCOUR INPUT. ENDIF.Example PROCESS AFTER INPUT. ABAP/4 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ENDMODULE ENDMODULE. IF SY SY-SUBRC SUBRC NE 0 0. SELECT SINGLE * FROM SCOUR WHERE AREA = SCOUR-AREA AND COURSE = SCOUR-COURSE. MESSAGE E123 WITH 'SCOUR'. FIELD SCOUR-COURSE MODULE CHECK_SCOUR.

1 1 1 E.. . <screen field n>. . MESSAGE E . Message 1 ready for input Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . <screen field2>. > MODULE <module>. . ABAP/4 1 1 1 . . .. FIELD: <screen field1>. ENDCHAIN. . .Field Group-Related Checks PROCESS AFTER INPUT. . Screen Painter MODULE <module> INPUT. .. CHAIN.. ENDMODULE.

Screen Painter MODULE CHECK_SCOUR INPUT. CHAIN CHAIN.Example PROCESS AFTER INPUT. MODULE CHECK_FIELD. ENDIF. ENDCHAIN. MESSAGE E123 WITH 'SCOUR’. SELECT SINGLE * FROM SCOUR WHERE AREA = SCOUR-AREA AND COURSE = SCOUR-COURSE. IF SY SY-SUBRC SUBRC NE 0 0. FIELD: SCOUR-AREA.’COURSE’. ENDMODULE ENDMODULE. SCOUR-COURSE. ABAP/4 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

yp user Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • ON REQUEST: This module will be executed if a value has been entered in the specific field since the screen was displayed.Conditional Check • ON INPUT INPUT: If the field value is different from the initial value. • AT EXIT-COMMAND: EXIT COMMAND At EXIT-COMMAND module will be executed only if the invokes a function code with ‘E’ function type.

On Input / on Chain Input PROCESS AFTER INPUT. . ENDCHAIN. MODULE <module> ON CHAIN-INPUT. . . Screen Painter PROCESS AFTER INPUT. . . Satyam SAP PMG SAP PMG Screen Painter Delivering Solution Excellence and Innovation . . . . FIELD <screen field> MODULE <module> ON INPUT. <screen field 2>. FIELD: <screen field 1>. . C CHAIN. <screen field n>.

. . .On Request / On Chain Request PROCESS AFTER INPUT. <screen field n>. ENDCHAIN. MODULE <module> ON CHAIN-REQUEST. . FIELD <screen field> MODULE <module> ON REQUEST. . . . <screen field 2>. FIELD: <screen field 1>. . CHAIN CHAIN. Satyam SAP PMG SAP PMG Screen Painter Delivering Solution Excellence and Innovation . Screen Painter PROCESS AFTER INPUT. .

MODULE TERMINATE INPUT.. . SET SCREEN . Screen Painter . LEAVE SCREEN. . . . .At Exit Command I Field ? Cancel PROCESS AFTER INPUT. . Satyam SAP PMG SAP PMG ABAP/4 Delivering Solution Excellence and Innovation . ENDMODULE. . MODULE X X.. . MODULE TERMINATE AT EXIT-COMMAND. .

At Exit Command II F Function ti list li t Function Type E Menu Painter ABBR Field ? Cancel List of modification groups Field name ABEND Fcode Type E Screen Painter ABBR Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic. g . Menu Painter Input checks.7. changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Screen Painter .

Displays Error Message on the current screen .Error Handling • • • • • Error (E) Warning (W) Abend (A) Success (S) .Displays Warning Message on the current screen .Message is displayed on the Following Screen Information (I) .The current Transaction will be Terminated .Displays Popup Message on the current screen Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. ENDCHAIN. ENDMODULE. MODULE CHECK INPUT. ENDIF. MESSAGE <qnnn> WITH <value 1>. ENDCHAIN Screen Painter ABAP/4 PROGRAM B220MAIN MESSAGE-ID <id>. FIELD: <screen field 1>. CHAIN CHAIN. . .Error Handling Overview PROCESS AFTER INPUT. . .. MODULE CHECK.. . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . . <screen field 2>. IF SY-SUBRC .<value 4>. .

The system maintains it internally and updates during every screen change.You need not declare as table in your program. you may want to change the attributes depending on what user has requested in the previous screen.The attributes for each screen field are stored in the memory as SCREEN.Dynamic Screen Modification At runtime . h Display Change <-> Display Change Change <-> Display A B A B Output template Input/output template Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Dynamic Screen Modification Field and its attrib. active Required entry field Input field Output field Highlighted Invisible Shorter output length SC SCREEN-ACTIVE C SCREEN-REQUIRED SCREEN-INPUT SCREEN-OUTPUT SCREEN OUTPUT SCREEN-INTENSIFIED SCREEN-INVISIBLE SCREEN-LENGTH Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. MODIFY SCREEN. . .Dynamic Screen Modification. Screen Painter MODULE MODIFY_SCREEN OUTPUT. ENDIF. MODULE MODIFY_SCREEN. ENDIF.Program PROCESS BEFORE OUTPUT. IF SCREEN-GROUP1 = 'GR1'. . . . ENDLOOP. . . SCREEN-INPUT = 1. ABAP/4 LOOP AT SCREEN. SCREEN-ACTIVE = 0. . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . IF SCREEN-NAME = 'TAB-FELD'.

These are the two mechanisms offered by ABAP/4 for displaying and using table data in a screen. Each entry contains one or more fields. and all rows have the same field structure.SCREEN TABLES A screen table is a repeated series of table rows in a screen screen. • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • Table controls and step loops are types of screen tables you can add to a screen in the Screen Painter.

Table Controls With table controls. the user can: • • • • Scroll through the table vertically and horizontally Re-size the width of a column Select table rows or columns Re-order the sequence of columns Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .7. DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic. Menu Painter Input checks. g . Screen Painter .

but can be very long. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Step Loops • The feature of step loops is that their table rows can span more than one line on the screen. By contrast. the rows in a table control are always single lines.

Screen Table Processing You process a screen table by looping through it as you would through the rows of an internal table. Note : Atleast.ENDLOOP dynpro statement in the screen's flow logic. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . What the LOOP Statement Does? The LOOP statement is responsible for getting screen table values passed back and forth between the screen and the ABAP/4 program program...ENDLOOP must be there in PAI. To do this. you must code a LOOP statement in both the PBO and PAI events for every table in your screen.. an empty LOOP. As a result. you place a LOOP..

g . changing of input values Error handling St loops Step l Table Control Field help and value help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Screen Painter . DIALOG PROGRAMMING S Screen (b (basics) i ) Screen logic. Menu Painter Input checks.7.

Endloop. Endloop.Syntax for table Controls At PBO. At PAI. Module <mod_name>. controls <name> type tableview using screen <no>. Loop at <itab>. Declaration for table control. Loop at <itab> with control <name> cursor <name>-top_line. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Endloop. Module <mod_name>. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . L Loop at t <itab>. Loop at <itab> cursor <var>. it b Endloop. At PAI.Syntax for step loops At PBO.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Once the new transaction starts. use the LEAVE TO TRANSACTION statement: Syntax LEAVE TO TRANSACTION '<TRAN>'.Leaving to transaction To branch to another transaction and end the current one. Any data the user did not save in the previous transaction is lost. the user can not return to the previous transaction by pressing the Exit icon.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the ABAP/4 statement: Syntax y CALL TRANSACTION '<TRAN>'.Calling a transaction If you want the user to be able to return to the initial transaction after processing an interim transaction.

Suppressing the transactions initial screen When you call a transaction. while suppressing the first screen. The initial screen is processed but not displayed. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . transaction you can tell the system to suppress the transaction's initial screen and proceed directly to the next screen in the sequence: syntax: CALL TRANSACTION '<TRAN>' AND SKIP FIRST SCREEN. your program must pass in data values when calling the transaction. for all required fields in the initial screen.

Each parameter is identified by a three-character code. by setting field attributes in the Screen Painter by using the SET PARAMETER or GET PARAMETER statements Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . GET PARAMETER ID 'RID' FIELD <FIELD NAME1>. There are two ways to use SPA/GPA parameters: • • Syntax SET PARAMETER ID 'RID' FIELD <FIELD NAME1>.Passing data with SPA / GPA Parameters You can pass data to a called program using SPA/GPA parameters. SPA/GPA parameters are field values saved globally in memory.

Ways to produce list from within transaction ·SUBMIT Use the SUBMIT statement to start a separate report directly from the transaction. SUBMIT <prog>. prog . SUBMIT <prog> AND RETURN. LEAVE LIST-PROCESSIN LIST PROCESSIN Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SUBMIT <prog> VIA SELECTION-SCREEN SUBMIT <prog> WITH <prog sele var> = <fld> SUBMIT <prog> WITH <para> IN <seltab> Produce the list from your module pool using LEAVE TO LIST-PROCESSING LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN <screen number>.

On return from the list display. PAI processing p g for the current screen is not executed. · To display the list output instead of the current screen: Code the LEAVE TO LIST-PROCESSING logic in the PBO. This tells the system to display the list without displaying p y g the current screen.How List-Mode in Dialog-Mode Works You can code list-mode logic in PBO or PAI for the current screen. the system repeats processing for the current screen starting with the beginning of PBO screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . · To display the list output in addition to the current screen: Place the LEAVE TO LIST-PROCESSING logic at the end of PAI. and follow it with LEAVE SCREEN. PBO.

the system re-starts processing at the beginning of PBO. On return. When the user presses one of these. The user requests BACK or CANCEL from the basic-list level of the report.Leaving the List Your program runs in list-mode until one of the following occurs The system reaches a LEAVE LIST LIST-PROCESSING PROCESSING statement in your code. exits the list using the BACK or CANCEL icons. The LEAVE LIST-PROCESSING statement returns control to the dialog screen. you do not need to program an explicit LEAVE LIST-PROCESSING. these the system returns to the screen containing the LEAVE TO LIST-PROCESSING and re-starts PBO processing screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If the user.

Returning to different screen When returning to dialog-mode. your program can also re-route the user to a screen different from the one that started the list. To do this. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . use the keywords AND RETURN TO SCREEN when you first branch to list-mode: syntax t LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.

PROCESS ON VALUE-REQUEST.and Value-Help You can program help texts and possible values lists using the PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV) events. Syntax PROCESS ON HELP-REQUEST. FIELD <field> MODULE <module>. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . FIELD <field> MODULE <module> .Programming Field.

and Value-Help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Programming Field.

Customizing F4 value request • • • • Matchcode help Check tables Help views Domain values Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Customizing F4 value request Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Customizing F1 Help The ABAP/4 development environment provides a number of ways of designing a context-sensitive F1 help: • • Data element documentation Using the PROCESS ON HELP-REQUEST event.

Database INSERT UPDATE DELETE MODIFY DB Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .INSERT I Insert t a new record d into i t a database d t b Syntax: INSERT <table>[<workarea>] Eg: MOVE ‘BC’ BC TO SPLAN SPLAN-AREA. INSERT SPLAN. MOVE ‘BC’ TO REC-AREA. INSERT INTO SPLAN VALUES REC. MOVE ‘BC200’ BC200 TO REC REC-COURSE COURSE MOVE …. AREA. MOVE ‘BC200’ TO SPLAN-COURSE MOVE ….

UPDATE <TABLE> SET <F1> = <V1>…<FN> = < VN> WHERE <f1> = <x1> . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . UPDATE SPLAN SET TID1 = ‘007’ TID2 = ‘003’ WHERE AREA = ‘BC’ BC AND COURSE = ‘BC200’ BC200 AND WEEK = ‘23’.UPDATE UPDATE C U Changes a ges a record eco d in t the e database syntax: UPDATE <table>. UPDATE SPLAN. SPLAN-TID1 = ‘007’. Eg: SELECT SINGLE * FROM SPLAN WHERE AREA = ‘BC’ AND COURSE = ‘BC200’ AND WEEK = ‘23’.

DELETE FROM <table> table WHERE <F1> F1 = <V1>. MOVE ‘BC200’ TO SPLAN-COURSE MOVE …. Syntax: DELETE <table> .. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DELETE SPLAN. V1 .DELETE Delete record from the database database.. Eg: MOVE ‘BC’ TO SPLAN-AREA. DELETE FROM SPLAN WHERE AREA = ‘BC’ AND COURSE = ‘BC200’ AND WEEK = ‘23’.

UPDATE <table< FROM <itab>. Include structure splan.. INSERT SPLAN FROM ITAB. ITAB DELETE SPLAN FROM ITAB. …. g Eg: Data: begin of itab occurs 10. Data: end of itab.ARRAY OPERATIONS ARRAY operations improve the performance of the database updates Syntax: INSERT <table< FROM <itab>. UPDATE SPLAN FROM ITAB. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . <itab> DELETE <table< FROM <itab>. itab Move ‘BC’ to itab-area. Append itab.

.. .COMMIT WORK – ROLLBACK WORK . ELSE. MODULE UPDATE INPUT. . . ABAP/4 Dialog1 Dialog2 Dialog3 UPDATE1 UPDATE2 DB-COMMIT DB-COMMIT (Implicit) (Explicit) SAP-COMMIT Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . . MESSAGE E . . UPDATE <table2>. ENDMODULE. . ROLLBACK WORK. . . COMMIT WORK. UPDATE <table1>.. IF SY-SUBRC EQ 0. . . ENDIF. .

optimizing response times for users. ff ti l programmers are mainly i l concerned with: • • maintaining database correctness.Programming database updates To program database T d t b updates d t effectively. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

• • Database LUW SAP LUW LUW Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .There Work) There are two types of LUW LUW’s s. • If the transaction encounters an error. all changes should be carried out. no changes should be carried out. not t even partially. an "all-or-nothing" transaction is called an (Logical Unit of Work).LUW • If the transaction runs successfully. ti ll In the database world.

rather than at every screen change. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can avoid your updates being committed at each screen change.Update Bundling With Update Bundling you can execute updates at the end of the update transaction. You can lock the objects to be updated across multiple screens.

•PERFORM ON COMMIT •CALL FUNCTION IN UPDATE TASK •CALL FUNCTION IN BACKGROUND TASK These statements specify that a given FORM routine or function module be executed not immediately. you package your updates in special routines that run only when your program issues a ABAP/4 commit/rollback. To do this you use: this.Bundling Techniques With update bundling. but rather at the next ABAP/4 commit/rollback. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Updating in the dialog task The PERFORM ON COMMIT statement calls a form routine in the dialog task. but delays its execution until the system encounters the next COMMIT WORK statement. t t t Updating in the update task: The CALL FUNCTION IN UPDATE TASK statement logs a function module for execution in the update task. The subsequent COMMIT WORK statement triggers actual execution.

t but b t all ll requests for the same destination run in a common update transaction.Updating in a background task The CALL FUNCTION IN BACKGROUND TASK statement logs a function module to run in a background task. Normally. Background-task B k dt kf functions ti are processed d as low-priority l i it requests. this statement is used to execute functions on remote hosts (by specifying an additional DESTINATION parameter). Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE In this Exercise we see how to write a simple Transaction First create a program with naming convention SAPMZ<initials>. Eg. SAPMZ_EMPDET Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE N Now create t a screen using i Transaction T ti SE80 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE W can also We l create t a screen using i Transaction T ti SE51 Click the create button Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Enter a meaningful description for the screen and select the screen type Click on the save button to save the entries Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Double click on the Include MZ<initial>TOP Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE Select the program name and click the change icon icon.

EXAMPLE Declare the Global variables in this include section Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Click on the LAYOUT BUTTON on the application toolbar to design the screen.EXAMPLE Cont. Click the BACK icon to come out. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Of the previous screen Click on the SAVE icon to save the code.

EXAMPLE C c o Click on t the e DICT/PROGRAM C / OG fields e ds button butto o on the t e app application cat o toolbar too ba to include the fields on the screen from the dictionary tables or internal tables or other fields declared in the program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Enter the Internal or Table or field name on the Table/Field name and click on the Get from program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Entry Entry. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE Using the corresponding icon (Text (Text. Check and so on) on the object bar and drag and place the object on he screen. Click on the SAVE icon to save the code .

EXAMPLE Double Click on the table Control object to view the attributes or properties Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

PAI POV and POH for this screen flow logic Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . PAI.EXAMPLE Now write the code for the PBO PBO.

EXAMPLE In t the e PBO O write te t the e relevant e e a t code for o PF-STATUS S US a and d TITLE BAR Click on the SAVE icon to save the code . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE This is a GUI status containing buttons and menus for the screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . All ABAP programs will have a default GUI status.

di l Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE Th title The titl Bar B of f the th window i d that th t you will ill use to t display.

Click on the SAVE icon to save the code . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE In the I th PAI of f the th flow fl logic l i we can use the th conditional diti l statement t t t AT EXIT-COMMAND as below.

odu e Click on the SAVE icon to save the code . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE Code for o the t e Field e d check c ec in t the e PAI module.

EXAMPLE In t this s module odu e we e can ca even e e write te t the e code to Retrieve et e e t the e Data. Branching to Different Screen and also use function codes . ata. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

you can dynamically change the Attributes of the object using SCREEN Attributes in the screen 200.EXAMPLE Depending on the user requirements in the previous screen 100 100. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE In the I th Process P on value l request t (POV) of f the th flow fl logic l i we can use the th search help for a particular field Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE You Can Use the F4 to see the search help Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE In t the e Process ocess o on value a ue Help ep( (POH) O )o of t the e flow o logic og c we e ca can use t the e additional documentation descriptive text for the data element in the ABAP/4 Dict. extra Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . In the screen painter you place the cursor in the field string of a screen on the field to be documented and select the menu goto > documentation > data el.

EXAMPLE Now you will N ill get t a popup with ith th the data d t element l t and d the th number b of f the th current screen as an identifier for the additional text. In addition to the help contents in the ABAP/4 Dict you can enter your own Description Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Here you enter your own description and SAVE Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE N Now while hil R Running i t transaction ti place l th the cursor on the th field fi ld and d press F1 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Layout slide for screen 200 200. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Now o Create C eate a t transaction a sact o code for o you your d dialog a og p program og a us using g Txn S SE93 93 Click on the enter button Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

EXAMPLE Enter the information in the fields and SAVE Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .EXAMPLE In Screen I S 100 we give i the th required i d input(Employee i t(E l No) N ) and d retrieve ti the th Data from the Data Dictionary and display the details on to the screen 200.

EXAMPLE The details of the employee in screen 200. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control In t this se example a p e we e will c create eate a sc screen ee a and d use t the e tab table e co control t o object to display data. Use SE51 to Create a screen (In our case 300) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control W will We ill d design i th the screen with ith a t text t object bj t and d th the t table bl control t l object bj t Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control Enter te t the e Internal te a o or Table ab e o or field e d name a eo on t the e Table/Field ab e/ e d name a ea and dc click c on the Get from program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control Us g the Using t e attribute att bute butto button o of t the e tab table e co control t o you ca can put vertical e t ca and a d horizontal separators an resizing if required and name the table control Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

In the PAI of the screen 100 we are branching it to our table control screen i. 300.e.Example : Table Control Now we have to write code for the data retrieval and populate the internal table. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control We write code to retrieve Data Data. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control Now using the PBO of the screen 300 flow logic we populate the table control Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example : Table Control In our example when the user clicks the LIST Button in the initial screen screen. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the complete list of employees will be displayed in the second screen.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Example : Table Control Here we get the list of all employees employees.

Transactions Su Summary ay The slides explained the structure of transaction. screen and menu painter and all the main features associated with dialog programming. programming Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

DATABASE UPDATES Database updates with open SQL LUW processing Update Bundling Techniques Programming Bundling Updates Unbundled Updates Local Updates Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .8.

Database INSERT UPDATE DELETE MODIFY DB Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

MOVE ‘BC200’ BC200 TO REC REC-COURSE COURSE MOVE ….INSERT I Insert t a new record d into i t a database d t b Syntax: INSERT <table>[<workarea>] Eg: MOVE ‘BC’ BC TO SPLAN SPLAN-AREA. MOVE ‘BC’ TO REC-AREA. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . AREA. INSERT INTO SPLAN VALUES REC. INSERT SPLAN. MOVE ‘BC200’ TO SPLAN-COURSE MOVE ….

UPDATE SPLAN SET TID1 = ‘007’ TID2 = ‘003’ WHERE AREA = ‘BC’ BC AND COURSE = ‘BC200’ BC200 AND WEEK = ‘23’.UPDATE UPDATE C U Changes a ges a record eco d in t the e database syntax: UPDATE <table>. UPDATE <TABLE> SET <F1> = <V1>…<FN> = < VN> WHERE <f1> = <x1> . SPLAN-TID1 = ‘007’. UPDATE SPLAN. Eg: SELECT SINGLE * FROM SPLAN WHERE AREA = ‘BC’ AND COURSE = ‘BC200’ AND WEEK = ‘23’. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

DELETE FROM <table> table WHERE <F1> F1 = <V1>.DELETE Delete record from the database database. DELETE FROM SPLAN WHERE AREA = ‘BC’ AND COURSE = ‘BC200’ AND WEEK = ‘23’... Syntax: DELETE <table> . MOVE ‘BC200’ TO SPLAN-COURSE MOVE …. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . DELETE SPLAN. V1 . Eg: MOVE ‘BC’ TO SPLAN-AREA.

<itab> DELETE <table< FROM <itab>. itab Move ‘BC’ to itab-area. Include structure splan. Data: end of itab. UPDATE <table< FROM <itab>. Append itab. …. g Eg: Data: begin of itab occurs 10. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ARRAY OPERATIONS ARRAY operations improve the performance of the database updates Syntax: INSERT <table< FROM <itab>. INSERT SPLAN FROM ITAB. UPDATE SPLAN FROM ITAB.. ITAB DELETE SPLAN FROM ITAB.

. . ROLLBACK WORK. COMMIT WORK. ELSE. ABAP/4 Dialog1 Dialog2 Dialog3 UPDATE1 UPDATE2 DB-COMMIT DB-COMMIT (Implicit) (Explicit) SAP-COMMIT Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . . . .. ENDMODULE. . . . IF SY-SUBRC EQ 0.. MODULE UPDATE INPUT. MESSAGE E . . ENDIF.COMMIT WORK – ROLLBACK WORK . . UPDATE <table2>. . UPDATE <table1>. .

8. DATABASE UPDATES Database updates with open SQL LUW processing Update Bundling Techniques Programming Bundling Updates Unbundled Updates Local Updates Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

There Work) There are two types of LUW LUW’s s. no changes should be carried out. • If the transaction encounters an error. all changes should be carried out. an "all-or-nothing" transaction is called an (Logical Unit of Work). not t even partially. • • Database LUW SAP LUW LUW Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ti ll In the database world.LUW • If the transaction runs successfully.

( ( For a quick introduction before programming updates. see: Transaction in the SAP system.Database Update Techniques PROGRAMMING DATABASE UPDATES To program database updates effectively. programmers are mainly concerned with: Maintaining database Correctness. Correctness Optimizing response times for users. Introduction to SAP Locking ( ( ( Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Introduction to Update Bundling.

an "all-or-nothing" transaction is called an LUW (Logical Unit of Work). all changes should be carried out. . not even p partially.Database Update Techniques TRANSACTIONS IN THE SAP SYSTEM ( If the transaction runs successfully. no changes should be carried out.There are three types of LUW’s. If the transaction encounters an error. y ( In the database world. ( ( ( Database LUW SAP LUW ABAP/4 Transaction Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques DATABASE LUW The SAP System triggers database commit operations automatically at every screen change. Database LUW lasts (at longest) from one screen change to the next.

an update transaction usually spans several database LUWs and is closed at the ABAP/4 level with a COMMIT WORK command.Database Update Techniques SAP LUW As a logical unit. In general. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . or not at all. update transactions should be executed entirely.

event blocks. ( With one or more SAP LUWs. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Transactions in this form consist entirely of processing blocks (dialog modules. it opens a new SAP LUW.Database Update Techniques ABAP/4 TRANSACTION An ABAP/4 or SAP transaction is an application program that you start using a transaction code. Whenever the system reaches a COMMIT WORK or ROLLBACK WORK statement that is not at the end of the last dialog step of the SAP transaction. and subroutines). You should be careful to ensure that external subroutines or function modules d not do t lead l d to t COMMIT WORK or ROLLBACK WORK statements t t t accidentally being executed. function module calls. It may contain one or more SAP LUWs.

SUBMIT (start an executable program). the system carries on processing the first SAP LUW. LUW When you call a program. When the new LUW is complete. This means that a COMMIT WORK or ROLLBACK WORK statement only y applies pp to the SAP LUW of the called program. and CALL FUNCTION. DESTINATION (call a function module using RFC) open a new SAP LUW. it always opens its own SAP LUW. it does not end the LUW of the SAP transaction that called it.Database Update Techniques ( By inserting an SAP LUW The ABAP statements CALL TRANSACTION (start a new transaction). However. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ...

the calling transaction carries on with its own processing as soon as the function module has started...Database Update Techniques ( By running two SAP LUWs in parallel The CALL FUNCTION. The function call is asynchronous. STARTING NEW TASK statement calls a function module asynchronously in a new session. Unlike normal function module calls. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The called function module can now call its own screens and interact with the user. and does not wait for it to finish processing.

8. DATABASE UPDATES Database updates with open SQL LUW processing Update Bundling Techniques Programming Bundling Updates Unbundled Updates Local Updates Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

rather than at every screen change.Database Update Techniques INTRODUCTION TO UPDATE BUNDLING With Update Bundling you can execute updates at the end of the update transaction. ( Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ABAP/4 provides commands for bundling updates in special update routines. You can lock the objects j to be updated p across multiple p screens. ( You can avoid your updates being committed at each screen change.

To do this. but rather at the next ABAP/4 commit /rollback. An ABAP/4 commit is an ABAP/4 statement that triggers a database commit. you package your updates in special routines that run only when your program issues a ABAP/4 commit/rollback.Database Update Techniques SUMMARY OF BUNDLING TECHNIQUES With update bundling.The ABAP/4 statements for performing these commits and roll backs are: ( ( COMMIT WORK ROLL BACK Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . but also p perform other functions. . you use: ( ( ( PERFORM ON COMMIT CALL FUNCTION IN UPDATE TASK CALL FUNCTION IN BACKGROUND TASK These statements specify that a given FORM routine or function module be executed not immediately.

Using PERFORM ON COMMIT: You can bundle updates for dialog-task processing and have them execute in the last LUW for the transaction. Call the transaction with PERFROM <form> ON COMMIT> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques BUNDLED UPDATING IN THE DIALOG TASK The PERFORM ON COMMIT statement calls a form routine in the dialog task. Place all update statements (insert. but delays its execution until the system encounters the next CO COMMIT WORK O statement. To do this: 1. update.Modify. Delete) in a FORM routine. 2.

ASSIGNING RUN PRIORITIES TO FORM ROUTINES: You can assign a run priority to each form routine by adding the level parameter to the PREFORM ON COMMIT statement. PERFORM update_table1 ON COMMIT LEVEL 2. For Ex. ….Database Update Techniques The effect of using PERFORM ON COMMIT. is that the system delays execution of the form routine until it encounters the COMMIT WORK statement. PERFORM update_table3 ON COMMIT LEVEL 1. You should position the commit WORK at the end of the statement or wherever user can select the save condition. …. PERFORM update_table2 ON COMMIT LEVEL 3. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Instead of simple perform.

Update table1 Third : Update_table2. the FORM routines will run in this order. Second : Update_table1. First : Update_table3. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques When this reaches COMMIT WORK statement.

Database Update Techniques BUNDLED UPDATING IN THE UPDATE TASK The CALL FUNCTION IN UPDATE TASK statement logs a function module for execution in the update task. You can perform f updates in the dialog task as well as in the update task. Dialog task updates are synchronous updates. Update task updates are asynchronous. The subsequent COMMIT WORK statement triggers actual execution. (An exception is You can trigger an update function with COMMIT WORK AND WAIT: this is synchronous.) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Database Update Techniques The following diagram illustrates the Synchronous Update in Update Task Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

To be able to call a function module in an update work process. you first need to start the Function Builder. imm.Database Update Techniques CREATING UPDATE FUNCTION MODULES To create a function module.ABAP Workbench. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you must flag it in the Function Builder. Function Builder. These functions can be restarted by the update task in case of errors. no restart Set this option for high priority ("V1") functions that run in a shared (SAP LUW). start. These functions may not be restarted by the update task. • Update w. Choose Tools . module set the Process Type attribute to one of the following values: • Update with immediate start Set this option for high priority ("V1") functions that run in a shared (SAP LUW). Builder When you create the function module.

update- You must specify input parameters and tables with reference fields or y reference structures defined in the ABAP Dictionary. DEFINING THE INTERFACE Function modules that run in the update task have a limited interface: • • Result parameters or exceptions are not allowed since task function modules cannot report on their results.Administration. These functions can be restarted by the update task in case of errors. To display the attributes screen in the Function Builder.Database Update Techniques • Update with delayed start Set S t this thi option ti f low for l priority i it ("V2") functions f ti th t run in that i their th i own update transactions. choose Goto . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

( COMMIT WORK: Your program does not wait for the requested functions to finish processing. Control returns to your program after function module run successfully. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . which specifies asynchronous processing.Database Update Techniques CALLING UPDATE TASK FUNCTION MODULES: Function modules that run in update task can run synchronously or asynchronously. Which specifies synchronous processing. ( COMMIT WORK AND WAIT Your program will wait for the requested functions to finish processing.

Here. with value 1 in PAR... CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A.Database Update Techniques CALLING UPDATE FUNCTIONS DIRECTLY To call a function module directly. use CALL FUNCTION IN UPDATE TASK directly in your code code. a = 2. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .. the function module UPD_FM is performed twice in the update task: the first time.. 3 COMMIT WORK. CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A A. the second time with value 2 in PAR... For EX: a = 1. a = 3. CALL FUNCTION 'FUNCTMOD' IN UPDATE TASK EXPORTING.

Thus the request to run the function in the update task is also logged during commit processing. As a result. the parameter values logged with the request are those current at the time of the commit.Database Update Techniques ADDING UPDATE TASK CALLS TO A SUBROUTINE You can also put the CALL FUNCTION IN UPDATE TASK into a subroutine and call the subroutine with: PERFORM SUBROUT ON COMMIT. If you choose this method. the subroutine is executed at the commit. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

In this example. a=3 3. This is because a given function module. The update task executes the function module only once. CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A. a = 2. despite the two PERFORM ON COMMIT statements. PERFORM F ON COMMIT. PERFORM F ON COMMIT. ENDFORM. can never be executed more than once in the update task. logged with the same parameter values. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques a = 1. COMMIT WORK. the function module UPD_FM is carried out with the value 3 in PAR. FORM f f.

the LUW of the calling program is restored together with the old update key. If the called program does not contain its own COMMIT WORK. F2 and F3 are update function modules: Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . example F1.Database Update Techniques TRANSACTION THAT CALL UPDATE TASK FUNCTIONS If your program calls another program that itself calls an update function module you should be aware of the following: module. called In the following example. a new SAP LUW begins. and a new update d t key k is i generated. the database update requests are not processed. F1 F2. t d This Thi key k is i used d to t identify id tif all ll update-task d t t k operations requested during the called program. When the new program is called. and the update function modules are not called. When returning from the program.

However. task Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . because the COMMIT WORK for the main program triggers their execution. F1 and F3 are executed in the update task. the function F2 is never executed by the update task. since transaction ZABC contains no COMMIT WORK statement.Database Update Techniques Here.

For Example if you are maintaining a replicated data in two databases. databases While making the primary updates in the update task of the local system.Database Update Techniques BUNDLED UPDATING IN A BACKGROUND TASK The CALL FUNCTION IN BACKGROUND TASK statement logs a function module to run in a background task. this statement is used to execute functions on remote hosts (by specifying an additional DESTINATION parameter). Normally. use the statement: CALL Function <fctmode> IN BACKGROUNG TASK DESTINATION <dest> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . y To execute updates on a remote host. you would also execute the same updates on a remote database. This system y uses RFC to send request q to the remote system.

On encountering this statement.In this case . the function runs in a separate work process. but on the local host. You can also use this statement without the DESTINATION parameter.Database Update Techniques This statement requests execution of an update function in an external system. the system writes your request to the log table and then executes it at the next commit statement. The destination specifies the remote system. host All remote host background task functions triggered with same COMMIT WORK run together g in a common LUW. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

COMMIT WORK processing occurs in the following order: All dialog-task di l t k FORM routines ti l logged d with ith PERFORM ON COMMIT are executed. All high-priority (V1) update-task function modules are executed. All background-task function modules are triggered. How are they handled? In general. g. If you used COMMIT WORK AND WAIT to trigger gg commit p processing. control returns to the dialog-task program. Satyam SAP PMG SAP PMG (V2) are Delivering Solution Excellence and Innovation . All low-priority update-task function modules triggered.Database Update Techniques ERROR HANDLING FOR BUNDLED UPDATES Runtime errors can occur during execution of bundled updates. The end of V1-update processing marks the end of the .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques Runtime errors can occur either in the system itself. or because your program issues an termination message (MESSAGE type ‘A’). − No further update-task or background-task functions will be started. − No other FORM routines will be started. − An error message appears on the screen. Also. The y handles errors according g to where they y occur: system In a FORM routine (called with PERFORM ON COMMIT) − Updates already executed for the current update transaction are rolled back. the ROLLBACK WORK statement automatically signals a runtime error.

if your system is set up to t send d them th Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . − All further update-task requests (V1 or V2) are thrown away.Database Update Techniques In a V1 update-task function module (requested IN UPDATE TASK) − Updates already executed for V1 functions are rolled back. − An error message appears on the screen. − All background-task requests are thrown away. − Updates already executed for FORM routines called with PERFORM ON COMMIT are not rolled back.

− All background-task requests still to be executed are carried out. − All update-task requests (V2) still to be executed are carried out.Database Update Techniques In a V2 update-task function module (requested IN UPDATE TASK) − Updates already executed for the current V2 function are rolled back back. if your system is set up to send them Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . − An error message appears on the screen. − No updates previously executed for FORM routines (called with ON COMMIT) are rolled back back. − No updates for previously executed V1 or V2 function are rolled back.

− No other previously-executed updates are not rolled back. it can decide whether to resubmit the requests at a later time. − All further background-task requests for the same DESTINATION are thrown away. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques In a background-task function module (requested IN BACKGROUND TASK DESTINATION) − Background-task B k d t k updates d t already l d executed t d for f the th current t DESTINATION are not rolled back. If your program detects that an error in remote processing has occurred. − No error message appears on the screen screen.

Modify. This inline update is only suitable for the single screen transactions. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . With Multiple screen transactions.DELETE) directly in your code These are inline updates without using any bundling techniques. if any error occurs in later screens. code.Database Update Techniques UNBUNDLED UPDATES You can make database updates in ABAP/4 without these bundling Here You can place update statements (insert. techniques Even if you code No COMMIT WORK statement the database commit at the next screen change will commit the updates to the database. you can't roll back the data committed in earlier screens.

8. DATABASE UPDATES Database updates with open SQL LUW processing Update Bundling Techniques Programming Bundling Updates Unbundled Updates Local Updates Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Modify. code. This inline update is only suitable for the single screen transactions. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Database Update Techniques UNBUNDLED UPDATES You can make database updates in ABAP/4 without these bundling Here You can place update statements (insert. if any error occurs in later screens. With Multiple screen transactions.DELETE) directly in your code These are inline updates without using any bundling techniques. you can't roll back the data committed in earlier screens. techniques Even if you code No COMMIT WORK statement the database commit at the next screen change will commit the updates to the database.

PERFORM ON COMMIT may make more efficient use of data resources. ( ( Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . since all accesses are performed at one time.Database Update Techniques Advantages and Disadvantages: Inline updating may feel simpler and more natural.

8. DATABASE UPDATES Database updates with open SQL LUW processing Update Bundling Techniques Programming Bundling Updates Unbundled Updates Local Updates Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

LOCKING IN THE SAP SYSTEM Please refer the Locking concepts in DATA DICTIONARY. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . background You can check the task from your code by querying the SY-BATCH system variable. SET UPDATE TASK LOCAL. TASK … CALL FUNCTION UPDATE_TABLE2 IN UPDATE TASK. … CALL FUNCTION UPDATE_TABLE1 UPDATE TABLE1 IN UPDATE TASK.Database Update Techniques LOCAL UPDATES In ABAP/4 You can tell the system to perform updates locally. use the statement SET UPDATE TASK LOCAL whenever your program runs in background. To do this. … COMMIT WORK. ENDIF. IF SY-BATCH NE SPACE. rather than in the update task.

CALL FUNCTION IN UPDATE TASK and CALL FUNCTION IN BACKGROUND TASK. ABAP/4 provides id commands d for f bundling b dli updates d in i special i l routines i like PERFORM ON COMMIT. The ABAP/4 bundling techniques let you distribute your updates to different work processes. The operation must be carried out in “all or nothing fashion . Execution of these routine is delayed until your program issues an explicit “SAP COMMIT” In a local update.Database Update Techniques SUMMARY ( Transaction is an operation that lets the user make changes to the database. ( ( ( ( ( Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . We have seen the bundling techniques in different updates like dialog task. The different transactions in SAP are Database LUW. update task and Background task. the update program is run by the same work process that processed the request. fashion”. SAP LUW and ABAP Transactions.

ENHANCEMENTS & MODIFICATIONS Enhancements to SAP Objects E h Enhancements t via i Menu M exits it / Screen S exits it / FM exits it Business Add-Ins Modifications ( Registering the Modifications in SSCR. Modification Adjustment.9. Rules for Modifications ) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Enhancements ADAPTABILITY OF SAP R/3 Customizing Modifying Project Dependent Menu Exit Function Exit Screen Exit Enhancements Customer Development Project Independent Field Exit Keyword Exit Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

the customer version and the new SAP version must be reconciled manually. Hence use these only when customer requirements are not met by customizing or by user exits exits. Customizing is required during implementation of the system. z Custom development : Creation of custom objects within the customer name range. z Enhancement concept : Changing of SAP Repository objects by the customer without modification. z Modification : Alteration of SAP Repository objects in the form of custom changes when SAP changes occur occur. g Modification and Customer development involve high maintenance and costs. Satyam SAP PMG SAP PMG z Customizing Delivering Solution Excellence and Innovation .Enhancements There are four different ways of adapting the SAP system to fit your needs : : Configuration of system parameters via a special user interface. the possible changes are preplanned and organized.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Enhancements can be achieved by Exits. They do not affect software updates.Enhancements Advantages of Enhancements z There Th are two t main i reasons why h you should h ld use exits it rather th than th modifying SAP software yourself. Add-ons attached to exits have the advantage that: z z They do not affect standard SAP source code.

Rules for Modifications ) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .9. Modification Adjustment. ENHANCEMENTS & MODIFICATIONS Enhancements to SAP Objects E h Enhancements t via i Menu M exits it / Screen S exits it / FM exits it Business Add-Ins Modifications ( Registering the Modifications in SSCR.

Enhancements There are three types of exits: z Menu Exits z Screen Exits z Function module Exits Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . From here. choose utilities --> SAP enhancements to call a selection screen that lets you look for the exits available in the standard applications. choose the Execute function without specifying any selection criteria.Enhancements Locating Applications that Have Exits z SAP organizes its exits in packages are called SAP enhancements. To list all the enhancements in the entire system. Each SAP enhancement can contain many individual exits. Choose utilities -->Enhancements --> Project Management from the ABAP Workbench menu.

z Expand the Exit Techniques sub-tree. Choose either Enhancements or Projects. hierarchy For a particular application area. for example exits associated with Material Management. proceed as follows: z Place the cursor on the material management branch of the application tree and choose sel / dsel --> repository infosys. z Expand the Environment sub-tree sub tree in the repository information system.Enhancements Searching in the Application Hierarchy Application Hierarchy can be accessed by choosing ABAP Workbench --> > Overview --> > Application hierarchy. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z Choose Execute.

Enhancements MENU EXITS z Menu exits allow you to attach your own processes to action menu items. the SAP applications programmer reserves certain menu entries in the GUI interface. For this. z Once you activate the menu exits. they become visible in the application. z The Menu exit entries have function codes that begin with + (Plus sign). When the menu item is selected. either the functionality provided by the SAP applications programmer or your own functionality implemented in the program exit is processed. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

z Specify a Project name in the Enhancement Text box. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . For example let us create an enhancement project say zuser.Enhancements Step-by-step process of creating Menu Exits z Evoke the Transaction code CMOD or alternatively you can use the path tools --> ABAP workbench --> utilities --> Enhancements --> Project Management. z Click on the create icon on the screen.

Enhancements Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z In the next screen enter the description of the project. z Save the changes made so far in the development class.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The system lists all customer exits contained in the enhancements included in your project.Enhancements Select Enhancement components. z Place the cursor on the menu exit you want to add your own function to.

The system displays technical information about the menu entry. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Choose Edit component. It also displays two input fields where you can specify a language and the text you want your menu item to have.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z Choose Save text.Enhancements Enter the name of your menu function (such as test menu) in the field New text. Your special menu function will not appear in the pulldown menu of the corresponding standard transaction until you activate your enhancement project.

Enhancements Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Enhancements z After activation the menu(rounded) will be visible on the standard menu for the transaction S001. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Screen Exits z Screen exits add fields to screens in R/3 applications.

proceed as follows: z Select Enhancement components and choose Change. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Step-by-step process of creating Screen Exits From the main screen of the Project management transaction.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z Choose Edit component.

Enhancements z Choose the screen exit e it and double do ble click on it Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Enhancements z Create your subscreen using the Screen Painter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Enhancements z Design your screen to be added to the standard screen and activate the particular screen and return back to the flow logic . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Choose the PAI and PBO to write down the logic.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z Generate your screen and choose Back (the green arrow) to return to the Project management transaction.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z Go to the transaction ME22 to view the customer defined screen exit.

Enhancements z Enter the purchase order number and press Enter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Go to the menu header --> Details.

ee ( ou ded) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z Purchase u c ase number u be is s visible s b e on o the t e standard sta da d sc screen(rounded).

text elements. The programmer also creates the related function modules with short text. to implement additional logic in an application function. z You code the function modules. as customer. The SAP applications programmer defines where in the application function the function module exits are placed and which data is to be transferred.Enhancements Function module Exits z Function module exits allow you. and if needed the screens. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the program exits have no effect effect. z After you activate the enhancement project that contains the function module as component the ABAP/4 code will be processed. Before that. interface. and documentation and describes the intended functionality of the function module exit in the SAP documentation. and your own Includes for the function group.

From the main screen of the Project management transaction. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements Step-by-step process of creating Functional module Exits. or transaction CMOD proceed as follows: z Select Enhancement components and choose Change.

Enhancements Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z Choose Edit component.Enhancements z Place the cursor on the function module exit y you want to use.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Enhancements z Call the function module’s include p program g by y double-clicking g on it.

Enhancements z Confirm that y you want to create the include p program g . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Enhancements z Enter y your function’s source code in the editor. it Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z Save Sa e your o r incl include de program and activate acti ate it.

ENHANCEMENTS & MODIFICATIONS Enhancements to SAP Objects E h Enhancements t via i Menu M exits it / Screen S exits it / FM exits it Business Add-Ins Modifications ( Registering the Modifications in SSCR. Modification Adjustment.9. Rules for Modifications ) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .9.

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .9.

ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .9.

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

9. ENHANCEMENTS & MODIFICATIONS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Modification Adjustment. ENHANCEMENTS & MODIFICATIONS Enhancements to SAP Objects E h Enhancements t via i Menu M exits it / Screen S exits it / FM exits it Business Add-Ins Modifications ( Registering the Modifications in SSCR. Rules for Modifications ) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .9.

database indices. buffer settings. customer objects. regardless of which registered user is making the change. patches and objects whose changes are based on automatic generation If the same user changes the object again at a later time generation. Once an object is registered. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . bj t Exceptions E ti to t such h registration are matchcodes. time. no new query is made for the registration key. the related key is locally stored and copied automatically for later changes.Modifications Registering the Modification in SSCR z A registered development user registers changes in SAP sources and manual l changes h of f SAP Data D t Dictionary Di ti objects.

This increases the availability of your R/3 system.Modifications How do you benefit from SSCR ( SAP Software Change Registration)? z Quick error resolution and therefore high availability of modified systems All th the changed h d objects bj t are l logged d by b SAP. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SAP Based B d on this thi information. This in turn promises the dependable operation of your R/3 system. system z Dependable Operation The necessity to register will likely prevent unintended modifications. i f ti SAP’ s First Level Customer Service can quickly localize and remove the causes of problems. z Simplification of upgrades Upgrades and release changes become considerably easier because of fewer modifications.

the Workbench Organizer will require a change request. This will remove the object locks of the change request. z Once the development is completed. The object is automatically added to a repair task.Modifications Procedure for a Registered Modification If you change one of the SAP's Repository objects.. you release the change request.. z Change request may be transportable or local. z Immediately after the export a test import will check if all objects can be imported into the target system system. the Programmer releases the task. The WBO will automatically classify the change request depending upon the development p class. Only y transportable p change g request q will be transferred to the transport system after their release. same as if you were creating your own object. The objects and the object locks are transferred from the task to the change request. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . request z Once the project is completed.

z The Th import i t into i t the th target t t system t is i not t automatic. t ti rather th it is i initiated i iti t d by the system administrator of the transport control program tp at the operating system level. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z The result of export and test import are recorded in the transport log of the change request to be verified by the programmer.Modifications z Repository objects are exported to the central transport directory.

z Procedure : Determination of overlap and manual adjustment adjustment. h z The same is true for maintenance upgrades.Modifications Modification Adjustment at Release Change z The modifications must be adjusted to the new standard during release change. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z If you later edit a Repository object again. z When you assign a Repository object to a task. the current object becomes the complete copy and the differences between the old and the new object are stored in the versions database as backward delta delta. This takes place the first time you change an object. If not. the system checks whether the current version agrees with the complete copy in the versions database. a complete copy is created.Modifications old ZABAP Release request Full version Backward Delta old ZABAP Release q request z When you release a change request. a complete version of all objects contained in the changes request is written to the versions database.

Modifications z The versions of a Repository object are the basis for the modification adjustment .information on whether the version was created by SAP or by the customer is also stored Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .To support this adjustments.

Views z ABAP/4 Programs z Reports. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Module Pools.Modifications Objects of the Modification Adjustment z Dictionary objects z Tables. Domains. Function groups z Screens z Menus z Enterprise Data Models The object listed above are managed by version .therefore they are included in the modification adjustment. Matchcodes. Data Elements.

z A Dictionary adjustment after the release change would result in the loss of new custom fields.Modifications Modification Adjustment zThe modification adjustment for Dictionary objects is done during the release change. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z The Dictionary adjustment is done with transaction SPDD. the adjustment of the remaining Repository objects with transaction SPAU. Other Repository objects are adjusted after the release change.

z Never create custom programs within the SAP name range. ) z The workbench Organizer does not allow modifications by DDIC and SAP*. z Avoid modification adjustments by avoiding modifications. You will find the customer name range in the SAP Style Guide. Such repairs and requests will be pointed out to your during the upgrade. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . z Release open repairs and open requests containing repair objects prior to the release change.Modifications Rules for Modifications z Use the following rules when modifying or adjusting: z Try to concentrate the changes in one place ( possibly by using I l d within Includes ithi the th customer t name range).

0 which allow automatic implementation and deimplementation of hot packages and patches Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP offers online correction services in release 3. z To avoid manual patches . z By using program enhancements and appends for SAP tables you can enhance SAP object without having these changes overwritten by SAP during an upgrade.Modifications Avoiding g the Adjustments j z Try to avoid changing SAP objects to prevent the necessity for modification adjustments.

Exits z There are three types of Exits. z Menu Exits z Screen Exits Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Summary Summary z There are four ways of modifying the standard system. z Customizing z Modifications z Enhancement Concepts z Custom Development z The advantages of enhancements are z They do not affect standard SAP source code z They do not affect software updates z Enhancements can be achieved by Exits.

M difi ti z Rules for modifications or adjusting.Summary z Function Module Exits z Registering the Modifications in SAP Software Change Registration (SSCR). z Procedure P d for f a Registered R i t d Modification. z Avoid the adjustment using the program enhancements for SAP tables. tables Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Exercise Exercise Create a menu exit SDW00003 in the area menu ‘TEST’ and add an userdefined report for that menu exit. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

d fi d Now go to transaction SE80 and select the user-defined report say for example : ZTEST56.Exercise Solution Follow the steps mention in the step-by-step process of creating the menu exits. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . For the F th menu exits it SDW00003. SDW00003 T Transaction ti code d +DW3 DW3 is i predefined.

Exercise For the particular report create the transaction as shown in the picture. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

highlight the Program and selection screen radiobutton and press enter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Exercise Mention the transaction code that is predefined by the menu exit and mention the short text.

Exercise Assign report ZTEST55 to the transaction +DW3 and save it. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Click the menu item and it will take you to the output of the report.Exercise Go to the transaction S001 and go the menu TEST. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . there you can find USER DEFINED REPORTS menu item.

Exercise Output for the report ZTEST56 executed through the transaction +DW3. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage St t Structure of f Business B i Obj Objects t Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation T h i l St Technical Steps f for BAPI Creation C ti List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

10. ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros SAP PMG Delivering Solution Excellence and Innovation .10.

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Microsoft Word Document Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

ADDITIONAL TOPICS : BAPI & BUSINESS OBJECTS Introduction to BAPI & BAPI Usage Structure of Business Objects Important Transaction codes BAPI Creation Understanding Business Requirements before BAPI Creation Technical Steps for BAPI Creation List of Macros Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .10.

SAP Smart Forms Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Smart Forms Objectives About SAP Smart Forms D i i Smart Designing S t Forms F Writing g Programs g for Smart Forms Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Smart Forms •Introduction to Smart Forms •Structure of a form •Windows •Architecture •Forms •Nodes •Form Painter •Table Painter •PC Editor •Style Style Builder •Driver Program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

a fax. Transaction to start SAP Smart Forms : SMARTFORMS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . or e-mail as output medium. Besides using g the p printer for standard output p y you can also select the Internet (by using a generated HTML output).6C as the tool for creating and maintaining forms for mass printing in SAP Systems.SAP Smart Forms What is SAP Smart Forms? • • • • SAP Smart Forms is introduced in SAP Basis Release 4. SAP S Smart tF Forms allow ll you t to execute t simple i l modifications difi ti t to th the f form and di in the form logic by using simple graphical tools.

graphics for form design in particular the use of templates which were scanned. pushbuttons.10) • • • • • • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . etc. radio buttons.SAP Smart Forms Advantages g advantages: g SAP Smart Forms offers the following • The adaptation of forms is supported to a large extent by graphic tools for layout and logic. so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore. Colored output of texts Reusing Font and paragraph formats in forms (Smart Styles) Data interface in XML format (XML for Smart Forms.10) Interactive Web forms with input fields. power user forms can also make configurations for your business processes with data from an SAP system. (Basis-Release 6. in short XSF) HTML output of forms (Basis release 6. Displaying table structures (dynamic framing of texts) Output of background graphics.

To further structure and format text and data. use paragraphs with the paragraph and character formats formats. y you can use static or dynamic y tables to display p y data or texts in lines. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . or cells.SAP Smart Forms Structure of a Form A form consists of: •pages •output areas – called “windows” •Addresses •graphics graphics (such as company logo) •data or text contents. Within an output p area. columns.

Print pages are those pages that are eventually printed.SAP Smart Forms Pages of a form On the pages of a form you determine the page layout and the sequence of pages with different structures structures. For each draft page. You can also repeatedly call the same draft page if you want recursive output. you use the Form Builder to define draft pages. Letter Letter. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The page layout includes the page format (for example. Draft pages and print pages: You use a draft p page g to determine the layout y and the contents of one or several print pages. you must specify a next page to make the page sequence clear. example DIN A4 A4. In SAP Smart Forms. DIN A5 landscape) and the position of the windows on a page.

For such a form you need two draft pages. the second page.SAP Smart Forms Pages of a form Many forms contain only two pages of different structure. the page break is triggered either automatically by the main window or built into the form logic. If the text does not entirely fit onto the second print page. another print page with identical structure is started automatically. which is defined as next page of the first one one. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . for example one for the letter and one for listing the invoice items. For draft page 2 2. calls itself as next page page.

there O th are two t different diff t types t of f output t t areas for f texts t t and d data: d t the th main window and the secondary window. even overlapping.SAP Smart Forms Windows On a page. You can choose a different size for the window on each page. so that the same contents are displayed on all these pages. You can position windows anywhere on a page. except for the main window. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can position the same window (determined by the technical name on several pages of a form.

since this would gg an endless loop.SAP Smart Forms Main Window In a main window you display text and data. the system y automatically y terminates after trigger three pages. . i ht A page without main window must not call itself as next page. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . p In such a case. You can define only one window in a form as main window. the system continues displaying the text in the main window of the next page. which can cover several pages (flow text). but b t can differ diff i in h height. It automatically triggers the page break. Th main The i window i d must t have h the th same width idth on each h page. As soon as a main window is completely filled with text and data.

SAP Smart Forms Secondary Windows In a secondary window you display text and data in a predetermined output area. y window are truncated and not Text and data that do not fit into the secondary displayed. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . If you position a secondary window with ith th the same name on several l pages. th the system t di displays l th the contents t t of f this thi secondary window on each page. There is no flow text display with page break.

i ti Thi This i is also l referred to as 'calling a Smart Form for printing'. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the system generates a function module that encapsulates all attributes of the Smart Form. the Smart Form uses the module's interface (which corresponds to the form interface) to transfer any table data previously selected l t d and dt to print i t th the f form according di t to the th f form d description. As soon as the application program calls the function module.SAP Smart Forms Architecture The architecture of SAP Smart Forms separates application data retrieval from the actual definition of the form When you activate the Smart Form.

Before printing. • The function module generates an XSF data stream that transfers. • Describe your form. use the p print p preview to check whether the form is correct. Printing the Form: Call a function module generated by SAP Smart Forms to print your form. • Pass the application data to the form form. you must: • Retrieve the application data. SAP Smart Forms supports the following output options: • The form is printed on a printer connected to the SAP System. p g. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Smart Forms Creating and Printing Forms When creating a form. the form description including the retrieved data to programs of third-party companies. for example.

using other tools of the Form Builder: * Use the Form Painter to position windows. 3.Use the flow control to control whether and when to print pages and elements 1. * Use the Table Painter to format your tables 4. and so on) for each page. graphics. and addresses on a page (the other elements are displayed in an assigned window).SAP Smart Forms Describing a Form Describe the interface of the form. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . addresses addresses. tables. graphics. It results from the application data previously selected. Within a window. On a page page. Create elements (text. pages. tables. * Use the PC Editor to write your texts. you can create additional elements. 2 Create one or more pages 2. you can position windows windows. and graphics.

SAP Smart Forms Form Attributes Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

In the form interface we can define import and export parameters.SAP Smart Forms Form Interface We define the form interface to pass the data to the form. tables and exceptions. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . We can initialize the global data before we start processing the start page. We can use any object defined there in all nodes of the tree. Withi the Within th form f routines ti we cannot t access any global l b l data d t unless l we explicitly li itl pass them to the form routine interface.SAP Smart Forms Global Definitions Global definition apply for the entire form form.

SAP Smart Forms Global Definitions Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Smart Forms Form logic In the I th Form F Builder B ild you describe d ib a Smart S t Form F by b a set t of f nodes. d To T do d this. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . thi you build up a tree structure on the left side of the user interface The numbering of the nodes also shows the sequence in which they are processed (from top to bottom). The first node is the root node.

SAP Smart Forms •Page P •Window •Text •Graphic p •Template •Table •Command •Loop •Alternative •Folder •Complex Section •Program Lines Nodes in Smart Forms Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

be placed directly on the page.SAP Smart Forms O t t Areas Output A Node type Description Page Window Node Types . There are main windows and All except window and subwindows. The system reads the address data directly from the database tables and formats them for print output output. use node type Page . You use this node to position graphics in the form. except p addresses.1 Possible direct successors A page of the form. ). Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . To include background graphics. address Output area on a page. Direct successors of this node can Window. You use this node to include an address. page nodes Elementary nodes (without successors) Node type Description Text Graphic Address You use this node to p print any y texts ( (and table contents). graphic.

2 Description Possible Directly Inferior Nodes Table ab e output Icon Node Type Template You use this node to print a table with fixed layout You use this node to print a table with dynamic layout All except window. Main Area and Footer . Table cell As with the template node Table Table line Table cell You use this node to print a table line in a table or template You use this node to print a table cell of a table line according to the line type Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . folder nodes. and template nodes Directly inferior nodes are automatically the three nodes Header . loop nodes. table. page. or table nodes are allowed.SAP Smart Forms Node Types . As their directly inferior nodes nodes.

3 Possible direct successors Flow Control Node type Command Description Executes special commands (next page. loop. folder Program lines Executes ABAP program code (for example. printer control) Processes successor node repeatedly. table.SAP Smart Forms Node Types . conversion routines). Loop Alternative Other Nodes N d t Node type Folder D Description i ti P ibl direct Possible di t successors All except window and page nodes All except window and page nodes (no successors) Combines successor nodes to logical groups Complex section Combines all attributes of the node types template. (no successor) paragraph numbering. Branches depending on condition. All except window and page nodes Direct successors are automatically the nodes TRUE and FALSE. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The direct successors of these are all nodes except window and page nodes.

SAP Smart Forms •Form F Painter P i t •Table Painter •PC Editor •Navigation Tree Tools in Smart Forms Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Smart Forms Form Painter •Used U d to t design d i the th layout l t of f the th Smart S t Form F •Used to create and change the size of the windows •Add graphical images Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Smart Forms Table Painter •Drawing D i rows and d columns l •Inserting .copying and deleting lines •Deleting cells •Splitting cells •Selecting table patterns •Changing cell size and moving cell separator lines Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . cutting .

SAP Smart Forms Table Painter Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

delete select select. change. and delete fields Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Smart Forms PC Editor •Enter Enter. delete. cut cut. and copy texts •Assign paragraph and character formats •Include.

3.Enter a unique name for the node and a description 4D t 4. You can then position the address anywhere on the page. In the box Additional Address Specifications you can maintain other attributes to specify how you want to display the address. 2. Procedure 1.Create the address node as directly inferior node of the page node or use the context menu in the layout of the Form Painter. To do this. yp .Determine i th the address dd t type on th the General G l Att Attributes ib t tab. you y must specify p yap person number and an address number. applications addresses are administered using the Business Address Services (BAS). The addresses are stored in the database tables of the central address administration and identified by the application via a number. For any other address types. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . t b For organization addresses you must specify only an address number.Create a node of type Address in the navigation tree of the Form Builder.SAP Smart Forms Inserting Addresses In many applications. use the search help.

SAP Smart Forms Inserting Addresses .Illustration Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

When the system displays the form. Prerequisites If you use your own fields. Process: 1.A dialog window appears. Make sure that the field name is enclosed in ampersands ('&'). The field serves as placeholder. The text node into which you want to include a field must exist exist. Enter the field name in a line. it replaces the field with the value that was assigned to it during processing.SAP Smart Forms Including Fields in the PC Editor You include Y i l d fi fields ld ( (your own fi fields ld and d system t fi fields) ld ) t to di display l variable i bl d data t i in th the form. you must have defined them either as global data or as parameters in the form interface.Include field ( ) to include a defined field into the text 2. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Contains the name of the current window (string in the Window field) Contains the name of the current page (string in the Page field) Smart Forms sets this flag ( SFSY-XSF = 'X' ). Queries whether the original is printed or which number the copy has. and so on. Arabic Arabic. Displays the total number of pages for the currently processed form. this field can be used only for include texts and text modules: •SFSY-SUBRC = 0 :Text T t module d l or include i l d text t t found f d and d printed i t d •SFSY-SUBRC = 4 :Text module or include text not found Logon name of the user who prints the form. COPYCOUNT = 3: second copy. Up to now. This allows you to include texts such as ‘Page x of y’ into your output. pushbuttons). Contains the total page number of all forms in the currently processed print request. node you can use this field to suppress output that is intended only for these output formats (for example. numeric) in the page node node. COPYCOUNT = 1 : orginal. Queries whether the original is printed or which number the copy has. and so on. COPYCOUNT = 1 : first copy.SAP Smart Forms Description Field Name &SFSY-DATE& &SFSY-TIME& &SFSY-PAGE& &SFSY-FORMPAGES& System Fields Displays the date. You determine the display format in the user master record. You determine the format of the page number (for example example. if you want to print the form in XSF format or HTML format format. Return value that you can query in program lines nodes. This enables you to react dynamically to error situations during output. Displays the time of day in the form HH:MM:SS. &SFSY-JOBPAGES& &SFSY-WINDOWNAME& &SFSY-PAGENAME& &SFSY-XSF& &SFSY-COPYCOUNT& &SFSY-COPYCOUNT0& SFSY-SUBRC SFSY-USERNAME Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Inserts the number of the current print page into the text. COPYCOUNT = 2 : first copy. COPYCOUNT = 2 : second copy. COPYCOUNT = 0 : orginal. On the Conditions tab of a node.

SAP Smart Forms Tabular Data Layout You can use the following node types for tabular data layout: •The template node. use line types. •The table node. Tables are dynamic because the table size depends on the amount of data selected at runtime. Templates are static because the number of columns and lines are determined before the actual output. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . To specify the layout of both node types. Line Types: You use the line type to describe the following attributes of a table line: •The width of the table line •The number and width of individual cells within the table line A major difference between line types of templates and line types of tables lies in the height: •line types of templates all have the same height. •while SAP Smart Forms determines the height of table lines dynamically (depending on the output in the table).

and outline and numbering •Character formats including effects (superscript. font attributes. bar-code and font attributes •Colors and underlines for a paragraph or character format •Preview Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . subscript).SAP Smart Forms Style Builder Use Transaction Code SMARTSTYLES to maintain paragraph and character formats. A Smart Style contains •Header data containing the default values of a Smart Style •Paragraph formats including indents and spacing. tabs.

SAP Smart Forms Style Builder Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

KUNNR LIKE VBAK VBAK-KUNNR KUNNR OBLIGATORY OBLIGATORY. DATA ZITAB1 LIKE ZITAB OCCURS 0 WITH HEADER LINE. HEADING DATA FLAG(1). DDSHRETVAL TABLES: VBAK. SELECT SINGLE * FROM VBAK WHERE VBELN = VBELN AND KUNNR = KUNNR. DATA: BEGIN OF ZITAB OCCURS 0. DATA: SVBELN TYPE DDSHRETVAL. DATA: END OF ZITAB.SAP Smart Forms Driver Program REPORT ZSALES_PRINT ZSALES PRINT NO STANDARD PAGE HEADING. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . INCLUDE STRUCTURE VBAP. DATA: FORM_NAME(30) ( ) VALUE 'ZSALES_PRINT'. VBAP. DATA: FM_NAME TYPE RS38L_FNAM. PARAMETERS: VBELN LIKE VBAK-VBELN OBLIGATORY. START-OF-SELECTION.

NAME CALL FUNCTION FM_NAME EXPORTING VBELN = VBELN KUNNR = KUNNR FLAG = FLAG TABLES ZITAB = ZITAB ZITAB1 = ZITAB1. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = FORM_NAME IMPORTING FM NAME FM_NAME = FM FM_NAME. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Smart Forms Driver Program SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE ZITAB WHERE VBELN = VBAK-VBELN .

whereby several customers are selected in the application program.SAP Smart Forms Example Forms Available in Standard SAP R/3 SF_EXAMPLE_01 Simple example. the form is called for each customer and a all form outputs are included in an output request Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . invoice with table output of flight booking for one customer SF_EXAMPLE_02 Similar to SF_EXAMPLE_01 but with subtotals SF_EXAMPLE_03 SF EXAMPLE 03 Similar to SF_EXAMPLE_02.

Thus you have drawn a box but it looks like a line. Font style and Font size Goto Transaction SMARTSTYLES. Line in Smartform Either t e you ca can use a window do t that at ta takes es up t the e width dt o of you your page a and do only y has as a height eg to of 1 mm. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Or you can just draw "__" across the page and play with the fonts so that it joins each UNDER_SCORE. Then only loop through a subset of the internal table (based on the conditions in the Command node) of the elements in the Table node.SAP Smart Forms Frequently Asked questions Forcing a page break within table loop Create a loop around the table. There you can create Paragraph formats etc just like in sapscript. Put a Command node before the table in the loop that forces a NEWPAGE on whatever condition you want. Then you put a frame around it (in window output options). Then in your window under OUTPUT OPTIONS you include this SMARTSTYLE and use the Paragraph and character formats.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Global definitions is where you declare data to be used within the smartform on a global scope ie: anything you declare here can be used in any other node in the form form.SAP Smart Forms Frequently Asked questions Difference between 'forminterface' and 'global definitions' in global settings of smart forms The Difference is as follows. Form Interface is where you declare what must be passed in and out of the smartform (in from the print program to the smartform and out from the smartform to the print program).

Sap Script SAP Script Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

or displayed on-line in the SAP System Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SAP Script is tightly integrated into the SAP System Note: Entering and formatting text in SAP script is a little bit different than traditional text-processing p g programs p g on a PC. The main difference: the text that you enter is not in its final format.Also called as Word processing tool of SAP. SAP script applies your formatting to text only when a document is printed.Sap Script INTRODUCTION SAP Script is the SAP System's own text-processing system. print-previewed.

Creation of Purchase Order .Sap Script How does a SAP Script work ? Every Script has a driver / print program attached or calling it. This program can be executed directly or attached to attached to certain events viz. Hiring an Employee. Standard SAP scripts p can be modified by y copying py g them in the customer name space and making the required chnages. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .you you also need to create the driver program. Sales Order . In case you are creating an entirely new script .

Standard Text This is like a normal document.Sap Script Components of a SAP Scripts 1. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .You can create letters . articles bascially y any static text. This can be created from transaction SO10. Print i t Program P This program retrieves desired data from the database . Layout Set This also called as Form created from Transaction SE71. calls the Form. 2. supplies data to the Form and finally closes the Layout Set ( Form ). 3 P 3.

Sap Script Supplies S li data Driver Program Layout set Gets printed Defines Forms Sap Script Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Sap Script Name House name Postal Code City WINDOW Name House name Postal Code City Page window Particular area in the page where the window is printed out o t Page Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Script : Standard Text Transaction SO10 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Script : Standard Text After creating a Standard Text assign it a Style.

you need to enclose the text <character string>TEXT</>.SAP Script : Standard Text If you want text in your standard text to appear as per attributes of character string . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SAP Script : Layout Set OBJECTS OF LAYOUT SET • Header • Paragraph and Character format • Windows and Text Elements • Pages • Page g Windows Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . In style maintenance. h d is i used d for f information and control purposes.SAP Script : Header Header data is found both in style and layout set maintenance. i t on the th other th hand. it is used primarily to present information designed to make it easier for the end user to select a style. The header Th h d data d t in i layout l t set t maintenance.

SAP Script : Header HEADER INFORMATION GLOBAL DATA Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Word processing is simplified by the use of different paragraph attribute groups: • Standard • Font • Tabs • Outline Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Script : Paragraph In SAP Script. I S i t paragraphs h are formatted f tt d using i formats f t and d their th i corresponding attributes.

SAP Script : Paragraph Paragraph Format Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. &VBDKA-TFGEU&</> Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Script : Character Format Character formats you to format entire blocks of text within a p paragraph g p • Allow y •Which will override the paragraph format •Character formats are defined in character strings Eg: <B1> &VBDKA-TDNAME& .

SAP Scripts calls such a group a window • To refer a window via program each window must have a unique name • We W can assign i text t t to t each h windows i d via i text t t elements l t TEXT ELEMENTS Text elements can be defined in layout set maintenance for each window. The /E in the tag column is used to identify the text as a text element Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Script : Windows and Text Elements WINDOWS We can combine information contained in a document into certain groups and make each group appear on the printed page in an individual area. and output in the respective window. formatted. The text elements are accessed by name by a print program.

SAP Script : Windows Windows Wi d are defined d fi d in i layout l t set t maintenance. i t They Th represent t areas which are positioned on pages -. If not not. Script The following window types can be used: • main • variable • constant Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . At least one window must be defined for each layout set. a text cannot be formatted by SAP Script.and in which text is later output.as page windows -.

SAP Script : Windows WINDOWS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

as long as MAIN has been defined for these pages. If the text fills one page. The text can vary on each page in which the window is positioned. The text in the main window can extend over several pages. VAR Window with variable contents.SAP Script : Windows MAIN Main window in which continuous text is output. output continues in the window of the next and subsequent pages. CONST Window with constant contents which is only formatted once. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Variable windows are formatted for each page.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Otherwise text formatting is not possible. You ou must ust a also so designate a "first" page in the layout set header.SAP Script : Pages At t least east o one e page must ust be de defined ed for o e every e y layout ayout set set.

SAP Script : Pages PAGES Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

i d the th window i d names are linked li k d to t page names. you need to specify the position and size of the window on the assigned page. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .SAP Script : Page Windows When you define Wh d fi page windows. Width of the main window must be the same on all pages. To do this.

SAP : Page Windows SapScript Script

PAGE WINDOWS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Sap Script

COMPONENTS OF SCRIPT • Text Elements • Style • Layout set

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Text Elements

The text elements are related to a window . Th print The i t program calls ll the th respective ti text t t elements l t of f the th window i d TYPES OF TEXT ELEMENTS •TEXT ELEMENTS WITH OUT NAMES •TEXT ELEMENTS WITH NAME

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Text Elements

NAMED TEXT ELEMENTS • We recognize named text elements by paragraph format /E • The name can be up to 40 characters • The different windows can have same named text elements • To out put named text elements we have to call the function module WRITE_FORM

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Style

A sty style e de defines es t the e set o of pa paragraph ag ap a and dc character a acte formats o ats t that at a are e available for formatting a document. If a style is selected, then it provides the character and paragraph formats for your document. Any formats defined in the layout set selected for a document are then ignored.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Layout Set

• Layout sets are used to control the page layout and also the text formatting in your documents. • If a document is formatted for output to the screen or to a printer, then a l layout t set t must t be b specified ifi d for f it. it • If no other layout set is specified for a document, then the SYSTEM layout set is assigned to the document by default. default

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Layout Set

LAYOUT SET CONTROL OPEN_FORM CLOSE_FORM - Initializes the SAP script composer and opens the specified p layout y set - Closes the layout set ( if close_form is missing in the program nothing will be printed)

WRITE_FORM , WRITE_FORM_LINES, CONTROL_FORM - To output data( this can be used as many times between OPEN_FORM and CLOSE_FORM) PAGE CONTROL IN LAYOUT SETS •STATIC DEFINITION- Specify the starting page in header and for each page specify the subsequent page •DYNAMIC DEFINITION - Specify START PAGE when you call START FORM START_FORM

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Symbols

SYMBOLS Symbols are constants that can be inserted in a document. They save the user unnecessary work k when h replacing l i sections ti of f text, t t phrases, h etc. t Possible symbol types are: • System y symbols y • Standard symbols • Program symbols • Text symbols.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Symbols

THE SYNTAX OF SYMBOLS • The delimiter & must be used both immediately before and after the symbol. symbol •The name of a symbol may not contain spaces. • A SAP Script editor line break should not occur between the symbol delimiters. • If additional formatting options are required, these should be enclosed in round brackets and inserted immediately after the symbol name. • The code letters identifying these options must be given in capitals.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Symbols

SYSTEM S S SYMBOLS S O S SAP script provides values for the system symbols Example &date& &time& &month& &year& &uline& &vline& &page& STANDARD SYMBOLS • • • • • Standard St d d symbols b l are defined d fi d in i the th TTDTG table. t bl This table contains both the name of each symbol and its value. The value, which is language-dependent, can contain up to 60 chars. This table is delivered complete with standard entries supplied by SAP SAP. It may be extended with customer-specific symbols

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Symbols
PROGRAM SYMBOL SAP Script cannot read this data out of the SAP database itself, but has to call ll on another th program t to d do thi this. The Th data d t are then th copied i d into i t work k areas declared using TABLES. If SAP Script is now called from this program in order to format a text, it can copy the data out of these work areas. areas Symbols which obtain their values from this kind of data area are called program symbols. Note • The value of a p program g symbol y is limited up p to a maximum of 255 chars. • The name of a program symbol consists of the table name and the field name separated by a hyphen.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

SAP Script : Symbols

TEXT S SYMBOLS O S All symbols which do not correspond to one of the three types of symbol described above are text symbols. You define the value of a text symbol yourself in the text module. There are two ways of doing this: • Use U th the menu entries t i in i the th text t t editor dit • Use the control command DEFINE for e e.g g /: DEFINE &mysymbol& = ‘XXXX’ / &mysymbol& /: DEFINE &mysymbol& = ‘YYYY’ YYYY / &mysymbol&
would print XXXX YYYY
Delivering Solution Excellence and Innovation

Satyam SAP PMG SAP PMG

Control Commands
Control Command is a type of SAP script command which are used to control output formatting. The Syntax of Control Commands • The paragraph format /: must be entered in the format column to identify a control. • You enter the command itself in the text line. • A control command, together with any parameters it requires, may not occupy more than a single line • A maximum of one control command may appear in each line

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands

SYNTAX OF CONTROL COMMANDS • In tag column, indicate control commands with paragraph format /: • Enter complete control commands and necessary parameters on one line • Enter only one control command per line • Editor formatting does not affect lines with control commands

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
SOME IMPORTANT CONTROL COMMANDS: /: NEW-PAGE /: PROTECT & /: ENDPROTECT

/: SET DATE MASK = 'date_mask’ /: SET TIME MASK = 'time_mask’ / RESET paragraph_format /: h f t /: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l ] [PARAGRAPH p] [NEW-PARAGRAPH np]

(Cont…..
Satyam SAP PMG SAP PMG

Next page)

Delivering Solution Excellence and Innovation

Control Commands

/: TOP : /: ENDTOP /: BOTTOM : /: ENDBOTTOM /: IF condition : /: ENDIF

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
SET DATE MASK command The formatting for date fields can be defined with the SAPscript SET DATE MASK command. Executing this command causes all subsequent date fields to be output using the specified formatting. formatting Syntax /: SET DATE MASK = 'date date_mask mask' The following templates may be used in the date mask: For day y : DD / DDD / DDDD For month : MM / MMM / MMMM For year : YY / YYYY

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
SET TIME MASK command You can use the SAPscript SET TIME MASK command to format time fields in a way that differs from the standard setting. Executing this command causes all subsequent time fields to be output using the specified formatting. Syntax: /: SET TIME MASK = 'time_mask' The following g templates p may y be used in the time mask: HH hours (two digits) MM minutes (two digits) SS seconds (two digits)

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
BOXES LINES, BOXES, LINES SHADING: BOX, BOX POSITION, POSITION SIZE The BOX, POSITION and SIZE commands for drawing boxes, lines and shadowing can be used for specifying that within a layout set particular windows or passages of text within a window are to be output in a frame or with shadowing. Syntax 1. /: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY] 2. /: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE] 3. /: SIZE [WIDTH] [HEIGHT] [WINDOW] [PAGE]

.

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
ADDRESS The command formats an address according to the postal standards of the destination country defined in the parameter COUNTRY sap scripts calls function module ADDRESS_INTO_PRINTFORM to format the address /: ADDRESS[DELIVERY] [ ][ [PARAGRAPH a] ][ [PRIORITY p] [LINES [ l] ] /: TITLE title /: NAME name1[,name 2[,name 3[,name 4]]] /:STREET street /:POBOX po box[CODE zip code] /:CITY town1[,town 2] /:REGION region / COUNTRY country /:COUNTRY t /: FROMCOUNTRY from country /: ENDADDRESS

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Control Commands
BOTTOM /ENDBOTTOM /:BOTTOM The text te t lines bet between een the t two o commands are o output tp t at the bottom of MAIN window /:ENDBOTTOM /:DEFINE &symbolname& = ‘value’ Text symbol receive their value through an explicit assignment. This assignment can be done interactively in the editor via include-symbolsg value may y have a maximum of 60 characters text. The assigned

Satyam SAP PMG SAP PMG

Delivering Solution Excellence and Innovation

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . 4 Include ZHEX-MACRO-LOGO 4. System t generates t a suggested t d name for f the th text t t e. Upload the file as text module using ABAP/4 report “RSTXLDMC” specify BMON or BCOL 3 S 3.g Company Logo 1.bmp / . ZHEX MACRO LOGO object Text ID ST in the Layout Layout.jpg file has to be converted to .Incorporating Graphics For e. .tiff file 2.g ZHEX-MACRO-LOGO Use ID “ST” and logon language.

Next Ne t Page) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SELECT * FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE I_SPFLI. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZTEST11'. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'HEADER_ITEM' * FUNCTION = 'SET' TYPE = 'BODY' WINDOW = 'MAIN'. DATA: I_SPFLI I SPFLI LIKE SPFLI OCCURS 0 WITH HEADER LINE LINE.Example of Print Program Calling an Script from a program created in SE38 REPORT ZSCRIPT . TABLES: SPFLI. (Contd (Contd…..

ENDLOOP. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .Example of Print Program CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'ADDRESS_LIST' * FUNCTION = 'SET' TYPE = 'BODY' BODY WINDOW = 'WINDOW1'. CALL FUNCTION 'CLOSE_FORM'. LOOP AT I_SPFLI. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'LINE_ITEM' * FUNCTION = 'SET' TYPE = 'BODY' WINDOW = 'MAIN' 'MAIN'.

Example of Print Program Output of the program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example Details of Layout Set Header Data Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example Pages Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example Windows Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example Page Windows Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Example Main Window Details Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Formatting Options Offset .g &symbol& &s mbol& ---> > 1234576789 &symbol+3& ----> 456789 Output p Length g &symbol(3)& ----> 123 &symbol(7)& ----> 1234567 Time Mask &Time& Normally 10:08:12 (hh) : (mm): (ss) /: Set Time Mask = ‘HH:MM’ &Time& = 10:08 /: Set Time Mask = ‘HH hours MM minutes’ &Time& = 10 hours 08 minutes &Time(Z)& = 10 hours 8 minutes Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .specifying an offset of ‘n’ . Eg E. n left most characters are not displayed.

Also Leading spaces are completely removed.YYYY’ &Date& = May 01.2001 Fill Character Leading spaces in a value can be replaced with a fill character. Omitting Leading Zeros &symbol(Z)& &Day& = 01 &DAY(Z)& = 1 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The ‘F’ option p is used and character to be filled is specified.g &KNA1-UMSAT& = 700.00 Space Compression &symbol(C)& It has a effect of replacing each string of space characters with a single space and shifting the words to left as necessary to close up gaps.00 &KNA1-UMSAT(F*)& = **700. p E.Example Date Mask /: Set Date / ate Mask as = ‘DDMMYY’ &Date& = 01 05 01 /: Set Date Mask = ‘MMMM DD.

ADDITIONAL TOPICS: SAP Business Workflow SAP Business Workflow: Introduction Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow WfMC • WfMC : The Workflow Management Coalition is the globally recognized body for the advancement of workflow management technology and its use in industry. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Workflow is defined as the automation of a business process . in whole or part . according to a set of procedural rules.ADDITIONAL TOPICS: SAP Business Workflow Definition of Workflow • According to WfMC . information or tasks are passed from one participant to another for action . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . during which documents .

Work items are sent to th participants the ti i t notifying tif i them th of f what h t they th have h to t do.ADDITIONAL TOPICS: SAP Business Workflow Wh is When i Workflow W kfl needed d d? ƒ It is particularly beneficial • when different people are involved in different parts of the process • when the users need to be reminded of what they need to do • when the duration of the process is critical and deadlines have to be met By automating the process. d and a single click on the notification calls the correct transaction and navigates to the relevant screen. you free the users from having to know what to do when. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

These work items can be received in the R/3 business workplace. Delivering Solution Excellence and Innovation • Satyam SAP PMG SAP PMG . or work item notifications can be distributed by e-mail.ADDITIONAL TOPICS: SAP Business Workflow H d How does it work k? • When the workflow runs it creates work items which are like e mails but e-mails. o they disappear on their own when they have been executed by someone else or made obsolete. o they have the advantage that they contain the intelligence needed to execute the relevant task with the correct data when the operational user executes them. Lotus Notes. MS Outlook (or any other MAPI compatible client). o they provide their own functionality so that the operational user has access to everything that is useful to improve the flow of the process.

ADDITIONAL TOPICS: SAP Business Workflow Purpose of SAP Business Workflow • SAP Business Workflow can be used to define business processes that are not yet mapped in the R/3 System. These workflows do not require much implementation • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . These may be simple release or approval procedures. or situations in which the business process requires the involvement of a large number of agents in a specific sequence. SAP Business Workflow is particularly suitable for situations in which work processes have to be run through repeatedly repeatedly. SAP provides several workflows that map predefined business processes . or more complex business processes such as creating g a material master and the associated coordination of the departments involved.

You can combine the existing functions of the R/3 System to form new business processes with SAP Business Workflow. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Integration • SAP Business Workflow uses the existing g transactions and functions of the R/3 System and does not change the functions. The workflow system takes over control of the business processes.

¾ ¾ ¾ ¾ Business Workplace Workflow Builder Tasks Business Object Repository (BOR) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Technical Principles • The definition and execution of Workflow can be divided into four main areas.

ADDITIONAL TOPICS: SAP Business Workflow Technical Principles Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

OBJECTS AND OBJECT TYPE o Object type describes the data with which you want to work in workflow . defined which can be executed with data e. Each Object type has methods in which activities are g creation of material .g. e. MATERIAL . They always refer to the method of the object . TASKS o Tasks describe elementary business activities . • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Technical Principles • • BUSINESS WORKPLACE o Work items are displayed to the user for execution in their SAP Inbox WORKFLOW BUILDER o W Workflow kfl d definitions fi iti are defined d fi d which hi h are made d up of f steps t that th t control t l the workflow or the tasks to be executed . This linking is defined in Workflow Builder . Tasks can be background tasks or dialog tasks .g.

ADDITIONAL TOPICS: SAP Business Workflow General Procedure Model • With SAP Business Workflow. you can map business processes in the R/3 System and process them (several times if required) under the control of the workflow system A workflow orkflo management s system stem can process and monitor structured processes that: ¾ ¾ ¾ ¾ Contain a sequence of activities Reoccur in the same or similar forms Involve several people or groups of people Require a lot of coordination • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow General Procedure Model • Process Flow ƒ Objects and Object Type o You identify y all objects j involved in your y business process. 9 If you find an object type whose definition does not quite meet your requirements. 9 If you find an object type whose definition meets your requirements. you extend its definition. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . p o You check whether the relevant object types with their methods. you can use it without making any modifications. 9 If you d do not fi find d a suitable i bl object bj type. you define d fi your own object bj type. attributes and events are defined in the Business Object Repository.

o You Y establish t bli h which hi h object bj t method th d is i to t be b executed t d for f the th task t k ƒ Rules for Agent Determination o You identify possible agent rules in your business process . functionally-oriented criteria. o You use these rules when agents are to be found using specific. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . ƒ Events o You define the events used to initiate and control the Workflow. business.ADDITIONAL TOPICS: SAP Business Workflow General Procedure Model • Process Flow ƒ Tasks o You identify the tasks involved in your business process.

create a workflow template . o The tasks defined are to be included in the workflow template . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow General Procedure Model • Process Flow ƒ Workflow o To describe a business process .

the creator is informed and can decide whether to withdraw the notification of absence or revise it. The R/3 System determines the direct superior automatically on the basis of the organizational i ti l plan l maintained. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . o The direct superior of the employee is responsible for approving or rejecting the notification of absence.ADDITIONAL TOPICS: SAP Business Workflow Demo Example • Process Flow o An employee enters a notification of absence (leave request) in the R/3 System by filling out the relevant input template. the creator can take these into consideration. i t i d o If the request is approved the creator is notified by mail: o If the request is not approved. If the superior has given reasons for the rejection in an attachment.

i o This cycle is repeated until either the superior approves the leave request or the creator withdraws it. The applicant can also add an attachment. which hi h can then th be b accessed db by th the superior. it is submitted to the superior for approval again.ADDITIONAL TOPICS: SAP Business Workflow Demo Example • Process Flow o If the creator revises the request. o The applicant can find out the current processing status at any time by looking in their workflow outbox. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow Demo Example Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

¾ Roles to be assigned 9 SAP_BC_SRV_USER SAP BC SRV USER 9 SAP_BC_BMT_WFM_PROCESS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . identifies those that are suitable for SAP Business Workflow and maps them onto a business process model.ADDITIONAL TOPICS: SAP Business Workflow Roles in Workflow • Process Cons Consultant ltant ¾ Person within the system of workflow roles who analyses the existing business processes. ¾ The process consultant is also responsible for the maintenance of the organizational plan required for the workflow.

¾ Roles to be assigned 9 SAP_BC_BMT_WFM_DEVELOPER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Roles in Workflow • Workflow Workflo Developer De eloper ¾ Person within the system of workflow roles who implements the workflow based on the business process model developed by the process consultant and using the SAP Business Workflow definition tools .

¾ Roles to be assigned 9 SAP_BC_ENDUSER 9 SAP_BC_SRV_USER 9 SAP_BC_BMT_WFM_ADMIN SAP BC BMT WFM ADMIN Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Roles in Workflow • Workflow Workflo System S stem Administrator ¾ Person within the system of workflow roles who is responsible for the technical maintenance of the development environment and the runtime behavior after automatic Customizing.

Their work area is the Business Workplace. ¾ The workflow agent starts workflows and processes work items. ¾ Roles to be assigned 9 SAP_BC_SRV_USER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Roles in Workflow • Workflow Workflo Agent ¾ Person within the system of workflow roles who appears as an end user in productive workflows workflows.

ADDITIONAL TOPICS: SAP Business Workflow Roles in Workflow • Process Controller ¾ Person within the system of workflow roles who evaluates the workflow from a business perspective at runtime. and is responsible for suggesting improvements. g ¾ Roles to be assigned 9 SAP_BC_SRV_USER 9 SAP_BC_BMT_WFM_CONTROLLER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

display di l or change h object types .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder USE : ¾ Y You use the h B Business i Object Obj Builder B ild to create . ¾ The path is Tools Æ Business Workflow Æ Development Æ D fi i i Tools Definition T l Æ Workflow W kfl Builder B ild ¾ The transaction code is SWO1 Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

material.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder OBJECT TYPES : • • Object Type is the description of data (objects) in the system created at definition time in the Business Object Builder The examples are : Documents (invoices. .q quotation. vendor. and so on) o Transaction data ( (order. . and so on) o Master data (customer. purchase requisitions. job applications. and so on) ) o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

result and exceptions Events with parameters Implementation program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder • Object types are described and implemented by specifying the following components: o o o o o o Basic data Key fields Attrib tes Attributes Methods with parameters.

generate or where-used list are available. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you must know its ID. • FEATURES : o Various functions such as check. test. In this case Business Object Repository Browser is used . name or description o If you do not know the object type precisely or if you are not sure whether there is an appropriate object type. you can find an object type via its position in the component hierarchy or via its relationships to other object types .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder • INTEGRATION : o If you want to display or change a defined object type in the Business Object Builder.

ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder MAINTENANCE OF OBJECT TYPES : 9 USE 9 The maintenance of object j types yp encompasses p the functions of the Business Object Builder for creating. displaying and changing object types. 9 You need these functions if y you want to: o Look at and analyze the definition and implementation of a particular object type o Create a new object j type yp or change g an existing g object j type yp o Change the release status of an object type Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder MAINTENANCE OF OBJECT TYPES : • INTEGRATION : o If required required. • FEATURES o You create a new object type with initially just its basic data. This assigns the appropriate position in the Business Object Repository to the object type Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you can get an overview of the existing object types including their relationships using the Business Object Repository Browser. The Business Object Repository Browser is called from the Business Object j Builder.

y Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . which inherits the components of the existing object type automatically.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder CREATING OBJECT TYPES : • There are two ways of creating a new object type: ƒ You create a completely p y new object j type yp ƒ You create an object type as a subtype of an existing object type.

Name and Description. When doing so. 4.ADDITIONAL TOPICS: SAP Business Workflow PROCEDURE : 1. 2. Select Create. Choose Tools Æ Business Workflow Æ Development Æ Definition tools Æ Business Object Builder. bear in mind the general naming conventions for object types. application 6. Specify the code letter of your application (usually Y or Z). 3 The 3. This displays the screen Business Object Builder: Initial Screen. Leave the field Supertype blank. Th Create C Object Obj Type T di dialog l box b appears. Object name. Edit the fields Object type. Enter the name of a new program for the implementation of the object type Bear in mind the naming conventions in your application. 5. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . type.

ADDITIONAL TOPICS: SAP Business Workflow Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

It can be changed g at any y time in the basic data o • o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . upper and lower cases should be used Object type name o The object type name is a short. language-dependent text with 20 characters. The object name has 20 characters and should be in English regardless of the user language. which can be used on screens or in lists to identify y the object type. The object type name is entered when the object type is created.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder GENERAL NAMING CONVENTION FOR OBJECT TYPES : • Object name The object name is specified when the object type is created. To make the object name easier to read.

t d It can be changed at any time in the basic data o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . which can be used in lists of object types or for brief documentation.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder GENERAL NAMING CONVENTION FOR OBJECT TYPES : • Object type description o The object Th bj t t type d description i ti is i an explanatory. l t languagel dependent text with 80 characters. Th description The d i ti is i entered t d when h the th object bj t type t is i created.

Upper case only can therefore be changed easily into upper/lower /l case. The ID begins with a letter. Upper/lower cases are not significant for identification since only upper case is used. digits and underscores. attribute a method or an event. and should be in English and comprehensible semantically. which is followed by letters. can no longer be used as an ID for an attribute. Delivering Solution Excellence and Innovation o o Satyam SAP PMG SAP PMG .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder RULES FOR NAMING OBJECT TYPE COMPONENTS : • • The following naming rules apply to each object type component's ID. for example. event The ID of a object type component has an identifying character. An ID already allocated to a key field. It has a maximum of 20 characters. name and description: ID o The ID of an object type component must be unique. Upper/lower U /l case always l improves i legibility l ibilit even within a word.

Created Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . li t The Th object bj t type t ID and d object bj t type t component ID are separated with a period • Examples E l of f object bj t type t component t IDs ID of f th the object bj t t type Material are: Key field : Attribute : Method : Event : Material. The object type ID precedes the object t type component t ID i in a list.Industry Material.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder RULES FOR NAMING OBJECT TYPE COMPONENTS : • ID o The ID of an object type component should not repeat the ID of the object type or the object name.Material Material.Display Material.

which can be used in lists of components or for brief documentation The ID must be an English g noun The ID must be an English noun Description • • Key fields o o Attributes Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder RULES FOR NAMING OBJECT TYPE COMPONENTS : • • Name o o This is a short. language-dependent text with a length of 80 characters. language-dependent text with a length of 20 characters The description is an explanatory.

general information about the object type and information generated automatically by the system Select . The takes you to the screen Object Type <object type>: Edit Basic Data. Assign the object type to the data model if required. select Organizational type.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder EDITING THE BASIC DATA OF AN OBJECT TYPE : o The basic data contains both changeable. edit the name and the description of the object type. Edit the default method and the default attribute on the tab page Defaults • Procedure o o o o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . On the tab page General. in order to define it as a business object. The object type information displayed above the tab pages cannot be changed. object If the object type corresponds to an SAP organizational entity.

..ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder PROCESSING OBJECT TYPES : • Check o To check that the implementation program with the attribute and method accesses is syntactically correct and complete with regard to the object type definition. • Change release status o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . proceed as follows: o o o Open the object type in change mode. select .. To change the release status of an object type component. choose Object t type ÆChange Ch release l status t t to t Æ .. Select the object type component. To change the release status of the object type. Choose Edit ® Change release status ÆObject type component Æ...

Released object types/object type components are released for use.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder RELEASE STATUSES : • • g release statuses exist for object j types yp and object j type yp The following components: Modeled • You cannot call modeled object types/object type components at runtime. Implemented object types/object type components are either in the test phase or are only used internally. Any enhancements made by SAP to released l d object bj t types t and d object bj t type t components t are upwardd compatible Delivering Solution Excellence and Innovation • Implemented • • R l Released d • Satyam SAP PMG SAP PMG . You can call them at runtime. You can call and test them at runtime. Implementation may not yet be stable.

This displays the screen for testing an object type. select an object j for testing g the instanceIf objects dependent attributes and methods.ADDITIONAL TOPICS: SAP Business Workflow PROCESSING OBJECT TYPES : • • Generate • To generate an object type and make it available for the runtime system. • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . select Test. You are then asked to enter the key fields of an object of the type to be executed in order to specify it. yp . select . select Create instance. To test the attributes and methods that operate on an object as well. j already y exist for the object j type. Test/Execute • • • • To test whether the implementation of the methods and attributes of the object type was successful. You execute the methods on this object by double-clicking on the appropriate line. only the attributes and methods that are defined as instance-independent are offered for testing . If no objects exist yet for the object type. A screen with the attributes of the object and their current values is displayed.

you define key fields. A newly created object type only has the object type components that is inherits from the standard interface. methods and events o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . attributes. which is supported by every object type To set up the object type for your tasks.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF OBJECT TYPE COMPONENTS : o You need object type components to work with an object type.

you do not have to edit all object type components. You should follow the sequence below: • • • • • You check whether any object type components required are already contained in interfaces and implement them. h d f for which hi h you can d define fi method parameters and exceptions. for which you can create additional ddi i l event parameters. Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . them You define the key fields. You create the necessary events.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild PROCESS FLOW : • To define an object type. You create the necessary attributes. Y create the You h necessary methods.

A redefined object type component loses its red background Creating an object type component • Redefining an object type component • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder MAINTENANCE OF OBJECT TYPE COMPONENTS : • • Editing an object type component • • • Position the cursor on an object j type yp component p and select Position the cursor on the object type component name with a blue background and select . Position the cursor on the object type component and select . You can now process the newly-created object type component directly Redefining an object type component inherited from the supertype allows you to process it.

ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder MAINTENANCE OF OBJECT TYPE COMPONENTS : • Deleting and renaming individual object type components • Position the cursor on the object j type yp component p to be processed. To rename it. select Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . To delete it. select .

p Using an interface guarantees that the object type fully supports the methods (with all parameters and all exceptions).ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild IMPLEMENTATION OF INTERFACES : o o o o You use this function to define the interfaces that your object type supports SAP supplies pp interfaces that y you can use when defining gy your own object types Using interfaces standardizes the definition of the object type components. This contains the interfaces Check existence and Display You can add other interfaces to your object type o o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . attributes and events in the interface All objects types support the standard interface.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE AGGREGATE : o o o o The aggregate type is used to specify functional relationships between object types There is no inheritance The attribute Aggregate contains the reference to this aggregate type You do not have to implement anything in the program of the object type Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The values are specified using the fixed values for the domain SWF_XAPPRE : • • • • 0 (object approved) 1 (object proposed for approval) 3 (object proposed for rejection) 4 (object rejected) • In the implementation of this method.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE EXTENDED APPROVAL : • • Result of this method The method XApproval has one result with four possible values. the container element RESULT of the method container must be assigned one of the four values at the end Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The implementation p of this method is always y incomplete p and not adapted to the current conditions of the object type RESULTS OF THIS METHOD : – The method Approval has one result with two possible values.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE APPROVAL : • • • The interface Approval is used to offer a method for the object type. which can be used in an approval task. These are specified using the fixed values for the domain SWF_APPRES : – 0 (object approved) – 4 (object rejected) In the implementation of this method. the container element RESULT of the method container must be assigned one of the two values at the end – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Use the macro following macro instruction: EXIT_RETURN <Code> <Variable1> <Variable2> <Variable3> <Variable4> As the <Code>.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE CREATE : • Used for creating an object for the object type • • Three exceptions are defined in the interface Create for the method Create You must implement these exceptions at the appropriate points in the program. The variables (maximum of four) are derived from the definition of the message that is linked to the exception • EXCEPTIONS FOR THIS METHOD : • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . enter the exception’s 4-digit number specified when the exception was defined.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE DISPLAY : ƒ ƒ ƒ The interface Display contains the method Display for displaying an object Th method The th d Display Di l is i implemented i l t d for f the th interface i t f in i such h a manner that the key field values of the object are displayed as standard It is also entered as default method in the basic data Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Use U th the macro f following ll i macro instruction: i t ti » EXIT_RETURN 0001 SPACE SPACE SPACE SPACE Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You must implement this exception at the appropriate point in the program.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE EDIT : • • To offer a method for editing an object for your object type Exceptions for the method • The exception Object does not exist is defined for the method Edit under the number 0001 in the interface Edit.

The source code is not entered in the program of your object type. you must also define and implement the method ExistenceCheck (interface Check existence) for the object type ƒ ƒ Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . from which it is inherited The system sets up an object reference in the inherited implementation of the method Find. the system generates a dialog box with input fields for the key fields of the object Th system The t also l checks h k within ithi the th implementation i l t ti whether h th the th key k fields entered actually identify an existing object So that the method Find really does only return objects that exist. To do this.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE FIND : ƒ ƒ ƒ With this method you can use the inherited source code unchanged. but only in the program of the interface Find.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild INTERFACE FIND : • Exceptions for the method • • • Two exceptions are defined for the method Find : Exception 0001: Object does not exist Exception 1017: Cancellation by user • The exceptions are implemented in the program of the interface Find Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild STANDARD INTERFACE : ƒ ƒ ƒ All object types support the standard interface and hence inherit the attribute ObjectType and the interfaces Display and Check existence These contain the methods Display and ExistenceCheck The attribute ObjectType returns the type of an object Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

and select the fields that are the key fields of your object type • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Select Answer YES to the question Create with ABAP Dictionary field proposals? The Create with Data Dictionary Field Proposals dialog box appears Enter the table from which you want to reference the fields.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINING KEY FIELDS : • • • Objects are always identified using one or more key fields The identifying key of an object is made up of all the key fields of the object type Procedure • • • Position the cursor on the component name Key fields (blue background).

and can also be used to control the workflow Object type attributes can return data in the following formats: • • • • Value of ABAP Dictionary field Object reference Value calculated at runtime Object status in status management Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE : • • • • You must define attributes for an object type when you want to query particular properties. statuses or values at runtime Attributes can be used to formulate conditions in the workflow definition At runtime. the attribute values are read or calculated.

An attribute whose source is a database field can either return the database field contents or an object reference ƒ DATABASE FIELD ƒ ƒ OBJECT STATUS ¾ Attribute whose value is an object status Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . reference is made to a database field as the source of the required information. since no field content in the database corresponds to this attribute. A virtual attribute can return the value of an ABAP Dictionary field or an object reference When this type of attribute is defined.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE : • Att ib t have Attributes h various i sources of f information i f ti ƒ VIRTUAL ƒ Attribute for which a read procedure always has to be implemented.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF ATTRIBUTES FOR AN OBJECT TYPE : o Relationships between two object types are described using attributes. which return their information as object references to the other object type In the field Inverse attribute. which contains the object reference to this object type You can use macros to access the attribute o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . enter the attribute of the other object type.

create. dialog modules. and so on) and make them available to the workflow system Features – You can also define the following data for each method: ™ Import p p parameters ( (for synchronous y and asynchronous y methods) ™ A result (only for synchronous methods) ™ Export parameters (only for synchronous methods) ™ Exceptions (only for synchronous methods) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation • . (transactions function modules. search for or delete an object of this object type The methods refer to ABAP functions (transactions.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHODS FOR AN OBJECT TYPE : • • With a method you define a function with which you can edit.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHODS FOR AN OBJECT TYPE : • SYNCHRONOUS METHODS : – Method that assumes process control for the duration of its execution and reports back to the calling component (in this case the work item manager) after its execution Terminating events can be defined for a single-step task described with a synchronous object method A synchronous method can return the following data to the workflow: – Return parameters – One result – Exceptions – – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHODS FOR AN OBJECT TYPE : • ASYNCHRONOUS METHODS : – Method that does not report back directly to the calling component (in this case the work item manager) after its execution It does not return any result. itself Import parameters can be passed to it only – – – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . any parameters or any exceptions At least one terminating event must be defined for a singlestep task described with an asynchronous object method An asynchronous method must enter its results itself.

but it can have any number of return parameters as well A method does not necessarily have to have a result – – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHODS FOR AN OBJECT TYPE : • RESULT – – A specific parameter of a synchronous method for returning the essential result of this method The possible values of this result can be defined in a fixed value domain or a check table so that they are known in the workflow definition and can be taken into account A method can only ever have one result.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHODS FOR AN OBJECT TYPE : • EXCEPTIONS – Object type component: Error which may occur during method execution and indicates whether a method was successful Exception categories: – Application and system error – Temporary error Temporary errors can occur when system resources are not available il bl – – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • • DEFINITION OF METHODS FOR AN OBJECT TYPE : PROCEDURE – – To create methods for an object type. You are then supported by a wizard in the definition of the method GENERAL TAB – DIALOG : If you do not set the indicator Dialog on the tab page General. position the cursor on the name Methods (blue background). you should answer the question with YES . background) and select If the new method is based on a function module. the method is executed in the background at runtime SYNCHRONOUS RESULT SU INSTANACE DEPENDENT Delivering Solution Excellence and Innovation – – – – Satyam SAP PMG SAP PMG .

g if the transaction has to be called by the method then Checkbox “Transaction” is to be selected and the transaction code to be entered in the NAME – Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • • DEFINITION OF METHODS FOR AN OBJECT TYPE : PROCEDURE RESULT TYPE TAB • Define the reference to ABAP Dictionary – ABAP TAB • You enter the function to be executed when the method is called on the tab page ABAP A A e.

which are not requested in dialog.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • • DEFINITION OF METHOD PARAMETERS : You define method parameters for a method under the following circumstances: When the method requires other input values apart from the object reference. – When the method returns parameters apart from the object reference Integration – – – The following data type references exist for method parameters: ABAP Dictionary reference Object j type yp reference – • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

th d position iti the th cursor on the th method th d and d select Exceptions. reserved for SAP development 8000-8999: Exceptions p triggered gg by y the object j manager g 9000-9999: Customer-defined exceptions. reserved for customers Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj t Builder B ild DEFINITION OF METHOD EXCEPTIONS : • You define e Yo exceptions ceptions for a method when hen you o want ant to "p "publicize" blici e" error situations in a standardized manner in order to give the caller of the method the opportunity to react to the error situations To d T define fi exceptions ti f for a method. The following number ranges apply: » » » » Satyam SAP PMG SAP PMG • • 0001-1000: 0001 1000 E Exceptions ti defined d fi d f for i interfaces t f 1001-7999: Application-specific exceptions. The existing exceptions for the method are displayed and you select to create a new exception. which is used to address it in the implementation program. Give the Gi th exception ti an identifying id tif i number b in i the th dialog di l box b Add Exceptions.

advisable to call the method again at a later point in time. Application error: This error type is caused within the application called in the method. System error: This error type shows incorrect configuration of the object manager or an inconsistency between object type definition and method call. Delivering Solution Excellence and Innovation • • Satyam SAP PMG SAP PMG . and that it is resources are not available at the moment.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF METHOD EXCEPTIONS : • Exceptions are classified according to error types. A table that cannot be maintained or a document that does not exist are typical application errors. • Temporary error: This error type indicates that certain system . Temporary errors can also occur if the method is temporarily locked by another user for processing. Missing mandatory method parameters when calling a method are an example of a system error.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF EVENTS FOR AN OBJECT TYPE : • • You define events for an object type. In a workflow definition for steps of the types Event creator and Wait for event. if a status change in an object of this type is to be published across the system You use an event in a workflow under the following circumstances: • • • • • • In a workflow or task definition as a triggering event The workflow or task is started when the event is triggered. In a task definition as a terminating event The task is terminated when the event is triggered. event) Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The event is triggered (event creator) or the workflow is continued when the event is triggered (wait for event).

which is evaluated by the event manager Every event has an event container that contains data about the context of its creation. You can use the function modules SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT to trigger an event t An event is published without the creating application being informed as to whether a receiver reacts to this event. The system enters potential receivers in a linkage table.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF EVENTS FOR AN OBJECT TYPE : o The event is not normally triggered in the implementation program. The data is passed to the task or workflow via a binding o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . but instead by an event creation.

Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF EVENT PARAMETERS : • • You define event parameters to supplement the system event parameters EVENT PARAMETERS : – – – Runtime-specific information from the event creation context Event parameters are defined as elements of the event container and are passed to the event receivers via binding The following event parameters are automatically contained in the event container: – – Satyam SAP PMG SAP PMG The reference to the object whose change of state is described by the event. The user name of the party who triggered the event creation.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild DEFINITION OF EVENT PARAMETERS : • The event parameters are displayed as event container elements and you use them in binding definitions between the event container and the task or workflow container There are two different types of data type reference for event parameters: • • ABAP Dictionary reference Object type reference • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild PROGRAMMING IN THE IMPLEMENTATION PROGRAM : o The information specified about the object type components is only of a descriptive nature. Attribute accesses and method calls are programmed in the implementation program of the object type This program is called and executed by the system at runtime. During g object j type yp definition you y select Program g to g go to the ABAP Editor You go directly to the lines in the implementation program that contain the relevant source text for the selected method or attribute Parts of the source text can be generated automatically to help implementation p o o o o Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

and inserted into the implementation p p program g MANUAL POSTPROCESSING You need to check the program as automatic program generation i only provide i templates CHANGES AFTER PROGRAM GENERATION – – Changes g made to object j type yp components p do not automatically change the program So all subsequent changes have to be made manually – • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild PROGRAMMING IN THE IMPLEMENTATION PROGRAM : • The source text is generated based on the specifications you made when defining the object type and the object type components.

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild PROGRAMMING IN THE IMPLEMENTATION PROGRAM : • Only in the following cases the source code gets automatically changed in the implementation program • • • • Deletion of methods Deletion of virtual attributes Renaming of methods Renaming of virtual attributes Macro instructions for processing containers and accessing objects bj t are used di in th the i implementation l t ti program The macro instructions are available if the macro <OBJECT> has been included into the implementation program • INCLUDING MACRO INSTRUCTIONS • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild PROGRAMMING IN THE IMPLEMENTATION PROGRAM : • • The macro instructions for processing the container can also be used outside the implementation program The macro instructions for accessing objects objects. attributes and methods can only be used within the implementation program Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • MACRO INSTRUCTIONS FOR PROCESSING A CONTAINER These macro instructions can be used in following programs : • Implementation programs of object types • Function modules for event creation • Function modules for role resolution Processing a container instance includes: • Accessing A i the value of f a container i element • Entering a value for a container element Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • • The include file <CNTN01> must have been included into the program in order to use these macros The container must be declared and initialized with the following macro instructions: SWC_CONTAINER <Container>. a structure or an o a object reference e e e ce – • • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . "Initialization You can assign the content of a field to a container element or write the content of a container into a field This content can be multiline. "Declaration SWC_CREATE_CONTAINER <Container>. in the form of an internal table The content of a field can be an elementary data type. that is.

Fi ldV i bl Delivering Solution Excellence and Innovation 9 9 9 Satyam SAP PMG SAP PMG .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • ACTIVITIES : 9 Deleting a container element 9 SWC_DELETE_ELEMENT <Container> <ContainerElement>. Copying a container element 9 SWC_COPY_ELEMENT <SourceContainer> <SourceElement> <TargetContainer> <TargetElement>. <TargetElement> Writing a field value 9 SWC_SET_ELEMENT <Container> <ContainerElement> <Value>. <Value> Reading a field value 9 SWC_GET_ELEMENT <Container> <ContainerElement> C i El <FieldVariable>.

Reading an object reference – DATA <Object> TYPE SWC SWC_OBJECT. • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . Writing an object reference – DATA <Object> j TYPE SWC_OBJECT. SWC_GET_OBJECT_TYPE <Object> <ObjectType>.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • ACTIVITIES : • • Writing a multiline field value – SWC_SET_TABLE <Container> <ContainerElement> <Value>. SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>. SWC_GET_OBJECT_KEY <Object> <ObjectKey>. Reading a multiline field value – SWC_GET_TABLE S C G A <Container> C i <ContainerElement> C i l <TableVariable>. SWC_SET_ELEMENT <Container> <ContainerElement> <Object>. OBJECT SWC_GET_ELEMENT <Container> <ContainerElement> <Object>.

• Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation ... SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>. Reading a multiline object reference – DATA <ObjectList> TYPE SWC_OBJECT OCCURS 0.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • ACTIVITIES : • Writing a multiline object reference – DATA <ObjectList> TYPE SWC_OBJECT OCCURS 0. SWC_GET_TABLE <Container> <ContainerElement> <ObjectList>. DATA <Object> TYPE SWC_OBJECT. APPEND <Object> TO <ObjectList>. SWC_SET_TABLE <Container> <ContainerElement> <ObjectList>. .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • MACRO INSTRUCTIONS FOR ACCESSING OBJECTS . ATTRIBUTES AND METHODS • • • You can use these macros for simplifying access to Business Object Repository objects The include file <OBJECT> must be incorporated into the program in order to use these macros You must declare variables in which an object reference is to b stored be t d with ith th the f following ll i i instruction: t ti » DATA : <Object> TYPE SWC_OBJECT. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

SWC_CALL_METHOD <Object> <Method> <Container>. SWC_GET_PROPERTY <Object> <Attribute> <AttributeValue>.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • GENERAL MACROS • • • • • • SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>. • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . SWC_REFRESH_OBJECT <Object>. SWC_GET_OBJECT_KEY <Object> <ObjectType>. SWC_GET_OBJECT_TYPE <Object> <ObjectType>. SWC_GET_TABLE_PROPERTY SWC GET TABLE PROPERTY <Object> <Obj t> <Attribute> <Att ib t > <AttributeValue>.

• Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • EXECUTING MACROS ON OWN OBJECT • All the macros in the section General macros can also be executed directly on the object itself in the implementation program To do this. » SWC_GET_PROPERTY SELF <Attribute> <Att ib t V l > . <AttributeValue>. you replace <Object> with SELF in the macro calls e.g.

p og . the object key must be set This typically applies to the methods Create and Find SWC_SET_OBJECTKEY <ObjectKey>.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • SETTING AN OBJECT KEY • • • When implementing methods with which an object is created. • RAISING EXCEPTIONS • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . you c can raise se the e exceptions defined for a method EXIT_RETURN <Exception> <Var1> <Var2> <Var3> <Var4>. W Within the e implementation pe e o program.

attributes and method parameters in the implementation program This area is between the two macro instructions BEGIN_DATA OBJECT and END_DATA OBJECT at the beginning of the source text The data structure of the object key is between the macro instructions BEGIN OF KEY and END OF KEY and is created automatically by the system The method p parameters and attributes are then declared Since the system obtains the information about the names of the variables and the field references directly from the definition of the individual object type components.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • DATA DECLARATION FOR VARIABLES USED • The system automatically creates an area for the data declaration for key fields. you cannot make k any changes h h here • • • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

DATA is generated Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . PURCHASEORDER TYPE SWC_OBJECT OCCURS 0. COSTESTIMATE TYPE SWC_OBJECT OCCURS 0.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • DATA DECLARATION FOR VARIABLES USED ¾ BEGIN_DATA OBJECT. " to declare private attributes remove comments and " insert private attributes here . _MARA LIKE MARA. " Do not change.. MATERIAL LIKE MARA-MATNR. PIECEOFEQUIPMENT TYPE SWC_OBJECT OCCURS 0. PURCHASINGINFO TYPE SWC_OBJECT OCCURS 0. END_DATA OBJECT. END OF KEY. BEGIN OF KEY. _MAKT LIKE MAKT.. 0 DOCUMENT TYPE SWC_OBJECT OCCURS 0.. " Do not change. DATA is generated * only private members may be inserted into structure private DATA: " begin of private. PURCHASEREQUISITION TYPE SWC_OBJECT OCCURS 0.. PURCHOUTLINEAGREEMT TYPE SWC SWC_OBJECT OBJECT OCCURS 0. " end of private.

ti Th t The transaction ti i is called ll d in i the th program with ith the th ABAP command CALL TRANSACTION Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • PROGRAMMING ASYNCHRONOUS METHODS • • • • It is programmed between the macro instructions BEGIN_METHOD <Method> and END_METHOD The unique ID of the object is available in the structure of the key fields under the variable OBJECT-KEY An asynchronous method can be implemented with a t transaction.

The result is available in the task container in the container element l t _WI_RESULT WI RESULT • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • PROGRAMMING SYNCHRONOUS METHODS • • • It is programmed between the macro instructions BEGIN_METHOD <Method> and END_METHOD The unique ID of the object is available in the structure of the key fields under the variable OBJECT-KEY A synchronous method can be implemented with a function module. The function module is called with the ABAP command CALL FUNCTION in the program In the case of synchronous methods. a result and/or the export parameters can be returned to the caller if you pass the result to the container CONTAINER within the method implementation The result is always put into the container element RESULT.

that is within the macro instructions BEGIN_METHOD <Method> and END_METHOD . You must declare <Code> with the type SWOTINVOKECODE EXIT_OBJECT_NOT_FOUND EXIT_CANCELLED EXIT_NOT_IMPLEMENTED EXIT_PARAMETER_NOT_FOUND • • • STANDARD EXCEPTIONS • • • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . using the macro instruction EXIT_RETURN EXIT_RETURN <Code> <Variable1> <Variable2> <Variable3> <Variable4>.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • PROGRAMMING EXCEPTIONS • You implement exceptions within a method.

areas you proceed as follows: » You create a new object type as a subtype of the object type that you want to extend. If you want to use one of these object types. refer to Defining Delegation Types. » » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . refer to Maintenance of an Object Type Component. You make this object type into a delegation type of the supertype. For further information. but would like to make specific extensions or adaptations in certain areas. The new object type inherits the components and their implementation from the supertype. You can redefine existing attributes and methods and create new object type components. supertype You modify and add to this object type.ADDITIONAL TOPICS: SAP Business Workflow Business Object Builder EXTENDING AND ADAPTING OBJECT TYPES • • • You can extend an object j type yp to add more object j type yp components not in the standard version This ensures that productive workflows and tasks remain executable in the same manner with the original object type Process Flow ƒ You cannot change the object types supplied by SAP. For further information. supertype For further information. refer to Creating Subtypes.

attributes and events. but the system uses the definition of the delegation type for every access. In all definition tools you can still refer to the original object type. linkage tables). although this other object type is specified in all definition components (for example task and workflow definition. The delegation type can have different or additional methods.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • EXTENDING AND ADAPTING OBJECT TYPES ¾ DELEGATION TYPE » Object type whose definition is considered at runtime instead of the definition of another object type. A delegation type is always defined for an object type on a systemwide and cross-client basis » » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The delegation type must always be a subtype of the object type it is to replace.

The delegation type must always be a subtype of the object type it is to replace. attributes and events. A delegation type is always defined for an object type on a systemwide and cross-client basis » » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . but the system uses the definition of the delegation type for every access.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • EXTENDING AND ADAPTING OBJECT TYPES ¾ DELEGATION TYPE » Object type whose definition is considered at runtime instead of the definition of another object type. In all definition tools you can still refer to the original object type. although this other object type is specified in all definition components (for example task and workflow definition. The delegation type can have different or additional methods. linkage tables).

The screen New Entries: Details of Added Entries is displayed. Enter the name of a person responsible. You are on the screen Display View "Customizing Customizing Object Types": Types : Details. Details Select . Select New entries. E Enter the h ID of f the h object bj type f for which hi h you want to d define fi a d delegation l i type.ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • EXTENDING AND ADAPTING OBJECT TYPES • DEFINING DELEGATION TYPES ¾ Defining a customer-specific delegation type across the system » » » » » » » Choose Settings ÆDelegation ÆSystem-wide. in the field Object type. Enter the ID of the subtype for the object type in the field Delegation type Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow B i Business Object Obj Builder B ild • EXTENDING AND ADAPTING OBJECT TYPES • DEFINING DELEGATION TYPES ¾ Defining a customer-specific delegation type for a specific frontend » » » On the screen Business Object Builder: Initial Screen. enter the ID of an object type as a frontend-specific delegation type in the field Object/interface type. Choose Settings Æ Delegation ÆFrontend. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can only specify a frontend-specific delegation for an object type if you checked "GUI-specific GUI specific" beforehand for this object type when maintaining system-wide delegation.

ADDITIONAL TOPICS: SAP Business Workflow Tasks and Task Groups Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

– Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . o You have to create new tasks as standard tasks .ADDITIONAL TOPICS: SAP Business Workflow T k Tasks • DEFINITION OF TASK o You use a Task to define an activity that can be executed within a workflow definition or independently (as a single step). This activity can be an SAP System transaction. CREATING A TASK – Choose Tools Æ Business Workflow Æ Development Æ Definition Tools Æ Tasks/Task Groups ÆCreate. Select the relevant elevant task type.

ADDITIONAL TOPICS: SAP Business Workflow T k Tasks • SINGLE STEP TASK – – – – – – – – Maintain names. object type and method Maintain agent assignment Maintain elements in task container Maintain triggering events Maintain terminating events Maintain default rules Maintain description and notification texts Maintain additional data Tab page Basic data Additional data ÆAgent assignment Æ Maintain Container Tab page Triggering events Tab page Terminating events Tab page Default rules Tab page Description Additional data Æ Selection criteria. work item text...Additional data Æ Classification Æ Change Tab page SAPphone. – Maintain SAPphone properties Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

. – Maintain SAPphone properties Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . object type and method Maintain agent assignment Maintain elements in task container Maintain triggering events Maintain description and notification texts Maintain additional data Tab page Basic data Additional data ÆAgent assignment Æ Maintain Container Tab page Triggering events Tab page Description Additional data Æ Selection criteria.Additional data Æ Classification Æ Change Tab page SAPphone..ADDITIONAL TOPICS: SAP Business Workflow T k Tasks • MULTI STEP TASK – – – – – – Maintain names. work item text.

ADDITIONAL TOPICS: SAP Business Workflow Tasks Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

These containers hold standard container elements defined by the workflow system Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . data type reference and other properties • Types of Container ¾ ¾ ¾ ¾ ¾ Method Container Event Container Rule Container Task Container Workflow Container • Usually containers are already defined.ADDITIONAL TOPICS: SAP Business Workflow CONTAINER • The elements of a container are described with ID.

ADDITIONAL TOPICS: SAP Business Workflow BINDING • Values can be assigned to container elements in different ways. V l assignment Value i directly di l to a container i instance i in i the h program of f an application. ¾ ¾ ¾ Value assignment using a binding from another container according to a binding definition carried out previously. This involves specifying p y g the assignment g rules for how data is exchanged g between two containers. Value assignment with an initial value determined at definition time when the container instance is created. • At definition time you create binding definitions for the workflow. At runtime these binding definitions are executed making workflow execution possible Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow BINDING Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

– In the definition of a task » » » There are binding definitions to the: Method container (for import parameters of method) Rule container (for definition of default rules) – In the step definition in the Workflow Builder » The binding definition to the workflow container. document from template. send mail. form step) E ent container (event Event (e ent creator) Rule container (for definition of responsible agents and recipients) Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . There are binding definitions to the: » » » Task container (activity. • Binding Definitions to Workflow Container • You define the bindings g from the workflow container within the Workflow Builder.ADDITIONAL TOPICS: SAP Business Workflow BINDING • Binding Definition from Task Container • You define the bindings from the task container in the following two places. user decision.

Delivering Solution Excellence and Innovation Satyam SAP PMG SAP PMG . » In the definition of a task for the binding definition to the task container (for triggering or terminating events of the task). • Binding Definition from the Rule Container ¾ You make the binding definition from the rule container to the workflow container during the definition of a step. task) » In the Workflow Builder in the basic data of a workflow for the binding definition to the workflow container (for triggering events of the workflow). » In I the th Workflow W kfl B Builder ild i in th the d definition fi iti of f a wait it step t for f the th binding definition to the workflow container. • Binding Definition from Event Container ¾ You define the bindings from the event container in the following three places.ADDITIONAL TOPICS: SAP Business Workflow BINDING • Binding Definition from Method Container ¾ You define the binding from the method container to the task container (for export parameters of the method with synchronous methods) during definition of a task.

ADDITIONAL TOPICS: SAP Business Workflow Workflow Builder Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

If you call the Workflow Builder using a different SAP GUI. fi iti You Y can test t t workflow kfl definitions d fi iti and d generate operable versions. • provides a g graphical p and an alphanumeric p The Workflow Builder p modeling view and also a tree display of the workflow definition • You can only use the graphical modeling view if you are working with the SAPGUI for Windows Windows. and processing i workflow kfl d definitions. the alphanumeric modeling view is displayed automatically Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . displaying.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER • This is the main WebFlow Engine tool for creating.

ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The overview graphic is displayed here. All step types that you can use in the workflow are displayed here if you are in change mode. Changing the size or position of the rectangle changes the display in the screen area Workflow. Double-clicking on a step calls the associated step definition. You can insert a new step using Drag&Drop. The part of the workflow graphic displayed in the screen area Workflow is marked with a green rectangle.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ¾ Workflow ¾ Here you can insert new steps into the workflow definition and process existing ones. This screen area contains the following: ¾ Overview ¾ ¾ Step types ¾ ¾ Objects ¾ Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

In the options in the Workflow Builder. The binding between the task container and the workflow container as well as the other container elements required is generated automatically by the workflow system as far as possible. here You can also define new container elements and generate a where-used list here.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER » » Workflow container All workflow container elements are displayed here. » » Document templates All the workflow's document templates that can be used in steps of the type document from template are displayed here. you can choose not to display the workflow system elements here. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You define which workflows and tasks are displayed here yourself. » » Workflow Wizards All Workflow Wizards that you can use in the definition of your workflow are displayed here. » » T Teamworking ki Here you can search for steps by selected criteria. see Business Workflow Explorer. For more information. The result is displayed graphically in the workflow area. You can use a where-used list to determine the steps in which a document template is used used. » » My workflows and tasks Tasks and workflows that are displayed can be inserted into your workflow definition as activities by double-clicking. You can also go directly to the relevant definition.

This displayed which workflow is loaded in which definition. the status of the respective workflow. and the version number of this workflow in the original system ¾ Messages » ¾ Information » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . which displays all running workflows for this definition.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER » » Workflows of this definition Your Workflow Outbox is displayed here here. All messages generated in where where-used used lists and workflow tests are displayed here. Double-clicking on a message takes you to the relevant step definition. You can go directly to the relevant step definition from the list. ¾ Navigation » The workflow steps are displayed here according to the workflow definition display.

ƒ St t f Start from T Task kD Definition fi iti » » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . The active version of the workflow definition is loaded. choose Goto Æ Workflow Builder Æ Choose version in the task definition. If there is no active version. choose Workflow Builder on the tab page Basic Data. To call another version of the workflow definition. the version with the highest version number is loaded. If you start the Workflow Builder from a screen for processing or displaying a multistep task.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ CALLING THE WORKFLOW BUILDER ƒ Direct Start ƒ Tools ÆBusiness Workflow Æ Development ÆDefinition tools ÆWorkflow Builder . This takes you to a dialog box in which you can choose a version of the workflow definition.

ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Activities • At runtime. Background work item if the activity references a task processed by the system without dialog. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . an activity is represented with a work item of one of the following types: » » » Dialog work item if the activity references a task with dialog. Workflow work item if the activity represents a workflow.

The system creates the variables used within the step definition in the task container and defines a binding from the workflow container to the task container for them Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You define the text and subject of the mail when defining the step. The text to be sent is stored with the task. • This step type replaces the wizard Include "Send mail". • The system creates a task automatically automatically. which sends the mail mail. Y can use variables You i bl i in th the t text. t which hi h are fill filled d from f the th task t k container at runtime.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Mail Transmission • You use this step type to send a mail to different recipients.

th such h as: » Data for deadline monitoring » Outcomes » Responsible p agents g At runtime.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Form Steps ƒ This step type enables you to display or process the data in a container element of the workflow container. a form step is represented by a dialog work item • • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . You can process the form generated to adapt it to suit your individual requirements The maintenance of a form step is spread across several tab pages. A form can be generated automatically by the workflow system. You can process its it properties ti on them. The container element must refer to a structure whose fields are used in the form.

Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . A decision about the p progression g of the workflow must be made in dialog with a user.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of User Decision • In a user decision. An instruction (= user decision with only one decision option) is required to continue the workflow. For approval and release steps. You can use a user decision d i i in i the th following f ll i situations: it ti » » » » Only one of several possible alternatives can be processed in the workflow from a business point of view at execution time. the recipients receive the task description together with the possible decision options during execution. possibly in connection with a secondary method (the latter is possible without the application having to cater for these functions).

You can process properties on them.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Documents from a Template p • You use this step type to create documents of various PC applications and process them within the workflow. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . them such as: » » » Template selection Responsible agents Deadline monitoring g • At runtime. which hi h can also l contain i container i elements l of f the h workflow kfl container • The maintenance is spread across several tab pages. this step is represented by a dialog work item in the Workflow Inbox of its recipients. The work item recipient creates the document based on a document template.

To ensure the consistency of the block structure. The workflow system can make a decision based on the contents of the workflow container without user interaction • The system inserts a step of the type condition into the workflow definition The system adds a branch to the workflow definition for definition.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Conditions • You use a condition in a workflow definition if: » » At execution time. each outcome. from a business point of view. only one of two possible alternatives can be processed during the workflow. all branches created are brought together before the next step of the workflow definition Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The system adds a branch to the workflow definition for each outcome. The decision can be formulated based on a comparison between an expression p from workflow container and a finite amount of comparison values (constants. from a business point of view. The workflow system can make a decision based on the contents of the workflow container. only one of several possible alternatives can be processed during the workflow.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Multiple p Conditions • You use a multiple condition in a workflow definition if: » » » At execution time. To ensure the consistency of the block structure. The system inserts a step of the type condition into the workflow definition. all branches created are brought together before the next step of the workflow definition » Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . expressions).

For this.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Event Creators • Use an event creator if you want to publish an event from a workflow. » As a terminating event of a task. » For internal communication and synchronization Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . the event must be entered as a triggering event for the relevant workflow or task. This event can be used as follows: – – To start other workflows or tasks.

To wait for an event in a parallel processing branch. which renders processing in the other branches unnecessary • At runtime. a wait step is represented by a wait step work item Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Wait Steps • The following shows possible uses of a wait step in a workflow definition: » » To suspend d the h entire i execution i of f the h workflow kfl until il a defined d fi d event has occurred.

ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Container Operations • You use a container operation to change a container element of the workflow kfl container i at runtime i Maintenance of Process Controls • Y use this You hi step type to complete l or cancel l other h work k items i of f the current workflow or the workflow itself at runtime ƒ Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

The decision can be formulated based on a comparison p between an expression from workflow container and a finite amount of comparison values (constants. i The workflow system can make a decision based on the contents of the workflow container. definition i The workflow system can make a decision based on the contents of the workflow container » ƒ Maintenance of While Loops • You use the WHILE loop in a workflow definition if: » At execution time. and then h the h comparison i is i to be b performed f d again. Delivering Solution Excellence and Innovation » » Satyam SAP PMG SAP PMG . the workflow is to "jump back" to process sections of the workflow d fi i i again. expressions). only one of several possible alternatives can be processed in the workflow from a business point of view.ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Until Loops p • You use an UNTIL loop in a workflow definition if: » At execution time with one of two possible alternatives.

ADDITIONAL TOPICS: SAP Business Workflow WORKFLOW BUILDER ƒ Maintenance of Forks • You use a fork in a workflow definition when the business process can be continued by several users at the same time. You can also configure fi th the f fork ki in such h a manner th that t not t all ll branches b h have h to t be b processed . Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

ADDITIONAL TOPICS: SAP Business Workflow Events in Workflow Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Any number of receivers can react to the event Events that you want to use must be defined as components of an object type. Events are published without the creating application knowing whether a receiver reacts to them.ADDITIONAL TOPICS: SAP Business Workflow EVENTS ƒ An event is created from any application program and published system-wide. The event manager checks whether there are active linkages for the published event ƒ ƒ Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

When the event occurs. You can edit existing linkages . – When the event occurs. the task or workflow is started as a response. the task is terminated as a response.ADDITIONAL TOPICS: SAP Business Workflow EVENTS • An event can be used as follows in SAP Business Workflow: • As a triggering event of a task or a workflow. the linkages required are created automatically by the workflow system. Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . • • As a terminating event of a task. – In workflow definition steps of the types event creator and wait for event • If you use events only within SAP Business Workflow.

ADDITIONAL TOPICS: SAP Business Workflow EVENTS • EVENT CREATION • Events can be created in following ways : • • • • • • • Function Module like SWE_EVENT_CREATE Change Documents : Events are created when change documents are written General Status Management : Events creation at status changes Message Control LIS : Event creation when an exception situation occurs Business Transaction Events HR Master Data : Event creation when HR Master data changes • You can used ‘Wizard’ for Event Creation Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

you can specify the binding from the event container to the task container. You define a binding from the event container to the workflow container i in i the h definition d fi i i of f a wait i step.ADDITIONAL TOPICS: SAP Business Workflow EVENTS • EVENT CONTAINER • • The event Th t container t i contains t i the th event t parameters t as container t i elements. The event container contains workflow system elements as standard. You can add more container elements to the event container within object type definition in the Business Object Builder Delivering Solution Excellence and Innovation • • • • Satyam SAP PMG SAP PMG . If you define triggering events or terminating events for a task. If you define triggering events for a workflow. you can specify the binding from the event container to the workflow container You define a binding from the workflow container to the event container in the definition of an event creator.

ADDITIONAL TOPICS: SAP Business Workflow EVENTS • USING LINKAGES • • A linkage defines the assignment of events to the event receivers interested in them The p potential receiver of an event must define the linkage. hi the h event manager carries i out the following steps: • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation . d In I doing d i this. g This can be done using function modules provided or a maintenance transaction The workflow system in the form of the event manager evaluates all ll the h events created.

ADDITIONAL TOPICS: SAP Business Workflow EVENTS Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

You can enter a check function module for the linkage to decide whether the receiver function module should actually be called. The interface of the receiver type function module is described in the documentation for the function module SWE_TEMPLATE_RECTYPE_FB _ _ _ . which executes the actual reaction to the event • Check Function Module • • R i Receiver F Function ti Module M d l • Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .ADDITIONAL TOPICS: SAP Business Workflow EVENTS • Receiver Type Function Module • You can enter Y t a receiver i type t function f ti module d l for f the th linkage li k to t determine a receiver type at runtime . This function module can be used as a template and is stored in the function group SWE_TEMPLATE . The data in the event container can be used for this A receiver function module must be entered for each linkage.

Thank You Satyam SAP PMG SAP PMG Delivering Solution Excellence and Innovation .

Sign up to vote on this title
UsefulNot useful