Escolar Documentos
Profissional Documentos
Cultura Documentos
Objectives
On Completing this course, participants will be able to
Understand the Structure of ABAP Program Work with ABAP Editor Declare Data Types and Data Objects Understand the internal tables and its types Work with internal tables Understand modularization Techniques Use message class Use Open SQL Statements for processing
ABAP Basics
Advanced Business Application Programming
ABAP Processing logic is responsible for processing data in R/3 application Programming
Dialog Module s
Event Blocks
Subroutines
etc..
All Local Class Definition Local Classes are part of ABAP Objects (OO ABAP)
Procedures
Methods Subroutines Function Modules
Authorization Group
Development Class
Can Only Be controlled using Screen Flow Logic Must Start them using a Transaction Code Must Define Your own Screen Contains Dialog module belonging to various Screens Used when the program contains large number of screens whose flow logic determines the Program Flow
Creates in Class Builder Cannot Run using transaction Code or by entering Program name
Application
Contains the short form of application Enables system to allocate the program to correct Business area
Logical Database
Determines the Logical Database used by Executable Program
ABAP Syntax
The following rules in general applies to ABAP syntax
ABAP Programs comprises of individual sentences The first word in the statement is the ABAP keyword Each statement ends with a period (.)
ABAP Program
First ABAP Program
REPORT ZFIRSTPRG. WRITE 'MY FIRST PROGRAM'.
In the above program REPORT and WRITE are keywords. On Execution , this program displays a list on screen which contains a line
ABAP Statements
Chained Statements
Used to concatenate statements The chain operator used is : Example
Statement sequence: WRITE var1. WRITE var2. WRITE var3. Chain Statement: WRITE : var1, var2, var3.
ABAP Statements
Control Statements
Used to control the flow of program within the processing block Examples:
IF, WHILE, CASE
Call Statements
Used to call the processing block Examples:
CALL METHOD , CALL TRANSACTION, SUBMIT, LEAVE TO
D
T
8
6 Hexa Decimal
8
6
00000000
000000
1-65535
X00
Complex Types
Allows to manage and process related data under a single name
The Key
Unique or non-Unique. Identifies Table Rows
Constants Data Objects whose contents cannot be changed Declared Using CONSTANTS Statement. Example: CONSTANTS pi TYPE p DECIMALS 3 VALUE 3.141.
Type C
Length - 1 byte Contains Space Character
Assigning Values
WRITE TO
References
Resets reference variable to initial value, so that it doesnt point to any object
Structures
Resets individual components of a structure to their respective initial values
Internal Tables
Deletes the entire contents of Internal Table
CLEAR var.
Example
DATA number TYPE i VALUE '10'. WRITE number. CLEAR number. WRITE number.
Output : 10 0
Type Conversions
When a Data Object is assigned to a variable the data types involved must be compatible or The source fields data type must be convertible into target fields data type. Two non-compatible data types can be converted to each other if a corresponding conversion rule exists Assignment Rules for Reference Variable The content of a reference variable can be assigned only to another reference variable. Data references can be assigned only to data reference variables Object references can be assigned only to object reference variables. No Conversion takes place during this assignments
The system first converts all the structures concerned to type c fields and then performs the conversion between the two resulting elementary fields
Conversion Rule For Internal Tables Can only be converted into another internal table Internal tables which have internal tables as their line type are convertible if the internal tables which define the line types are convertible.
Numerical Operations
COMPUTE <n> = <expression>. COMPUTE is optional The interpretations of mathematical expressions are in the following order Expressions in parentheses Functions ** (powers) *, / , MOD, DIV (multiplication, division) +, - (addition, subtraction)
Arithmetic Operations
The following arithmetic operators are used in mathematical expressions:
Operator + _ Addition Subtraction Meaning
*
/ DIV MOD **
Multiplication
Division Integer division Reminder of Integer Division Powers
Example: DATA: BEGIN OF RATE, USA TYPE F VALUE '0.6667', FRG TYPE F VALUE '1.0', END OF RATE. DATA: BEGIN OF MONEY, USA TYPE I VALUE 100, FRG TYPE I VALUE 200, END OF MONEY. MULTIPLY-CORRESPONDING MONEY BY RATE. WRITE : MONEY-USA, MONEY-FRG.
" first day of this month " last day of last month
SPA/GPA
Filling an Initial Screen using SPA/GPA Parameters
SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory.
SAP memory allows passing values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions.
Each SPA/GPA parameter is identified by a 20-character code which is maintained in the Repository Browser in the ABAP Workbench.
The values in SPA/GPA parameters are user-specific.
SPA/GPA (Contd.).
Filling an Initial Screen using SPA/GPA Parameters
ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
To fill one, use: SET PARAMETER ID <pid> FIELD <f>. This statement saves the contents of field <f> under the ID <pid> in the SAP memory. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
SPA/GPA (Contd.).
Filling an Initial Screen using SPA/GPA Parameters To read an SPA/GPA parameter, use: GET PARAMETER ID <pid> FIELD <f>. This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0. To fill the initial screen of a program using SPA/GPA parameters, use the SET PARAMETER statement. On a selection screen, link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECTOPTIONS statement.
ABAP Memory
ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
Control Structures
Controlling the Program Flow
Logical Expressions
Operand1 operator operand2 Several Logical Expressions can be linked together with a condition
Loops
Unconditional loops using the DO..ENDDO. Conditional Loops Using the WHILE .ENDWHILE.
Loops
Terminating Loops
Terminating Loop Pass Unconditionally
CONTINUE
EXIT
Character Strings
Processing Character Strings
FIND
FIND [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern IN dobj.
REPLACE
REPLACE [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern IN dobj WITH new
TRANSALATE
CONDENSE
Field Symbols
Placeholders or symbolic names for a Data Object. To Access Data Objects Dynamically in ABAP Programs Do not Physically reserve space for a field but points to its Contents Can point to any Data Object Allows the access of Data Objects whose name and attributes are not known till runtime
DATA: WA TYPE LINE, ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1, KEY(4) VALUE 'COL1'. FIELD-SYMBOLS <FS> TYPE ANY TABLE. ASSIGN ITAB TO <FS>. READ TABLE <FS> WITH TABLE KEY (KEY) = 'X' INTO WA.
To assign a data object to a field symbol, use the ASSIGN statement ASSIGN <f> TO <FS>.
When the data object is assigned, the system checks whether the technical attributes of the data object <f> correspond to any type specifications for the field symbol <FS>.
SKIP
Simple Reports
WRITE Statement
The basic ABAP statement for displaying data on the screen is WRITE.
WRITE <f>.
Syntax
Output is left-justified. Output is centered. Centered Right-Justified Output is right-justified. Output starts directly under field Under <g> <g>. The blank after field <f> is omitted. NO-GAP Specifies format template <m>. Using Edit Mask(m) Using No Edit Deactivates a format template
Example
INCLUDE <symbol>. INCLUDE <icon>. WRITE: / 'Telephone symbol:', sym_phone AS SY MBOL. WRITE: / 'Alarm icon: ', icon_alarm AS ICON.
Drawing Lines
Horizontal lines ULINE [AT [/][<pos>][(<len>)]]. WRITE [AT [/][<pos>][(<len>)]] SYULINE. WRITE [AT [/][<pos>][(<len>)]] '-----...'. Vertical Lines
To layout a Page Header the event keyword TOP-OF-PAGE must be defined. The TOP-OF-PAGE event occurs as soon as the system starts processing a new page of a list The system processes the statements following TOP-OF-PAGE before outputting the
If the <width> is set to zero, the system uses the width of the standard list.
Page length of an output list, is determined using the LINE-COUNT option of the REPORT statement.
Messages
Single texts stored in table T100 Maintained in Transaction SE91 Provides a way to communicate with the user Mostly used for error handling
Messages (Contd.).
The message class and number are used to identify the message in table T100. The message types are one of the following:
A E I S W : Termination Message : Error Message : Information Message : Status : Warning
Messages Statement
Using a Global Message Class
MESSAGE tnnn [WITH f1 ... f4] [RAISING exc].
Messages - Examples
MESSAGE i001(zmsgs).
Selection Screen
Selection screens are a standardized user interface. It is used when the user has to give data input. Input parameters are primarily used to control the program flow, while users can enter selection criteria to restrict the amount of data read from the database.
Enables the user to enter values for single fields on the selection screen Each parameter declared with the PARAMETERS statement appears as an input field on the relevant selection screen. PARAMETERS p[(length)] [TYPE type|LIKE obj] [DECIMALS d].
The data type of an internal table is usually a Structure Each component of a structure is a column in internal table
Records are accessed by index or keys The response time for key access is proportional to number of entries The key is always non-unique
Records can be accessed by table index or key Uses Binary Search for access
Like all other data objects, declare internal table objects using the LIKE or TYPE addition of the DATA statement.
DATA <itab> TYPE <type>|LIKE <obj> [WITH HEADER LINE]. Here, the LIKE addition refers to an existing table object in the same program.
Use it as a work area when working with the internal table. When using internal tables with header lines, the header line and the body of the table have the same name. If there is an internal table with header line, to address the body of the table, place brackets after the table name
The entire body of the table is addressed as a single Data Object The following operations are done on the entire Internal Table
Assigning Internal Tables Initializing Internal Tables
Example:
DATA : it_mat LIKE TABLE OF str_mat, it_mat1 LIKE TABLE OF str_mat. str_mat-matno = 'm01'. str_mat-matname = 'Notepads'.
REFRESH itab
This always applies to the body of the table. With REFRESH, too, the initial memory
While accessing individual table entries, the data in the table is not directly accessed but through another Data Object like a Work Area Work Area is an interface to the entries in the Internal Table Work Area must be compatible with the line type of
A line of the Internal Table is assigned to the Field Symbol i.e., the Field Symbol will have the same line type as the Internal Table Once an entry is assigned to the Field Symbol, working with it is like accessing the line of the Internal Table directly.
INSERT wa INTO TABLE itab. To Append Rows to the Internal Table APPEND wa TO itab.
Sorted Tables
The lines are inserted into the table according to the table key
Inserting Lines
Inserting Several Lines
To insert several lines into the internal table use
INSERT LINES OF itab1 [FROM n1] [TO n2] INTO TABLE itab2.
Appending Lines
Appending a Single Line
APPEND line TO itab.
If the system finds an entry it sets the system field SY-SUBRC to 0 and if not, it sets the value to 4.
The sequence in which lines are processed depends on the table type
Standard and Sorted Table
The lines are processed according to linear index
After the ENDLOOP, SY-SUBRC = 0 , if at least one table entry is processed. The loop may not contain any operations which may change the contents of the entire table
Changing Lines
Changing Lines of an Internal Table
MODIFY TABLE itab FROM wa [TRANSPORTING f1 f2 ...].
Deleting Lines
DELETE TABLE itab FROM wa.
Deletion Using Table Key
DELETE TABLE itab WITH TABLE KEY k1 = f1 ... kn = fn.
Within the processing block of the loop, the control level statement AT is used to react to a control level change
Control Level Statements are used to react to control breaks in internal tables instead of programming them with logical expressions According to the hierarchy of the control levels , the AT-ENDAT statements must be placed within the Loop. All character fields to the right of the
Open SQL
Subset of Standard SQL Enable the ABAP programs to access data irrespective of the database system installed Open SQL consists of the Data Manipulation Language (DML)
Native SQL
Loosely integrated into ABAP Allows access to all of the functions contained in the programming interface of the respective database system Native SQL statements are not checked and converted, but sent directly to the database system
Open SQL
Open SQL consists of a set of ABAP statements that perform operations on the central database in the SAP Web AS ABAP Open SQL provides a uniform syntax and semantics for all of the database systems supported by SAP ABAP programs that only use Open SQL
DELETE OPEN
sy-dbcnt
Defines the structure of a result set which is to be read from the database A single SELECT statement can perform functions ranging from simply reading a single line to executing a very complicated database query Aggregate functions can be applied to individual columns.
SELECT * INTO CORRESPONDING FIELDS O F wa FROM spfli WHERE carrid EQ 'LH'. WRITE: / wa-carrid, wa-connid, wacityfrom, wa-cityto.
SELECT lines agg( [DISTINCT] s1) [AS a1] agg( [DISTINCT] s2) [AS a2] ...
MAX: supplies the maximum value of the column MIN: supplies the minimum value of the column AVG: supplies the average value of the column
Example
DATA: average TYPE p DECIMALS 2, sum TYPE p DECIMALS 2. SELECT AVG( luggweight ) SUM( luggweight ) INTO (average, sum) FROM sbook.
:', sum.
Examples
DATA: itab TYPE STANDARD TABLE OF spfli, wa LIKE LINE OF itab. DATA: line(72) TYPE c, list LIKE TABLE OF line(72). line = ' CITYFROM CITYTO '. APPEND line TO list. SELECT DISTINCT (list) INTO CORRESPONDING FIELDS OF TABLE itab FROM spfli.
Example
SELECT SINGLE carrid connid cityfrom cityto INTO CORRESPONDING FIELDS OF wa FROM spfli WHERE carrid EQ 'LH' AND connid EQ '0400'.
IF sy-subrc EQ 0. WRITE: / wa-carrid, wa-connid, wa-cityfrom, wacityto. ENDIF.
Example:
Open SQL
Values in Intervals
SELECT... WHERE s NOT BETWEEN f1 AND f2...
Negating Conditions
SELECT... WHERE NOT cond... Linking Conditions
Example
DATA: cond(72) TYPE c, itab LIKE TABLE OF cond. PARAMETERS: city1(10) TYPE c, city2(10) TYPE c. DATA wa TYPE spfli-cityfrom. CONCATENATE 'CITYFROM = ''' city1 '''' INTO cond. APPEND cond TO itab. CONCATENATE 'OR CITYFROM = ''' city2
To use the GROUP-BY clause, all of the relevant columns in the SELECT clause must be specified.
Example
The HAVING clause uses conditions to restrict the number of groups selected. The HAVING clause can be used only in conjunction with the GROUP-BY clause.
SELECT lines s1 [AS a1] s2 [AS a2]... agg sm [AS am] agg sn [AS an]... GROUP BY s1 s2.... HAVING cond.
UPDATE <target> SET <set1> <set 2> ... [WHERE <cond>]. UPDATE <target> FROM <wa> .
UPDATE <target> FROM TABLE <itab>.
COMMIT WORK always concludes a database LUW and starts a new one ROLLBACK WORK always undoes all changes back to the start of the database LUW.
Native SQL
Native SQL statement begins with the EXEC SQL statement, and ends with the ENDEXEC statement.
Modularization Techniques
ABAP programs are modular in structure and made up of processing blocks Two kinds of processing blocks
Called from outside a program by ABAP runtime system
Event Blocks Dialog Modules
The modularization of ABAP programs in event blocks and dialog modules serves for general execution of ABAP programs
Dialog Modules
Procedures
Contains a set of statements, and are called from other ABAP programs Procedures are defined in ABAP Programs When the program is generated, they remain as standalone modules. Procedures have an interface for passing data, and can also contain local data.
Subroutines
Used for local modularization Generally called from the program from which it is defined Use subroutines to write functions that are used repeatedly within a program Defining Subroutines
Subroutines - Example
FORM header. WRITE: / 'Program started by', sy-uname, / 'on host', sy-host, 'date:', sy-datum, 'time:', sy-uzeit. ULINE. ENDFORM.
The USING and CHANGING additions in the FORM statement define the formal parameters of a subroutine
When a subroutine is called, all formal parameters must be filled with the values from the actual parameters
At the end of the subroutine, the formal parameters are passed back to the
Subroutines (Contd.).
Subroutines has the following formal parameters
Parameters Passed by Reference Parameters passed by Value
Subroutine - Example
DATA: num1 TYPE i, num2 TYPE i, sum TYPE i. num1 = 2. num2 = 4. PERFORM addit USING num1 num2 CHANGING sum. num1 = 7. num2 = 11. PERFORM addit USING num1 num2 CHANGING sum. FORM addit USING add_num1TYPE any add_num2 TYPE any CHANGING add_sum TYPE any. add_sum = add_num1 + add_num2. PERFORM out USING add_num1 add_num2 add_sum.
Function Modules
Function modules are procedures that are defined in special ABAP programs called function groups
Function groups act as containers for function modules that logically belong together.
Function groups and function modules are created in the ABAP Workbench using the
Function Groups
Function groups are containers for function modules Function Groups cannot be executed When a function module, is called the system loads the whole of its function group into the internal session of the calling program
Function Modules
INCLUDE L<fgrp>TOP.
FUNCTION-POOL <fgrp> TABLES : .. TYPES:..... DATA:. INCLUDE L<fgrp>U01. INCLUDE L<fgrp>U02. INCLUDE L<fgrp>U03. FORM .. .. ENDFORM.
INCLUDE L<fgrp>UXX.
INCLUDE L<fgrp>F<xx>.
INCLUDE.
Include Programs
Exception Handling
Exception handling is the integral part of the designing the application. By raising the exception, we are providing the opportunity to the Caller program to handle the exception in its own way. When creating a reusable component like the Function Module,
Create the exception,
To help implement RFC partner programs in non-SAP Systems, SAP provides External Interfaces
When the Function Module is created, the Process Type Attribute is set to
Start Immediately
Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions can be restarted by the update task in case of errors.
Macros
When the same set of statements has to be reused more than once in a program, it can be included in a Macro.
Macros Example
DATA: result TYPE i, n1 TYPE i VALUE 5, n2 TYPE i VALUE 6. DEFINE operation. result = &1 &2 &3. output &1 &2 &3 result. END-OF-DEFINITION. DEFINE output. write: / 'The result of &1 &2 &3 is', &4. END-OF-DEFINITION.
Include Programs
They are global R/3 Repository objects The functions of Include Programs are
Library
It allows the usage of same source code in different programs
Order
Naming Standards
The names of specific developed objects are identified, at the beginning of the word (mostly), by characters Y or Z.
First character Y is reserved for Core system First character Z is reserved for Local systems
When standard SAP object will be copied, original name will be preceded by Y for a core development and Z for a local one.
Packages allow a grouping of development objects and facilitate the configuration management.
Data Dictionary
Data Dictionary
Data Definitions are created and Managed in ABAP Dictionary Describes the logical structure of objects use in application development Provides standard functions for editing fields on screens
ABAP Dictionary
Object Types in ABAP Dictionary are
Tables
Defined in Dictionary Independent of Database
Views
Logical Views
Types
Data elements Structures Table Types
Domain
Data Dictionary
Integration in ABAP Workbench
DEVELOPMENT ENVIRONMENT
ABAP Tools Data Modeler Screen Painter
ABAP Dictionary
ABAP Interpreter
Dialog Control
Interfaces .
Screen Interpreter
Data Dictionary
Integration with ABAP Runtime Environment
Changes can be made to the Dictionary Objects before being activated Objects can both be Active and Inactive in the ABAP dictionary Inactive Objects have no effect on runtime System
Basic Objects
Domain
Contains Technical Characteristics of a Field
Field Length
Data Type
Domain
Fixed Values
Used to restrict the values in the Domain Used in input check in screen templates If no other help is defined in field, Fixed Values are offered in F4 help. Value Range or Intervals can be defined by specifying the upper and lower limits
Domain
Fixed Values
Fixed Values are defined only for the following data types
CHAR NUMC DEC INT1 INT2 INT4
Domain
Relationship between Field, Data Element and Domain Data Type and Field Length are consistent
TABLE 1 TABLE 2 TABLE 3
DATA ELEMENT 1
DATA ELEMENT 2
DOMAIN
Tables
Value Tables
When a domain is defined, all the table fields or structure component referring to this domain can be checked against a table, the Value Table
A check is not implemented by simply entering a value table. The check against the value table only takes
Data Elements
Specifies the Semantic Characteristics of a Field Describes an elementary type or a Reference Type
Elementary type is defined by built-in data type and length These attributes can be defined directly or
Data Elements
Contains Field Label
Field Labels are used to display a screen field
F1 Documentation
The text appearing in the Field Help (F1 Help) comes from the documentation If there is no Documentation, the short text
Tables - Introduction
Defined Independent Of Database Fields are defined with Data types and Length On activation of the Table, a physical table definition is created in the database Table Types
Transparent Tables
Transparent Tables
One-to-one relationship with tables in database Most commonly Used Holds Application data
Master data or Transaction data Used by an application
Pooled Tables
Many-to-One Relationship with the table in Database SAP Proprietary Construct Stored in a Table Pool
Table Pools Hold large number of small Tables
A D
C E F
Var Key
DataLn
Vardata
Key
Data
Cluster Table
Many-to-One relationship with table in database Cluster tables are stores in Table Cluster in Database Used when the tables have a part of Primary Key in common
Tables
Components
Table Fields
Technical Settings
Foreign Keys Indexes
Table Fields
Field Name
Should begin with an Alphabet
Key Flag
Determines the Primary Key
Field Type
Data Type
Short Text
Technical Settings
Data Class
Defines the physical area of the database in which tables should be created
Size Category
Defines the Expected Space for the table in the Database
Buffering Permission
Define whether and how a table is buffered
Buffering Type
Full-Buffering
When to Use
Tables up to 30KB Table Accessed Frequently Most Read Access
Types
Generic Buffering
When to Use
When Certain areas of table are normally used for processing Client-Specific Tables Language Specific Tables
Types
When to Use
Select SINGLE is used mostly Record Size Between 100 200 KB
Tables - Transparent
Creation of Tables
Top-Down Approach
Table is first created Domain and Data element are created after creation of Table Easier to Use
Bottom-Up Approach
Domain and Data element are created More intuitive for first timers Cumbersome
Key Fields must be stored at the beginning of the field list Non-Key fields may not occur between two key fields Maximum of 16 key fields per table is allowed
The same process as BOTTOM-UP is followed except for the order of execution Create Table in SE11. Specify Field name and a Data Element( which is yet to be created) Double click on the new Data Element Name
Indexes
Copy of Database Table reduced to certain fields Always in sorted form Provides faster access to data records Contains a pointer to corresponding record of actual table
Tables
Indexes
The Primary index of the Table
Tables - Index
Secondary Index
Created if the table is frequently accessed using fields which is not a part of primary key Index distinguished with a three place identifier For certain database systems, the index improves performance
Tables - Index
Secondary Indexes
Only Few indexes should be there in tables where the entries are frequently changed The database system does not use suitable indexes for selection even if there is one The index used depends on the optimizer used for the database system Creating an additional index might have side
Tables - Buffering
Important in client/server environment Buffers reside in each application server Improves Performance
Buffer Synchronization
If Program changes data in a table on Application Server, it is noted in log table by Database Interface
Buffering Tables
Only Transparent and Pooled Tables Table that is frequently read and rarely changed The key fields of the buffered table should of the Character data types ( C, N, D, T) By pass the buffer if table data should be read from Database
Select DISTINCT ..
Select . WHERE . IS NULL
Foreign Keys
Defines Relationship between Tables Create Value Checks for input fields Link several tables in a view or a Lock Object
Field 2
Field 3
Field 4
Primary Key
Value Table
Domain Level Data Validation Maintained as a customization Object The contents of Value Table are not used in Input Help.
All table fields referring to the domain which has a value table can then be checked against the corresponding field of this value table. For this check to be
Tables
Text Tables
The table has a additional key field of type Table B Key Fields K1, K2 LANG
K 1 K 2 F 1 F 2
Text Table A for B Key Fields k1, k2 and L (Type Lang)
1 1 1 2 X X Y Y Y Y X X
K 1
K L 2
TEXT
1 1 1 1 1 2 D E E N D E Text 1 ( German) Text 1 (English) Text 2 (German)
Tables
Table Types
Describes the Structure and functional attribute of an internal table in ABAP DATA statement in ABAP is used to Reference the table type
A user interface tool which is used to change the entry of the table or delete an entry from the table or create an entry for the table.
To make this feature work care should be taken while creating the database table that in the 'Delivery & Maintenance' tab, the 'Table View Maint.' should have the "Maintenance allowed" property defined.
Choose the table in SE11 for which Table Maintenance Generator is to be defined.
Maintenance Type
In the Maintenance Screen, the Maintenance Type can be
One Step
One Screen is created for Table Maintenance In SM30, after specifying the table name, the overview screen is displayed and when choosing New Entries, the records are entered in the same screen Multiple records can be entered at the same time Generally used as it is user friendly
About Structures
Structures
Contains Fields
Types :
Flat Structures
Creating Structures
Maintain Foreign Keys if required Save Activate the Structure
Includes
To add fields of another structure in Tables or Structures Structure
Includes Tabl e
F3 F4
F F F F F 1 2 3 4 5
F1 F2 F3 F4 F5
Database
Structures
Only Flat Structures can be included A Structure can be included more than once The field name of the structure should not be longer than 16 places
Append Structures
Append Structures
Used for Table Enhancement
About Views
View is data derived from one or more tables Used in ABAPView Program for data selection on tables Data is not stored physically
F1 F2 F3 F4 F5 F6 F7 F8
F1 F2 F4 F7 F8
Table T1
Table T2
Table T3
Types of Views
Database View Projection View Maintenance View
Help View
Database View
Provides application specific view on data distributed in tables Created in the database accessed using Open SQL and Native SQL If there is only one table in the view , write access is possible
Projection View
Used to hide fields of a table Contains exactly one table Selection conditions cannot be defined
Pooled and Clustered tables can be accessed as the projection view is not stored in the database
Maintenance View
Allows To maintain data of an Application Object All the tables in this view must be linked with foreign keys Join Conditions cannot be directly specified
Help View
Created if a view with outer join is needed as selection method of search help All tables in help view must be linked with foreign Key Implements Outer Join
Selection Method
Selection Method
Possible input values are determined at runtime by database selection If the values are from a single table, the corresponding table is selected as selection method If the values are from multiple tables, they must be linked with a view (Database or Help
Locks are set and released by calling Function Modules, which are automatically generated from the definition of lock objects
Lock Arguments
Lock Mode
A lock mode can be assigned to each table in the lock object Lock mode
Defines how the users can access the locked records of the table Write Lock
Locked Data can be displayed or edited by a single user. Can be requested several times from the same transaction and are processed successively
Lock Objects
Creating Lock Objects (Contd.).
Specify the lock mode
Save
Activate The Function modules get automatically generated.
Introduction
Data is transferred from an external system into the SAP R/3 System Data Transfer is used when,
Transfer data from an external system into an R/3 System as it is installed. Transfer data regularly from an external system into an R/3 System.
BDC
Programming technique for loading data into SAP BDC is a combination of ABAP/4 Programming and built in SAP functionality Simulates the act of a user entering data into an SAP transaction.
Why BDC?
When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a nodata situation A SAP R/3 project comes in to replace or complement to an existing application. In the process of replacing current application and transferring application
A data transfer method is required that transfers the data automatically in the background without user intervention.
BDC is a very good answer to this problem.
Non SAP.
SAP
Inbound. Non-SAP
SAP
There are three ways to transfer the data into SAP from any external system.
SESSION METHOD CALL TRANSACTION DIRECT INPUT.
SESSION Method and CALL TRANSACTION are called as BATCH INPUT Methods
Analyzing Transaction
Declaring Internal Tables Transferring Data From Flat Files into internal Tables Population of BDCDATA into Internal Table
Analyzing Transaction
The following steps are involved in Analyzing transaction
The name, Type and length of the field Screen number and name of the module pool program Determine the mandatory fields
If the flat file resides on the presentation server the function module GUI_UPLOAD is used.
If the file is residing on the application server, the following statements are used :
OPEN DATASET for opening files
OPEN DATASET <dsn> [Additions]. OPEN DATASET <dsn> FOR INPUT.
After uploading data to internal table, the BDCDATA internal table is filled with values required to process single record .
Loop
Loop this internal table and employ any of the below mentioned methods of data transfer
CALL TRANSACTION
CALL TRANSACTION <tcode> USING IT_BDCDATA MESSAGES INTO IT_BDCMSGCOLL
SESSION METHOD
The Conversion program uses the ABAP statement CALL TRANSACTION USING to run an SAP transaction
External data does not have to be deposited in a session for later processing.
The entire batch input process takes place inline in the program.
MESSAGES INTO
<BDCMSGCOLL_TAB>.
Where
<tcode> : Transaction code. <bdc_tab> : Internal table of structure BDCDATA.
BDC
After the BDC table has been built, it has to be submitted for SAP Processing Once the SAP data structure has been determined
Determine which fields can be transferred directly from the existing data. There is a direct match between an existing
S - Synchronous updating.
The called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. The called transaction will return any update error message that occurs to the program.
In Call transaction there is no such log file available and error record is lost unless handled.
Values Explanation 0 Successful The MESSAGES specification indicates <=100 Error in Dialog Program that all system messages issued during a 0
Session Method
The second way of data transfer is by submitting the BDC session to the system for batch processing.
The data that a session enters into transaction screens is subject to the same consistency checking as in normal interactive operation.
Batch input sessions are subject to the
Asynchronous processing
Generate the batch input session using function module BDC_OPEN _GROUP. BDC_OPEN_GROUP has the following Export Parameters:
CLIENT
Client in which the session is to be processed
GROUP
Name of the session to be created
Use function module BDC_INSERT to transfer the transaction and the IT_BDCDATA to the session.
Processing Session
A batch input session is a set of one or more calls to transactions along with the data to be processed by the transactions.
The system normally executes the transactions in a session non-interactively, allowing rapid entry of bulk data into an R/3 System.
A Session can be processed in two ways:
In most cases, batch input sessions can be processed automatically. It is not necessary for a session to wait until a system administrator explicitly starts the processing of the session. The ABAP program RSBDCSUB must be scheduled as a periodic job in the R/3 background processing system.
Procedure
Schedule RSBDCSUB to run periodically in one or more background jobs. If there are batch input scheduled to run regularly, separate jobs can be scheduled for each of the scheduled data transfers. The start time for the RSBDCSUB job can be set according to the batch input schedule.
Session name
Date and time of generation Status : ready to run or held in the queue because of errors
Running a batch input session executes the transactions in the session and enters data into an R/3 System.
Usually, the system will run batch input sessions automatically. However, it can also be started manually for the following reasons:
To correct transactions that had errors
Procedure
To start the session, mark the session and choose PROCESS from the toolbar Choose how to run a session and with what logging and display options Run Modes
There are 3 ways to run a session
BDC
Process/foreground:
Transactions that contain errors can be corrected and step through transactions that have not yet been executed.
Session Status
Sessions in the session queue are sorted by date and time of generation and are grouped in different lists according to their status. Possible statuses are as follows:
New:
Session was created and recorded but not yet processed.
Incorrect :
Status
Processed:
It refers to all those sessions that have been successfully run. The log generated can be displayed by the session. All completed sessions generate a log. A completed session cannot be run a second time.
Note:
Status (Contd.).
In Background:
This status appears only if the Session is processed in the Background Mode
Being Created:
This status is seen only if the queue is displayed while a session is being generated
RMDATIND
RVAFSS00 RAALTD11 RKEVEXT0
MM
SD AM CO-PA
To handle the variation in number of rows, the following things has to be taken care of.
To handle it, use the following steps:
Get the complete flat file entries in to a dummy table Differentiate the header data and item data using offset functionality
LSMW - Introduction
Legacy System Migration Workbench An R/3-based tool that supports when transferring data from non-SAP systems ("Legacy Systems") to SAP systems once or periodically The tool supports conversion of data of the legacy system in a convenient way.
The LSM Workbench was developed on the basis of the R/2R/3 Migration Workbench
Advantages of LSMW
It is a part of the SAP system and thus independent of individual platforms A variety of technical possibilities of data conversion:
Data consistency due to standard import techniques
LSMW - Procedure
Project
An ID to name the data transfer project
Sub Project
An ID used as a further structuring attribute
Object
An ID to name the business object
LSMW - Procedure
The following screen is displayed on choosing the overview
Define the structures of the object with name, description and the hierarchical relationships
Fields are created and maintained for the structures defined in the preceding step.
The structural relationships define the relationships between source and target structures. Since there is only one source and target, the relationship is maintained
Assign source fields to target fields and define how the field contents will be converted.
Displays a short documentation for the target field the cursor is positioned on. The documentation may branch off to further information.
Possible values:
Displays a selection list of all values possible for this target field.
Longtext / Documentation:
Maintain Fixed Values, Translations and User-written Routines Fixed value: Here you can specify length,
type, flag for lowercase/uppercase and value in addition to the description. Translation values: Here you specify the value table to be used during translation. The values can be uploaded from a PC file.
Process the reusable rules of a project
Specify Files
This step describes all files to be used in the following steps:
Legacy data on the PC and/or SAP server The file for the read data The file for the converted data If legacy data is on the PC:
In change mode, position the cursor on the line "Legacy data on PC (frontend)". Select Add entry. A popup is displayed. Specify file path (F4 help), file name and
Read Data
Can display all or a part of the read data in table form . To process all data belonging to an object, click on Execute. To migrate a part of the data only, limit the number of data to be migrated in field "General selection parameters". Make the selection in field "Transaction number"
Convert Data
With regard to operation, this work step essentially corresponds to work step "Read Data".
If data selection is not to be made, confirm the process by clicking on Execute. Otherwise, make the selection in field "Transaction number" from "...to...". Here, multiple selection of transaction numbers is possible as well.
Import Data
The steps displayed by the program depend on the selected object type:
Standard batch input or recording:
Generate batch input session Run batch input session
BAPI or IDoc:
The standard batch input program belonging to the object is directly called. The name of the file with the converted data is already proposed. The batch input sessions to be generated are named after the LSMW object.
LSMW Procedure
Run Batch Input Session
The program goes to SAP standard transaction SM35. Follow the procedure to run the session (which is already discussed in the Session method)
Data stored in a file by means of the IDoc technique is generally imported in two steps.
Screens Introduction
Screen is a repository object and is a component of ABAP Program Screen consists of input/output mask and the screen flow logic Screen is also called Dynpro which is Dynamic Program
The screens in a single ABAP program can be combined to form screen sequences
PAI event
Processed after a user action on screen
PBO
SCREENS
PAI
Screen
Same Names
SCREENS
PBO
PAI
Modules
Modules
The screen flow logic calls dialog modules in the ABAP program,
to prepare the screen for display or to process the user's entries
Screens are dynamic programs, and have their own data objects, called Screen Fields.
Each screen has a GUI status, containing a menu bar, standard toolbar, and an application toolbar.
Like screens, GUI statuses are independent components of the ABAP program.
They are created in the ABAP Workbench using the Menu Painter.
Screen Elements
Screen Elements are created using the screen painter (tcode SE51). There are different ways to access the screen painter.
From ABAP Development Workbench. From ABAP editor
Screen Fields
Screen Fields are Fields in the working memory of a screen Their contents are passed to identicallynamed fields in the ABAP program in the PAI event, and filled from the same identically-named fields in the program in the PBO event. The screen fields are linked with the
Event Blocks
The following screen Keywords can be used in theDescription event blocks: Keywor
d
MODULE Calls a module in ABAP Program Specifies the point at which the FIELD
contents of a screen field should be transported
ON
VALUES Used with FIELD Starts a Processing Chain CHAIN ENDCHA Ends a Processing Chain IN
Processing Screens
Two ways of calling a screen
Using a Transaction Code
When a screen is called, the PBO event is called and the corresponding event block in the screen flow logic is processed.
Processing Screens
If the OK_CODE field in the element list has a name, it is filled with the corresponding function code when the user chooses the function If the OK_CODE field does not have a name, the PAI event is still triggered, but there is no screen field into which the function code can be passed.
All input/output fields have a name linking them to a screen field. The data type of the screen field determines the input format Radio buttons and checkboxes always have the data type CHAR and length 1. A selected radio button or checkbox has the value X, when empty, both have the value
The fields can be copied from the Dictionary to be used on the screens
The fields can refer to both Structures and Database tables The advantage of referring to ABAP Dictionary data types is that both the screen fields and the fields in the ABAP program are updated automatically if the
In each PAI event, the function code, as long as it is not empty, is placed in the system field SYST-UCOMM (SY-UCOMM) and assigned to the OK_CODE field.
Empty function codes are placed in neither
Checkboxes and radio buttons without a function code behave like normal input/output fields
Clicking the object , changes the contents of the field, but does not trigger the PAI event.
When a function code is assigned to a checkbox or radio button, clicking it not
GUI Status
It is an independent component of an ABAP Program It is created in the ABAP Workbench using the Menu Painter The function of a GUI status is to provide the user with a range of functions on a screen
Function Codes
Empty Function Codes P A I Non-Empty Function Codes P P A A I I OK_CODE Field P P A B I O OK_CODE Field
Screen P B O
SYSTUCOMM P A I
ABAP
SY-UCOMM
OK_CODE Field
The OK_CODE field in an ABAP program is initialized for the following reason:
The OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event Therefore, the OK_CODE field must be
The Dialog modules in an ABAP program can be called from more than one screen, the functions that is required in several screens can be centrally programmed in a single module. The main task of the screen flow logic is to call dialog modules in an ABAP program To distinguish between screen numbers in
In the PBO event, the statement used to call any dialog module in the ABAP program that has been defined is MODULE <mod> OUTPUT. ... ENDMODULE.
In the PAI, POH, and POV events, the statement to call any dialog module in the ABAP program that has been defined is
There are special function codes with a special module call which calls the module irrespective of the user entry on screen
PAI module is called when several screen fields meet a particular condition The module calls are combined in a flow logic to form a processing chain CHAIN. FIELD: <f1>, <f 2>,... MODULE <mod1> ON CHAIN-
Input Checks
Checks user input for consistency and validity Automatic Input Checks
Called in the PAI event before data is transported to the ABAP Program and before dialog modules are called
Input Help
Provides the list of possible entries in a field Three techniques for input help are
Definition in the ABAP Dictionary Definition on a Screen
The FIELD statement with one of the additions VALUES or SELECT.
Few attributes of the screen elements which are set statically in the screen painter can be overridden in ABAP Programs with special Internal Tables The following modifications can be done dynamically
Setting Attributes Dynamically
A subset of the attributes of each screen field can be addressed using the system table SCREEN
SCREEN is like an internal table with header line which need not be declared in the program
Screen table cannot be displayed in the debugger
Processing Screens
The statements that can be used in screens
LOOP AT SCREEN. ... MODIFY SCREEN. ... ENDLOOP. For the components of the SCREEN table except for length, 1 represents active and 0
Status Icons
Display elements that represents a state of program graphically Status icon is created in the graphical Screen painter When status icon is created , a place holder appears on the screen
Context Menus
The user interface is defined by a GUI status designed using the Menu Painter and assigned the type Dialog Status.
For each dialog status, the system automatically creates a standard context menu, which the user can display by clicking the right-hand mouse button on the screen (or choosing Shift+F10 ).
Subscreens
Embedding one screen within another Subscreen area is an area in the main screen where a Subscreen is placed When using a Subscreen, the flowlogic of the Subscreen is also embedded in the flowlogic of the main program
Subscreens
To use a Subscreen,
Define the Subscreen area(s) on a screen
Defining Subscreens
Defining Subscreen area
Subscreen area is defined using the screen painter in the layout of the screen
TabStrip Controls
A screen object that contains 2 or more pages Each tab page consists of a tab title and a page area Tabstrip controls allows to place a series of screens belonging to an application on a single screen, and to navigate between them easily
Creating a TabStrip
Define the tab area on a screen and the tab titles.
Designed in the Screen Layout
Two ways of programming screen flow logic depending on the Tabstrip control Paging in SAPgui
Every Subscreen area has its own Subscreen.
PROCESS BEFORE OUTPUT. CALL SUBSCREEN: <area1> INCLUDING [<prog 1>] <dynp 1>, <area2> INCLUDING [<prog 2>] <dynp 2>, <area3> INCLUDING [<prog 3>] <dynp 3>,
The only component of the control which is used in the program is ACTIVETAB
In the PBO Event
To activate the tab page asssign the function codes to the component ACTIVE TAB
<ctrl>-ACTIVETAB = <fcode>.
The PAI event is not triggered when the user chooses a tab title, and the OK_CODE field is not filled The OK_CODE field is only filled by user actions in the GUI status or when the user chooses a pushbutton either outside the Tabstrip control or on one of the subscreens.
Table controls
ABAP offers two mechanisms for displaying and using table data in a screen.
Table controls Step loops.
Table controls and step loops are types of screen tables that can be added to a screen in the Screen Painter.
Loop Statement
Two Forms of Loop statement
LOOP
This statement loops through screen table rows, transferring the data in each block to and from the corresponding ABAP fields in the program. The screen table fields may be declared in ABAP as anything (database table, structure or individual fields) except as internal table fields.
Step Loops
A step loop is a repeated series of fieldblocks in a screen. Each block can contain one or more fields, and can extend over more than one line on the screen. Step loops as structures in a screen do not have individual names. The screen can contain more than one step loop, but if so, it must be programmed
The LEAVE SCREEN statement ends the current screen and calls the subsequent screen.
The next screen is either
the static next screen
The LEAVE TO SCREEN statement exits the current screen and calls the dynamic next screen, which is specified as part of the statement. The LEAVE TO SCREEN statement is no more than a contraction of the two statements.
SET SCREEN Next Screen. LEAVE SCREEN.
To pass control from the dialog processor to the list processor, the following statement is included in one of the dialog modules: LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>]. This statement can be included in either the PBO or the PAI event.
The optional addition AND RETURN TO SCREEN allows to specify a different screen in the current screen sequence at whose PBO event you want to resume processing.
This inserts a screen sequence into the program flow as described in the section Calling Screen Sequences. The list processor passes control to the dialog processor.
Introduction
There are several ways for modifying a SAP standard. R/3 system can be adjusted to meet the customer needs in different ways
Customizing Personalization Modifications Enhancements
What is Customizing?
Customizing is the setting of system parameters via SAPs own interface. Possible changes to the standards have been thought out and organized by SAP. Customizing is an obligatory part of the R/3 implementation process.
Customizing (Contd.).
If a company has decided to implement the SAP System, they must adapt the software to meet their individual business requirements This process of customizing the system can be controlled and accelerated using the Accelerated SAP method. The term Customizing refers to the
Customizing (Contd.).
Customizing supports the project teams in the following situations:
Implementing the SAP System Enhancing the SAP System in release and system upgrades
Functions of Customizing
Customizing provides the following functions:
Tools for making and documenting system settings Recommendations for system settings Customizing projects as a means for controlling the management, editing and analysis processes of the implementation and upgrade projects
Support for transferring the system settings from the test system into the production system
Support for transferring the system settings by means of Business Configuration Sets in a group rollout
Personalization
Personalization means to adjust the SAP System to meet the work requirements of specific users or user groups.
Personalization is aimed at accelerating and simplifying the business transactions that the SAP System processes.
Based on the "What you see is what you need" slogan, application Personalization
The standard point of entry into the system is the SAP Easy Access user menu. Each user of the SAP System can be assigned a user menu tailored to the individual activities of that user that appears when the user logs on to the system. System administrators can choose from
Menus and the transactions of the SAP System can be adjusted to the business environment of the company.
In many cases, the fields and options contained in the standard transactions are not needed for specific process flows.
Besides other tools, transaction and screen variants are used to adjust the
SAP organizes its exits in packages are called SAP enhancements. Each SAP enhancement can contain many individual exits. Enhancements represent potential customer requirements that have not been developed in the standard.
There are two main reasons why exits should be used rather than modifying SAP software. Add-ons attached to exits have the advantage that:
They do not affect standard SAP source code
When a new functionality is added to SAP System using SAPs exits, the source code of standard SAP programs in not altered any way. The code and screens created are encapsulated as separate objects.
Types of Exits
There are several different types of customer exits. Each of these exits acts as hooks where add-ons can be attached or "hanged" . Menu Exits
Menu exits add items to the pulldown menus in standard SAP applications. These menu items can be used to call up own screens or to trigger
To take advantage of exits if SAP has added them to one of its standard applications, we need to know how to locate the exits available in the SAP System.
SAP organizes its exits in packages called SAP enhancements. Each SAP enhancement can contain
To create an add-on project from within the ABAP Workbench menu, choose Utilities EnhancementsProject management.
Before defining a project, decide which application, application component, or specific standard transaction would be added to the
ADD-ON Project
There are two factors to keep in mind when creating an add-on project.
SAP enhancement package and the customer exits it contains should be included in one project only.
The same SAP enhancement may not appear in two separate customer projects.
In order to make add-ons, such as menu items or screen fields, appear in standard R/3 applications, activate the add-on project.
When a project is activated, all of the add-ons created within this project are activated as well. For this reason, ensure that the exits included in
Creating Add-Ons
After the project name is specified :
Choose Create. Describe the nature of the project by providing a short descriptive text. Choose Save. The system then prompts to assign a change request. This assignment allows to transport the project and its components into a productive system once completed.
Specify which SAP enhancement packages has to be included in the project by choosing SAP enhancements.
Enter the names of these SAP enhancements in the spaces provided.
On identifying the SAP enhancements to be included in the project, add own functions to the exits offered in the enhancements.
After attaching the add-on functionality to the exits in the project, activate the project. Activating a project turns on all the addons. The project also has to be activated after transporting it from a development system into a production system. When activating the project, the system turns on all add-ons that the project
To make changes to any of the add-ons, first deactivate the project that contains that add-on.
Customer-Specific Menus
Menu exits allows to add own functions to the pulldown menus in standard R/3 transactions.
Screen Exit
Screen exits allows to add own fields to specified screens in standard R/3 transactions.
The global data defined in the standard SAP program is not known to the program that controls the customer subscreen. Also, the fields used in the subscreen are not known to the SAP program in which they appear. To compensate for this problem, SAP creates special flow logic modules when defining screen exits. SAP creates a special PBO module with a
SAP defines where function module exits are inserted and what kind of data they transfer
Function module exits play a role in both menu and screen exits.
SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs.
These calls have the following syntax: CALL CUSTOMER-FUNCTION nnn.
From the main screen of the Project management transaction, proceed as follows:
Select Enhancement components and choose Change. Place the cursor on the function module exit to be used. Choose Edit component.
The system displays the exits corresponding function module, which has been prepared by an SAP application developer. Fill this module with functions required by calling the include program (called ZXnnnU01) contained within the module and insert the source code into it. Both the function module and the include
When using a function module exit, we should know how the function module fits into the program logic of the standard R/3 program that calls it. When defining function module calls in its standard program, SAP specifies exactly what data can be transferred to and from the standard program.
Enhancements - Field
Customer-specific Documentation
For all data elements stored in the R/3 Repository ,SAPs enhancement concept allows to create
SAP application developers do not need to prepare special exits for data elements. Customizing the texts of all standard data elements can be done in the SAP System.
The enhancement concept also allows you to alter a data elements short description (short text).
This brief text appears whenever a user calls up online help for that field with F1 .
The enhancement concept allows to create your own online documentation for all data elements in the ABAP Dictionary.
The system displays this documentation whenever a user chooses F1 to get more information about a screen field.
Enhancements - Table
Table Enhancements
A standard table can be enhanced with additional fields and structures using
Append structures
For enhancements that are not included in the standard. An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure. The following enhancements can be made to a table or structure TAB with an append
Field ZZB
Customizing Includes
A Customizing include is a structure that satisfies a special naming convention. The name of a Customizing include begins with CI_ and the include lies in the customer namespace. If enhancements are already planned in the R/3 standard using customer-specific fields, such Customizing includes are
Customers can enhance tables and structures of the R/3 standard system without themselves having to modify the table and structure definitions. If a table or structure of the R/3 standard system is enhanced with customer fields using a Customizing include, these customer fields are automatically inserted in the new delivered table or structure
A Transaction variant is created to alter the layout of the screen Transaction variants are made up of a series of screen variants. The field values and settings for each screen in the transaction variant are stored in a screen variant
Screen Variants
Screen Variants are automatically created when the transaction variant is created A screen variant contains field values and attribute for exactly one screen.
Modification
Modifying the Standard
The standard SAP code is modified to meet the business needs. A registered development user registers changes in SAP sources and manual changes of SAP Data Dictionary objects. Exceptions to such registration are match codes, database indices, buffer settings, customer objects, patches, and objects whose changes are based on automatic generation (for example, in Customizing). If the same user changes the object again at a later time, no new query is made for the registration key. Once an object is registered, the related key is locally stored and copied automatically for later changes, regardless of which registered user is making the change.
SCCR Benefits
Benefit from SSCR (SAP Software Change Registration)
Quick error resolution and therefore high availability of modified systems
All changed objects are logged by SAP. Based on this information, SAPs First Level Customer Service can quickly localize and remove the causes of problems.
Dependable operation
Customization
Customer Development
During customer development, customer-specific objects are created in the customer namespace.
Exception Handling
Exception handling is the integral part of the designing the application. By raising the exception, an opportunity is provided to the Caller program to handle the exception in its own way. The occurrence of an exception is normally used to display an error situation.
Since exceptions cannot be handled by means of program calls, all possible exceptions within the program itself must be handled to prevent a runtime error.
This rule does not apply to the coding
Variants
Variants allows to save sets of input values for programs that is often started with the same selections.
It can be used for any programs except subroutine pools (type S).
When a program in which selection screens are defined is started, the system displays a set of input fields for database-
Variants (Contd.).
Any number of variants can be created for any program in which selection screens are defined.
Variants are assigned exclusively to the program for which they were created.
Variants can be used to change the appearance of the selection screen by hiding selection criteria.
Job Scheduling
The scheduled time for when a job runs is one part of the jobs definition. Before any background processing can actually begin, background jobs must be defined and scheduled. In background processing, the SAP System automatically runs any report or program
When starting the report in the background, running the report does not influence the interactive work with the SAP System.
The execution of reports can be shifted to
Background processing is the only way to execute long-running jobs. To prevent tying up system resources with interactive sessions for long reports, the SAP System has a built-in time limit on interactive sessions. If a single ABAP report runs for more than 5 minutes continuously in an interactive
Go to Transaction SM36 Specify the job name and the job class
The job class specifies the job priority
B
C
Normal
Low
What is ERP?
Enterprise Resource Planning Enterprise-wide system which integrates the business functions and processes of an organization An information system which integrates all applications for the business organization
INVENTORY
Choose the ERP vendor Engaging an external body for ERP implementation Services Identify Functional / Technical (if any) SME from the organization as POC to coordinate the implementation
Advantages of ERP
Eliminates Duplication, Discontinuity and Redundancy in data Increases return of investment made on implementation Delivers Quality Information Reducing Manpower
Each department can act independently Ensures quicker processing of Information Quick and Efficient Response to Customers Weightage in Winning Business(Helps in Having a say over the competitor)
Disadvantages of ERP
Exorbitant investment of time and money Benefits are subject to proper implementation, training and use ERP Training requires more man days which results in overhead to the regular functioning of the organization
Understanding the business components and processes increases the organizational awareness among users Faster Implementation leads to quicker and better delivery
ERP Products
SAP
ORACLE e-BUSINESS SUITE PEOPLE SOFT JD EDWARDS
Introduction To SAP
SAP AG HISTORY OF SAP SAP PRODUCTS
SAP
SAP AG
The Company behind the Package German Based Founded in 1972 as Systemanalyse und Programmentwicklung ("System Analysis and Program Development") by five former IBM engineers in Mannheim, BadenWrttemberg
Dietmar Hopp
History of SAP
Three Systems developed - R/1, R/2, R/3 R/1 Launched in 1973 R/2 Launched in 1979
SAP
Client/Server Technology Highly Customizable Industry Specific BEST Practices
Open Standards
Market and Technology leader in business
SAP
R/1 1972 R/2 1979
Mainframe
R/3 1992
Client/Server Compatible with multiple Platforms and Operating Systems
SAP Solutions
Applications Business Object Portfolio On-demand Solutions
SAP Solutions
SAP Business Objects Portfolio
Solution for Large Enterprises Solutions for small Businesses and Midsize Companies
On demand Solutions
SAP Business by Design SAP CRM on-demand Solution
SAP For Banking SAP For Insurance SAP For Defense & Security SAP For Healthcare SAP For Aerospace and Design SAP For Chemicals SAP For Oil & Gas SAP For Media SAP For Telecommunications
SOA based Open Technology Platform Unifies Technology Component Into A Single Platform Provides The Best Way To Integrate All Systems Running SAP or non-SAP Software People Integration
Right functionality to right people at right time Multi-Channel Access
Connect to Enterprise systems through
Knowledge Management
Access to unstructured information Repositories are directly linked to the portal with preconfigured or programmable connectors
The basis for Process Integration is SAP Exchange Infrastructure (SAP XI) Provides technical infrastructure for XML based message exchange to enable integration of SAP to SAP or non-SAP systems
Mid-Sized Companies
Ideal for companies with Industry Specific requirements Can be implemented quickly
SAP Consultants
Technical Consultant Functional Consultant Basis Consultant
Modules Of SAP
Functional Modules
Material Management (MM) Sales and Distribution (SD) Production Planning (PP) Plant Maintenance (PM) Quality Management (QM) Financial Accounting & Controlling (FICO) SAP Business Warehouse (BW) SAP Enterprise Portals (EP)
System Landscape
Customizing Client
Consultants do the customization as per the Business requirement
Make all changes to Customizing Client Other clients with additional roles
Development Test Client (TEST) Prototype Client (SAND) Neat and Clean Client (GOLDEN)
SANDBOX doesnt affect the other clients Golden Client is a configuration only client
Test the customization Changes to cross-client data appear in the Quality Assurance (QAS) after Transport Test if the transports are complete
Any new changes will be in the development DEVELOPMENT PRODUCTION client and request QUALITY will be transported in the same order as
SAP Systems are used to map Business Processes Applications should be implemented independent of hardware environment (OS, DB) SAP Netweaver provides 2 runtime environments to achieve it
SAP WAS
R/3
ABAP Workbench
R/3 R/3
BASIS SYSTEM
Application1
Application n
DATABASE
Runtime environment written in C , C++ and ABAP Advanced Business Application Programming
Programming language for SAP
ABAP WORKBENCH
Written in ABAP
Used to create, edit, test and organize application developments
Application server 1
Application server n
APPLICATION LAYER
DATABASE LAYER
Consists of a Central Database System containing all data in R/3 system Contains 2 components
DBMS DB
Interface between the R/3 System and its Users User interface for entering and displaying data
SAP
SAP GUI session6
SAP
SAP GUI session6
SAP
SAP GUI session6
..
GUI1
..
GUI 2
..
GUI 3
..
R/3 System 1
R/3 System 2
The screens that appear in the window of the screen are the visible components Windows are generated by Presentation Layer SAP LOGON a utility to start to logon to SAP
Choose an available SAP system Program connects to the message server of
An important component of R/3 System R/3 Programs run on Application Server Application Layer is made of Application servers and Message server Application Servers Communicate with Presentation Components, the database and also with each other using the
Components that run an application Linked to the memory area containing the context of the application that is running Context contains current data for the application program It needs to be available in each DIALOG STEP
Dispatcher
Shared Memory
All Work Processes on an Application Server
Roll Area
Allocated by Work process for the instance of
SAP R/3 Architecture When we start up the R/3, each Application Server registers itself with the DB layer and receives a single dedicated channel Each Work process is a user of database system A work process can make DB changes only within a single DB Logical Unit Of
Database Connection
SAP GUI
1
4 5 context 3
context
Shared Memory
Work Process 1
Work Process 2
Work Process 3
context
The dispatcher receives the request to execute a dialog step from user 1 and directs it to work process 1, which happens to be free. The work process addresses the context of the application program (in shared memory) and executes the dialog step. It then becomes free again. The dispatcher receives the request to execute a dialog step from user 2 and directs it to work process 1, which is now
Screen Processor
Database Interface
SAP instances are defined during the installation of the SAP system. The term instance is often used synonymously with server or application server in the SAP system An SAP instance defines a group of resources such as memory, work processes and so on, usually in support of
Basic Navigation
SAP GUI
Based on Windows Style
Available for Several Platforms, providing the same functions for each SAP GUI Types
SAP GUI For Windows Environment SAP GUI For Java Environment
Client
Username Password
Logon Language
Client
Transaction Codes
Commonly Used Transaction Codes
SE80 : Object Navigator (ABAP Development Workbench) SE38 : ABAP Editor
SAP Implementation
SAP Implementation is the whole of processes that defines a complete method to implement the Enterprise Resource Planning SAP ERP software in an organization. The SAP implementation method described in this entry is a generic method and not a specific implementation method as such.
The implementation of SAP software, such as SAP R/3 is almost always a massive operation that brings a lot of changes in the organization. The resulting changes that the implementation of SAP generates are intended to reach high level goals, such as improved communication and increased return on information.
Implementation Methodologies
Selection Screen
Selection screens are a standardized user interface. It is used when the user has to give data input. Input parameters are primarily used to control the program flow, while users can enter selection criteria to restrict the amount of data read from the database.
Selection Tables
SELECT-option S seltab FOR f.
Structure of Selection Tables
The row of a selection table consists of
Sign Option Low High
Low
High
Select-Option
Default Values for Selection Criteria
SELECT-OPTIONS seltab FOR f DEFAULT g [TO h].... To fill only the low field (single field comparison):
........DEFAULT g.
SELECTION-SCREEN BEGIN OF SCREEN numb [TITLE tit] [AS WINDOW]. ... SELECTION-SCREEN END OF SCREEN numb.
Underlines
To place underlines on the selection screen SELECTION-SCREEN ULINE [[/]pos(len)] [MODIF ID key].
An individual function code fcode can be assigned to an individual checkbox A radio button group must have one shared function code.
The ABAP runtime environment fully controls the processing flow of selection screens.
The ABAP runtime environment generates a number of special selection screen
The basic form of the selection screen events is the AT SELECTION-SCREEN event
This event occurs after the runtime environment has passed all input data from the selection screen to the ABAP program.
Selection Screen Processing starts after the INITIALIZATION event with AT SELECTION SCREEN OUTPUT.
User actions on the selection screen result in other events that are either used for field or possible entries help, or that trigger PAI processing of the selection screen.
Only if the AT SELECTION-SCREEN
The AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program In the PBO of the selection screen, the AT SELECTION-SCREEN OUTPUT event is triggered.
Processing Blocks
If the user opens the Multiple Selections dialog box for a selection option, the same events are triggered in the PAI of the selection screen as if the user had chosen Execute. In the Multiple Selections dialog box, user actions either lead to input help or trigger the PAI event of the dialog box. At first, the AT SELECTION-SCREEN ON seltab
The event is triggered when the user calls the F1 help for the field field No event block AT SELECTION-SCREEN ON HELP-REQUEST can be created for input fields of the selection screen that are declared within the logical database used.
The event is triggered when the user calls the F4 help for the field field.
When a selection screen is used as a subscreen on a screen or in a tabstrip control on a screen, the CALL SUBSCREEN statement is executed in both the PBO and PAI events in the screen flow logic
PAI modules for selection screens as subscreens cannot be programmed, the CALL SUBSCREEN statement ensures
A tabstrip area and the associated tab pages must be defined, and assigned to a subscreen to the tab pages.
The tabstrip control or program the screen flow logic cannot be declared in ABAP program, since both are automatically generated.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK tab_area FOR n LINES,
Displaying a subscreen in a subscreen area on a selection screen is a special case of a tabstrip control on a selection screen.
Logical Database
Logical databases are special ABAP programs that retrieve data and make it available to application programs.
Logical databases contain Open SQL statements that read data from the database
LDB can be called using the function module LDB_PROCESS
Tasks of a LDB
Reading the same data for several programs. Defining the same user interface for several programs. Central authorization checks Improving performance
Database Program
The database program contains the ABAP statements used to read the data and pass it
Structure
Defines the data view of the LDB The order in which data is made available to the user depends on the hierarchical structure of the logical database concerned. The structure of a logical database is usually based on the foreign key relationships between hierarchical tables
Structure
LFA1
LFBK LFB1
LFC1
Selections
Defines a selection screen Layout determined by Structure If LDB is called using the function module LDB_PROCESS, the selections are filled using interface parameters.
Database Program
The database program contains the ABAP statements used to read the data and pass it to the user of the logical database
Example Program without LDB DATA: wa_spfli TYPE spfli, wa_sflight TYPE sflight.
SELECT-OPTIONS: sel_carr FOR wa_spfli-carrid. SELECT carrid connid cityfrom cityto FROM spfli INTO CORRESPONDING FIELDS OF wa_spfl i WHERE carrid IN sel_carr. WRITE: / wa_spfli-carrid, wa_spfli-connid, wa_spfli-cityfrom, wa_spfli-cityto.
SELECT fldate FROM sflight INTO CORRESPONDING FIELDS OF wa_sflight WHERE carrid = wa_spfli-carrid AND connid = wa_spfli-connid.
Reports
There are different types of Reports
Simple reports
Classical reports
ALV Reports
Simple Reports
Creating Simple Reports
Simple output lists on the screen can be created by using the ABAP statements
WRITE
ULINE
SKIP
Events - INITIALIZATION
Occurs before the standard selection screen is called In this event the input fields of the standard selection screen can only be initialized once after the program has been started If an executable program declares a standard selection screen the same
The event AT SELECTION-SCREEN is the basic form of a whole series of events that occur while the selection screen is being processed. This event is used to validate the information entered in the selection screen The standard selection screen, either in an executable program or in the logical
Events - AT SELECTIONSCREEN
This event occurs after the selection screen has been processed and before data is read using the logical database
Events - START-OFSELECTION
It is used to prepare the data for reading and creating the list
In an executable program, any nondeclarative statements that occur between the REPORT or PROGRAM statement
This is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started. The event block is used to process and format all data that the program has stored in sequential datasets, such as internal
Events - END-OFSELECTION
Interactive Lists
Lists are the output medium for structured, formatted data from ABAP programs. Each program can produce up to 21 lists, one basic list and 20 secondary lists. The basic list is the standard screen of an executable program (report).
Each interactive list event creates a new detail list. With one ABAP program, one basic list and up to 20 detail lists can be maintained. If the user creates a list on the next level , the system stores the previous list and displays the new one. The user can interact with whichever list is currently
TOP-OF-PAGE event cannot be used in secondary lists but TOP-OF-PAGE DURING LINE-SELECTION can be used The system does process the event ENDOF-PAGE in secondary lists.
SY-
SYCPAGE SYSTARO
SY-
If an event block is define d in the program using the event keyword AT SELECTION SCREEN, the system automatically assigns extra function to other function keys
After a user interaction on a list, the ABAP runtime environment checks whether it should process the function code itself (for example, %EX or %PC), or whether it should trigger the relevant event. Unlike normal screens, in which the PAI event is triggered, the runtime environment triggers three special events when list events occur
When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line
The WINDOW statement takes effect only within the processing block of an interactive event, that is, only for detail lists
The system field SY-LIESEL contains the contents of the selected line .
READ LINE
To read data from the lines of existing list levels Closely connected to HIDE technique
GET CURSOR
GET CURSOR FIELD and GET CURSOR LINE is
HIDE Technique
HIDE <f>.
Places the contents of the variable <f> for the current output line (system field SYLINNO) into the HIDE area. Always place the HIDE statement directly after the output statement for the variable <f>
HIDE area is like a table, in which the system stores the names and values of all HIDE fields for each list and line number.
The statement without any options stores the contents of line <lin> from the list on which the event was triggered (index SY-LILLI) in the SY-LISEL system field and fills all HIDE
Interactive Lists
Reading Lists at the Cursor Position
GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] [LENGTH <len>].
LINE-COUNT <len>
writes the page length into the variable <len>.
TOP-LINES <top>
writes the number of page header lines into the variable <top>.
TITLE-LINES <ttl>
writes the number of list header lines of the standard page header into the variable <ttl>.
A function to a function key must be assigned before it can be included in the application toolbar.
ALV Reporting
ABAP List Viewer An SAP Tool for Reporting The tool provides common list operations as generic functions and can be enhanced by self-defined options. Reduces the development time of reports by providing the standard interfaces (
1% of the time spent on preparing field catalog and sort sequence information for the list viewer
9% of the time spent on fancy features for interactive list events
Declare data areas for list viewer Declare internal table to store selected data Select data into internal table Populate display variants Build field catalog Build sort catalog Build event catalog Build Layout
Implementation Details
Declare data areas for list viewer
TYPE-POOLS: SLIS. ** For field catalog DATA: i_fieldcat TYPE SLIS_t_fieldcat_ALV. ** For events DATA: i_events TYPE SLIS_t_EVENT. ** For sorting DATA: i_sort TYPE slis_t_sortinfo_alv. ** For fieldgroups DATA: i_fieldgroups_tab TYPE SLIS_t_sp_group_ALV. ** For variant
ALV Functions
The commonly used ALV functions are:
REUSE_ALV_LIST_DISPLAY REUSE_ALV_GRID_DISPLAY REUSE_ALV_VARIANT_DEFAULT_GET REUSE_ALV_VARIANT_F4 REUSE_ALV_VARIANT_EXISTENCE REUSE_ALV_EVENTS_GET REUSE_ALV_COMMENTARY_WRITE REUSE_ALV_FIELDCATALOG_MERGE
Debugging
Debugger is a stepwise method of finding out errors or bugs ABAP Debugger allows to interrupt the running program after each step, to check intermediate results and processing logic. Debugger can be called in 2 ways.
By Setting Break Points
Debugging (Contd.).
The Debugger is a programming tool that is used to execute ABAP programs, by line or by section.
Using this tool, data objects can be displayed and the flow logic of programs can be checked.
Two Types of Debugging
There are two possible strategies for starting the Debugger in the ABAP Workbench:
By setting breakpoints then running the program By running the program in debugging mode.
Setting Breakpoints
A breakpoint is a signal in a specific line of the program source code. This signal indicates to the ABAP runtime processor to stop the program at the relevant line and start the ABAP Debugger. A distinction is made between static and dynamic breakpoints.
Direct Processing
Start the Debugger without previously having set breakpoints. This is the best procedure to use when a program has to be started right from the From the Object Select a program or transaction and choose beginning. Navigator Program Test Debugging.
From the ABAP Editor
The Debugger can be started in one of From any Screen ways: Choose System Utilities Debug ABAP. the following
Enter /h in the command field.
Choose Program Execute Debugging (or the Debugging pushbutton). In the source code display, you need to select the menu Program Test Debugging
Table
A scrollable display containing up to 30 Breakpoin breakpoints. Next to each breakpoint is a counter. ts You can also delete breakpoints in this display Set a watchpoint for a field so that the program is Watchpoin interrupted whenever the value of that field ts changes. Calls This mode displays the current sequence of events,
Breakpoints
Apart from being able to execute an ABAP program in the Debugger, it is possible to start the Debugger by choosing a breakpoint. This is achieved by setting one or more of these breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP
Static Breakpoints
Static breakpoints are always userindependent if there is no specification of a user name.
On inserting BREAK-POINT or BREAK statement in an ABAP program, the system always interrupts the program at that point for that user or only for the user name.
Dynamic Breakpoints
Dynamic breakpoints are user-specific. All dynamic breakpoints are deleted when you log off from the R/3 System. Dynamic breakpoints are more flexible than static breakpoints because you can deactivate or delete them at runtime.
Breakpoints
Causes program execution to stop at that location and start the debugger Several breakpoints can be set simultaneously in the new Debugger by choosing the path Utilities Breakpoint Set. A debugger breakpoint is only valid while the Debugger instance, in which it was set,
Watchpoint
Like a breakpoint, a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field change. Watchpoints, like dynamic breakpoints, are
Watchpoints (Contd.).
Used to interrupt a program when contents of field or structure change It allows the option of monitoring the content of individual variables The Debugger stops as soon as the value of the monitored variable changes. Creating a Watchpoint
Use the pushbutton Create Watchpoint in the toolbar of the New Debugger.
Start the Debugger via the path Utilities Settings ABAP Editor Debugging.
Sapscript - Introduction
SAP scripts is the standard SAP form design tools for user to developed customized form for printing
Advantages of SAPScript
High performance during mass printing Multilingual capability Support to various hardware platforms and
Components of SAPScript
Editor
For entering and editing the lines of a text
Composer
A Programming Interface
Database Tables
For storing texts, styles and forms
SAPScript
SAP Script
Define
SAP document
Read Data
Print Forms
SAPScript - Layout
Each form consists of a start page and any number of subsequent pages, depending on the length of the letter text.
Whenever a window on one page is full, the remaining text is automatically output on the subsequent page.
The window thus controls the page break.
Header Data
Header Data is in both form and style maintenance In style maintenance, it is used primarily to present important information
Information designed to make it easier for the end user to select a style.
The header data in form maintenance is used for information and control purposes
Form - Pages
A page must be defined for a form A First Page must be designated in the form header The system should be informed about the page to be used (NEXT PAGE) after reaching the end of First Page
Form - Windows
Forms consist of individual text areas. To provide these areas with texts, define the areas as output areas. Then print the appropriate texts in these output areas, controlled by the print program.
Form - Windows
Texts can be assigned to each form window. Text elements are part of the form and stored together with the other form elements. Text elements also receive names which are used to refer to the respective text elements via the programming interface.
Pages Windows
Form - Window
Date
Heading Variable Window
Window with Body Text
Main Window
Footer
The contents of variable windows are processed again for each page, on which the window appears.
The system outputs only as much text as fits into the window.
Text exceeding the window size is truncated and the system does not trigger a page break.
For outputting texts in the main window, or, more correctly, in a page window of type MAIN, there are three different areas.
The upper margin of the main window is called TOP area; The lower margin is called BOTTOM area.
The area in-between is called BODY of the main window.
The contents of the three areas TOP, BODY, and BOTTOM can be determined or modified dynamically during the output of the form.
The BOTTOM area appears at the end of the main window. Unlike the TOP area, the BOTTOM area can be defined for the current page after the output to the BODY area is complete, provided there is enough space left on the page. Otherwise, the BOTTOM area text is
Page Window
A page window is the definition of a rectangular output area on the output medium (for example, DIN A4 paper page), determined by the left upper edge and the height and width of the area. By defining page windows, which windows has to appear on a page, their sizes and their positions are determined. When defining windows and pages, the position and spacing of the texts to be
Page Windows
Top Margin Left Margin
Window
Height
Page Window
Pag e
Width
Paragraph Format
In SAPScript, paragraphs are formatted using formats and their corresponding attributes.
Paragraph Format
In the Standard attribute group, the general attributes that can be defined in paragraph formats are:
Description
Precise explanation of your paragraph tag, so that the user can immediately identify it.
Character Format
Character formats, as opposed to paragraph attributes, allows to format entire blocks of text within a paragraph.
Text Elements
A window contains texts and variables to be printed in the window Text elements (window texts) can be defined for each window. SAPscript calls the individual text components of a form text elements.
Print Program
An application that allows to print documents The print program retrieves the required data from the database and combines them with the data the user entered. R/3 applications (FI, CO, MM and so on) deliver standardized forms and print programs that customers may have to
Graphics
The SAPscript Graphics Administration (transaction code SE78) is used to import, administer, transport, and preview graphics before printing. Graphics are stored in a document server *.BMP and *.TIF files can be imported.
Uploading Graphics
2. Include Graphics using Standard Programs
i. Go to ABAP Editor-SE38 ii. Execute RSTXLDMC program.
iii.Specify the Tif file name, the type and the text name. iv.Execute
SAPScript Symbols
SAPscript recognizes four different kinds of symbols:
System symbols
SAPscript provides values for the system symbols.
Standard symbols
Standard symbols and their values are defined in the TTDTG table
Program symbols
Syntax Of Symbols
Each symbol has a name that is used when the symbol is called. A call to a symbol is normally made in a line of text that also includes other kinds of text. Use the delimiter & both immediately before and after the symbol.
Program Symbols
The integration of SAPscript allows to link data that is stored in various applications of the SAP system into text modules;
The system can evaluate the ABAP Dictionary information (output length, number of decimal places, and so on) not only for TABLES fields, but also for INFOTYPES fields and variables with a LIKE reference.
Standard Symbols
Standard symbols are defined in table TTDTG. This table contains both the name of each symbol and its value. The value is language-dependent.
Text Symbols
All the text symbols contained either in the current text or in a form assigned to the text are displayed.
The effect of assigning a value is temporary, since the values assigned are not stored with the text but are lost as soon as you leave the editor.
In the text the control command DEFINE is
The functionality of the SAPscript editor is made available through a set of commands.
These commands give full editing control over your text and are executed immediately when called.
These commands are not interpreted by the SAPscript editor, but are passed
NEW-PAGE
Explicit Page Break: NEW-PAGE
SAPscript automatically inserts a page break when the main window of a page (MAIN) is full.
The NEW-PAGE command is used to force a page break in the text at any point The text following this command then appears on a new page.
Syntax
Conditional Text
IF
The IF control command is used to specify that text lines should be printed only when certain conditions are met.
Syntax
/: IF condition : /: ELSEIF condition : /: ENDIF
Finding a Match
CASE
The CASE command covers a special case of the multiple case IF command. Syntax
/: CASE symbol /: WHEN value1 : /: WHEN value2 : /: WHEN valuen
Subroutines
ABAP Subroutines: PERFORM
The PERFORM command is used to call an ABAP subroutine from any program. PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.
Subroutines (Contd.).
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
The ABAP subroutine called via the command line stated above must be
Subroutine (Contd.).
Form
Report <prog>. FORM <form> TABLES in_tab STRUCTURE itcsy Out_tab STRUCTURE itcsy. .. ENDFORM.
ABAP Dictionar y
SAPScript Styles
Styles are used to define the paragraph and character formats A style can be allocated to every text Styles can be used to highlight texts Styles are used for the main windows of the form
To modify the styles, copy the style from client 000 to the development client.
Assign a name from the name area reserved for
Using Styles
Paragraph and Character formats can be defined independent of forms Styles can be assigned to any text in SAPScript The naming conventions for style names are :
The name must start with a letter.
Style Components
Header Data Paragraph Format and Attributes Paragraph formats control the formatting of paragraphs in SAPscript . Character Formats and Attributes
It is possible to choose single objects for a comparison, or generate comparisons of a whole set of objects. A comparison covers only the attributes and, if applicable, the formal definition of
SAPScript
2. Goto SE38. Enter the print program name and execute. 3. Now its possible to debug the script both page and window wise
It also allows to execute simple modifications to the form and in the form logic by using simple graphical tools.
Its easy to create the form without much programming knowledge
Data retrieval and form logic are separated from each other. Application program passes data to Smartform through Function module interface which is generated automatically on Smartform activation. Provides GUI which helps user in performing critical tasks like creating and
The adaptation of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary
Displaying table structures (dynamic framing of texts) Output of background graphics, for form design in particular the use of templates
Reusing Font and paragraph formats in forms (Smart Styles) Data interface in XML format (XML for Smart Forms, in short XSF) Form translation is supported by standard translation tools
SMARTFORM Architecture
Smart Form WEB Browser ABAP Function Module (Generated)
Application Program
Printer
Smart Forms
When the Smart Form is activated, the system generates a function module that encapsulates all attributes of the Smart Form. As soon as the application program calls the function module, the Smart Form uses the modules interface to transfer any table data previously selected and to print the form according to the form description.
SE78
Structure of SmartForm
SMARTFORMS provides a graphical user interface which is divided into three different parts:
Navigation Panel
PC Editor Form Painter
Pages
Each form consists of one or more pages. The first page in the tree structure is the start page The page layout includes the page format and the position of windows on a page
Windows
Windows are output areas for all output data. The size and position of a window can be set graphically in the Form Painter. There are main windows and secondary windows.
Window Types
The following window types can be defined in a form:
Main Window Secondary Windows
Copies Windows
Final Windows
Main Window
A main window is used to display text and data, which can cover several pages. As soon as a main window is completely filled with text and data, the system continues displaying the text in the main window of the next page. It automatically triggers the page break.
Secondary Windows
In a secondary window text and data displayed in a predetermined output area. Text and data that do not fit into the secondary window are truncated and not displayed. The main difference between a main window and a sub window is that, the contents of the main window, which is
Copies Window
The copies window is used to define an output area for the print output, whose content has to appear either only on the copy or only on the original. this window type is used only to print copies of the form. In the spool dialog in the Number input field of the Copies group box enter the
Final Window
To display values that are processed in the initial pages . Processing first skips all windows of this type in the tree and works its way to the end of the tree. Only after the actual processing is finished, the final windows are processed in the order in which they appear in the
To format texts and fields (data), paragraph and character formats are used.
Paragraph formats are assigned to entire paragraphs and character formats to individual character strings.
The paragraph format determines:
Font family and font size,
All texts in the form are displayed using text nodes. The only exception is addresses, which are displayed using their own node. Features
The following text types exist:
Text Nodes are used to display texts in form Addresses are displayed in separate nodes
Text Modules
Text modules are used to centrally store texts that are used frequently in forms in the system.
Character Format
Character formats are used to assign special output attributes to sections of texts or character strings within a paragraph After creating a character format, you can choose the following attributes:
Inserting Addresses
Addresses are administered using the Business Address Services (BAS). Depending on how the address is used, the application uses a particular address type. The addresses are stored in the database tables of the central address administration and identified by the
For a contact person in a company, for example, the company address and the name of the contact person is required and possibly the name of the department.
This is why it makes sense to distinguish between different types of addresses.
Graphics In Smartforms
The graphic administration is used to import, administer, and transport graphics, and to display them in a print preview.
Graphics can be incorporated statically into a form or include them dynamically using an appropriate field.
To copy any form in the Form Painter, scan the desired form as graphic and
Form printing is triggered by calling as few as two function modules. The first module uses the name of the form to determine the name of the generated function module.
The name of the generated function module is unique only within one system.
Procedure (Contd.).
In the application program define a variable of type RS38L_FNAM for the name of the generated function module:
Procedure (Contd.).
Call function module SSF_FUNCTION_MODULE_NAME . It returns the name of the generated function module:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = <form name> " Specify th e form name * VARIANT ='' * DIRECT_CALL ='' IMPORTING FM_NAME = fmname "The function mo
Printing tables
Smartform can display data in the form of tables The table can be designed independent of the number of lines The size of the table depends on how much data the application program passes to the form at runtime
The table node, unlike the loop node, allows to define a table layout.
The table node is used to print one internal table as a table in the form.
1.Create a work area for the internal table in the global definitions.
a)If the Tables tab is used to pass the table at the form interface, work area is not required. b)Field symbols point to the current line instead of copying it into a work area.
2.Go to the Data tab of the loop or table node and mark Internal Table else the loop is deactivated. 3.Enter the name of the internal table that is passed at the form interface.
The events are not visible in the navigation tree; they are triggered implicitly by SAP Smart Forms.
In the table below, which contains one sort criterion, these implicit events are
Page Numbering
Smart Forms use page counters to determine the page number.
&SFSY-PAGE& for the current page number &SFSY-FORMPAGES& for the total number of pages in the form &SFSY-JOBPAGE& for the total number fo pages in all forms in the print job
Individual Migration
It is possible to migrate a SAPscript form into a Smart Form and convert a SAPscript style into a Smart Style.
When converting a SAPscript style into a Smart Style, the system converts all paragraph and character formats with all their properties and attributes without any changes.
When migrating a SAPscript form into a Smart Form, the system executes the following steps:
It copies the language attributes and the output options. It migrates the layout information including pages, windows, and their attributes and positions on the page. It copies the texts in the form. It displays the fields (SAPscript notation: program symbols) in the texts.
Go to the SAP Smart Forms initial screen (transaction SMARTFORMS). In the Form field enter the name of the Smart Form to create. Choose Utilities Migration SAPscript form. The dialog window Migrate SAPscript Form appears.
Select the names and the language of the SAPscript forms and choose Execute. The system creates the Smart Forms under the names of the SAPscript forms plus the extension _SF. It displays a list of the migrated forms.