Вы находитесь на странице: 1из 12

Automation of Publishing Formatted Query Output to Destination Server

Applies to:
SAP Netweaver BW. For more information, visit the Data Warehousing homepage.

Summary
In certain business requirement, the users might want the output of the query with formatting changes to be published to a destination Server. And in most cases they might want the fields to be aligned in a particular format which cannot be done using the standard Query Designer. For example if they wanted to see Key figures between characteristics without changing the report layout. This article will be a step by step guide on how to automate such a process. Author: Santosh Durai

Company: Hewlett-Packard NZ Created on: 8 October, 2010

Author Bio
Santosh is working as a SAP Netweaver BW consultant for Hewlett-Packard New Zealand. He has an experience of around 5 years in SAP.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Table of Contents
Introduction ......................................................................................................................................................... 3 Process Flow ...................................................................................................................................................... 3 Use of APD ..................................................................................................................................................... 4 Creating APD Flow.......................................................................................................................................... 4 Testing APD .................................................................................................................................................... 5 Executing APD ................................................................................................................................................ 5 Checking the contents of Transactional ODS ................................................................................................. 6 Restrictions on APD ........................................................................................................................................ 6 Overcoming the restriction of Selection Screen .............................................................................................. 6 Formatting Query Output .................................................................................................................................... 8 Process Chain Flow ............................................................................................................................................ 9 Restriction on Info-spoke ................................................................................................................................ 9 Overcoming Restriction on info spokes .......................................................................................................... 9 Periodic Automation .......................................................................................................................................... 10 Adhoc Automation: ........................................................................................................................................... 10 Related Content ................................................................................................................................................ 11 Disclaimer and Liability Notice .......................................................................................................................... 12

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Introduction
In certain business requirement, the users might want the output of the query with formatting changes to be published to a destination Server. And in most cases they might want the fields to be aligned in a particular format which cannot be done using the standard Query Designer. For example if they wanted to see Key figures between characteristics without changing the report layout. This article will be a step by step guide on how to automate such a process in the below scenarios. 1.) Periodic Automation: Periodic intervals in which the query would be called, the output of the query would be formatted according to the requirement and then sent to the Application Server. 2.) Ad-hoc Automation: At Ad-hoc basis if the user wants to see the output sent to the application server, they just need to execute a transaction code which would in turn trigger the query; the output of the query would be formatted according to the requirement and then sent to the Application Server

Process Flow

1 Transaction Code

2 Process Chain
2.1 Start 3 APD FLOW 1. Start 3.1 Trigger Query 2.2 Call APD Flow 3.2 Load data from Query output to Transaction ODS

2.3. Loading Data from Transaction ODS to Standard ODS

2.4 Info spoke

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

APD Flow
Use of APD APD is used here to transfer the Query output contents to Transaction ODS. Since we cannot link a Query directly to a Standard ODS, we have to use Transaction ODS first to get the contents of the query and then load data to the Standard ODS. Then by using an Info spoke we can get the content of the Standard ODS and send it to an Application Server path. Note: Info-spoke cannot send the content of a Transactional ODS to a target destination address. Creating APD Flow T-Code for APD: RSANWB Use the Data source Use Query to read data to add the Query 9030. Use the Data Target Write data in Transaction ODS Object to get the Query output data transformed t o the Transactional ODS.

In the query properties select the variant which can be used to give the selection variable inputs to the query.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Create the transaction ODS only with those fields that has to be included in the CSV/Flat file and map those field in the Transformation in APD.

Testing APD Execute the APD and test the data in the Transactional ODS to see if the query output data has been captured in the ODS contents. Executing APD

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Checking the contents of Transactional ODS Go to properties and select Display Data

Restrictions on APD The query would not pop up any Selection Screen if it is executed through APD. If the Selection Screen has any Mandatory Variables, the APD would return with error. If the query has any hidden Key figures which is used in other Key figures, the other key figures will not have values populated in the Transaction ODS. Overcoming the restriction of Selection Screen Variants can be created for the Selection Screen Variables and then used in the Query Element of the APD. In this way the variant would populate the Selection Screen inputs for the Query. Once after the Variant has been defined, if the user requires changing the selection screen variant values, the variant has to be reconfigured. The below would describe how to change the Variant values.
Pre Requisite: The same variant that used in the Query properties while defining APD must be used for

saving the new selection values For Example lets take the example of Report 9030 whose input selections have to be changed and the variant that is used in APD is YVAR_9030. Execute Report 9030 in BEx Analyser

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Enter all the Selection Screen Values and click the Save as Variant button. It is important to enter all mandatory values. 1. Store Selection Variables in Variant YVAR_9030

Enter the Variant Name as YVAR_9030 always. Enter a description. Click the Save button. A dialog box asking to overwrite variant YVAR_9030 will pop up. Please click yes every time.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Formatting Query Output


The update rules present between the Transaction ODS and the Standard ODS can be used to do any formatting changes. (Start and Update routine) The alignment of the CSV file can be changed in the info spokes Info object definition tab.

The fields on the Right window would appear in the CSV /Flat file. The fields on the left window would be hidden. The Right window can be used to align the order in which the fields need to appear in the output file.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Process Chain Flow


The process chain would first trigger the APD, which would in turn populate value to Transaction ODS from the Query output. Since we cannot use Transaction ODS to send data to the Application Server, we have to load data from the Transaction ODS to the Standard ODS. Later an Info spoke can be used to get the content of the Standard ODS and push the data as a flat file to the Application server.

Restriction on Info-spoke Info-spoke cannot be used to send data to Local system (Desktop or any path in the local system) Overcoming Restriction on info spokes In such scenarios write an ABAP Program using the function Module GUI_DOWNLOAD to get data from the Active ODS table of the Standard ODS and send the content to the Local System.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Periodic Automation
In the Start Variant scheduling option in process chain, make the Selection to Periodic.

Adhoc Automation:
Create a Program which uses the Standard Function Module API_CHAIN_START, to call the Process Chain. A transaction code can be created to call this program. Whenever the transaction code is executed the program would trigger the process chain and in turn the APD and the Query.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

Related Content
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/156ab490-0201-0010-1181-894491f2baf6 http://help.sap.com/saphelp_nw04/helpdata/en/49/7e960481916448b20134d471d36a6b/content.htm For more information, visit the Data Warehousing homepage

SAP COMMUNITY NETWORK 2010 SAP AG

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

Automation of Publishing Formatted Query Output to Destination Server

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 2010 SAP AG

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

Вам также может понравиться