You are on page 1of 20

Reusable Component

Daily BDoc Processing Statistics – Email and List


Prepared by: L&T Infotech
Daily BDoc Processing Statistics – Email and List
Jan 2010

Table of contents
1.0 Technology Environment....................................................................4
2.0 Business Requirement Analysis.............................................................4
2.1 Problem definition.........................................................................4
2.2 Business Requirements....................................................................4
3.0 Solution Walkthrough.........................................................................5
4.0 Solution Details................................................................................7
4.1 Solution Overview..........................................................................7
4.2 Process Enhancements....................................................................7

Reusable Component Page 2 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

Record of Release

Author Sharifuddin Inamdar


Reviewer
Date of Release
Date of Publishing on Portal
Date of Emailing to
Community

Reusable Component Page 3 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

1.0 Technology Environment


SAP CRM 7.0.

2.0 Business Requirement Analysis


Whenever a BDoc is processed in CRM system, only those which go into error are
reported by system; no information about successful or intermediate BDocs is
reported.

2.1 Problem definition


The Business required a Statistic of BDocs which should show number of BDocs in
each state grouped by the BDoc type.

2.2 Business Requirements


An email alert to the concerned user is to be automatically sent on a daily basis
about BDoc processing statistics grouped by BDoc state and BDoc Type.

As a solution, a report has been developed which picks up BDocs from Database,
groups them by BDoc State first and then by BDoc type and sends it as an email to
the specified recipients.
 This report can be run in Foreground as well as in Background.
 Foreground: When run in foreground, the selection parameters should be Date
Range and Time Range and the output should be in List formatn showing 3
different tables for BDocs in Error State, Intermediate State and Successful
State
 Background: When run in Background, the input is only list of email ids and the
Date Range is defaulted to yesterday’s date and Time Range should be the
whole day i.e., 00:00:00 to 23:59:59. The output form is same as that in point
above
 There should be a radio button available to chose execution in background
mode

Reusable Component Page 4 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

3.0 Solution Walkthrough


The solution developed is given below as process steps:

1. Execute Report ZIPC_BDOC_PROCESSING_STATS in SE38

2. Provide input values and execute

3. In Output you see 3 tables; for Successful Bdocs, Error BDocs and Intermediate
BDocs. Each table will have BDoc Type and count of BDocs in a particular state. At
the end of each table, total count of BDocs in that state is mentioned.

Reusable Component Page 5 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

Reusable Component Page 6 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

4. Now run the report in Batch mode and provide a list of email ids

5. You get a message of email sent successfully

6. Email is sent the email ids, check SOST

7. The email is received in Inbox:

Reusable Component Page 7 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

4.0 Solution Details


4.1 Solution Overview
The Database table SMW3_BDOC contains all the BDoc messages that are in the
system. The Solution consists of reading this database table filtering records based
on the date range in the input parameters. These filtered records are then
segregated into 3 different internal tables, based on 3 BDoc states: Successful,
Error and Intermediate. Each of these tables are then sorted according to BDoc
Types and count for each BDoc Type in each of these tables is determined.
Essentially, we create 3 internal tables for each State of BDoc and these internal
Reusable Component Page 8 of 20
Daily BDoc Processing Statistics – Email and List
Jan 2010

tables will have 2 columns: BDoc Type and BDoc Count. Once we have these 3
internal tables ready we format an output list and display it in case of foreground
execution. In case of batch run, we format an email and send it across to the
selected recipients.

The Solution Development comprises of the following steps:


 Create a structure - ZCOUNT (details given in point 4.2.1). This structure is
used as a type for returning parameter of the Forms used in report below
 Create a report ZIPC_BDOC_PROCESSING_STATS with the below details:
 Selection screen: Flag to run in background, Date and Time range, Email IDs
list
 Collect and segregate date based on input parameters
 If in foreground: Format result data and display as List
 If in background: format email and send it to all recipients in email list

4.2 Process Enhancements


The process developments consist of the following steps:
 Create Structure ZZCOUNT
 Create Report ZIPC_BDOC_PROCESSING_STATS

4.2.1 Create Structure - ZZCOUNT

Reusable Component Page 9 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

4.2.2 Create Report ZIPC_BDOC_PROCESSING_STATS


Report: ZIPC_GET_PRICE_CND_DELTA_ERROR

*-----------------------------------------------------------------------------*
* Program Name : ZIPC_BDOC_PROCESSING_STATS *
* Object No : *
* Created by : Sharif Inamdar *
* Created on : 02/8/2010 *
* Transport Request No: CS1K900849, CS1K900859 *
*-----------------------------------------------------------------------------*
* Purpose : Displaying and Emailing BDOC logs *
*-----------------------------------------------------------------------------*
* Modification Logs: *
* *
* Date Programmer Change Request# Description *
* ========== =============== =============== =============== *
*-----------------------------------------------------------------------------*

REPORT zipc_bdoc_processing_stats MESSAGE-ID zipc_status.

*****************************************************************
* Types-Pools
*****************************************************************
TYPE-POOLS : slis, line.

*****************************************************************
* Types
*****************************************************************
TYPES: BEGIN OF t_recipient,
sign TYPE c,
option(2) TYPE c,
low TYPE ad_smtpadr,
high TYPE ad_smtpadr,
END OF t_recipient.

DATA: lt_error_count TYPE TABLE OF zzcount WITH HEADER LINE,


lt_inter_count TYPE TABLE OF zzcount WITH HEADER LINE,
lt_success_count TYPE TABLE OF zzcount WITH HEADER LINE,
lv_last_count TYPE sy-tabix.
DATA: wa_recipient TYPE t_recipient.

*****************************************************************
* Global Data Declarations
*****************************************************************
DATA: lt_error_detail TYPE TABLE OF zcond_log_tab,
ls_error_detail TYPE zcond_log_tab,
alv_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
alv_layout TYPE slis_layout_alv.

DATA: lt_master TYPE TABLE OF zbdoc_tab WITH HEADER LINE.


DATA: lt_error_bdocs TYPE TABLE OF zbdoc_tab WITH HEADER LINE.
DATA: lt_inter_bdocs TYPE TABLE OF zbdoc_tab WITH HEADER LINE.
DATA: lt_success_bdocs TYPE TABLE OF zbdoc_tab WITH HEADER LINE.

Reusable Component Page 10 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

DATA: lv_count_e TYPE i, lv_count_i TYPE i, lv_count_s TYPE i, lv_char10 TYPE c LENGTH 10.

FIELD-SYMBOLS: <fs_bdocs> TYPE zbdoc_tab.

*****************************************************************
* Selection Screen
*****************************************************************
* Time selection
SELECTION-SCREEN BEGIN OF BLOCK date_sel WITH FRAME TITLE text-s01.

PARAMETERS: p_batch TYPE sxmsflag RADIOBUTTON GROUP time.

PARAMETERS: p_real TYPE sxmsflag RADIOBUTTON GROUP time DEFAULT 'X'.


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) text-cm7 FOR FIELD p_dat_fr.
PARAMETERS: p_dat_fr TYPE sy-datum MODIF ID ta1.
SELECTION-SCREEN COMMENT 46(2) text-cm9 FOR FIELD p_tim_fr.
PARAMETERS: p_tim_fr TYPE sy-uzeit MODIF ID ta1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) text-cm8 FOR FIELD p_dat_to.
PARAMETERS: p_dat_to TYPE sy-datum MODIF ID ta2.
SELECTION-SCREEN COMMENT 46(2) text-cm9 FOR FIELD p_tim_to.
PARAMETERS: p_tim_to TYPE sy-uzeit MODIF ID ta2.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK date_sel.

* Other selection
SELECTION-SCREEN BEGIN OF BLOCK other_sel WITH FRAME TITLE text-s16.
SELECT-OPTIONS s_sender FOR wa_recipient NO INTERVALS.
SELECTION-SCREEN END OF BLOCK other_sel.

*****************************************************************
* AT SELECTION-SCREEN
*****************************************************************
AT SELECTION-SCREEN OUTPUT.

IF p_dat_fr IS INITIAL AND p_dat_to IS INITIAL.


p_dat_fr = sy-datlo.
p_tim_fr = '000000'.
p_dat_to = sy-datlo + 1.
p_tim_to = '000000'.
ENDIF.

*****************************************************************
* START-OF-SELECTION
*****************************************************************
START-OF-SELECTION.

* Assigning Values (if Run in Batch Mode)


IF NOT p_batch IS INITIAL.
p_dat_fr = sy-datum - 1.

Reusable Component Page 11 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

p_tim_fr = '000000'.
p_dat_to = sy-datum - 1.
p_tim_to = '235959'.
ENDIF.

* If no date found then use the User Date


IF p_dat_fr IS INITIAL.
p_dat_fr = sy-datlo.
ENDIF.
IF p_dat_to IS INITIAL.
p_dat_to = sy-datlo + 1.
ENDIF.

IF p_tim_to IS INITIAL.
p_tim_to = '235959'.
ENDIF.

* Get BDOC Details from DB


SELECT * FROM smw3_bdoc
INTO CORRESPONDING FIELDS OF TABLE lt_error_bdocs
WHERE bdoc_state LIKE 'E%'
AND fctxt EQ 'MI0'
AND snd_date GE p_dat_fr
AND snd_date LE p_dat_to
AND snd_time GE p_tim_fr
AND snd_time LE p_tim_to.

SELECT * FROM smw3_bdoc


INTO CORRESPONDING FIELDS OF TABLE lt_inter_bdocs
WHERE bdoc_state LIKE 'I%'
AND fctxt EQ 'MI0'
AND snd_date GE p_dat_fr
AND snd_date LE p_dat_to
AND snd_time GE p_tim_fr
AND snd_time LE p_tim_to.

SELECT * FROM smw3_bdoc


INTO CORRESPONDING FIELDS OF TABLE lt_success_bdocs
WHERE bdoc_state LIKE 'F%'
AND fctxt EQ 'MI0'
AND snd_date GE p_dat_fr
AND snd_date LE p_dat_to
AND snd_time GE p_tim_fr
AND snd_time LE p_tim_to.

* Get the Total Counts


DESCRIBE TABLE lt_error_bdocs LINES lv_count_e.
DESCRIBE TABLE lt_inter_bdocs LINES lv_count_i.
DESCRIBE TABLE lt_success_bdocs LINES lv_count_s.

* Get Counts per BDOC Type


PERFORM get_count TABLES lt_error_bdocs lt_error_count.
PERFORM get_count TABLES lt_inter_bdocs lt_inter_count.
PERFORM get_count TABLES lt_success_bdocs lt_success_count.

Reusable Component Page 12 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

IF NOT p_batch IS INITIAL. "Executing in Batch Mode


* Send Mail
PERFORM send_mail TABLES lt_error_count
lt_inter_count
lt_success_count.
ELSE. "Executing in Foreground Mode
* Display Results
PERFORM display_result TABLES lt_error_count
lt_inter_count
lt_success_count
USING lv_count_e
lv_count_i
lv_count_s.
ENDIF.

*&---------------------------------------------------------------------*
*& Form get_count
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->T_BDOCTAB text
* -->T_COUNT text
*----------------------------------------------------------------------*
FORM get_count TABLES t_bdoctab STRUCTURE zbdoc_tab
t_count STRUCTURE zzcount.
CLEAR lv_last_count.
SORT t_bdoctab STABLE ASCENDING BY bdoc_type.
LOOP AT t_bdoctab .
AT END OF bdoc_type.
t_count-bdoc_type = t_bdoctab-bdoc_type.
t_count-count = sy-tabix - lv_last_count.
lv_last_count = sy-tabix.
APPEND t_count.
ENDAT.
ENDLOOP.

ENDFORM. "get_count

*&---------------------------------------------------------------------*
*& Form SEND_MAIL
*&---------------------------------------------------------------------*
* Module for Generating and Sending Mail *
*----------------------------------------------------------------------*
* -->LT_ERROR_DETAIL Error Detail Table
*----------------------------------------------------------------------*
FORM send_mail TABLES lt_error_count STRUCTURE zzcount
lt_inter_count STRUCTURE zzcount
lt_success_count STRUCTURE zzcount.
* Module Related Data Declaration.
DATA: v_email_desc TYPE so_obj_des VALUE 'BDOC Processing Statistics',
v_date(10) TYPE c,
v_tmp_str TYPE string,

Reusable Component Page 13 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

v_bcs_message TYPE string,


v_conlength TYPE i,
v_conlengths TYPE so_obj_len,
v_sent_to_all TYPE os_boolean,
wa_html TYPE w3html,
i_html TYPE STANDARD TABLE OF w3html,
v_sender TYPE ad_smtpadr VALUE '-BDocProcessingStatistics@ingrammicro.com'.

DATA: v_binterval_date(10) TYPE c,


v_einterval_date(10) TYPE c,
v_binterval_time(10) TYPE c,
v_einterval_time(10) TYPE c.

* Class Declaration
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
sender_id TYPE REF TO if_sender_bcs,
recipient TYPE REF TO if_recipient_bcs,
bcs_exception TYPE REF TO cx_bcs.

DATA: lv_dummy TYPE c LENGTH 4.

CLEAR: v_conlength, v_conlengths .


v_conlength = STRLEN( v_tmp_str ) .
v_conlengths = v_conlength .

* Converting Date Format


WRITE p_dat_fr TO v_date DD/MM/YYYY.

* Email Subject
CONCATENATE sy-sysid ':' INTO lv_dummy.
CONCATENATE lv_dummy v_email_desc INTO v_email_desc SEPARATED BY space.
CONCATENATE v_email_desc 'on' v_date INTO v_email_desc SEPARATED BY space.

* Email Sender
CONCATENATE sy-sysid v_sender INTO v_sender.

* Mail Body
* Sending the Duration
WRITE p_dat_fr TO v_binterval_date DD/MM/YYYY.
WRITE p_tim_fr TO v_binterval_time USING EDIT MASK '__:__:__'.
WRITE p_dat_to TO v_einterval_date DD/MM/YYYY.
WRITE p_tim_to TO v_einterval_time USING EDIT MASK '__:__:__'.

CONCATENATE 'Duration: From ' v_binterval_date '/' v_binterval_time


' To ' v_einterval_date '/' v_einterval_time '<br/>'
INTO wa_html SEPARATED BY space.
APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.

** Header line
* wa_html = '<b>BDOC Processing Statistics:</b><br/>'.
* APPEND wa_html TO i_html.
* wa_html = '<br />'.

Reusable Component Page 14 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

* APPEND wa_html TO i_html.

***************************************************************************************
* Fill Table for Processed BDocs *
***************************************************************************************

* Title line
CLEAR: wa_html.
wa_html = '<b>BDOC Statistics – Processed State:<b><br />'.
APPEND wa_html TO i_html.

IF lt_success_count[] IS INITIAL. " If No Message Found


wa_html = '<b>No Processed BDOCs found for the specified period.</b>'.
APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = ' '.
APPEND wa_html TO i_html.
ELSE. "Message Found

* Create TABLE tag for HTML


CONCATENATE '<table border="1"><tr bgcolor="#99cc66">'
'<th>BDOC Type</th>'
'<th>BDOC Count</th></tr>'
INTO wa_html.
APPEND wa_html TO i_html.

* Fill ROWS for HTML Table


LOOP AT lt_success_count.
CLEAR lv_char10.
lv_char10 = lt_success_count-count.
CONCATENATE '<tr><td>' lt_success_count-bdoc_type '</td>'
'<td>' lv_char10 '</td></tr>' INTO wa_html.
APPEND wa_html TO i_html.
ENDLOOP.
* End TABLE tag of HTML
wa_html = '</table>'."'</table><br />'.
APPEND wa_html TO i_html.

ENDIF.

* End Line for 'Total Count'


CLEAR: lv_char10, wa_html.
lv_char10 = lv_count_s.
CONCATENATE '<b>Total Count:' lv_char10 '<b><br/><br/>'
INTO wa_html SEPARATED BY space.
APPEND wa_html TO i_html.

***************************************************************************************
* Fill Table for Error BDocs *
***************************************************************************************

* Title line

Reusable Component Page 15 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

CLEAR: wa_html.
wa_html = 'BDOC Statistics – Error State: <br />'.
APPEND wa_html TO i_html.

IF lt_error_count[] IS INITIAL. " If No Message Found

wa_html = '<b>No Erro BDOCs found for the specified period.</b>'.


APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = ' '.
APPEND wa_html TO i_html.

ELSE. "Message Found

* Create TABLE tag for HTML


CONCATENATE '<table border="1"><tr bgcolor="#99cc66">'
'<th>BDOC Type</th>'
'<th>BDOC Count</th></tr>'
INTO wa_html.
APPEND wa_html TO i_html.

* Fill ROWS for HTML Table


LOOP AT lt_error_count.
CLEAR lv_char10.
lv_char10 = lt_error_count-count.
CONCATENATE '<tr><td>' lt_error_count-bdoc_type '</td>'
'<td>' lv_char10 '</td></tr>' INTO wa_html.
APPEND wa_html TO i_html.
ENDLOOP.
* End TABLE tag of HTML
wa_html = '</table>'.
APPEND wa_html TO i_html.

ENDIF.

* End Line for 'Total Count'


CLEAR: lv_char10, wa_html.
lv_char10 = lv_count_e.
CONCATENATE '<b>Total Count:' lv_char10 '<b><br/><br/>'
INTO wa_html SEPARATED BY space.
APPEND wa_html TO i_html.

***************************************************************************************
* Fill Table for Intermediate BDocs *
***************************************************************************************

* Title line
CLEAR: wa_html.
wa_html = 'BDOC Statistics – Intermediate State: <br/>'.
APPEND wa_html TO i_html.

IF lt_inter_count[] IS INITIAL. " If No Message Found

Reusable Component Page 16 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

wa_html = '<b>No Intermediate BDOCs found for the specified period.</b>'.


APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = '<br />'.
APPEND wa_html TO i_html.
wa_html = ' '.
APPEND wa_html TO i_html.

ELSE. "Message Found

* Create TABLE tag for HTML


CONCATENATE '<table border="1"><tr bgcolor="#99cc66">'
'<th>BDOC Type</th>'
'<th>BDOC Count</th></tr>'
INTO wa_html.
APPEND wa_html TO i_html.

* Fill ROWS for HTML Table


LOOP AT lt_inter_count.
CLEAR lv_char10.
lv_char10 = lt_inter_count-count.
CONCATENATE '<tr><td>' lt_inter_count-bdoc_type '</td>'
'<td>' lv_char10 '</td></tr>' INTO wa_html.
APPEND wa_html TO i_html.
ENDLOOP.
* End TABLE tag of HTML
wa_html = '</table>'.
APPEND wa_html TO i_html.

ENDIF.

* End Line for 'Total Count'


CLEAR: lv_char10, wa_html.
lv_char10 = lv_count_i.
CONCATENATE '<b>Total Count:' lv_char10 '<b><br/><br/>'
INTO wa_html SEPARATED BY space.
APPEND wa_html TO i_html.

***************************************************************************************
* Start Send Request *
***************************************************************************************

TRY.
CLEAR send_request .
send_request = cl_bcs=>create_persistent( ).
CLEAR document .
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = i_html
i_length = v_conlengths
i_subject = v_email_desc ).
* add document to send request
CALL METHOD send_request->set_document( document ).

Reusable Component Page 17 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

CLEAR sender_id .
sender_id = cl_cam_address_bcs=>create_internet_address( v_sender ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender_id.

LOOP AT s_sender INTO wa_recipient .


CLEAR recipient .
recipient = cl_cam_address_bcs=>create_internet_address(
wa_recipient-low ).
* add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '.
ENDLOOP .

CALL METHOD send_request->set_status_attributes


EXPORTING
i_requested_status = 'E'
i_status_mail = 'E'.
CALL METHOD send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = v_sent_to_all ).
IF v_sent_to_all = 'X'.
* WRITE 'Mail Sent Successfully'.
MESSAGE s002.
ENDIF.
COMMIT WORK.
CATCH cx_bcs INTO bcs_exception.
v_bcs_message = bcs_exception->get_text( ).
* WRITE v_bcs_message.
MESSAGE e003 WITH v_bcs_message.
EXIT.
ENDTRY.

ENDFORM. "send_mail

*&---------------------------------------------------------------------*
*& Form display_result
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->LT_ERROR_DETAIL text
*----------------------------------------------------------------------*
FORM display_result TABLES lt_error_count STRUCTURE zzcount
lt_inter_count STRUCTURE zzcount
lt_success_count STRUCTURE zzcount
USING lv_count_e TYPE any
lv_count_i TYPE any

Reusable Component Page 18 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

lv_count_s TYPE any.


DATA: lv_line TYPE c LENGTH 43.
*********************** DISPLAY SUCCESSFUL BDOCS**************************
WRITE:/ 'BDOC Statistics - Processed State:' COLOR 5.
WRITE:/ line_top_left_corner AS LINE NO-GAP,
'----------------------------',
30 line_top_middle_corner AS LINE NO-GAP,
'------------',
42 line_top_right_corner AS LINE.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = 'BDOC Type'.
lv_line+29(1) = '|'.
lv_line+30(10) = 'BDOC Count'.
lv_line+41(1) = '|'.
WRITE:/ lv_line+(42) INTENSIFIED COLOR 1 .
NEW-LINE.
WRITE: (42) sy-uline.

LOOP AT lt_success_count.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = lt_success_count-bdoc_type.
lv_line+29(1) = '|'.
lv_line+30(10) = lt_success_count-count.
lv_line+41(1) = '|'.

WRITE:/ lv_line.
NEW-LINE.
WRITE: (42) sy-uline.
ENDLOOP.
WRITE:/ 'Total Count: '. WRITE lv_count_s COLOR 5. SKIP.
*********************** DISPLAY ERROR BDOCS**************************
ULINE.
WRITE:/ 'BDOC Statistics - Error State:' COLOR 6.
WRITE:/ line_top_left_corner AS LINE NO-GAP,
'----------------------------',
30 line_top_middle_corner AS LINE NO-GAP,
'------------',
42 line_top_right_corner AS LINE.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = 'BDOC Type'.
lv_line+29(1) = '|'.
lv_line+30(10) = 'BDOC Count'.
lv_line+41(1) = '|'.
WRITE:/ lv_line+(42) INTENSIFIED COLOR 1 .
NEW-LINE.
WRITE: (42) sy-uline.

LOOP AT lt_error_count.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = lt_error_count-bdoc_type.
lv_line+29(1) = '|'.

Reusable Component Page 19 of 20


Daily BDoc Processing Statistics – Email and List
Jan 2010

lv_line+30(10) = lt_error_count-count.
lv_line+41(1) = '|'.

WRITE:/ lv_line.
NEW-LINE.
WRITE: (42) sy-uline.
ENDLOOP.
WRITE:/ 'Total Count: '. WRITE lv_count_e COLOR 6. SKIP.
*********************** DISPLAY INTERMEDIATE BDOCS**************************
ULINE.
WRITE:/ 'BDOC Statistics - Intermediate State:' COLOR 7.
WRITE:/ line_top_left_corner AS LINE NO-GAP,
'----------------------------',
30 line_top_middle_corner AS LINE NO-GAP,
'------------',
42 line_top_right_corner AS LINE.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = 'BDOC Type'.
lv_line+29(1) = '|'.
lv_line+30(10) = 'BDOC Count'.
lv_line+41(1) = '|'.
WRITE:/ lv_line+(42) INTENSIFIED COLOR 1 .
NEW-LINE.
WRITE: (42) sy-uline.

LOOP AT lt_inter_count.
CLEAR lv_line.
lv_line+0(1) = '|'.
lv_line+2(26) = lt_inter_count-bdoc_type.
lv_line+29(1) = '|'.
lv_line+30(10) = lt_inter_count-count.
lv_line+41(1) = '|'.

WRITE:/ lv_line.
NEW-LINE.
WRITE: (42) sy-uline.
ENDLOOP.
WRITE:/ 'Total Count: '. WRITE lv_count_i COLOR 7. SKIP. ULINE.

ENDFORM. "display_result

Reusable Component Page 20 of 20

You might also like