Applies to:

SAP BPC 7.5 / SAP BW 7.3x 

Summary:

This document is a step by step guide to implement a BPC Data Manager Package to download data to a FTP server

Author(s)          : Lijo John

Company         : Infosys Limited

Created on       : 09 August 2013

Author Bio:

EAME_u327502_LThumb.jpg

Lijo John works as Senior SAP Consultant with Infosys Limited. He has 7 years of experience in IT Consulting Industry and during this time he has worked majorly on SAP NetWeaver BW, Business Objects and BPC. He has worked on multiple implementation projects.

Table of Contents

Introduction

We have a SAP delivered Data Manager package in BPC 7.5 for uploading flat file data into a BPC application directly from an FTP server. However a similar standard package for downloading data directly into an FTP server in flat file format is currently not available. This document tries to address this limitation by providing a step by step guide to create a custom data manager package to implement this functionality.

Standard BPC Data Manager Packages for data download

Before getting into the details of the custom package, let’s look into the standard ways of downloading transactional data in BPC 7.5.

The two standard approaches of exporting transactional data to a flat file in BPC 7.5 are…

Approach 1 : Export transactional data to file service and then download to local computer

Approach 2: Export transactional data to the backend BW application server and then download to local computer through BW transactions/Database level file transfer

Limitations

  • Both approaches practically can’t handle huge data volumes due to un manageable sized output files when data volume increases.
  • Both approaches can’t split huge data downloads automatically into multiple manageable sized target files
  • In both approaches we need to define a transformation file even for one to one mappings.
  • In approach 1, the actual download to the local computer runs in foreground and needs the user doing this activity to be logged in into the system.
  • In approach 2 , retrieving the files from the application server would require involvement of multiple teams like BW basis/support teams and Database teams
  • Both approaches can’t download data directly to an FTP

Custom FTP Data Download Package

The idea here is to create a flexible BAdI based custom data manager package that can overcome the above said limitations and download data directly to an FTP server.

Key functionalities of the custom package

  • Ability to download huge data volumes.
  • Ability to split huge data downloads into multiple manageable sized target files.
  • Ability to handle the number of records in the downloaded file, the field separator to be used etc. (like COMMA or SEMICOLON)
  • Ability to schedule the download
  • No transformation files required for download
  • Direct download to FTP server. No dependencies on technical teams to get the files out of the application server/file server.

Limitations of the custom package

  • This package can be used only for simple data download without any transformations since we don’t use a transformation file like in the standard packages.

Step by Step Implementation Guide

Defining the data manager pacakge

Login to your BPC excel client and create a new data manager package as shown below.

  • You can either use the sap delivered process chain as shown below or create your own if your organization policies mandates it.
  • The task type can be a User Package or an Admin package based on your requirements.
  • You can choose your own package name, group and description

DMPKG 1.jpg

Once the package is created and saved, open the package again with modify option as shown below and navigate to the advanced section

DMPKG 2.jpgDMPKG 3.jpg

Copy paste the below PROMPT and TASK definitions into the editable area in the advanced section.

  • The first PROMPT definition (highlighted below) should be modified as per the dimensions of your application.
  • Also ensure you change the application name to your BPC Application. In this document we use an application called ‘DEMO_APPLICATION’

PROMPT(SELECTINPUT,,,,”GEOGRAPHY,PRODUCT,YEAR”)

PROMPT(TEXT,%FTPLOC%,”FTP Server :”)

PROMPT(TEXT,%FTPUSR%,”FTP User ID  :”)

PROMPT(TEXT,%FTPPASS%,”FTP Password :”)

PROMPT(TEXT,%FOLDER%,”Folder to save the files :”)

PROMPT(TEXT,%FILENAME%,”File name to use :”)

PROMPT(RADIOBUTTON,%NUMREC%,”Maximum Number of Records Per File :”,1,{“1 Million”,” 0.75 Million”,” 0.5 Million”},{“1″,”2″,”3”})

PROMPT(RADIOBUTTON,%DELIM%,”Delimiter to use :”,1,{“COMMA”,” SEMICOLON”},{“1″,”2”,})

INFO(%EQU%,=)

INFO(%TAB%,;)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,TAB,%TAB%)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,EQU,%EQU%)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,SUSER,%USER%)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,SELECTION,%SELECTION%)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,SAPPSET,%APPSET%)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,SAPP,DEMO_APPLICATION)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,LOGICFILENAME,FTP_DOWNLOAD.LGF)

TASK(/CPMB/G_D_M_TD_NC_SMP_WSO_LOGI,REPLACEPARAM,FTPLOC%EQU%%FTPLOC%%TAB%FTPUSR%EQU%%FTPUSR%%TAB%FTPPASS%EQU%%FTPPASS%%TAB%FOLDER%EQU%%FOLDER%%TAB%FILENAME%EQU%%FILENAME%%TAB%NUMREC%EQU%%NUMREC%%TAB%DELIM%EQU%%DELIM%)

Once done, click OK and Save the package as shown below.

DMPKG 4.jpg

Defining the script logic to trigger the BAdI

Login to the BPC Administration client and navigate to the script logic section of the application for which the package is being developed.

SCript Logic 1.jpg

Create a new script logic as shown below.

SCript Logic 2.jpg

Copy paste the below script logic definition into the editable area. Once done validate and save the logic as shown below.

*START_BADI FTP_DOWNLOAD

QUERY = OFF

WRITE = OFF

CHKOPT = $CHKOPT$

FTPLOC = $FTPLOC$

FTPUSR = $FTPUSR$

FTPPASS = $FTPPASS$

FOLDER = $FOLDER$

FILENAME = $FILENAME$

NUMREC = $NUMREC$

DELIM = $DELIM$

*END_BADI

SCript Logic 3.jpg

Defining Custom Logic BAdI

In SE19 transaction, navigate to your enhancement spot for Custom Logic BADIs and click change

Create a new custom logic BAdI implementation by following the steps below

Custom BADi 1.jpg

Click create BAdI implementation button

Custom BADi 2.jpg

Provide the details as shown below. You can chose your own BAdI implementation name and class name.

Custom BADi 3.jpg

Set the Implementation as Active

Custom BADi 4.jpg

Create a filter value for the BAdI. The filer Value should be same as that of the BAdI name mentioned in the Script Logic START_BADI Keyword.

Once done Activate the BAdI.

Custom BADi 5.jpg

Create an Implementation for the method as shown below.

Custom BADi 6.jpg

You would be prompted to enter the method definition/Code. Copy paste the code that is provided in attachment ‘FTP Download ABAP Code snippet.txt’.

Check for errors if any and correct them.

Custom BADi 7.jpg

Activate the BAdI Implementation and the Enhancement Spot.

Custom BADi 8.jpg

Running the new Data Manager Package

  • Login to BPC excel client and execute the package you just created.
  • The package will run and prompts for the below inputs.
  • Each of the input prompts are explained below.

FTP Server                : Name of the FTP server.

FTP User ID               : User ID that has access to connect to this FTP server and save files

FTP Password           : Password to connect to the FTP server with above user id

Folder to save files    : The folder in the FTP server in which the files needs to be saved. This folder needs to be created before running the package

Run PKG 1.jpg

File name to use                                 : Name of the target file in the FTP server that needs to be created/replaced with the data export

Maximum number of records per file : Allows the data export to be split into multiple manageable small files of desired number of records

Delimiter to use                                  : Allows to select a COMMA or SEMICOLON as delimiter for the file 

**You can always enhance the code to add more options like a PIPE separator etc.

Run PKG 2.jpg

The actual selection of the data that needs to be exported.

Run PKG 3.jpg

  • Once the prompts and data selections are done, you can run the package immediately or schedule it for a later point in time.

Run PKG 4.jpg

  • Monitor the package status for completion

Run PKG 5.jpg

Browsing the FTP location for the files

  • Login to the FTP server and navigate to the folder using your FTP client software.
  • You will be able to see the flat files created at the FTP location.
  • Depending on the ‘Maximum number of records per file’ parameter selected during the package execution, you might find one or multiple files.
  • In below example two files got generated since total 1.5 million records got downloaded and ‘Maximum number of records per file’ was given a 1 million.

FTP 1.jpg

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply