BW - Tracking Zero Record Loads
BW - Tracking Zero Record Loads
Applies To:
SAP BW 3.0 and Above.
Summary
Sometimes when we extract data from source systems such as R3, flat files, or databases, we see the load
finish successfully but deliver no new records to BW. Such loads may fail to bring records from the data
source because of problems in that source system such as a database refresh not happened or for other
reasons. Tracking these “zero record” loads is difficult because someone needs to manually examine the
logs in the process chain. In these cases, it is useful to include the code sample provided below as an ABAP
program in your process chains. This program automatically detects zero record loads and sends detailed
mail to an administrator, so that he or she becomes aware of potential problems in the source system. You
can include this program in a process chain after the Info Package load with the details of that Info Package
as variant.
Table of Contents
Applies To:........................................................................................................................................1
Summary ..........................................................................................................................................1
Code Sample....................................................................................................................................1
Author Bio.........................................................................................................................................5
Code Sample
Where you see blue text, for example ******, in the code below please use your SAP login ID as
sender_address and list mail_ids of the persons to receive alert mail in the i_receivers-receiver value.
<html>
<head>
*&---------------------------------------------------------------------*
*& Report ZEROREC_LOAD_MAIL_NOTIFY
*&---------------------------------------------------------------------*
*-----------------------------------------------------------------------
* DESCRIPTION # Zero record loads mail notification
* SPEC-OWNER # Pradeep C Yalamanchili
* CODED BY # Pradeep C Yalamanchili
*-----------------------------------------------------------------------
* This program is used to findout the Loads which are loading zero *
* records and send mail to the list of monitor users regarding the *
* status useful to include in Process chains after the data loads *
* wherever neccesary to track the zero record loads. *
*-----------------------------------------------------------------------
* Tables
Tables:RSREQDONE.
*Constants
CONSTANTS: c_head(30) type c value 'ZERO records Loaded for'.
* Email text
DATA: t_email_txt LIKE soli OCCURS 0 WITH HEADER LINE,
t_line LIKE TABLE OF sy-lisel.
* Internal Tables
DATA: Begin of i_record occurs 0,
RNR type RSREQUNR,
LOGDPID type RSLOGDPID,
TSTATUS type RSSTATUS,
TDATUM type SYDATUM,
TUZEIT type SYUZEIT,
end of i_record.
****************************************************************
*** INITIALIZATION **
****************************************************************
INITIALIZATION.
******************************************************************
START-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form sub_send_mail
*&---------------------------------------------------------------------*
FORM sub_send_mail .
DATA: i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
s_doc_data LIKE sodocchgi1, " Document data
v_sender LIKE soextreci1-receiver,
w_lines TYPE i.
ENDIF.
* IF w_lines ge 4 .
CLEAR i_packing_list.
i_packing_list-transf_bin = 'X'.
i_packing_list-head_start = 1.
i_packing_list-head_num = 1.
i_packing_list-body_start = 1.
i_packing_list-body_num = w_lines.
i_packing_list-doc_type = 'RAW'.
i_packing_list-obj_descr = 'PKTERROR'.
i_packing_list-doc_size = w_lines * 255.
APPEND i_packing_list.
* ENDIF.
* subject of email
s_doc_data-obj_name = '???'.
Concatenate c_head p_ipak into s_doc_data-obj_descr.
* sender of email
MOVE SY-UNAME TO v_sender.
WHEN 5.
MESSAGE e000 WITH 'Parameter error'.
WHEN 6.
MESSAGE e000 WITH 'Error occured when sending message'.
WHEN 7.
MESSAGE e000 WITH 'Enque error'.
WHEN OTHERS.
MESSAGE e000 WITH 'Error occured when sending message'.
ENDCASE.
ENDIF.
COMMIT WORK.
</head>
<body>
Author Bio
Pradeep Choudhari is an ABAP/BW consultant working with HCL Technologies.Having over
three years of development and consulting experience in various parts of the world.
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.