Académique Documents
Professionnel Documents
Culture Documents
Human Resources
UNIX
Human Resources
reside in:
reside in:
reside in:
Presentation servers: Presentation servers: Systems capable of Systems capable of providing a providing a graphical interface. graphical interface.
Application servers: Application servers: Specialized systems Specialized systems multiple CPUs and multiple CPUs and vast amounts of RAM. vast amounts of RAM.
Database servers: Database servers: Specialized systems Specialized systems with fast and large with fast and large hard drives. hard drives.
Client/Server Defined
PC Software program SAP Client Server Software Presentation Layer
Application Layer
MS Excel components
Database Layer
Physical Distribution of R/3s Three Layered Client/Server Presentation Layer components are installed across many PCs. Architecture
The Application Layer components are installed across one or more high-end servers. The Database Layer components are installed on one high-end database server.
Computer A
Presentation Layer
Application Layer
Database Layer
Presentation Layer
Application Layer
Database Layer
Presentation Layer
Application Layer
Database Layer
Computer C
Presentation Layer
Application Layer
Database Layer
Presentation Layer
Application Layer
Database Layer
Computer C
Computer B-n
Computer C-n
Presentation Layer
Application Layer
Database Layer
Business Transactions
Business Transaction FD02 Change customer information
Screen 1
Screen 2
Complete transaction ?
Screen 2
Screen 1
DAY - 2
Session 1,2,3&4
Processes
Process
A Process is essentially A Process is essentially a program. Each process a program. Each process has memory and access has memory and access to system resources. to system resources.
Threads
A Thread is the actual component A Thread is the actual component of a process that is executing at of a process that is executing at one time. Each thread is capable one time. Each thread is capable of completing a different task that of completing a different task that its process requests. its process requests. Process
Thread 1 Thread 1
Thread 2 Thread 2
Thread 3 Thread 3
The Kernel
Process
Process
Process
SAP Dialog
OS Kernel OS Kernel
CPU
A component of the SAP A component of the SAP Kernel called the Dispatcher Kernel called the Dispatcher must manage process must manage process access to the OS kernel. access to the OS kernel.
Application Server A
Dispatcher
Dialog Update Spool Background
Application Server B
Dispatcher
Dialog Update Enqueue Spool Background
Database Server
Dispatcher
USER 1 USER 1 USER 3 USER 3
Dispatcher
USER 2 USER 2
USER 4 USER 4
Work Processes
Dialog Update Enqueue Spool Background or Batch
Dispatcher in Action
Presentation level Various types of processing requests
Application level
Dispatcher
Request queues
Dialog
Update
Enqueue
Spool
Batch
Process Request User: Fred Jones Activity: Read data XYZ Screen: 1
Dispatcher
Request queues
Dispatcher
Dialog Update Enqueue Spool
Work Process
Process Request Read data XYZ or Write data XYZ Request queues
Dispatcher
Screen 2
Screen n.
Screen 3. But only for product XYZ.
Screen 2. I only want to include data in my report that pertains to orders that were filled within the last 2 months.
Dispatcher
Request queues
Transaction
Screen 1
Screen 2
Screen n.
R/3 Buffers
Process Requests
Dialog
Task Handler
DYNP ABAP/4
memory
AVA
BLE ILA
USY B
USY B
memory
memory
Dialog
Request Queues
Dialog
ILAB VA
The data retrieved for the last screen is stored in extended memory in an area called the user context.
memory
Extended Memory
Dispatcher
Distribution of a Business Transaction Across Multiple SAP Logical Unit of Work (SAPLUW) WPs Update
Transaction Screen 1
Handled by:
Screen 2
Handled by:
Screen n.
Handled by:
+
Handled by:
Dialog A
Dialog B
Dialog C
Update
Asynchronous Updating:
SAP Logical Unit of Work (SAPLUW)
Transaction Screen 1
Database Commit
Dialog A
Screen 2
Database Commit
Dialog B
Screen n.
Database Commit
Dialog C
+
The Online Phase of an update ends here.
Write
Write
Write
VBLOG
Asynchronous Updating:
SAP Logical Unit of Work (SAPLUW)
Transaction Screen 1
Database Commit
Dialog A
Screen 2
Database Commit
Dialog B
Screen n.
Database Commit
Dialog C
Read
Update
VBLOG
VBLOG records
Dialog A
SAPLUW
Dialog B
Posting Routine
Data
U2
Screen 2 of 3
Dialog C
Posting Routine
Data
U2
Screen 3 of 3
Update
VBLOG
Posting Routine Data U1 Screen 1 of 3 ..ROLLBACK
SAPLUW
Dialog B
Posting Routine
Data
U1
Screen 2 of 3
..ROLLBACK
Dialog C
Posting Routine
Data
U2
Screen 2 of 3
..Ignored
VBLOG
Posting Routine Data U1 Screen 1 of 3
SAPLUW
Dialog B
Posting Routine
Data
U2
Screen 2 of 3
Dialog C
Posting Routine
Data
U2
Screen 2 of 3
Continue
Dialog
Lock Table
Background
The Operating System The Operating System spooler assumes the spooler assumes the print queue management. print queue management.
O/S Spooler
An SAP Instance
SAP Dispatcher SAP Dispatcher Operating Operating System System TCP/IP Software TCP/IP Software
SAP Central Instance SAP Central Instance Work Processes Work Processes
Peripheral Instance A
SAP Dispatcher SAP Dispatcher Operating Operating System System TCP/IP TCP/IP Software Software
Message Service
Peripheral Instance B
SAP Instance
Work Processes
Work Processes
DATABASE
SAP Servers
SAP Server/ Instance 8 Dialog Work Processes 3 Background Work Processes 1 Spool Work Processes SAP Server/ Instance 3 Dialog Work Processes 8 Background Work Processes 1 Spool Work Processes
ABAP/4 Dictionary
Session 1,2,3 & 4 DAY - 3
ABAP Dictionary
Tables
Views
Types
User-defined data types can be stored for all programs in the ABAP Dictionary. These user-defined types provide the same functionality as the local types that can be defined in ABAP programs with TYPES Data elements (elementary types and reference types). Structures (structured types): A structure consists of components that also have a type, that is they refer to a type Table types: A table type describes the structure and functional attributes of an internal table
Domains
Search Helps
The input help (F4 help) is a standard function of the R/3 System. The user can display the list of all possible input values for a screen field with the input help. There are two types of search help: Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help). Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
Lock Objects
The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. Structure of a Lock Object: The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships Lock Arguments: The lock argument of a table in the lock object consists of the key fields of the table. Lock Mode: The lock mode controls whether several users can access data records at the same time. Exclusive lock, Shared lock, Exclusive but not cumulative Function Modules for Lock Requests: Enqueue_<lock object name> Dequeue_<lock object name>
ABAP/4 Workbench
ABAP Statements
Declarative Statements These statements define data types or declare data objects which are used by the other statements in a program or routine. The collected declarative statements in a program or routine make up its declaration part. Ex: TYPES, DATA, TABLES Modularization Statements These statements define the processing blocks in an ABAP program. The modularization keywords can be further divided into: Event Keywords. Ex: AT SELECTION SCREEN, START-OF-SELECTION, AT USER-COMMAND Defining keywords. Ex: FORM ..... ENDFORM, FUNCTION ... ENDFUNCTION, MODULE ... ENDMODULE.
Control Statements
Controls the flow of an ABAP program Ex: IF, WHILE, CASE
contd
Call Statements Use to call processing blocks in the same ABAP program or in a different program Ex: PERFORM, CALL, SET USER-COMMAND, SUBMIT, LEAVE TO Operational Statements These keywords process the data that you have defined using declarative statements. Ex: WRITE, MOVE, ADD, COMPUTE etc Database Statements These statements use the database interface to access the tables in the central database system. There are two kinds of database statement in ABAP: Open SQL and Native SQL.
Processing Data
Assigning Values Ex:- MOVE <f1> TO <f2> it is equivalent to <f2> = <f1>. Assigning Values between Components of Structures MOVE-CORRESPONDING <struct1> TO <struct2>. Assigning Values with WRITE TO Ex:- WRITE <f1> TO <f2> Specifying the Source field Dynamically Ex: WRITE (<f>) TO <g>. Resetting Values to Their Initial Value To reset a variable <f> to the appropriate initial value for its type, use the statement Ex: CLEAR <f>.
Numerical Operations
To assign the result of a mathematical calculation to a variable, use the COMPUTE statement or the assignment operator (=). Ex:- COMPUTE <n> = <expression>. Here, COMPUTE is optional, you can also write as follows: <n> = <expression> Arithmetic Calculations:
The CONDENSE statement deletes redundant spaces from a string: CONDENSE <c> [NO-GAPS] The CONCATENATE statement combines two or more separate strings into one. CONCATENATE <c1> ... <cn> INTO <c> [SEPARATED BY <s>] To split a character string into two or more smaller strings, use the SPLIT statement as follows: SPLIT <c> AT <del> INTO <c1> ... <cn> Assigning Parts of Character Strings: The following variant of the MOVE statement works only with type C fields: MOVE <c1> TO <c2> PERCENTAGE <p> [RIGHT] Processing Sections of Strings: <f>[+<o>][(<l>)] here, By specifying an offset +<o> and a length (<l>) directly after the field name <f>, you can address the part of the field starting at position <o>+1 with length <l>
The CASE Control Structure CASE <f>. WHEN <f11> [OR <f 12> OR ...]. <Statement block> WHEN <f21>.[OR <f 22> OR ...] <Statement block> WHEN <f31> [OR <f 32> OR ...]. <statement block> WHEN ... ...... WHEN OTHERS. <statement block> ENDCASE.
LOOPS
Unconditional Loops Conditional loops Unconditional Loops: DO [<n> TIMES] [VARYING <f> FROM <f1> NEXT <f 2>]. <Statement block> ENDDO. Conditional loops: WHILE <condition> [VARY <f> FROM <f1> NEXT <f 2>]. <statement block> ENDWHILE.
Terminating Loops
Terminating a Loop Pass Unconditionally
To terminate a single loop pass immediately and unconditionally, use the CONTINUE statement
Internal Tables
Dynamic sequential dataset in which all records have the same structure and a key Part of the ABAP type concept In ABAP, internal tables fulfill the function of arrays Internal tables can exist both as data types and as data objects Internal Tables as Data Types The data type of an internal table is fully specified by its line type, key, and table type
Table Types
Declaring Internal Tables: DATA <itab> TYPE|LIKE <tabkind> OF <linetype> WITH <key> [INITIAL SIZE <n>][WITH HEADER LINE]. <itab> Name of the Internal Table <tabkind> may be STANDARD TABLE, SORTED TABLE, HASHED TABLE <linetype> <key> UNIQUE or NON-UNIQUE INITIAL SIZE <n> Initial amount of main memory assigned to an internal table WITH HEADER LINE It declares an extra data object with the same name and line type as the internal table
Program Modularization
Program Modularization
Subroutines Function Modules
Subroutines
A subroutine is a block of code introduced by FORM and concluded by ENDFORM FORM <subr> [USING ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ] [CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]. ... ENDFORM. USING and CHANGING define the parameter interface Protecting Global Data Objects Against Change use LOCAL <F> Parameters passed by Reference For calling by reference, USING and CHANGING are equivalent. To avoid the value of an actual parameter being changed automatically, you must pass it by value. ..Contd
Terminating Subroutines Use EXIT to terminate a subroutine unconditionally Use CHECK to terminate a subroutine conditionally Calling Subroutines PERFORM... [USING ... <pi>... ] [CHANGING... <pi>... ]. Calling External Subroutines PERFORM <subr>(<prog>) [USING ... <pi>... ] [CHANGING... <pi>... ] [IF FOUND]. Specifying Subroutines Dynamically PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING ... <pi>... ] [CHANGING... <pi>... ] [IF FOUND].
Function Module
Function modules are procedures that are defined in function groups Function groups act as containers for function modules that logically belong together You create function groups and function modules in the ABAP Workbench using the Function Builder(SE37). Play an important role in database updates and in remote communications Function modules supports exception handling
Attributes of Function Modules: Documentation Import parameters. Export parameters Changing parameters Tables parameters
To Call A Function Module: CALL FUNCTION <module> [EXPORTING f1 = a 1.... f n = a n] [IMPORTING f1 = a 1.... f n = a n] [CHANGING f1 = a 1.... f n = a n] [TABLES f1 = a 1.... f n = a n] [EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E] [OTHERS = ro]].
Lists
Lists can be created using ABAP statements The basic ABAP statement for displaying data on the screen is WRITE. Syntax: WRITE <F> Positioning WRITE output on the list: WRITE AT [/][<pos>][(<len>)] <f>. Formatting Options: WRITE .... <f> <option>.
Formatting options for all data types
Displaying Symbols and Icons on the list WRITE <symbol-name> AS SYMBOL. WRITE <icon-name> AS ICON. Blank Lines and Drawing Lines Horizontal Lines: ULINE [AT [/][<pos>][(<len>)]] Vertical Lines: WRITE [AT [/][<pos>]] SY-VLINE. or WRITE [AT [/][<pos>]] '|'. Blank Lines: SKIP [<n>]. SKIP TO LINE <n> Displaying Field Contents as CheckBoxes WRITE <f> AS CHECKBOX
Complex Lists
To layout a page header individually, event keyword TOP-OFPAGE To Suppress the Standard page header, use the NO STANDARD PAGE HEADING Ex: REPORT <rep> NO STANDARD PAGE HEADING Determining the List Width: REPORT <rep> LINE-SIZE <width>. The system field SY-LINSZ contains the current line width. Creating Blank Lines: SKIP [<n>]. SET BLANK LINES ON|OFF Determining the Page Length: Ex: REPORT <rep> LINE-COUNT <length>[(<n>)] The system field SY-LINCT contains the current number of lines per page
Defining a Page Footer: To define a page footer, use the END-OF-PAGE event Programming Page Breaks: To program unconditional page breaks, use the NEW-PAGE statement. To program page breaks depending on the number of empty lines left on a page, use the RESERVE statement. Ex: RESERVE <n> LINES Standard Page Headers of Individual Pages: NEW-PAGE [NO-TITLE|WITH-TITLE] [NO-HEADING|WITHHEADING]. Page Length of Individual pages: NEW-PAGE LINE-COUNT <length> Formatting Output: FORMAT <option1> [ON|OFF] <option 2> [ON|OFF] .... FORMAT COLOR <n> [ON] INTENSIFIED [ON|OFF] INVERSE [ON|OFF] FORMAT INPUT [ON|OFF]
Interactive Lists
Following are the list events which are called, depending upon the Function Code triggered by the user. AT PF<nn> (obsolete) AT LINE-SELECTION AT USER-COMMAND With one ABAP program, you can maintain one basic list and up to 20 detail lists Page Headers for Detail Lists: TOP-OF-PAGE DURING LINE-SELECTION Dialog Status for Lists: SET PF-STATUS <stat> [EXCLUDING <f>|<itab>] [OF PROGRAM <prog>] [IMMEDIATELY]. SET TITLEBAR <ttl> [WITH <g1> ... <g9>] [OF PROGRAM <prog>].
You can display a list in a dialog box instead of on the full screen using the WINDOW statement: WINDOW STARTING AT <left> <upper> [ENDING AT <right> <lower>]. System Field for Details Lists:
Automatic Data Transfer: Automatic data transfer happens by means of the system fields that are filled by the system for each interactive event SY-LISEL: contains the contents of the selected line. Program controlled Data Transfer: To pass individual output fields or additional information from a line to the corresponding processing block during an interactive event, use these statements:
HIDE <f>
GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] [LENGTH <len>]
READ LINE <lin> [INDEX <idx>] [FIELD VALUE <f1> [INTO <g 1>] ... <f n> [INTO <g n>]] [OF CURRENT PAGE|OF PAGE <p>] READ CURRENT LINE [FIELD VALUE <f1> [INTO <g 1>] ...].
GET CURSOR LINE <lin> [OFFSET <off>] [VALUE <val>] [LENGTH <len>].
where, <options> are LINE-SIZE, LINE-COUNT, LINES, FIRST-LINE, TOP-LINES, TITTLE-LINES, HEAD-LINES, ENDLINES. Modifying List Lines: MODIFY LINE <n> [INDEX <idx>|OF CURRENT PAGE|OF PAGE <p> [<modifications>].
Calling Screens from List Processing: To call a screen from list processing, use the statement CALL SCREEN <nnnn>.
Messages
Messages are stored in Tables T100 Maintain in Transaction SE91 or thru forward navigation T100 has the following structure Language key Twenty-character message class Message number Message text (up to 72 characters) To call a message from ABAP, you need to specify the message class and message number Ex: MESSAGE-ID <id>. Message And Exception: you can use the RAISING addition in the MESSAGE statement to trigger exception: MESSAGE..... RAISING <exc>
SY-MSGID, SY-MSGNO, SY-MSGTY, and SY-MSGV1 to SY-MSGV4 are the system fields which are filled automatically
Message Types
Logical Database
Special ABAP programs that retrieve data and make it available to application program. To call a LDB from ABAP Program use Function Module LDB_PROCESS Structure of LDB: Structure Selections Database program Structure: Based on the foreign key relationships between hierarchical tables Defines the data view of the logical database. .Contd
Selections:
The selections define a selection screen, which forms the user interface of the executable programs that use the logical database When the system generates the selection screen for an executable program, use the NODES or TABLES statement.
Database program:
The database program contains the ABAP statements used to read the data and pass it to the user of the logical database. The structure of the database program is a collection of special subroutines. LDB Program contains following subroutines: FORM LDB_PROCESS_INIT, FORM INIT, FORM PBO, FORM PAI, FORM PUT_<node> etc
SAP Query
The functional area determines the tables (and the fields of those tables) to which a query can refer
You can use SAP Query to generate different types of lists (partial lists): Basic List: Single line or multiline. Multiline basic lists can be compressed. Statistics, ranked lists: Require a numeric field. Data can be compressed. You can combine different partial lists in a single query. Starting in 4.6A, you can also print the individual partial lists
Queries are created either in the standard area or the global area
QuickViewer
QuickViewer
The QuickViewer allows you to define reports without having to program yourself. DataSource may be Table, LDB, InfoSet, Table join
Dialog Programming
Session 1,2,3 & 4 DAY - 6
Following are the available user Dialogs Screens Selection Screens Lists Messages
Screen: A Screen consists of the input/output mask and the flow logic The screen flow logic is divided into the PBO, PAI event Screen Elements: Screen Attributes Screen Elements Screen Fields Screen Flow Logic Screen Attributes: Program Screen Number Screen Type Next Screen Cursor Position Screen Group Hold Data
Screen Elements: Text Fields Input/Output Fields Dropdown list Boxes Checkboxes Radio Butttons Push Buttons Box Subscreens Table Controls Tabstrip controls Status Icons OK_CODE
Within the event blocks, you can use the following keywords:
Processing Screens
Triggering the PAI Event Function Code is associated with the actions triggered In each PAI event, the function code is placed in the system field SYST-UCOMM (SY-UCOMM) Function Code can be defined in the menu painter for GUI Status (menu bar, standard toolbar, an application toolbar) Processing Input/Output Fields: Local Program Fields Screen Fields with Dictionary Reference Finding Out the Cursor position: GET CURSOR FIELD <f> [OFFSET <off>] [LINE <lin>] [VALUE <val>] [LENGTH <len>].
Controlling the Data Transfer: The FIELD statement in the screen flow logic allows you to control the moment at which data is passed from screen fields to their corresponding ABAP fields. Ex:- Field <f> Calling Modules Unconditionally: Type E function Codes: You can assign function type E to the function codes of both pushbuttons on the screen and of elements in the GUI status Calling a PAI for type E Functions: MODULE <mod> AT EXIT-COMMAND Conditional Module Calls: A PAI module is only called when a certain condition applies FIELD <f> MODULE <mod> ON INPUT|REQUEST|*-INPUT. Condition for Multiple Screen Fields:
CHAIN. FIELD: <f1>, <f 2>,... MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST. FIELD: <g1>, <g 2>,... MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST. ... ENDCHAIN.
Input Checks
Automatic Input Checks: Mandatory Fields, Input format, ABAP Dictionary Checks (FKey , fixed values) Checking fields in the Screen Flow Logic: Checking a Value List: Ex: FIELD <f> VALUES (<v1>, <v 2>,...). The individual entries <vi> in the list can have the following format: [NOT] <val> [NOT] BETWEEN <val1> AND <val2>
Input Checks in Dialog Modules: FIELD <f> MODULE <mod> (Checking a Single field) Checking a Set of fields: CHAIN. FIELD: <f1>, <f 2>,... MODULE <mod1>. FIELD: <g1>, <g 2>,... MODULE <mod2>. ... ENDCHAIN.
Field Help
Data Element Documentation Data Element Supplement Documentation
To display data element supplement documentation, you must code the following screen flow logic in the POH event: PROCESS ON HELP-REQUEST. ... FIELD <f> [MODULE <mod>] WITH <num>.
Calling Help Texts From Dialog Modules: PROCESS ON HELP-REQUEST. ... FIELD <f> MODULE <mod>. HELP_OBJECT_SHOW_FOR_FIELD HELP_OBJECT_SHOW
Input Help
Input Help From ABAP Dictionary Search Helps, Check Tables, Fixed Values Input Help on the Screen Input Help in Flow Logic FIELD <f> VALUES (<val1>, <val 2>,...). Attaching a Search Help Input Help in Dialog Modules PROCESS ON VALUE-REQUEST. ... FIELD <f> MODULE <mod>. F4IF_FIELD_VALUE_REQUEST F4IF_INT_TABLE_VALUE_REQUEST
Status Icons: Status icons are display elements that you can use to represent the state of a program graphically ABAP Dictionary type ICONS-TEXT is used to create the field. To fill the field in your ABAP program, use the function module ICON_CREATE Import parameters for ICON_CREATE NAME, TEXT, INFO and ADD_STDINF Context Menus: Context menu can be defined for any of the following screen elements: Input/Output fields, Text Fields, Table Controls, Group Boxes, Subscreens. Context menus are objects of the global ABAP Objects class CL_CTMENU. FORM ON_CTMENU_<context> USING <l_menu> TYPE REF TO cl_ctmenu. ... ENDFORM. LOAD_GUI_STATUS, ADD_FUNCTION, ADD_MENU, ADD_SEPARATOR, HIDE_FUNCTIONS etc. are the methods of cl_ctmenu.
Subscreens
Define the subscreen area(s) on a screen Define suitable subscreen screens Include the subscreen screen in the subscreen area. PROCESS BEFORE OUTPUT. ... CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>. PROCESS AFTER INPUT. ... CALL SUBSCREEN <area>.
Tabstrip Controls
A tabstrip control is a screen object consisting of two or more pages. Each tab page consists of a tab title and a page area From a technical point of view, a tab page is a subscreen with a pushbutton assigned to it, which is displayed as the tab title. CONTROLS <ctrl> TYPE TABSTRIP <ctrl>-ACTIVETAB = <fcode> Paging in the SAPgui Paging on the Application Server
Table Controls
LOOP WITH CONTROL <table control>. ...<actions>... ENDLOOP. Using Step Loops: LOOP AT <internal-table> FROM <line1> and TO <line2> or CURSOR <scroll-var>
Selection Screens
ABAP Statement PARAMETERS for single fields SELECT-OPTIONS for complex selections SELECTION-SCREEN for formatting the selection screen and defining user-specific selection screens The standard selection screen of executable programs is predefined and has screen number 1000 ABAP Statement to Define User-defined selection screen: SELECTION-SCREEN BEGIN OF SCREEN <numb> [TITLE <title>] [AS WINDOW]. ... SELECTION-SCREEN END OF SCREEN <numb>. To Re-Use the elements of one selection screen in another using the following statement: SELECTION SCREEN INCLUDE BLOCKS <block> | PARAMETERS <p> | SELECT-OPTIONS <selcrit> | COMMENT <comm> | PUSH-BUTTON.<push>.
Defining Required Fields: PARAMETERS <p> ...... OBLIGATORY ...... Search Help for Parameters: PARAMETERS <p> ... MATCHCODE OBJECT <search_help> Checking Input Values: PARAMETERS <p> TYPE <type> ... VALUE CHECK ... Defining Checkboxes: PARAMETERS <p> ...... AS CHECKBOX ...... Defining Radio Buttons: PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>...... Hiding Input Fields: PARAMETERS <p> ...... NO-DISPLAY ...... Modifying Input Fields: PARAMETERS <p> ...... MODIF ID <key> ......
Select-options
SELECT-OPTIONS <seltab> for <f>. <seltab> is a selection Table with following structure The row type of a selection table is a structure that consists of the following four components: SIGN, OPTION, LOW and HIGH. SELECT-OPTIONS <seltab> FOR <f> ..... NO DATABASE SELECTION ..... Default Values for Selection Criteria: SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] .... Restricting Entry to One Row: SELECT-OPTIONS <seltab> FOR <f> ..... NO-EXTENSION ..... Restricting Entry to Single Field:
Pushbuttons in the Application Toolbar: SELECTION-SCREEN FUNCTION KEY <i>. <i> must be between 1 and 5 You must use the FUNCTXT_0<i> components of structure SSCRFIELDS for the individual pushbutton texts Changing the Standard GUI Status: RS_SET_SELSCREEN_STATUS Sets another GUI status defined in the same ABAP program, or deactivates functions of the standard GUI status. RS_EXTERNAL_SELSCREEN_STATUS Sets a GUI status defined in an external function group
Selection Screens as Subscreens: SELECTION-SCREEN BEGIN OF SCREEN <scrn> AS SUBSCREEN [NO INTERVALS] [NESTING LEVEL <n>]. ... SELECTION-SCREEN END OF SCREEN <scrn>. Tabstrip Controls on Selection Screens: SELECTION-SCREEN: BEGIN OF TABBED BLOCK <tab_area> FOR <n> LINES, TAB (<len>) <tab1> USER-COMMAND <ucom1> [DEFAULT [PROGRAM <prog>] SCREEN <scrn>], TAB (<len>) <tab2> USER-COMMAND <ucom2> [DEFAULT [PROGRAM <prog>] SCREEN <scrn>], ... END OF BLOCK <tab_area>. Subscreens on Selection Screens: SELECTION-SCREEN: BEGIN OF TABBED BLOCK <sub_area> FOR <n> LINES, END OF BLOCK <sub_area>.
Menu Painter
An instance of the user interface, consisting of a menu bar, a standard toolbar, an application toolbar, and a function key setting, is called a GUI status Setting the GUI Status: SET PF-STATUS <stat> [OF PROGRAM <prog>] [EXCLUDING <f>|<itab>]. Setting the GUI Title: SET TITLEBAR <title> [OF PROGRAM <prog>] [WITH <g1 >... <g9>].
Functions: The definition of an interface function contains the following elements: Function code: Unique key for the function, which can be interpreted by the ABAP program. Function Type: is used to determine processing control. Function types can, for example, tell the system when or how to carry out a function. Function text: A text that describes the function (such as Save). Icon name: Name of the icon to be displayed on a pushbutton. Icon text: Text to be output on the pushbutton in addition to the icon. Infotext: Text to be displayed in the status bar. Fastpath: Letter combination that allows users to choose functions without using the mouse. Function Types:
Transaction
To run a Type M program you have to created transaction SE93 is used to maintain the transaction Dialog Transactions: To create a dialog transaction, use the Transaction Maintenance transaction (SE93). Once you have entered a transaction code and short description, choose transaction type Program and screen (dialog transaction). Report Transactions: To create a report transaction, use the Transaction Maintenance transaction (SE93). Once you have entered a transaction code and short description, choose transaction type Program and selection screen (report transaction). Parameter Transactions: To create a parameter transaction, use the Transaction Maintenance transaction (SE93). Once you have entered a transaction code and short description, choose transaction type Transaction with parameters (Parameter transaction).
Overview
External System SAP System
Data
Batch Input
X
External Data
Online Program
To check and validate the external data, user dialog is simulated through an SAP transaction (i.e., an online program).
TEST1
BDCDATA Structure
To simulate user dialog, you must know the following information: (1) online program name, (2) screen numbers, (3) field names, and (4) field values. The BDCDATA ABAP/4 Dictionary structure is used in a batch input program to collect this information for an entire transaction.
ABAP/4 Dictionary
BDCDATA
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
X Address
Researching Transaction - 1st Step #1 Step ScreenF1 key and#2 Use System > Status Use Technical
menu path to determine online program name (SAPMF02K), screen number (0106), and transaction code (FK02).
Vendor Company Code X Address TEST1
Info pushbutton in each screen field to be filled to determine the field name.
Step #3
Determine how to proceed in the transaction (go to the next screen by pressing the Enter key). Field name = RF02K-LIFNR Field name = RF02K-D0110
Researching Transaction - 2nd Step #1 Step ScreenF1 key and#2 Use System > Status Use Technical
menu path to determine online program name (SAPMF02K) and screen number (0110). Info pushbutton in each screen field to be filled to determine the field name.
Step #3
Determine how to proceed in the transaction (save the record by clicking on the Save pushbutton or pressing the F11 key). Field name = LFA1-STRAS
FVAL TEST1 X
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
Method #2
Method #3
Overview
BDC Program
External Data The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
Insert Transaction Data into Session Insert Transaction Data into Session BDC_INSERT Close Batch Input Session Close Batch Input Session BDC_CLOSE_GROUP
BDC_OPEN_GROUP
CALL FUNCTION BDC_OPEN_GROUP EXPORTING CLIENT GROUP KEEP USER EXCEPTIONS CLIENT_INVALID ... OTHERS = 11. =1 = <client> = <session name> = <keep or delete session> = <user name>
BDC_INSERT
CALL FUNCTION BDC_INSERT EXPORTING TCODE TABLES DYNPROTAB = <bdc internal table> EXCEPTIONS INTERNAL_ERROR = 1 ... OTHERS = 5. = <transaction code>
BDC_CLOSE_GROUP
Data Section
Transaction Data
Street City
Step #1
Step #3 Step #4
Step #5
Example #1 - Subroutines
FORM FILL_BDC_TAB. REFRESH BDC_TAB. CLEAR BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 1 SAPMF02K RF02K-LIFNR RF02K-D0110 0106, TEST1, X, IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN = X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM. ENDFORM. FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
Sequential File
TEST1 TEST2 TEST3 TEST4 TEST5 123 Main St. 10 Walnut St. 32 Chestnut St. 30 Market St. 17 S. 30th St.
The sequential file we will read is set up in records. Each record has two fields with the following formats: <Field1> LIKE LFA1-LIFNR <Field2> LIKE LFA1-STRAS
Step #2
Example #2 - Subroutines
FORM FILL_BDC_TAB. REFRESH BDC_TAB. CLEAR BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 1 SAPMF02K RF02K-LIFNR RF02K-D0110 SAPMF02K LFA1-STRAS BDC_OKCODE 0106, INREC-VENDNUM, X, 0110, INREC-STREET, /11. IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN = X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM. ENDFORM. FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
Notice that the vendor number and street values are coming from the files records read into the INREC field string.
Summary
Research Transaction Code BDC Program Execute BDC Program
Batch Input Session Created
Overview
BDC Program
External Data
Session Overview
Transaction Code SM35
OR
Processing Modes
Process batch input session in the FOREGROUND. DISPLAY ERRORS ONLY when processing batch input session. Process batch input session in the BACKGROUND.
Processing Options
Session Status
Sessions still to be processed Sessions processed with errors Sessions processed successfully Background sessions Sessions being processed Sessions being created
Log
Created Created
01/08/1997 15:12:31 01/08/1997 15:12:31
Session Log
Session name Session name
SESSION3 SESSION3
User User
DANTHON DANTHON
Time Time
15:12:31 15:12:31 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32 15:12:32
Tran Tran
Screen Screen
Message Message
S00300 S00300 Session SESSION3 is being... Session SESSION3 is being... Changes have been made Changes have been made Changes have been made Changes have been made
Vendor TESTX has not been created Vendor TESTX has not been created
SAPMF02K 0110 SF2056 SAPMF02K 0110 SF2056 SAPMF02K 0110 SF2056 SAPMF02K 0110 SF2056 SAPMF02K 0106 EF2163 SAPMF02K 0106 EF2163 S00370 S00370 S00363 S00363 S00364 S00364 S00365 S00365 S00366 S00366 S00382 S00382
Processing statistics Processing statistics 3 transactions read 3 transactions read 2 transactions processed 2 transactions processed 1 transactions with errors 1 transactions with errors 0 transactions deleted 0 transactions deleted Batch input processing ended Batch input processing ended
Session Analysis
Session Log
1 2 3 4 5 FK02 FK02 FK02 FK02 FK02
Data
Status
Processed Incorrect Deleted Processed
Transaction
Screen
SAPMF02K 0106 SAPMF02K 0110 SAPMF02K 0106 SAPMF02K 0110 SAPMF02K 0106 SAPMF02K 0110 SAPMF02K 0106 SAPMF02K 0110 SAPMF02K 0106 SAPMF02K 0110
** This is not an analysis of the batch input session from the previous page **
Timing Issue
Remember: A batch input session is created when you execute a BDC program (time1), but it is processed at a different time (time2). Time2
Program RSBDCSUB
Execute program RSBDCSUB
Overview
PROGRAM
SAPMF02K
DYNPRO
0106
DYNBEGIN
X
FNAM
RF02K-LIFNR RF02K-D0110
FVAL
TEST1 X 123 Main St. /11
SAPMF02K
0110
X LFA1-STRAS BDC_OKCODE
10 Walnut St.
Boston
Step #2
Step #8
Step #9
Example #1 - Subroutines
FORM FILL_BDC_TAB. REFRESH BDC_TAB. CLEAR BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 1 SAPMF02K RF02K-LIFNR RF02K-D0110 SAPMF02K LFA1-STRAS BDC_OKCODE 0106, INREC-VENDNUM, X, 0110, INREC-STREET, /11. IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN = X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM. ENDFORM. FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
Notice that the vendor number and street values are coming from the files records read into the INREC field string.
Error Handling
Write an error report.
DO. ... PERFORM FILL_BDC_TAB. CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S. IF SY-SUBRC <> 0. WRITE: / Error. ENDIF. ENDDO.
DO. ... PERFORM FILL_BDC_TAB. CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE A. IF SY-SUBRC <> 0. WRITE: / Transaction error. ENDIF. ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
Step #2
Example #2 - Subroutines
FORM FILL_BDC_TAB. REFRESH BDC_TAB. CLEAR BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 1 SAPMF02K RF02K-LIFNR RF02K-D0110 SAPMF02K LFA1-STRAS BDC_OKCODE 0106, INREC-VENDNUM, X, 0110, INREC-STREET, /11. IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN = X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM. ENDFORM. FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
Notice that the vendor number and street values are coming from the files records read into the INREC field string.
CALL DIALOG
LSMW
The LSM Workbench is an R/3-based tool that supports You when transferring data from non-SAP systems ("Legacy Systems") to R/3 once or periodically . Data consistency due to standard import techniques: Batch input Direct input BAPIs (Business Application Programming Interfaces) * IDocs (Intermediate Documents)
Background Processing
Phases of Background Processing Passing Data to Subsequent Job Steps Scheduling Job within ABAP/4 Program
Work Processes
Dispatcher
Online
Update
Enqueue
Spool
Background
Background
Start date
General data Job name Job class Status Target host
Steps
Creating Step for Background Job Job Steps Job Scheduling Scheduling
ABAP/4 External program
ABAP/4 program Name Variant Language <name of report program> <name of variant> E
Immediate
Date/Time
After Job
After Event
Jobs can be scheduled Jobs can be scheduled to run after an event to run after an event has been has been triggered/raised. triggered/raised.
Jobs can be scheduled to Jobs can be scheduled to run immediately or at a run immediately or at a particular date/time. particular date/time.
Jobs can be Jobs can be scheduled to run scheduled to run after another job has after another job has been completed. been completed.
If you start a job based on a date/time or an event, you If you start a job based on a date/time or an event, you can schedule the job to run at regular intervals, not just can schedule the job to run at regular intervals, not just at a particular time. at a particular time.
X Periodic job
By checking the By checking the Periodic Job option, Periodic Job option, you can specify you can specify that the job run at that the job run at regular intervals. regular intervals.
With the Period With the Period Values pushbutton, Values pushbutton, you can schedule you can schedule the job to run hourly, the job to run hourly, daily, weekly, daily, weekly, monthly, etc. monthly, etc.
X Start status-depend.
After clicking on the After clicking on the After Job pushbutton, After Job pushbutton, you must specify the you must specify the name of the job that must name of the job that must be completed before this be completed before this job will run. job will run.
If you check the Start status-depend. If you check the Start status-depend. option, this job will run only if the option, this job will run only if the specified job ends successfully. specified job ends successfully.
Event Parameter
After clicking on the After Event After clicking on the After Event pushbutton, you must specify the pushbutton, you must specify the name of the event that must be name of the event that must be raised before this job will run. You raised before this job will run. You can distinguish between different can distinguish between different occurrences of a particular event occurrences of a particular event by specifying a parameter. by specifying a parameter.
X Periodic job
If you check the Periodic Job option, the If you check the Periodic Job option, the system starts a new job each time the system starts a new job each time the specified event is raised. specified event is raised.
Triggering/Raising Events
To trigger/raise an event from within an ABAP/4 program, you must To trigger/raise an event from within an ABAP/4 program, you must call the BP_EVENT_RAISE function module. call the BP_EVENT_RAISE function module.
CALL FUNCTION BP_EVENT_RAISE CALL FUNCTION BP_EVENT_RAISE EXPORTING EXPORTING EVENTID = <event name> EVENTID = <event name> EVENTPARM = EVENTPARM = TARGET_INSTANCE = TARGET_INSTANCE = EXCEPTIONS EXCEPTIONS BAD_EVENTID =1 BAD_EVENTID =1 The only required The only required EVENTID_DOES_NOT_EXIST = 2 EVENTID_DOES_NOT_EXIST = 2 exporting parameter is the EVENTID_MISSING =3 EVENTID_MISSING = 3 exporting parameter is the name of the event to raise. RAISE_FAILED =4 RAISE_FAILED = 4 name of the event to raise. OTHERS = 5. OTHERS = 5.
Job Job
Start Module Job Step #1 Job Step #2 Job Step #3 End Module Job Job Processing Processing
Job Overview
Transaction SM37
You can use this Job Log to analyze each step of a You can use this Job Log to analyze each step of a finished or cancelled background job. finished or cancelled background job.
Passing Data to Subsequent Job Steps Passing Data to Subsequent Job Steps Scheduling Job within ABAP/4 Program Scheduling Job within ABAP/4 Program
Passing Data to Subsequent Job Steps Background Job Global ABAP/4 Background Job Global ABAP/4
Memory Memory <data> Step #1 ... EXPORT <data> TO MEMORY. ... Step #2 ... IMPORT <data> FROM MEMORY. ...
Passing Data to Subsequent Job Steps Background Job Global ABAP/4 Background Job Global ABAP/4
Memory Memory <id1> <data> Step #1 ... EXPORT <data2> TO MEMORY ID <id2>. ... Step #2 ... IMPORT <data2> FROM MEMORY ID <id2>. ...
<id2> <data2>
Insert Job Step Insert Job Step JOB_SUBMIT Close Background Job Close Background Job JOB_CLOSE
JOB_OPEN
JOB_OPEN Exporting: jobname = <job name> Background Job <job name> <job #>
JOB_SUBMIT
JOB_SUBMIT Exporting: authcknam = <user> jobcount = <job #> jobname = <job name> report = <report> variant = <variant> Background Job <job name> <job #> Step #1
Step #2
JOB_CLOSE
JOB_CLOSE Exporting: jobcount = <job #> jobname = <job name> sdlstrtdt = <start date> sdlstrttm = <start time> strtimmed = <flag1> Importing: job_was_released = <flag2> Background Job <job name> <job #> Step #1
Step #2
Close Job
Scheduling Scheduling
Overview Overview
Job Log Spool List
Step #1 Step #2
Background
There are four different ways of changing the SAP system to fit our needs: 1. Customizing: Customizing constitutes changing the system parameters with its own special interface. 2. Enhancement Concept: It constitutes changing of SAP Repository objects by the customer without modification. 3. Modification: Modifying the SAP repository objects in the form of custom changes. 4. Customer Development: Need to create customer specific objects within the customer range. Types of Exits: 1. Menu Exits 2. Screen Exits 3. Function Module Exits 4. Field Exit
Menu 1
Menu 3
Menu exit
Field x
Field exit
Field y
Screen exit
SAP AG 1999
Menu exit: The system contains various points at which you can include menu items that start customer programs Screen exit: Some screens contain areas (subscreens) in which you can display your own screens Field exits: Field exits allow you to incorporate extra field checks.
Field Exits
Data element
FUNCTION FIELD_EXIT_... FIELD EXIT ENDFUNCTION.
SAP AG 1999
Finding Enhancements
User exits Customer exits System Status Double -click on program name Find character string... perform userexit call customer global in program ( prog) prog) SAP Reference IMG Sales & Distribution System adjustment User exits Select appropriate components CMOD Utilities SAP enhancements Restrict search with *<prog>* OPEN_FI_PERFORM SAP Reference IMG Financial Accounting Basic settings Use BTE Envir. Information System Select Component application components Business transaction events (BTEs)
SAP AG 1999
Field exits need not be prepared by the SAP application developer. You can create a field exit for any screen input field that has a Dictionary reference. The reference object is the data element. The unit "Enhancements to Dictionary Elements" discusses how the field exits work
DAY - 9
SAPSCRIPT
SAP Script
Chapter 1: Introduction Chapter 2: Layout Set Chapter 3: Output Program Chapter 4: Configuration
Introduction
What is SAP Script ?
SAP Script is used to print forms. Form Vs. Reports
Forms look nicer. PU Purchasing req. SD Inquiry Order can have Purchase Formsconfirmationgraphic elements. order Delivery note Contract Forms can be event-triggered. Invoice
Examples of forms:
FI
IM WM
Introduction
How SAP Script Works (Big Picture)
SAP SAP Document Document Layout set Read Data (Template) Define Form
(Output)
SAP Script
SAP documents are printed using forms. Forms are defined and formatted using layout sets. SAP script is a tool that SAP provides for creating layout sets.
Introduction
Creating Report Vs. Form
Creating Reports Output Program (ABAP) SAP SAP Document Document Report
Creating Forms SAP SAP Document Document Output Program (ABAP) Form
Layout set
Introduction
Output Program
Layout set
Form
Introduction
SAP Script Development
Component Output program Layout set Resource ABAP resource ABAP resource
Output determination Functional resource configuration Printer configuration Basis / ABAP (Impact, Thermal, Laser) Font configuraiton Basis / ABAP Testing End-user / Functional / ABAP resrouce
Layout Set
Some Facts
Client specific (clientdependent) Language specific Note: If the layout set is not available in the client in which the document is being printed, then the SAPscript checks for the style or layout set in client 000. Recommendation: Keep only one copy of the layout set in one client.
Initial Screen
Header Paragraphs Character strings Windows Pages Page windows
IMG
Header: Paragraphs: Character strings: Windows: Pages: Page windows: the pages
General info and default settings Font and tab info Font info within a paragraph Description of areas on the pages Name of the pages with page flow info Position and size of the windows on
Shows list of all windows defined for the layout set. A window can contain hard-coded texts and the variables to be printed in the window.
Specify tabs to create columns for line items If no font is specified, default font from the layout set header will be used
Font
Layout Set
Test Print
Menu: Utility > Test print Shows the layout design of the layout set. Test printing does not trigger the output program to interface with the layout set. It simply shows the maximum length of each of the fields being
Layout Set
Activating Layout Set
Menu: Layout set > Activate Must activate the layout set any time a change has been made
Layout Set
Symbol
Symbols are placeholders for values during print formatting. Symbols are identified by a name which is included in & characters. Example : &VBAK-VBELN&. Symbols are case sensitive. Depending on the source, the value of a symbol comes from, they can be categorized as follows:
SYSTEM symbols PROGRAM symbols STANDARD symbols TEXT symbols
Layout Set
Symbol
SYSTEM symbols are supplied by SAPscripts. They can be used in all texts. Following are list of frequently used system symbols.
&DATE& &DAY& &MONTH& &YEAR& &TIME& &HOURS& &MINUTES& &SECONDS& &PAGE& &NEXTPAGE& &SPACE& &ULINE& = Current date = Day = Month = Year = Time of day = Hours = Minutes = Seconds = Page = Page number of next page = Blanks = Underline
Layout Set
Symbol
PROGRAM symbols are placeholders for values which come from the program that calls the layout set. The symbol has to be defined in the Data Dictionary and filled with values by the output program.
Example: &KNA1-NAME1& in the layout set will output the Customers name.
STANDARD symbol are maintained centrally in one table (TTDTG) for all SAPscript users. Values of TEXT symbol are created by assignment via DEFINE statement.
Example : /: DEFINE &CASENUM& = 1234.
Layout Set
Symbol
FORMATTING of the symbol can be done in following different ways:
&SYMBOL+ 4& &SYMBOL(5)& &SYMBOL(I)& &SYMBOL(Z)& &SYMBOL(C)& &SYMBOL(R)& &SYMBOL(S)& &SYMBOL(5,2)& &SYMBOL(E3)& &text1SYMBOLtext2& = Off set = Length = If the symbol is initial, output nothing = Suppress leading zeros = Compress blanks = Right-justified output = Suppress +/- sign = Decimal place formatting = Exponential notation = Concatenation of symbol and text
Examples :
&VBDPR-MATNR+2(4)& &VBDKL-BRGEW(I13)& &Currency : VBDKA-WAERK&
Layout Set
Commands
IF..ELSE..ENDIF can be used within the layout set to control the flow of logic. Example : /: /: /: /: /: . / IF &VBRK-VKORG(2)& EQ HG. DEFINE &PREFIX& = Mr.. ELSE. DEFINE &PREFIX& = Mrs.. ENDIF. &PREFIX&
Layout Set
Commands
CASE ..ENDCASE command can also be used in the layout set to control the flow of logic. Example : /: /: / /: / /: CASE &VBDKL-VKORG(2)& WHEN HG Case # &934VBDPL-SORTKRI& WHEN OTHERS Case # &999VBDPL-SORTKRI& ENDCASE
Layout Set
Commands
Using the command NEW-PAGE, a page -break can be made in SAPscript at any position before the end of the page defined in the layout set. The next page can be specified explicitly.
Syntax: /: NEW-PAGE [PAGE]
A page break within a paragraph can be prevented by using this command PROTECT..ENDPROTECT.
Syntax : /: PROTECT
Layout Set
Commands
The command ADDRESSENDADDRES formats an address according to the postal standards of the country of destination which is defined in the parameter COUNTRY.
Syntax : /: ADDRESS DELIVERY PARAGRAPH paragraph [ PRIORITY prio LINES lines ]
/: /: /: /: /: /: /: /: /: /:
TITLE form of address NAME name1[, name2[, name3[,name4]]] STREET strno POBOX pobox [CODE code] POSTCODE postal code CITY city1[,city2] REGION district COUNTRY recipient country FORMCOUNTRY sender country ENDADDRESS
Layout Set
Commands
Parameter PRIORITY defines which address lines may be omitted, if necessary. The possible values are as follows :
A B C 2 3 4 L S O Form of address Mandatory blank line 1 Mandatory blank line 2 Name2 Name3 Name4 Country name Street line City line
The parameter LINES are available for formatting the address. Possible values are from 1 to n. If it is not possible to format all address data due to a lack of lines, the data which is entered in the parameter PRIORITY is omitted.
Layout Set
Commands
The date can be formatted using the command SET DATE MASK = . After formatting all date fields are output as specified. The available formats for day, month and year are following.
DD MM MMMM YY YYYY
Example :
The formatting can be reset at any point of time by /: SET DATE MASK = . Formatting is then carried out as defined by the System.
Layout Set
Commands
The time can be formatted using the command SET TIME MASK = . After formatting all time fields are output as specified. The available formats for hours, minutes and seconds are following.
HH MM SS Example Hours Minutes Seconds /: SET TIME MASK = HH:MM:SS
The formatting can be reset at any point of time by /: SET TIME MASK = . Formatting is then carried out as defined by the System.
Layout Set
Commands
In SAPscript, any text can be included at a certain position in the document using INCLUDE command.
Syntax : INCLUDE name OBJECT object ID identifier PARAGRAPH paragraph LANGUAGE language Example : INCLUDE &VBDPL-TDNAME& OBJECT VBBP ID 0001 PARAGRAPH IT INCLUDE SD_TEXT OBJECT TEXT ID SDVD PARAGRAPH HT
Layout Set
Commands
The name in the include command is always the document no for APPLICATION TEXT and the name of standard text for STANDARD TEXT. Example : vbdka-tdname, vbdkl-tdname, vbdkr-tdname. The text object specifies the environment to which a text belongs. TEXT NAME TEXT ORIGIN VBBK Sales document Header Text KNVV Customer Master SD Text VBKA Contacts General Text VTTK Shipment Header Text The object is always TEXT for STANDARD TEXT.
Layout Set
Commands
Several different text IDs can belong to one object . TEXT ID 0002 Sales document header note1. 0003 Sales document header note2.
Output Program
Program retrieves the data to be printed in a Layout set. Structure of Programs
Stand alone Transaction Triggered
Overview
Communication in between program and layout set is done via execution of function calls and communication structures. Execution sequence of function calls
A layout set must be opened before being able to output data. Data can be transfer as often as required.
Output Program
Function Call
General Function calls:
CALL FUNCTION OPEN_FORM . CALL FUNCTION WRITE_FORM . CALL FUNCTION CLOSE_FORM . CALL FUNCTION CONTROL_FORM . CALL FUNCTION READ_TEXT .
Output Program
Function Call
CALL FUNCTION OPEN_FORM
EXPORTING FORM LANGUAGE DEVICE = .. OPTIONS DIALOG = .. APPLICATION LANGUAGE ..
= ..
= .. = .. = .. = .. = ..
IMPORTING EXCEPTIONS
Output Program
Function Call
OPEN_FORM opens layout set for Printing . Parameters
LANGUAGE defines the layout set language version . DEVICE specifies the output device type . ( Example : PRINTER, SCREEN, TELEX, TELEFAX) OPTIONS can be used to specify the print preview. DIALOG can request a pop-up screen on which user can enter spool information such as
Output Program
Function Call
Possible Exceptions :
DEVICE FORM OPTIONS UNCLOSED = Device type invalid = Layout set does not exist = Options invalid = A layout set is still active
Output Program
Function Call
CALL FUNCTION WRITE_FORM = ..
EXPORTING ELEMENT TYPE FUNCTION WINDOW = .. = .. = .. = ..
EXCEPTIONS ..
Output Program
Function Call
WRITE_FORM transfer the data to layout. Parameters
Explicitly specify ELEMENT and WINDOW name to output data from a specific ELEMENT. No specification of WINDOW name is necessary for MAIN window. TYPE defines area of the MAIN window, where data need to written. Possible values :
TOP header. = MAIN window
Output Program
Function Call
FUNCTION defines how the data specified in the text element is to be written in the respective WINDOW.
MAIN window
SET
APPEND DELETE = Append to preceding output. = Identical with SET. = Ineffective.
OTHER window
SET APPEND DELETE = Delete old contents and output new text. = Append to preceding output. = Delete the specified text element.
Output Program
Function Call
Possible Exceptions :
ELEMENT FUNCTION TYPE WINDOW UNOPENED = Text does not exist. = Function is invalid. = Window area is invalid. = Window does not exist. = Layout set printing not opened.
Output Program
Function Call
CALL FUNCTION CLOSE_FORM = ..
EXPORTING RESULT EXCEPTIONS.. = ..
Layout set opened with function OPEN_FORM is closed. Layout set must be closed before being able to output the data on the screen or printer. Possible exceptions :
UNOPENED = No open layout set.
Output Program
Function Call
CALL FUNCTION CONTROL_FORM = ..
EXPORTING COMMAND EXCEPTIONS.. = ..
CONTROL_FORM can execute SAPscript control commands. Example : PROTECT ENDPROTECT. Parameter COMMAND accept the SAPscript command. Possible exceptions : UNOPENED = Layout set printing has not
been opened.
Output Program
Function Call
CALL FUNCTION READ_TEXT ..
EXPORTING OBJECT NAME ID LANGUAGE HEADER LINES = .. = .. = .. = .. = ..
Output Program
Function Call
An application text can be read from text file. HEADER and LINES contain header and text information after successful execution. Work area for header must be defined as a field string.
DATA BEGIN OF HEADER
INCLUDE STRUCTURE THEAD
Output Program
Function Call
Possible Exceptions :
ID LANGUAGE NAME NOT_FOUND OBJECT REFERENCE_CHECK = Text ID invalid. = Language invalid. = Text name invalid. = Text not found. = Text object invalid. = Reference sequence interrupted.
Output Program
Function Call
Document ( e.g. Sales Order ) generation programs can also be triggered via business transaction. Sources of data :
Document SO Delivery Note Picking VDLKK Invoice VDBKR Header Item VDBKAVBDPA VDBKL VBDPL VBLKP VBDPR
Output Determination
Linking a layout set to the printing program Proposing the output type for the documents Output time Output device Print parameters
Configuration
Configuration
Linking Layout set to Program: SD SD Module Menu: SD > Basic
functions > Output > Output determination > Process output and forms > Assign forms and programs > Allocate to sales documents Output type / Medium determines
Printing program Layout set Form routine
Configuration
Program FORM EntryA Interntl = X
By using the FORM Routine field you can indicate different entry point to the printing program. All output type can be associated with the same program / layout set combination but to different FORM Routines. Helps to consolidate logic variation in one program
Configuration
Linking Layout set to Program: MM Purchasing Menu: MM > Module Purchasing > Messages >
Output control > Output control > Define output control for the purchase order Inventory Management Menu: MM > IM > Output determination > Assign layout sets and programs Warehouse Management Menu: MM > WM > Activities > Define print control
Configuration
Linking Layout set to Program: FI Module
Finance Menu: FI > AR & AP > Customer (Vendor) accounts > Line items > Correspondence > Carry out check or correspondence settings >Define form names for printing correspondence Check Printing Menu: FI > AR & AP > Business transaction > Outgoing payments > Automatic outgoing payments > Payment method / Bank
Barcode Printing
To print barcode , follow the steps below :
Select / Create a barcode font in SAP. Create a character string and include the barcode with it. The data need to printed as barcode should be attributed via the character string. e.g. / <BC> * &VBAKA-WERKS& * </>
Logo Printing
To print a Logo, follow the steps below :
Built a Logo. This file can be a bit map or windows meta file. Convert the Logo to a TIFF ( extension TIF ) file. Use program RSTXLDMC to convert the TIF file to a standard text. Print this standard text via SAPscript INCLUDE command.
e.g. /:
INCLUDE ZHEX-IBMLOGO-PCL OBJECT TEXT ID ST
IDoc Applications
Business Connector Internet Intranet ALE IDoc R/3 System Other Systems... EDI Subsystem
R/2 System
Workflow
Electronic Form
SAP AG 1999
EDI: Electronic data interchange between different companies ALE: Electronic data interchange between different systems within one company Systems can exchange IDocs either directly (for example R/3 with R/3) or have them translated into other standards (for example UN/EDIFACT or ANSI X.12) by EDI subsystems. The application which uses IDocs (for EDI or ALE) must be able to write data to IDocs, or read data from IDocs, or both
The difference between EDI and ALE is ALE: it is synchronous data transfer uses file port Destination is not required Data transfer between SAP-SAP
EDI : Asynchronous data transfer trfc port Requires Destination Data transfer is from non SAP to SAP
Document
IDoc
EDI Subsystem
Message
EDI Subsystem
SAP AG 1999
7.Transfer the Data from sending system to destination system T-Code for partner profile we 20 T-Code for port we21 T-Code for RFC destinations sm59 Assigning clients scc4
IDOC
IDOC Intermediate Document which is used to transfer the data from one system to another system It contains 3 types of records : Control Record( only one ) Data Record( One or more ) Status Record( One or more )
One control record which store the seneding and receiving system address. Data records which store the application data in segments and describe the hierarchy of these segments. Status records which determine the defined processing steps for the IDoc. As a result, the number of status records for an IDoc increases as processing continues. T-code for segment we31 T-code for message we30 T-code for idoc we81 T-code for attachinf idoc to message we 82 T-code for status codes we 41 and we 42
Generate IDoc
SAP AG 1999
Generate IDoc
Port Definition Port Definition External System EDI Subsystem ? EDI Subsystem ?
Transfer data, process further
SAP AG 1999
R/3 System Check port & partner, Generate IDoc Post document
ok? No ok? No
Error handling
SAP AG 1999
Documentation Documentation Tools Tools Port Definition, Port Definition, Partner Profiles Partner Profiles
BAPI
BAPI Business Application programming interface The BAPI ActiveX Control enables external applications to access business functions in the r/3 system by calling BAPIs through OLE Automation. The place in SAP R/3 system where we can find all the business object types is called as Business Object Repository. To access the BOR T-code is sw03 To access the BAPIs directly tcode is BAPI
In SAP system we have Business Object types like Classes in oops. Class Vehicle BusinessObjectTypes Customer { { color Cust id No. of wheels Cname Model ---------------Create(BAPIs) function mod. Move(--) {} {} change (---) Stop(------) {} {} Getlist(----){} } }
Classes in OOPs Client: Vehicle scooter : new vehicle() Scooter.color=black Scooter.model = 1998 ----------------If the Client application is VB: Create the BAPI Activex Control Object. An instance of the BAPI ActiveX Contril. Establish a connection to the R/3 System. Create one or more business object instances. Access Business object properties and/or call BAPIs to manipulate business objects. Release business Objects logoff from R/3 system Release the BAPI ActiveX Control object.
Day 11
Exercises