Skip to Content
Author's profile photo Former Member

BOBJ Report Scheduling Based on File Event after BW Data Load Completion

Applies To
SAP BOBJ 4.1 and SAP BW 7.3
Summary
This document gives the information on how to schedule a BOBJ reports based on data load completion in BW. If BOBJ reports are scheduled to run on daily recurrence and for some reason if BW loads get delayed, BOBJ report will not show the latest data. In order to avoid the situation, we wanted to control the BOBJ report scheduling based on BW data loads else we have to re-schedule or run the report manually after the BW data loads.
Authors:              Shambhu K Gupta, Kiran Kumar Khamitkar
Company:            Cognizant
Created On:        18 December 2014
                                                           
Authors Bio
Shambhu.png


Shambhu is working in Cognizant as a Principal Consultant. He is having over 10 years of experience in the area of SAP BW/BI, BOBJ, and HANA.





Kiran.jpg



Kirankumar Khamitkar is working as Senior Associate in Cognizant Technology Solution with over 8 years of experience. His core competency is Business objects.




Introduction:

If BOBJ reports are scheduled to run on daily recurrence and for some reason if BW loads get delayed, BOBJ report will not show the latest data. In order to avoid the situation, we wanted to control the BOBJ report scheduling based on BW data loads else we have to re-schedule or run the report manually after the BW data loads. For this, we thought to schedule the BOBJ reports based on File events. The file will be created based on the successful completion of BW data loads. In BW, we have created an ABAP program to create a test file on application server. This directory, where the file is created, is mounted on both BW server as well as BOBJ server. BOBJ reports should be scheduled prior to this file creation in BW. In BOBJ once the schedules starts, Event will continuously search for the file. In case the file is available prior to BOBJ report schedule time, Event doesn’t process. It will internally check with timestamp of BOBJ report schedule and file creation.  So, we are deleting the old file and replacing it with a new file after BW data loads.
Below is a summary of the steps involved:
  • Create a share drive in BW and mount it to BOBJ server so that it can be accessed by both BW and BOBJ server. This is required so that file can be created in BW side and read in BOBJ side.
  • Create an ABAP Program to delete the previously created file
  • Create an ABAP program to create a sample test file on Application server
  • Create the File based Event on the BOBJ side and assign this event to the desired Report for scheduling

Creating a shared file path at OS level:

Create a share drive in BW and mount it to BOBJ server so that can be accessed by BW system and BOBJ system with full rights with an admin user.  For example, /data/BOBJ is directory that we created in BW where test file will be written. This file can be read from the BOBJ side.  This step is done by our BASIS team.
/wp-content/uploads/2014/12/al11_608853.png

BW Steps

We have created two ABAP program to delete and create the test file. We included these two program in a process chain and attached the process chain with our transactional data load process chain. This helped to create the file only at the end of all transactional data load.

Creating the ABAP program to delete the previously created file:

        We have hard coded the file name and the folder as this file is just used to create an event in BOBJ side.

REPORT  ZBIW_FILE_DELETION_AL11.
*&———————————————————————*
*& Report  ZBIW_FILE_DELETE_AL11
*&———————————————————————*
*& This Program will delete a file from Application server
*& Created BY:  Shambhu Gupta
*&———————————————————————*

DATA: P_S_PATH TYPE PATHEXTERN. ” Complete filepath
DATA: P_S_FILE TYPE PATHEXTERN. ” File name
DATA: P_S_DIR TYPE PATHEXTERN. ” Directory

P_S_FILE = ‘Test.csv’ . “file name to be deleted

P_S_DIR = ‘/data/BOBJ/’. ” Path from where file will be deleted

CONCATENATE P_S_DIR P_S_FILE INTO P_S_PATH.
CONDENSE P_S_PATH.

OPEN DATASET P_S_PATH FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF SYSUBRC = 0.
 
CLOSE DATASET P_S_PATH.
 
DELETE DATASET P_S_PATH.

  IF SYSUBRC EQ 0.
   
WRITE: ‘File Deleted Succesfully’, P_S_PATH.
 
ELSE.
   
WRITE: ‘No Authorization to delete or no file exists’, P_S_PATH.
 
ENDIF.
ELSE.

  WRITE: P_S_PATH, ‘File does not exist’.
ENDIF.

Creating the ABAP program to create the test file on Application server:

REPORT  ZBIW_FILE_CREATION_AL11.

**&—————————————————————————————–*
* *& Title :      Program will create a file and place it at application server
* *&              at specified path
* *& Created BY:  Shambhu Gupta
* *&—————————————————————————————–*

DATA: lv_file_str TYPE string “file Path
“For Application server file
DATA: lv_msg_text(50),
      lv_filename
TYPE rlgrapfilename.
DATA l_lines    TYPE i.
DATA ls_split    TYPE string.
DATA lt_split    LIKE TABLE OF ls_split.
DATA lp_file TYPE localfile.
DATA lp_fil2 LIKE rlgrapfilename.
lp_file
= ‘Test.csv’ . “file name to be created
lp_fil2
= ‘/data/BOBJ/’ . ” Path where file will be created

AT LINE-SELECTION.

  CALL TRANSACTION ‘AL11’ .

*———————————————————————-*
* Start of selection
*———————————————————————-

START-OF-SELECTION.
 
SPLIT lp_file AT ‘.’ INTO lv_file_str lv_filename .

  TRANSLATE lv_filename TO UPPER CASE .

  IF lv_filename = ‘CSV’ .

    CLEAR : lv_filename .

    “Get Filename

    SPLIT lv_file_str AT ‘\’ INTO TABLE lt_split.
   
DESCRIBE TABLE lt_split LINES l_lines.
* file name

    LOOP AT lt_split INTO ls_split.
     
IF sytabix EQ l_lines.
        lv_filename 
= ls_split.
     
ENDIF.
   
ENDLOOP.

    lv_file_str = lp_file .
   
IF lv_file_str IS NOT INITIAL.
     
PERFORM write_file .
   
ELSE.
     
MESSAGE ‘File Path Needed .’ TYPE ‘W’.
   
ENDIF.
 
ELSE.
   
MESSAGE ‘.CSV File Needed .’ TYPE ‘W’.
 
ENDIF.

  FREE :lv_filename ,lt_split ,l_lines ,lv_file_str.
*&———————————————————————*
*&      Form  write_file – This will create a file at Application Server
*&———————————————————————

FORM write_file .

  CONCATENATE  lp_fil2 lv_filename  ‘.csv’ INTO lv_filename .
 
CONDENSE lv_filename NOGAPS .
 
OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE
 
ENCODING DEFAULT MESSAGE lv_msg_text.

  IF sysubrc EQ 0.
   
WRITE: ‘File’ ,lv_filename ,‘created Successfully at Application server.’.
   
EXIT.
 
ELSE.
   
WRITE: ‘File’ ,lv_filename ,‘ cannot get created at Application server.’.
   
EXIT.
 
ENDIF.
ENDFORM .                    “write_file

*———————————————————————-*
* End Of Program
*———————————————————————-

Creating the process chain

We included the above two program in the process chain and included it in our transactional data load chain. This ensures that file would be created only after BW transactional load is completed. For more detail on how to crreate a Process chain, please refer to Related Content section.
                    BWPC.png
After all sequences, BW system will write file on /data/BOBJ mount or share drive.

        BWFile.png

BOBJ Steps

From the BusinessObjects side, following steps need to be addressed:
  • Creation of the file-based event
  • Attaching the event to the report.

Steps for Creating File Based Event.

1. Login to Central Management Console (CMC), it will appear like below screenshot.

      CMC.png

Click on Events, you will see the below screen


    CMC_Event.png

Select System Events, from the left top select Manage->New->New Event


    New Event.png     

Need to enter the Event Details

      Event details.png
    1. Type: File
    2. Event Name: Give any Event Name (Test File Event)
    3. Description: It is optional, Just mention the
      purpose of Event
    4. Server: By default it will select the available
      Event Server
    5. File Name: Path of the File, for example (/data/BOBJ/Test.csv)
Then say OK to create File Event

Once the File Event is created use in the report schedule


Steps for attaching the Event to the Report


Login to BI Launch pad, Right click on the report which need to scheduled based on File Event

    Report Schedule.png

Provide all the schedule details like Recurrence, Notification, Prompt so whatever is required, then select Event under this System Events and choose the File Event created


    Schedule details.png

Then click on Schedule to run the report.
Once the recurrence schedule starts, the event will continuously search for the files specified in the path. If the file occurs prior to schedule time, event will not trigger, internally it will check with time stamp of file creation and schedule time. In case if the file occurs then need to delete it and write the file. Once the file placed, event will get triggered and schedule process start to run the report.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ashok Babu Kumili
      Ashok Babu Kumili

      Hello Shabmhu.

      Thanks for the blog. Great details and thanks for the screen shots and ABAP code. I see this as an extra oridinary solution to the project specific needs. Rating as a 5 Star content.

      Thank you.  Regards-Ashok.

      Author's profile photo Haradev Viswanadha
      Haradev Viswanadha

      Its a great article and many will be benefited as this a common requirement today. Thanks for sharing it.

      Regards

      Haradev

      Author's profile photo Sat p
      Sat p

      Good Doc

      Author's profile photo Former Member
      Former Member

      Thanks Shambu

      Author's profile photo Former Member
      Former Member

      Hi Shambhu,

      We are trying to implement the same solution.  Basically, we want BW to create/dump a dummy file to an external network file path.  However, i see that you mentioned "Create a share drive in BW and mount it to BOBJ server".  Do you have a  guide on how to do this?

      Kind Regards,

      Mark

      Author's profile photo Shalaka Golde
      Shalaka Golde

      Hi,

      Ask your Basis team to do it.They will easily be able to do it.

      Regards,

      Shalaka

      Author's profile photo BusinessWarehouse Support
      BusinessWarehouse Support

      Nice Blog with detailed description.