Beruflich Dokumente
Kultur Dokumente
Course Overview - 1
Objetivos del curso
Haga clic para modificar el estilo de título del patrón
A la finalización del curso será capaz de:
• Identificar
z Haga clic para modificarObjetos dede
el estilo negocio
texto del patrón
• Identificar y utilizar las BAPIs
z Segundo nivel
• Crear RFCs
z Tercer nivel
• Ampliar la funcionalidad de las BAPIS
z Cuarto nivel
• Utilizar las BAPIs en el entorno ALE
z Quinto nivel
Course Overview - 2
Contenido del curso
Haga clic para modificar el estilo de título del patrón
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Course Overview - 3
Contenido del curso
Haga clic para modificar el estilo de título del patrón
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Course Overview - 4
Escenarios de integración
Haga clic para modificar el estilo de título del patrón
Course Overview - 5
Interfaces
Haga clic para modificar el estilo de título del patrón
RFC
CPI-C
TCP/IP LU6.2
Course Overview - 6
Remote Function Call
Haga clic para modificar el estilo de título del patrón
R/3 System Externes System R/2 System
z Tercer
RFCnivel
Interface RFC Interface RFC Interface
z Cuarto nivel
z Quinto nivel
RFC Interfaces
R/3 System
Offilog 2001 Universidad (Salvador Seda) / 7
Remote Function Call (RFC) is a communications interface based on CPI-C, but with more functions and
easier for application programmers to use. You can use SAP R/3 and SAP R/2 Systems as well as external
applications as RFC communication partners. For more information, see SAP Notes 13903 and 116051.
RFC is the protocol for calling special subroutines (function modules) over the network. Function modules
are comparable with C functions or PASCAL procedures. They have a defined interface through which
data, tables and return codes can be exchanged. Function modules are managed in the SAP R/3 System in
their own function library, called the Function Builder (transaction SE37).
The Function Builder provides application programmers with a useful environment for programming,
documenting and testing function modules that can be called locally as well as remotely.
You maintain the parameters for RFC connections using transaction SM59. The SAP R/3 System is also
delivered with an RFC-SDK (Software Development Kit) that uses extensive C libraries to allow external
programs to be connected to the SAP R/3 System.
Course Overview - 7
Objetos de negocio
Haga clic y BAPIs
para modificar el estilo de título del patrón
BOR: Business Object Repository BAPIs are used for:
Distributed scenarios (ALE)
z Haga clic para modificar el estilo de texto del patrón
contains
BAPI
BAPI
method
Business Workflow
External Programs
...
Business objects form the basis for communicating on high (user-friendly) network layers. For example,
they enable the SAP R/3 System to support the Internet and desktop programs to be connected. The goal
of SAP’s object-oriented strategy is to integrate objects at a business level rather than on a purely technical
level. You can create and manage business objects using transaction SWO1.
Business objects:
y Form the basis of well-defined communication between client / server systems.
y Are business-oriented: there are objects such as “customer”, “order” or “employee”.
y Provide business functions (methods). For a “customer” object, for example, there are
“Create customer” and “View customer” methods. These names support clear and therefore
error-free programming.
y Are managed centrally in the SAP R/3 System in the Business Object Repository (BOR).
Business Application Programming Interfaces (BAPIs) are functional interfaces. They use the business
methods from the business objects. BAPIs may be addresses within or outside the SAP R/3 System. You
can create and manage BAPIs using the transaction BAPI.
For specifications and more information about BAPIs, see the alias “bapi” in the SAP Service
Marketplace.
Course Overview - 8
ALE - Application
Haga Link Enabling
clic para modificar el estilo de título del patrón
Distributed
z Business
Haga clicProcesses
para modificar el estilo de texto del patrón
z Segundo nivel Accounting
Central Controlling
Information systems:
z Tercer nivel Inventory
Purchasing
z Cuarto nivel Sales
Course Overview - 9
EDI Architecture
Haga clic para modificar el estilo de título del patrón
z Segundo nivel
Control record
z Tercer nivel
z Cuarto nivel Data
record
z Quinto nivel
Control record
Electronic Data Interchange (EDI) describes the electronic exchange of structured business data between
applications.
EDI architecture consists of:
y EDI-enabled applications; they allow business transactions to be processed automatically
y The IDoc interface; this was designed as an open interface and consists of the intermediate documents
(IDocs) and the corresponding function modules, which create the interface to the application.
y The EDI subsystem; this converts the intermediate documents into EDI messages and back. SAP does
not supply this element of the EDI architecture.
The main component of the IDoc interface is the IDoc type. An IDoc is an SAP standard that specifies the
structure and format of the data to be transferred electronically. It was developed to support the EDIFACT
and ANSI X12 standards. IDocs are identified uniquely using a control record. The application data
records form the core. The status records log the status of an IDoc as it is passed from the application to
the trading partner and back.
XML will most likely be used more and more for transferring business information between enterprises.
Course Overview - 10
Transferencia de datos utilizando Batch Input
Haga clic para modificar el estilo de título del patrón
External System SAP R/3 System
Batch Input
SAP Interfaces
Sequential File
and Checks
When you transfer data from one SAP R/3 System to another, or from an external system to an SAP R/3
System, you must ensure the integrity of the data that is transferred. This means the external data must be
subjected to the same checks and controls as data that was entered manually online.
As the online checks in transactions are very comprehensive and are partly used across applications, it is
very difficult to program them yourself.
The best and easiest way is to use the online checks in SAP transactions, which also includes using SAP
transactions for data transfer.
The methods used to transfer external data are known as "batch input” methods.
For many areas, SAP provides standardized external data transfer methods. These methods use batch
input, call transaction and direct input programming methods. The SAP standard direct input methods
are controlled using the Data Transfer Workbench (transaction SXDA). If no SAP standard transfer
method is available, you can program transfers using batch input or call transaction. For more information,
see the next slide.
Course Overview - 11
Transferencia de datos utilizando Batch Input
Haga clic para modificar el estilo de título del patrón
BATCH INPUT: CALL TRANSACTION: DIRECT INPUT:
Sequential Sequential Sequential
File File File
z Haga clic para modificar el estilo de texto del patrón
z Segundo
BDC- nivel
BDC-Tabelle BDC-
BDC-Tabelle
z Tercer nivel
z Cuarto nivel
Queue File SAP
CALL
z Quinto nivel TRANSACTION
Transfer
Program
Batch
Batch Input
Input Function
Function
Application
Application Function
Function Application
Application Function
Function
With batch input, transfer data is buffered as a Batch Data Communication (BDC) table in a queue file
(batch input session). In the next step, the system processes this session, that is, the data is transferred to
the application transaction within the batch input environment and therefore entered in the database.
SAP R/3 Systems enable you to record a transaction in dialog mode. You can use this recording to
generate a batch input session and a transfer program.
Alternatively to batch input, you can also call the transaction directly (Call Transaction) after a data
record is taken from the sequential file and placed in the BDC table. The read and write process for the
queue file does not apply here.
The batch input and call transaction methods access application transactions within the component system.
The data is therefore subjected to the same consistency checks before it is transferred as data in the dialog
mode.
Direct input programs execute the consistency checks and update the data in the database, without having
to access the application transactions. Direct input methods are used in a few SAP standard transfer
methods such as transferring bills of material and documents). These processes are only programmed by
SAP developers.
Course Overview - 12
Integración Office
Haga clic para medianteelOLE
modificar estilo de título del patrón
Frontend SAP R/3 System
OLE Client
ABAP Program
z Cuarto nivel
PC Program
z Quinto nivel Function Module
OLE Server
Function Module
PC Program
Function Module
Course Overview - 13
SAP Automation
Haga clic para modificar el estilo de título del patrón
Course Overview - 14
Internet Transaction
Haga clic Server
para modificar el estilo de título del patrón
DIAG
z Cuarto
Internetnivel
HTTP
Internet
CGI WGate TCP/IP AGate
Comp.
Browser Server RFC system
z Quinto nivel
HTML Page Output
HTML CSS
Templates Files
The web server and component system is connected through SAP’s Internet Transaction Server
(ITS). The ITS is used for the following tasks:
y Data exchange (for example using protocol conversion);
y Logging on in a component system;
y Forwarding of data to component systems, conversion of output into HTML;
y Status administration.
The ITS consists of two components:
y Wgate: The interface to the Web server. The WGate and the Web server must be running on the
same hardware. As well as the Common Gateway Interface (CGI), SAP supports the secure
interfaces ISAPI (Microsoft) and NSAPI (Netscape).
If you are using Microsoft’s IIS Web servers, you can find the WGate as a DLL file in the Scripts
folder.
y Agate: Exchanges data with the component systems. It can be run on the same hardware as the
WGate (single host) or on its own server (dual host). Several files that are stored on the AGate
configure the ITS. Among these are:
- Service files: Specify the component system and logon data (client, user, and password)
- HTML Business Templates: HTML with additional commands, placeholders for display fields
- CSS files: Describe the optical and functional layout of the generated HTML pages
Course Overview - 15
SAP Business Connector
Haga clic para modificar el estilo de título del patrón
SAP
SAP
z Haga clic para modificar elSystem
estilo
System
de texto del patrón
XML
z Segundo
SAP
nivel HTML
BC SAP Business Connector
Tercer nivel
z SAP Web
Web
SAP
System
System Browser
Browser
z Cuarto nivel
z Quinto nivel Internet Technology
SAP BC or XML
B2Bi Server HTML/ Web
Web
XML Content
Content
Non
Non SAP
SAP XML XML Server
Server
Systems
Systems Interface
Web
Web
Non
Non SAP
SAP Applic-
Applic-
Systems
Systems ations
ations
Course Overview - 16
Contenido del curso
Haga clic para modificar el estilo de título del patrón
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Course Overview - 17
Qué es una BAPI?
Haga clic para modificar el estilo de título del patrón
Business Application Programming Interface
z Haga clic para modificar el estilo de texto del patrón
Interface nivel
zz Segundo bien definido para datos y procesos de R/3
Implementado
zz Tercer nivel como una RFC
Métodonivel
zz Cuarto de un objeto de negocio del Business Object Repository
z Quinto nivel
SAP created the Business Framework to allow the technical integration and exchange of business data
among SAP components and between SAP and non-SAP components. Important components of the
Business Framework are the Business Application Programming Interfaces (BAPIs), which represent
visible interfaces at the component boundaries and whose properties serve to integrate these
components.
BAPIs represent well-defined, internally consistent units that always represent business facts and leave
a consistent database state behind.
The business contents can be standardized, since BAPIs not only allow the integration of the SAP
system and other software components at a technical level, but also at the business level.
Stability and compatibility
Once SAP has released a BAPI, its interface definitions and parameters will remain stable in the long
term, which means application programs will not be affected by changes to the underlying SAP
software or data. If upward-compatible enhancements are made to the BAPIs, the stability of the
existing applications is not affected.
Openness
BAPIs can be accessed from any widespread development platform.
Course Overview - 18
Usos
Haga clic para modificar el estilo de título del patrón
Course Overview - 19
Atributos
Haga clic para modificar el estilo de título del patrón
You can access BAPIs from external clients like methods access objects, which are themselves an
instance in the client.
SAP guarantees that no incompatible changes will be made to the interfaces of BAPIs.
You can also use BAPIs within the R/3 System to access business data. This makes it easier for
customers and partners to add to the functions offered by the system.
Displaying data that is transmitted to a BAPI or that is returned from a BAPI must be done from the
calling program.
The return parameter RETURN contains success or error messages for the BAPI, and depending on the
SAP R/3 Release has the dictionary structure BAPIRETURN, BAPIRETURN1, BAPIRET1,
BAPIRET2 or BAPIRET2_FIX. The (common) relevant fields of these structures are:
TYPE (Message type: S(uccess), E(rror), W(arning), I(nformation) ) ;
ID (message class) ; NUMBER (message number) ; MESSAGE (message text) ;
MESSAGE_V1 , MESSAGE_V2 , MESSAGE_V3 , MESSAGE_V4 (message variables)
If the transmission is successful, RETURN is either completely empty (all the fields have their initial
fields for their types), or only the TYPE field has the value 'S'. Refer to the documentation to find out
which applies to the BAPI you are using.
Course Overview - 20
Actualización de base de datos
Haga clic para modificar el estilo de título del patrón
Database updates in BAPIs are always performed by an update. The update type (synchronous or
asynchronous) is specified when you call the COMMIT-BAPIs.
In BAPIs containing database updates, a COMMIT / ROLLBACK WORK is not used. Closing or
rejecting a BAPI-LUW occurs by calling a special BAPI from the service object BapiService (object
type 'SAP0001').
BAPI TransactionCommit (relevant function module BAPI_TRANSACTION_COMMIT)
BAPI TransactionRollback (relevant function module BAPI_TRANSACTION_ROLLBACK)
Course Overview - 21
BAPIs Estándar
Haga clic para modificar el estilo de título del patrón
Course Overview - 22
Ejemplo
Haga clic para modificar el estilo de título del patrón
Course Overview - 23
Contenido del curso
Haga clic para modificar el estilo de título del patrón
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Course Overview - 24
RFC – Introducción
Haga clic para modificar el estilo de título del patrón
Course Overview - 25
RFC – Introducción
Haga clic para modificar el estilo de título del patrón
Course Overview - 26
RFC – Posibilidades
Haga clic para modificar el estilo de título del patrón
RFC is available for R/3 as of Release 2.1A. For R/2, RFC is available as of Release 5.0D with
limitations regarding error handling and data volume. These limitations have been eliminated with
Release 5.0H. SAP plans to implement these corrections from version 5.0H on all releases as of 5.0D.
The following RFC couplings are possible in the SAP environment:
- R/3 to R/3: (the systems involved may have different releases)
- R/3 to external system: (external platforms are all R/3 server and front-end platforms)
- R/3 to R/2: (R/2 may run on IBM or SNI platforms)
- R/2 to external system: (external platforms are all R/3 server and front-end platforms)
You should note which communication partner initiated the connection either the server or the client).
This has a strong influence on the configuration and the programming.
If there is no RFC support offered by SAP for a specific platform, you can use the underlying CPI-C
interface. If this does not work, you must use suitable platform-specific programming (for example,
socket programming) to build a connection to the SAP communication components.
Course Overview - 27
RFC de clic
Haga sistema
para SAP a SAPel estilo de título del patrón
modificar
The only difference between a remote call of a function module to another server and a local call is a
special parameter (destination) that specifies the target server on which the program is to be executed.
There are three types of RFC calls:
Synchronous RFC call: The calling program stops until the function module has been processed on
the target server and any results have been returned to the caller. Only then does the calling program
continue processing.
Asynchronous RFC call: The calling program runs parallel to and independently of function module
processing in the target system. Programmers are responsible for the processing of the results. In
addition, the target system must also be available at the time of the RFC call.
Course Overview - 28
Requisitos
Haga clic para
para sistemas
modificarno-SAP
el estilo de título del patrón
z RFC Library, available for
Win32
z Haga (librfc32.dll)
clic para modificar el estilo de texto del patrón
Linux nivel
z Segundo
Other SAP-supported Unix flavors
z Tercer nivel
OS/390
z Cuarto nivel
OS/400
z Quinto nivel
OS/2
Macintosh (client only)
Course Overview - 29
Soluciones paramodificar
Haga clic para RFC el estilo de título del patrón
z Windows
SAP
z Haga clicDCOM
para Connector
modificar el estilo de texto del patrón
SAP ActiveX
z Segundo nivel Controls
Java nivel
zz Tercer
SAP Java Connector (JCO)
z Cuarto nivel
SAP Business Connector
z Quinto nivel
Course Overview - 30
Lenguajes
Haga clic de programación
para modificar el estilo de título del patrón
z Java
C clic para modificar el estilo de texto del patrón
zz Haga
Cualquier
zz Segundo lenguaje que soporte ActiveX
nivel
Visual
z Tercer Basic
nivel
Visual
z Cuarto C++
nivel
many others
z Quinto nivel
Course Overview - 31
Destinos
Haga clicRFC
para modificar el estilo de título del patrón
Course Overview - 32
Destinos
Haga clicRFC – modificar
para Conexión el
SAP
estilo de título del patrón
Course Overview - 33
Destinos
Haga clicRFC – modificar
para Conexión el
Externa
estilo de título del patrón
For connections to external RFC server programs, you need a destination with the type T. there are 2
variations of the T type:
1. Start: The external program is started when communication is being established.
a) On the application server: The external program is started on the current R/3 application server.
You must give the complete program path including the program names.
b) On the explicit host: The external program is started on the specified host.
You must specify the following:
- Host name --> Name of the machine where the external program is located
- Path --> Complete path including program names on an external host
c) Front end workstation: The external program is started on the current front end at runtime via the
SAPgui. You must enter the compete (absolute) path of the program including program names.
2. Registration: These destination variations let you access a program that has already started, which
has registered itself on a gateway. This program must be started manually beforehand and registers
itself using an RFC call with a program ID on a gateway (see the online documentation). With this
variant, the start time is not required. It is suited to starting a program frequently. You must specify
the following:
- Program-ID --> ID under which the external server program registered on the SAP gateway
- Gateway --> Host and TCP/IP service of the gateway where the external
program registered (If the gateway is the one for the current application server, this
information is not required.)
Course Overview - 34
Remote Function
Haga clic Call
para modificar el estilo de título del patrón
z Interface estándar y bidireccional para la integración entre
sistemas SAP y sistemas no-SAP
z Haga clic para modificar el estilo de texto del patrón
z Diferentes variantes
z Segundo nivel
• Síncrona
z Tercer nivel
• Asíncrona
z Cuarto nivel
• Transaccional
z Quinto nivel
• Queued
Course Overview - 35
RFC Síncrona
Haga clic para modificar el estilo de título del patrón
Course Overview - 36
RFC Flujo
Haga clicsíncrono
para modificar el estilo de título del patrón
With synchronous RFC, processing stops in the calling program until the called remote function is
processed and its output is returned. Then in the calling program, the processing continues after the
call.
Course Overview - 37
RFC Flujo
Haga clicsíncrono - Sintaxis
para modificar el estilo de título del patrón
The statement CALL FUNCTION ... DESTINATION enables you to call remote ABAP function
modules or C routines in external server programs.
When you call a function in this way, always include handling for the standard exceptions
COMMUNICATION_FAILURE and SYSTEM_FAILURE.
The exception COMMUNICATION_FAILURE is resolved by the system if the specified destination
in the sideinfo table RFCDES is not maintained, or if the connection to the remote system cannot be
established.
The exception SYSTEM_FAILURE is resolved if the function module or C routine that you want to
start in the remote system is not available.
Course Overview - 38
RFC Flujo
Haga clicsíncrono - Contexto
para modificar el estilo de título del patrón
The connection to a remote destination remains intact for as long as the context of the calling program
remains active. The function groups addressed in the remote destination remain active for as long as the
calling program itself remains active (this is the same as with local calls). This means that if you call
two function modules from the same function group one after the other, they can both access the same
global data of the function group.
Each function module called using synchronous RFC forms its own logical unit of work (LUW)
Course Overview - 39
RFC Flujo
Haga clicsíncrono - Debugg
para modificar el estilo de título del patrón
You can debug function modules called remotely in R/3 - R/3 connections.
Course Overview - 40
RFC Flujo
Haga clicAsíncrono
para modificar el estilo de título del patrón
In an asynchronous Remote Function Call, the called remote function is started and then continues
processing on its own immediately in the calling program. Remote function processing is separate
from the calling program. The function output can be received later in the program.
Asynchronous RFC is intended for parallel processing of processes.
Course Overview - 41
RFC Flujo
Haga clicAsíncrono - Sintaxis
para modificar el estilo de título del patrón
With the addition STARTING NEW TASK <task name> you can call a remote function module
asynchronously. You can use any task name.
The function module that you call is executed in its own work process.
You can also use aRFC in background processing. Note, however, that even here, each aRFC call
occupies a dialog work process.
In the sideinfo table RFCDES, you can set the number of aRFC calls for each destination using the
aRFC options. After these aRFC calls an automatic load check is performed on the target server. If
resource bottlenecks are detected, the system waits for a short time for the next aRFC call,
meant for the same remote system, and the client program is rolled out of its work process. It can then
receive results from previous aRFC calls.
During the call, you may not specify an IMPORTING addition since the call does not wait for the end
of the function module. Here, you can only handle the two system exceptions,
COMMUNICATION_FAILURE and SYSTEM_FAILURE for the same reason. The function module
output must be received and the function module-specific exceptions must be handled later on in a
different place. (See following slides)
Receiving the function module output and handling the function module-specific exceptions are
optional, however.
Course Overview - 42
RFC Flujo
Haga clicAsíncrono – Confirmación
para modificar el estilo de (1)
título del patrón
A program can receive output (parameters and exceptions) from a function module that is running
asynchronously.
To implement this, when you call use the addition "PERFORMING <subprogram> ON END OF
TASK", where the specified subroutine must exist in your program, and through which the output of
the function module is received using command "RECEIVE RESULTS FROM FUNCTION
<fbname> . .". When the function module ends, the subroutine is called automatically.
The subroutine must also have a formal parameter with any name you choose. When the subroutine is
called, it receives the accompanying task name. This parameter lets you see which aRFC call just
ended, and you can receive the relevant
output using the RECEIVE RESULTS FROM FUNCTION command.
The subroutine may not contain any statements that interrupt the program execution (such as CALL
SCREEN, SUBMIT, COMMIT WORK, WAIT, RFCs, W or I messages). WRITE statements in this
subroutine specially defined for aRFC have no effect.
The subroutine can only be executed automatically if the calling program is in rollout status. ->
"WAIT UNTIL" statements (see next slide).
The addition KEEPING TASK with the RECEIVE statement causes the function group context that
was loaded remotely to wait until the calling program has ended. This lets you use the old remote
context with later aRFC calls with the same task name.
Course Overview - 43
RFC Flujo
Haga clicAsíncrono – Confirmación
para modificar el estilo de (2)
título del patrón
The language element WAIT UNTIL with the addition PERFORMING is only useful with aRFC, and
otherwise has no effects.
When the WAIT UNTIL statement is executed, the conditions specified are checked.
If it is fulfilled, the program processing continues directly after the WAIT UNTIL statement.
Otherwise the system waits in rollout status for the output from the aRFCs. If the aRFC output is now
returned, the form routine specified during the call is executed and is sent back to the WAIT UNTIL
statement.
This check/wait procedure repeats until the WAIT conditions are fulfilled, or until there are no more
open RFC calls.
Note that the WAIT UNTIL statement sets the SY-SUBRC. Therefore, store the SY-SUBRC value
(set in the form routine by exceptions-handling in RECEIVE RESULTS) in its own global variable
before leaving the form routine, if you need this value again later (after WAIT UNTIL).
Course Overview - 44
RFC Flujo
Haga clicAsíncrono – Ejemplo
para modificar el estilo de título del patrón
In this program example, the are two aRFCs, and when the aRFCs are confirmed, the subroutine UP1
is always executed.
This subroutine uses parameter T to separately decide which function module just returned its output.
Then the corresponding RECEIVE RESULTS statement is used to receive (and process)
the output.
After processing an aRFC output, you must correspondingly adjust the WAIT UNTIL condition.
(Here: Set flag1 or flag2)
Course Overview - 45
RFC Flujo
Haga clicTransaccional
para modificar el estilo de título del patrón
Whereas with synchronous and asynchronous RFC each call makes up a single logical unit of work
(LUW) in the remote system, you can use transactional RFC to bundle several remote functions into
one LUW (with an automatic rollback mechanism in case of error).
You can use tRFC with the addition IN BACKGROUND TASK, which you must place before the
DESTINATION entry. If you specify a COMMIT WORK statement, you bundle all the previously
transmitted tRFCs in one LUW.
tRFCs are also called asynchronously. Unlike aRFC, the output from the called function module
cannot be received.
-> No IMPORTING . . . / PERFORMING . . . ON END OF TASK when calling;
-> No RECEIVE RESULTS FROM FUNCTION . . .
In the source system, you can use the administration transaction SM58 that lets you display and modify
tRFC-LUWs.
Course Overview - 46
RFC Flujo
Haga clicTransaccional
para modificar–elMecanismo ejecución
estilo de título del patrón
tRFC calls are first stored in the local tRFC tables ARFCSSTATE and ARFCSDATA. The execution
status of the LUWs is logged in table ARFCSSTATE, while ARFCSDATA contains the input data for
the tRFCs.
If you do not want to execute a remote LUW immediately, rather trigger it at a later time, call the
function module START_OF_BACKGROUNDTASK before the COMMIT WORK statement
locally. Here, you must enter the date and time of execution.
The COMMIT WORK statement automatically schedules an immediate job or a job set for a later start
time to remotely call the LUW. In the job execution, the relevant data is read from the tRFC tables,
and the corresponding tRFCs are transmitted. If the remote LUW is executed successfully, the
accompanying entries are deleted from the tRFC tables. If an error occurs, an automatic repeat
mechanism, or rollback mechanism is activated (see next slide).
If the update is triggered locally because of the COMMIT WORK statement, the tRFCs are only
executed when the local update is successfully completed.
Course Overview - 47
RFC Flujo
Haga clicTransaccional
para modificar–elErrores
estilo de título del patrón
If a connection cannot be made to the partner, this is logged in the tRFC status table ARFCSSTATE
(which you can see by using Transaction SM58), and the job is rescheduled. You can set in the
destination the number of times the system repeats the effort to connect, and the time intervals, by
using the tRFC options. The default is a maximum 30 times with a 15 minute interval.
If, after a tRFC-LUW is successfully executed in the partner system in one of the function modules, the
program terminates with an A/X-message (MESSAGE A/X...) or triggers an exception (RAISE...),
- all the changes made in the current LUW are automatically rolled back in the remote system, and
- the remote program termination is logged in the tRFC status table ARFCSSTATE (viewable using
SM58) in the source system.
The entries relevant to the LUW remain in the tRFC tables and the execution job is not rescheduled.
In this case, you can find the remote error using Transaction SM58, and you have to correct the
problem in the remote system. Afterward you must trigger the remote execution again also in
Transaction SM58.
If you want to cancel and roll back this remote execution from a remote function module of a tRFC-
LUW, but you also want to reschedule the job in the source system (for example, because a master
record that is to be processed is locked and the LUW must be executed again), call the function module
RESTART_OF_BACKGROUNDTASK in the remote function module instead of MESSAGE A... or
RAISE...
Course Overview - 48
RFC Flujo
Haga clicQueue
para modificar el estilo de título del patrón
With tRFC, generated LUWs are processed independently of each other. This means, the order in
which they are processed is not always the order in which they are generated.
To ensure that tRFC-LUWs are processed in the same order as they were generated, you can use qRFC
as an extension of tRFC.
qRFC is available as of Release 4.6A and can be used in R/3-R/3 connections as well as R/3-external
connections.
Course Overview - 49
RFC Flujo
Haga clicQueue - Sintaxisel estilo de título del patrón
para modificar
Course Overview - 50
RFC Flujo
Haga clicQueue - Datos el estilo de título del patrón
para modificar
The tRFC-LUWs belonging to a queue are stored in the tRFC tables ARFCSSTATE and
ARFCSDATA. However, you cannot maintain or display these LUWs using Transaction SM58. You
must use the queue administration transaction SMQ1.
The queue data (queue attributes + pointers to the relevant tRFC-LUWs in the tRFC tables) is stored in
the TRFCQOUT table, which you can maintain using Transaction SMQ1.
The following functions are available:
- List queues
- Display queues with a list of accompanying LUWs and function modules including input data
- Start/stop transmitting the queues
- Delete queues
If an LUW error occurs in the remote system, the queue is rolled back there. The relevant LUW and all
of the other LUWs in the queue remain in the queue and in the tRFC tables. After correcting the error,
you can use Transaction SMQ1 to transmit the queue again.
Course Overview - 51
Creación
Haga clicRFC
para(1)modificar el estilo de título del patrón
Function modules are special external subroutines stored in a central library called the Function
Builder. The R/3 System provides numerous predefined function modules that you can call from your
ABAP programs, and you can create your own customer function modules.
The interface facilitates and standardizes the passing of inbound and outbound parameters. For
example, you can assign default values to the inbound parameters of function modules.
You can combine several function modules to form a function group in the Function Builder. Since you
can define global data that can be accessed from all function modules of one function group, it is
reasonable to include function modules that operate with the same data, for example an internal table,
in one function group.
Course Overview - 52
Creación
Haga clicRFC
para(2)modificar el estilo de título del patrón
Course Overview - 53
RFC - Atributos
Haga clic para modificar el estilo de título del patrón
Course Overview - 54
RFC - Import
Haga clic para modificar el estilo de título del patrón
Course Overview - 55
RFC - Export
Haga clic para modificar el estilo de título del patrón
Course Overview - 56
RFC - Modificación
Haga clic para modificar el estilo de título del patrón
Course Overview - 57
RFC - Tablas
Haga clic para modificar el estilo de título del patrón
Course Overview - 58
RFC - Excepciones
Haga clic para modificar el estilo de título del patrón
Course Overview - 59
RFC – Código
Haga clic parafuente
modificar el estilo de título del patrón
Course Overview - 60
RFC – Ejecutar
Haga clic para modificar el estilo de título del patrón
Course Overview - 61
RFC – Ejecutar
Haga clic para modificar el estilo de título del patrón
Course Overview - 62
Contenido del curso
Haga clic para modificar el estilo de título del patrón
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Course Overview - 63
Business
Haga clicObjects
para modificar el estilo de título del patrón
Course Overview - 64
Tipo declic
Haga objeto
parae modificar
instancia el estilo de título del patrón
Course Overview - 65
Ejemplos
Haga clicBusiness Objectsel estilo de título del patrón
para modificar
Course Overview - 66
Business
Haga clicObject Repository
para modificar el (BOR)
estilo de título del patrón
Course Overview - 67
Componentes demodificar
Haga clic para Aplicación
el estilo de título del patrón
Course Overview - 68
Business
Haga clicObject Browser el estilo de título del patrón
para modificar
Transacción SWO2
z Haga clic para modificar el estilo de texto del patrón
z Segundo nivel
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Course Overview - 69
Business
Haga clicObject Builder el estilo de título del patrón
para modificar
Transacción SWO1
z Haga clic para modificar el estilo de texto del patrón
z Segundo nivel
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Course Overview - 70
Ejemplo Objeto
Haga clic para modificar el estilo de título del patrón
Course Overview - 71
Tipo de objeto - Definición
Haga clic para modificar el estilo de título del patrón
Events Report
Course Overview - 72
Objetos
Haga clic para modificar el estilo de título del patrón
z Tercer nivel
Table 1 Table 2 TA01
z Cuarto nivel Application
Key Fields Key Fields TA02
z Quinto nivel ReportXX
Events
Course Overview - 73
Utilización de objetos
Haga clic para modificar el estilo de título del patrón
Step definition
z Haga clic para modificar el estilo de texto
Conditional Forkdel patrón
branch
z Segundo nivel
Loop
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Container operation
Wait for
event
Event
creator
Course Overview - 74
Objeto - Propiedades
Haga clic para modificar el estilo de título del patrón
z Data encapsulation
Haga
z z clic para modificar el estilo de texto del patrón
Inheritance
Segundo
z z nivel
Polymorphism
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Object definitions and implementations can only be manipulated via the Business Object Builder.
Data encapsulation - definition: Abstraction for the modeler, irrespective of the concrete SAP tables, transactions,
etc.
Data encapsulation - runtime: A standard interface for calling application functionality is available to the workflow
runtime system, irrespective of the actual implementation.
Inheritance: Object properties such as attributes, methods and events are passed on to subtypes. Properties inherited
can be redefined in the subtype.
Polymorphism: Depending on the object type, the object manager always selects the relevant implementation for the
property requested. This property is implemented technically using the "late binding" principle.
Dynamic call interface for calls from the workflow runtime system.
Course Overview - 75
Campos clave
Haga clic para modificar el estilo de título del patrón
z Specification of object key
zz Several keypara
Haga clic fields possible
modificar el estilo de texto del patrón
zz Reference to underlying application table(s)
Segundo nivel
zz Client
Tercernot necessary
nivel
z Cuarto nivel
z Quinto nivel
The English ABAP Dictionary names are proposed automatically as the names of the key fields.
Key fields must be character-based.
The concatenated key fields can contain a maximum of 70 characters.
Course Overview - 76
Atributos
Haga clic para modificar el estilo de título del patrón
z Database or virtual attributes
zz Type
Hagainformation from ABAP
clic para modificar Dictionary
el estilo field
de texto delorpatrón
object type
z Segundo nivel
z Single-line and multiple-line attributes
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Database attributes are read from the associated application table and buffered in the object. Source code is
generated beforehand by the Business Object Builder for this purpose.
Virtual attributes are calculated on calling.
There are different macros for single-line and multiple-line attributes.
Course Overview - 77
Atributos virtuales
Haga clic para modificar el estilo de título del patrón
The Business Object Builder cannot generate a source code for virtual attributes. The algorithm required for
calculation of the attribute value must therefore always be explicitly programmed.
Typical examples:
language-dependent texts
time-dependent values
net/gross values
object references
Course Overview - 78
Atributos multilínea
Haga clic para modificar el estilo de título del patrón
z Correspond to internal tables
zz Are almost
Haga always
clic para virtual attributes
modificar el estilo de texto del patrón
zz Can contain
Segundo either database fields or object references
nivel
z Tercer nivel
z Cuarto nivel
z Quinto nivel
Example:
y List of purchase requisitions for a material (BUS1001.PurchaseRequisition).
Course Overview - 79
Métodos síncronos/asíncronos
Haga clic para modificar el estilo de título del patrón
z Synchronous method
Result returned directly to calling program
z Haga clic para modificar el estilo de texto del patrón
Return of exceptions possible
z Segundo nivel
z Asynchronous method
z Tercer nivel
Result can only be returned via an event
z Cuarto nivel
Only restricted exceptions possible
z Quinto nivel
Method itself does not wait for a possible terminating event
Course Overview - 80
Métodos síncronos
Haga clic para modificar el estilo de título del patrón
Method
z Haga clic para modificar el estilo de texto del patrón
Export
z Segundo nivel Import Result
Exceptions
z Tercer nivel
Caller
Course Overview - 81
Métodos asíncronos
Haga clic para modificar el estilo de título del patrón
z Tercer
Caller nivel
z Cuarto nivel
Time
z Quinto nivel
Course Overview - 82
Comunicación con métodos
Haga clic para modificar el estilo de título del patrón
Application error
System error
z Communication via event
Course Overview - 83
Reacción a excepciones – Paso de diálogo
Haga clic para modificar el estilo de título del patrón
Step
z Haga clic para modificar el estilo de texto
(method) del patrón
z Segundo nivel
Tercer nivel
z Temp. Sys. Temp. Sys.
OK
error error error error
z Cuarto nivel
z Quinto nivel
In process Error Subsequent Subsequent Subsequent
step step step
Course Overview - 84
Reacción a excepciones – Paso de fondo
Haga clic para modificar el estilo de título del patrón
Step
(method)
z Haga clic para modificar el estilo de texto del patrón
z Segundo nivel
Temp. Temp. Sys. Temp. Temp. Sys.
OK
Tercer nivel
z error error error error error error
Background steps also offer the option of modeling a repeat counter for a temporary error.
If this repeat counter is modeled and an error occurs, the step is repeated automatically as often as defined, before
either assuming "error" or "completed" status (with subsequent execution of the subsequent step modeled).
Course Overview - 85
Virtual Attributes - Background Method
Haga clic para modificar el estilo de título del patrón
Virtual Attributes Background Methods
z Haga
Read orclic para
calculate modificar
individual values el estilo deortexto
Read del
calculate patrón
a list of
or a list of homogeneous values heterogeneous values
z Segundo nivel
Calculate values which are not
z Tercer nivel dependent on other attributes or
system values
z Cuarto nivel Change values
The buffering of the virtual attributes must be programmed explicitly in the implementation of the attribute.
The return of the value of a virtual attribute to the caller corresponds, in principle, to a result value of a method.
Course Overview - 86
Eventos
Haga clic para modificar el estilo de título del patrón
Course Overview - 87
Tipo de objeto - Estados
Haga clic para modificar el estilo de título del patrón
z Modeled
z Not
Hagaaccessible
clic para at runtime.el estilo de texto del patrón
modificar
zz Implemented
Segundo nivel
Only in tests or internal use, possibly unstable.
z Tercer nivel
z Released
Cuarto nivel
z Released for use by the customer. Only upward-
z compatible enhancements possible.
Quinto nivel
z Obsolete
The functionality has been replaced. The old
functionality is still supported for two releases.
The "modeled" status is the only status in which execution is not possible. Customers should, however, only use
components with the "released" status.
The release information should be noted when a component's status changes to "obsolete".
Course Overview - 88
Tipo de objeto - Parámetros
Haga clic para modificar el estilo de título del patrón
z Object name
z Descriptive name
Haga clic para for objects
modificar of this
el estilo detype
texto del patrón
zz Default
Segundomethod
nivel
Display for presenting an object instance
z Tercer nivel
z Default attribute
z Cuarto nivel
Identifying attribute of an object instance
z Quinto nivel
The object name is used as the element name in the container definition, for example.
The default method is used, for example, when you double-click objects in a list of object links.
The default attribute is used, for example, to display objects in lists.
Course Overview - 89
Implementando campos clave
Haga clic para modificar el estilo de título del patrón
Key Field SalesDocument x
Texts
zName Segundo nivel
Sales document
Description Sales document
z Tercer
Data type referen. nivel
Reference table VBAK
z Cuarto nivel
Reference field
VBELN
Search help
include <object>.
data:
begin of key,
salesdocument like vbak-vbeln,
end of key,
Each object type has a program that implements the object type.
The macro instructions required for programming are incorporated via the include <object>.
The Business Object Builder always works with object references. These references are used to read and manipulate
the actual application data. An object reference of this kind must be created in the calling program with the macro
SWC_CREATE_OBJECT before a method is called or an attribute determined.
Each object program contains the variable SELF which, in turn, contains a reference to the object instance with
which the program was called.
The object-key-sales document variable (generally: object-key-<name of key>) is declared in conjunction with the
BEGIN_DATA OBJECT macro.
The declaration between BEGIN_DATA and END_DATA is generated entirely from the definition data.
Course Overview - 90
Atributos de los campos
Haga clic para modificar el estilo de título del patrón
Attribute DocumentDate x
Attribute DocumentDate
Object type VBAK
get_table_property vbak.
Release 30A
Source if subrc ne 0.
z Tercer nivel
Virtual
exit_object_not_found.
endif.
Database field
end_property.
z Cuarto nivel
Attribute properties
form select_table_vbak using subrc like sy-subrc.
Multiple-line
if object-_vbak-mandt is initial and
z Quinto nivel
Mandatory
Instance-independent
object-_vbak-vbeln is initial.
select single * from vbak client specified
where mandt = sy-mandt and
Data type referen. vbeln = object-key-salesdocument.
Dictionary subrc = sy-subrc.
Reference table VBAK if subrc ne 0. Exit. Endif.
Reference field AUDAT object-_vbak = vbak.
Search help else.
subrc = 0.
Object type vbak = object-_vbak.
Inverse attribute endif.
endform.
Source code is generated in the implementation program to read the date from the application table.
The source code between GET_TABLE_PROPERTY and END_PROPERTY is generated entirely from the
definition data. The form select_table_<table name> is also generated automatically for the actual database access.
The macro EXIT_OBJECT_NOT_FOUND returns the exception "Object not found". This exception corresponds to
the T100 message OL826.
Course Overview - 91
Atributos de los campos
Haga clic para modificar el estilo de título del patrón
Attribute SoldToParty x
Attribute OrderingParty
Object type VBAK
Release 30A get_table_property vbak.
z Haga clic para modificar el estilo
Status Released
de
data subrc liketexto
sy-subrc. del patrón
Texts
* Fill TABLES VBAK to enable Object Manager
z Segundo nivel
Name
Description
Ordering party
Ordering party
* Access to Table Properties
perform select_table_vbak using subrc.
if subrc ne 0.
z Tercer nivel
Source
exit_object_not_found.
endif.
Virtual
Database field
z Cuarto nivel end_property.
The source code between GET_TABLE_PROPERTY and END_PROPERTY is generated entirely from the
definition data.
The macro EXIT_OBJECT_NOT_FOUND returns the exception "Object not found". This exception corresponds to
the T100 message OL826.
An object reference is generated automatically as an attribute value. This procedure only works correctly if the
referenced object type has precisely one key field. Otherwise, the attribute must be implemented itself.
Course Overview - 92
Implementando atributos virtuales
Haga clic para modificar el estilo de título del patrón
Attribute SalesGroup x
Attribute SalesGroup
Object type Z_Bus2032
Release 40A
z Cuarto nivel
Attribute properties
select single * from vbak
where vbeln = object-key-salesdocument.
Multiple-line
* create object(-reference)
z Quinto nivel
Mandatory
Instance-independent swc_create_object
object-salesgroup 'TVKGR' vbak-vkgrp.
Data type referen.
Dictionary * write object(-reference) into container
Reference table swc_set_element container
Reference field 'SalesGroup' object-salesgroup.
Search help
end_property.
z Object type TUKGR Sales group
Inverse attribute
The data declaration is generated from the definition data and is used as a runtime buffer.
The implementation between GET_PROPERTY and END_PROPERTY must be created manually, since there is no
other definition information. The object reference to be returned, in particular, must be created explicitly via the
macro SWC_CREATE_OBJECT.
Both the Business Object Builder runtime buffer "object-salesgroup" and the associated container element
"SalesGroup" must be completed for data transfer.
Course Overview - 93
Implementando atributos virtuales multilinea
Haga clic para modificar el estilo de título del patrón
Attribute Items x
Attribute Items begin_data object.
begin of key,
Object type VBAK
...
Release 30A
end of key,
Status Released
z
Texts
Haga clic para modificar el estilo de texto del patrónitems type swc_object occurs 0.
end_data object.
z Object type VBAP Sales item * Assign object reference to container element
Inverse attribute swc_set_table container 'Items' object-items.
end_property.
The data declaration is generated from the definition data and is used as a runtime buffer.
The implementation between GET_PROPERTY and END_PROPERTY must be created manually, since there is no
other definition information. The object reference to be returned, in particular, must be created explicitly via the macro
SWC_CREATE_OBJECT.
Both the Business Object Builder runtime buffer "object-salesgroup" and the associated container element
"SalesGroup" must be completed for data transfer.
The actual implementation of the attribute also contains a query as to whether the runtime buffer is completed.
Course Overview - 94
Implementando métodos síncronos
Haga clic para modificar el estilo de título del patrón
begin_method display changing container.
Method Display x
z Segundo nivel
Method Display x
end_method.
Method Display
Name
TercerObject
z Description nivel
type
Release
Z_Bus2032
40A
General Status
ResultABAP
type Implemented
z Cuarto nivel
Name Display
Dialog Description Display object
Synchron
z Quinto nivel General Result type ABAP
Result para
The implementation between BEGIN_METHOD and END_METHOD is generated from the definition data.
The macro SWC_REFRESH_OBJECT must also be called after the application functionality for synchronous
methods that can change object attributes, in order to delete the object buffer.
Course Overview - 95
Implementando métodos asíncronos
Haga clic para modificar el estilo de título del patrón
Method DeliveryBlockReset x
Method DeliveryBlockReset
Object type Z_Bus2032
z Haga clic para modificar el estilo de texto del patrón
Release
Status
40A
Implemented
The implementation between BEGIN_METHOD and END_METHOD is generated from the definition data. The
generated source text has been extended so that the transaction is only called if a delivery block is set.
It is not necessary to call the macro SWC_REFRESH_OBJECT in this case, because the object context is always lost
in an asynchronous method
The terminating event must be triggered within the transaction called.
The single-step task that encapsulates this method requires at least one terminating event.
Course Overview - 96
Implementando
Haga clic paraexcepciones
modificar el estilo de título del patrón
Object Type BUS1001: Display Exceptions For Method GETMISSEDVIEWS
Object Edit Goto Utilities View System Help
Cuarto nivel
z Exception
Object type
1000
BUS1001
...
call function 'ENQUEUE_EMMARAE'
exporting
Release 30D matnr = object-key-material
Quinto
z Error type nivel _scope
_wait
= '2'
= 'X'
Temporary error exceptions
Application error foreign_lock = 1.
System error if sy-subrc ne 0.
* temporary error - material currently locked by another user
exit_return 1000 object-key-material space space space.
Message
Application area MA endif.
Message 279 ...
& blocked by another user end_method.
Course Overview - 97
Implementando parámetros de transferencia
Haga clic para modificar el estilo de título del patrón
Object Type BUS2032: Edit Parameters for Method CREATE
Object Edit Goto Utilities View System Help
Parameter Object type Creation rel. Impl. Man. Exp. begin_method create changing container.
SalesDocumentType VBAK 21A
z Segundo nivel
TransactionCode VBAK 21A data: salesdocumenttype like tvak-auart,
transactioncode like t180-tcode.
Parameter SalesDocumentType
Object type VBAK
z Quinto nivel
set parameter id 'AAT' field salesdocumenttype.
Import Mandatory call transaction transactioncode.
Export .
Multiple-line
.
.
Data type reference
Dictionary
Reference table TVAK
Reference field AUART
Search help
Object type
The parameter transfer source code is generated entirely from the definition data.
Single-line input parameters are generally read via the macro SWC_GET_ELEMENT, and output parameters
written via the macro SWC_SET_ELEMENT.
The macros SWC_GET_TABLE and SWC_SET_TABLE are used for multiple-line parameters.
Course Overview - 98
Resultados
Haga clic para modificar el estilo de título del patrón
Method
Method Approve
Approve x
Method Approve
Object type FORMABSENC begin_method approve changing container.
z
Release
Status
Haga clic para
30A
Released
modificar eldata:
estilo de like
proc_state texto del patrón
swxformabs-procstate.
z
Name
Segundo nivel call function 'SWX_FORMABS_APPROVE'
exporting
Approve formnumber = object-key-number
Description Approve form
z Tercer nivel importing
proc_state = proc_state
General Result type ABAP exceptions
The result parameter must be set explicitly under the name "result" using the macro SWC_SET_ELEMENT. The
constant "result" is predefined and need not be defined explicitly.
Course Overview - 99
Implementando acceso a atributos
Haga clic para modificar el estilo de título del patrón
Attribute SalesGroup x
Attribute SalesGroup
Object type Z_Bus2032
Release 40A
Texts
z Segundo nivel
Name
Description
Sales group
Sales group (impl. as virt. attr.)
include <CNTN01>.
z Tercer nivel
Source
data: sales_order type swc_object,
Virtual sales_group type swc_object.
Database field
z Cuarto nivel * create object(-reference)
swc_create_object
Attribute properties
sales_order 'Z_BUS2032' sales_order_key.
z Quinto nivel
Multiple-line
Mandatory if sy-subrc ne 0.
Instance-independent ” do your own error handling
endif.
Data type referen.
Dictionary * read attribute SalesGroup of order
Reference table swc_get_property sales_order 'SalesGroup' sales_group.
Reference field
Search help
The include <cntn01> must always be incorporated in the calling program. This include is also incorporated in the
implementation program via the include <object>.
Before attribute access, an object reference must be created by calling the macro SWC_CREATE_OBJECT. Error
handling measures must be incorporated if the object reference cannot be created.
Attribute access for single-line attributes uses the macro SWC_GET_PROPERTY, and for multiple-line attributes
the macro SWC_GET_TABLE_PROPERTY - irrespective of whether a virtual or a database attribute is read.
Attributes cannot be set via macros. Object values can only be changed via methods.
Parameter CompCurrent
z Haga clic para modificar el estilo de texto del patrón
Other view Program Exceptions
Parameter CompCurrency
Overview
Object type VBAK
z Segundo nivel
Parameter Object type Created Release 40A
CompCurrency VBAK 40A
NetvalueInCompCurr VBAK 40A Texts
Name Comparison currency
z Tercer nivel include <CNTN01>.
Description Comparison currency
z Cuarto nivel
data: sales_order type swc_object, Parameter properties
comp_curreny like vbak -waerk default ...,
new_value like vbak -netwr. Import Mandatory
swc_container method_container. Export
The include <cntn01> must always be incorporated in the calling program. This include is also incorporated in the
implementation program via the include <object>.
Before attribute access, an object reference must be created by calling the macro SWC_CREATE_OBJECT. Error
handling measures must be incorporated if the object reference cannot be created.
The import parameters of the method must also be completed before the method call.
The actual method call is implemented with the macro SWC_CALL_METHOD.
The export parameters can be read after the call.
The macro number must always be included if you are working in a program with objects. The macro is included
automatically in the Business Object Builders implementation programs via <object>.
Only macros from <cntn01> may be used to manipulate objects and containers.
z Object reference
z Haga clic para modificar el estilo de texto del patrón
Declaration
DATA: <obj_ref> TYPE SWC_OBJECT
z Segundo nivel
Creation
z Tercer nivel
SWC_CREATE_OBJECT <obj_ref> <obj_type> <obj_key>
z Cuarto nivel
z Quinto nivel
When SWC_CREATE_OBJECT is called, the method "ExistenceCheck" of the associated object type is always
called implicitly, in order to prevent references to non-existent objects.
An object reference must be created before an object macro is called (for example, for attribute access or method
call).
These macros are not usually used in object implementation, but are required in the program that the object uses.
If the <method> is SPACE for SWC_CALL_METHOD, the default method is executed.
z Triggering exceptions
z Haga clic para modificar el estilo de texto del patrón
EXIT_RETURN <exception_no> <var1> ... <var4>
z Segundo nivel
EXIT_OBJECT_NOT_FOUND
z Tercer nivel
EXIT_CANCELLED
z Cuarto nivel
z Quinto nivel
When a work item is executed, the objects in the associated container are automatically refreshed.
Edit
z Tercer
Inheritance
nivel
TS9001 TS9002 TS9003
Display
ZBUS1001. ZBUS1001. ZBUS1001.
Edit Display Release ZBUS1001
z Cuarto nivel Edit
Display
z Quinto nivel Release
BUS1001
BUS1001
Edit
Display
TS0001 TS0002 TS9004
Delegation BUS1001. BUS1001. BUS1001.
Edit Display Release ZBUS1001
Edit
Display
Release
Problem:
How can customers use their own object extensions with the tasks, events, etc. supplied by SAP
Without having to change the application program where events are triggered,
Without having to redefine existing tasks.
Solution:
Define subtype and delegation.
Delegation "covers" the original supertype.
Continue to use the supertype.
Gray/Top: Behavior without inheritance
Red/Middle: Behavior with inheritance
Blue/Bottom: Behavior with delegation - the object type BUS1001 is regarded as having the properties of
Z_BUS1001 (that is,
additional events, attributes and methods).
In the Business Object Builder itself, you can only see from the basic data for a supertype whether a delegation has
been defined.
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Las BAPIs son identificadas por el nombre del objeto seguido del nombre de la
z Haga clic para modificar el estilo de texto del patrón
BAPI (p.e. Material.CheckAvailability())
z Segundo nivel
z Tercer
Existen nivel
algunas BAPIs comunes para muchos objetos. Por ejemplo la BAPI
GetList()
z Cuarto devuelve
niveluna lista de instancias de un tipo de objeto.
z Quinto nivel
Los cambios en la base de datos se realizan completamente o no se realizan.
Los usuarios que ejecutan la BAPI deben tener las autorizaciones necesarias.
En él podemos ver los diferentes parámetros de una BAPI, así como los campos clave,
z Haga clic
documentación para modificar
y nombre de la funciónel estilo
asociada de texto del patrón
z Segundo nivel
z Tercer nivel
z Cuarto nivel
z Quinto nivel
z Transacciones SAP
z Haga clic paraBusiness
BAPI modificar el estilo
Object de texto
Browser del
(BAPIs patrón
only)
z Segundo
SWO1 nivel
Business Object Builder (all objects)
SWO2
z Tercer nivel Business Object Browser (all objects)
SE11
z Cuarto nivel Data Dictionary
SE37 Function Builder
z Quinto nivel
zzBAPIs
Haga since
clic para4.0 are not supposed
modificar el estilo detotexto
do this.
del patrón
zzDouble-check
Segundo nivel which category the BAPIs you want to use fall
into.
z Tercer nivel
There is no metadata attribute for this
z Cuarto nivel
Read the documentation
z Quinto
OSSnivel
Note 131838 should list all BAPIs that execute their own
COMMIT WORK
If in doubt, test...
z Be careful when using BAPIs from both categories in the
same session.
z Your own BAPIs must use the Update Task to support the
new concept.
Offilog 2001 Universidad (Salvador Seda) / 121
BAPI_TRANSACTION_COMMIT
BAPI_TRANSACTION_ROLLBACK
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Describir el escenario
z Haga
clic para
Definir modificar
propósito el estilo de texto del patrón
y alcance
z Segundo
nivel los pasos individuales y secuencias
Identificara
Identificar
z Tercer nivel los datos que se intercambiaran
Gestión
z Cuarto nivel de errores
z Quinto nivel
Definir el escenario en el explorador BAPI
En la transacción BAPI en la pestaña proyecto, implementar
nueva BAPI. Un asistente aparece
Comprobar:
z Haga clic para modificar el estilo de texto del patrón
Documentación
z Segundo nivelBAPI
Sintaxis
z Tercer nivel
Semántica BAPI
z Cuarto
Uso nivel
en aplicaciones externas
z Quinto
Uso nivel
en diferentes plataformas
Liberar
Liberar función
Liberar objeto
Liberar BAPI
Las modificaciones no se podrán hacer sobre el objeto original, se deberá crear un subtype
Creación exits
Introducción
z Haga
Unidad 1 clic para modificar
Conceptos el estilo
básicos BAPIde texto del patrón
z Segundo
Unidad 2 nivel
Creación Módulos de función RFC
z Tercer
Unidad 3 nivelObjetos de negocio
z Cuarto
Unidad 4 nivelUtilización de BAPIs
z Quinto
Unidad 5 nivelAmpliaciones y modificaciones
Unidad 6 BAPIs y ALE
Information about the enhancement of existing or the creation of new scenarios are available in:
y training class BC621
y R/3 online documentation
ALE Programming
BAPI Programming
y R/3 interface adviser
Some scenarios are not possible to implement for legal or business reasons
y e.g.: It makes no sense to link a logistic system to the financial system only by synchronous
communication. This would disable most of the logistic transactions if the communication is down or
there are problems within the financial system. The required postings within the general ledger could
not be done. A scenario with asynchronous communication is required.
Technical R/3 objects for IDocs with a message type exist, for example, audit data (ALEAUD) and
distribution group (CONDA2)
An IDoc has different characteristics: database table, text, HTML file, XML datastream, RFC call
parameters.
Î Asynchronous
Haga
z Î clic para modificar el estilo de texto del patrón
Document-related
z Segundo nivel
z Tercer nivel1
System System 2
z Cuarto nivel
SAP
Document
Document
IDoc
Transaction
z Quinto nivel
Message
z Haga Control
clic para modificar IDoc-ID
Record
el estilo de texto del patrón
Sender-ID
Receiver-ID
z Segundo nivel IDoc type and logical message
External structure
z Tercer nivel
Data Record IDoc-ID
Sequence/Hierarchy
z Cuarto nivel Segment Format definition for
• header data
z Quinto nivel • item data
z Haga clicRecord
Control para modificar el estilo de texto del patrón
z Segundo nivel
Data Records
z Tercer nivel
E1HDDOC E1TLSUM
z Cuarto
M nivel
1 C 1
E1ITSCH
Tree of Segments C 99 C 5
Status Records
Each IDoc type is defined by its segments and their properties. These are segmenttype / segmentname,
position / sequence and iteration / status.
SAP segmenttypes (internal representation) begin with 'E1', all the corresponding segmentnames
(external representation) begin with 'E2‘.
Field length and data types are compared where applicable with data element directories of
UN/EDIFACT, ANSI X12 and SAP‘s Data Repository.
Codes for coded fields (currencies, countries, units of measure) are taken from ISO standards.
The segments in the example above can be interpreted as follows
y E1HDDOC Document Header
y E1HDADR Header Addresses
y E1ITDOC Item Details
y E1ITSCH Item Schedule
y E1TLSUM Trailor Section
E1HDR xxxxxxxx
Segment
Segment 33
z Cuarto
E1SEG1
E1SEG2
nivel
xxxxxxxxxxxxxxx
xxxx
optional
optional Curr.
Curr. No.
No. 33 Transfer
Transfer No.
No. 11
Status records are data records assigned locally to an IDoc - they not part of an IDoc . They are not
sent together with the IDoc.
1. Order
z Haga clic para modificar
Message type:el estilo de texto del patrón
ORDERS
IDoc type : ORDERS01 (3.0A)
z Segundo nivel ORDERS02 (3.0D)
ORDERS03 (4.0A)
ORDERS04 (4.5A) Sales
z Tercer nivel
Customer
2. Order confirmation
z Cuarto nivel Message type: ORDRSP
IDoc type : ORDERS0x
z Quinto nivel
3. Delivery
Message type: DESADV
IDoc type : DESADV01 (3.0A)
DELVRY01 (4.0A)
DELVRY02 (4.5A)
4. Billing document
Message type: INVOIC
IDoc type : INVOIC01 (3.0A)
INVOIC02 (4.0A)
Message types specify the semantics of application data. The message type is usually based on an
EDIFACT message type.
The syntax (structure information) of the data is described in the IDoc type.
z Quinto nivel
IDoc Interface & IDoc IDoc Interface &
ALE Services ALE Services
Please read the left (outbound) from top and the right (inbound) from bottom.
Message Control is in use with transactions of the supply chain, applications MM and SD, in outbound
processing.
Workflow is conditional with all inbound processing by all SAP applications.
Nevertheless Workflow is in use with all SAP applications to report on exceptions in the implemented
processes. For details please refer to the notification and monitoring section.
SAP Application
z Haga clic para modificar el estilo de texto del patrón
Document
z Segundo nivel
z Tercer nivel Control (NAST)
Message
z Cuarto nivel Document
NAST
Record
z Quinto nivel
IDoc
SAP applications can create IDocs under control of Message Control or on their own.
An IDoc can go from an application through Message Control into the IDoc interface. The IDoc
interface is invoked by either form-routine EDI_PROCESSING or ALE_PROCESSING in program
RSNASTED. In the IDoc interface the IDoc is passed to ALE services (conditional) and later on
transferred to system 2 according to its port definition.
Applications that do not use Message Control will create IDocs directly. They invoke function module
MASTER_IDOC_DISTRIBUTE and pass the IDocs to ALE services, where the IDocs will be
preprocessed according to ALE customizing.
All IDocs are transferred according to the port definition,
y most common between R/3 systems is the (asynchronous) transactional RFC interface
(standard ALE scenario)
y most common between R/3 system and EDI subsystem is the flat file interface
(standard EDI scenario).
Document
SAP Application
System 2, e.g. the EDI subsystem, sends IDocs to the SAP system R/3.
All IDocs are received via a port with its related port definition,
y most common between R/3 systems is the (asynchronous) transactional RFC interface
(standard ALE scenario)
y most common between R/3 system and EDI subsystem is the flat file interface
(standard EDI scenario).
The IDocs enter the SAP system at the IDoc interface. The IDoc interface accepts the IDocs, passes the
IDocs either through ALE services or to workflow management.
The ALE services can be customized to post IDocs to the application directly via means of CALL
FUNCTION or via means of workflow management.
SAP Application
z Haga clic para modificar el estilo de texto del patrón
IDoc Interface & ALE Services
z Segundo nivel
z Tercer nivel
IDoc & IDoc &
IDoc IDoc IDoc
status status
z Cuarto nivel
z Quinto nivel
File
tRFC CPI-C ABAP XML
+ RFC
EDI ALE EC
R/2 Any
Any Any Any
2.1 on 4.5 on 4.6 on
3.0 on 3.0 on
The IDoc interface offers 5 different communication channels, defined by the appropriate port types,
within system R/3.
Port type „File“
Transfer of information via files and synchronous RFC for triggering of the destination by the source.
This allows transfer of IDoc data and status report.
Port type „tRFC“
Transfer of all information via (asynchronous) transactional RFC.
This is the preferred method in ALE scenarios and allows transfer of IDoc data.
Port type „CPI-C“
Transfer of all information via CPI-C. This option is in use only with system R/2 couppling based on the
R/2-IDoc interface as released in R/2, 5.0F.
This allows transfer of IDoc data and status report.
Port type „ABAP“
Transfer of all information with customer specific program logic.
This is thought to be a „Project-Exit“ for any unforseen communication channel.
Port type „XML“
Transfer of all information via XML compatible files, including DTD if requested. This port type is
released as prototype, changes and enhancements are expected for future releases.
The port type „Internet“ is not recommended for use anymore. If you plan for Web/EDI, please refer to
an EDI subsystem. If you plan for mySAP.com, please use the strategic recommendation of SAP
Business Connector with XML.
Please refer also to OSS note #315083.
Component D
SAP
ALE provides the functionality to distribute and receive data to and from:
y R/3 Systems ( >= 3.0 )
y different SAP components
y R/2 Systems
y Non-SAP-Systems
It uses synchronous and asynchronous RFC's and standard communication protocols.
The data can be processed on-line or in batch mode.
Application
Application
z Haga clicIDoc
IDoc data
data
para BAPI
BAPI parameters
modificar el estilo de texto parameters
del patrón BAPI
BAPI data
data
S e n d e r
Interface
Interface for
for Synchronous
z Segundo nivel
Interface
Interface for
for IDocs
(outbound)
(outbound)
IDocs asynchronous
asynchronous BAPIBAPI BAPI call
calls
calls (outbound)
(outbound)
z Tercer nivel
Basic
Basic IDoc
IDoc Legend
z Cuarto nivel tRFC
tRFC communication
communication Application
Application
Interface
Interface for
for Basis
Basis
Interface
Interface for
for IDocs
IDocs asynchronous
asynchronous BAPI
BAPI
(inbound)
(inbound) calls
calls (inbound)
(inbound)
Inbound
Inbound function
function module
module for
for IDoc
IDoc BAPI
BAPI
Application
Application
y INBOUND_IDOC_PROCESS (3.x)
y IDOC_INBOUND_ASYNCHRONOUS (since 4.x)
Inbound function modules for updating asynchronous BAPIs
y BAPI_<BO>_<METHOD>
The distribution model is client-dependent and may contain one or more views.
z Tercer
Fill IDocnivel
structures Receiver Determination
and forward to ALE
z Cuarto nivel IDoc Services
Data filtering
z Quinto nivel Explicit segment filtering
Conversion of global org.units
Data conversion
Version change
Writing links to
Process IDocs according
application objects
to partner profile
ALE
Application
z Haga clic para modificar el estilo de texto del patrón
Communication
IDocs received
z Segundo nivel via tRFC
Application
ALE Communication
z Haga clic para modificar el estilo de texto del patrón
Determine receivers, APIs for receiver
determination
z Segundo
if required nivel
Writing links to
application objects IDoc processing by
partner profile
z Segundo nivel
ALE Services Write IDoc to database
z Tercer nivel Explicit segment filtering
Conversion of global org.
In the application program, the following steps are involved in a synchronous BAPI call for a distributed
business process:
Distribution model query: The application program uses the distribution model to determine the
recipient and any filter values for filter objects.
Determining the RFC destination: To maintain the corresponding RFC destination, use transaction
BD97
Calling the BAPI function module using RFC: Application data is assigned to the BAPI interface, and
the BAPI function module is called in the remote system.
You can use transaction %' to enter a standard destination for BAPIs for a specific target system. All
BAPI calls for which no specific destination is maintained use this destination. Note that the RFC user
for the standard destination must have sufficient application authorizations.
For each BAPI call (= method call), you can maintain one destination for each target system. This means
that you can assign the RFC user the appropriate authorizations more precisely.
In the distribution model, you can use the "Add BAPI" icon to add more BAPIs to the view.
As well as the sender and recipient system, you enter the name of the business object type and the
method. For the business object type and method, enter the names from the BAPI Explorer, and not the
technical name of the business object type from the Business Object Builder.
To start a BAPI asynchronously in the target system, an IDoc is sent to the target system containing the
interface parameters of the BAPI and, for instance methods, the key fields of the business object. The
BAPI function module is called locally in the target system using the parameters from the IDoc.
From the detail view of the BAPI Explorer, you can double click on the ALE message type to display the
ALE interface for a BAPI. This displays the transaction BDBG for displaying and
generating ALE interfaces for BAPIs.
Choose the "Display interface" icon to display elements generated for the ALE interface to the BAPI.
The generated ALE interface for a BAPI includes the following elements:
Message type
IDOC type
Segment types: The elementary import parameters are grouped together in a segment type. A segment
type is created for each structured import parameter.
Function module for outbound ALE: In the outbound module, the interface parameters are copied to
the IDoc segments and a master IDoc is created. A function module is then called which transfers this
master IDoc to the ALE layer.
Function module for inbound ALE: The inbound module copies the contents of the segment fields to
the corresponding interface parameters, and calls the BAPI function module locally.
To set up distribution using an asynchronous BAPI call, add the BAPI to your view of the distribution
model as in the synchronous call.
Generate the partner profile from the distribution model. The system enters the correct message type
and IDoc type for the BAPI.