Anda di halaman 1dari 20

InfoSpoke Creation and Loading the File Generated via FTP

Applies to:
SAP BI 3.5 and SAP BI 7.0. For more information, visit the Business Intelligence homepage.

Summary
Sometimes the data loaded into BI objects are to be exported to external servers. This document talks about one such scenario where-in data from BI (info cube / info objects) is to be loaded on to external non-SAP system via FTP server. Data from BI objects is put onto application server in the form of Flat File. For this operation InfoSpoke is used. To load file generated by info spoke onto a specific path, Logical path is created using FILE transaction. Further the document covers the use of a Program to load files to external server via FTP. Author: Sanika Deo

Company: Patni computer system Ltd. Created on: 30 September 2008

Author Bio
Sanika Deo is working in Patni computer system Ltd. Currently she is working on SAP BI 3.5.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 1

InfoSpoke Creation and Loading the File Generated via FTP

Table of Contents
Scenario Explained.............................................................................................................................................3 Problem Statement .........................................................................................................................................3 Solution Steps .................................................................................................................................................3 Extract Data from BW objects using Info Spokes...............................................................................................4 InfoSpoke Creation .........................................................................................................................................4 InfoSpoke Tabs explored....................................................................................................................................5
GENERAL TAB............................................................................................................................................................5 DESTIONATION TAB ..................................................................................................................................................6 INFOOBJECTS TAB....................................................................................................................................................7 SELECTION TAB.........................................................................................................................................................8 TRANFORMATION TAB..............................................................................................................................................8

Using BADI to enhance info spoke extract structure..........................................................................................9 Creation of logical path to store file on a specific location................................................................................12 Loading data into Database Table ................................................................................................................12 Loading data into File....................................................................................................................................13 Using FILE T-Code to create Logical Paths..................................................................................................14
Creation of Logical File Path Definition ......................................................................................................................15 Assign a Physical Path to a Logical Path...................................................................................................................15 Define a Logical File Name Definition ........................................................................................................................16

Store file on external server via FTP ................................................................................................................16 Automate the process via Process Chain.........................................................................................................18 Related Content................................................................................................................................................19 Disclaimer and Liability Notice..........................................................................................................................20

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 2

InfoSpoke Creation and Loading the File Generated via FTP

Scenario Explained
Problem Statement
We need to extract data from a particular cube/info object to external file or Data base on another application server. For Example: Data from info Object 0PROJECT is to be loaded into a flat file on a specific path /interface/BWD/outbound. The file structure should be as given below in the table. The file created is to be loaded to external application server say for example DEVBP01.ccc.coopcam.com. Note: The text in blue indicates requirement specifications. The given file format is as follows: File Name: 0PROJECT.CSV

Fields in the file


Project ID Project External ID Description (Text) Project Status Indicator Field Currency Company Code

Info Object
0PROJECT-0PROJECT 0PROJECT- 0PROJECT_EX 0PROJECT 0PROJECT- 0STATUSSYS0 0PROJECT- 0OBJ_CURR 0PROJECT- 0COMP_CODE (Restricted for 2400, 2500, 2700 and 6600.)

Profit Center

0PROJECT- 0PROFIT_CTR (Restricted for 2430, 2440, 2525, 2780 and 6615.)

Following block diagram will explain the scenario well.

Solution Steps
Extract data from BW objects to external application server using Info Spokes. Using BADI to get required field (Text) into the file structure of Info Spoke. Creation of Logical path and Logical file to store the generated file on specific path of Application server in AL11 transaction. Using program RSFTP002, stored the file on external application server via FTP. Process Chain to make this process automated.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 3

InfoSpoke Creation and Loading the File Generated via FTP

Extract Data from BW objects using Info Spokes


InfoSpoke Creation Transaction to create/maintain infospoke RSBOH1 RSA1 -> Tools -> Open Hub Service -> Create Info Spoke

Enter technical name of info spoke to be created. E.g.: 0ZPROJECT (To get the data from 0PROJECT info Object into flat file)

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 4

InfoSpoke Creation and Loading the File Generated via FTP

InfoSpoke Tabs explored


GENERAL TAB
In general tab, we define the BI object from which we have to extract data and the destination where the data will be stored. In this tab we can define if the mode of extraction and lines per data package.

Here we will choose info Object (Attribute).

We need to include text of info object along with other attributes as mentioned in the file format but when we select Info object (attributes) we have no option to select text of info object. Due to this we need to write BADI to include text in the extracted data. Enter the info Object of which data is to be extracted into flat file. Extraction can be Full or Delta mode.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 5

InfoSpoke Creation and Loading the File Generated via FTP

DESTIONATION TAB In Destination tab we can specify whether to store data in the form of DB Table or As a File on Local System or Application Server.
Specify a logical target system. Logical system is for Open Hub monitoring. The open hub monitor groups the requests according to target system, open hub destination, and InfoSpoke.

If we select DB table, a table /BIC/0H0PROJECT is automatically created. Data is extracted into this table. Data can be viewed by SE11/SE16.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 6

InfoSpoke Creation and Loading the File Generated via FTP

If we select File, then we can create a file on local system or on application server. There is a default path for application server where the file is stored. To store the file on a specific path, we need to use Logical Paths. Note: Details of File option is covered in further topic Logical Path.

INFOOBJECTS TAB In this tab we can select the fields from the BI object which we need to extract into flat file. We will select all the fields mentioned in the above table from available source fields of Info Object. These will appear as the columns in file or table based on selection. In case of Cubes, all the navigational attributes which are switched on, are available in these selections.

This will be structure of File or Table generated.

Note: Here we have no filed to select text for 0PROJECT. Using BADI we can bring in text in the file. In Info Objects (Text), we can select Info Object value and its description only.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 7

InfoSpoke Creation and Loading the File Generated via FTP

SELECTION TAB In this tab we can restrict the data being extracted from BI Objects. In above mentioned scenario we want to extract data for few Profit Centers and company Code. So we will restrict the data in this Tab.

E.g.: Info Spoke will get all the data from 0PROJECT where 0PROFIT_CTR = 2430, 2440, 2525, 2780, 6615 and Company Code is 2400, 2500, 2700, 6600. If we have to extract a particular record, then we can exclude the selection by clicking on the Green = button. It will turn Red =. TRANFORMATION TAB
This tab has the option to implement BADI. If we select the check box then a BADI implementation is created. If no enhancement is to be done, no changes are done in this tab.

Save and activate the infospoke. This infospoke is ready to extract data from Info Object 0PROJECT. But the extract file will not have Text field in it. To add the field text, we will implement a BADI via Transformation Tab explained next.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 8

InfoSpoke Creation and Loading the File Generated via FTP

Using BADI to enhance info spoke extract structure


As seen above, if we want to include texts of a particular Info Object in Info Spoke generated file then either we have to create separate info Spoke for texts (0PROJECT(texts)) or we have to modify Target Structure of Info Spoke and populate texts in Target file. In above scenario we cannot create info Objects (text) as we need to add attributes of Info Objects in the file. To implement BADI, we have to mark a check in this tab.

This is the target structure created on activating.

This is the BADI implementation created automatically

It asks for the confirmation and activation of the info spoke. Due to which a target structure is generated along with a BADI implementation as shown above. On activation it opens the Transaction of BADI Implementation.

In the implementation, we have to specify filter. In filter we specify our Info Spoke name. An implementing class is created. When we click on implementing class we can write code in method.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 9

InfoSpoke Creation and Loading the File Generated via FTP

Before that we need to enhance the existing target structure which is generated when we save the BADI Implementation. As we need to populate text in some filed of the target structure. So we need to add a filed to populate text in target structure. This target structure is automatically generated.

Target Structure. Double click on it to change the target structure.

We will add a field PROJECT_TXT in the target structure as shown below. This will populate description of info Object in the info Object generated file.
Note: To add a field to existing structure make use of append structure or best option is to create a structure similar to target structure and add this newly created structure in the Target Structure filed in Info Object. This is because, when info Spokes are transported the enhanced structure is not transported, so the BADI ends up giving error.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 10

InfoSpoke Creation and Loading the File Generated via FTP

Writing ABAP code in BADI method

We will write the following code in IF_EX_OPENHUB_TRANSFORM~TRANSFORM method.

This is the source structure This is the target structure

This gets the data from text table of info Object into output table of info Spoke.

In the above code we are populating Text from 0PROJECT text table for each 0PROJECT value.Save and activate the BADI Implementation.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 11

InfoSpoke Creation and Loading the File Generated via FTP

Creation of logical path to store file on a specific location


Note: A need it implement Logical Path was: if a file is to be generated from an infospoke, then by default on application server it goes to the DIR_HOME:/usr/sap/BWD/DEVBMGS00/work directory. So to store it onto a specific path we need to implement Logical Paths.

We can extract the data from BW Objects either in a Data Base Table or a file. Loading data into Database Table A database name is generated, which is created when the info spoke is executed. We can view the database table from SE11.
Delete Table Before Extraction: Every time the info spoke is executed, the table contents will be deleted. Technical Key: This includes the OHREQUID, DATAPAKID, and RECODE in the key field. Notification to third Party tool: When this flag is set the third party tool is notified to start extraction.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 12

InfoSpoke Creation and Loading the File Generated via FTP

Loading data into File We can store the file onto local system or on Application server. When we uncheck the checkbox of Application Server, the file can be stored on local system.

When we check as Application server, a default path of application server (AL11) appears where the file is stored.

If we want to change the default path we need to go for Logical File Name

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 13

InfoSpoke Creation and Loading the File Generated via FTP

Here we have to specify the logical Path name created by using t-code /nFILE

Using FILE T-Code to create Logical Paths


Transaction code used to create logical Paths is FILE.

Step 1 Step 2

Step 3

Step 1: Here we will create a logical file path definition. Step 2: Then we assign a physical path to a logical path Step 3: Define a logical file name definition

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 14

InfoSpoke Creation and Loading the File Generated via FTP

Creation of Logical File Path Definition


On initial screen, if we click on new entry we get following screen wherein we can define logical Path definition.

Then we have to choose the Syntax group definition:

As syntax of out file path is of type UNIX, the Syntax Group will be UNIX. Assign a Physical Path to a Logical Path After creating a logical file path definition, we will assign a physical path to logical path.

The path (AL11) on which we want to store our file generated by info Spoke is /interface/CCD/BWD/outbound Now when this will be transported to quality the path generated should be /interface/CCQ/BWQ/outbound

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 15

InfoSpoke Creation and Loading the File Generated via FTP

To make it generic across landscapes we can use system defined variables. <SYSID> will contain the current BW instance name. <FILENAME> this will be replaced by a value we will define in the next step. Define a Logical File Name Definition

<FILENAME> will be replaced by the contents of Physical file. We specify the data format and the application component. The Logical file name i.e. ZPROJECT will be specified in the info spoke. So that the info spoke will store the file 0PROJECT.CSV on path (AL11) /interface/CCD/BWD/outbound/0PROJECT.CSV

Store file on external server via FTP


Program RSFTP002 is used to perform operations from BW on a specific server via FTP commands.

Using this program we can store the file generated by info spoke on external server. This program takes input as user name, password, Host name of remote server and Command to be performed.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 16

InfoSpoke Creation and Loading the File Generated via FTP

User name of remote Host Password Host name

FTP Command

SAPFTPA will accept files form application server. SAPFTP will accept file from

To put file from application server to remote host the command is put /interface/CCD/BWD/outbound/0PROJECT.CSV /SAP/0PROJECT.CSV To check it the file is placed we can use command dir SAP

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 17

InfoSpoke Creation and Loading the File Generated via FTP

Automate the process via Process Chain


To make this entire process automated we will create a process chain. The first process type is to execute the info spoke to generate a file on application server (AL11). The second process type is to execute the program RSFTP002, to place the file from application server (AL11) to external server via FTP.
This process type is to execute info Spoke, t place the file on application server (AL11)

This process type stores the file from application server to FTP server using program RSFTP002

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 18

InfoSpoke Creation and Loading the File Generated via FTP

Related Content
Following reference tells more about Info Spokes and BADI http://help.sap.com/saphelp_nw04/helpdata/en/c5/03853c01c89d7ce10000000a11405a/frameset.htm Some Problems faced with respect to Info Spokes https://www.sdn.sap.com/irj/sdn/thread?messageID=5953843 https://www.sdn.sap.com/irj/sdn/thread?threadID=64204 https://www.sdn.sap.com/irj/sdn/thread?threadID=325605 For more information, visit the Business Intelligence homepage.

SAP DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 19

InfoSpoke Creation and Loading the File Generated via FTP

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 DEVELOPER NETWORK | sdn.sap.com 2008 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 20

Anda mungkin juga menyukai