You are on page 1of 25

An ABAP Program to Effortlessly Check Data Load Status in BW

Applies to:
SAP BW 3.5. For more information, visit the Business Intelligence homepage.

Summary
This document guides the user to generate an ABAP report on the status of Daily Transaction Data Loads in BW Server, to minimize the time and effort it takes to check several periodic loads in Production server. Author: Mythili Kommu

Company: Intelligroup Asia Pvt Ltd. Created on: 29 October 2008

Author Bio
Mythili Kommu is a NetWeaver 2004s (BI 7) Certified consultant working with Intelligroup Asia Pvt. Ltd, Hyderabad. Has very good working knowledge in ABAP, Worked with SAP modules which include FI-CO, HR, ECC, SEM, APO and EP Application support. She has completed her Masters in Computer Applications (M.C.A) from Osmania University.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 1

An ABAP Program to Effortlessly Check Data Load Status in BW

Table of Contents
Introduction .........................................................................................................................................................3 Business Scenario ..........................................................................................................................................3
Key Point......................................................................................................................................................................3

Functionalities & Implementation of Program.....................................................................................................4 Program Functionalities ..................................................................................................................................4


Inputs ...........................................................................................................................................................................4 Output: .........................................................................................................................................................................4 Tables Used.................................................................................................................................................................4

Step-by-Step Procedure for Implementing the Program.................................................................................5


STEP 1: Creation of Program ......................................................................................................................................5 STEP 2: Populate Server Time Zone.........................................................................................................................22 STEP 3: Creation of Text elements............................................................................................................................22 STEP 4: Create and Assign Logical File to Physical Path .........................................................................................23 STEP 5: Execution of Program ..................................................................................................................................24

Disclaimer and Liability Notice..........................................................................................................................25

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 2

An ABAP Program to Effortlessly Check Data Load Status in BW

Introduction
The purpose of developing this ABAP program Z_DAILY_LOAD_STATUS_REPORT in BW server is to generate daily transaction data load status where there are number of periodic deltas and full loads to check, mainly in the Production server. Business Scenario In typical scenarios/cases when the loads are triggered in the nights or early hours of the day so that the business is not affected; this report minimizes the time and effort it takes to verify and validate the daily/weekly data loads, and all the data/reports are readily available for decision making at start of the business day. This was the case in one of the support projects that I was involved in, where there were several periodic loads triggered every night and in the early hours of the day. Once all the loads were through successfully I had to check the status, fix the errors and record the status of all the Infoproviders to an excel sheet and update it to the client. To overcome this tedious & manual job of documenting, I thought it prudent to automate the process using ABAP; and hence I developed this program which helped me a great deal in cutting down the time & efforts to capture the status of the data loads so that the client is informed before start of the business day. Key Point One distinct advantage of this report is to view the status report of transaction data loads in required time zone This report converts UTC timestamp in the tables (typically in SAP all timestamps are in UTC format) to server time, provided the time zone is specified in the program, and also identify requests with Zero updated records.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 3

An ABAP Program to Effortlessly Check Data Load Status in BW

Functionalities & Implementation of Program


Program Functionalities Inputs Output: A load status file is created in the desired location (To Presentation server in Excel format/ Application server in .csv format). Date range (Optional) InfoProvider Technical Names Output file path(except file name) - If destination is Presentation server Logical file name If destination is Application server This program displays latest (Last successful load) Load status of Infoproviders. Generate report based on date and Infoproviders as selection criteria Default yesterday and current dates as From and To dates as selections. F4 functionality to choose the path where the output file is to be stored (Presentation Server in excel format) Identify Zero records updated (This is very important check in case of deltas) Logical path selection is included to save the file in the Application server at a standard location for batch processing of data. Display transferred and updated records, requested time and updated time of Requests. Display column headings in the excel file. Output filename concatenated with current system date.

Tables Used
Note: Infoproviders, default dates and path (physical and logical) can be modified based on the requirement. Populate field tz with required Server time zone from ttzz table. Example: - tz = 'MSTNO' display timestamp in Mountain Standard Time.

RSICCONT - Monitor: Saving of the updated IC and ODS per request RSSELDONE - Monitor: Selections for executed request RSREQDONE - Monitor: Saving of the QM entries RSMONICTAB - Monitor IC table RSDCUBET - Texts for the InfoCubes RSDODSOT - Texts of ODS objects TADIR - Directory of Repository Objects TTZZ - Time zones

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 4

An ABAP Program to Effortlessly Check Data Load Status in BW

Step-by-Step Procedure for Implementing the Program This program is created in BW server. Text elements and Selection Texts are included in the implementation. STEP 1: Creation of Program Go to TCODE: SE38 Create an executable program Z_DAILY_LOAD_STATUS_REPORT Copy the below code in the Editor and save.

REPORT Z_DAILY_LOAD_STATUS_REPORT NO STANDARD PAGE HEADING LINE-SIZE 300 LINE-COUNT 2000.

*********************************************************************** * DATA Declarations * ***********************************************************************

DATA:i_prov(30) TYPE c, p_sep(01) TYPE c VALUE ','. " field separator

* Frame1 for selection screen SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1. SELECT-OPTIONS:sel_cube FOR i_prov, date FOR sy-datum. SELECTION-SCREEN END OF BLOCK bl1.

*Frame2 for selection Screen SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-bl2. *Output to Presentation Server PARAMETERS: p_phys RADIOBUTTON GROUP rad1 DEFAULT 'X', path(128) TYPE c DEFAULT '\\ C:\Daily Loads\Daily Load Status'." Physical path sample *Output to Application server PARAMETERS: p_log RADIOBUTTON GROUP rad1, path1 TYPE filename-fileextern DEFAULT 'Z_DAILY_LOAD_STATUS1'. "Logical file name sample *Physical path assigned to logical file 'Z_DAILY_LOAD_STATUS' * '/SAP/erp/dataload/'.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 5

An ABAP Program to Effortlessly Check Data Load Status in BW

SELECTION-SCREEN END OF BLOCK bl2. *Default yesterday and current dates as From and To dates as selections INITIALIZATION. date-low = sy-datum - 1. date-high = sy-datum. date-option = 'BT'. date-sign = 'I'. APPEND date.

*********************************************************************** * Enable F4 functionality to identify the Presentation server path * *********************************************************************** AT SELECTION-SCREEN ON VALUE-REQUEST FOR path. DATA: l_dir TYPE string.

* Browse the Directories CALL METHOD cl_gui_frontend_services=>directory_browse * EXPORTING * WINDOW_TITLE = * INITIAL_FOLDER = CHANGING
selected_folder = l_dir

EXCEPTIONS
cntl_error = 1 error_no_gui = 2 not_supported_by_gui = 3 OTHERS = 4 . IF sy-subrc NE 0.

* *

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE.
path = l_dir.

ENDIF.

*********************************************************************** * Internal Tables * ***********************************************************************

START-OF-SELECTION. DATA: BEGIN OF work,


filename TYPE rlgrap-filename, buffer(1024) TYPE c,

" work fields

END OF work.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 6

An ABAP Program to Effortlessly Check Data Load Status in BW

TYPES:BEGIN OF it_source1,
rnr TYPE rsiccont-rnr, icube TYPE rsiccont-icube, timestamp TYPE rsiccont-timestamp, source TYPE rsseldone-source, logdpid TYPE rsseldone-logdpid,

END OF it_source1. TYPES:BEGIN OF it_reqdone3,


logdpid TYPE rsreqdone-logdpid, rnr TYPE rsreqdone-rnr, tstatus TYPE rsreqdone-tstatus, datum TYPE rsreqdone-datum, uzeit TYPE rsreqdone-uzeit, tuzeit TYPE rsreqdone-tuzeit, records TYPE rsreqdone-records, timestampbegin TYPE rsreqdone-timestampbegin, timestampend TYPE rsiccont-timestamp,

END OF it_reqdone3.

TYPES:BEGIN OF it_sreq1,
icube TYPE rsiccont-icube, source TYPE rsseldone-source, object TYPE tadir-object, txtlg TYPE rsdcubet-txtlg, logdpid TYPE rsseldone-logdpid, rnr TYPE rsiccont-rnr, tstatus TYPE rsreqdone-tstatus, datum TYPE rsreqdone-datum, uzeit TYPE rsreqdone-uzeit, tuzeit TYPE rsreqdone-tuzeit, timestampbegin TYPE rsreqdone-timestampbegin, timestamp TYPE rsiccont-timestamp, records TYPE rsreqdone-records, req_insert TYPE rsmonictab-req_insert,

END OF it_sreq1.

TYPES:BEGIN OF it_stat,
object TYPE tadir-object, icube TYPE rsiccont-icube, txtlg TYPE rsdcubet-txtlg, source TYPE rsseldone-source, logdpid TYPE rsseldone-logdpid, rnr TYPE rsiccont-rnr, tstatus TYPE rsreqdone-tstatus, datum TYPE sy-datum, "rsreqdone-datum, uzeit TYPE sy-uzeit, "rsreqdone-uzeit,

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 7

An ABAP Program to Effortlessly Check Data Load Status in BW

tuzeit TYPE sy-uzeit,"rsreqdone-tuzeit, records TYPE rsreqdone-records, req_insert TYPE rsmonictab-req_insert, timestampbegin TYPE rsreqdone-timestampbegin, timestamp TYPE rsiccont-timestamp,

END OF it_stat.

TYPES:BEGIN OF it_mon,
object TYPE tadir-object, icube TYPE rsiccont-icube, txtlg TYPE rsdcubet-txtlg, source TYPE rsseldone-source, logdpid TYPE rsseldone-logdpid, rnr TYPE rsiccont-rnr, tstatus TYPE rsreqdone-tstatus, datum TYPE sy-datum, "rsreqdone-datum, uzeit TYPE sy-uzeit, "rsreqdone-uzeit, tuzeit TYPE sy-uzeit,"rsreqdone-tuzeit, records TYPE rsreqdone-records, req_insert TYPE rsmonictab-req_insert,

END OF it_mon.

TYPES:BEGIN OF it_object1,
object TYPE tadir-object, obj_name TYPE tadir-obj_name,

END OF it_object1.

TYPES:BEGIN OF it_cubet1,
infocube TYPE rsdcubet-infocube, txtlg TYPE rsdcubet-txtlg,

END OF it_cubet1.

TYPES:BEGIN OF it_odsot1,
odsobject TYPE rsdodsot-odsobject, txtlg TYPE rsdodsot-txtlg,

END OF it_odsot1.

TYPES:BEGIN OF it_urec1,
rnr TYPE rsmonictab-rnr, infocube TYPE rsmonictab-infocube, req_insert TYPE rsmonictab-req_insert,

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 8

An ABAP Program to Effortlessly Check Data Load Status in BW

END OF it_urec1.

TYPES: BEGIN OF it_file1,


object(4) TYPE c, icube(40) TYPE c, txtlg(60) TYPE c, source(30) TYPE c, logdpid(60) TYPE c, rnr(30) TYPE c, tstatus TYPE rsreqdone-tstatus, datum(10) TYPE c, uzeit(8) TYPE c, tuzeit(8) TYPE c, records(11) TYPE c, req_insert(11) TYPE c,

END OF it_file1.

DATA:it_source TYPE STANDARD TABLE OF it_source1, wa_source TYPE it_source1,


it_reqdone1 TYPE STANDARD TABLE OF it_reqdone3, wa_reqdone1 TYPE it_reqdone3, it_reqdone TYPE STANDARD TABLE OF it_reqdone3, wa_reqdone TYPE it_reqdone3, it_sreq TYPE STANDARD TABLE OF it_sreq1, wa_sreq TYPE it_sreq1, it_object TYPE STANDARD TABLE OF it_object1, wa_object TYPE it_object1, it_cubet TYPE STANDARD TABLE OF it_cubet1, wa_cubet TYPE it_cubet1, it_odsot TYPE STANDARD TABLE OF it_odsot1, wa_odsot TYPE it_odsot1, it_urec TYPE STANDARD TABLE OF it_urec1, wa_urec TYPE it_urec1, it_req TYPE STANDARD TABLE OF it_sreq1, wa_req TYPE it_sreq1, it_obj_txt TYPE STANDARD TABLE OF it_sreq1, wa_obj_txt TYPE it_sreq1, it_final TYPE STANDARD TABLE OF it_sreq1, wa_final TYPE it_sreq1,

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 9

An ABAP Program to Effortlessly Check Data Load Status in BW

it_tstat TYPE STANDARD TABLE OF it_stat, wa_tstat TYPE it_stat, it_time TYPE STANDARD TABLE OF it_mon, wa_time TYPE it_mon, it_file TYPE STANDARD TABLE OF it_file1, wa_file TYPE it_file1.

*********************************************************************** * Subroutines * *********************************************************************** PERFORM PERFORM PERFORM PERFORM PERFORM PERFORM PERFORM PERFORM PERFORM
it_source. it_reqdone. it_sreq. it_urec. it_obj_txt. it_final. it_tstat. it_time. get_physical_filename

USING
path1

CHANGING work-filename. PERFORM download.

*&-------------------------------------------------------------------* *& Form it_source *&--------------------------------------------------------------------* * Get Infosource and timestampend *---------------------------------------------------------------------* FORM it_source . SELECT a~rnr
a~icube a~timestamp b~source b~logdpid

INTO TABLE it_source FROM rsiccont AS a INNER JOIN rsseldone AS b ON a~rnr = b~rnr WHERE a~icube IN sel_cube.

ENDFORM.

" it_source

*&--------------------------------------------------------------------* *& Form it_reqdone *&--------------------------------------------------------------------* * Get details of request including timestampbegin, transfered

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 10

An ABAP Program to Effortlessly Check Data Load Status in BW

* records etc. *---------------------------------------------------------------------* FORM it_reqdone . SELECT logdpid


rnr tstatus datum uzeit tuzeit records timestampbegin FROM rsreqdone INTO TABLE it_reqdone1 FOR ALL ENTRIES IN it_source

WHERE
rnr = it_source-rnr

AND
datum IN date.

SORT it_reqdone1 BY timestampbegin DESCENDING timestampbegin.

ENDFORM.

" it_reqdone

*&--------------------------------------------------------------------* *& Form it_sreq *&--------------------------------------------------------------------* * Combine infosource and request detials *---------------------------------------------------------------------* FORM it_sreq . LOOP AT it_source INTO wa_source. READ TABLE it_reqdone1 INTO wa_reqdone1 WITH KEY rnr = wa_source-rnr.

IF sy-subrc = 0. MOVE:wa_source-icube TO wa_sreq-icube, wa_source-source TO wa_sreq-source, wa_source-logdpid TO wa_sreq-logdpid, wa_source-timestamp TO wa_sreq-timestamp, wa_reqdone1-tstatus TO wa_sreq-tstatus, wa_reqdone1-datum TO wa_sreq-datum, wa_reqdone1-uzeit TO wa_sreq-uzeit , wa_reqdone1-tuzeit TO wa_sreq-tuzeit, wa_reqdone1-records TO wa_sreq-records, wa_reqdone1-timestampbegin TO wa_sreq-timestampbegin, wa_reqdone1-rnr TO wa_sreq-rnr.

APPEND wa_sreq TO it_sreq.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 11

An ABAP Program to Effortlessly Check Data Load Status in BW

CLEAR wa_sreq. ENDIF. ENDLOOP. SORT it_sreq BY datum DESCENDING.

ENDFORM.

" it_sreq

*&---------------------------------------------------------------------* *& Form it_urec *&---------------------------------------------------------------------* * Get Updated Records for Requests *----------------------------------------------------------------------*

FORM it_urec . SELECT rnr


infocube req_insert FROM rsmonictab INTO TABLE it_urec WHERE infocube IN sel_cube.

LOOP AT it_sreq INTO wa_sreq. MOVE:wa_sreq-icube TO wa_req-icube, wa_sreq-source TO wa_req-source, wa_sreq-rnr TO wa_req-rnr, wa_sreq-logdpid TO wa_req-logdpid, wa_sreq-tstatus TO wa_req-tstatus, wa_sreq-datum TO wa_req-datum, wa_sreq-uzeit TO wa_req-uzeit , wa_sreq-tuzeit TO wa_req-tuzeit, wa_sreq-records TO wa_req-records, wa_sreq-timestampbegin TO wa_req-timestampbegin, wa_sreq-timestamp TO wa_req-timestamp. READ TABLE it_urec INTO wa_urec WITH KEY rnr = wa_sreq-rnr. IF sy-subrc = 0. MOVE:wa_urec-req_insert TO wa_req-req_insert. ELSE.
wa_req-req_insert = 0.

ENDIF. APPEND wa_req TO it_req. CLEAR wa_req.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 12

An ABAP Program to Effortlessly Check Data Load Status in BW

ENDLOOP. SORT it_req BY timestampbegin DESCENDING timestampbegin.

ENDFORM.

" it_urec

*&---------------------------------------------------------------------* *& Form it_obj_txt *&---------------------------------------------------------------------* * Get object types and texts for Infoproviders *----------------------------------------------------------------------* FORM it_obj_txt .

SELECT object
obj_name FROM tadir

INTO TABLE it_object WHERE obj_name IN sel_cube AND object IN ('CUBE','ODSO').

SELECT infocube
txtlg

FROM rsdcubet INTO TABLE it_cubet WHERE infocube IN sel_cube AND langu = 'EN' AND objvers = 'A'.

SELECT odsobject
txtlg

FROM rsdodsot INTO TABLE it_odsot WHERE odsobject IN sel_cube AND langu = 'EN' AND objvers = 'A'.

LOOP AT it_req INTO wa_req.

MOVE:wa_req-icube TO wa_obj_txt-icube, wa_req-source TO wa_obj_txt-source, wa_req-logdpid TO wa_obj_txt-logdpid, wa_req-rnr TO wa_obj_txt-rnr, wa_req-tstatus TO wa_obj_txt-tstatus, wa_req-datum TO wa_obj_txt-datum, wa_req-uzeit TO wa_obj_txt-uzeit , wa_req-tuzeit TO wa_obj_txt-tuzeit,

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 13

An ABAP Program to Effortlessly Check Data Load Status in BW

wa_req-records TO wa_obj_txt-records, wa_req-req_insert TO wa_obj_txt-req_insert, wa_req-timestampbegin TO wa_obj_txt-timestampbegin, wa_req-timestamp TO wa_obj_txt-timestamp.

READ TABLE it_object INTO wa_object WITH KEY obj_name = wa_req-icube. IF sy-subrc = 0. MOVE: wa_object-object TO wa_obj_txt-object. ENDIF.

READ TABLE it_cubet INTO wa_cubet WITH KEY infocube = wa_req-icube. IF sy-subrc = 0. MOVE:wa_cubet-txtlg TO wa_obj_txt-txtlg. ELSE. READ TABLE it_odsot INTO wa_odsot WITH KEY odsobject = wa_req-icube. IF sy-subrc = 0. MOVE:wa_odsot-txtlg TO wa_obj_txt-txtlg. ENDIF. ENDIF. APPEND wa_obj_txt TO it_obj_txt. CLEAR wa_obj_txt. ENDLOOP.

ENDFORM.

" it_obj_txt

*&---------------------------------------------------------------------* *& Form it_final *&---------------------------------------------------------------------* * Get current request for each Infosource in Infoprovider *----------------------------------------------------------------------* FORM it_final . SORT it_obj_txt BY icube source timestampbegin DESCENDING timestampbegin
.

DATA :count LIKE sy-tabix. LOOP AT it_obj_txt INTO wa_obj_txt.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 14

An ABAP Program to Effortlessly Check Data Load Status in BW

count = sy-tabix. AT NEW source. READ TABLE it_obj_txt INTO wa_final INDEX count. IF sy-subrc = 0. APPEND wa_final TO it_final. ENDIF. ENDAT. ENDLOOP. SORT it_final BY object DESCENDING. ENDFORM. " it_final

*&---------------------------------------------------------------------* *& Form it_tstat *&---------------------------------------------------------------------* * Get texts for Request status *----------------------------------------------------------------------*

FORM it_tstat . DATA: green(10) TYPE c VALUE 'C', yellow(10) TYPE c VALUE 'P', red(10) TYPE c VALUE 'F'. "Completed "Processing "Failed

LOOP AT it_final INTO wa_final. MOVE:wa_final-object TO wa_tstat-object, wa_final-icube TO wa_tstat-icube, wa_final-txtlg TO wa_tstat-txtlg, wa_final-source TO wa_tstat-source, wa_final-logdpid TO wa_tstat-logdpid, wa_final-rnr TO wa_tstat-rnr, wa_final-tstatus TO wa_tstat-tstatus, wa_final-datum TO wa_tstat-datum, wa_final-uzeit TO wa_tstat-uzeit, wa_final-tuzeit TO wa_tstat-tuzeit, wa_final-records TO wa_tstat-records, wa_final-req_insert TO wa_tstat-req_insert, wa_final-timestampbegin TO wa_tstat-timestampbegin, wa_final-timestamp TO wa_tstat-timestamp.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 15

An ABAP Program to Effortlessly Check Data Load Status in BW

IF wa_finaltstatus = '@08@'. "Technical value for a Successful request MOVE green TO wa_tstat-tstatus. ELSE. IF wa_finaltstatus = '@09@'. "Technical value for a Processing request MOVE yellow TO wa_tstat-tstatus. ELSE. IF wa_final-tstatus = '@0A@'. "Technical value for a Failed request MOVE red TO wa_tstat-tstatus. ENDIF. ENDIF. ENDIF. APPEND wa_tstat TO it_tstat.

ENDLOOP.

ENDFORM.

" it_tstat

*&---------------------------------------------------------------------* *& Form it_time *&---------------------------------------------------------------------* * Convert UTC timestamp to Server date & time *----------------------------------------------------------------------* FORM it_time . TYPES: BEGIN OF time_stamp,
begin_ts TYPE timestamp, end_ts TYPE timestamp,

END OF time_stamp.

DATA:it_ts TYPE STANDARD TABLE OF time_stamp, wa_ts TYPE time_stamp.

DATA:dat TYPE sy-datum, b_tim TYPE sy-uzeit, e_tim TYPE sy-uzeit, tz TYPE ttzz-tzone. *Populate Server timezone from table ttzz into variable tz.
tz = 'MSTNO'.

" MSTNO represents Mountain standard Time

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 16

An ABAP Program to Effortlessly Check Data Load Status in BW

LOOP AT it_tstat INTO wa_tstat. MOVE:wa_tstat-object TO wa_time-object, wa_tstat-icube TO wa_time-icube, wa_tstat-txtlg TO wa_time-txtlg, wa_tstat-source TO wa_time-source, wa_tstat-logdpid TO wa_time-logdpid, wa_tstat-rnr TO wa_time-rnr, wa_tstat-tstatus TO wa_time-tstatus, wa_tstat-records TO wa_time-records, wa_tstat-req_insert TO wa_time-req_insert, wa_tstat-timestampbegin TO wa_ts-begin_ts, wa_tstat-timestamp TO wa_ts-end_ts.

CONVERT TIME STAMP wa_ts-begin_ts TIME ZONE tz INTO DATE dat TIME b_tim. CONVERT TIME STAMP wa_ts-end_ts TIME ZONE tz INTO TIME e_tim.

MOVE: dat TO wa_time-datum, b_tim TO wa_time-uzeit, e_tim TO wa_time-tuzeit. APPEND wa_time TO it_time. CLEAR wa_time.

ENDLOOP. ****To View results in SAP, uncomment the write statement.*** *WRITE:'DAILY LOAD STATUS' COLOR 5,/ .

*LOOP AT it_time INTO wa_time. * * WRITE: wa_time-object, * wa_time-icube, * wa_time-txtlg, * wa_time-source, * wa_time-logdpid, * wa_time-rnr, * wa_time-tstatus, * wa_time-datum, * wa_time-uzeit, * wa_time-tuzeit, * wa_time-records, * wa_time-req_insert,/. * *ENDLOOP. ENDFORM. " it_time

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 17

An ABAP Program to Effortlessly Check Data Load Status in BW

*&---------------------------------------------------------------------* *& Form get_physical_filename *&---------------------------------------------------------------------* * Get physical path using the logical path *----------------------------------------------------------------------* FORM get_physical_filename USING path1 TYPE filename-fileextern CHANGING p_filename LIKE work-filename.

CALL FUNCTION 'FILE_GET_NAME' EXPORTING


logical_filename = path1

IMPORTING
file_name = p_filename.

ENDFORM.

" get_physical_filename

*&---------------------------------------------------------------------* *& Form download *&---------------------------------------------------------------------* * Insert Column headings and download file *----------------------------------------------------------------------* FORM download . TYPES:BEGIN OF it_fieldnames,
column TYPE dd03d-ddtext,

END OF it_fieldnames.

DATA:it_col TYPE STANDARD TABLE OF it_fieldnames, wa_col TYPE it_fieldnames.

wa_col-column = 'INFOPROVIDER TYPE'(001). APPEND wa_col TO it_col. CLEAR wa_col.

wa_col-column = 'INFOPROVIDER NAME'(002). APPEND wa_col TO it_col. CLEAR wa_col.

wa_col-column = 'INFOPROVIDER DESC.'(003). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'INFOSOURCE'(004). APPEND wa_col TO it_col. CLEAR wa_col.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 18

An ABAP Program to Effortlessly Check Data Load Status in BW

wa_col-column = 'INFOPACKAGE'(005). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'REQUEST'(006). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'REQUEST STATUS'(007). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'START DATE'(008). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'START TIME'(009). APPEND wa_col TO it_col. CLEAR wa_col.

wa_col-column = 'END TIME'(010). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'TRANSFERRED RECORDS'(011). APPEND wa_col TO it_col. CLEAR wa_col. wa_col-column = 'UPDATED RECORDS'(012). APPEND wa_col TO it_col. CLEAR wa_col.

DATA:file(200) TYPE c. TYPES:BEGIN OF w , file TYPE string, END OF w. DATA:wa TYPE w.

*Download to Presentation Server IF p_phys = 'X' AND path <> ' '. *Concatenating current system date and .xls extension to the file name. CONCATENATE path '\Load Status'(013) ' - '
sy-datum

'.xls' INTO file.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 19

An ABAP Program to Effortlessly Check Data Load Status in BW

wa-file = file.

*Function Module to download data to Presentation server in excel format CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING
filename = wa-file filetype write_field_separator trunc_trailing_blanks dat_mode = 'ASC' = 'X' = 'X' = 'X'

* IMPORTING TABLES
data_tab fieldnames . = it_time = it_col

IF sy-subrc = 0. MESSAGE s899(s1) WITH 'File Transferred'(014) '' '' ''. ENDIF. *Download to Application Server ELSEIF p_log = 'X' AND path1 <> ' '. *Concatenate Current system date and .csv file extension to the file name. CONCATENATE work-filename ' - '
sy-datum

'.csv' INTO file. TRANSLATE file TO LOWER CASE. CLEAR work-filename. work-filename = file. *Creating output file in Application server in .csv format OPEN DATASET work-filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. CLEAR wa_file. REFRESH it_file. IF sy-subrc = 0.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 20

An ABAP Program to Effortlessly Check Data Load Status in BW

LOOP AT it_time INTO wa_time.


wa_file-object = wa_time-object. wa_file-icube = wa_time-icube. wa_file-txtlg = wa_time-txtlg. wa_file-source = wa_time-source. wa_file-logdpid = wa_time-logdpid. wa_file-rnr = wa_time-rnr. wa_file-tstatus = wa_time-tstatus. WRITE wa_time-datum TO wa_file-datum. WRITE wa_time-uzeit TO wa_file-uzeit. WRITE wa_time-tuzeit TO wa_file-tuzeit. wa_file-records = wa_time-records. wa_file-req_insert = wa_time-req_insert.

APPEND wa_file TO it_file. ENDLOOP. LOOP AT it_file INTO wa_file. CLEAR work-buffer. CONCATENATE
wa_file-object wa_file-icube wa_file-txtlg wa_file-source wa_file-logdpid wa_file-rnr wa_file-tstatus wa_file-datum wa_file-uzeit wa_file-tuzeit wa_file-records wa_file-req_insert

INTO work-buffer SEPARATED BY p_sep. TRANSFER work-buffer TO work-filename. IF sy-subrc = 0. MESSAGE s899(s1) WITH ' File Transferred'(014) '' '' ''. ENDIF.

ENDLOOP. ENDIF. CLOSE DATASET work-filename.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 21

An ABAP Program to Effortlessly Check Data Load Status in BW

ENDIF.

ENDFORM.

" download

END-OF-SELECTION. *********************************************************************** * End of Program "Z_DAILY_LOAD_STATUS_REPORT ***********************************************************************

STEP 2: Populate Server Time Zone Populate field tz = Required Server time zone from table ttzz Example: tz = MSTNO where value MSTNO represents Mountain standard time. STEP 3: Creation of Text elements Create the following Text elements and activate. We can also create text elements by double clicking on the serial number assigned to the text in the program which would take us to the Text elements screen.

Text Symbols:

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 22

An ABAP Program to Effortlessly Check Data Load Status in BW

Selection Texts:

STEP 4: Create and Assign Logical File to Physical Path Create a Logical file name and assign a physical path from Application server. Example: - Logical file 'Z_DAILY_LOAD_STATUS' is assigned a physical path
' /SAP/erp/dataload/ ' in the program.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 23

An ABAP Program to Effortlessly Check Data Load Status in BW

STEP 5: Execution of Program Activate the program and Text elements. Provide required selections and Execute the program.

Note: To view results on your SAP screen remove Write statement from comments. This program is primarily for BW 3.5 environment. I shall be posting Program for BI 7.0 version shortly.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 24

An ABAP Program to Effortlessly Check Data Load Status in BW

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.

SAP COMMUNITY NETWORK 2008 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 25

You might also like