Code from Figure 15 of “Enable Your Process Chains to React to Outcomes of ABAP Programs” by David Eady. *&---------------------------------------------------------------------* *& Report ZBW_CHKFIRSTDAYOFPERIOD * *& * *&---------------------------------------------------------------------* *& * *& * *&---------------------------------------------------------------------* REPORT ZBW_CHKFIRSTDAYOFPERIOD . ************************************************************************ * Date: 5/3/2005 * Author: David Eady * * This program is intended to be called by BW process chains. It should * check if today is the first day of the fiscal period. If so, it * should do nothing (complete successfully). If not it should * return message ZBW 003 as an error. This should terminate process * chain execution. * data: wfirstday like sy-datum. data: wbuper like t009b-poper. data: wgjahr like t009b-bdatj. * get today's fiscal period CALL FUNCTION 'DATE_TO_PERIOD_CONVERT' EXPORTING I_DATE = sy-datum * I_MONMIT = 00 I_PERIV = 'V9' IMPORTING E_BUPER = wbuper E_GJAHR = wgjahr EXCEPTIONS INPUT_FALSE = 1 T009_NOTFOUND = 2 T009B_NOTFOUND = 3 OTHERS = 4. * get the first day of the period CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET' EXPORTING I_GJAHR = wgjahr * I_MONMIT = 00 I_PERIV = 'V9' I_POPER = wbuper IMPORTING E_DATE = wfirstday EXCEPTIONS INPUT_FALSE = 1 T009_NOTFOUND = 2 T009B_NOTFOUND = 3 OTHERS = 4. * if today is not the first day of the period, return an error. if sy-datum <> wfirstday. * Date is not the first day of the fiscal period. MESSAGE E003(ZBW). endif. * otherwise complete successfully