To Check the Files/Reports in Application Server and Trigger Mail Alerts

Similar documents
Triggering the Process Chains at Particular Date using Events

Tracking Zero Record Loads

ABAP Code - Recipients (Specific Format) SAP BW Process Chain

Using Customer Exit Variables in BW/BI Reports: Part - 14

Convert the Spool into PDF and send to External ID

Using Customer Exit Variables in BW/BI Reports: Part - 4

Errors while Sending Packages from OLTP to BI (One of Error at the Time of Data Loads through Process Chains)

Using Rule Group in SAP-BI. Part - 1

Using Customer Exit Variables in BW/BI Reports Part - 1

Step by Step Method for File Archival in BW

SDN Community Contribution

Using Radio Buttons in Web Template

Step by Step Guide to Creating a Process Type to Close an Open Request in a Cube in BI 7.0

Customized Transaction to Trigger Process Chain from Failed Step

Custom Process types Remote Trigger and End Time

Restricting F4 (Input Help) Values While Running a SAP BW Query

A Simple search program for Dictionary objects

Using Query Extract to Export Data from Business warehouse, With Pros and Cons Analyzed

DB Connect with Delta Mechanism

Procedure to Trigger Events in Remote System Using an ABAP Program

Step by Step Guide to Enhance a Data Source

How to use Boolean Operations in the Formula as Subsidiary for IF Condition

Reporting Duplicate Entries

Data Extraction & DS Enhancement in SAP BI Step by Step

Material Master Archiving in Simple Method

This article explains the steps to create a Move-in letter using Print Workbench and SAPScripts.

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Process Chain Log Deletion

Using Nested Exception Aggregation in BEx Reports- Scenario

Implementing Customer Exit Reporting Variables as Methods

Recreating BIA Indexes to Address the Growth of Fact Index Table

Routines in SAP BI 7.0 Transformations

How to Create and Schedule Publications from Crystal Reports

Extracting Missing Fields of Data Source Which Are Present In Their Extract Structure

MDM Syndicator: Custom Items Tab

Step By Step: the Process of Selective Deletion from a DSO

Easy Lookup in Process Integration 7.1

Function Module to Create Logo

Information Broadcasting Part 3 Scheduling the First Report

Standalone BW System Refresh

Creation of Sets in SAP-ABAP, How to Read them INI SAP-ABAP Reports

POWL: Infoset Generation with Web Dynpro ABAP

Creation of Key Figures with Higher Decimal Place Precision

Integration of Web Dynpro for ABAP Application in Microsoft Share Point Portal

Customizing Characteristic Relationships in BW-BPS with Function Modules

Reading Enhanced DataSource fields for the Remote Cube

Download SAP Query Output to Local/ Network Folders in Background

ecatt Part 6 System Data Container

Database Statistics During ODS Activation

SAP BW Copy Existing DTP for Data Targets

Changing the Source System Assignments in SAP BW Objects without Affecting the Data Modeling

Creating Custom SU01 Transaction Code with Display and Password Reset Buttons

Steps to Activate ALE Delta for Custom Master Datasource Created on ZTable

Extraction of Hierarchy into Flat File from R/3 and Loading in BW System

Adding Custom Fields to Contract Account Screen

How to Create Top of List and End of List of the ALV Output in Web Dynpro for ABAP

Generate Export Data Source

Graphical Mapping Technique in SAP NetWeaver Process Integration

Validity Table in SAP BW/BI

SAP BusinessObjects Translation Manager Functionality and Use

SAP BW - PSA/Change Log Deletion Governance

Material Listing and Exclusion

How to Create and Execute Dynamic Operating System Scripts With XI

How to Default Variant Created for Report Developed In Report Painter/Writer

Linking Documents with Web Templates

Open Text DocuLink Configuration - To Access Documents which are Archived using SAP

MDM Import Manager - Taxonomy Data (Attribute Text Values) Part 3

SAP BI BO Unit/Currency Logic for Unknown Units Case Study

Replacement Path: Explained with an Illustrated Example

Performance Optimization of Long Running Queries Using OLAP Cache

Xcelsius Tricks Part 5 Create a Loading Bar in SAP Crystal Dashboard and Presentation Design (Xcelsius 2008)

Step by Step Procedure for DSO Creation

Limitation in BAPI Scheduling Agreement (SA) Create or Change

Data Flow During Different Update Mode in LO Cockpit

Loading the Data for Time Dependent Hierarchy in SAP BI

How to Display Result Row in One Line While Reporting On Multiproviderer

E-Sourcing System Copy [System refresh from Production to existing Development]

Displaying SAP Transaction as Internet Application in Portal

Methods of Selecting BOM Variant Parts in Variant Configuration

A Step-by-Step Guide on IDoc-ALE between Two SAP Servers

Add /Remove Links on ESS Home Page in Business Package 1.5

Common Production Failures Encountered at BW Production Support

Server Connectivity and Data Load from Non SAP System to BW

Dynamically Enable / Disable Fields in Table Maintenance Generator

Purpose of Goods Receipt Message indicator in Purchase Orders

Role and Scope of ABAP in SAP BI

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

Step-By-Step guide to Virtual InfoCube Implementation

How to Extend an Outbound IDoc

Currency Translation in SAP BI Step by step Guide

Step by Step Guide for PI Server Start and Stop Procedure

SAP Net Weaver 400s BI 7.0For more information, visit the Business Intelligence homepage.

Offsetting Account Description in FBL3N & FAGLL03 GL Line Item Display Reports

About ITAB Duplicate_Key (SAP lrsaods) Runtime Error

How to Display Traffic Lights for Exceptions in BI Web Reports

Material Master Extension for New Plant

SDN Community Contribution

How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3

Complete Guide for Events in Workflows in SAP ECC 6.0

Template Designer: Create Automatic PDF Documents for Attachment or Print Purpose

Transcription:

To Check the Files/Reports in Application Server and Trigger Mail Alerts Applies to: SAP BW 3.0b, SAP BW 3.5, Will also work on SAP BI 7 For more information, visit the Business Intelligence homepage Summary Sometimes we need to check the files in Application server and based on that you want to get the mail, i.e. if the files are not there in that folder/path then you wanted to get a mail alert. Author: Surendra Kumar Reddy Koduru Company: ITC Infotech India Ltd. (Bangalore/INDIA) Created on: 18 February 2009 Author Bio Surendra Kumar Reddy Koduru is a SAP BI consultant currently working with ITC Infotech India Ltd (Bangalore/INDIA). He has over 4+ years of experience in various BW/BI implementation/support projects. 2009 SAP AG 1

Table of Contents Scope of the Z_FILE_CHECK Program:...3 Why we need this...3 Code...3 Once you run the above program the it will ask inputs like below...7 Related Content...8 For more information, visit the Business Intelligence homepage...8 Disclaimer and Liability Notice...9 2009 SAP AG 2

Scope of the Z_FILE_CHECK Program: This is the custom program and it will check the give input files in the application server in particular folder/path and if the files are not found in that folder/path then you will get a mail, so based on that we will take further actions. Why we need this Eg: I have some reports in BW and using RSCRM_BAPI Tcode, I m downloading the reports into one particular folder/path in BW application server. From there some other system will read that files/reports. So every day the job will run in background i.e. once RSCRM_BAPI completes, then this program will run, and if files/reports not found in that folder/path, then a mail notification will be sent to the mentioned mail id. So it becomes easier to check whether the file/reports are executing and downloading in that folder/path. If I get a mail then I need to take further action. Note: At the end of the day the files will be deleted in that Folder/Path using UNIX script. (My BW system is running on UNIX.). From BW application server folder/path, the SQL server will take/read the file/report, after that the file/report should be deleted using UNIX Script, else, the next day we will not be able to trace whether the file/report is downloaded using RSCRM_BAPI. Note: The folder/path names may differ; here I create my own folder/path in BW application server. Code REPORT z_file_check. TABLES:filepath,somlreci1. TYPES:BEGIN OF ts_select, value TYPE pathintern, flag TYPE c, END OF ts_select. TYPES:BEGIN OF ts_dirlist1, name TYPE epsfili-name, size TYPE epsfili-size, rc TYPE epsfili-rc, flag TYPE char1, END OF ts_dirlist1. DATA:it_dirlist1 TYPE STANDARD TABLE OF ts_dirlist1, it_objtxt TYPE STANDARD TABLE OF solisti1, it_objpack TYPE STANDARD TABLE OF sopcklsti1, it_reclist TYPE STANDARD TABLE OF somlreci1, it_objbin TYPE STANDARD TABLE OF solisti1, it_dirlist TYPE STANDARD TABLE OF epsfili, it_select TYPE STANDARD TABLE OF ts_select. DATA : is_doc_chng is_objtxt is_objpack is_objbin is_reclist is_select is_dirlist is_dirlist1 TYPE sodocchgi1, TYPE solisti1, TYPE sopcklsti1, TYPE solisti1, TYPE somlreci1, TYPE ts_select, TYPE epsfili, TYPE ts_dirlist1. 2009 SAP AG 3

DATA:w_tabix TYPE sy-tabix, w_dirname TYPE epsf-epsdirnam, w_filename TYPE epsf-epsfilnam, w_lines_tx TYPE i, w_text TYPE char255. *& S E L E C T I O N S C R E E N * SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. PARAMETERS: p_file LIKE rlgrap-filename. SELECT-OPTIONS: s_file FOR filepath-pathintern NO INTERVALS. SELECT-OPTIONS:s_mail FOR somlreci1-receiver NO INTERVALS. PARAMETERS: p_date TYPE sy-datum. SELECTION-SCREEN: END OF BLOCK b1. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. PERFORM sub_get_filename_appl USING p_file. START-OF-SELECTION. PERFORM sub_populate_data. *& Form sub_populate_data * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM sub_populate_data. w_dirname = p_file. CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING' EXPORTING * dir_name = p_file dir_name = w_dirname TABLES dir_list = it_dirlist EXCEPTIONS invalid_eps_subdir = 1 sapgparam_failed = 2 build_directory_failed = 3 no_authorization = 4 read_directory_failed = 5 too_many_read_errors = 6 empty_directory_list = 7. LOOP AT s_file. is_select-value = s_file-low. APPEND is_select TO it_select. CLEAR is_select. APPEND LINES OF it_dirlist[] TO it_dirlist1[]. LOOP AT it_dirlist1 INTO is_dirlist1. TRANSLATE is_dirlist1-name TO UPPER CASE. MODIFY it_dirlist1 FROM is_dirlist1 TRANSPORTING name. 2009 SAP AG 4

SORT it_dirlist1 BY name. LOOP AT it_select INTO is_select. w_tabix = sy-tabix. READ TABLE it_dirlist1 INTO is_dirlist1 WITH KEY name = is_select-value BINARY SEARCH. IF sy-subrc = 0. is_select-flag = 'X'. ENDIF. MODIFY it_select FROM is_select INDEX w_tabix TRANSPORTING flag. DATA:it_select1 TYPE TABLE OF ts_select. DATA:is_select1 TYPE ts_select. it_select1[] = it_select[]. delete it_select where flag = 'X'. LOOP AT it_select INTO is_select. IF is_select-flag NE 'X'. is_doc_chng-obj_name = 'MAIL'. is_doc_chng-obj_descr = 'Problem while downloading the report in BW Folder'. ** main text CLEAR w_text. LOOP AT it_select1 INTO is_select1 WHERE flag NE 'X'. Folder' CONCATENATE 'Problem while downloading the report in BW Application Server p_file 'FILE' is_select1-value INTO w_text SEPARATED BY space. is_objtxt-line = w_text. * is_objtxt-line = is_select-name. APPEND is_objtxt TO it_objtxt. is_objtxt-line = 'This is an automatically generated mail. Please do not reply to it.'. APPEND is_objtxt TO it_objtxt. is_objtxt-line = space. APPEND is_objtxt TO it_objtxt. DESCRIBE TABLE it_objtxt LINES w_lines_tx. READ TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx. is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ). CLEAR is_objpack-transf_bin. is_objpack-head_start = 1. is_objpack-head_num = 0. is_objpack-body_start = 1. is_objpack-body_num = w_lines_tx. is_objpack-doc_type = 'RAW'. APPEND is_objpack TO it_objpack. LOOP AT s_mail. is_reclist-receiver = s_mail-low. is_reclist-rec_type = 'U'. APPEND is_reclist TO it_reclist. 2009 SAP AG 5

CLEAR is_reclist. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = is_doc_chng put_in_outbox = 'X' commit_work = 'X' TABLES packing_list = it_objpack contents_txt = it_objtxt receivers = it_reclist EXCEPTIONS too_many_receivers = 1 document_not_sent = 2 document_type_not_exist = 3 operation_no_authorization = 4 parameter_error = 5 x_error = 6 enqueue_error = 7 OTHERS = 8. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDIF. EXIT. ENDFORM. " sub_populate_data *& Form SUB_GET_FILENAME_APPL * text *----------------------------------------------------------------------* * -->P_P_FILE text *----------------------------------------------------------------------* FORM sub_get_filename_appl USING w_fname. **GET THE FILENAME FROM THE APPLICATION SERVER CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE' EXPORTING directory = w_fname filemask = '*' IMPORTING serverfile = w_fname EXCEPTIONS canceled_by_user = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. " SUB_GET_FILENAME_APPL 2009 SAP AG 6

Once you run the above program the it will ask inputs like below You just give path name in Application Directory and File name in File and mail id. Date is not required. It is better create a variant and set the variant, because everyday my file name is same. So I set the variant and execute this program in background at particular time, and if it won t find the given file names then you will get mail. Note: Configure your mail box with your BW system. 2009 SAP AG 7

Related Content For more information, visit the Business Intelligence homepage. 2009 SAP AG 8

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. 2009 SAP AG 9