You are on page 1of 0

%& 5HPRWH )XQFWLRQ &DOOV LQ $%$3

%&

5HPRWH )XQFWLRQ &DOOV LQ $%$3   

¨

£

¨

¨

£  

¨ 

¥    

 

¨

£

¥

£

¡

 

Materialnummer 50086522

¨

)

Collection 62

&

System R/3

'

© SAP AG© SAP AG 2007
2006

)

)

.

VideoFrame and MultiWin are trademarks or registered trademarks of Citrix Systems. OSF/1 and Motif are registered trademarks of the Open Group. Windows. Netfinity. Outlook and PowerPoint are registered trademarks of Microsoft Corporation. OS/400. pSeries. X/Open. S/390.  Microsoft. WinFrame. MetaFrame. zSeries. xSeries. AIX.&RS\ULJKW &RS\ULJKW  6$3 $* $OO ULJKWV UHVHUYHG ! 1R SDUW RI WKLV SXEOLFDWLRQ PD\ EH UHSURGXFHG RU WUDQVPLWWHG LQ DQ\ IRUP RU IRU DQ\ SXUSRVH ZLWKRXW WKH H[SUHVV SHUPLVVLRQ RI 6$3 $* 7KH LQIRUPDWLRQ FRQWDLQHG KHUHLQ PD\ EH FKDQJHG ZLWKRXW SULRU QRWLFH © SAP AG 2006 Some software products marketed by SAP AG and its distributors may contain proprietary software components of other software manufacturers. Tivoli and Informix are trademarks or registered trademarks of IBM Corporation in the USA and/or in other countries. z/OS.  IBM. OS/390. Program Neighborhood.  UNIX. AS/400.   . MVS/ESA.  Oracle is a registered trademark of Oracle Corporation. DB2. AFP. iSeries. Inc. Intelligent Miner. Parallel Sysplex. OS/2. ICA. WebSphere. DB2 Universal Database. Citrix.

mySAP.  MaxDB is a trademark of MySQL AB.com. Massachusetts Institute of Technology. The information contained herein may be changed without prior notice. HTML. XHTML and W3C are trademarks or registered trademarks of W3C®.  Java is a registered trademark of Sun Microsystems. The SAP Group is solely responsible for products and services according to requirements explicitly defined in the agreement regarding the respective products and services. World Wide Web Consortium. xApps. Sweden.  JavaScript is a registered trademark of Sun Microsystems. The information provided herein is non-binding and is intended for information purposes only. mySAP. Inc. The SAP Group does not assume any liability or provide guarantees for errors or incompleteness in this publication.. Inc. Products may have country-specific variations. R/3.   .  SAP. used under license for technology invented and implemented by Netscape. No further liability is assumed as a result of the information contained in this publication. XML. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only. xApp and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in other countries around the world. All other product and service names are trademarks of their respective companies.

3UHUHTXLVLWHV z 6$37(& WUDLQLQJ FRXUVH z %& WUDLQLQJ FRXUVH z %& WUDLQLQJ FRXUVH KLJKO\ UHFRPPHQGHG DV SUHSDUDWLRQ IRU UHPRWH GDWDEDVH FKDQJHV.

© SAP AG 2002 .

7DUJHW $XGLHQFH z 3DUWLFLSDQWV $%$3 GHYHORSHUV LQYROYHG LQ FURVVV\VWHP FRPPXQLFDWLRQ WKURXJK 5)& IURP WKH 5 6\VWHP z 'XUDWLRQ  GD\V © SAP AG 2002 1RWHV WR WKH SDUWLFLSDQW The training materials are QRW VHOIWHDFK SURJUDPV They FRPSOHPHQW WKH FRXUVH LQVWUXFWRU V H[SODQDWLRQV On the sheets. there is space for you to write down additional information.  .

&RXUVH *RDOV DQG &RQWHQWV z *HQHUDO *RDOV z &RXUVH 2EMHFWLYHV z &RXUVH &RQWHQW © SAP AG 2002 © SAP AG BC415 1-1 .

*HQHUDO *RDOV 7KLV FRXUVH ZLOO SURYLGH \RX ZLWK z .QRZOHGJH RI WKH XVH RI WKH 5)& LQWHUIDFH RQ WKH 5 V\VWHP VLGH IRU GDWD H[FKDQJH EHWZHHQ WKH 5 6\VWHP DQG RWKHU DSSOLFDWLRQ V\VWHPV z .V © SAP AG 2002 © SAP AG BC415 1-2 .QRZOHGJH RI WKH EDVLFV RI XVLQJ %$3.

V DV DQ LQWHUIDFH WR 5 GDWD © SAP AG 2002 © SAP AG BC415 1-3 .&RXUVH 2EMHFWLYHV z 7KH LPSOHPHQWDWLRQ RI 5)&V LQ WKH 5 6\VWHP IRU GDWD H[FKDQJH EHWZHHQ 5 DQG RWKHU DSSOLFDWLRQ V\VWHPV z 2YHUYLHZ RI WKH FRQFHSW DQG XVH RI %$3.

&RXUVH &RQWHQW 3UHIDFH Unit 1 &RXUVH *RDOV DQG &RQWHQWV Unit 2 .QWURGXFWLRQ Unit 3 5HPRWH )XQFWLRQ &DOO Unit 4 %$3.  %XVLQHVV $SSOLFDWLRQ 3URJUDPPLQJ .QWHUIDFH ([HUFLVHV 6ROXWLRQV $SSHQGL[ © SAP AG 2002 © SAP AG BC415 1-4 .

.QWURGXFWLRQ &URVVV\VWHP GDWD GLVWULEXWLRQ z %DVLF WHUPV z (QYLURQPHQW DQG DUFKLWHFWXUH z 7HFKQLFDO EDFNJURXQG © SAP AG 2002 © SAP AG BC415 2-1 .

8QLW 2EMHFWLYHV z <RX ZLOO OHDUQ DERXW WKH EDVLF FRQFHSWV WKH HQYLURQPHQW DQG WKH DUFKLWHFWXUH RI FURVVV\VWHP GDWD GLVWULEXWLRQ z <RX ZLOO UHFHLYH DQ RYHUYLHZ RI H[LVWLQJ LQWHUIDFHV WKDW \RX FDQ XVH WR PDLQWDLQ GDWD FRQVLVWHQF\ LQ GLVWULEXWHG V\VWHPV z <RX ZLOO OHDUQ ZKHUH WR JHW VXSSRUW ZKHQ FKRRVLQJ GHVLJQLQJ DQG LPSOHPHQWLQJ LQWHUIDFHV z <RX ZLOO EHFRPH IDPLOLDU ZLWK WKH WHFKQLFDO EDFNJURXQG RI FURVVV\VWHP FRPPXQLFDWLRQ © SAP AG 2002 © SAP AG BC415 2-2 .

'LVWULEXWHG 6\VWHPV ([WHUQDO V\VWHP ([WHUQDO V\VWHP 5 5 5 © SAP AG 2002 © SAP AG BC415 2-3 .

QWHUIDFH $GYLVHU :RUNIORZ %)$ (' . '&20 +70/ CORBA -$9$ -$9$ © SAP AG 2002 Choosing a suitable interface technology is a central task in an integration project.QWHUIDFH I CP -C . gives you detailed information on implementing the interfaces. 2/( V5)& . The .QWHJUDWLRQ 7HFKQRORJLHV. a Knowledge Product.     © SAP AG BC415 2-4 . 6$3 .&KRRVLQJ DQG 'HVLJQLQJ WKH .'RF $/ ( %25 5)& W5)& $)( *8. and when designing your interface.QWHUIDFH $GYLVHU supports you when choosing the interface technology.

QWHUIDFHV IRU 'DWD 'LVWULEXWLRQ $/(  .2YHUYLHZ RI .QWHUIDFHV SURYLGHG E\ 6$3 IRU FURVVV\VWHP GDWD GLVWULEXWLRQ  %DVHG PRVWO\.

7 $/(. RQ 5)& DQG .'RF  7UDLQLQJ FRXUVHV  %.

7 .'RF. %.

 %.7 .'RF.

5)& &3. transmit or recieve data.If older programs that communicate through CPI-C need to be maintained .   CPI-C (Common Programming Interface . It consists of socalled CPI-C calls that a program uses to set up a connection to another program. and then disconnect the connection again.If RFC is not available (few platforms) . which means an RFC call is always transmitted through CPI-C calls. you will find additional information about CPI-C with exercises and solutions.     © SAP AG BC415 2-5 .& © SAP AG 2002 RFC is based on CPI-C. only simple input/output handling is possible) In the appendix. it should only be used under the following conditions: .   Since CPI-C is more complicated to use than RFC.Communication) is a program-to-program communication interface that allows communication between programs.If a more complex communication protocol is required (with RFC.

6$3 *8. $%$3 'DWDEDVH 6$3 *8. enter data. which consists of ABAP programs. and display the results of their work. the database also stores programs and metadata that describes the R/3 System and the structure of its data. which contains the user interface through which end users access the application functions.5 $UFKLWHFWXUH 3UHVHQWDWLRQ $SSOLFDWLRQ 6$3 *8. This forms the basis for the high degree of scalability in the R/3 System. The third level is the SUHVHQWDWLRQ OD\HU (SAPGUI).     © SAP AG BC415 2-6 . $%$3 5'%06 © SAP AG 2002 The SAP R/3 System has a modular software architecture that follows the software-oriented client/server principle. In addition to master and transaction data.   The lowest level is the GDWDEDVH OHYHO.   The second level is the DSSOLFDWLRQ OD\HU. 6$3 *8. The data is managed at this level using a relational database management system (RDBMS). and data across hosts at different levels. application logic. You can also use alternative front ends (AFEs) or interfaces at this level instead of the SAPGUI.   The system distributes presentation. You can complement the existing SAP functions by writing your own programs using the ABAP Workbench.

QWHUIDFHV 5HPRWH 6\VWHP .QWHUQHW 5 5 ([WHUQDO 6\VWHP.&RPPXQLFDWLRQ DQG 'DWD .

the communication interfaces are the gate to external communication.& 5)& )LOH .   The data interfaces include Batch Input. Direct Input.7 or SAP Web Application Server 6. whereas the data interfaces are used for read and write access to the R/3 database. CALL TRANSACTION USING. Native SQL For more information on these interfaces. This topic is covered in training course BC416. refer to the training courses BC420 and BC414. In addition to the file I/O.  A ¤ 5 9 7 6 5 4 2 2 ¡  0   Q (  ¨ P & I  $ H ¦ ¤ ¡ ¢ ¡ ( " D ¤ (  +773 " $SSOLFDWLRQ VHUYHU 3URJUDP &RPPXQLFDWLRQ LQWHUIDFHV &3.2 $%$3 3URJUDP 'DWD LQWHUIDFHV %DWFK LQSXW 6$364/ DQG VR RQ 'DWDEDVH VHUYHU 5'%06 © SAP AG 2002 Communication interfaces and data interfaces are different. As of SAP R/3 Release 4. SAP-SQL (OpenSQL).20.     © SAP AG BC415 2-7 . it is possible to exchange data between ABAP programs and applications over the Internet using the HTTP protocol (instead of the RFC protocol).

It describes which services (dialog. However. with remote Windows NT applications because the remote program can only be started using this gateway. it usually uses its own gateway work process. gateway) are available on the corresponding application server. As of Release 3. update. it may be more useful to use a gateway that runs on a dedicated host.6$3 *DWHZD\ . with external systems.0.     © SAP AG BC415 2-8 . You may have to use a remote gateway. background. through the gateway service.   The GLVSDWFKHU process on an application server coordinates tasks within the respective instance. You can also install a gateway service on a non-R/3 host.QVWDQFH . for communication with SNA.QVWDQFH 'LVSDWFKHU 'LVSDWFKHU *:  ' ' % ' *:    . enqueue. for example. It FRPPXQLFDWHV with other instances (application servers) in the same R/3 System through the message server and. When an application server (dispatcher) communicates with external systems. spool.QVWDQFH . where a gateway with an add-on is required. The reason is to minimize the effort needed for configuration and maintenance (the gateway add-on is only on one host instead of each application server). a gateway service (application server) belongs to each instance (application server).QVWDQFH 'LVSDWFKHU *:  ' 9 ( *DWHZD\ 0 6   © SAP AG 2002 An LQVWDQFH is an administrative unit in the R/3 System.

3 5 6LHPHQV.3 p 5 u f Y Y e e d Y d c Y i c S R q R h d d c S f i b b c b a h b h ` f a f Y g ` g f Y X X W h h h V W V f q h q x x h s s r r q c c t t v v u q h h u 6$3 *DWHZD\ 2SWLRQDO 61$ )XQFWLRQV 7&3.3 h 7&3.$UFKLWHFWXUH DQG 8VH RI WKH 6$3 *DWHZD\ 5 t s t p V t w s c w p q T Y Y e e d Y d c i Y i b c b h b a h b f f Y ` g g Y f X X W q f q q r r q c c t t v v u q h q h V h s c q h V W c w q q h x x h s w s V T T ` a V q R R h d c S f d c S p q q f s t c V T q q 7&3.

/8 5 .%0.

([WHUQDO V\VWHPV /8.

([WHUQDO V\VWHPV 7&3.3.

An SAP gateway with SNA functions is also known as an (SAP) SNA gateway.2 functions (external software).2 transport protocol is used. © SAP AG 2002 R/3 communication always runs through the SAP gateway and is based on TCP/IP. you need an SAP gateway with additional SNA functions.2 systems where the LU6.     © SAP AG BC415 2-9 . For R/3 communication with an IBM R/2 System or other LU6.2 conversion (SAP) and LU6. The optional SNA functions on the SAP gateway mainly consist of the protocol converter for the TCP/IP LU6.

QWHUIDFH $GYLVHU VXSSRUWV \RX ZKHQ FKRRVLQJ WKH LQWHUIDFH WHFKQRORJ\ DQG ZKHQ GHVLJQLQJ \RXU LQWHUIDFH z 6$3 RIIHUV WRJHWKHU ZLWK WKH $/( FRPSRQHQW SUHGHILQHG LQWHUIDFHV IRU PDLQWDLQLQJ GDWD FRQVLVWHQF\ LQ GLVWULEXWHG V\VWHPV z 5)& LV EDVHG RQ &3.7RSLF 6XPPDU\ z 7KH .& +RZHYHU &3.& VKRXOG EH XVHG RQO\ LI DEVROXWHO\ QHFHVVDU\ GXH WR LWV FRPSOLFDWHG XVDJH z 7KHUH LV D GLIIHUHQFH EHWZHHQ FRPPXQLFDWLRQ LQWHUIDFHV DQG GDWD LQWHUIDFHV z 5 FRPPXQLFDWLRQ DOZD\V UXQV WKURXJK D JDWHZD\ © SAP AG 2002 © SAP AG BC415 2-10 .

5HPRWH )XQFWLRQ &DOO z 2YHUYLHZ z 5)& 'HVWLQDWLRQV z 6\QFKURQRXV 5)& z $V\QFKURQRXV 5)& z 7UDQVDFWLRQDO 5)& z 4XHXHG 5)& z 5)& ZLWK ([WHUQDO 3URJUDPV z 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-1 .

2YHUYLHZ 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-2 .

5)& 2YHUYLHZ 7RSLF 2EMHFWLYHV z 7KLV WRSLF ZLOO SURYLGH \RX ZLWK DQ RYHUYLHZ RI WKH 5)& HQYLURQPHQW DQG WKH YDULRXV 5)& W\SHV © SAP AG 2002 © SAP AG BC415 3-3 .

21   /RFDO 5 6\VWHP £ 352*5$0  )0 $QRWKHU DSSOLFDWLRQ VHUYHU IURP WKH VDPH 5 6\VWHP :RUN SURFHVV :RUN SURFHVV.5)& IURP :LWKLQ 6$3 5 5 $SSOLFDWLRQ 6HUYHU 5HPRWH 6\VWHP ([WHUQDO QRQ6$3 V\VWHP :RUN SURFHVV ¨  ¦ ¥ ¡ £ ¡    $SSOLFDWLRQ VHUYHU IURP DQRWKHU 5 6\VWHP   &$// )81&7.

an SAP R/2 System. 2 If a function module is called remotely.1$7. 2 2 © SAP AG BC415 3-4 . Note that the calling program is rolled out for each remote function call (RFC). 2 The remote destination can be another application server in the same or a different SAP R/3 System. which triggers an implicit database (DB) commit. or an external non-SAP system. 352*5$0  &$// )81&7. it runs in the same work process as the calling program.21  UHPRWH )0 ¦ 0 ¦ ¨ ¨ ¥  ¨     ¥  $ # © SAP AG 2002 When you call a function module locally. it runs in its own work process (its own SAP LUW) if the remote system is an SAP R/3 System.21  '(67.

5)& 'HVWLQDWLRQV 5 6\VWHP 5HPRWH 6\VWHPV 5 $SSOLFDWLRQ 6HUYHU IRU DQRWKHU RU WKH VDPH 5 6\VWHP.

For each partner system.21  )0 5)& 6LGH. © SAP AG BC415 3-5 . you need to maintain one entry in this information table. RFCDES.1$7.21  '(67. 352*5$0  &$// )81&7.QIR 7DEOH 5)&'(6 5 6\VWHP )0 ([WHUQDO V\VWHP 0DLQWHQDQFH WUDQV DFWLRQ 60 & URXWLQH © SAP AG 2002 Use transaction SM59 to maintain RFC destinations that must specify an ABAP program when calling remote function modules in the RFC side information table.

5 )XQFWLRQ 0RGXOHV 7KDW &DQ %H &DOOHG 5HPRWHO\ 3URSHUWLHV 3URFHVVLQJ W\SH 1RUPDO IXQFWLRQ PRGXOH 5HPRWHHQDEOHG PRGXOH 8SGDWH PRGXOH LQWHUIDFH &+$1*.1* SDUDPHWHU QRW DOORZHG .

7\SH DVVLJQPHQW IRU DOO LQWHUIDFH SDUDPHWHUV LV UHTXLUHG E\ VSHFLIL\LQJ D 'LFWLRQDU\ ILHOGVWUXFWXUH.

© SAP AG 2002 .

© SAP AG BC415 3-6 .6C. nested structures can be transferred even for remote-enabled function modules. 3RVVLEOH DV RI 6$3 5 5HOHDVH  RU 6$3 :HE $SSOLFDWLRQ 6HUYHU  As of SAP R/3 Release 4.

.&DOOLQJ ([WHUQDO & 5RXWLQHV 8VLQJ 5)& 5 6\VWHP ([WHUQDO 6\VWHP $%$3 SURJUDP 5)& OLEUDU\ 5)&6'.

you can use the RFC client or RFC server programs with RFC calls.3257.1*  .21 (. © SAP AG BC415 3-7 .&(37. After installing the RFC Library on your external platform.03257.1$7.<=        © SAP AG 2002 SAP delivers the RFC Library for all standard external platforms that contain RFC calls for C programs.216   & URXWLQH $%&  & URXWLQH .73*0 (. 352*5$0     5)& VHUYHU SURJUDP &$// )81&7.21 $%& '(67.1*  7$%/(6  (.

3URFHVV )ORZ 6\QFKURQRXV 5)& V5)&.

21 % '(67.1*  .3257.1*  .<=    &$// )81&7. 352*5$0  352*5$0        'DWD WUDQVIHU )81&7.21 ¦ ¦ ¨ ¨ ¥  ¨     ¥  $ #       5HPRWH IXQFWLRQ 'DWD LV UHWXUQHG © SAP AG 2006 With synchronous RFCs.1$7.21 . 2 © SAP AG BC415 3-8 .3257.21 .21 .21 % (.1*  (.<= '(67.1*  '% /8: (1')81&7.<= &$// )81&7. Then processing continues in the calling program after the call.03257. processing is stalled in the calling program until the called remote function is processed and its output is returned.03257.1$7.

3URFHVV )ORZ $V\QFKURQRXV 5)& D5)& .

1*  (.<= &$// )81&7.<= &$// )81&7.1*     '% /8: ¦ ¦ ¨ ¨ ¥  ¨     ¥  $ #       5HPRWH IXQFWLRQ (1')81&7.1* 1(: 7$6.21 % 67$57. % 67$57.21 'DWD LV UHWXUQHG © SAP AG 2006 In an asynchronous Remote Function Call.<= '(67.21 % '(67. Asynchronous RFCs are intended for parallel processing of processes. 352*5$0  352*5$0        'DWD WUDQVIHU )81&7. The output of the function can be received later in the program.3257.3257. % (.21 .21 .1$7. The remote function itself is processed separately from the calling program.21 . the called remote function is started and processing continues immediately afterwards in the calling program.1$7.1* 1(: 7$6. 2 2 © SAP AG BC415 3-9 .

3URFHVV )ORZ 7UDQVDFWLRQDO 5)& W5)&.

1 %$&. . &200.*5281' 7$6. &$// )81&7.1$7. . . '(67. &$// )81&7.21 %   &$// )81&7.1 %$&.7 :25.21 .*5281' 7$6.1$7.21 .21 %   &200. 352*5$0  352*5$0    &$// )81&7.21 .1 %$&.21 % '(67.21 .7 :25.*5281' 7$6.*5281' 7$6. '(67. 6WDUW ZLW GDWD K WUDQVIHU /RJLFDO XQLW RI ZRUN /8:.21 % '(67. .1$7.1 %$&.1$7.

QR ZDLWLQJ.

for transactional RFCs you can group several remote functions in one LUW (with automatic rollback mechanism if there is an error).21 .    (1')81&7.21 '% /8: SURFHVVLQJ FRQILUPDWLRQ Whereas with synchronous and asynchronous RFCs each call makes up a single logical unit of work (LUW) in the remote system. 2 © SAP AG BC415 3-10 . )81&7.21 .    ¦ (1')81&7.21 0 ¦ ¨ ¨ ¥  ¨    8 ¥ 7 $ #    0DQDJHPHQW  0RQLWRULQJ 0DQDJHPHQW 0RQLWRULQJ RI /8:V RI /8:V © SAP AG 2006 *XDUDQWHHG )81&7.

3URFHVV )ORZ 4XHXHG 5)& T5)&.

6HULDOL]DWLRQ RI W5)& /8:V /8: 4XHXH  W5)&/8: /8: LV VHQW : 9 8 ) ) 6 6 3 3 4 4 + + 3 3 1 1 / / - + + ) ) ( ( >  8 QWH W5)&/8: 9 9 A ? 8 6 8 9 9 ) 8 ) 3 ) 6 4 6 3 + 3 4 3 4 + 1 + 3 / 3 1 - 1 / + / - ) - + ( + ) LV JHQHUDWHG @ /8: ) ( ( © SAP AG 2002 LUWs generated using tRFC are processed independently of each other. use qRFC as an extension of tRFC Queued RFC (qRFC) is available as of release 4. This means the order in which they are processed is not always the order in which they are generated.6A and can be used in SAP R/3-R/3 connections and in SAP R/3 external connections. To ensure that tRFC-LUWs are processed in the same order in which they were generated. © SAP AG BC415 3-11 .

5)& 2YHUYLHZ 7RSLF 6XPPDU\ z <RX FDQ XVH 5)& WR FDOO $%$3 IXQFWLRQ PRGXOHV LQ 6$3 V\VWHPV DQG & URXWLQHV LQ H[WHUQDO VHUYHU SURJUDPV z 7R GR WKLV \RX QHHG DQ 5)& GHVWLQDWLRQ WKDW \RX PDLQWDLQ LQ WKH VLGH LQIRUPDWLRQ WDEOH 5)&'(6 z 7KHUH DUH IRXU FDOO YDULDQWV V\QFKURQRXV DV\QFKURQRXV WUDQVDFWLRQDO DQG TXHXHG 5)& 6HOHFW WKH DSSURSULDWH 5)& W\SH GHSHQGLQJ RQ WKH SXUSRVH DQG UHTXLUHPHQWV LQYROYHG © SAP AG 2002 © SAP AG BC415 3-12 .

5)& 'HVWLQDWLRQV 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-13 .

© SAP AG 2002 © SAP AG BC415 3-14 .5)& 'HVWLQDWLRQV 7RSLF 2EMHFWLYHV z <RX DUH DEOH WR PDLQWDLQ 5)& GHVWLQDWLRQV IRU FRPPXQLFDWLRQ SURFHVVHV VWHPPLQJ IURP DQ 6$3 5 6\VWHP z <RX DUH IDPLOLDU ZLWK WKH VWDQGDUG GHVWLQDWLRQV 63$&( 121( DQG %$&.

0DLQWHQDQFH RI 5)& 'HVWLQDWLRQV ! 7UDQVDFWLRQ 60 5)& 'HVWLQDWLRQV 5 FRQQHFWLRQV 5 FRQQHFWLRQV  $%$3 FRQQHFWLRQV +773 FRQQHFWLRQV WR 5 V\VWHP  $%$3 V\VWHP +773 FRQQHFWLRQV WR H[W VHUYHU .

.QWHUQDO FRQQHFWLRQV /RJLFDO FRQQHFWLRQV 7&3.3 FRQQHFWLRQV &RQQHFWLRQV XVLQJ $%$3 GULYHUV © SAP AG 2006 .

3RVVLEOH DV RI 6$3 5 5HOHDVH  RU 6$3 :HE $SSOLFDWLRQ 6HUYHU  Using transaction SM59. Depending on the remote system. see training course BC416.20. For further information.7 or SAP Web Application Server 6. you maintain the RFC destination in the RFC side information table RFCDES. it is possible to exchange data between ABAP programs and application in the Internet on the basis of the HTTP protocol (instead of the RFC protocol). © SAP AG BC415 3-15 . maintain one destination for the corresponding type. there are two new HTTP destination types. As of SAP R/3 Release 4. You can maintain RFC destinations in the source system only. Using these.

If the logon data is not complete or is faulty. the logon language of the current caller is used. if you do want to use load distribution when you log on. You can display this using transaction RZ11 or report RSPFPAR. If you want to ensure that a particular R/3 application server is addressed.& (or of the type "communication" in more recent releases). you must specify the V\VWHP . you need a destination with type 3. Note that the name of a type 3 destination is case sensitive. In this case. In the destination system. set the /RDG GLVWULEXWLRQ option to <HV. You determine the message server of an SAP R/3 System using the profile parameter UGLVSPVKRVRX.'HVWLQDWLRQ IRU 55 &RQQHFWLRQ 7\SH  'HVWLQDWLRQ $%& KV 7DUJHW KRVW B <HV B *DWHZD\ VHUYLFH /RDG GLVWULEXWLRQ B *DWHZD\ KRVW 5 FRQQHFWLRQ B  B &RQQHFWLRQ W\SH *DWHZD\ RSWLRQV B 5)& GHVWLQDWLRQ 1R 6\VWHP QXPEHU  'HVFULSWLRQ 5)& FRQQHFWLRQ WR UHPRWH 5 6\VWHP $%& /DQJXDJH &OLHQW 8VHU 3DVVZRUG (1  60. a distinction is made between lowercase and uppercase letters. © SAP AG BC415 3-16 . and the required ORJRQ JURXS. the logon to the target system occurs automatically. you can specify the logon data of a user in the target system. If you do not enter the logon language in an RFC destination. You can find out this information from transactions SM51 (overview of R/3 servers) and SMLG (overview of logon groups) in the SAP R/3 target system. This must be a user of the type GLDORJ or &3.'. However. set the /RDG GLVWULEXWLRQ option to 1R.7+ © SAP AG 2002 If you want to connect to another SAP R/3 System. a logon screen from the target system appears at runtime. you must specify the R/3 application server using the 7DUJHW KRVW and 6\VWHP QXPEHU parameters. the PHVVDJH VHUYHU. In this case. that is. When the destination is used.

see the online documentation on maintaining gateways). /DQJXDJH &OLHQW 8VHU 3DVVZRUG (1  60. It must match the name of the corresponding destination in the gateway side information table (for more information. You must also specify the SNA gateway (for IBM R/2) or the host gateway (for Siemens R/2) through which the connection is to be made. © SAP AG BC415 3-17 . B *DWHZD\ VHUYLFH B *DWHZD\ KRVW B 5 FRQQHFWLRQ B  B &RQQHFWLRQ W\SH *DWHZD\ RSWLRQV B 5)& GHVWLQDWLRQ 'HVFULSWLRQ 5)& FRQQHFWLRQ WR UHPRWH 5 6\VWHP . you need a destination with type 2.'HVWLQDWLRQ IRU 55 &RQQHFWLRQ 7\SH  GHVWLQDWLRQ . In the destination. Note that the destination name (in the figure. you need to specify the logon data of an R/2 user with the type CPIC.7+ © SAP AG 2002 If you want to connect to an SAP R/2 system. it is K50) for a type 2 destination cannot be chosen at random.

You must specify the following: . 5HJLVWUDWLRQ: These destination variations let you access a program that has already started and has registered itself on a gateway.Gateway --> Host and TCP/IP service of the gateway where the external program has registered (If the gateway is the one for the current application server. b) 2Q WKH F[SOLFLW KRVW: The external program is started on the specified host. 2. 6WDUW: The external program is started when the actual communication is being established.Program-ID --> ID under which the external server program has registered on the SAP gateway .(& $FWLYDWLRQ W\SH B *DWHZD\ VHUYLFH B *DWHZD\ KRVW B 7&3. You must enter the compete (absolute) path of the program including program names. this information is not required.'HVWLQDWLRQ IRU 5 ([WHUQDO &RQQHFWLRQ 7\SH 7 GHVWLQDWLRQ 5)&(. the start time is not required. With this variant. 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). a) 2Q WKH DSSOLFDWLRQ VHUYHU: The external program is started on the current SAP R/3 application server. you need a destination with the type T.Host name --> Name of the machine where the external program is located . There are two variations of type T: 1.3 FRQQHFWLRQ B 7 B &RQQHFWLRQ W\SH *DWHZD\ RSWLRQV B 5)& GHVWLQDWLRQ 5HJLVWUDWLRQ 6WDUW 6WDUW RQ $SSOLFDWLRQ VHUYHU ([SOLFLW KRVW )URQW HQG ZRUNVWDWLRQ ([SOLFLW KRVW 3URJUDP & ? [\] ? UIFH[HF 7DUJHW KRVW LZGI 'HVFULSWLRQ 5)& FRQQHFWLRQ WR H[WHUQDO VHUYHU SURJUDP UIFH[HF © SAP AG 2002 For connections to external RFC server programs. You must specify the following: .Path --> Complete path including program names on an external host c) )URQW HQG ZRUNVWDWLRQ: The external program is started on the current front end at runtime through the SAPGUI. You must give the complete program path including the program names. It is suited for starting a program frequently.) © SAP AG BC415 3-18 .

$XWKRUL]DWLRQ DQG 8VH RI 5)& 'HVWLQDWLRQV 5)& GHVWLQDWLRQ $%&    6HFXULW\ RSWLRQV $XWKRUL]DWLRQ .<= DV RI 6$3 5 UHOHDVH  RU 6$3 :HE $SSOLFDWLRQ 6HUYHU .

© SAP AG BC415 3-19 .<= © SAP AG 2002 As of SAP R/3 Release 4. it is possible to have an automatic check of the required authorization for destination use.(/' '(67 )LHOG .&) )LHOG . 8VH RI WKLV GHVWLQDWLRQ UHTXLUHV DXWKRUL]DWLRQ IRU WKH DXWKRUL]DWLRQ REMHFW 6B.7 or SAP Web Application Server 6.&)B).20.&)B9$/8( . It can be implemented for all destination types.

21 &$// )81&7.21 121(  6HPLUHPRWH )0 )0 *DWH ZD\ © SAP AG 2002 The destinations listed above are predefined standard destinations and have the following meanings: . 5 6\VWHP % 5 6\VWHP $ &$// )81&7. © SAP AG BC415 3-20 .1$7.21 %  UHPRWH )81&7.21 %$&.<= '(67.21 $%& '(67.21 .21 $%& '(67. This destination is suited to the RFC test if you only have one system to test.21 $%& '(67.NONE: Also a local call. (This functions with synchronous RFC only.21 $%&  &$// )81&7. but the call request is sent to the default gateway of the current application server and is handled there like an external call request. Destination BACK cannot be used for R/3-R/2 connections.21 63$&(  /RFDO &$// )81&7. . )0  (1')81&7.BACK: You can use this destination if you want to start a function module from the called function module in the current system.'HVWLQDWLRQV 63$&( 121( DQG %$&.1$7.1$7.SPACE: Local call of a function module .1$7.) You cannot use these standard destinations from R/2 systems.

5)& 'HVWLQDWLRQV 7RSLF 6XPPDU\ z 7R PDNH D UHPRWH FDOO WR D IXQFWLRQ PRGXOH \RX UHTXLUH DQ 5)& GHVWLQDWLRQ LQ WKH VRXUFH V\VWHP 7KLV LV DQ HQWU\ LQ WKH 5)& VLGH LQIRUPDWLRQ WDEOH 5)&'(6 ZKLFK \RX FDQ PDLQWDLQ XVLQJ WUDQVDFWLRQ 60 z 7KLV W\SH RI 5)& GHVWLQDWLRQ FRQWDLQV FRPPXQLFDWLRQ SDUDPHWHUV DQG LI UHTXLUHG WKH ORJRQ GDWD QHFHVVDU\ IRU VHWWLQJ XS WKH FRQQHFWLRQ RU WKH ORJRQ LQ WKH UHPRWH V\VWHP z 'HSHQGLQJ RQ WKH UHPRWH SDUWQHU V\VWHP \RX QHHG WR GHILQH DQ 5)& GHVWLQDWLRQ RI WKH DSSURSULDWH W\SH z 63$&( 121( DQG %$&. DUH SUHGHILQHG VWDQGDUG GHVWLQDWLRQV ZLWK VSHFLDO PHDQLQJV © SAP AG 2002 © SAP AG BC415 3-21 .

6\QFKURQRXV 5)& 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-22 .

Q WKLV WRSLF \RX ZLOO OHDUQ WKH WHFKQLTXHV RI V\QFKURQRXV 5)& © SAP AG 2002 © SAP AG BC415 3-23 .6\QFKURQRXV 5)& 'HVWLQDWLRQV 7RSLF 2EMHFWLYHV z .

6\QFKURQRXV 5)& 3URFHVV )ORZ.

processing is stalled in the calling program until the called remote function is processed and its output is returned.21 .3257.21 &$// )81&7.3257.1*  '% /8: ¦ 'DWD LV UHWXUQHG 0 ¦ ¨ ¨ ¥  ¨     ¥  $ #       © SAP AG 2002 With synchronous RFCs.03257.1*  . 352*5$0  352*5$0        'DWD LV SDVVHG 5HPRWH IXQFWLRQ )81&7.1*  (.<= '(67.03257.<= &$// )81&7.1$7.21 .21 % (. Processing in the calling program continues after the call.1*  .1$7.<=    (1')81&7. 2 © SAP AG BC415 3-24 .21 .21 % '(67.

6\QFKURQRXV 5)& 6\QWD[.

5 $SSOLFDWLRQ 6HUYHU 5HPRWH 6$3 6\VWHP $%$3 SURJUDP $%$3 IXQFWLRQ PRGXOH    &$// )81&7.21B)$.1* I D 7$%/(6 W LWDE (. always include handling for the standard exceptions COMMUNICATION_FAILURE and SYSTEM_FAILURE.03257. DESTINATION ./85(  ([WHUQDO SURJUDP   & URXWLQH $%&       © SAP AG 2002 You can call the remote ABAP function modules or even C routines in external server programs using the command CALL FUNCTION . The exception COMMUNICATION_FAILURE is triggered by the system if the specified destination in the side information table RFCDES is not maintained. or if the connection to the remote system cannot be established.21 '(67./85( 6<67(0B)$.21 . When you call a function in this way.21 $%&    (1')81&7.21 $%& )81&7.1$7.1* I D .216 &20081.&$7.&(37. The exception SYSTEM_FAILURE is triggered if the function module or C routine that you want to start in the remote system is not available.. © SAP AG BC415 3-25 .3257.<= (..

1$7.<=    (1')81&7. they can both access the same global data of the function group.21 % ¦ 0 ¦ ¨ ¨ ¥  ¨     ¥  $ #    '% /8:  '% /8:  © SAP AG 2002 The connection to a remote destination remains intact for as long as the context of the calling program remains active.21 0 ¦ ¨ ¥ ¨ ¨       ¥ $ #    )81&7. 2 2 © SAP AG BC415 3-26 .21 &$// )81&7.21 $%& '(67. This means that if you call two function modules from the same function group one after the other. Each function module called using synchronous RFC forms its own logical unit of work (LUW).21 % ¦ (1')81&7.1$7./RJLFDO 8QLWV DQG 5HPRWH 3URJUDP &RQWH[W 5HPRWH 5 DSSOLFDWLRQ VHUYHU 5HPRWH 5 DSSOLFDWLRQ VHUYHU 5 DSSOLFDWLRQ VHUYHU DSSOLFDWLRQ VHUYHU )XQFWLRQ JURXS $%$3 SURJUDP *OREDO GDWD 352*5$0   )81&7.<= '(67.21 .21 .21 $%&    &$// )81&7. 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).

the remote function module is executed in one step (background processing).21 $%& &$// )81&7. the remote function module for processing through the debugger of your calling prgram Also. you can easily access. step by step.1$7. the remote logon user must be type GLDORJ and must have debug authorization.21 © SAP AG 2002 You can debug function modules called remotely in R/3 . © SAP AG BC415 3-27 . If this is not the case.5HPRWH 'HEXJJLQJ 5 DSSOLFDWLRQ VHUYHU 5HPRWH 5 DSSOLFDWLRQ VHUYHU $%$3 SURJUDP LQ WKH GHEXJJHU )XQFWLRQ PRGXOH LQ WKH GHEXJJHU    )81&7.21 $%& '(67.R/3 connections. In this way.21 %       (1')81&7. choose: %UHDNSRLQWV → %UHDNSRLQW IRU VWDWHPHQW → (QWHU 5)& During remote debugging of a synchronous RFC. From the Debugger menu. you can have a breakpoint set automatically before each RFC statement in the debugger of your calling program.

or list display). CALL SCREEN. the remote logon must be type GLDORJ. Remember that these RFC dialogs in background processing cause program termination with the exception SYSTEM_FAILURE.21 $%&    &$// 6&5((1      (1')81&7.21 $%& '(67. © SAP AG BC415 3-28 . Otherwise.21 'LVSOD\ UHPRWH VFUHHQ IRU LQSXW 6FUHHQ  6FUHHQ  6FUHHQ  8VHU HQWULHV &DOOLQJ VHVVLRQ © SAP AG 2002 If a remotely-called function module uses dialogs (for example. the screens concerned are displayed with all the functions in the session of the caller.21 %    )81&7.1$7.5)& 'LDORJ 5 DSSOLFDWLRQ VHUYHU 5HPRWH 5 DSSOLFDWLRQ VHUYHU 352*5$0     &$// )81&7. the RFC exception SYSTEM_FAILURE will be triggered. CALL TRANSACTION. Here.

6\QFKURQRXV 5)& 7RSLF 6XPPDU\ z :LWK V\QFKURQRXV 5)& WKH FDOOLQJ SURJUDP ZDLWV XQWLO WKH FDOOHG IXQFWLRQ PRGXOH KDV EHHQ SURFHVVHG z .Q DQ 5)& EHWZHHQ 5 6\VWHPV DOO UHPRWH GLDORJV DUH GLVSOD\HG RQ WKH FDOOLQJ SURJUDP VLGH © SAP AG 2002 © SAP AG BC415 3-29 .Q D UHPRWH IXQFWLRQ FDOO EHWZHHQ WZR 5 6\VWHPV \RX FDQ GHEXJ IXQFWLRQ PRGXOHV WKDW DUH UXQQLQJ UHPRWHO\ z .

$V\QFKURQRXV 5)& 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-30 .

$V\QFKURQRXV 5)& 7RSLF 2EMHFWLYHV z <RX ZLOO OHDUQ KRZ WR FDOO IXQFWLRQ PRGXOHV DV\QFKURQRXVO\ LQ RUGHU WR LPSOHPHQW SDUDOOHO SURFHVVLQJ z <RX ZLOO EH DEOH WR H[SODLQ WKH LQWHUQDO UHVRXUFH PDQDJHPHQW WHFKQLTXHV XVHG LQ WKLV FRQWH[W © SAP AG 2002 © SAP AG BC415 3-31 .

$V\QFKURQRXV 5)& 3URFHVV )ORZ.

1* 1(: 7$6.1$7.<=    '% /8: K O K I I J F I H G F F N J E M L       5HPRWH IXQFWLRQ (1')81&7.1*  )81&7.1* 1(: 7$6. Asynchronous RFCs are intended for parallel processing of processes.21 % 67$57.1*  (. Remote function processing itself is separate from the calling program. % (. the called remote function is started and processing continues immedately afterwards in the calling program. % 67$57.21 % '(67.<= &$// )81&7.3257.1$7.<= '(67.21 . The output of the function can be received later in the program.3257.21 .21 'DWD LV UHWXUQHG © SAP AG 2002 In an asynchronous remote function call. Q Q © SAP AG BC415 3-32 . 352*5$0  352*5$0        'DWD LV SDVVHG &$// )81&7.21 .

$V\QFKURQRXV 5)& %DVLF 6\QWD[.

1* 1(: 7$6.1*  (. and the client program is rolled out of its work process.21 % 67$57.03257. If resource bottlenecks are detected.Q WKH D5)& FDOO  1R . the RFC calls are each executed in a work process. The client program can then receive results from previous aRFC calls. 7 (. Here. too.1$7./85( $V\QFKURQRXV FDOO )81&7. an automatic load check is performed on the target server.1$7. After these aRFC calls.21 % '(67. You can use any task name.&(37.&$7.1*  7$%/(6  7$%/(6  (.1* 1(: 7$6. Q During the call.21 .216 &20081.3257. the system waits for a short time for the next aRFC call meant for the same remote system./85( 6<67(0B)$. 352*5$0  352*5$0     &$// )81&7. Receiving the function module output and handling the function module-specific exceptions are optional tasks. Q Q © SAP AG BC415 3-33 ./85( 6<67(0B)$. however. you can set the number of aRFC calls for each destination using the aRFC options.&$7. you can call a remote function module asynchronously.21B)$.216 (. that in this context.&(37.3257. Q The function module that you call is executed in its own work process.21 ./85( &20081.21B)$.21        . however. Note.1* DGGLWLRQ  1R FDWFKLQJ RI )0 H[FHSWLRQV © SAP AG 2002 With the STARTING NEW TASK <task name> addition. The function module output must be received and the function module-specific exceptions must be handled later on in a different place.21 . Q You can also use aRFC in background processing. for the same reason.<= &$// )81&7. you can handle only the two system exceptions COMMUNICATION_FAILURE and SYSTEM_FAILURE. 7 67$57.<=    (1')81&7. Q In the side information table RFCDES.<= '(67. you may not specify an IMPORTING addition since the call does not wait for the end of the function module.

D5)& ZLWK &RQILUPDWLRQ .

21 ./85(   6<67(0B)$.21 % 67$57.1*  7$%/(6  7$%/(6  (.1* subprogram! 21 (1' 2) 7$6.21B)$. Q The subprogram must also have a formal parameter with any name you choose.21 % '(67.1*  . WRITE statements in this subroutine.1$7. COMMIT WORK. W or I messages).9( 5(68/76 )520 )81&7./85(  6<67(0B)$. it receives the accompanying task name./85(    7 7 )250 83 86.1* 7 )250 83 86. do not work.21 © SAP AG 2006 A program can receive output (parameters and exceptions) from a function module that is running asynchronously.21 IEQDPH!   ".<= . 3(5)250.&$7. Q The subroutine can only be executed automatically if the calling program is in rollout status. When the subroutine is called.216 (.21 .21 .1* 1(: 7$6./85( &20081.21B)$.9( 5(68/76 )520 )81&7.&(37.21 5(&(. This parameter lets you see which aRFC call just ended. The subprogram you specify must exist in your program and the output of the function module should be received through the command "5(&(.3257.<= . (.1* 83 21 (1' 2) 7$6.3257.<=    (1')81&7. Q To implement this. which is specially defined for aRFC.21B)$. use the addition "3(5)250.&$7.1* 1(: 7$6.1*  7$%/(6  7$%/(6  (.&(37. RFCs. When the function module ends. Q The subroutine cannot contain any statements that interrupt the program execution (such as CALL SCREEN.<= &$// )81&7.&(37./85(  )/.21B)$. 7 3(5)250./85(  6<67(0B)$. Q Q © SAP AG BC415 3-34 .216 &20081.1* 7 5(&(. and you can receive the relevant output using the "RECEIVE RESULTS FROM FUNCTION" command.&$7.21 ./85(   6<67(0B)$. This lets you use the old remote context with later aRFC calls under the same task name./85( &20081.216 (.*+7B127B)281'  )/. 7 67$57. 352*5$0  352*5$0    &$// )81&7. the subprogram is called automatically.1* 83 21 (1' 2) 7$6.<= '(67. 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.*+7B127B)281'    (1')250 (1')250 )81&7. WAIT.03257.216 &20081.1*  (.03257." for the call.&(37.1$7. SUBMIT.9( 5(68/76 )520 )81&7.&$7. -> "WAIT UNTIL" statements (see next slide).

D5)& ZLWK &RQILUPDWLRQ .

7 67$57.9( 5(68/76 )520 )81&7. Q Q © SAP AG BC415 3-35 .21 .216  Evaluate SY-SUBRC immediately or store Set WAIT condition (1')250 (1')250 © SAP AG 2006 The language element WAIT UNTIL with the addition PERFORMING is only useful with aRFC.&(37. Q At the execution of the "WAIT UNTIL" statement.1* 1(: 7$6. If the condition is met.03257. This check/wait process repeats until the "WAIT UNTIL" condition is met or until no more open aRFC calls are left.7 817.1*  7$%/(6  (.1* 7 (1')81&7.1$7.9( 5(68/76 )520 )81&7.1* 1(: 7$6.<= '(67. and otherwise has no effects. Otherwise. Note that the "WAIT UNTIL" statement sets the SY-SUBRC.21 % 67$57. 7 3(5)250.1* 7 )250 83 86.<= .1*  7$%/(6  (.<= &$// )81&7.21 . the specified condition is checked.21 7 7    5(&(.     Program waits :$. 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).21 ./ ORJH[S!  in rollout status :$.1$7.21 . the form routine specified when it was called is executed and then it branches back to the "WAIT UNTIL" statement.&(37.1* 83 21 (1' 2) 7$6.<= 5(&(.7 817.216  . 352*5$0   352*5$0     &$// )81&7./ ORJH[S!   (implicit DB commit)   )81&7.  3(5)250.03257.??? If an aRFC now returns its output. the program continues directly after the "WAIT UNTIL" statement. the program waits in rollout status for the output delivery of the aRFC.21 .1* 83 21 (1' 2) 7$6. Therefore.21 % '(67.<= (QG RI PDLQ SURJUDP )250 83 86.

$/ $1' 127 IODJ .21 % '(67.1* 1(: 7$6.([DPSOH :DLWLQJ IRU PXOWLSOH D5)&V 352*5$0  352*5$0    &$// )81&7.7.9( 5(68/76  Output processing of .7 817.21 .21 .9( 5(68/76  Output processing of .6 .  IODJ . '(67.1* 7 )250 83 86.1* 83 21 (1' 2) 7$6.9( 5(68/76  Output processing of .1.1* 1(: 7$6.1* 83 21 (1' 2) 7$6. &$// )81&7.1. 3(5)250.7.6 . you must adjust the WAIT UNTIL condition accordingly.1$7. '(67.$/ :$. 7 3(5)250.1.21 % '(67.7. 3(5)250.      :$.6 ./ 127 IODJ . (here: set flag1 or flag2) Q Q © SAP AG BC415 3-36 ./ 127 IODJ .  © SAP AG 2006 In this program example.1$7. ! :+(1 7   5(&(. &$// )81&7.1$7. 7 67$57.21 % 67$57.1* 1(: 7$6. ! :+(1 7   5(&(. the subroutine UP1 is always executed.1* 1(: 7$6.1* 83 21 (1' 2) 7$6.9( 5(68/76  Output processing of . Q This subroutine uses parameter T (which is automatically transferred by the system at the call) to separately decide which function module just returned its output. there are two aRFCs and.21 .   &$// )81&7.1.$/    )250 83 86. when the aRFCs are confirmed. ! (1'&$6( (1'&$6( (1')250 (1')250 IODJ .$/ $1' 127 IODJ .21 % 67$57.  IODJ . ! :+(1 7   5(&(.1$7.6 .1* 83 21 (1' 2) 7$6.7 817.1* 7 &$6( 7 &$6( 7 :+(1 7   5(&(. 7 3(5)250. Then the corresponding RECEIVE RESULTS statement is used to receive (and process) the output. 7 67$57.21 .??? After processing an aRFC output.7.  IODJ .

21  '(67.1$7.21 % 67$57.  )XQFWLRQ JURXS 5HPRWH )XQFWLRQ )XQFWLRQ PRGXOH PRGXOH © SAP AG 2002 aRFC is particularly suited for implementing parallel processing in several R/3 Systems.D5)& %HWZHHQ 'LIIHUHQW 5 6\VWHPV 5 6\VWHP $ 5 6\VWHP % 5 DSSOLFDWLRQ VHUYHU 5 DSSOLFDWLRQ VHUYHU :RUN SURFHVV :RUN SURFHVV 352*5$0  &$// )81&7. Q © SAP AG BC415 3-37 .1* 1(: 7$6.

) Q Q © SAP AG BC415 3-38 . (You can find this under .21 $ 67$57.1* 1(: 7$6. Enter the RFC destination that refers to the corresponding application server.1$7. for example.21  '(67. to move some of the processing load to an application server specially used for this.QWHUQDO FRQQHFWLRQV in transaction SM59.QWHUQDO UHPRWH )XQFWLRQ )XQFWLRQ PRGXOH PRGXOH © SAP AG 2002 You can also use aRFC within the same SAP R/3 System.D5)& :LWKLQ WKH 6DPH 5 6\VWHP 5 6\VWHP 5 DSSOLFDWLRQ VHUYHU $ 5 DSSOLFDWLRQ VHUYHU $ :RUN SURFHVV :RUN SURFHVV 352*5$0  &$// )81&7.  )XQFWLRQ JURXS .

Q At a function module call in this R/3 system you can use the addition DESTINATION IN GROUP <RFC group> to specify one of the defined RFC groups.1 *5283 * 5)& JURXS * R R R R R R (.<= 67$57. the system triggers the exception 5(6285&(B)$.216   5(6285&(B)$.1$7. it cannot be used together with the previous addition DESTINATION.1* 1(: 7$6.216  (.1$7.&(37.21 . you can specify conditions under which the application server is to be considered as "available for aRFCs within the same R/3 system". Q Q © SAP AG BC415 3-39 . Q When assigning an application server to an RFC group. The server is then selected from amongst all the application servers of the R/3 system. .In contrast to the previous addition DESTINATION you must specify it DIWHU 67$57.21 .1 *5283 * '(67.<= &$// )81&7.1 *5283 '()$8/7 $SSO 6HUYHU $ $SSO 6HUYHU $ $SSO 6HUYHU $ R   5)& JURXS '()$8/7 R R R R R © SAP AG 2006 You can use transaction SM59 to divide the application servers for an SAP R/3 system into different RFC groups.21 . and .1* 1(: 7$6. The server in this group that has the lowest load is then selected to execute the function module. 7 '(67. You can also specify the ’DEFAULT’RFC group. 7 67$57.D5)& LQ WKH 6DPH 5 6\VWHP ZLWK /RDG 'LVWULEXWLRQ 5 6\VWHP 352*5$0   352*5$0     &$// )81&7. If none of the servers belonging to the specified RFC group are available for this aRFC./85( 5)& JURXS * $SSO 6HUYHU $ '(67.1 *5283 '()$8/7 '(67. that is.21 .1$7.21 .&(37.1$7.FDQ RQO\ EH XVHG LQ WKH VDPH 5 V\VWHP.It is generally to be considered different from the previous addition DESTINATION./85( Notes about the addition '(67./85( 5(6285&(B)$.1$7.1 *5283  .1* 1(: 7$6.21 .21 .

Q Q © SAP AG BC415 3-40 .1* 1(: 7$6. however.D5)& :LWKLQ WKH 6DPH $SSOLFDWLRQ 6HUYHU 5 6\VWHP 5 $SSOLFDWLRQ 6HUYHU :RUN SURFHVV  :RUN SURFHVV  352*5$0  &$// )81&7. Note.  /RFDO )XQFWLRQ JURXS )XQFWLRQ PRGXOH © SAP AG 2002 You can also use aRFC locally within the VDPH DSSOLFDWLRQ VHUYHU to implement parallel processing in several work processes. Q Here you do not need to specify a destination. that several work processes will be occupied by your program at the same time.21  67$57.

too. Q Q © SAP AG BC415 3-41 .21 $%&    &$// 6&5((1      (1')81&7. the remote logon use must be type GLDORJ Otherwise. Remember. but this is not possible if an SAP router is implemented.1* 1(: 7$6.1$7. The reason is that. The debugger screen then appears as a new external mode. too. the relevant screens are displayed in an additional (new external session) window on the calling side. Q As with synchronous RFC. the exception SYSTEM_FAILURE is triggered. Q When you write the program. Q Here.D5)& ZLWK 'LDORJ 5HPRWH 5 DSSOLFDWLRQ VHUYHU 5 DSSOLFDWLRQ VHUYHU 352*5$0     &$// )81&7. the remote logon use must be type GLDORJ and must also have debugging authorization. 7    )81&7. the RFC exception SYSTEM_FAILURE will be triggered.21 % 67$57. that the aRFC dialog described here will not function if you have an SAP router set in between. for each aRFC dialog. remote debugging is also possible for asynchronous calls.21 [ X X V J S X K N F X V U T H G S I L \ ] G [ I V N 0DLQ VHVVLRQ K &DOOLQJ VHVVLRQ 6FUHHQ  6FUHHQ  6FUHHQ  8VHU HQWULHV ([WHUQDO VHVVLRQ © SAP AG 2002 If you have called a function module asynchronously and it contains dialogs. If the calling dialog user already has six external sessions open.21 $%& '(67. limit the number of external sessions for each dialog user to six. a return link to the source system is specially set up. Here.

$V\QFKURQRXV 5)& 7RSLF 6XPPDU\ z D5)& HQDEOHV \RX WR LPSOHPHQW SDUDOOHO SURFHVVLQJ z <RX FDQ XVH D5)& V\VWHPZLGH IRU PXOWLSOH DSSOLFDWLRQ VHUYHUV RU ORFDOO\ RQ WKH VDPH DSSOLFDWLRQ VHUYHU z )XQFWLRQ PRGXOHV UXQQLQJ DV\QFKURQRXVO\ FDQ UHWXUQ GDWD WR WKH FDOOLQJ SURJUDP 7R GR WKLV WKH FDOOLQJ SURJUDP PXVW UHPDLQ DFWLYH XQWLO WKH IXQFWLRQ PRGXOH RXWSXW KDV EHHQ UHWXUQHG © SAP AG 2002 © SAP AG BC415 3-42 .

7UDQVDFWLRQDO 5)& 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-43 .

7UDQVDFWLRQDO 5)& 7RSLF 2EMHFWLYHV z +RZ WR FRPELQH VHYHUDO UHPRWH IXQFWLRQ PRGXOHV IRU HDFK GHVWLQDWLRQ.

LQWR D GDWDEDVH /8: ZLWK DXWRPDWLF UROOEDFN DQG FRPPLW PHFKDQLVPV XVLQJ W5)& z +RZ WR SURJUDP W5)& LQ $%$3 z 7R EH DZDUH WKDW W5)& JXDUDQWHHV UHWXUQ FRQILUPDWLRQ RI WKH UHPRWH SURFHVVLQJ VWDWXV DQG WR EH DEOH WR PDQDJH W5)& /8:V XVLQJ WUDQVDFWLRQ 60 © SAP AG 2002 © SAP AG BC415 3-44 .

.*5281' 7$6.21 .*5281' 7$6. &$// )81&7.1 %$&.*5281' 7$6.21 %   6WDUW ZLWK GDWD WUDQVIHU QR ZDLWLQJ.7UDQVDFWLRQDO 5)&  3XUSRVH 3URFHVV DQG 6\QWD[ 352*5$0  352*5$0    1R IXQFWLRQ PRGXOH RXWSXWV UHFHLYHG &$// )81&7. '(67.21 % '(67.1 %$&.1$7. &$// )81&7.21 . . '(67.1$7.21 .21 % '(67.1 %$&. .*5281' 7$6.1$7.1 %$&. .21 .1$7.21 %   &$// )81&7.

    (1')81&7. )81&7.21 .7 :25.7 :25. &200.21 K O K I I J F I H F G N _ J ^ M L    /RJLFDO XQLW RI ZRUN /8:. &200.

1 %$&. ON END OF TASK when called. which you must place EHIRUH the DESTINATION entry.21 .    (1')81&7. . . Q Q © SAP AG BC415 3-45 . you can use the administration transaction SM58 to display and modify tRFC LUWs. . 0DQDJHPHQW  PRQLWRULQJ RI 0DQDJHPHQW PRQLWRULQJ RI W5)& /8:V XVLQJ 60 W5)& /8:V XVLQJ 60 *XDUDQWHHG SURFHVVLQJ FRQILUPDWLRQ )81&7. . In the source system. Unlike aRFC." to bundle all the previously executed ??? RFCs in one LUW. . for transactional RFCs you can group several remote functions in one LUW (with automatic rollback mechanism if there is an error). .*5281' 7$6.7 :25. the output from the called function module cannot be received.". You can use "&200. Q tRFCs are also called asynchronously. -> No IMPORTING . Q You can implement a tRFC with the addition ".21 '% /8: © SAP AG 2006 Whereas with synchronous and asynchronous RFCs each call makes up a single logical unit of work (LUW) in the remote system. / PERFORMING . -> No RECEIVE RESULTS FROM FUNCTION .

the accompanying entries are deleted from the tRFC tables. but rather trigger it at a later time. Q The COMMIT WORK statement automatically schedules an immediate job or a job set for a later start time to remotely call the LUW. you must enter the date and time of execution. If the update is also triggered locally by the COMMIT WORK statement. If an error occurs.7 :25. If the remote LUW is executed successfully. an automatic repeat mechanism or rollback mechanism is activated. Here. while ARFCSDATA contains the input data for the tRFCs. Q Q © SAP AG BC415 3-46 . The execution status of the LUWs is logged in table ARFCSSTATE. the relevant data is read from the tRFC tables. call the function module START_OF_BACKGROUNDTASK EHIRUH the COMMIT WORK statement locally. During job execution.([HFXWLRQ 0HFKDQLVPV &OLHQW / 8 : W5)& FDOO  W5)& FDOO  2SWLRQDO  f j r a k x g t f e i m s r ` <date/time> i a h g s p f n ` h c f g i e m n c g b i m w a v g b k a ` j u &200. and the corresponding tRFCs are transmitted. 6HUYHU W5)& FDOO $5)&667$7( $5)&6'$7$ 60 )XQFWLRQ  -RE ([HFXWLRQ VWDWXV )XQFWLRQ  / 8 : © SAP AG 2002 tRFC calls are first stored in the local tRFC tables ARFCSSTATE and ARFCSDATA. Q If you do not want to execute a remote LUW immediately. the tRFCs are executed only when the local update is successfully completed.

$XWRPDWLF 0HFKDQLVPV 6XFFHVVIXO RU (UURU &OLHQW 6HUYHU W5)& FDOO $5)&667$7( $5)&6'$7$ 60 )XQFWLRQ  -RE ([HFXWLRQ VWDWXV )XQFWLRQ  / 8 : .I VXFFHVVIXO 5HOHYDQW HQWULHV GHOHWHG IURP W5)& WDEOHV .I SDUWQHU QRW UHDFKDEOH $XWRPDWLF MRE UHVFKHGXOLQJ <RX FDQ VHW WKH QXPEHU RI UHSHDW DWWHPSWV DQG LQWHUYDO OHQJWK LQ WKH GHVWLQDWLRQ W5)& RSWLRQV.

I HUURU ZLWK WHUPLQDWLRQ LQ RQH RI UHPRWH IXQFWLRQV PRGXOHV y $XWRPDWLF UROOEDFN LQ WKH WDUJHW V\VWHP  HUURU QRWH LQ $5)&667$7( 1R GHOHWLRQ  QR DXWRPDWLF MRE UHVFKHGXOLQJ LQ VRXUFH V\VWHP. z .

.. and you have to correct the problem in the remote system. The default setting is 30 times maximum.6( H[FHSWLRQ! If no connection can be made to the partner. you can set the number of times the system repeats the effort to connect. the following will happen: . Afterwards. and the execution job is not rescheduled. or RAISE. using the tRFC options.) or triggers an exception (RAISE.. call the function module RESTART_OF_BACKGROUNDTASK in the remote function module instead of MESSAGE A.. Q The entries relevant to the LUW remain in the tRFC tables. z y © SAP AG 2002 $ PHVVDJH  5$. and the time intervals. In the destination.These changes are logged in the source system of the remote program termination in the tRFC status table ARFCSSTATE (can be viewed using SM58). but at the same time reschedule the job in the source system (for example. . and the job is rescheduled.. because a master record that is to be processed is locked and the LUW must be executed again).All the changes executed in the remote system in the current LUW are rolled back. Q If the program terminates with an A/X-message (MESSAGE A/X. with a 15-minute interval. Q © SAP AG BC415 3-47 . If you want to cancel and roll back this remote execution from a remote function module of a tRFC LUW... you can find the remote error using transaction SM58.) after a tRFC-LUW has been sucessfully executed in the partner system in one of the function modules. you must trigger the remote execution again in transaction SM58 (function ([HFXWH /8:). In this case.. this is logged in the tRFC status table ARFCSSTATE (viewable by calling transaction SM58).

you must use the rollback mechanism in the external server program (see RFC-SDK documentation and example programs).*5281' 7$6. '(67.21 '(67. they are grouped into different LUWs according to their destination.*5281' 7$6.*5281' 7$6. © SAP AG 2002 If tRFCs are transmitted with different destinations before the COMMIT WORK.1$7.1 %$&. &$// )81&7. &$// )81&7. { | { &$// )81&7.*5281' 7$6.1 %$&.*5281' 7$6. '(67.1 %$&.7 :25. . You can also call transactional C functions.7 :25.21 .21 '(67.1$7.21 .1$7.21 'HVWLQDWLRQ % { .21 '(67.21 .*5281' 7$6. &$// )81&7.1 %$&.1$7. .1 %$&. / 8 :  { } { &200. You can determine the LUW execution status using the function module STATUS_OF_BACKGROUNDTASK under the transaction ID (which is called after the COMMIT WORK). Q Each tRFC-LUW is assigned a unique transaction ID (viewable using transaction SM58). Q A tRFC call with the AS SEPARATE UNIT addition is always processed as a separate LUW independently of the other tRFCs.1 %$&.21 . '(67. | { &$// )81&7.1$7. However.21   .21 / 8 :  'HVWLQDWLRQ & { .*5281' 7$6.1$7. . . &$// )81&7.*5281' 7$6. Q Q © SAP AG BC415 3-48 . '(67.1$7.21 . . } { &$// )81&7.21 ./8: %XQGOLQJ &OLHQW SURJUDP 352*5$0  352*5$0    &$// )81&7. &200.1 %$&.21 . .1 %$&.21 . . Q If you also called the update function modules locally before the COMMIT WORK.1$7.21 .21 '(67. . tRFC calls will be processed only after the local update function modules have been processed successfully. The function module ID_OF_BACKGROUNDTASK (called before the COMMIT WORK) returns this ID.

7UDQVDFWLRQDO 5)& 7RSLF 6XPPDU\ z <RX FDQ XVH W5)& WR SURFHVV VHYHUDO IXQFWLRQ PRGXOHV UHPRWHO\ LQ WKH VDPH /8: ZLWK WKH DXWRPDWLF UROOEDFN PHFKDQLVP z W5)& DOORZV \RX WR HQVXUH WKDW WKH IXQFWLRQ PRGXOHV \RX FDOO DUH H[HFXWHG HYHQ LI WKH WDUJHW V\VWHP LV XQDYDLODEOH ZKHQ WKH FDOO LV PDGH z :LWK W5)&V \RX DUH JXDUDQWHHG D FRQILUPDWLRQ RI WKH UHPRWH SURFHVVLQJ VWDWXV z <RX FDQ XVH WUDQVDFWLRQ 60 WR GLVSOD\ DQG SURFHVV GHOHWH DQG H[HFXWH.

LQFRUUHFW RU QRQH[HFXWHG W5)& /8:V © SAP AG 2002 © SAP AG BC415 3-49 .

4XHXHG 5)& 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-50 .

4XHXHG 5)& 7RSLF 2EMHFWLYHV z <RX NQRZ WKDW \RX FDQ VHULDOL]H W5)&/8:V LQ D TXHXH XVLQJ TXHXHG 5)& z <RX FDQ H[SODLQ WKH DUFKLWHFWXUH DQG SURJUDPPLQJ RI TXHXHG 5)& z <RX NQRZ KRZ WR PDQDJH 5)& TXHXHV XVLQJ WUDQVDFWLRQ 604 © SAP AG 2002 © SAP AG BC415 3-51 .

3XUSRVH RI 4XHXHG 5)& T5)&.

6HULDOL]DWLRQ RI W5)&/8:V /8: 4XHXH VW W5)& /8: /8: LV VHQW ‹ ‰ ˆ ˆ € € ‡ ‡ … … † †   … … „ „ ƒ ƒ ‚ ‚   € €   Œ  ‰ QWK W5)& /8: Š ‰ Ž  ˆ ‡ ˆ ‰ ‰ € ˆ € … € ‡ † ‡ …  … † … †  „  … ƒ … „ ‚ „ ƒ  ƒ ‚ € ‚    € /8: LV JHQHUDWHG €   © SAP AG 2002 LUWs generated using tRFC are processed independently of each other. Queued RFC (qRFC) is available as of Release 4. use qRFC as an extension of tRFC.6A. and can be used in SAP R/3-R/3 connections and in SAP R/3 external connections. This means the order in which they are processed is not always the order in which they are generated.   © SAP AG BC415 3-52 .  To ensure that tRFC-LUWs are processed in the same order as they were generated.

and may not contain an asterisk (*). you must specify the queue you want to use through the function module TRFC_SET_QUEUE_NAME EHIRUH HYHU\ VLQJOH W5)& FDOO.© SAP AG BC415 3-53 You can choose the queue name you need to specify. and it can have up to 24 characters The queue name may QRW start with an empty character or the percent (%) symbol.  © SAP AG 2002 R R R R ± R R { Í ¿ Ì œ š · ˜ ™ ¡ ¡ š } R ± ¶ ž µ  £ { ˜ ² { Ì ¸ ² – – š • { ™ š ˜ œ – š  ¥ ™ – ± ˜ ™ } } ˜ ž Ÿ |  – ² – • ™ “ ‘ ‘  } Ë ¿ R { É Ç Æ ¿ Å ¾ ½ Ä ¼ à  » Á Ï À É ¯   { « ª © ¨ § ¦ ¥ – ™ ˜ œ š ¤ £ Ÿ { Ÿ ¡  –  Ÿ • Ÿ •    ˜ Ÿ ž  } “ œ ˜ { – š ™ ˜ } – • “ ‘ ‘  } º Î R R R { ¶ ± µ ž £  { – ˜ ² { } š – ™ • { ˜ š  œ – š – ¥ ™ ™ } ± ˜ ˜  } ž Ÿ | – ² – • ™ “ ‘ ‘  } R { ¯   { « ª © ¨ § ¦ ¥ – ™ ˜ œ š ¤ £ Ÿ { Ÿ ¡  –  Ÿ • Ÿ •    ˜ Ÿ ž  } “ œ ˜ { – š ™ ˜ } – • “ ‘ ‘  } R ± R R { Í Ì ¿ œ š · ˜ ™ ¡ ¡ š } R ¶ ± µ ž £  { – ˜ ² { Ì ¸ š – ™ • ˜ š { |  œ – – ¥ š ™ ± ™ ˜ } ˜ Ÿ ž  } ² | – – • ™ “ ‘ ‘  } Ë ¿ R { É Ç Æ ¿ Å ¾ ½ Ä ¼ à  » Á º ¹ À ¯   { « ª © ¨ § ¦ ¥ – ™ ˜ œ š ¤ £ Ÿ { Ÿ ¡  –  Ÿ • Ÿ •    ˜ Ÿ ž  } “ œ ˜ { – š ™ ˜ } – • “ ‘ ‘  } º ¸ R R R { ¶ ± µ ž £  { – ˜ ² { š –  ™ • ˜ š {  œ – – ¥ š ™ ± ™ ˜ } ˜ ž  } Ÿ ² | – – • ™ “ ‘ ‘  } R { ¯   { « ª © ¨ § ¦ ¥ – ™ ˜ œ š ¤ £ Ÿ { Ÿ ¡  –  Ÿ • Ÿ •    ˜ Ÿ ž  } “ œ ˜ { – š ™ ˜ } – • “ ‘ ‘ R R R  R } R R ¡  œ ¥ š œ ¤ 6\QWD[ .  To place tRFC-LUWs in a first-in-first-out (FIFO) queue.

You PXVW use the queue administration transaction SMQ1.   © SAP AG BC415 3-54 .  The queue data (queue attributes + pointers to the relevant tRFC-LUWs in the tRFC tables) is stored in the TRFCQOUT table. The relevant LUW and all of the other LUWs in the queue remain in the queue and in the tRFC tables. the queue is rolled back there.'DWD 6WRUDJH DQG 4XHXH 0DQDJHPHQW 4XHXH GDWD 75)&4287 W5)& GDWD $5)&667$7( $5)&6'$7$ 'R QRW PDLQWDLQ XVLQJ 60 0DLQWDLQ XVLQJ 7UDQVDFWLRQ 604 © SAP AG 2002 The tRFC LUWs belonging to a queue are stored in the tRFC tables.Display queues with a list of accompanying LUWs and function modules including input data . After correcting the error.Delete queues If an LUW error occurs in the remote system.ARFCSSTATE and ARFCSDATA.List queues . you can use transaction SMQ1 to transmit the queue again. However. which you can maintain using transaction SMQ1. The following functions are available: . you cannot maintain or display these LUWs using Transaction SM58.Start or stop transmission of queues .

4XHXHG 5)& 7RSLF 6XPPDU\ z :LWK T5)& \RX FDQ HQVXUH WKDW W5)& /8:V DUH SURFHVVHG LQ WKH RUGHU WKH\ ZHUH JHQHUDWHG VHULDOL]DWLRQ.

 z 7KLV LV LPSOHPHQWHG XVLQJ D TXHXH IRU W5)& /8:V z 7KH TXHXH DWWULEXWHV DUH VWRUHG LQ WKH TXHXH WDEOH 75)&4287 DQG WKH W5)& LQSXW GDWD LQ WKH W5)& WDEOHV $5)&667$7( DQG $5)&6'$7$ <RX FDQ PDLQWDLQ DQG GLVSOD\ WKLV LQIRUPDWLRQ XVLQJ WUDQVDFWLRQ 604 © SAP AG 2002 © SAP AG BC415 3-55 .

5)& ZLWK ([WHUQDO 3URJUDPV 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-56 .

5)& ZLWK ([WHUQDO 3URJUDPV 7RSLF 2EMHFWLYHV z <RX ZLOO OHDUQ KRZ H[WHUQDO 5)& FOLHQWV DQG 5)& VHUYHUV DUH VWUXFWXUHG LQ & © SAP AG 2002 © SAP AG BC415 3-57 .

([WHUQDO 5)& &OLHQW DQG 6HUYHU 5 6\VWHP ([WHUQDO 6\VWHP $%$3 SURJUDP 5)& OLEUDU\ 5)&6'.

<=  )XQFWLRQ PRGXOH )81&7. you also have several sample programs in C source together with documentation supplied with your system.21 )81&    (1')81&7.   © SAP AG BC415 3-58 .21 $%& '(67. In addition to the RFC Library.21 5)& FOLHQW SURJUDP  © SAP AG 2002 SAP delivers the RFC Library for all standard external platforms that contain RFC calls for C programs. you can use the RFC client or RFC server programs with RFC calls. 352*5$0     &$// )81&7. After installing the RFC Library on your external platform.21 (.73*0  5)& VHUYHU SURJUDP     &5RXWLQH $%& &5RXWLQH .1$7.

5)& 'HVWLQDWLRQV IRU & 3URJUDPV VDSUIFLQL.

VDSUIFLQL WH[W ILOH.

For details.ini . there is also an saprfc. '(67 7B$6 7<3( $ $6+267 LZGI 6<615  '(67 7B/% 7<3( % 51$0( 7 06+267 LZGI *5283 63$&( '(67 (.ini with sample entries and documentation for maintaining the different RFC destination types supplied with your system.73*0 7<3( ( *:+267 KV *:6(59 VDSJZ 73+267 KV 731$0( '?DEF?VUIFVHUY    © SAP AG 2002 You maintain RFC destinations for C programs in the text file saprfc.   © SAP AG BC415 3-59 . refer to the online documentation.  In addition to the RFC Library.

([WHUQDO 5)& &OLHQW 5IF2SHQ .

  5IF&DOO .

  5IF5HFHLYH .

  5IF&DOO .

  5IF5HFHLYH .

  5IF&ORVH .

  5IF&DOO5HFHLYH .

This program calls the function module RFC_SYSTEM_INFO in a remote R/3 System to get R/3 system data from it. © SAP AG 2002 This slide shows you the structure of an external RFC client. This enables you to use an asynchronous call. use 5IF&DOO5HFHLYH instead of these two RFC calls.  5IF&DOO calls an R/3 function module. 5IF5HFHLYH receives the output of the function module. use 5IF&ORVH  You will find the semantics and syntax for the RFC calls listed in the RFC library in the online documentation.  The connection to the SAP R/3 System is made using the RFC call 5IF2SHQ with the destination and logon data.  To close the RFC connection to the SAP R/3 System. If you want to use a synchronous call.   © SAP AG BC415 3-60 . The VDSLQIR program provides an example of an RFC client in C source that is delivered with the RFC Library.

([WHUQDO 5)& 6HUYHU PDLQ .

^  5IF$FFHSW .

5IF.QVWDOO)XQFWLRQ DEF.

QVWDOO)XQFWLRQ [\]. 5IF.

5IF'LVSDWFK .

5IF&ORVH .

` VWDWLF 5)&B5& DEF .

^  5IF*HW'DWD .

'DWD SURFHVVLQJ 5IF6HQG'DWD .

` VWDWLF 5)&B5& [\] .

QVWDOO)XQFWLRQ. This program contains various.   © SAP AG BC415 3-61 . interesting remote-enabled routines and can. The VDSLQIR program provides an example of an RFC client in C source that is delivered with the RFC library.  The call 5IF&ORVH ends the RFC connection.  The call 5IF*HW'DWD enables the C routine to receive the input sent from the calling program.  The call 5IF6HQG'DWD.  The call 5IF$FFHSW accepts the incoming RFC connection.  The call 5IF'LVSDWFK sends the incoming call to the corresponding C rontine.  All C routines for the RFC server program that should be called remotely must be registered as being remote-enabled using the call 5IF. ^  ` © SAP AG 2002 This slide shows you the structure of an external RFC server.  You will find the semantics and syntax for the RFC calls listed in the RFC Library in the online documentation. be called in the standard system with the supplied ABAP program RSRFCDOC through a corresponding RFC destination. returns the result to the calling program. for example.

PXVW EH LQVWDOOHG IRU 5)& RQ WKH H[WHUQDO SODWIRUP z 7KH WH[W ILOH VDSUIFLQL FRQWDLQV 5)& GHVWLQDWLRQV IRU & FOLHQWV z <RX FDQ FDOO 5 IXQFWLRQ PRGXOHV XVLQJ DQ H[WHUQDO 5)& FOLHQW SURJUDP z $OO UHPRWHHQDEOHG UHJLVWHUHG & URXWLQHV RI DQ 5)& VHUYHU SURJUDP FDQ EH FDOOHG IURP ZLWKLQ $%$3 SURJUDPV © SAP AG 2002 © SAP AG BC415 3-62 .5)& ZLWK ([WHUQDO SURJUDPV 7RSLF 6XPPDU\ z 7KH 5)& 6'.

8VH RI 5)& 7\SHV  5)& $XWKRUL]DWLRQV 2YHUYLHZ 2YHUYLHZ 5)& 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 5)& 'HVWLQDWLRQV 6\QFKURQRXV 5)& 6\QFKURQRXV 5)& $V\QFKURQRXV 5)& $V\QFKURQRXV 5)& 7UDQVDFWLRQDO 5)& 7UDQVDFWLRQDO 5)& 4XHXHG 5)& 4XHXHG 5)& 5)& ZLWK ([WHUQDO 3URJUDPV 5)& ZLWK ([WHUQDO 3URJUDPV 8VH RI 5)& 7\SHV 6HFXULW\ $VSHFWV 8VH RI 5)& 7\SHV DQG 5)& $XWKRUL]DWLRQV 6HFXULW\ $VSHFWV DQG 5)& $XWKRUL]DWLRQV © SAP AG 2002 © SAP AG BC415 3-63 .

'V LQ WKH WDUJHW V\VWHP IRU VSHFLILF XVHU .'V LQ WKH VRXUFH V\VWHP ZLWK DQ H[LVWLQJ WUXVW UHODWLRQVKLS z <RX NQRZ WKH 5)& XWLOLWLHV WKDW DUH XVHIXO © SAP AG 2002 © SAP AG BC415 3-64 .5)& 7\SHV DQG $XWKRUL]DWLRQV 7RSLF 2EMHFWLYHV z <RX ZLOO OHDUQ ZKLFK 5)& W\SHV DUH WR EH XVHG IRU ZKLFK SXUSRVH z <RX FDQ H[SODLQ ZKLFK DXWKRUL]DWLRQ FKHFNV H[LVW IRU 5)& z <RX NQRZ ZKLFK DXWKRUL]DWLRQV WKH UHPRWH XVHU QHHGV IRU WKH 5)& ORJRQ WR FDOO WKH UHPRWH IXQFWLRQ PRGXOH VXFFHVVIXOO\ z <RX FDQ GHILQH WUXVW UHODWLRQVKLSV EHWZHHQ 6$3 5 6\VWHPV DQG DOVR H[SODLQ  IRU H[LVWLQJ WUXVW UHODWLRQVKLSV  KRZ XVHUV LQ WKH VRXUFH V\VWHP FDQ XVH WKH UHOHDVHG XVHU .'V LQ WKH WDUJHW V\VWHP ZLWKRXW QHHGLQJ D SDVVZRUG IRU 5)& ORJRQ z <RX NQRZ KRZ WR UHOHDVH XVHU .

3URFHVVLQJ 6WDWXV IRU &RPPXQLFDWLRQ (UURUV 6RXUFH V\VWHP 7DUJHW V\VWHP V5)& D5)& 3URJUDP 5)& HUURU 5HPRWH SURFHVVLQJ 5HPRWH SURFHVVLQJ VWDWXV" W5)& T5)& 3URJUDP *XDUDQWHHG FRQILUPDWLRQ RI UHPRWH SURFHVVLQJ VWDWXV 5HPRWH SURFHVVLQJ © SAP AG 2002 If a communication error occurs during synchronous or asynchronous RFC. even if a communication error occurs. always guarantee confirmation of the remote processing status (continued confirmation attempts until confirmation is successful) Therefore. Therefore. these two RFC types are paraticularly suitable for remote data changes where knowledge of the remote processing status is important.   © SAP AG BC415 3-65 . on the other hand. the remote processing status is unknown. Transaction or queued RFCs. these two RFC types are suitable for remote data retrieval where knowledge of the remote processing status is not of primary importance.

8VH RI 'LIIHUHQW 5)& 7\SHV 5HPRWH 'DWD 5HWULHYDO  6\QFKURQRXV 5)&  $V\QFKURQRXV 5)& 5HPRWH 'DWD &KDQJHV  7UDQVDFWLRQDO 5)&  4XHXHG 5)& © SAP AG 2002 © SAP AG BC415 3-66 .

$XWKRUL]DWLRQ &KHFN IRU 5)& 6RXUFH 6\VWHP 7DUJHW 6$3 5 6\VWHP 5 5 H[WHUQDO.

in which function groups the user is authorized to start RFC. However. for each RFC logon user.7+  $XWKRUL]DWLRQV IRU DFWLRQV RQ WKH IXQFWLRQ PRGXOH )XQFWLRQ PRGXOH © SAP AG 2002 The authorization object S_RFC lets you define. Authorization checks for actions that call a function module remotely (for example. This user can only start function modules in these function groups with RFC. 8VHU 60. transaction authorization for CALL TRANSACTION) are compared against the user master record of the corresponding RFC logon user. you can deactivate this default setting using a profile parameter.  This authorization check is active by default.7+ 3URJUDP 5)&  $XWKRUL]DWLRQ IRU 5)& VWDUW RI GHVLUHG IXQFWLRQ PRGXOH 5)& ORJRQ ZLWK UHPRWH XVHU 60.   © SAP AG BC415 3-67 .

7KH $XWKRUL]DWLRQ 2EMHFW 6B5)& $XWKRUL]DWLRQ IRU 5)& ORJRQ XVHU WR VWDUW D IXQFWLRQ PRGXOH $XWKRUL]DWLRQ $// 5)&B1$0(  $&797  5)&B1$0( )XQFWLRQ JURXS.

$&797 5)& REMHFW W\SH.

)8*5 $FWLYLW\.

5)&B7<3( : Can currently accept only the value FUGR (function group) The above examples show authorizations for the object S_RFC : .   © SAP AG BC415 3-68 .5)&B1$0( : Can currently contain only names of function groups .$&797 : Can currently accept only the value 16 (execute) .If you use an RFC logon user with authorization "ALL". you can call all function modules. 5)&B7<3(  5)&B7<3(  2EMHFW 6B5)& $XWKRUL]DWLRQ $%&' 5)&B1$0(  $%&' $&797   5)&B7<3(  )8*5 © SAP AG 2006 The authorization object S_RFC contains three fields: . if you use an RFC logon user that only has authorization "ABCD".However. you can only call function modules of function group ABCD. . .

7UXVW 5HODWLRQVKLSV 2QO\ 55 .

 You always declare a trust relationship in the system that is to become the trusting system. You can use transaction SMT2 in the trusted system to display which trusting systems are declared for the local system. it is in the RFC target system. 'HFODUDWLRQ RI D WUXVW UHODWLRQVKLS XVLQJ 607 LQ WKH V\VWHP WKDW LV WR EHFRPH WKH WUXVWLQJ V\VWHP 5 6\VWHP $ 5 6\VWHP % 7UXVWHG 6\VWHP 7UXVWLQJ 6\VWHP 607 © SAP AG 2002 You can declare a trust relationship between two SAP R/3 Systems so that you can perform certain RFC logons in the trusting system without requiring a password for released users. which means.   © SAP AG BC415 3-69 .  You use transaction SMT1 to define a trust relationship.

5)& /RJRQ :LWKRXW D 3DVVZRUG 5 6\VWHP $ 5 6\VWHP % 7UXVWHG 6\VWHP 7UXVWLQJ 6\VWHP 7UXVW GHVWLQDWLRQ 60.

not the accompanying password. defined user ID for the RFC logon in the trusting system (RFC target system) without a password. Remote system B Remote client 002 Remote user SMITH No password ! Logon language EN 5)& 8VHU 60.Released for user Ryan in trusted system A . created using transaction SM59 (7UXVWHG V\VWHP = ’<HV’). the user requires a trust destination.Authorizations for actions on the function module $%$3 SURJUDP )XQFWLRQ PRGXOH 'LDORJ XVHU 5\DQ © SAP AG 2002 A dialog user in the trusted system (RFC source system) can use a specially released. For a detailed description of the definition and usage of trust relationships.7+ 5)& ORJRQ 5HPRWH XVHU 60.Authorization for RFC start of desired function module . refer to note number 128447.7+ XVHG ZLWKRXW SDVVZRUG . you need to release a user in the trusting system. You do this by giving an authorization for the authorization object S_RFCACL to the user you want to release in the trusting system. in which only the name of the remote user is entered. To do this. 1RWH: You can also use regular destinations (with a password) with an existing trust relationship.   © SAP AG BC415 3-70 .  To be able to use RFC logon without a password for a specific user ID in the trusted system.

1)2  $&797 $&797   © SAP AG 2006 The authorization object 6B5)&$&/ contains seven fields : . 5)&B(486(5 means that user SMITH is released for the user of the same name in trusted system A.(17 : Calling client . client 400.   © SAP AG BC415 3-71 .$&797 : Can only have the value 16 (execute) Example: If user SMITH in the trusting system has the authorization "A400_RYAN". .5)&B7&2'( : Calling transaction . he is released for the user RYAN in the trusted system A.'  $ 5)&B&/.5)&B6<6.5)&B(486(5 : Indicator that shows if the user that has this authorization is released for the user of the same name in the RFC source system. RYAN is allowed to use remote user SMITH for RFC logon without a password using any transaction from system A.' : Calling RFC source system (trusted system) .1)2: Additional information about the RFC source system (not currently used) .5)&B86(5 : Calling user .(17 5)&B&/.' $XWKRUL]DWLRQ $B5<$1 5)&B6<6.5)&B&/.7KH $XWKRUL]DWLRQ 2EMHFW 6B5)&$&/ 5HOHDVH D XVHU LQ WKH 7UXVWLQJ 6\VWHP E\ DVVLJQLQJ DXWKRUL]DWLRQ 2EMHFW 6B5)&$&/ 5)&B6<6.5)&B.(17   5)&B86(5 5)&B86(5  5<$1 5)&B(486(5 5)&B(486(5  < 5)&B7&2'( 5)&B7&2'(  5)&B.1)2 5)&B.

5)& 8WLOLWLHV z 6KRUW GXPSV FDXVHG E\ UHPRWH IXQFWLRQ PRGXOHV 67 LQ WKH UHPRWH V\VWHP z *DWHZD\ PRQLWRU GLVSOD\V DOO UXQQLQJ UHPRWH FRQQHFWLRQV WKDW UXQ RQ WKH FXUUHQW 5 JDWHZD\.

use transaction SMGW or choose from the menu as follows: *RWR → 7UDFH → *DWHZD\ → 'LVSOD\ ILOH.Set WUDFH flag in der definition (SM59) of the required destination Display trace using SM59 then choose RFC → Display trace  To display the gateway trace. from the Debugger menu. you can specify the ABAP term RFC and call up useful information on the RFC topic.  Using transaction ST05. Ñ Ñ © SAP AG BC415 3-72 . proceed as follows: .  To display a destination-related trace.Q WKH GHEXJJHU KDYH D EUHDNSRLQW VHW LQ IURQW RI HDFK 5)& %UHDNSRLQW PHQX LQ WKH GHEXJJHU z *HQHUDO WLSV IRU 5)& L NH\ LQ $%$3 HGLWRU (QWHU $%$3 WHUP 5)& © SAP AG 2002 You can analyze dumps caused by RFC function modules in the remote system using transaction ST22.  The gateway monitor (transaction SMGW) shows all the remote connections that run through the gateway of the current application server.  To have a breakpoint set automatically before each RFC statement in the debugger of your calling program. 60*: z 7UDFHV   8VHUUHODWHG 5)& WUDFH  67  'HVWLQDWLRQUHODWHG 5)& WUDFH  60  *DWHZD\ WUDFH  60*: z . you can switch on/off and display a user-related RFC trace for the current user. choose: %UHDNSRLQWV → %UHDNSRLQW IRU VWDWHPHQW → (QWHU 5)& Through the i key (information key) in your ABAP editor.

5)& 7\SHV DQG $XWKRUL]DWLRQV 7RSLF 6XPPDU\ z 6\QFKURQRXV DQG DV\QFKURQRXV 5)&V DUH VXLWDEOH IRU UHPRWH GDWD UHWULHYDO )RU UHPRWH GDWD FKDQJHV WUDQVDFWLRQDO RU TXHXHG 5)& LV PRUH VXLWDEOH GHSHQGLQJ RQ UHTXLUHPHQWV.

EHFDXVH RI JXDUDQWHHG UHPRWH SURFHVVLQJ FRQILUPDWLRQ z 7R VWDUW D IXQFWLRQ PRGXOH XVLQJ 5)& WKH 5)& ORJRQ XVHU LQ WKH WDUJHW V\VWHP QHHGV D FRUUHVSRQGLQJ DXWKRUL]DWLRQ IRU WKH DXWKRUL]DWLRQ REMHFW 6B5)& z )RU DQ H[LVWLQJ WUXVW UHODWLRQVKLS EHWZHHQ WZR 6$3 5 6\VWHPV VSHFLILF XVHUV LQ WKH VRXUFH V\VWHP FDQ XVH WKH XVHU UHOHDVHG IRU WKHP LQ WKH WDUJHW V\VWHP IRU 5)& ORJRQV ZLWKRXW D SDVVZRUG z 7R UHOHDVH D XVHU LQ WKH WDUJHW V\VWHP \RX QHHG WR JLYH DQ DXWKRUL]DWLRQ IRU WKH DXWKRUL]DWLRQ REMHFW 6B5)&$&/ © SAP AG 2002 © SAP AG BC415 3-73 .

© SAP AG BC415 3-74 .

1-2 Test your destination. Create a destination in R/3 System A through which it can communicate with R/3 System B using RFC. RFC destination name: DEST## User in source system: BC415-## Remote user for RFC logon: BC415-## ( ## = your group number) 1-1 Create and maintain logical destinations for Remote Function Call using transaction SM59. BC415 3-75 .([HUFLVHV 8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 5HPRWH 'HVWLQDWLRQV • Creating a logical destination for RFC communication with another R/3 System.) You can find out the information you need using transaction SM51 in the target system. you can press ENTER after entering the connection type to refresh the screen where fields relating to the connection type appear for maintenance. (The names of systems A and B will be given to you by your instructor. 7LSV © SAP AG 7ULFNV When maintaining the destination.

© SAP AG BC415 3-76 .

display the relevant error message. Check the exceptions defined in the function module. output the data returned by the function module. 2-2 In system A. it passes the table entry and system ID back to the caller through the interface parameters. If the function module reads an entry successfully. From your program. If the program is successful. learn to use the functions of the %&B5)&B5($'B63)/. In the function call. create a program by first copying the sample program listed above. © SAP AG BC415 3-77 . Template: SAPBC415_RFCSYNC_T1 Name of your solution program: ZBC415_##_RFCSYNC Name of the function module to be called: BC415_RFC_READ_SPFLI 2-1 In system B. The function module reads an entry from table SPFLI. function module (interface and source text). If an error occurs. call the function module BC415_RFC_READ_SPFLI in destination system B. If no table entry was found during the read access. an exception is triggered in the function module. you pass the relevant key values required for the read access using the interface parameters.Exercises 8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 6\QFKURQRXV 5)& • Calling a remote function module synchronously and passing data.

© SAP AG BC415 3-78 .

and exception handling to asynchronous processing. © SAP AG BC415 3-79 . data transfer. and convert the function call.Exercises 8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF $V\QFKURQRXV 5)& • Calling an RFC function module synchronously and passing data. Template: ZBC415_##_RFCSYNC (or SAPBC415_RFCSYNC_S1) Name of your solution program: 3-1 ZBC415_##_RFCASYNC Calling a function module remotely and asynchronously Copy your solution from the Synchronous RFC exercise or the model solution SAPBC415_RFCSYNC_S1.

© SAP AG BC415 3-80 .

4-1-1 Copy the program SAPBC415_RFCTRANS_T1 to your program. use the START_OF_BACKGROUNDTASK function module. 4-1-6 In the source system. 4-1-4 In the remote system. If not. Ensure that you copy all of the program components! You need to define a transaction code for your dialog program (see name above). There you will find a CASE statement for the field OKCODE. use the Data Browser (transaction SE16) to check that the changes have been made correctly. use transaction SM58 to check that the tRFC LUW has been correctly scheduled and executed. 4-1-2 Go to the module USER_COMMAND_0200. This function module contains two import parameters: CUSTOMER_ID Æ customer number I_TELEPHONE Æ telephone number Call the function module locally (-> local change) and then call it again remotely using transactional RFC (-> identical remote change). 4-1-3 The function module BC415_TRFC_CHANGE_SCUSTOM_ENTR allows you to change the telephone number of a customer (table SCUSTOM ). you see the entry field for the time of execution that you pass along when you call the function module. To do this. In screen 200. with screens and user interfaces. 4-1-5 Set the processing of the tRFC LUW for a future time. use transaction SM58 (tRFC monitor) to find out why. Enter the processing step you want to supplement under :+(1 µ6$9(¶. Template: SAPBC415_RFCTRANS_T1 Name of your dialog program : Name of your transaction : 4-1 SAPMZ_BC415_##_RFCTRANS ZBC415_## Making the same changes to customer data in two R/3 Systems. © SAP AG BC415 3-81 .([HUFLVHV 8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 7UDQVDFWLRQDO 5)& • Making identical changes to a customer’s telephone number in two R/3 Systems using transactional RFC. This program is a module pool.

© SAP AG BC415 3-82 .

user. Choose "Unicode Test" to check if the target system is a Unicode system. You can get the required information by running transaction SM51 in the target system. on which you should enter the name of the new destination. Enter a description. There you will see a list of all the instances in the target system. 1. password). Test your RFC destination by choosing "Connection Test” or “Remote Logon”.System number for the instance (for example. Choose &UHDWH. 17) This example would therefore be displayed as follows: hs0330_ABC_17. Choose (QWHU to continue.6ROXWLRQV 8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 5HPRWH 'HVWLQDWLRQ • Creating a logical destination for RFC communication with another R/3 system. client. enter  as the connection type (Æ the target system is an R/3 system). In the next step. You must now enter the RFC logon data ( language. 4.System ID (for example. The instance ID consists of the: . 3. In the "Connection Type” field. and save the destination. Call transaction 60. 5. hs0330) . A screen appears.Name of the host on which the instance is running (for example. and make the appropriate settings according to the result. 2. © SAP AG BC415 3-83 . ABC) . you must specify an R/3 application server for the target system by entering the relevant host name and the R/3 system number. 6.

sysid COLOR 5. CALL FUNCTION ’BC415_RFC_READ_SPFLI’ DESTINATION dest EXPORTING carrid = icarr connid = iconn IMPORTING ex_spfli = wa_spfli sys = sysid EXCEPTIONS invalid_data = 1 communication_failure = 2 MESSAGE mess system_failure MESSAGE mess. = 3 CASE sy-subrc. PARAMETERS: icarr TYPE sflight-carrid DEFAULT ’LH’. START-OF-SELECTION. mess(80). WRITE: / text-004. LIKE sy-sysid. dest TYPE rfcdes-rfcdest DEFAULT ’NONE’.8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 6\QFKURQRXV 5)& • Calling an RFC function module synchronously. DATA: wa_spfli sysid TYPE spfli. © SAP AG BC415 3-84 . iconn TYPE sflight-connid DEFAULT ’0400’. WHEN 0. with data transfer. 6RXUFH WH[W RI WKH VROXWLRQ SURJUDP REPORT sapbc415_rfcsync_s1 MESSAGE-ID bc415.

wa_spfli-cityto. wa_spfli-connid. WRITE / mess. ENDCASE. WRITE: wa_spfli-carrid. WHEN 1. WRITE / mess. © SAP AG BC415 3-85 . WHEN 2. WRITE / text-001. WHEN 3.SKIP. wa_spfli-cityfrom.

© SAP AG BC415 3-86 .

8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF $V\QFKURQRXV 5)& • Calling an RFC function module asynchronously with data transfer. LIKE sy-sysid. dest TYPE rfcdes-rfcdest DEFAULT ’NONE’. retcode LIKE sy-subrc. PARAMETERS: icarr TYPE sflight-carrid DEFAULT ’LH’. © SAP AG = 3 BC415 3-87 . flag. mess(80). 6RXUFH WH[W RI WKH VROXWLRQ SURJUDP REPORT sapbc415_rfcasync_s1 MESSAGE-ID bc415. DATA: wa_spfli sysid TYPE spfli. START-OF-SELECTION. iconn TYPE sflight-connid DEFAULT ’0400’. CALL FUNCTION ’BC415_RFC_READ_SPFLI’ DESTINATION dest STARTING NEW TASK ’T1’ PERFORMING back ON END OF TASK EXPORTING carrid = icarr connid = iconn EXCEPTIONS communication_failure = 2 MESSAGE mess system_failure MESSAGE mess.

WHEN 3.CASE sy-subrc. WHEN 2 OR 3. WAIT UNTIL flag IS NOT INITIAL. wa_spfli-cityto. ENDCASE. WHEN 1. © SAP AG BC415 3-88 . / text-002. wa_spfli-connid. ENDCASE. WRITE: / mess. wa_spfli-cityfrom. WHEN 2. WRITE: / text-001. WHEN 0. WRITE: wa_spfli-carrid. EXIT. EXIT. WRITE: / mess. WRITE mess. SKIP. WRITE: / text-004. sysid COLOR 5. CASE retcode.

ENDFORM.*---------------------------------------------------------------------* * FORM BACK * *---------------------------------------------------------------------* * --> T * *---------------------------------------------------------------------* FORM back USING t. = 3 retcode = sy-subrc. RECEIVE RESULTS FROM FUNCTION ’BC415_RFC_READ_SPFLI’ IMPORTING ex_spfli = wa_spfli sys = sysid EXCEPTIONS invalid_data = 1 communication_failure = 2 message mess system_failure message mess. © SAP AG "BACK BC415 3-89 . flag = ’X’.

© SAP AG BC415 3-90 .

6FUHHQ  )ORZ /RJLF.8QLW 5HPRWH )XQFWLRQ &DOO 7RSLF 7UDQVDFWLRQDO 5)& • Making identical changes to a customer’s telephone number in two R/3 systems using transactional RFC.

MODULE set_values. MESSAGE a514 WITH scustom-id. PROCESS BEFORE OUTPUT. CASE okcode. ENDIF. ELSE. MESSAGE i515. CALL FUNCTION ’BC415_TRFC_CHANGE_SCUSTOM_ENTR’ IN BACKGROUND TASK DESTINATION destination EXPORTING customer_id © SAP AG = scustom-id BC415 3-91 . IF sy-subrc <> 0. 0RGXO XVHUBFRPPDQGB MODULE user_command_0200 INPUT. PROCESS AFTER INPUT. CALL FUNCTION ’BC415_TRFC_CHANGE_SCUSTOM_ENTR’ EXPORTING customer_id = scustom-id i_telephone = scustom-telephone EXCEPTIONS no_data_found = 1. MODULE user_command_0200. MODULE status_0200. WHEN ’SAVE’.

MESSAGE i517 WITH time. COMMIT WORK. LEAVE TO SCREEN 100. CALL FUNCTION ’START_OF_BACKGROUNDTASK’ EXPORTING startdate = starttime. WHEN ’SM58’. WHEN ’BACK’. CALL TRANSACTION ’SM58’.i_telephone = scustom-telephone.. LEAVE PROGRAM. WHEN ’END’.= sy-datum time. © SAP AG " user_command_0200 BC415 INPUT 3-92 . WHEN ’CANC’. ENDCASE. LEAVE TO SCREEN 100. ENDMODULE.

2YHUYLHZ z 8VLQJ WKH %$3.QWHUIDFH z %$3.V LQ 2WKHU 5 6\VWHPV © SAP AG 2002 © SAP AG BC415 4-1 .V z &DOOLQJ %$3.  %XVLQHVV $SSOLFDWLRQ 3URJUDPPLQJ .%$3. ([SORUHU WR 6HDUFK )RU DQG 'LVSOD\ %$3.

/HDUQLQJ 2EMHFWLYHV z 2YHUYLHZ RI EXVLQHVV REMHFWV EXVLQHVV REMHFW UHSRVLWRU\ %25.

 DQG WKH DUFKLWHFWXUH RI %$3.V z 8VLQJ WKH %$3.V LQ RWKHU 5 V\VWHPV © SAP AG 2006 © SAP AG BC415 4-2 .V z &DOOLQJ %$3. ([SORUHU WR VHDUFK IRU DQG GLVSOD\ %$3.

%XVLQHVV 2EMHFWV LQ WKH %25   %XVLQHVV 2EMHFWV      !  ¥    ' ©  % $ C   ¥ 0  % A 2EMHFWRULHQWHG YLHZ RI 5 DSSOLFDWLRQ GDWD ¡  © § ¥ £ ¡ ¥ § 0 §  5 $SSOLFDWLRQ GDWD 0HWKRGV IRU GLVSOD\LQJFKDQJLQJ DSSOLFDWLRQ GDWD $GPLQLVWUDWLRQ LQ WKH %XVLQHVV 2EMHFW 5HSRVLWRU\ %25.

  § % (      £ §  3     B ¥ 6  A @  0 ¡  © § 6 6 5 %XVLQHVV 2EMHFW 5HSRVLWRU\ © SAP AG 2006 SAP business objects provide an object-oriented view of business data and processes in the R/3 System. and technical objects in a hierarchical display corresponding to the component hierarchy in the R/3 system. E E © SAP AG BC415 4-3 . organizational objects. The Business Object Repository (BOR) manages business objects.

QFUHDVH VDODU\ 0HWKRGV z 1DPH z $GGUHVV $WWULEXWHV 6DOHV 2UGHU z 'LVSOD\ z /RFN © SAP AG 2006 You can use the methods of a business object to display or change its attributes.([DPSOHV RI %XVLQHVV 2EMHFWV (PSOR\HHV z &XVWRPHU z 'DWH z 6DODU\ z . - © SAP AG BC415 4-4 .WHP OLVW z &KDQJH DGGUHVV z &UHDWH z .

..Links to change documents for the underlying database fields .(YHQWV: To be used in workflow definitions. .QWHUIDFHV . or pointers to other objects (object references). To trigger an event. values that are calculated at runtime (virtual attributes). methods.Calling the function module SWE_EVENT_CREATE - © SAP AG BC415 4-5 . . and events. see the online documentation on workflow definition): .Links to the status administration .QWHUIDFHV: List of interfaces from which the object type adopts attributes. transport data. Usually the key fields of the underlying database tables. BAPIs are known as API methods. release level. use the following links (for details.Links to message control .&RPSRQHQWV RI DQ 2EMHFW 7\SH 2EMHFW W\SH 3URJUDP %DVLF GDWD .%DVLF GDWD: Technical details such as an internal ID. PHWKRGV 7UDQVDFWLRQ )XQFWLRQ PRGXOH 5HSRUW © SAP AG 2002 Components of an object type in the BOR . . The events are only defined in the BOR. or other ABAP code.0HWKRGV: Calls to R/3 transactions. . and so on.QWHUIDFHV )LHOG UHIHUHQFHV 9LUWXDO DWWULEXWHV . Object references are particularly useful in Workflow definitions. These are either values from database fields (field references).H\ ILHOGV Attributes that uniquely identify an object of this type.H\ ILHOGV $WWULEXWHV 0HWKRGV (YHQWV 2EMHFW UHIHUHQFHV 5HODWLRQVKLS DWWULEXWH $%$3 FRGH 6\QFKURQRXV $V\QFKURQRXV $3.$WWULEXWHV: Object type attributes. allowing you to navigate easily between objects that belong together in a particular business context. . function modules.

Querying the attributes of an object . - © SAP AG BC415 4-6 .:KDW LV D %$3. - BAPIs can perform various functions such as: .PSOHPHQWHG DV D VSHFLDO UHPRWHHQDEOHG PHWKRG RI EXVLQHVV REMHFWV LQ WKH %XVLQHVV 2EMHFW 5HSRVLWRU\ %$3. © SAP AG 2002 BAPIs are special.Creating an object .QWHUIDFH z :HOOGHILQHG LQWHUIDFH IRU 5 GDWD DQG SURFHVVHV z . they are implemented as RFC-enabled function modules." %XVLQHVV $SSOLFDWLRQ 3URJUDPPLQJ .Changing the attributes of an object BAPIs are interfaces to R/3 data. remote-enabled methods of a business object.

%$3.V  8VHV 5 VDWHOOLWH V\VWHPV  GLVWULEXWHG VFHQDULRV $/(.

VisualBasic / JAVA / C++ : External clients (for example. . 1 6 5 3 1 / . 9 8 7 7 . %XVLQHVV :RUNIORZ 9LVXDO%DVLF-$9$ 1 1 1 6 5 3 1 / 5 6 5 8 . © SAP AG BC415 4-7 . alternative GUIs) access R/3 data and processes through BAPIs. . For example: - .Building R/3 components: Communication between the business objects from different R/3 components (applications). 8 7 © SAP AG 2002 6SHFLDO GHYHORSPHQWV E\ FXVWRPHUV RU SDUWQHUV 5 &RPSRQHQW VHWXS You can use BAPIs for different applications. < < 9 8 5 6 5 8 .QWHUQHW . / 9 .QWUDQHW 1 < 5 1 6 6 5 5 8 3 1 .Internet application components: Where individual R/3 functions are implemented on the Internet or intranet for users with no R/3 experience. .

V FDQ EH XVHG ERWK ZLWKLQ WKH 6$3 5 6\VWHP DQG H[WHUQDOO\ B z 'R QRW KDYH D SUHVHQWDWLRQ OD\HU 7KH FDOOHU LV UHVSRQVLEOH IRU WKH H[WHUQDO YLVXDOL]DWLRQ RI WKH UHVXOWV B z 6XFFHVV DQG HUURU FRQILUPDWLRQ WKURXJK H[SRUW SDUDPHWHU 5(7851 6WUXFWXUH RU WDEOH DFFRUGLQJ WR HDFK %$3. $WWULEXWHV z 2EMHFWRULHQWHG .PSOHPHQWHG DV REMHFW PHWKRGV IURP WKH %25 B z 6WDEOH LQWHUIDFH 7KH LQWHUIDFH RI D %$3.%$3. FDQQRW EH FKDQJHG B z &DQ EH XVHG LQWHUQDOO\ DQG H[WHUQDOO\ %$3.

which are themselves an instance in the client. or only the TYPE field has the value 6. - © SAP AG BC415 4-8 . B © SAP AG 2002 You can access BAPIs from external clients like methods access objects. ID (message class) . and. Refer to the online documentation to find out which applies to the BAPI you are using. has one of these dictionary structures: BAPIRETURN. This makes it easier for customers and partners to add to the functions offered by the R/3 System. NUMBER (message number) . - SAP guarantees that no incompatible changes will be made to the interfaces of BAPIs. I(nformation) ) . depending on the SAP R/3 release. - Displaying data that is transmitted to a BAPI or that is returned from a BAPI must be done from the calling program. MESSAGE_V4 (message variables) If the transmission is successful. MESSAGE_V2. RETURN is either completely empty (all the fields have their initial fields for their types). These structures commonly comprise the following relevant fields: TYPE (message type: S(uccess). W(arning). MESSAGE_V1. BAPIRET2 or BAPIRET2_FIX. BAPIRETURN1. BAPIRET1. - The return parameter RETURN contains success or error messages for the BAPI. MESSAGE_V3. E(rror). MESSAGE (message text) . - You can also use BAPIs within the R/3 System to access business data.

LQ WKH %$3. In BAPIs containing database updates. RU 52//%$&. Closing or rejecting a BAPI LUW occurs by calling a special BAPI from the service object BapiService (object type SAP0001). a COMMIT WORK or ROLLBACK WORK is not used. BAPI 7UDQVDFWLRQ&RPPLW (relevant function module BAPI_TRANSACTION_COMMIT) BAPI 7UDQVDFWLRQ5ROOEDFN (relevant function module BAPI_TRANSACTION_ROLLBACK) - © SAP AG BC415 4-9 . FDOO 6HUYLFH REMHFW %DSL6HUYLFH %$3. :25./8: LV FORVHG RU UHMHFWHG E\ FRUUHVSRQGLQJ %$3.V z 'DWDEDVH XSGDWHV LQ %$3. The update type (synchronous or asynchronous) is specified when you call the commit BAPIs. DOZD\V WKURXJK XSGDWH WDVN z 1R &200. z %$3. 7UDQVDFWLRQ5ROOEDFN © SAP AG 2002 Database updates in BAPIs are always performed by an update task. 7UDQVDFWLRQ&RPPLW %$3.7 :25.'DWDEDVH 8SGDWHV 7KURXJK %$3.

([SORUHU 6WDQGDUG %$3.6WDQGDUG %$3.V z *HW/LVW 5HWXUQV WKH FRQWHQWV RI WKH REMHFW V NH\ ILHOGV B z *HW'HWDLO 5HWXUQV LQIRUPDWLRQ DWWULEXWHV.V DQG %$3.

([SORUHU 7UDQVDFWLRQ %$3. RQ WKH REMHFW FRQFHUQHG B z &UHDWH)URP'DWD *HQHUDWHV D QHZ REMHFW LQ WKH 5 6\VWHP DQG UHWXUQV LQIRUPDWLRQ DERXW LW B %$3.

you can use additional BAPIs (for example. CheckPassword for the business object &XVWRPHU. - Depending on the object. z 'LVSOD\ RI DOO EXVLQHVV REMHFWV ZLWK %$3.V JURXSHG E\ DSSOLFDWLRQ © SAP AG 2002 The above BAPIs exist for many business objects.

- There is an example of how to create your own BAPIs in the appendix. refer to the BAPI Explorer in the "Project” tab page. - © SAP AG BC415 4-10 . - The BAPI Explorer (transaction BAPI) displays all business objects with BAPIs. grouped by application. For more detailed information and guidelines on BAPI programming.

B.V IURP ([WHUQDO 6\VWHPV 5 ([WHUQDO V\VWHP 9LVXDO %DVLF & %XVLQHVV REMHFW UHSRVLWRU\ -$9$ $SSOLFDWLRQ GHYHORSPHQW %$3. OD\HU 5XQ WLPH %$3.$FFHVVLQJ %$3. GHILQLWLRQV %XVLQHVV REMHFW .V  0 0 )XQFWLRQ PRGXOHV /LEUDU\ %$3.<= %$3.<=B0 %$3. FDOO 5)&. OD\HU %$3.

<=B0 © SAP AG 2002 The programmer needs to know which business objects are available with which BAPIs. - © SAP AG BC415 4-11 . %$3. C++. - SAP delivers libraries for BAPI calls for various development environments (Visual Basic.B. enabling developers to call a BAPI from outside the system without having to worry about how BAPIs are actually implemented in the system. and Java from the training courses CA925. - The BAPI Browser is a logical view of the BOR in which only those objects that have BAPIs are displayed. The complete interface of each BAPI is displayed. and what the interface looks like. These libraries include the technical details of the communication. Java). CA926. C++. You can get more information on using BAPIs with Visual Basic. and CA927.

<= 352*5$0    '$7$ 0<B5(7851 /. MESSAGE_V1. - © SAP AG BC415 4-12 . SAP is planning a later release where all BOR business objects will be integrated in the class library of ABAP so that you will be able to access BAPIs object-oriented from ABAP using ABAP-OO. Refer to the documentation to find out which applies to the BAPI you are using.(  %$3.21 $%& (.216  © SAP AG 2002 Currently. depending on the SAP R/3 release. BAPIRETURN1.B. RETURN is either completely empty (all the fields have their initial fields for their types). or only the TYPE field has the value 6.21 %$3. W(arning).1*  . MESSAGE_V4 (message variables) If the transmission is successful. E(rror). - The naming convention for BAPI function modules is: BAPI_<business_object>_<method> - There are no exceptions for BAPI function modules..B.<=B0 0<B5(7851 (.03257.B.$FFHVVLQJ %$3.V  0 0 &$// )81&7. MESSAGE_V3.&(37.<=B0 %$3.<=B0 '(67. MESSAGE_V2. has one of these dictionary structures: BAPIRETURN.V IURP $%$3 5 %XVLQHVV REMHFW UHSRVLWRU\ $%$3 SURJUDP %XVLQHVV REMHFW . Success or error messages are returned by the RETURN export parameter. I(nformation) ) . NUMBER (message number). which. MESSAGE (message text) .1*  5(7851 'LUHFW 5)& )XQFWLRQ PRGXOHV %$3. BAPIRET2 or BAPIRET2_FIX.3257. you can only access BAPIs from an ABAP program using the relevant direct function call (local or remote). These structures commonly comprise the following relevant fields: TYPE (message type: S(uccess).1$7. BAPIRET1. ID (message class).

8QLW 6XPPDU\ z %$3.V ZLWK REMHFWRULHQWHG SURJUDPPLQJ RQO\ IURP H[WHUQDO V\VWHPV 9LVXDO %DVLF & -DYD.V DUH UHPRWHHQDEOHG PHWKRGV IRU REMHFWV LQ WKH %25 ZLWK DQ LQWHUIDFH WKDW FDQQRW EH FKDQJHG z <RX FDQ FXUUHQWO\ DFFHVV %$3.

FDOO FDQ EH XVHG IURP $%$3 DV D GLUHFW UHPRWH. 7KH %$3.

V GR QRW FRQWDLQ &200. RU 52//%$&.V z 8VLQJ WKH %$3.V DOZD\V UXQ GDWDEDVH XSGDWHV WKURXJK XSGDWH WDVNV 6LQFH %$3.V JURXSHG E\ DSSOLFDWLRQ © SAP AG 2002 © SAP AG BC415 4-13 . ([SORUHU \RX FDQ GLVSOD\ %$3. :25. IXQFWLRQ FDOO RQO\ z %$3.7 :25. \RX FDQ FORVH RU UHMHFW DQ /8: RQO\ E\ FDOOLQJ VSHFLILF %$3.

© SAP AG BC415 4-14 .

V  )LQGLQJ 'LVSOD\LQJ 7HVWLQJ &DOOLQJ 1-1 Find the business object )OLJKW&RQQHFWLRQ in V\VWHP %. In this case. © SAP AG BC415 4-15 . 1-2-1 To create the coding for the function module call. output the contents of the internal table (required flights) returned by the BAPI. If an RFC communication error (6<68%5& 1( ) or a BAPI error (5(78517<3( 1( 6 ) has occurred. create in V\VWHP % a dummy program with any name. and use the editor function WHPSODWH for &$// )81&7. 1-2 Call the BAPI from V\VWHP $. output the relevant error message.21 with the corresponding function module.([HUFLVHV 8QLW %$3. Copy the coding you created to the Clipboard so you can enter it in the ABAP Editor of system A. 1-2-2 In V\VWHP $ create a QHZ =%&B B%$3.  %XVLQHVV $SSOLFDWLRQ 3URJUDPPLQJ . display them. program. 1-1-1 Which BAPIs does the business object contain? 1-1-2 Which BAPI do you use to get a list of flights? 1-1-3 Which function module is behind this BAPI? 1-1-4 Test the BAPI in the test environment. After a successful call (SY-SUBRC = 0)the field TYPE of the RETURN structure has the value “S”. Get all the flights from FRANKFURT (DE) to NEW YORK (US) from the remote BAPI. and call them from a remote R/3 System. %$3. test them locally.QWHUIDFH 7RSLF )LQGLQJ 'LVSOD\LQJ 7HVWLQJ DQG &DOOLQJ %$3. Insert the function module call from the Clipboard and supplement it with additions and the necessary parameter values for an sRFC in system B.V • Searching for a BAPI in the BAPI Explorer • Displaying and tesing a BAPI • Calling a BAPI from ABAP You want to find existing BAPIs for a specific R/3 component.

© SAP AG BC415 4-16 .

B6)/. Test.67 ABAP program with remote BAPI call: see following pages © SAP AG BC415 4-17 . and Call BAPIs • Searching for a BAPI in the BAPI Explorer • Displaying and testing a BAPI • Calling a BAPI from ABAP BAPI you searched for to list flights: *HW/LVW Function module belonging to BAPI: %$3.*+7B*(7/.Business Application Programming Interface Topic: Find. Display.6ROXWLRQV Unit: BAPI .

START-OF-SELECTION. CASE sy-subrc. WHEN 0. tocity TYPE bapisfdeta-cityto OBLIGATORY DEFAULT ’NEW YORK’. CALL FUNCTION ’BAPI_SFLIGHT_GETLIST’ DESTINATION dest EXPORTING fromcountrykey = fromcoun fromcity = fromcity tocountrykey = tocoun tocity = tocity airlinecarrier = carrier afternoon = afternon maxread = maxread IMPORTING return = return TABLES flightlist = flightlist EXCEPTIONS system_failure = 1 MESSAGE msg communication_failure = 2 MESSAGE msg OTHERS = 3. msg(80). dest TYPE rfcdes-rfcdest DEFAULT ’LH’. DEFAULT ’NONE’. © SAP AG BC415 4-18 . fromcity TYPE bapisfdeta-cityfrom OBLIGATORY DEFAULT ’FRANKFURT’. carrier TYPE bapisfdeta-carrid afternon TYPE bapi_aux-afternoon. tocoun TYPE bapisfdeta-countryto OBLIGATORY DEFAULT ’US’. DATA: flightlist TYPE TABLE OF bapisflist. maxread TYPE bapi_aux-maxread.REPORT sapbc415_bapi_s1 PARAMETERS: fromcoun TYPE bapisfdeta-countryfr OBLIGATORY DEFAULT ’DE’. flight LIKE LINE OF flightlist. return TYPE bapiret2.

LOOP AT flightlist INTO flight. msg. WRITE: / text-002. return-message. flight-airpfrom. flight-seatsocc. WRITE: / text-003. flight-deptime. WRITE: / text-001. WHEN OTHERS. ELSE. WRITE: / flight-carrid. flight-connid. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form PRINT_LIST *&---------------------------------------------------------------------* FORM print_list. WHEN 1 OR 2.IF return-type <> ’S’. PERFORM print_list. ENDIF. ENDCASE. flight-fldate. © SAP AG " PRINT_LIST BC415 4-19 . flight-seatsmax.

© SAP AG BC415 4-20 .

$SSHQGL[ 7KLV DSSHQGL[ FRQWDLQV DGGLWLRQDO LQIRUPDWLRQ ZKLFK LV QRW D GHILQLWH SDUW RI WKH VWDQGDUG FRXUVH <RXU LQVWUXFWRU PLJKW QRW KDYH HQRXJK WLPH WR FRYHU WKLV LQIRUPDWLRQ GXULQJ UHJXODU FODVV WLPH V © SAP AG 2002 © SAP AG BC415 5-1 .

& &RPPXQLFDWLRQ .QWHUIDFH 4$3.QWHUIDFH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4XHXH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4XHXH $SSOLFDWLRQ 3URJUDPPLQJ .0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 :HE 5)& :HE 5)& 7KH &3.& &RPPXQLFDWLRQ .QWHUIDFH 7KH &3.

QWHUIDFH 4$3. $SSOLFDWLRQ 3URJUDPPLQJ .

& DQG 4$3. ([HUFLVHV DQG 6ROXWLRQV IRU &3. :RUNVKRS © SAP AG 2002 © SAP AG BC415 5-2 . ([HUFLVHV DQG 6ROXWLRQV IRU &3. :RUNVKRS %$3. %$3.& DQG 4$3.

0DLQWDLQLQJ 5)& 6LGHLQIR 5 .%0.

& VLGHLQIR WDEOH .  5 0 KV 6$3 61$ JDWHZD\     © § ¥ £ ¡ 61$ VXEV\VWHP  /8 5 6\VWHP 7  B @ 8 7 6 5 6\VWHP ..3 JZKRVW a U ! ` 5 ( 3 2 0 ( & $ #  X f V e U S T © R H S S P I  c " R b &3.&20 . ! C KV   E F G 7&3.

. 'HVW /8 73 7B5 /8 7 6LGHLQIR WDEOH RI JZKRVW 5)& VLGHLQIR WDEOH 5)&' .

&20 HQWU\ '(67 /8 73 *:+267 *:6(59 3URWRFRO 7 KV VDSGS KV VDSJZ I 7B5 © SAP AG 2002 The architecture of an RFC connection originating from an IBM R/2 System is identical to that of a CPIC connection. you must create an RFC destination in the RFC side information table RFCD within the IBM R/2 System using transaction TM31. The specified XCOM entry is used to build the connection when using this RFCdestination. €  r i ‚ q v x ˆ w € v † t r „ q x p i h x ‚  7B 5 ORJRQ GDWD ‘ 'HVW . ’ ’ © SAP AG BC415 5-3 . You can choose any destination name you like. You must specify the R/3 logon data and the name of an existing XCOM entry as the communication parameters. For this type of communication.

0DLQWDLQLQJ 5)& 6LGHLQIR 5 6LHPHQV.

3 ! 5 6\VWHP .& VLGHLQIR WDEOH ..&20 . KV   JZKRVW 6LGHLQIR WDEOH RI JZKRVW '(67 /8 73 *:+267 *:6(59 3URWRFRO &3.  5 6LHPHQV KRVW       © § ¥ £ ¡ 6$3 *DWHZD\ 5 6\VWHP 7 7&3.

. 'HVW /8 73 7B5 7 KV VDSGS KV VDSJZ I 6$3 *DWHZD\ &RPP7\SH 7 + 5)& VLGHLQIR WDEOH 5)&' .

you must create an RFC destination in the RFC side information table RFCD in the Siemens R/2 System using transaction TM31. You can choose any destination name. The specified XCOM entry is used to build the connection when using this RFC destination. You must specify the R/3 logon data and the name of an existing XCOM entry as the communication parameters. For this type of communication. ’ ’ © SAP AG BC415 5-4 . 5 ORJRQ GDWD .&20 HQWU\ e i ˜ ( – 2 ™ d C h e ™ B 0 ˜ 3 2 C — C – • ( f 7B j 'HVW 7B5 © SAP AG 2002 The architecture of an RFC connection originating from a Siemens R/2 System is identical to that of a CPI-C connection.

QWHUIDFH 7KH &3. :RUNVKRS %$3. ([HUFLVHV 6ROXWLRQV IRU &3. :RUNVKRS © SAP AG 2002 © SAP AG BC415 5-5 .QWHUIDFH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.& DQG 4$3. $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.:HE 5)& 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 :HE 5)& :HE 5)& 7KH &3.& &RPPXQLFDWLRQ . ([HUFLVHV 6ROXWLRQV IRU &3.  %$3.& &RPPXQLFDWLRQ .& DQG 4$3.

17(51(7 ::: :HE %URZVHU )XQFWLRQ PRGXOH 5HSRUW :HE XVHU © SAP AG 2002 © SAP AG BC415 5-6 .6FHQDULR %XVLQHVV LQ WKH :RUOG :LGH :HE :HEVLGH DFFHVV WR 5 IXQFWLRQV 5 7UDQVDFWLRQ .

\ From the R/3 point of view. the ITS and HTTP servers form an intermediate layer between the application and presentation layers.)LYH7LHUHG &OLHQW6HUYHU $UFKLWHFWXUH 5HTXHVW .QWHUQHW %URZVHU +773 6HUYHU . \ \ © SAP AG BC415 5-7 .QWHUQHW 7UDQVDFWLRQ 6HUYHU 5 $SSO $SSO 6HUYHU 5 'DWDEDVH 6HUYHU 5HVSRQVH © SAP AG 2002 The Internet Transaction Server connects the three-tiered client/server architecture of R/3 with the twotiered HTTP client/server architecture. From the Internet user’s point of view. the ITS takes care of the interactive HTML pages (generated at runtime).

:HE 5)& $UFKLWHFWXUH m q t o A A k n s m q n o n +773 6HUYHU .76 +70/ 6HLWH .QSXW :HE5)& IXQFWLRQ PRGXOH s A A k .63$7&+B5(48(67 t n 85/ )XQFWLRQ PRGXOH 5 6HUYLFH )LOH 85/.QWHUQHW %URZVHU :::B'.

Returns an HTML page or a MIME object as the output . \ \ © SAP AG BC415 5-8 . © SAP AG 2002 WebRFC is the term used when you call special function modules in R/3 using the ITS.Permits read or write access to the R/3 database . The service function module WWW_DISPATCH_REQUEST is always called as the agent that executes the call.Cannot be used by Internet users SAP delivers important.Allows business objects to be called from WebRFC-enabled function modules . For more information. essential functions as WebRFC-enabled function modules. \ Attributes of WebRFC-enabled function modules include: \ . refer to training course BC440.

0/ 5)& 5)&HQDEOHG IXQFWLRQ PRGXOH 5)& © ¥  v ¥ © s b +773 .5)& 8VLQJ .0/ )LOHV 7KURXJK WKH %XVLQHVV &RQQHFWRU 5 5)& w +773 w c n .0/ 6$3 %XVLQHVV &RQQHFWRU 5)& 6HUYLFH )LOH 85/.

com/connectors).com). ’ On the SAP BC.sap. and an XML file is passed to the service. For information on the SAP BC. ’ You will find examples of such XML files used for calling a function in the SAP Interface Repository.sap. © SAP AG 2002 Use the SAP Business Connector to call an arbitrary RFC-enabled function module from the intranet or the Internet. The response of the function module is converted by the SAP BC into an XML file. More details are available in the training course BIT530 .QWURGXFWLRQ WR WKH 6$3 %XVLQHVV &RQQHFWRU. which is a collection of interfaces that can be viewed publicly (http://ifr. you can set up a service that points to an RFC-enabled function module. ’ ’ © SAP AG BC415 5-9 . the application data will be transmitted through the SAP BC from the file to the function module interface in the SAP System. ’ The SAP BC is a middleware technology developed by SAP and can be used by SAP customers free of charge. which is then returned to the caller. refer to the service marketplace (http://service. If you call the service from the Internet using the corresponding URL.

QWHUIDFH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.& DQG 4$3.& &RPPXQLFDWLRQ .  %$3.& &RPPXQLFDWLRQ .QWHUIDFH 7KH &3. :RUNVKRS © SAP AG 2002 © SAP AG BC415 5-10 .& &RPPXQLFDWLRQ .QWHUIDFH 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 :HE 5)& :HE 5)& 7KH &3.& DQG 4$3. $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.7KH &3. ([HUFLVHV 6ROXWLRQV IRU &3. :RUNVKRS %$3. ([HUFLVHV 6ROXWLRQV IRU &3.

QWHUIDFH 7RSLF 2EMHFWLYHV z .& FDOOV IRU FRPPXQLFDWLRQ  8QGHUVWDQGLQJ SDUWLFXODU DVSHFWV RI UHPRWHO\ FDOOLQJ DQ $%$3 SURJUDP z <RX ZLOO DOVR EHFRPH IDPLOLDU ZLWK WKH &3.& LQWHUIDFH z 7KLV LQFOXGHV  'HILQLQJ UHPRWH GHVWLQDWLRQV  8VLQJ WKH &3.Q WKLV FKDSWHU \RX ZLOO OHDUQ KRZ WR UXQ SURJUDPWR SURJUDP FRPPXQLFDWLRQ XVLQJ WKH &3.7KH &3.& &RPPXQLFDWLRQ .& WHVW HQYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-11 .

& LQ &RPPXQLFDWLRQV z &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ z 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-12 .QWURGXFWLRQ z 5HPRWH 'HVWLQDWLRQV z 8VLQJ &3.7RSLF 2YHUYLHZ z .

& LQ &RPPXQLFDWLRQV 8VLQJ &3.QWURGXFWLRQ .QWURGXFWLRQ .& LQ &RPPXQLFDWLRQV &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 'HYHORSPHQW DQG 7HVW (QYLURQPHQW 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-13 .QWURGXFWLRQ 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 8VLQJ &3..

& 7RSLF 2EMHFWLYHV z ..& DQG WKH FRQQHFWLRQ W\SHV © SAP AG 2002 © SAP AG BC415 5-14 .QWURGXFWLRQ WR &3.Q WKLV WRSLF \RX ZLOO OHDUQ DERXW WKH JHQHUDO IXQFWLRQV RI &3.

\ \ © SAP AG BC415 5-15 .$YDLODEOH &RQQHFWLRQ 7\SHV 5 &3. Communication using CPI-C is an interesting option whenever RFC is not available.& ([WHUQDO 6\VWHP 5 5 © SAP AG 2002 The SAP CPI-C interface allows ABAP programs in an R/3 or an R/2 System and external C programs to communicate with each other and exchange data.

&.'LUHFW &RPPXQLFDWLRQ 8VLQJ &3.& 3URJUDPWRSURJUDP FRPPXQLFDWLRQ &3.

\ \ © SAP AG BC415 5-16 . It consists of a set of calls with which two programs can communicate with each other. SAP supports the CPI-C interface for ABAP and C programs. 6\VWHP $ 6\VWHP % $FWLYH SURJUDP 3DVVLYH SURJUDP Start connection Accept connection Send data Receive and process data Receive confirmation Send confirmation Close connection Recognize end of connection and close © SAP AG 2002 CPI-C (Common Programming Interface for Communications) is a standardized program-to-program communication interface that was originally developed at IBM.

QWURGXFWLRQ .& LQ &RPPXQLFDWLRQV 8VLQJ &3.QWURGXFWLRQ 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 8VLQJ &3.& LQ &RPPXQLFDWLRQV &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 'HYHORSPHQW DQG 7HVW (QYLURQPHQW 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-17 .5HPRWH 'HVWLQDWLRQV .

& GHVWLQDWLRQ DOVR NQRZQ DV D V\PEROLF GHVWLQDWLRQ RU VLGH LQIRUPDWLRQ HQWU\.Q WKLV WRSLF \RX ZLOO OHDUQ KRZ WR 'HILQH WKH &3.8QLW 2EMHFWLYHV z .

WKDW LV UHTXLUHG WR FRQQHFW WR WKH SDUWQHU V\VWHP © SAP AG 2002 © SAP AG BC415 5-18 .

QIRUPDWLRQ (QWULHV.6\PEROLF 'HVWLQDWLRQV 6LGH .

73*0     © SAP AG 2002 To start communication with a partner using CPI-C. You maintain it using transaction SM54. \ For each remote partner you want to call. the active program has to have an entry in the side information table (sideinfo entry).&20. These sideinfo entries are also known as V\PEROLF GHVWLQDWLRQV. you must have a corresponding sideinfo entry. 6LGHLQIR 7DEOH LQ WKH 6RXUFH 6\VWHP 6\PEROLF GHVWLQDWLRQ &RPPXQLFDWLRQ SDUDPHWHU 7  .  (. The sideinfo table in the R/3 System is called 7. This entry contains all of the necessary communication parameters. \ \ © SAP AG BC415 5-19 .

&20 6\VWHP 7.55 KV KV 5 6\VWHP 7 ‰ ˆ ƒ ‚ €  ~ } | { z y … „ „ ƒ ‚ €  ~ } | { z y 6$3 *DWHZD\ … 5 6\VWHP 7 6$3 'LVSDWFKHU 6$3 *DWHZD\ 60 6LGHLQIR WDEOH 7.

you need an entry in the sideinfo table TXCOM in the active (source) system. the default current application server is used when the connection is set up.) /8 : Application server of the appropriate R/3 system (target system) 73 : TCP/IP service of the dispatcher of the passive R/3 System (target system) © SAP AG BC415 gateway of the 5-20 . Specifications in the sideinfo entry: \ \ 'HVW : Any logical name (name of the sideinfo entry) 3URW:’I ’ (protocol type for R/3-R/3 connection) *: KRVW: Host on which the requisite gateway is running *: 6HUYLFH : TCP/IP service for gateway to be used (If the two fields *: KRVt and *: VHUYLFH are not set with values. 'HVW 7B$ 7B% 7B& /8 KV KV KV 73 VDSGS VDSGS VDSGS 3URW I I I *: +RVW *: 6HUYLFH KV KV VDSJZ VDSJZ © SAP AG 2002 To start communication between two R/3 Systems.

%0.55 .

 Š /8.  Œ ‹ /8 Ž “” 6$3 61$ DWHZD\  7&3.3 ‘ 5 6\VWHP .

&20 6\VWHP 7. /8 .6$ 6LGHLQIR 7DEOH 7. • „ 7&3.3 ˆ 7 – 5 6\VWHP +RVW  KV ’ +RVW  KV z — 6LGHLQIR 7DEOH IRU *DWHZD\ '(67 /8 73 .

2 systems. SNA entries about the Logical Unit (LU) for the R/2 host (remotely called). you need an 61$ JDWHZD\ (SAP Gateway with SNA functions) on which. ˜ ˜ © SAP AG BC415 5-21 .&20 LQ WKH 5 6\VWHP. and an entry in the VLGHLQIR WDEOH RI WKH 61$ *DWHZD\. 'HVW /8 .2 product is installed and configured. The advantage of running the SNA gateway on the IBM host is that you can use existing TCP/IP and LU6. and the R/2 Taskhandler (TP = X1SA).2 software for the gateway on the host side. in addition to TCP/IP.&20 HQWU\: 'HVW : Name of sideinfo entry (must match name of corresponding gateway sideinfo entry) 3URW : C’ (Protocol type for R/3-R/2 connection) *: KRVW  *: VHUYLFH : Host and TCP/IP service of the SNA gateway /8 / 73: Not important 6LGHLQIR HQWU\ RI JDWHZD\ (see graphic) : Sideinfo on the gateway (see diagram): Contains the entry name (must match the corresponding TXCOM entry). 7. you need an entry in the sideinfo table 7. ˜ To connect from an R/3 System to an IBM R/2 System. a suitable LU6. (See online documentation for maintenance of gateway sideinfo table) You can also install the SNA gateway on the host side. 73 3URW *: +RVW *: 6HUYLFH & KV VDSJZ © SAP AG 2002 To communicate between an R/3 System and an IBM R/2 System. We recommend installing the SNA gateway as a dedicated standalone gateway that can be used by various R/3 application servers to communicate with SNA LU6.

55 6LHPHQV.

&20 6\VWHP 7. 6LHPHQV KRVW 7&3. — ‚ œ › ~ … Ÿ  ™ ~ › Ÿ š ‚ ž ™  } ™ z }   ‚ y 6LGHLQIR WDEOH 7.3 6$3 *DWHZD\ z 7 – 5 V\VWHP ˆ +RVW  KV 5 6\VWHP .

&20 HQWU\: 'HVW : Name of the DCAM or UTM application (SAP System) to be called by the gateway or name of the gateway side info entry.1] ) You may have to maintain a corresponding sideinfo entry for the host gateway. DCAM version 11. you need an entry in the sideinfo table TXCOM in the R/3 System. (Setting in host file SAPGW. 73 3URW *: +RVW *: 6HUYLFH & EVKRVW VDSJZ © SAP AG 2002 To communicate between an R/3 System and a Siemens R/2 System.) ˜ You can operate the host gateway with or without VLGHLQIR. To connect from an R/3 System to a Siemens R/2 System. parameter EVXVHBVLGHLQIR [0. Refer to the documentation for maintaining the gateway sideinfo table.RSPARAM. 7. you need an SAP gateway running on the Siemens host that can be addressed using TCP/IP. 3URW: C (Protocol type for R/3-R/2 connection) *: KRVW  *: VHUYLFH: Host name / TCP/IP service of the host gateway /8 / 73: Not important ˜ ˜ © SAP AG BC415 5-22 . 'HVW /8 . (TCP/IP functions on the host side are available starting with BS2000 version 10.

%0.5 .

.&20 .5 KV KV 5 6\VWHP 7 „ ƒ ‚ €  ~ } | { z 61$ 6XEV\VWHP y /8 „ ‘  Ž  Œ ‹ “” 5 6\VWHP . … ’ 6$3 61$ *DWHZD\ ˆ « § 6$3 *DWHZD\ … ª „ © ‰ ¨ ¬ § ¥ ¦ ~  ¤ ¡ ¥  ¥ ¤ £ ¢ › 6LGHLQIR WDEOH .

˜ Sideinfo entry in R/2 (table TXCOM) 'HVW : Any logical name (name of the sideinfo entry) /8 : Logical unit of the SNA gateway 73 : Name under which the program JZKRVW can be called on the SNA gateway through the specified logical unit 6LGHLQIR HQWU\ IRU JZKRVW RQ 61$ JDWHZD\: '(67 : Name of the sideinfo entry (must match TP value in XCOM) 3URWRFRO : I *:+267  *:6(59 : Host and TCP/IP service of the required SAP gateway /8 : Application server of the R/3 System 73 : TCP/IP service of the R/3 dispatcher You can also operate the SNA gateway on the host side. The advantage of running the SNA gateway on the IBM host is that you can use existing TCP/IP and LU6. ˜ © SAP AG BC415 5-23 .2 software for the gateway on the host side.&20 and an entry in the VLGHLQIR WDEOH RI WKH SURJUDP JZKRVW on the gateway. 7&3.3 JZKRVW 6LGHLQIR WDEOH RI JZKRVW 'HVW /8 73 7B5 /8 7 '(67 /8 73 *:+267 *:6(59 3URWRFRO 7 KV VDSGS KV VDSJZ I © SAP AG 2002 To start a connection from an IBM R/2 System to an R/3 System. you need an entry in WKH 5 VLGHLQIR WDEOH .

5 6LHPHQV.

3 6$3 *DWHZD\ 5 6\VWHP 7 … 5 6\VWHP ..5 KV 6LHPHQV KRVW „ „ ƒ ‚ €  ~ } | { z y 7&3. JZKRVW 6LGHLQIR WDEOH RI JZKRVW '(67 /8 73 *:+267 *:6(59 3URWRFRO 6LGHLQIR WDEOH .&20 .

you use the program JZKRVW on the host gateway. 'HVW 7B5 /8 73 7 7 KV VDSGS KV VDSJZ I 6$3 *DWHZD\ &RPP7\SH + © SAP AG 2002 For communication between Siemens R/2 and R/3. you need the host gateway that runs on the Siemens host. For this. To start a connection from a Siemens R/2 System to an R/3 System.&20) 'HVW : Any logical name (name of the sideinfo entry) /8 : Not important 73 : Name of the corresponding gwhost sideinfo entry &RPP7\SH : H 6LGHLQIR HQWU\ IRU JZKRVW RQ KRVW JDWHZD\: '(67 : Name of the sideinfo entry (must match TP value in XCOM) 3URWRFRO : I *:+267  *:6(59 : Host and TCP/IP service of the required SAP gateway /8 : Application server of the R/3 System 73 : TCP/IP service of the R/3 dispatcher © SAP AG BC415 5-24 . you need an entry in the sideinfo table of the R/2 System and one in the sideinfo table of gwhost. ˜ ˜ 6LGHLQIR HQWU\ LQ 5 WDEOH 7.

5  ([WHUQDO 6\VWHP +RVW  KV ([WHUQDO V\VWHP +RVW  KV & SURJUDP 6$3 *DWHZD\ 5 6\VWHP &XUUHQW IURQW HQG 7 z 6\VWHP 1R .

— & SURJUDP ­ ® ” ¯ 6LGHLQIR WDEOH 7.&20 6\VWHP 7.

:LQGRZV   :I:  . The UKRVW (remote shell authorization) on the remote machine must also have a corresponding entry. t79adm). (The program is called using its name). This user must have the correct start authorization. the SAP gateway must run on the same host as the external program the Windows NT remote shell function.R C only at current front end ˜ ˜ © SAP AG BC415 5-25 . ˜ 26  As with UNIX. You call an external program over the SAP gateway using the user that started the gateway (for example.. 'HVW /8 3*0B$ 3*0B% 3*0B) KV KV 73 3DWK QDPH! 3DWK QDPH! 3DWK QDPH! 3URW *: +RVW *: 6HUYLFH ( ( ) KV VDSJZ © SAP AG 2002 81. it is started by UHPRWH VKHOO from the gateway. The corresponding sideinfo table is maintained in the same way as the R/3 -> R/2 (IBM) communication scenario that you see in the online documentation. because of ˜ /8 6\VWHPV You can also reach external LU6. The user who started the SAP gateway must also exist on the host of the external program. but without user ID ˜ 17  As with OS/2.No CPI-C . you can call a Cobol program running in CICS using CPI-C from an R/3 System. If the SAP gateway does not run on the same host as the external program. For example.2 systems using the SAP SNA gateway.

8VLQJ &3.& LQ &RPPXQLFDWLRQV &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 'HYHORSPHQW DQG 7HVW (QYLURQPHQW 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-26 .& LQ &RPPXQLFDWLRQV 8VLQJ &3.QWURGXFWLRQ .& LQ &RPPXQLFDWLRQV .QWURGXFWLRQ 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 8VLQJ &3.

8VLQJ &3.& © SAP AG 2002 © SAP AG BC415 5-27 ..& z 8VH WKH FRPPDQGV IRU FRQYHUWLQJ $6&.& FRPPXQLFDWLRQ z .& LQ &RPPXQLFDWLRQV 7RSLF 2EMHFWLYHV $W WKH FRQFOXVLRQ RI WKLV WRSLF \RX ZLOO EH DEOH WR z /HDUQ WKH H[DFW SURFHVV IORZ RI D &3.PSOHPHQW FRPPXQLFDWLRQV LQ $%$3 XVLQJ &3. WR (%&'.GHQWLI\ WKH FRPPXQLFDWLRQ PHWKRGV \RX FDQ XVH DQG WKHLU DGYDQWDJHV DQG GLVDGYDQWDJHV z .

& &RPPXQLFDWLRQ 6\VWHP $ 6\VWHP % 6LGHLQIR 6LGHLQIR WDEOH WDEOH $FWLYH SURJUDP &OLHQW.3URFHVV )ORZ RI &3.

3DVVLYH SURJUDP 6HUYHU.

Once the passive program has accepted the communication. the transmitting buffer is physically transmitted along with permission to send (!) only when the sending side submits its next receive command. After being accepted by the target program. These parameters are then stored under a conversation ID (output of the CPI-C call) and are used when the connection is made.QLWLDOL]H FRPPXQLFDWLRQ 6WDUW FRQQHFWLRQ $FFHSW FRQQHFWLRQ 6HQG GDWD 5HFHLYH GDWD 5HFHLYH GDWD 6HQG GDWD &ORVH FRQQHFWLRQ 5HFHLYH GDWD © SAP AG 2002 The program that initiates the connection is called the active program or client. The program that is called is known as the passive program or server. In other words. . use a CPI-C call to read the necessary communication parameters from the corresponding sideinfo entry. that is. whereas the passive program must wait for data using a receive call. the active program may send data first. ˜ To start a CPI-C connection. only one side may send data at a time. the active program must initialize it. that is. the connection is available for data exchange. The connection may only be closed by the program that is currently permitted to send data (otherwise data may be lost). ˜ CPI-C is a semi-duplex communication method. The partner program waiting with the receive command then receives the corresponding return code (18). ˜ CPI-C transmission is asynchronous. ˜ ˜ © SAP AG BC415 5-28 .

3LQJ3RQJ &RPPXQLFDWLRQ 0HWKRG 6\VWHP % 6\VWHP $ 3URJUDP < 3URJUDP . a confirmation message is sent after each data record. With this method.       6HQG GDWD 5HFHLYH GDWD 5HFHLYH FRQILUPDWLRQ 6HQG FRQILUPDWLRQ 6HQG GDWD 5HFHLYH GDWD 5HFHLYH FRQILUPDWLRQ 6HQG FRQILUPDWLRQ 6HQG GDWD 5HFHLYH GDWD 5HFHLYH FRQILUPDWLRQ    6HQG FRQILUPDWLRQ    © SAP AG 2002 The term SLQJ SRQJ describes the communication method illustrated above. ˜ © SAP AG BC415 5-29 .

and only has to wait for one overall confirmation. or the receiving program crashes -> yielding return code 17). The PXOWLVHQG method. on the other hand. therefore. ˜ ˜ © SAP AG BC415 5-30 . you always know. and where you need to resume processing. PXOWLVHQG sends a series of data records before receiving a single confirmation at the end. However. whereas PXOWLVHQG uses a single asynchronous transmission. and whether they have been fully or partially processed. which have been processed. or not processed at all. also returns code 17. SLQJ SRQJ provides you with better control of your data. &RPSDULVRQ RI WKH WZR FRPPXQLFDWLRQ PHWKRGV The SLQJ SRQJ method involves more work because you are dealing with single records and individual confirmations. but does not know which records have been received.       6HQG GDWD 5HFHLYH GDWD 6HQG GDWD 5HFHLYH GDWD 6HQG GDWD 5HFHLYH GDWD 5HFHLYH FRQILUPDWLRQ    6HQG FRQILUPDWLRQ    © SAP AG 2002 In contrast to the SLQJSRQJ method. use the ping pong method where each data record contains the data for one transaction. You should. if you are using SLQJ SRQJ which records have arrived in the target system.0XOWLVHQG &RPPXQLFDWLRQ 0HWKRG 6\VWHP % 6\VWHP $ 3URJUDP < 3URJUDP . If the communication is interrupted (communication error.

&$7. their functions are the same as the corresponding ABAP calls.21 .21 $//2&$7( &20081.&$7. ˜ © SAP AG BC415 5-31 .21 &20081.&$7. CMSEND.&$7.21 6(1' &20081.&$7.21 $&&(37 &20081. CMACCP.21 &20081.21 5(&(. CMDEAL).&$7.$YDLODEOH &3.&$7.&$7.&$7.21 .9( Receive data '($//2&$7( Close connection External C programs use the same calls to communicate with ABAP programs using CPI-C.&$7.1.9( &20081.21 '($//2&$7( © SAP AG 2002 You can execute the steps explained for CPI-C using the CPI-C calls specified previously: ˜ &20081. CMRCV.7 Initialize connection $//2&$7( Make (allocate) connection $&&(37 Accept connection 6(1' Send data 5(&(.&$7.21 &20081.21 &20081.&$7. CMALLC.7 &20081. Although the syntax of the calls is different in C (CMINIT.21 &20081.1.& &DOOV LQ $%$3 &20081.

&') '$7$    .17 .& 5HWXUQ &RGHV $%$3 LQFOXGH 56&3.&3.

( .( .. ˜ In addition to the return code.17 9$/8(         © SAP AG 2002 The return code of a CPI-C call in ABAP is always placed in the SY-SUBRC field.17 9$/8(   &0B352*5$0B67$7(B&+(&. some CPI-C calls also return special parameters containing extra information about data transfer and which side is entitled to send data. 7<3( ..17 9$/8(   &0B3$5$0(7(5B(5525 /. it can also be placed in the RETURNCODE parameter of the CPI-C call itself.).17 9$/8(   &0B352'8&7B63(&.&').( ..( . These CPI-C constants are contained in the standard ABAP include 56&3.17 9$/8(   &0B'($//2&$7('B1250$/ /.  * return_code '$7$  &0B2.( . ˜ The return codes and return parameters of CPI-C calls are stored as hexadecimal code. For example. you should use meaningful constants instead of hexadecimal codes.. However. /.17 9$/8(      &0B'($//2&$7('B$%(1' /. instead of IF RC = 18 use IF RC = CM_DEALLOCATED_NORMAL to close the connection from the partner side. /..( .&B(5525 /. The most important return codes are: ˜ ˜ 0000 ( CM_OK ) Connection OK 0011 ( CM_DEALLOCATED_ABEND ) Connection terminated 0012 ( CM_DEALLOCATED_NORMAL ) Connection from partner terminated normally 0013 ( CM_PARAMETER_ERROR ) Invalid conversation ID in CPI-C call 0014 ( CM_PRODUCT_SPECIFIC_ERROR ) Invalid sideinfo entry in CMINIT call 0019 ( CM_PROGRAM_STATE_CHECK )Send command rejected due to missing transmission permission © SAP AG BC415 5-32 .. When you query the codes.

&$7.1$7..7 is used to initialize the CPI-C connection.1. ˜ The fields listed in the INIT call must have the following types: dest C8 convid C8 rc X2 Legend: Lowercase plus italics indicates ABAP field. at the same time.21 GHVW . This parameter is optional..' FRQYLG > 5(7851&2'( UF @     © SAP AG 2002 &20081. Underlined indicates entry variable. the name of the connection.21 . it can be used in additional fields.1$7.21 .' Conversation ID: This indicates the communication partners for the specified sideinfo entry. It is used until the next connection is made and is. ] indicates optional specification ˜ ˜ © SAP AG BC415 5-33 . [ .&$7.21Name of a sideinfo entry Output: .7 '(67.& &RQQHFWLRQ    &20081. (Preparing the connection) Entry: '(67.1. 5(7851&2'( Return code of the call is always stored in SY-SUBRC.QLWLDOL]LQJ D &3..

& &RQQHFWLRQ    &20081.' FRQYLG > 5(7851&2'( UF @     © SAP AG 2002 &20081. You must specify the conversation ID returned by the INIT call.&$7. ˜ © SAP AG BC415 5-34 .&$7.6WDUWLQJ D &3.21 $//2&$7( .21 $//2&$7( builds the CPI-C connection and the corresponding partner program is started.

& &RQQHFWLRQ &20081.' FRQYLG > 5(7851&2'( UF @     © SAP AG 2002 For a valid connection to be established. the called program must accept the connection using the &20081. After the ACCEPT call from the side that was called.&$7. the active program has the required transmission permission. The passive program must first receive data. This must be the first statement in the passive program.$FFHSWLQJ D &3.21 $&&(37 statement.&$7. ˜ ˜ © SAP AG BC415 5-35 .21 $&&(37 . The ACCEPT call returns the conversation ID of the connection and a return code.

you can transmit a data packet of up to 30000 bytes. ˜ © SAP AG BC415 5-36 .&$7. Output: RETURNCODE If a program sends data without having permission.6HQGLQJ 'DWD    &20081. the entire transmission buffer is sent. The field must be type P. Parameters: ˜ . the return code issued is 25 (hex 19).' FRQYLG %8))(5 VHQGEXI > /(1*7+    VHQGOHQ @ > 5(7851&2'( UF @  © SAP AG 2002 In the SEND command.).21 6(1' .' Conversation ID %8))(5 Transmission buffer (max 30000 bytes) /(1*7+ Length of the buffer you want to send (Optional: If entries are missing.

5(7851&2'( © SAP AG BC415 5-37 .21 5(&(.' FRQYLG %8))(5 UFYEXI > /(1*7+ UFYOHQ @ > 5(&(.1)2 Information on the transmission permission.' Conversation ID /HQJWK Use this parameter to specify which part of the specified receive buffer should be used. You would use this when using RECEIVE within a SELECT loop.5HFHLYLQJ 'DWD    &20081. (Optional. Output: %8))(5 Receiving buffer (contains data received) 5(&(.1)2 > +2/' @    UFYGOHQ @ GDWDLQIR VWDWXVLQIR > 5(7851&2'( UF @  © SAP AG 2002 Your own previous SEND packages that are still in the buffer due to the asynchronous SEND. This field must be type X4.9(' Number of character received. the system uses the whole receive buffer.9( . together with the transmission permission. Parameters: ˜ .1)2 67$786. This field must be type X4. This field must be type X4.&$7.) The field must be type P. +2/' This addition (without a field) causes the work process to be stopped (no rollout/rollin) while it waits from the RECEIVE.1)2 Information on whether the receive buffer was large enough for the incoming SEND packet. '$7$. if you do not specify a length. 67$786. are physically transmitted through the connection by the COMMUNICATION RECEIVE statement. The statement then waits for the data.9(' '$7$.

&') '$7$    .1)2 $%$3 LQFOXGH 56&3.9DOXHV RI '$7$.1)2 DQG 67$786.17 .

17 9$/8(   &0B6(1'B5(&(. STATUSINFO May have the following values: CM_NO_STATUS_RECEIVED --> No transmission permission received CM_SEND_RECEIVED --> Transmission permission received ˜ © SAP AG BC415 5-38 .9(' /.9(' /...9('    /.17 9$/8(   &0B&203/(7(B'$7$B5(&(. (In this case.1)2 specifies whether data has been received and whether the receive buffer (or section of the buffer) used was large enough to receive the entire SEND packet.. 7<3( ..17 9$/8(   © SAP AG 2002 The return parameter '$7$.( . DATAINFO can have the following values: ˜ CM_NO_DATA_RECEIVED --> No data received CM_COMPLETE_DATA_RECEIVED --> Data received and RECEIVE buffer is large enough CM_INCOMPLETE_DATA_RECEIVED --> Data received but RECEIVE buffer too small to receive entire SEND packet.9('    /..( .1)2 indicates whether transmission permission has also been received.17 9$/8(   &0B.17 9$/8(   * status_received '$7$  &0B12B67$786B5(&(.( .1&203/(7(B'$7$B5(&(.  * data_received '$7$  &0B12B'$7$B5(&(.( .( . until DATAINFO has the value CM_COMPLETE_DATA_RECEIVED.9(' /.) The return parameter 67$786. the remaining segments must be transmitted as long as there are other RECEIVEs to be received.

˜ ˜ © SAP AG BC415 5-39 . Any data in the local buffer that has not yet been sent is transmitted first and then the connection is closed.21 '($//2&$7( .&ORVLQJ D &3.&$7. otherwise.& &RQQHFWLRQ    &20081. any data that has not yet been received is lost. The connection should always be closed by the program that has transmission permission.' FRQYLG > 5(7851&2'( UF @     © SAP AG 2002 You use this call to close the CPI-C connection.

you use the following ABAP command 75$16/$7( ILHOG! )520 &2'( 3$*(    72 &2'( 3$*(    This command lets you convert character strings between different code pages. 81. 096 096 17 17 96( 96(    %6 %6 &RQYHUVLRQ FRPPDQG LQ $%$3 75$16/$7( ILHOG )520 &2'( 3$*(  72 &2'( 3$*(   © SAP AG 2002 Data conversion is necessary when two systems that use different character sets communicate with each other..&RQYHUWLQJ 'DWD (%&'..& $6&. You can display and/or maintain the codepages in R/3 using transaction 63$'.. The contents of the field you specify is converted from the source code page representation to the target code representation. ˜ To convert the character sets. 5 5 5 5 81. ˜ ˜ © SAP AG BC415 5-40 .

& LQ &RPPXQLFDWLRQV &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 'HYHORSPHQW DQG 7HVW (QYLURQPHQW 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-41 .QWURGXFWLRQ 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 8VLQJ &3.QWURGXFWLRQ .&DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ .& LQ &RPPXQLFDWLRQV 8VLQJ &3.

&DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 7RSLF 2EMHFWLYHV z $W WKH FRQFOXVWLRQ RI WKLV WRSLF \RX ZLOO EH DEOH WR FDOO D SDVVLYH $%$3 SURJUDP UHPRWHO\ © SAP AG 2002 © SAP AG BC415 5-42 .

&DOOLQJ DQ $%$3 3URJUDP 8VLQJ &3.& SURJUDP 5 5 $%$3 &.& 5 5 H[WHUQDO V\VWHP $FWLYH &3.

& SURJUDP $%$3 URXWLQH. 6$3 %DVLV V\VWHP 3DVVLYH &3.

called using X1SA. You cannot communicate with them directly. © SAP AG 2002 You can call ABAP programs (or more precisely. In the R/2 System. The connection must be made through the SAP Basis System of the passive program. In the SAP R/3 System. ABAP form routines) in an R/2 or an R/3 System remotely using CPI-C. ˜ ˜ © SAP AG BC415 5-43 . the SAP Basis System is the task handler. however. you address the dispatcher using sapdp##.

3URFHGXUH LQ WKH $FWLYH 3URJUDP  .1.7.QLWLDOL]H FRQQHFWLRQ ZLWK UHPRWH V\VWHP .

 (VWDEOLVK FRQQHFWLRQ ZLWK UHPRWH V\VWHP $//2&$7(.

 6HQG FRQQHFW VWULQJ WR UHPRWH V\VWHP 6(1'.

 :DLW IRU UHVSRQVH IURP UHPRWH V\VWHP 5(&(.9(.

 :LWK DIILUPDWLYH DQVZHU FRPPXQLFDWH ZLWK UHPRWH DQVZHU $%$3 URXWLQH VHQG SHUPLVVLRQ RQ DFWLYH VLGH.

VLGH.

.

˜ © SAP AG BC415 5-44 .  &RQWDLQV 6$3 ORJRQ GDWD IRU WKH UHPRWH V\VWHP DQG V\VWHP WKH QDPH RI WKH UHPRWH $%$3 URXWLQH  0XVW DOZD\V EH VHQW LQ (%&'. regardless of whether the active program is an ABAP program in an R/2 or an R/3 System. or a C program in an external system.& © SAP AG 2002 The above procedure for calling a remote ABAP routine is the same.

enter a XVHU ZLWK W\SH &3. The name of this main program can have a maximum of 8 characters. The form routine that you enter in the 02'1 field must exist within the specified main program. enter the main program of the remote routine. By defining a structure using the latter and setting the fields with suitable values. ˜ In the 1$0( field. ˜ In the 352* field.& that is already defined in the relevant client of the remote system. If you are programming in C. you create your own connect string. use the call SAP_CMLOGON to create a connect string in EBCDIC. ˜ The one-character language key is converted into the corresponding two-character key by the remote Basis system.7KH &RQQHFW 6WULQJ 'LFWLRQDU\ VWUXFWXUH &3.// 0$1' 1$0( &2'( /$1* &255 352* 02'1 7\SH /HQJWK & & & & & & & & & & & & 9DOXH &211 &3.&   1RW LPSRUWDQW !  1RW LPSRUWDQW !  FKDUDFWHU FOLHQW !  6$3 XVHU !  3DVVZRUG !  /RJRQ ODQJXDJH !  1RW LPSRUWDQW !  $%$3 SURJUDP !  )RUP URXWLQH !             © SAP AG 2002 The valid format for a connect string is contained in the ABAP Dictionary structure CPICCONN. ˜ ˜ © SAP AG BC415 5-45 .02'( ). This must be made known to the remote system. ˜ All of the values in a connect string must be entered in uppercase.&&211 )LHOG 5(4. The syntax must be correct.' 5(47<3( $02'( .

If the checks fail.&  5HWXUQ FRGH 8VHU QRW SHUPLWWHG  © SAP AG 2002 If the remote Basis system’s check on the connect string is positive (valid logon data. ° ° © SAP AG BC415 5-46 . As of this point. The data format is completely open. main program and form routine are syntactically correct and exist in the target system).&  5HWXUQ FRGH    7UDQVPLVVLRQ SHUPLVVLRQ 1HJDWLYH &RQILUPDWLRQ 0HVVDJH )5((  &3. the active program receives the 12byte EBCDIC string APPCCPIC1 with return code 0 and the transmission permission. the remote Basis system sends a corresponding error message with the 12-byte header FREECPIC1 in EBCDIC and terminates the connection.&RQILUPDWLRQ 0HVVDJHV IURP WKH 5HPRWH %DVLV 6\VWHP 3RVLWLYH &RQILUPDWLRQ 0HVVDJH $33& &3. the system can communicate directly with the called ABAP routine.

21 $//2&$7(    &20081.1&/8'( 56&3.&&211    &3.21 6(1'    &20081.&&2115(4.&&211352* ===  &3.<=  .&$7.) &20081.9(    6HQG DSSOLFDWLRQ GDWD 5HFHLYH DSSOLFDWLRQ GDWD © SAP AG 2002 The above coding example shows an active ABAP program that calls an ABAP form routine remotely in another SAP system (R/2 or R/3) using CPI-C.&$7.&') 7$%/(6 &3.&$7.21 .21 5(&(.&$7. ° © SAP AG BC415 5-47 ..7 (1'.&&21102'1 $%&  75$16/$7( &3.21 5(&(.) 5(7851&2'( 1( &0B2.$FWLYH $%$3 3URJUDP 5(3257 .&$7.&&211    &20081.&$7.1.21 6(1' %8))(5 &3.9( %8))(5 5&9%8)    .  (.' &211     &3.7    &20081.&&211 )520 &2'( 3$*(  72 &2'( 3$*(   &20081.

&$7.&')    )250 $%&  &20081.1&/8'( 56&3. only the subroutine specified in the connect string is executed.&$7.21 $&&(37    &20081. ° ° © SAP AG BC415 5-48 .21 5(&(.9(    5HFHLYH DSSOLFDWLRQ GDWD &20081.21 6(1'       6HQG DSSOLFDWLRQ GDWD (1')250  © SAP AG 2002 This coding example shows an ABAP program containing an ABAP routine that can be called remotely. However.$%$3 3URJUDP :LWK D 3DVVLYH 5RXWLQH 5(3257 ===  . The main program may contain more than one subroutine that can be called remotely.&$7.

'HYHORSPHQW DQG 7HVW (QYLURQPHQW .QWURGXFWLRQ 5HPRWH 'HVWLQDWLRQV 5HPRWH 'HVWLQDWLRQV 8VLQJ &3.QWURGXFWLRQ .& LQ &RPPXQLFDWLRQV 8VLQJ &3.& LQ &RPPXQLFDWLRQV &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ &DOOLQJ DQ $%$3 3URJUDP 5HPRWHO\ 'HYHORSPHQW DQG 7HVW (QYLURQPHQW 'HYHORSPHQW DQG 7HVW (QYLURQPHQW © SAP AG 2002 © SAP AG BC415 5-49 .

'HYHORSPHQW DQG 7HVW (QYLURQPHQW 7RSLF 2EMHFWLYHV $W WKH FRQFOXVLRQ RI WKLV WRSLF \RX ZLOO EH DEOH WR z 8VH WKH &3.& SURJUDPV DQG FRQQHFWLRQV XVLQJ WKH WRROV SURYLGHG © SAP AG 2002 © SAP AG BC415 5-50 .& WHVW SURJUDPV VXSSOLHG E\ 6$3 LQ WKH VWDQGDUG 5 6\VWHP z $QDO\]H &3.

7KH 6$3 &3.LW 6'.&6RIWZDUH 'HYHORSPHQW .

&$7.&$7.1.1.21 &20081.&$7. ([WHUQDO V\VWHP &0. $%$3 ODQJXDJH VFRSH 5 &20081.21 &20081.7  $//2&$7(  $&&(37  6(1'  5(&(.&6'.21 &20081.&$7.21 &20081.7 .21 .&$7.9(  '($//2&$7(  &3.&$7.21 &20081.

&0$//& .

&0$&&3 .

&06(1' .

&05&9 .

&0'($/ .

the CPI-C calls are contained in the language scope of ABAP. ° ° © SAP AG BC415 5-51 . For information on how to use the CPI-C calls.  6DPSOH SURJUDPV © SAP AG 2002 In R/3. However. refer to the text files and sample programs delivered with the SDK. on external platforms you must install the CPI-C library (CPI-C-SDK).

&7 FFSLFWW DFWLYH.&3.& 7HVW 3URJUDPV 5  5 ([WHUQDO V\VWHP $%$3 SURJUDPV & SURJUDPV $&3.

DFWLYH.

&7 FFSLFWW SDVVLYH. $&3.

SDVVLYH.

but.If test data should be converted from ASCII to EBCDIC (parameter &219(57 ).&7.&7.&7. When you run $&3.&7 is a passive CPI-C program.&7 (in R/2 as of release 5. © SAP AG 2002 The standard system contains the CPI-C test programs $&3. ccpict1 can call not only FFSLFWW remotely. . You can use this kit to develop CPI-C programs in C. you must also enter the logon data for the connect string on the selection screen of $&3.0G).&7 is an active CPI-C program. ° SAP also supplies the SAP CPI-C SDK (Software Development Kit) with every SAP R/3 System. $&3. You can use them to test R/3-R/3 and R/3-R/2 CPI-C connections. you must specify: . ° ° © SAP AG BC415 5-52 .&7 or FFSLFWW should be called remotely (parameter ’ABAP’) . Likewise. $&3.&7 can call the passive C program FFSLFWW.&7. above all.If $&3. but also the passive ABAP program $&3. The SDK contains the C programs FFSLFWW (active) and FFSLFWW (passive). You can use these programs to test connections between two external systems. to test connections between external systems and an R/3 System. If you call $&3.&7 and $&3. the active ABAP program $&3.

$QDO\VLV 7RROV $%$3 'HEXJJHU $%$3 'HEXJJHU *DWHZD\ 0RQLWRU 60*:.

*DWHZD\ 0RQLWRU 60*:.

6\VWHP /RJ 60.

6\VWHP /RJ 60.

° You can use the Gateway monitor (transaction SMGW) to monitor SAP Gateway activity (existing CPIC connections) and generate and display Gateway traces. This does not apply in R/2 since screen changes are not allowed in R/2 during a CPI-C connection (Debugging involves screen changes). You cannot analyze passive programs in the Debugger. ° ° © SAP AG BC415 5-53 . © SAP AG 2002 You can use the Debugger to analyze an active ABAP CPIC-C program in R/3. You can display the system log using transaction SM21. One of the tasks of the system log is to record failed CPI-C logons that have been sent from remote systems to the current system.

& &RPPXQLFDWLRQ .& LQWHUIDFH DOORZV SURJUDPV LQ 5 5 DQG H[WHUQDO V\VWHPV WR FRPPXQLFDWH DQG H[FKDQJH GDWD ZLWK RQH DQRWKHU z 7KH FRPPXQLFDWLRQ DOZD\V UXQV XVLQJ DQ 6$3 *DWHZD\ z 7R VWDUW D FRQQHFWLRQ WKH DFWLYH SURJUDP UHTXLUHV D GHVWLQDWLRQ HQWU\ LQ WKH VLGH LQIRUPDWLRQ WDEOH.QWHUIDFH 7RSLF 6XPPDU\ z 7KH &3.7KH &3.

 z .I WKH WDUJHW V\VWHP LV DQ 6$3 V\VWHP WKH DFWLYH SURJUDP PXVW VHQG WKH UHTXLUHG ORJRQ GDWD DQG WKH QDPH RI WKH IRUP URXWLQH LW ZDQWV WR FDOO DV D FRQQHFW VWULQJ z 7KHUH DUH PDQ\ &3.& WHVW SURJUDPV DQG DQDO\VLV WRROV DYDLODEOH © SAP AG 2002 © SAP AG BC415 5-54 .

QWHUIDFH 4$3.$V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4XHXH $SSOLFDWLRQ 3URJUDPPLQJ .

QWHUIDFH 7KH &3.QWHUIDFH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.& &RPPXQLFDWLRQ .& &RPPXQLFDWLRQ . 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 :HE 5)& :HE 5)& 7KH &3.

$V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.

 %$3. ([HUFLVHV 6ROXWLRQV IRU &3.& DQG 4$3.& DQG 4$3. :RUNVKRS %$3. :RUNVKRS © SAP AG 2002 © SAP AG BC415 5-55 . ([HUFLVHV 6ROXWLRQV IRU &3.

$V\QFKURQRXV 'DWD 7UDQVIHU 7KURXJK 4$3. 7RSLF 2EMHFWLYHV $W WKH FRQFOXVLRQ RI WKLV XQLW \RX ZLOO EH DEOH WR z 7UDQVPLW EXIIHUHG.

GDWD DV\QFKURQRXVO\ z *HQHUDWH D TXHXH ORFDOO\ GHSRVLWHG GDWD WKDW LV WR EH VHQW DV\QFKURQRXVO\.

z 0DQDJH TXHXHV © SAP AG 2002 © SAP AG BC415 5-56 .

$UFKLWHFWXUH 5 5HPRWH 6\VWHP Å Ä Å ´ ´Á È Ä » È » Á Â Â ³ Â Â » ² ² Â Â ± ± À ¼ · ¼ » ³ ¾ ¾ ½ · ½ ¼ ¼ · » · º » ¹ º ¸ ¹ ¸ · · ¶ µ ¶ À À À ´ µ ´ Â À Â À À À Ä Ä Ã ¾ ¾ ¿ ¿ Â Â » » Å Å É É ¾ ¾ Ã Ç Ç Æ À À Æ 5 GDWDEDVH Job X (driver prog. You specify the recipient passive program in the queue attributes.) Data selection Job Y (driver prog. Asynchronous data transmission (or buffered data transmission) is useful for cases where the recipient system is unavailable or overloaded (and so unable to receive and process data). which is then called at the appropriate time to receive and process the data. ° ° © SAP AG BC415 5-57 .) Accept connection Receive data record & process Ó Data storage in queue  Ò Ï Ñ Ð Ï Í Ì Ê Ë Ê QAPI &3.& 3DVVLYH UHFLSLHQW SURJUDP Send confirmation Close connection and end program  Queue X Queue Y 4XHXH SRRO © SAP AG 2002 One of the prerequisites of CPI-C communication is that the recipient system be available. Then a job is automatically scheduled that starts an active CPI-C send program (driver program) at the set time to read and send the queue data. The data that is to be sent is first placed in a queue.

 © SAP AG 2002 The system only schedules the transmission job for queues with the value A (automatic transmission) in the 6WDUW PRGH attribute. © SAP AG BC415 5-58 . The only step in the job is to call the active CPI-C program specified in the 'ULYHU SURJUDP attribute of the queue. ° The job has the same name as the queue. 4XHXH .  6WDUW WLPH   6WDUW GDWH   6WHS  564$3. and is scheduled for the time and date specified in the ’Transmission date/time’attribute.$XWRPDWLF 6FKHGXOLQJ RI D 'ULYHU 3URJUDP 5 $XWRPDWLF VFKHGXOLQJ RI WKH GULYHU SURJUDP ZKHQ D TXHXH LV FUHDWHG 4XHXH SRRO -RE . 4XHXH DWWULEXWHV 6WDUW PRGH 6HQG WLPH $  6HQG GDWH 'ULYHU SURJ  564$3.

LUWs that have been sent successfully are deleted from the queue (LUW = records that belong together). the corresponding CPI-C connect string is constructed and sent automatically after establishing the connection with the remote system. You can set the interval between attempts using the constant DELAYTIME in the driver program (300 sec. 6WDUW WLPH   6WDUW GDWH   6WHS  564$3. &3. the current LUW in the queue is rolled back. Ù  Ù Ú Ö × ó ÷ à à ö ô ó × Ù Ö Û à ï í è ë å ä ç è ê è å ä ä ç ç è æ ê å è ä ò ã â ñ á ð 'HVWLQDWLRQ 3DVVLYH SURJUDP )RUP URXWLQH © SAP AG 2002 The specified driver program is started automatically at the chosen start time. the queue status is set to E. (In this error case. and an express e-mail is sent to the queue creator.$XWRPDWLF 'DWD 7UDQVPLVVLRQ 5 6FKHGXOHG H[HFXWLRQ RI RI WKH GULYHU SURJUDP 4XHXH SRRO 5HPRWH 6\VWHP -RE . The queue records are then read and sent in SLQJ SRQJ mode. ° The SAP standard driver program 564$3. the driver program schedules itself again (-> new job). has the following properties: . This active CPI-C program calls the relevant recipient program and sends the queue to it. you can adapt the driver program to your own needs. or write your own driver program for use in queue transmission. .If the connection to the remote system cannot be established. the recipient program must roll back the current LUW in the remote system itself.).If the connection is terminated when the data is transmitted. You must create a passive recipient program in the remote system that can receive and process the queue data. If the CLIENT attribute (client in remote SAP system) is set. If required. ° ° © SAP AG BC415 5-59 .& Ù × Ö Õ Ö Õ Ô 3DVVLYH UHFLSLHQW SURJUDP  Ù Ú Ù × Ö Õ Ö Õ Ü × ú ù Ö Û  û Ù 4XHXH DWWULEXWHV Ú 4XHXH .) . The driver program reads the relevant parameters for the CPI-C communication from the corresponding queue attributes.

&UHDWLQJ D 4XHXH  2SHQ TXHXH JHQHUDWH TXHXH KHDGHU.

7 :25.  3ODFH UHFRUGV RI ILUVW /8: LQWR TXHXH RQH E\ RQH  &200. IL[HV /8: LQ TXHXH.

3ODFH UHFRUGV RI VHFRQG /8: LQWR TXHXH RQH E\ RQH  &200.7 :25. IL[HV /8: LQ TXHXH.

IL[HV TXHXH.7 :25.   &ORVH TXHXH IROORZHG E\ &200.

© SAP AG 2002 The above is the procedure for creating a queue. ° © SAP AG BC415 5-60 .

2SHQLQJ D 4XHXH .

)XQFWLRQ PRGXOH 48(8(B23(1 .  63$&( 7<3( $  8 67$57 $  0  ( '$7(  6HQG GDWH !  6HQG WLPH ! 7.0( VWDUW PRGH .PSRUW SDUDPHWHUV 9DOXHV 1$0(  4XHXH QDPH ! 23(102'( :  5 (5$6( .

you must supply the following parameters: NAME Name of queue to be opened This parameter is not specified when opening a new queue. R: Read ERASE X Deletes the queue shell when the queue is empty TYPE U : Unique (queue can only be filled with data once.) To do this. OPENMODE W Write . even during transmission) START A Automatic (queue data is automatically sent through an internally scheduled job at the specified send time (DATE / TIME). which you receive from the export parameter NAME of the function module. When the queue is activated. it cannot be extended subsequently) Appendable (queue may be extended. ° © SAP AG BC415 5-61 .The queue. If you place data from this program into this queue.  © SAP AG 2002 When you open a queue using the function module QUEUE_OPEN. DATE/TIME Transmission start time and date (only applies to start type A). a job is created internally that is executed at the event SAPQEVENT / parameter <queue name>. you must manually create an appendable queue first from start mode E using transaction SM38. M Manual (queue must be sent manually using transaction SM38) -> internal scheduling of an immediate job) E Event-controlled (used to start transmission immediately once the queue has been created. The scheduled job for sending data commences. therefore. receives the current time stamp as its name. the accompanying event is triggered automatically at QUEUE_CLOSE.

2SHQLQJ D 4XHXH .

° ° © SAP AG BC415 5-62 . )XQFWLRQ PRGXOH 48(8(B23(1 .9(5  'ULYHU SURJUDP ! '(67. SPACE : Queue data is transmitted unconverted.) USERID / PASSWORD Logon data for the receiving system PROGRAM / FORM Receiving program or form routine called remotely from the driver program The input parameters of the function module QUEUE_OPEN are stored in the queue header as queue attributes.PSRUW SDUDPHWHUV 9DOXHV  '$7$7<3( 63$&(  &3. The parameters of the QUEUE_* function modules are all defined with reference to ABAP Dictionary fields.21  6LGH LQIR HQWU\ IRU WDUJHW V\VWHP ! &/.'  8VHU LQ WDUJHW V\VWHP ! 3$66:25' 352*5$0  3DVVZRUG RI UHPRWH XVHU !  3DVVLYH UHFLSLHQW SURJUDP ! )250  )RUP URXWLQH LQ UHFLSLHQW SURJUDP! © SAP AG 2002 Further import parameters of function module QUEUE_OPEN: DATATYPE: This queue attribute is interpreted by the driver program RSQAPI20. CPIC: If the sending system uses ASCII. the corresponding actual parameters must all have the same types.&  52'& '5.1$7. the queue data is converted from ASCII to EBCDIC before it is sent. the driver RSQAPI20 automatically sends a connect string. Therefore.(17  &OLHQW LQ WDUJHW V\VWHP ! 86(5. RODC: Queue data is sent by CPI-C using RODC protocol (only when sending to R/2). DRIVER Name of driver program (for example RSQAPI20) DESTINATION TXCOM entry (for making connection to receiving ssystem by driver) ° Only enter the following parameters if the receiving system is an SAP System: CLIENT Client in receiving system (with CLIENT values.

PSRUW SDUDPHWHUV 9DOXHV 1$0(  4XHXH QDPH ! 67$7( 6 VLQJOH UHFRUG RI /8: .6WRULQJ D 5HFRUG RI DQ /8: LQ WKH 4XHXH )XQFWLRQ PRGXOH 48(8(B387 .

) )LUVW UHFRUG RI /8: .

63$&( 0LGGOH UHFRUG RI /8: .

/ %8))(5 /(1*7+ /DVW UHFRUG RI /8: .

SATE Position of the current record within its LUW: S: Current record is the only record in the LUW F Current record is the first (but not only) record in the LUW SAPCE Current record is neither the first nor the last record in the LUW L Current record is the last of several records in the LUW BUFFER Current record LENGTH Length of current record ° © SAP AG BC415 5-63 .  5HFRUG FRQWHQWV !  5HFRUG OHQJWK ! © SAP AG 2002 The function module QUEUE_PUT requires the following input parameters: NAME Name of the queue into which you want to place the record.

&ORVLQJ WKH 4XHXH )XQFWLRQ PRGXOH 48(8(B&/26( .PSRUW SDUDPHWHUV 9DOXHV 1$0(  4XHXH QDPH ! 23(102'(  2SHQ PRGH XVHG WR RSHQ WKH TXHXH :  5 .

° ° © SAP AG BC415 5-64 . the corresponding job is scheduled automatically when you call QUEUE_CLOSE. ! © SAP AG 2002 The function module QUEUE_CLOSE requires the following input parameters: NAME Name queue to be closed OPENMODE Open mode used when queue was opened If you created the queue with start mode A (automatic transmission). The job name is the same as the queue name.

5HDGLQJ DQG 'HOHWLQJ D 4XHXH )XQFWLRQ PRGXOHV 48(8(B*(7 48(8(B'(/(7( 48(8(B(5$6( )XQFWLRQ 5HDGV D UHFRUG IURP D TXHXH 'HOHWHV DQ /8: IURP WKH TXHXH 'HOHWH TXHXH DQG DQ\ GDWD LQ LW.

© SAP AG 2002 If you modify driver program RSQAPI20 or write your own driver program. refer to their documentation in the Function Builder. For further information about their use. ° © SAP AG BC415 5-65 . you can use the above function modules to read or delete queues.

4XHXH $GPLQLVWUDWLRQ 7UDQVDFWLRQ 60.

5 60 4XHXH SRRO z /LVW TXHXHV z 'LVSOD\FKDQJH TXHXH DWWULEXWHV z 'LVSOD\ TXHXH GDWD  4XHXH . ü ü ü © SAP AG BC415 5-66 . which show how to create a queue and send and received data: Creating a queue: SAPBC415D_CREATE_QUEUE or RSQAPI10 Data transmission: RSQAPI20 (Standard driver program) Data transmission: RCVQDATP (Passive recipient program in the remote system) You can also use asynchronous (buffered) data transmission from an R/2 System. 4XHXH < z 6WDUW TXHXH WUDQVPLVVLRQ z 'LVSOD\ WUDQVPLVVLRQ ORJ z 'HOHWH TXHXH z &UHDWH TXHXHV ZLWK QR GDWD © SAP AG 2002 You can manage queues in the queue pool using transaction SM38. The standard R/3 System contains the following demonstration programs. refer to the online documentation for &3. For further information.&  $V\QFKURQRXV 'DWD 7UDQVPLVVLRQ.

$V\QFKURQRXV 'DWD 7UDQVIHU 7KURXJK 4$3. 7RSLF 6XPPDU\ $V\QFKURQRXV GDWD WUDQVPLVVLRQ DOORZV \RX WR SUHSDUH DQG VHQG GDWD VHSDUDWHO\ ý 7KH GDWD LV ILUVW SODFHG LQ D TXHXH WKDW LV VHQW E\ D GULYHU SURJUDP WR WKH DSSURSULDWH UHFLSLHQW SURJUDP DW WKH VFKHGXOHG WLPH ý <RX XVH WKH IXQFWLRQ PRGXOHV 48(8(B23(1 48(8(B387 DQG 48(8(B&/26( WR FUHDWH D TXHXH ý 7KH VWDQGDUG V\VWHP FRQWDLQV GULYHU SURJUDP 564$3. 7KLV SURJUDP FRQWDLQV PDQ\ XVHIXO IXQFWLRQV DQG FDQ VHUYH DV D WHPSODWH IRU \RXU RZQ GULYHU SURJUDPV ý <RX PXVW FUHDWH D SDVVLYH UHFLSLHQW SURJUDP LQ WKH UHPRWH V\VWHP WR FRUUHVSRQG WR \RXU GULYHU SURJUDP 7UDQVDFWLRQ 60 FRQWDLQV IXQFWLRQV WKDW DOORZ \RX WR PDQDJH \RXU TXHXHV ý ý © SAP AG 2002 © SAP AG BC415 5-67 .

& DQG 4$3. :RUNVKRS %$3. %$3.& DQG 4$3.QWHUIDFH $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.& &RPPXQLFDWLRQ .& &RPPXQLFDWLRQ .& DQG 4$3. ([HUFLVHV DQG 6ROXWLRQV IRU &3. ([HUFLVHV DQG 6ROXWLRQV IRU &3.([HUFLVHV DQG 6ROXWLRQV IRU &3. :RUNVKRS © SAP AG 2002 © SAP AG BC415 5-68 . %$3. $V\QFKURQRXV 'DWD 7UDQVIHU WKURXJK 4$3.QWHUIDFH 7KH &3. :RUNVKRS 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 0DLQWDLQLQJ DQ 5)& 'HVWLQDWLRQ LQ 5 :HE 5)& :HE 5)& 7KH &3.

& &RPPXQLFDWLRQ .&B3*0 to your program =B3 (where ## is your group number).9(B&3.&B3*0 to program name =B$ ( where ## is your group number). You must create the program in the passive system yourself) • Sends the airline code to the partner program • Receives the relevant SPFLI entries in SLQJSRQJ mode. 1-1 Use CPI-C to link two R/3 Systems and transfer data from the passive system to the active system. stores them. the routine should: • Receive an airline code • Read the corresponding SPFLI entries • Send the SPFLI entries to the caller in SLQJSRQJ mode • Terminate the CPI-C connection when finished. Destination 1-1-2 In the active system. and extend the form routine SEND so that it is a passive CPI-C partner. copy the main program 6$3%&7B3$66. © SAP AG BC415 5-69 . (Your instructor will tell you the names of the active and passive systems).([HUFLVHV 8QLW 7KH &3.& &RPPXQLFDWLRQ %HWZHHQ 7ZR $%$3 3URJUDPV • Creating a remote destination in the active system • Developing active and passive ABAP programs You have two R/3 Systems and want to use CPI-C communication to transmit data from one to the other.9(B&3. and convert it into an active CPI-C program that: • Prompts the user to enter a destination (DEST##) and an airline code (such as ‘AA’) • Calls the SEND form routine of program Z415_P## remotely (## = group number. name: '(67 ( where ## is your group number).QWHUIDFH 7RSLF &3. and then displays them. create a remote destination using transaction SM54. copy the main program 6$3%&7B$&7. When it is called. 1-1-1 In the active system. 1-3 In the passive system.

7LSV 7ULFNV d out the information required to create the sideinfo entry in the active © SAP AG system. BC415 5-70 . use transaction SM51 (in the passive system).

QWHUIDFH 7RSLF &3.6ROXWLRQV 8QLW 7KH &3. CARRID © SAP AG LIKE SPFLI-CARRID DEFAULT ’LH’. " Receive buffer for an SPFLI record " Connect string " CPI-C constants * User details (CPI-C destination.& &RPPXQLFDWLRQ . INCLUDE RSCPICDF. ************************************************************************ * * * Unit: The CPI-C Communication Interface * * * * * Model solution for exercise 1 * ( Active program ) * * * ************************************************************************ REPORT SAPBC415S_ACTIVE_CPIC_PGM. TABLES CPICCONN.& &RPPXQLFDWLRQ %HWZHHQ 7ZR $%$3 3URJUDPV • Creating a remote destination in the active system • Developing active and passive ABAP programs You have two R/3 Systems and want to use CPI-C communication to transmit data from one to the other. required SPFLI records) PARAMETERS: DEST(8) DEFAULT ’DEST00’. TABLES SPFLI. BC415 5-71 .

" Info about send permission CPIC_RC LIKE SY-SUBRC. * Initialize communication SKIP. FORMAT COLOR 1.* CPI-C variables DATA: CONVID(8). " FORM routine ’. " Connection type CPICCONN-AMODE = ’1’. © SAP AG BC415 5-72 . " CPI-C user in remote system CPICCONN-CODE = ’ADMIN’. " Client CPICCONN-NAME = ’SAPCPIC’. " Logon language CPICCONN-KORR = ’ ’. " Partner ABAP program CPICCONN-MODN = ’SEND’. " Length of data received DI(4) TYPE X. FORMAT COLOR 2. " Conversation ID RECEIPT(40). " Receive buffer for logon response RL(4) TYPE X. COUNTER(2) TYPE P. " Unused CPICCONN-FILL1 = ’ " Unused CPICCONN-MAND = ’401’. " Receipt: Record received RBUFFER(255). " Is the received data complete SI(4) TYPE X. WRITE: / ’RC =’. " Unused CPICCONN-PROG = ’CPICS33P’. * Fill the connect string CPICCONN-REQID = ’CONN’. " Mode CPICCONN-IMODE = ’ ’. " Password of CPI-C user CPICCONN-LANG = SY-LANGU. " Return code for CPI-C calls " Counter for SPFLI records received * Internal table for storing SPFLI records received DATA: ITAB LIKE SPFLI OCCURS 0. COMMUNICATION INIT DESTINATION DEST ID CONVID RETURNCODE CPIC_RC. CPIC_RC. " Request ID CPICCONN-REQTYPE = ’CPIC’. WRITE: / ’COMMUNICATION INIT : SYMDEST =’. DEST.

* Start communication SKIP. CPIC_RC. WRITE CPICCONN. FORMAT COLOR 2. " Simple error handling * Logon response received SKIP. IF CPIC_RC NE CM_OK. FORMAT COLOR 2. WRITE: / ’RC =’. WRITE: / ’ ==> EXIT. EXIT. EXIT. " Simple error handling CONVID =’. COMMUNICATION SEND ID CONVID BUFFER CPICCONN RETURNCODE CPIC_RC. ENDIF. ENDIF. IF CPIC_RC NE CM_OK. CPIC_RC. COMMUNICATION ALLOCATE ID CONVID RETURNCODE CPIC_RC. " Simple error handling * Send logon data SKIP. TRANSLATE CPICCONN FROM CODE PAGE ’1100’ TO CODE PAGE ’0100’. WRITE: / ’COMMUNICATION ALLOCATE : CONVID =’.IF CPIC_RC NE CM_OK. FORMAT COLOR 1. FORMAT COLOR 1. WRITE: / ’RC =’. FORMAT COLOR 1. ENDIF. COMMUNICATION RECEIVE ID BUFFER © SAP AG CONVID RBUFFER BC415 5-73 . WRITE: / ’COMMUNICATION RECEIVE (Logon response) :’. CONVID. CONVID. WRITE: / ’COMMUNICATION SEND (Logon-Data) : ’.

FORMAT COLOR 2. IF CPIC_RC NE CM_OK. /2 ’RL =’. RL. /2 ’DI =’. TRANSLATE RBUFFER FROM CODE PAGE ’0100’ TO CODE PAGE ’1100’. FORMAT COLOR 2. © SAP AG BC415 5-74 .appended to ITAB (processing) and * . /2 ’SI =’. EXIT.RECEIVED RL DATAINFO DI STATUSINFO SI RETURNCODE CPIC_RC. IF CPIC_RC NE CM_OK.a receipt is sent to the sender. /2 ’RC =’. SI. " Simple error handling * Loop for receiving and processing data and sending acknowledgement * in ping pong mode: * In each loop pass * . WRITE: / CARRID. DO. /2 ’RC =’. " Simple error handling * Send CARRID SKIP. WRITE: / RBUFFER. COMMUNICATION SEND ID CONVID BUFFER CARRID RETURNCODE CPIC_RC. EXIT.One SPFLI record is received * . ENDIF. CPIC_RC. FORMAT COLOR 1. DI. ENDIF. CPIC_RC. WRITE: / ’COMMUNICATION SEND (CARRID) :’.

COMMUNICATION RECEIVE ID CONVID BUFFER SPFLI RECEIVED RL DATAINFO DI STATUSINFO SI RETURNCODE CPIC_RC. " DO loop ENDIF.’.’. WRITE: / ’COMMUNICATION SEND (Receipt)’. RL. DI. /2 ’DI =’.’. " Loop * Append SPFLI record to itab APPEND SPFLI TO ITAB. /2 ’SI =’. WRITE: / ’->’.. RECEIPT = ’ . ADD 1 TO COUNTER. * Send receipt SKIP. EXIT. 6 ’.’. " terminated by WRITE / ’-> " partner exit from CPI-C connection deallocated. entry received and processed. FORMAT COLOR 1. IF CPIC_RC NE CM_OK. 3 COUNTER. MOVE COUNTER TO RECEIPT(4). " If connection is FORMAT COLOR 2. FORMAT COLOR 2. SI. FORMAT COLOR 1. /2 ’RC =’. COMMUNICATION SEND ID © SAP AG CONVID BC415 5-75 . /2 ’RL =’.* Receive SPFLI record SKIP. WRITE: / ’COMMUNICATION RECEIVE (SPFLI-Entry) : . SPFLI-entry received and processed.. CPIC_RC.

WRITE: /3 SPFLI-CARRID. SPFLI-CITYTO. CPIC_RC. FORMAT COLOR 2. WRITE / ’Received SPFLI entries :’. " Length of data received DI(4) TYPE X. FORMAT COLOR 3. TABLES SPFLI. © SAP AG " Info about send permission " Return code for CPI-C calls BC415 5-76 . FORMAT COLOR 5. SPFLI-CONNID. WRITE: /2 ’RC =’. LOOP AT ITAB INTO SPFLI. CPIC_RC LIKE SY-SUBRC. ENDLOOP. " Conversation ID RL(4) TYPE X. DATA: CONVID(8). ENDIF. IF CPIC_RC NE CM_OK. " Simple error handling ENDDO.BUFFER RECEIPT RETURNCODE CPIC_RC. INCLUDE RSCPICDF. * Display itab SKIP 2. SPFLI-CITYFROM. ************************************************************************ * * * Unit: The CPI-C Communication Interface * * * * Model solution for exercise 1 * * ( Passive program ) * * * ************************************************************************ REPORT CPICS33P . " Is the received data complete SI(4) TYPE X. EXIT.

ENDIF. " Simple error handling * Receive SPFLI-CARRID from active program COMMUNICATION RECEIVE ID CONVID BUFFER CARRID RECEIVED RL DATAINFO DI STATUSINFO SI RETURNCODE CPIC_RC.CARRID LIKE SPFLI-CARRID. COMMUNICATION ACCEPT ID CONVID RETURNCODE CPIC_RC. FORM SEND. * send contents of itab record by record in ping pong mode LOOP AT ITAB INTO SPFLI. IF CPIC_RC NE CM_OK. " Receive field for SPFLI-CARRID RECEIPT(40). IF CPIC_RC NE CM_OK. EXIT. EXIT. " Simple error handling * Read SPFLI records into itab using array fetch SELECT * FROM SPFLI INTO TABLE WHERE ITAB CARRID = CARRID. ENDIF. " Receive field for receipt DATA: ITAB LIKE SPFLI OCCURS 0. COMMUNICATION SEND ID © SAP AG CONVID BC415 5-77 .

" Simple error handling COMMUNICATION RECEIVE ID CONVID BUFFER RECEIPT RECEIVED RL DATAINFO DI STATUSINFO SI RETURNCODE CPIC_RC. © SAP AG BC415 5-78 . ENDIF.BUFFER SPFLI RETURNCODE CPIC_RC. * Close connection COMMUNICATION DEALLOCATE ID CONVID RETURNCODE CPIC_RC. IF CPIC_RC NE CM_OK. ENDIF. ENDFORM. IF CPIC_RC NE CM_OK. EXIT. " Simple error handling ENDLOOP. EXIT.

([HUFLVHV 8QLW $V\QFKURQRXV 'DWD 7UDQVIHU 4$3.

‘GR##_LUW2_REC1’ . 1-1 In this exercise. Record contents: ‘GR##_LUW1_REC1’ . you will pass data between two R/3 Systems using a buffer in the source system that is then transmitted to the target system. with the same functions as the original version). ‘GR##_LUW1_REC2’ . 7RSLF $V\QFKURQRXV 'DWD 7UDQVIHU EHWZHHQ 5 6\VWHPV • Creating a queue for automatic transmission in the source system • Queue administration • Checking the processing results You want to send data from one system to another system. • Recipient program and form routine 5&94'$73  5(&(. because the target system is currently not available or overloaded. ‘GR##_LUW1_REC3’ . • CPI-C destination and remote logon data as in the CPI-C exercise • Data: two LUWs. copy the main program 6$3%&7B&5($7(B48(8( to your program =%&B B&5($7(B48(8( (## = your group number). The queue should have the following attributes: • Name 4 • Extendable • Automatic transmission at your chosen time using the driver program 564$3. but asynchronously. (Your instructor will tell you the names of the source and target systems). (a slightly modified version of RSQAPI20.9( (already exist in target system). ‘GR##_LUW2_REC2’ . each with three records. and convert it into a program that generates a queue. ‘GR##_LUW2_REC3’ (## = your group number) © SAP AG (## = group number) BC415 5-79 . 1-1-1 In the source system.

1-2 Use transaction 60 4XHXH $GPLQLVWUDWLRQ.1RWHV : 1 You can ignore the parameters for the function modules you are calling that are not documented in the exercises. 2 You can use OTHERS for the exceptions to the function modules you want to call. Refer to the relevant function module documentation for their meanings.

to ensure that your queue has been created successfully. You can display the corresponding job using transaction 60 -RE $GPLQLVWUDWLRQ. Display its attributes.

This program receives the queue data in ping-pong mode and stores it in table 4'$7 (data processing). 1-3 Log onto the target system and look at the coding of receiving program 5&94'$73.. Use transaction 6( 'DWD %URZVHU.

but the corresponding job generated when you use QUEUE_CLOSE will be scheduled ZLWKRXW D VWDUW WLPH. to ensure that your queue data has been successfully received and processed (stored in table QDAT). 7LSV 7ULFNV © SAP AG If you specify a WUDQVPLVVLRQ WLPH LQ WKH SDVW when you create your queue. the system will be able to create the queue successfully. BC415 5-80 .

6ROXWLRQV 8QLW $V\QFKURQRXV 'DWD 7UDQVIHU 4$3.

" program DATA: RCDPOS. " data receiving FORM LIKE APQI-FORMID DEFAULT ’RECEIVE’. 7RSLF $V\QFKURQRXV 'DWD 7UDQVIHU EHWZHHQ 5 6\VWHPV • Creating a queue for automatic transmission in the source system • Queue administration • Checking the processing results You want to send data asynchronously from one system to another system because the target system is currently not available or overloaded. INCLUDE RSQAPIDF. " data sending pgm DEST LIKE APQI-DESTSYS DEFAULT ’DEST00’. " record position in LUW BUFFER LIKE APQD-VARDATA. STRTTIME LIKE APQI-STARTTIME DEFAULT SY-UZEIT. " for PASSWD LIKE APQI-PASSWD DEFAULT ’ADMIN’. REPORT SAPBC415S_CREATE_QUEUE MESSAGE-ID BC415. " Sideinfo-entry CLIENT LIKE APQI-MANDANT DEFAULT ’000’. " unique/appendable STRTMODE LIKE APQI-STARTMODE DEFAULT ’A’. " logon-data USERID LIKE APQI-USERID DEFAULT ’SAPCPIC’. " input length © SAP AG BC415 5-81 . DRIVER LIKE APQI-STARTPGID DEFAULT ’RSQAPI21’. PARAMETERS: QID LIKE APQI-QID DEFAULT ’Q00’. QTYPE LIKE APQI-QATTRIB DEFAULT ’A’. LUWS TYPE N DEFAULT ’2’. " input data for queue LENGTH TYPE I. " remote system PROG LIKE APQI-PROGID DEFAULT ’RCVQDATP’. " manual/automatic STRTDATE LIKE APQI-STARTDATE DEFAULT SY-DATUM.

WHEN 1. " counter for LUWs *----------------------------------------------------------------------* * Open queue * *----------------------------------------------------------------------* CALL FUNCTION ’QUEUE_OPEN’ EXPORTING NAME = QID OPENMODE = ’W’ ERASE = ’X’ " automatically erased when empty TYPE = QTYPE " unique/appendable START = STRTMODE " manual/automatic start DATE = STRTDATE TIME = STRTTIME DATATYPE = ’ ’ " no data conversion ASC_TO_EBC DRIVER = DRIVER " active data sending program DESTINATION = DEST " Sideinfo-entry CLIENT = CLIENT " logon-data USERID = USERID " for PASSWORD = PASSWD " remote system PROGRAM = PROG " passive data receiving program FORM = FORM " and subroutine EXCEPTIONS INVALID_PARAMETER = 1 OTHERS = " invalid value in parameter 2. © SAP AG " first record of LUW BC415 5-82 .LUWCOUNTER TYPE N. CASE SY-SUBRC. MESSAGE E184 WITH ’Other error in QUEUE_OPEN !’. ENDCASE. RCDPOS = Q_FIRST. WHEN 2. MESSAGE E184 WITH ’Invalid value in QUEUE_OPEN-parameter !’. *----------------------------------------------------------------------* * Fill queue * *----------------------------------------------------------------------* DO LUWS TIMES.

RCDPOS = Q_MIDDLE. WRITE: 6 ’Queue-Id : ’. LENGTH = STRLEN( BUFFER ). PERFORM INSERT_RECORD_TO_QUEUE. " third (last) record of LUW BUFFER = ’GR00_LUW _REC3’. " queue sucessfully closed COMMIT WORK. QID. CASE SY-SUBRC. SKIP. WHEN 2. WHEN 0. BUFFER+8(1) = LUWCOUNTER = SY-INDEX. LENGTH = STRLEN( BUFFER ). LENGTH = STRLEN( BUFFER ). BUFFER+8(1) = LUWCOUNTER = SY-INDEX. *----------------------------------------------------------------------* * Close queue * *----------------------------------------------------------------------* CALL FUNCTION ’QUEUE_CLOSE’ EXPORTING NAME = QID OPENMODE = ’W’ " openmode used in QUEUE_OPEN EXCEPTIONS INVALID_PARAMETER = 1 OTHERS = 2. WHEN 1.BUFFER = ’GR00_LUW _REC1’. MESSAGE E184 WITH ’Invalid value in QUEUE_CLOSE-parameters !’. " second record of LUW BUFFER = ’GR00_LUW _REC2’. BUFFER+8(1) = LUWCOUNTER = SY-INDEX. SKIP 2. © SAP AG BC415 5-83 . WRITE: 6 ’Created queue sucessfully !’. ENDDO. PERFORM INSERT_RECORD_TO_QUEUE. PERFORM INSERT_RECORD_TO_QUEUE. RCDPOS = Q_LAST.

" other error in QUEUE_PUT ! " -> message + LUW-rollback MESSAGE E184 WITH ’Other error in QUEUE_PUT -> LUW-rollback’. ENDFORM. *----------------------------------------------------------------------* * FORM insert_record_to_queue * *----------------------------------------------------------------------* FORM INSERT_RECORD_TO_QUEUE. ENDCASE. WHEN 2. IF RCDPOS = Q_LAST. WHEN 1. ENDCASE.MESSAGE E184 WITH ’Other error in QUEUE_CLOSE !’. CASE SY-SUBRC. CALL FUNCTION ’QUEUE_PUT’ EXPORTING NAME = QID STATE = RCDPOS " record position in LUW BUFFER = BUFFER " record data LENGTH = LENGTH " record length EXCEPTIONS INVALID_PARAMETER = 1 OTHERS " invalid value in parameter = 2. ENDIF. © SAP AG BC415 5-84 . " invalid value in QUEUE_PUT-parameters " -> message + LUW-rollback MESSAGE E184 WITH ’Invalid value in QUEUE_PUT-parameters -> LUW-rollback’. " complete LUW in queue COMMIT WORK.

© SAP AG BC415 5-85 .

We will start with the business object )OLJKW&XVWRPHU (object type 6&86720). If you want to reconstruct the example described in the guide in your own system. This add-on contains all the objects used in ABAP training courses and can be downloaded from the SAP service homepage: KWWSVHUYLFHVDSFRPRFVGRZQORDG Æ Logon with OSS user or User "walldorf" (Password "training") . :RUNVKRS 'HVFULSWLRQ The following pages provide guidelines for creating BAPIs. This business object is available in all SAP training systems. but not in the standard delivery. you must first import the 4.Q WKH QDYLJDWLRQ DUHD Æ Download support packages Æ Add-on support packages / CRTs Æ Further add-on components Æ Training Æ Training 46C .6 training add-on.%$3.Q WKH FRQWHQWV DUHD Æ All objects (full task) Æ Download 1RWH Data for flight tables can be generated automatically by calling the report SAPBC_DATA_GENERATOR. © SAP AG BC415 5-86 .

the two BAPIs remain functionally independent of each other because. After creating the ABAP programs. The relevant 6$3 %XVLQHVV 2EMHFW for this scenario is )OLJKW&XVWRPHU. first of all. © SAP AG BC415 5-87 . It requires that you create a structure. However. using another BAPI. and then. two BAPIs are required: One to display a list of flight customers (*HW/LVW) and another to display details of a specific flight customer (*HW'HWDLO). From this list you can select a flight customer. you need to display a list of flight customers.6FHQDULR In the scenario to be implemented here. First. To save time. You will create the *HW/LVW BAPI first. The interdependency of these two BAPIs is evident because. To read a flight customer’s details as described in the above scenario. and a form routine. The second BAPI you will create is the *HW'HWDLO BAPI. a function module. you will create the two above-mentioned BAPIs. you will then use the BOR/BAPI Wizard to create the BAPI and attach it to the )OLJKW&XVWRPHU object. In this workshop. display specific details about this customer. you require a BAPI to read data about a flight customer. the ABAP code is attached to the end of this workshop. To save time. the BAPI to display the details of a specific flight customer can be used without calling the *HW/LVW BAPI. You will have to create a function module to get the detail about a flight customer and then create the BAPI using the BOR/BAPI wizard. the ABAP code is attached to the end of this workshop. if the flight customer ID is known. you can display details of the flight customer. From this ID. the list of flight customers is displayed to obtain the ID of the specific flight customer sought.

Use the menu path 7RROV Æ $%$3 :RUNEHQFK Æ )XQFWLRQ %XLOGHU. Press the (QWHU key to display the detailed structure screen. enter the structure for the *HW/LVW BAPI. The BAPI will return the &XVWRPHU . and the remaining entries for ID will be filled in from the S_CUSTOMER definition. Field Name: NAME Type Name: S_CUSTNAME Press the (QWHU key.  Go to the 'DWD 'LFWLRQDU\ and define a structure for the BAPI. 2 Select the VWUXFWXUHV option button and enter the name as ZBAPICUSTxx (xx is your group number). 6HFWLRQ  %XLOGLQJ WKH )XQFWLRQ 0RGXOH IRU WKH *HW/LVW %$3. Use the Menu Path 7RROV Æ $%$3 :25. The structure we will create is based upon the SCUSTOM table. 1 Go to the )XQFWLRQ %XLOGHU and create a function group.6HFWLRQ  3URJUDPPLQJ WKH *HW/LVW %$3. © SAP AG BC415 5-88 . 5 Save and activate the structure. and the remaining entries for NAME will be filled in from the S_CUSTNAME definition.%(1&+ and select the 'LFWLRQDU\ command button in the toolbar or use transaction SE11 to get into the 'DWD 'LFWLRQDU\. 4 Complete the remaining entries for the two fields in the structure as follows: Field Name: ID Type Name: S_CUSTOMER Press the (QWHU key. 2 Name the function group ZGxx (xx is your group number).' and the &XVWRPHU 1DPH fields in a structure. %DFNJURXQG The *HW/LVW BAPI requires a structure to hold the return data for the BAPI method call. 3 In the 6KRUW 7H[W field.

To access the *OREDO 'DWD area from the source code editor. you will not need to repeat these declarations for the *HW'HWDLO BAPI. On the $GPLQ tab : • Enter the short text (your choice). 5 You will need to add global data for the function group. PLEASE NOTE: YOU NEED TO CHANGE ANY REFERENCES TO TABLES AND PROGRAMS BASED UPON THE NAMES YOU HAVE BEEN ASSIGNED. On the 'RFXPHQWDWLRQ tab: Entries are made for you. THE SAMPLE CODE USES A STRUCTURE AND FUNCTION NAME DIFFERENT FROM YOURS.3 Create a function module. On the . use the menu path *R7R Æ *OREDO 'DWD. and a message structure. &KDQJLQJ and ([FHSWLRQV tabs: No entries required. Since these are global for your function group. 6 Code the function module. the internal table. Specifically. you will need to add declarations for the table work area VFXVWRP. © SAP AG BC415 5-89 .PSRUW. 4 Define the interface for your function module. The code for your function module is attached at the end of this workshop. • Select 5HPRWH )XQFWLRQ &DOO supported in the processing type On the ([SRUW tab: • Enter 5HWXUQ for the export parameters and BAPIRETURN for the 5HIILHOG  VWUXFWXUH On the 7DEOHV tab: • Enter SCUST_LIST for the table parameters and ZBAPICUSTxx for the 5HI6WUXFWXUH ([[ is your group number). See the attached program code for the function group global declarations at the end of this workshop. Name the module ZBAPI_GET_CUSTOMER_LISTxx (xx is your group number).

© SAP AG BC415 5-90 .7 You will need to create a form routine that handles messages. This routine handles the messaging return structure (of type BAPIRETURN). It should not be changed from the printed copy. You can find the ABAP code at the end of this workshop. the form routine is set_return_message. You can just enter it as is. For our workshop. To access the form routine (subroutine) area. which is used to inform the external program calling the BAPI whether the BAPI was successful or not. double click the name of the form routine being called.

© SAP AG BC415 5-91 .

Note: If you are prompted for a change request. 5 Select the next button. This will display a dialog to enter the function module name you created in the previous steps (for example. PHWKRG 0HWKRG IHDWXUHV dialog will be displayed. The next step is the &UHDWH SDUDPHWHU dialog.6HFWLRQ   'HILQLQJ 0HWKRGV LQ WKH %25 XVLQJ WKH %25  %$3. ScustList or CustDetail. In the &KDUDFWHULVWLFV section. make sure 6\QFKURQRXV and . except for the upper/lower case letters. Table parameters are marked with a check in column 0OLQH (multiple lines). Use the name *HW&XVWRPHU/LVW[[ ([[ is your group number). enter SCUSTOMER as the object type. which is the second button of three in the lower left corner of the dialog box. PHWKRGV Æ $GG PHWKRG. In the &UHDWH SDUDPHWHU step. • Make sure that the parameter names of the method in the BOR are identical to the parameter names in the function module. In the text boxes. ZL]DUG 1 Go to the %XVLQHVV 2EMHFW %XLOGHU. ZBAPI_GET_CUSTOMER_LIST). type an appropriate name and description for documentation purposes. as required. This will take you to the next step in the BOR/BAPI wizard. You can use the path from the main menu 7RROV Æ %XVLQHVV )UDPHZRUN Æ %$3. enter one through the dialogs using a local change request path. Modify the parameter names as follows: • Each new word in the parameter name must start with a capital letter. GHYHORSPHQW Æ %XVLQHVV 2EMHFW %XLOGHU. Or you can use transaction SWO1 (alpha O). 4 Enter the method name. Select the green checkmark. for example. • Specify whether the individual table parameters are used for data import or data export. Then select the &KDQJH command button. 3 Once you have displayed the &KDQJH 2EMHFW 7\SH screen. go to the menu path 8WLOLWLHV Æ $3. You may need to edit this. 2 In the %XVLQHVV 2EMHFW %XLOGHU initial screen. and the &UHDWH $3.QVWDQFHLQGHSHQGHQW are checked. © SAP AG BC415 5-92 . a list of parameters and default names is displayed.

The dialog warns you that the BAPI is not yet implemented.NOTE: You do not need to make any changes in this step for our workshop. Your BAPI should now be listed with a green circle icon (green light). 6 The next step is the ([WHQG 3URJUDP step. You should now be back on the &KDQJH 2EMHFW 7\SH screen. This step adds “wrapper objectoriented” code to your function module. Select the plus sign next to the 0HWKRGV to expand and display all the methods of SCUSTOMER. 7 The next step is to generate the BAPI entry. Select your BAPI once and then select the *HQHUDWH icon in the toolbar (fourth icon from the left). converting it to a method of an SAP Business Object. 8 Test your BAPI by selecting your BAPI once and then select the test tool in the toolbar (the sixth button from the left) or you can press the F8 key. Select <HV to generate the template that will add the BAPI as a method of the SCUSTOMER object type. © SAP AG BC415 5-93 . Select the next button to bring you to the next step in the BOR/BAPI wizard.

The BAPI will return the following fields : Customer ID Customer Name Postal Code City Customer Type Discount This BAPI will be instance-dependent and therefore require that a keyfield be passed to create the object. What is the key field for the business object )OLJKW&XVWRPHU ? © SAP AG BC415 5-94 .6HFWLRQ  3URJUDPPLQJ WKH *HW'HWDLO %$3. %DFNJURXQG The *HW'HWDLO BAPI requires several fields to hold the return data for the BAPI method call.

© SAP AG BC415 5-95 .

PSRUW tab: • Enter . 3 The code for your function module is attached to the end of this workshop. THE SAMPLE CODE USES A STRUCTURE AND FUNCTION NAME DIFFERENT FROM YOURS. On the $GPLQ tab : • Enter the short text (your choice). enter the following: Export Parameters Ref. On the ([SRUW tab.' as the import parameter and ZBAPICUSTxx-ID as the 5HIILHOG  VWUXFWXUH. The global data for this function module was already created in the function group in the previous steps. © SAP AG BC415 5-96 . 2 Define the interface for your function module.6HFWLRQ  %XLOGLQJ WKH )XQFWLRQ 0RGXOH IRU WKH *HW'HWDLO %$3.field / structure SCUST_ID SCUSTOM-ID SCUST_NAME SCUSTOM-NAME SCUST_POSTCODE SCUSTOM-POSTCODE SCUST_CITY SCUSTOM-CITY SCUST_CUSTTYPE SCUSTOM-CUSTTYPE SCUST_DISCOUNT SCUSTOM-DISCOUNT RETURN BAPIRETURN On the &KDQJLQJ 7DEOHV DQG ([FHSWLRQV tab: no entries. PLEASE NOTE: YOU NEED TO CHANGE ANY REFERENCES TO TABLES AND PROGRAMS BASED UPON THE NAMES YOU HAVE BEEN ASSIGNED. 1 Create a function module in your Function Group ZGxx. Name the module ZBAPI_GET_CUSTOMER_DETAILxx ([[ is your group number). On the 'RFXPHQWDWLRQ tab: Entries are made for you. • Select 5HPRWH )XQFWLRQ &DOO supported in the processing type. On the .

4 The form routine your function module needs to handle messages was already created in the function group ZGxx in one of the last sections. © SAP AG BC415 5-97 . so there is no need to create it again.

PHWKRGV Æ $GG PHWKRG. The next step is the &UHDWH SDUDPHWHU dialog. You may need to edit this.QVWDQFHLQGHSHQGHQW will also be checked. 3 Once you have displayed the &KDQJH 2EMHFW 7\SH screen. This will take you to the next step in the BOR/BAPI wizard. Then select the &KDQJH FRPPDQG button. 4 Enter the 0HWKRG name. You can use the path from the main menu 7RROV Æ %XVLQHVV )UDPHZRUN Æ%$3. type an appropriate name and description for documentation purposes. In the text boxes. which is the second button of three in the lower left corner of the dialog box. make sure 6\QFKURQRXV is checked. ScustList or CustDetail. 5 Select the next button. ZL]DUG 1 Go to the %XVLQHVV 2EMHFW %XLOGHU. enter SCUSTOMER as the object type. except for the upper/lower case letters. Select the green checkmark. and WKH &UHDWH $3. but you will change this in a later step. PHWKRG  0HWKRG IHDWXUHV dialog will be displayed. Modify the parameter names as follows: • Each new word in the parameter name must start with a capital letter. go to the menu path 8WLOLWLHV Æ $3. © SAP AG BC415 5-98 . In the &KDUDFWHULVWLFV section. . enter one through the dialogs using a local change request path. as required. GHYHORSPHQW Æ%XVLQHVV 2EMHFW %XLOGHU. a list of parameters and default names is displayed. ZBAPI_GET_CUSTOMER_DETAILxx). This will display a dialog to enter the function module name you created in the previous steps (for example. Use the name *HW&XVWRPHU'HWDLO[[ ([[ is your group number). Or you can use transaction SWO1 (alpha O).21  'HILQLQJ 0HWKRGV LQ WKH %25 XVLQJ WKH %25  %$3. In the &UHDWH SDUDPHWHU step. for example. • Make sure that the parameter names of the method in the BOR are identical to the parameter names in the function module. 2 In the %XVLQHVV 2EMHFW %XLOGHU initial screen.6(&7. Note: If you are prompted for a change request.

QVWDQFHLQGHSHQGHQW checkbox. 8 After generating the BAPI.• Specify whether the individual table parameters are used for data import or data export. Why do you deselect this checkbox? If you are not sure. 9 Test your BAPI by selecting your BAPI once and then select the test tool in the toolbar (the sixth button from the left). which will add the BAPI as a method of the SCUSTOMER object type. 6 The next step is the ([WHQG 3URJUDP step. deselect the . The dialog warns you that the BAPI is not yet implemented. Your BAPI should now be listed with a green circle icon (green light). Select <HV to generate the template. On the *HQHUDO tab. It is very important to BAPI development that you know the difference between instance-dependent and instance-independent BAPIs. Table parameters are marked with a check in the column 0OLQH (multiple lines). 7 The next step is to generate the BAPI entry. NOTE: You do not need to make any changes in this step for our workshop. This will display the 0HWKRG attributes dialog with 3 tabs. have a look at the BAPI Programming Guide. or press the F8 key. Select the plus sign next to the 0HWKRGV to expand and display all the methods of SCUSTOMER. You should now be back on the &KDQJH 2EMHFW 7\SH screen. © SAP AG BC415 5-99 . double click the *HW&XVWRPHU'HWDLO[[ BAPI. Select the next button to bring you to the next step in the BOR/BAPI wizard. Select your BAPI once and then select the *HQHUDWH icon in the toolbar (fourth icon from the left).

MSGV4 LIKE SY-MSGV4. DATA: BEGIN OF MESSAGE. "MESSAGE-ID . MSGNO LIKE SY-MSGNO. TABLES SCUSTOM. END OF MESSAGE. © SAP AG BC415 5-100 . MSGTY LIKE SY-MSGTY. MSGID LIKE SY-MSGID.$%$3 &RGHV *OREDO )XQFWLRQ *URXS 'DWD 'HFODUDWLRQ FUNCTION-POOL ZG00. MSGV1 LIKE SY-MSGV1.. MSGV3 LIKE SY-MSGV3. MSGV2 LIKE SY-MSGV2. DATA: ITAB LIKE ZBAPICUST00 OCCURS 0 WITH HEADER LINE.

CLEAR SCUSTOM. IF SY-SUBRC NE 0.B*(7B&86720(5B/.67 FUNCTION ZBAPI_GET_CUSTOMER_LIST00. © SAP AG BC415 5-101 . CLEAR ITAB. PERFORM SET_RETURN_MESSAGE USING MESSAGE CHANGING RETURN. )XQFWLRQ 0RGXOH =%$3. MESSAGE-MSGID = ’FN’. MESSAGE-MSGNO = 022. CLEAR MESSAGE. CLEAR RETURN. MESSAGE-MSGTY = ’E’. *"----------------------------------------------------*"*"Local interface: *" *" *" *" EXPORTING VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN TABLES SCUST_LIST STRUCTURE ZBAPICUST00 *"----------------------------------------------------CLEAR SCUST_LIST. ENDIF. SELECT * FROM SCUSTOM INTO CORRESPONDING FIELDS OF TABLE ITAB. REFRESH ITAB.%$3. REFRESH SCUST_LIST.

ENDFUNCTION. SCUST_LIST[] = ITAB[]. © SAP AG BC415 5-102 .CHECK RETURN IS INITIAL.

© SAP AG BC415 5-103 .

)XQFWLRQ 0RGXOH =%$3.%$3. MESSAGE-MSGNO = 020. SCUST_CITY./ FUNCTION ZBAPI_GET_CUSTOMER_DETAIL00. *"----------------------------------------------------*"*"Local interface: *" *" *" IMPORTING VALUE(ID) LIKE ZBAPICUST-ID EXPORTING *" VALUE(SCUST_ID) LIKE SCUSTOM-ID *" VALUE(SCUST_NAME) LIKE SCUSTOM-NAME *" VALUE(SCUST_POSTCODE) LIKE SCUSTOM-POSTCODE *" VALUE(SCUST_CITY) *" VALUE(SCUST_CUSTTYPE) LIKE SCUSTOM-CUSTTYPE *" VALUE(SCUST_DISCOUNT) LIKE SCUSTOM-DISCOUNT *" VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN LIKE SCUSTOM-CITY *"----------------------------------------------------CLEAR: SCUST_ID. MESSAGE-MSGV1 = ID. SCUST_DISCOUNT. CLEAR: SCUSTOM. PERFORM SET_RETURN_MESSAGE © SAP AG BC415 5-104 . MESSAGE-MSGTY = ’E’. SELECT SINGLE * FROM SCUSTOM WHERE ID = ID. IF SY-SUBRC NE 0 CLEAR MESSAGE. MESSAGE-MSGID = ’FN’.B*(7B&86720(5B'(7$. RETURN. SCUST_POSTCODE. SCUST_NAME. SCUST_CUSTTYPE.

SCUST_POSTCODE = SCUSTOM-POSTCODE. CHECK RETURN IS INITIAL. ENDFUNCTION. SCUST_CITY = SCUSTOM-CITY.USING MESSAGE CHANGING RETURN. © SAP AG BC415 5-105 . SCUST_ID = SCUSTOM-ID. SCUST_NAME = SCUSTOM-NAME. SCUST_DISCOUNT = SCUSTOM-DISCOUNT. SCUST_CUSTTYPE = SCUSTOM-CUSTTYPE. ENDIF.

CHECK NOT MESSAGE IS INITIAL. CALL FUNCTION ’BALW_BAPIRETURN_GET’ EXPORTING TYPE = P_MESSAGE-MSGTY CL = P_MESSAGE-MSGID NUMBER = P_MESSAGE-MSGNO PAR1 = P_MESSAGE-MSGV1 PAR2 = P_MESSAGE-MSGV2 PAR3 = P_MESSAGE-MSGV3 PAR4 = P_MESSAGE-MSGV4 IMPORTING BAPIRETURN = P_RETURN © SAP AG BC415 5-106 . *-----------------------------------------------------* *&----------------------------------------------------* *& Form SET_RETURN_MESSAGE *&----------------------------------------------------* * text *-----------------------------------------------------* * -->P_MESSAGE text * * <--P_RETURN text * *-----------------------------------------------------* FORM SET_RETURN_MESSAGE USING P_MESSAGE LIKE MESSAGE CHANGING P_RETURN LIKE BAPIRETURN.)XQFWLRQ *URXS )RUP 5RXWLQH 6(7B5(7851B0(66$*( *-----------------------------------------------------* ***INCLUDE LZG00F01 .

" SET_RETURN_MESSAGE BC415 5-107 . © SAP AG = 1.EXCEPTIONS OTHERS ENDFORM.