Vous êtes sur la page 1sur 4

Integrating SAP Data Services with SAP BusinessObjects Planning

This blog will describe a generic approach to integrate Excel-based reporting tools to SAP Data
Services. The benefit of this is that it allows the business user to invoke complex SAP Data
Services ETL processes from their familiar Excel-based reporting tools. This saves both time
and money by not requiring IT support to run SAP Data Services jobs and instead allowing
business users from finance and accounting to run jobs as needed. This can be particularly
useful for accountants during close, when they need to update the data more frequently.
This technique could be used for a variety of Excel-based reporting tools including SAPs BPC,
BusinessObjects Planning (SRC) and PeopleSofts NVision to name a few. An example will be
shown using Data Services to integrate with BusinessObjects Planning (SRC). Using this
approach the users were able to run a scheduled job from BusinessObjects Planning to invoke
a Data Services job, which then calls back to BusinessObjects Planning to load the table that
Data Services created.

BusinessObjects Planning Scheduler (Excel Based). End-user starts the process by running
a scheduled job.

SAP Data Services: Complex logic to prepare detail load table.

BusinessObjects Planning: Loads the table that was prepared by Data Services.
Process is complete.

The first step of this process is to create a Data Services batch script that could be invoked from
an external application. This is done by going to the Data Services Management Console and
selecting Batch Job Configuration. Next select the Export Execution Command action. This
will create a .bat script on the Data Services server that can be executed to run the job.
The second step is to build a process which can call the Data Services script from an external
server or workstation. Since the external computer does not have the Data Services software
installed, it cannot directly execute the batch file. In order to do this without installing client
software on the computer, we utilized standard windows scheduling functionality to have the
process scheduled, which then calls the Data Services job at the specified time.
The last step is to set up an Excel macro which can execute a batch file to set up the remote
schedule. The Excel macro has logic to determine the current time and increment by 1 minute
so as to give a slight time delay when scheduling the job.

Steps to perform in Excel


1. The Data Services job will need to be exported to a batch script on the Data Services
server. For this example, the batch job will be called DataServicesBatchJob.bat
2. A batch script called RunDSJob.bat is called, which is used to create the remote
schedule. This batch script utilizes a windows utility called schtasks.exe, which
schedules the Data Services batch job to run at the specified time.
a. The following is the contents of a typical script that might be used.

schtasks /create /sc ONCE /tn SCHEDULE /tr \\SERVER\log\DataServicesBatchJob.bat /ru


System /s bods2 /ST %1 /F

Command Line Parameter

Description

/create
/sc ONCE
/tn SCHEDULE
/tr \\server\share\
/ru System

Indicates to create a new schedule.


Indicates to run the schedule one time only.
Indicates the name of the schedule in Data Services.
Indicates the script to run on the remote server.
Specifies to use the current users credentials. A password is not
required when using the value of System
Specifies the server on which to schedule the job.

/s SERVER
/ST %1

Indicates the time in hh:mm 24 hour format. For example, to run the
job at 1:00 PM, use 13:00.admin this time is passed in from the Excel
Reporting tool.

b. In Excel a macro is created that can invoke the batch file.


The Excel report will have logic to assign the time to run the job. The time is set by incrementing the
current time by one minute.

Listed below is sample Excel logic that can be used to set the time ahead one minute. Additional logic
can be added as needed to accommodate other requirements.
Hour : (B2)

=IF(B3=0,HOUR(NOW())+1,HOUR(NOW()))

Minute: (B3)

=IF(MINUTE(NOW())=59,0,MINUTE(NOW())+1)

Time to start : Sent to


scheduler.
Hour: (B5) With leading zero if
needed.
Minute: (B6) With leading zero if
needed.

=B5&":"&B6
=IF(LEN(B2)=1,"0"&B2,B2)
=IF(LEN(B3)=1,"0"&B3,B3)

Listed below is sample Excel Macro logic that could be used to call the scheduled task. This Excel macro
could be invoked by any process with the reporting environment. For example, from BusinessObjects
Planning, it could be called by tying it to a batch report, which can then be scheduled. Other Excelbased reporting solutions have specific ways to expose macros, each of which can be used to call the
Data Services job. In this specific example, the date and time is passed through a parameter by using
the Cells() function, which takes the row and column in Excel to pass through. In this case there is logic
to skip the job on a specific day (Sunday). Other logic could be added as needed to schedule for
different combinations of day and time.

Public Sub runDIJob()


'Shell "C:\Documents and Settings\server\My
Documents\RunDSJob.bat " & Cells(4, 2)
If Weekday(Now()) = 1 Then
Debug.Print "skip"
Else
Shell "C:\RunJobDS.bat " & Cells(4, 2)
'DataServicesBatchJob.bat
Debug.Print "run"
End If
End Sub

Steps to perform in Data Services


If needed, the Data Services job can make a call back to the Excel-based reporting tool. In this case, I
will show using BusinessObjects Planning as an example. BusinessObjects Planning has a command
line interface to start scheduled jobs using a standard Web Service. In order to use this method, the Web
Planning must be configured.
From Data Services, the following lines would need to be added to a script.

exec('C:\BusinessObjectsPlannignSchedule.BAT',7160 ServerName '||G_PROCESSID,0);

In this script the Job ID, Server Name and process id are passed in as parameters. The server name is
used to switch between different environments (Dev, Test, Prod). The process id is passed in to run a
specific batch run. The Job ID is passed in and corresponds to the job that is defined in Planning. A file
called SchedulerCLI.exe will need to be copied to the same directory as the batch file. It does not require
any other software installation.

\\SERVERNAME\SHAREDIR\SchedulerCLI.exe run --jobid %1 --webaddress


http://%2/planningdesktop --system "Planning" --user administrator --password password -parameter 2 11 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?> <ScheduledTask
version=\"11.1\"><ImportTask> <SRCVars> <SRCVar> <Name>processid</Name>
<Value>%3</Value> </SRCVar> </SRCVars> </ImportTask> </ScheduledTask>" --parameter 5 11
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?> <ScheduledTask
version=\"11.1\"><ImportTask> <SRCVars> <SRCVar> <Name>processid</Name>
<Value>%3</Value> </SRCVar> </SRCVars> </ImportTask> </ScheduledTask>"

In the example below, the Data Services job would run job id 7160, which would then complete the data
load process from BusinessObjects Planning to Data Services and finally back to BusinessObjects
Planning.

Example Scheduled Job

By David Bath, Principal Business Intelligence Consultant


Decision First Technologies
david.bath@decisionfirst.com

twitter @davidbathBI

Vous aimerez peut-être aussi