Você está na página 1de 16

APDs and Open hubs Sending SAP BW Data to 3rd Party

Applies to:
NetWeaver SAP BW 7.0. For more information, visit the EDW homepage.

Summary
There are occasions when we need to send data to 3 party systems such as Teradata or Datastage from SAP BW system. To achieve this, SAP has provided Open Hubs wherein we can define the containers to store data, i.e., either rd a flat file or a database table, and facilitate the extraction of data to 3 party systems through these systems. In addition to this, certain requirements mandate sending status details along with the actual data to 3 party systems. One such scenario is described here along with the solution devised. Author: Debanshu Mukherjee
rd rd

Company: IBM Created on: 22 April 2011

Author Bio
Debanshu Mukherjee is working as Lead SAP BW Consultant with IBM India Pvt Ltd. and (c) He has around 6 yrs of rich experience in BW implementation, development and rollout projects.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

APDs and Open hubs Sending SAP BW Data to 3rd Party

Table of Contents
Introduction ......................................................................................................................................................... 3 Requirement: ...................................................................................................................................................... 3 Solution: .............................................................................................................................................................. 4 Step by Step Solution: ........................................................................................................................................ 4 Step 1: Create Z info-objects for direct update DSO. ..................................................................................... 4 Step 2: Create a direct update DSO which will act as the target for APD. ..................................................... 6 Step 3: Create APD......................................................................................................................................... 6 Step 4: Create an OHD for storing data for the latest DTP run. ................................................................... 10 Step 5: Create the Transformation and DTP from the Direct Update DSO to the Status OHD. ................... 10 Step 6: Test by Executing the APD and Checking Data. .............................................................................. 11 Related Content ................................................................................................................................................ 15 Disclaimer and Liability Notice .......................................................................................................................... 16

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

APDs and Open hubs Sending SAP BW Data to 3rd Party

Introduction
There are occasions when we need to send data to 3 party systems such as Teradata or Datastage from SAP BW system. To achieve this, SAP has provided Open Hubs wherein we can define the container to store data, i.e., either rd a flat file or a database table, store data in these containers and facilitate the extraction of data to 3 party systems through these systems. In addition to this, certain requirements mandate sending status details to 3 party systems along with the actual data. One such scenario is described here along with the solution devised:
rd rd

Requirement:
Facilitating the status details for the latest load into the Master data Open Hub for Profit Center. In other words, we have an Open Hub defined, ZPFT_CTR, to send the profit center master data from SAP rd BW to 3 party.

Now 3 party also requires SAP BW to send the latest load details such as: 1. Request ID for the latest DTP run which extracts data from SAP BW target and stores it into the Open Hub. 2. The no of records extracted with the latest run. 3. Calday 4. OHD Name

rd

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

APDs and Open hubs Sending SAP BW Data to 3rd Party

Solution:
To cater to the above requirement, we can use a combination of APD and Open Hub. APD: The Analysis Process Designer is a graphical tool for modeling multilevel "Analyses Processes". It is an interactive modeling (drag & drop) workbench for multilevel Data Analysis Processes APDs empower us to do the following: 1. Creation of new information out of existing data 2. Transformation of data 3. Writing back new data to BW database or operational system (CRM) With APDs Different kinds of sources allow the possibility of ad-hoc analyses. We are going to leverage this feature by taking a standard SAP table as a source and storing the data in a DSO. APD: This APD will take the standard SAP view for DTP, RSBKREQUEST_V, as source and store data in a direct update DSO (APDs only support direct update DSO) or Flat file.

Note: We could also use table RSBKREQUEST for DTP details but not all fields in this table are linked to data elements which is a mandate for using this as a source in APD.

Thereafter we can send data from the direct update DSO or flat file to another Open Hub which will store the rd status information for the 3 party. Therefore in essence, we need to create the following objects in BW: 1. Z info-objects for direct update DSO. 2. Direct update DSO 3. APD 4. Open Hub for status details

Step by Step Solution:


Step 1: Create Z info-objects for direct update DSO. Here we need to create 3 Z info-objects: a) ZDTPREQID This will store the latest DTP request ID. Data Type NUMC Length 10 (The length of DTP Req in RSBKREQUEST_V view is 4510).

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

APDs and Open hubs Sending SAP BW Data to 3rd Party

b) ZOHDNAME This will store the OHD name. Data Type NUMC Length 45 (The length of target object in RSBKREQUEST_V view is 45)

c) ZOHRCDTRS This will store no of records transferred to OHD Aggregation will be default (Summation)

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

APDs and Open hubs Sending SAP BW Data to 3rd Party

Step 2: Create a direct update DSO which will act as the target for APD. We need to create a direct update DSO with the Z info-objects created. DSO: ZPFCT3PR Key field: ZDTPREQID (As this would be unique with every load) Data fields: ZOHDNAME, 0CALDAY, ZOHRCDTRS

Step 3: Create APD. Now we will create an APD which will take the data from the view RSBKREQUEST_V and store in the direct update DSO ZPFCT3PR Tcode: RSANWB 1. Create an new APD under the Generic folder:

2. We will drag and drop the Read Data from Database table icon to the right panel.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

APDs and Open hubs Sending SAP BW Data to 3rd Party

3. Provide the description and the database view name:

4. Now we need to inform the APD as to which DTP requests it has to pick. For that we need to drag a filter, connect it with the DTP View RSBKREQUEST_V and provide details (right click -> properties)

While providing details for this filter, we need to transfer the field, TGT Name of data target for DTP, from the list of fields to the selection and provide value as ZPFT_CTR.

Actually what this is doing is that it is selecting only those records from the RSBKREQUEST_V view where the target is the profit center open hub. In essence the DTP which is feeding the Open Hub for actual profit center master data.

5. Now we need to select the latest run details for the DTP. To achieve this we will be sorting the data which is picked after the filter restriction: For that we need to drag the sort data icon, connect it with the OHD Name filter and provide details (right click -> properties)

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

APDs and Open hubs Sending SAP BW Data to 3rd Party

While providing details for this sort, we need to transfer the field, REQUID Request ID for DTP, from the list of fields to the selection and check the box for the descending option.

This will bring the latest DTP run record on the top. 6. Now we need to write drag the ABAP Routine icon, connect it with the sort and write a small routine which will extract only the top row from the table.

Before providing the details for the routing, drag the DSO icon, provide details and connect it with the routine, this will ensure that both source and target structure for the routine are connected to it.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

APDs and Open hubs Sending SAP BW Data to 3rd Party

Here are the routine properties: Source Fields: REQUID, TGT, LINESTRANSFERRED, TSTMP_FINISH Target Info-objects (Direct update DSO Info-objects): ZDTPREQID, ZOHDNAME, ZOHRCDTRS, 0CALDAY

ABAP Code: Please see the ABAP code at the end. 7. Now assign the target info-objects to the source fields in the transformations from routine to the DSO

8. Now the APD is ready to be activated. Save and Activate the APD: While saving please provide the technical name and description: Tech Name: Z_APD_MSRT_DAYA_3RD_PRTY Description: Profit Center (Attribute) Load details for EDW

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

APDs and Open hubs Sending SAP BW Data to 3rd Party

Step 4: Create an OHD for storing data for the latest DTP run. This OHD will extract data from the direct update DSO ZPFCT3PR. Select database table as destination type.

Select database table as destination type.

Step 5: Create the Transformation and DTP from the Direct Update DSO to the Status OHD.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 10

APDs and Open hubs Sending SAP BW Data to 3rd Party

Step 6: Test by Executing the APD and Checking Data. For this first we will trigger the DTP which loads data from Profit center master data to the Open Hub ZPFT_CTR.

This DTP generated Req ID 111213 No of data transferred = 2462 Day of run - 22.04.2011 Target OHD ZPFT_CTR

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 11

APDs and Open hubs Sending SAP BW Data to 3rd Party

Lets trigger the APD and check the data in the OHD

Now execute the DTP from the direct update DSO ZPFCT3PR to the Open Hub ZPFCT3PR

Lets check the data in the OHD table /BIC/OHZPFCT3PR We can see that data is accurately transferred from RSBKREQUEST_V view :

Now 3 party can access these details. These details can be used for reconciliation purposes such as comparing no of records extracted from the main OHD and no of records extracted from this status OHD.

rd

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 12

APDs and Open hubs Sending SAP BW Data to 3rd Party

ABAP Routine Code:


Begin of SAP default code: REPORT RSAN_WB_ROUTINE_TEMP_REPORT . TYPES: BEGIN OF y_source_fields , REQUID TYPE RSBKREQUID , TGT TYPE RSBKTGTNM , LINESTRANSFERRED TYPE SYTABIX , TSTMP_FINISH TYPE RSTIMESTMPL , END OF y_source_fields . TYPES: yt_source_fields TYPE STANDARD TABLE OF y_source_fields . TYPES: BEGIN OF y_target_fields , REQUID TYPE /BIC/OIZDTPREQID , TGT TYPE /BIC/OIZOHDNAME , LINESTRANSFERRED TYPE /BIC/OIZOHRCDTRS , TSTMP_FINISH TYPE /BI0/OICALDAY , END OF y_target_fields . TYPES: yt_target_fields TYPE STANDARD TABLE OF y_target_fields . *---------- Begin of type definitions ------------------------------*TYPES: ... *----------- End of type definitions -------------------------------FORM compute_data_transformation USING it_source TYPE yt_source_fields ir_context TYPE REF TO if_rsan_rt_routine_context EXPORTING et_target TYPE yt_target_fields . *--------- Begin of transformation code ----------------------------* Data Declaration Data: ls_source type y_source_fields, ls_target TYPE y_target_fields, End of SAP default code: Begin of custom code: v_tim_stamp type TZNTSTMPS, v_dat type SYSTDATLO. * Processing blocks IF et_target[] is initial. read table it_source INTO ls_source index 1. IF sy-subrc = 0. * Assigning source fields to target fields ls_target-REQUID = ls_source-REQUID. ls_target-TGT = ls_source-TGT. ls_target-LINESTRANSFERRED = ls_source-LINESTRANSFERRED. v_tim_stamp = ls_source-TSTMP_FINISH. * Convert the timestamp to date CALL FUNCTION 'RS_TBBW_CONVERT_TIMESTAMP' EXPORTING

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 13

APDs and Open hubs Sending SAP BW Data to 3rd Party

I_TIMESTAMP = v_tim_stamp IMPORTING E_DAT = v_dat. IF sy-subrc = 0. ls_target-TSTMP_FINISH = v_dat. ENDIF. APPEND ls_target TO et_target. clear : ls_source, ls_target. ENDIF. ENDIF. *---------- End of transformation code -----------------------------ENDFORM. ** End of custom code:

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 14

APDs and Open hubs Sending SAP BW Data to 3rd Party

Related Content
Analysis Process Designer (Apd) Step By Step - Business Intelligence SAP HELP Analysis Process Designer A Simple Guide to Using Analysis Process Designer Analysis Process Designer (APD): Part - 1 Analysis Process Designer (APD): Part - 2 For more information, visit the EDW homepage.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 15

APDs and Open hubs Sending SAP BW Data to 3rd Party

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 16

Você também pode gostar