Skip to Content

Applies to:

SAP NetWeaver Business Warehouse (formerly BI). This has been tested and working fine on SAP BI 7.0 version.

Applicable for other BW versions as well.

Summary :

This document will help to understand the steps one can do to run a process chain on the last day of month.

This is specially useful in case of MEC (Month End Closure) activities to avoid the manual effort from consultants and saving the efforts and time for project.

Author: Arpit Khandelwal.

Company: Accenture Services Pvt. Ltd.

Author Bio:

apk.PNG

Arpit Khandelwal is a SAP BI Consultant currently working with Accenture Services Private Limited. He has 2.7 years of experience in  BW/BI implementation and support projects. He has been particularly involved in SAP BW Archiving Activities. Major area of work involves with the extraction of R/3 data from LO and FI datasources.



Basic Scenario ::


A partial developed BW Landscape has been assigned to you. The user need to run the MEC load for the Inventory datasource on the last day of the month from now on without involving the manual work by the consultant.



Functional Aspect ::


The simple requirement brings to the logic that system date needs to be checked on daily basis to find out whether the same is last day for that  month or not. So the code must involve the logic to check this condition and whenever the condition is met, the process chain has to be triggered.


This will covered by using the SAP FM “‘SLS_MISC_GET_LAST_DAY_OF_MONTH‘ to compare its output against sy-datum on daily basis. When this matches , the Inventory load process chain will run.



Technical Design ::


Following the document created by Surendra Kumar Reddy Koduru  at link


http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80e36f3e-0e7f-2e10-b7b7-a08d89046b03?QuickLink=index&….


This is the best document which tells us how to use event to trigger the chain on last month of day.

But even after doing everything, there might be confusion regarding the process chain settings after creating code , event  which I have tried to clarify through the snapshots of each and every setting.


So defining the steps after you have created the ABAP program with the reqquired code , create the event and assigned the event in the process chain variant.


We need to create a new process chain to execute the Program which we created to know if the sy-datum date (i.e. today’s date is equal to last day of month) . I have created this process chain “ZTEST” which will run on daily basis and execute the custom ABAP program.


s1.JPG




Start Variant settings of chain “ZTEST” to execute the process chain daily



s2.JPG



Variant settings of Program – assigning of custom created abap program to variant ::


s3.JPG


Code for your reference :: (Same as in the document link given above except for event/process names)


REPORT  ZEVENT_MEC03_TEST.

DATA: zfd TYPE sy-datum,

      zld TYPE sy-datum.

zfd = sy-datum.

CALL FUNCTION ‘SLS_MISC_GET_LAST_DAY_OF_MONTH’

  EXPORTING

    DAY_IN            = zfd

  IMPORTING

    LAST_DAY_OF_MONTH = zld

  EXCEPTIONS

    DAY_IN_NOT_VALID  = 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.

IF sy-datum = zld.

  CALL FUNCTION ‘RSSM_EVENT_RAISE’

    EXPORTING

      I_EVENTID              = ‘MEC03_1’

      I_EVENTPARM            = ‘ZMEC_PARAM’

    EXCEPTIONS

      BAD_EVENTID            = 1

      EVENTID_DOES_NOT_EXIST = 2

      EVENTID_MISSING        = 3

      RAISE_FAILED           = 4

      OTHERS                 = 5.

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

ELSE.

  EXIT.

ENDIF.

“ZTEST” execution everyday ::

s4.JPG

The main process chain – ZMEC03_MONTH_END which needs to be run on last day of month.

s5.JPG

Start Variant for Process chain – ZMEC03_MONTH_END

s6.JPG

Once we have defined the 2 process chain – one for execution of ABAP program on daily basis

and the 2nd process chain to be run on basis of event trigerred on outcome of custom ABAP program in chain 1.

The 2nd process chain got triggerred on 31st Dec 2013 as per the created settings.

s7.JPG

As we can see in the snapshot the MEC process chain got trigerred on the 31st and rest days it does not run as per the requirement.

Don’t get worried about red step, that is happening beacuse of internal issue in process chain

Let me know if you have doubt while doing the steps in your system or if you find something not covered in these steps.

I will try to add the same to the document and improve it. Thanks a lot.

Reference Sources ::

Triggering the Process Chains at  Last Day of Every Month using Events document ( http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80e36f3e-0e7f-2e10-b7b7-a08d89046b03?QuickLink=index&…)

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply