Exercise 4 - ABAP Proxy to BAPI

Embed Size (px)

Citation preview

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    1/6

      1

    Exercise 4 – Proxy to BAPI

    Overview

    This exercise introduces the generation and execution of ABAP proxies in a Web ApplicationServer 6.40 or above. We will demonstrate the reusability of objects in the XI Repository, andemphasize the outside-in approach for interface development, offered by XI.

    Prerequisites

    - Good understanding of basic XI 3.0 features- Basic knowledge of ABAP-OO programming

    Description

    This is similar to the previous exercise, where the plain HTTP client was used to post XML data toXI, first synchronously then asynchronously. In this case, instead of an HTTP client, an ABAPprogram will send the message via the proxy framework. The assumption, of course, is that there

    is a client available in a SAP WebAS 6.40 or above for this purpose.

    The instructor will explain the outside-in development approach which is a fundamental conceptbehind SAP Exchange Infrastructure. We will fully re-use the existing Repository objects andgenerate a synchronous proxy in the ABAP client. During this process we will deal with namingconflicts for the generated proxy, and learn how to address them. Then we will explore the ABAPproxy runtime and send a message from an application program.

    Exercise s teps

    Step 1 – Repository

    Since we are re–using the PO-related objects created in the previous exercise, nothing needs tobe done in the Integration Repository.

    Step 2 – ABAP client

    2.1 Generate an outbound synchronous proxy for your message interface“PurchaseOrder_out ”2.1.1 Log on to the SAP Web AS 6.40 client (we will use client 821 on the XI server).2.1.2 Enter transaction SPROXY. In the list of Software Components, expand your

    own Software Component TBIT40_WORKSHOP##. Right–click on the interfacename, ‘PurchaseOrder_out ”, and click on “Create”.

    XML / ProxyOrder DataBAPI

    ZBAPI_PO_CREATE

    SAPR/3 4.6C

    SAP Web AS6.40

    Purchasing App licat ion

    RFC

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    2/6

      2

     

    2.1.3 A window will pop up to allow entries for Package Name and Prefix. Enter thefollowing:

      Package: $TMP   Prefix: ZGROUP##.

    Please use individual prefix with ## as your group number!

    2.1.4 When generating the proxy, you may get a warning message regarding naming

    problems. After quitting this message, you will have to select the tab ‘NameProblems’ and examine the situation. The names of the ABAP proxy objects arelimited to 30 characters. Because of the prefix and the long names for therepository objects, the system has truncated them, which in turn led toduplicates.

    2.1.5 Resolve the naming conflicts, using the suggested values below: Area “Properties ”:

     ABAP Name Name in Integrat ion Bui lderZGROUP##CO_PURCHASE_ORDER_OUT PurchaseOrder_out

     Area “Name Problems”:

     ABAP Name Name in Integrat ion Bui lderZGROUP##PO_OUT_HEADER header

    ZGROUP##PO_OUT_ITEM item

    ZGROUP##PO_OUT_POREQUEST PurchaseOrderRequest

    ZGROUP##PO_OUT_PORESPONSE PurchaseOrderResponse

    ZGROUP##PO_OUT_RECORDSET Recordset

    ZGROUP##PO_OUT_RETURN Return

    ZGROUP##PO_OUT_ITEM_TAB Item (table type)

    ZGROUP##PO_OUT_RETURN_TAB Return (table type)

    ZGROUP##PO_OUT_RECORDSET_TAB Recordset (table type)

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    3/6

      3

    Note:You may choose your own names, but the master solution for the program willwork only with these suggested names.

    2.1.6 Examine the rest of the ABAP class and generated DDIC objects. Then, saveand activate your proxy (ignore warnings about reserved fields “key” and“return”.)

    2.1.7 There is nothing more to be done with the proxy. The classes and structuresgenerated for an outbound proxy cannot be changed. They can only bereferenced and executed. To execute the proxy, we will write an ABAP report.This will be presented in a later step.

    Step 3 – Directory

    The Integration Directory configuration steps should be identical to Exercise 2, the only exceptionis the sender information. In this case the Sender Service name should be the Business Systemof the WebAS system (‘Training’) as defined in the System Landscape Directory.So you have to create a Receiver Determination, an Interface Determination and a Receiver

     Agreement like shown below.Don’t forget to activate all objects. 

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    4/6

      4

     

    Step 4 – Test

    To test the ABAP proxy, we will use an ABAP report.

    4.1 Log on to R/3 system with SAPGUI.

    4.2 In transaction SE38, create a report with the name “Z_XIWS_##_SEND_PO” (Type:executable program).

    4.3 Assign Package “ $TMP” and click “Local object” button.

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    5/6

      5

     

    4.4 Examine file “Z_XIWS_##_SEND_PO.abap”, provided to you (to be found in your group## folder on the XI server drive). In the type definition section, adjust the type names accordingto your own proxy types in the system. Replace all occurrences of ## with your groupnumber.

    4.5 Cut and paste the contents of your file into the source code area.

     Alternatively you may use the following menu in your program in SE38 to upload the mastersolution: “Utilities / More Utilities / Upload/Download / Upload” and then edit it.

    4.6 Perform a syntax check. Save and activate the report.

    4.7 Execute/test the report. Change the vendor to your assigned vendor id.

    4.8 In transaction SXMB_MONI on the Integration Server, you can view the status of the

    message. Notice that you may see several entries for your message, representing therequest and response in the integration engines (depending on the customizing):- Integration Engine located in the main integration server client (800)- Integration Engine located in the application client where the proxy resides (821).

  • 8/18/2019 Exercise 4 - ABAP Proxy to BAPI

    6/6

      6

     Appendix: naming conventions and terminology

    Exercise 4

     Area Obj. type Object name Descript ionSLD n/a n/a No SLD objects

    Int. Rep. NS urn:xiworkshop:group##:webapp All objects same as exercise 2

    XSD PurchaseOrderCombined

    Msg.type PurchaseOrderRequest

    Msg.type PurchaseOrderResponse

    Msg.int. PurchaseOrder_out

    Msg.int. PurchaseOrder_out_async

    XSLT POReq__Z_BAPI_PO_CREATE_req.xsl

    XSLT ZBAPI_PO_CREATE_resp__POResp.xsl

     Archive PurchaseOrder__Z_BAPI_PO_CREATE

    Int.map PO_out__Z_BAPI_PO_CREATE

    Int.map. PO_out_async__Z_BAPI_PO_CREATEContext Vendor

    Int. Dir scenario TBIT40_WORKSHOP_## Reuse scenario container

    service XIWS_web_purchasing_## Business service – no party

    640-cli Prefix ZGROUP## Prefix for proxy objects

    proxy ZGROUP##CO_PURCHASE_ORDER_OUT PurchaseOrder_out

    ZGROUP##PO_OUT_HEADER header

    ZGROUP##PO_OUT_ITEM item

    ZGROUP##PO_OUT_POREQUEST PurchaseOrderRequest

    ZGROUP##PO_OUT_PORESPONSE PurchaseOrderResponse

    ZGROUP##PO_OUT_RECORDSET Recordset

    ZGROUP##PO_OUT_RETURN Return

    ZGROUP##PO_OUT_RECORDSET_TAB Recordset (table type)

    ZGROUP##PO_OUT_RETURN_TAB Return (table type)

    ZGROUP##PO_OUT_ITEM_TAB Item (table type)

    Program Z_XIWS_##_SEND_PO Program for testing the proxy

    File sys Program Z_XIWS_##_SEND_PO.abap Source code template for program

    R/3 RFC ZBAPI_PO_CREATE RFC wrapper