Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

 

 

 

 

 

Applies to:All SAP BI 7.0 users.

Summary Trigger the process chains on alternate week of a year 

Author(s):  

   
Company:     Infosys Ltd
Created on:    4/01/2012
Author(s) Bio:  Anshul Rawat is a SAP BI Consultant currently working in Infosys Ltd. He has around 2.8 years of experience and involved in implementation and development of various BI/BW projects

Scenario

Sometimes it is required to trigger the process chains on alternate weeks of a year.

How to achieve

* *Suppose we have to trigger Process Chain on very even Week (2, 4, 6 etc.).

Create an Event and assign it to the Process Chain which needs to be triggered on every even week.

Create another process chain with ABAP Process Type. Put the below code in a Program.

 CALL FUNCTION 'DATE_GET_WEEK'
                     EXPORTING
                       DATE              = sy-datum
_                    _IMPORTING
                      WEEK               = v_datum    “ type YYYYWW
*                    EXCEPTIONS
*                      DATE_INVALID       = 1
*                      OTHERS             = 2

 

v_week = v_datum+4(2).

v_value = v_week MOD 2.

If v_value EQ 0.

 CALL FUNCTION 'BP_EVENT_RAISE' EXPORTING
    eventid = 'ZTEST_EVENT'
    EXCEPTIONS
        bad_eventid = 1
        eventid_does_not_exist = 2
        eventid_missing = 3
        raise_failed = 4
        OTHERS = 5.

Endif.

The FM ‘DATE_GET_WEEK’ in the above program takes the system date and converts it into week Year/Week form YYYYWW. The week will be calculated and then it checks if week is even or odd. If even it will call the FM ‘BP_EVENT_RAISE’ which will trigger the event. This event will be assign in the process chain which we want to trigger every even week.