REPORT ZAO00001 message-id ZM.

************************************************************************ * Program : ZAO00001 Creation Date: 06/01/2010 * * Type : Report * * Title : Program to update the TVARV variables for Archiving Jobs * * Author : Anil Kumar kupparathi * * Satyam Computers, India * * Spec ID : (Enhancement-NNA-2009-1447) * * * * Pathname of Spec: * ************************************************************************ * Description : Program to update the TVARV variables for Monthly * * Archiving Jobs * * * ************************************************************************ * ************************************************************************ *______________________________________________________________________* * Modification History: * * MM/DD/YYYY Author Transport# * * Changes: * * 06/01/2010 Anil Kumar Kupparathi DV5K953867 * * Initial Version * ************************************************************************ *----------------------------------------------------------------------* * Data Decleration *----------------------------------------------------------------------* data : g_wa_t001B g_arc_fye l_arch_wa_date g_arc_18_yr type type type type t001B, t001B-FRYE2, sy-datum, t001B-FRYE2.

*----------------------------------------------------------------------* * Selection Screen Variables *----------------------------------------------------------------------* Selection-screen begin of block blk1 with frame title text-001. Parameters: parm AS CHECKBOX. Selection-screen End of block blk1. *----------------------------------------------------------------------* * Start Of Selection *----------------------------------------------------------------------* Start-of-selection. * Performing function module Z_GET_VARIANT_CONTENTS. include ZZIGETVAR. PERFORM lock_program. if parm = 'X'. *Get Current Fiscal Year and Current Fiscal Period. select single * from t001B into g_wa_t001B where bukrs = 'NNNA' and MKOAR = 'S'.

MESSAGE s127 WITH 'TVARV' 'Z_ARC_FI_DOC_FISY_TO' 'updated sucessfully'.if sy-subrc = 0. else. MESSAGE e127 WITH 'TVARV' 'Z_ARC_PCA_ITM_FY' 'RC =' sy-subrc. *CO_ITEM UPDATE tvarv SET low = g_arc_fye WHERE name = 'Z_ARC_CO_ITM_FY' and type = 'P' and . else. g_arc_fye = g_wa_t001B-FRYE2 . MESSAGE s127 WITH 'TVARV' 'Z_ARC_PCA_ITM_FY' 'updated sucessfully'. IF sy-subrc <> 0. *FI_DOCUMNT UPDATE tvarv SET low = g_arc_fye WHERE name = 'Z_ARC_FI_DOC_FISY_TO' and type = 'P' and NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_FY' 'updated sucessfully'. ENDIF. *FI_SL_DATA UPDATE tvarv SET high = g_arc_fye WHERE name = 'Z_ARC_SL_DATA_SL_FY' and type = 'S' and NUMB = '0000'. *EC_PCA_ITM UPDATE tvarv SET high = g_arc_fye WHERE name = 'Z_ARC_PCA_ITM_FY' and type = 'S' and NUMB = '0000'. IF sy-subrc <> 0.3. MESSAGE e127 WITH 'TVARV' 'Z_ARC_FI_DOC_FISY_TO' 'RC =' sy-subrc. write / 'TVARV Z_ARC_SL_DATA_SL_FY updated sucessfully'. ENDIF. MESSAGE e127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_FY' 'RC =' sy-subrc. write / 'TVARV Z_ARC_FI_DOC_FISY_TO updated sucessfully'. write / 'TVARV Z_ARC_PCA_ITM_FY updated sucessfully'. IF sy-subrc <> 0. else. ENDIF. *Fiscal Year and substract it by 3 years and assign them *to the TVARV variables.

else. ENDIF. write / 'TVARV Z_ARC_CPA1_FY updated sucessfully'. else. IF sy-subrc <> 0. . IF sy-subrc <> 0. write / 'TVARV Z_ARC_CPA1_FY_L updated sucessfully'. ENDIF. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_FY' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CO_ITM_FY' 'updated sucessfully'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_FY_L' 'updated sucessfully'. else. ENDIF. write / 'TVARV Z_ARC_CPA1_NM_FY updated sucessfully'. write / 'TVARV Z_ARC_CO_ITM_FY updated sucessfully'. *Lower Limit only UPDATE tvarv SET low = g_arc_fye WHERE name = 'Z_ARC_CPA1_FY_L' and type = 'S' and NUMB = '0000'. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FY' 'RC =' sy-subrc. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_FY_L' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FY' 'updated sucessfully'.NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_FY' 'updated sucessfully'. *COPA1_NNA1 UPDATE tvarv SET high = g_arc_fye WHERE name = 'Z_ARC_CPA1_FY' and type = 'S' and NUMB = '0000'. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CO_ITM_FY' 'RC =' sy-subrc. IF sy-subrc <> 0. IF sy-subrc <> 0. else. *COPA1_NM01 UPDATE tvarv SET WHERE name = type = NUMB = high = g_arc_fye 'Z_ARC_CPA1_NM_FY' and 'S' and '0000'.

*Lower Limit only UPDATE tvarv SET low = g_arc_fye WHERE name = 'Z_ARC_CPA1_NM_FY_L' and type = 'S' and NUMB = '0000'. *Fiscal Year of ACCTIT will be Current Fiscal Year . ENDIF.1. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FY_L' 'RC =' sy-subrc. ENDIF. IF sy-subrc <> 0. MESSAGE s127 WITH 'TVARV' 'ZARC_ACCTIT_FP_TO' 'updated sucessfully'. else. endif. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FY_L' 'updated sucessfully'. write / 'TVARV ZARC_ACCTIT_FP_TO updated sucessfully'. *Assign the Current Fiscal Period and assign them to the TVARV variables *MM_ACCTIT UPDATE tvarv SET low = g_wa_t001B-FRPE2 WHERE name = 'ZARC_ACCTIT_FP_TO' and type = 'P' and NUMB = '0000'. IF sy-subrc <> 0. UPDATE tvarv SET low = g_arc_18_yr WHERE name = 'ZARC_ACCTIT_FY_TO' and type = 'P' and NUMB = '0000'. *parameter: g_arc_18_yr = g_wa_t001B-FRYE1 . else. MESSAGE e127 WITH 'TVARV' 'ZARC_ACCTIT_FY_TO' 'RC =' sy-subrc. write / 'TVARV ZARC_ACCTIT_FY_TO updated sucessfully'. else. . ENDIF. IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'ZARC_ACCTIT_FP_TO' 'RC =' sy-subrc.18 months. write / 'TVARV Z_ARC_CPA1_NM_FY_L updated sucessfully'. MESSAGE s127 WITH 'TVARV' 'ZARC_ACCTIT_FY_TO' 'updated sucessfully'.

UPDATE tvarv SET low = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_FI_DOC_FISP_TO' and type = 'P' and NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_PCA_ITM_FP' 'updated sucessfully'. ENDIF. else. ENDIF. else. IF sy-subrc <> 0. MESSAGE s127 WITH 'TVARV' 'ZARC_ACCTIT_FP_TO' 'updated sucessfully'. MESSAGE e127 WITH 'TVARV' 'Z_ARC_PCA_ITM_FP' 'RC =' sy-subrc. else. write / 'TVARV Z_ARC_PCA_ITM_FP updated sucessfully'. ENDIF. IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_FP' 'RC =' sy-subrc. *EC_PCA_ITM UPDATE tvarv SET high = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_PCA_ITM_FP' and type = 'S' and NUMB = '0000'. *CO_ITEM UPDATE tvarv SET low = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_CO_ITM_FYP' and . *SL_DATA UPDATE tvarv SET high = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_SL_DATA_SL_FP' and type = 'S' and NUMB = '0000'. IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'ZARC_ACCTIT_FP_TO' 'RC =' sy-subrc. write / 'TVARV Z_ARC_SL_DATA_SL_FP updated sucessfully'. write / 'TVARV ZARC_ACCTIT_FP_TO updated sucessfully'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_FP' 'updated sucessfully'.ENDIF.

MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FYP' 'RC =' sy-subrc. IF sy-subrc <> 0. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_FYP' 'updated sucessfully'. ENDIF. else. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_FYP_L' 'updated sucessfully'. write / 'TVARV Z_ARC_CO_ITM_FYP updated sucessfully'. IF sy-subrc <> 0.type = 'P' and NUMB = '0000'. IF sy-subrc <> 0. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CO_ITM_FYP' 'updated sucessfully'. IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_FYP_L' 'RC =' sy-subrc. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_FYP' 'RC =' sy-subrc. . else. ENDIF. *COPA1_NNA1 UPDATE tvarv SET high = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_CPA1_FYP' and type = 'S' and NUMB = '0000'. else. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CO_ITM_FYP' 'RC =' sy-subrc. write / 'TVARV Z_ARC_CPA1_FYP updated sucessfully'. *Lower Period only UPDATE tvarv SET low = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_CPA1_FYP_L' and type = 'S' and NUMB = '0000'. ENDIF. *COPA1_NM01 UPDATE tvarv SET high = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_CPA1_NM_FYP' and type = 'S' and NUMB = '0000'. else. write / 'TVARV Z_ARC_CPA1_FYP_L updated sucessfully'.

*Dates *----*substract 3 years from current Date. ENDIF. write / 'TVARV Z_ARC_CPA1_NM_FYP updated sucessfully'. *MM_MATBEL UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_MATBEL_PD' and type = 'S' and NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FYP_L' 'updated sucessfully'. else. else.MESSAGE s127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FYP' 'updated sucessfully'. *MM_EBAN UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_EBAN_POREQ_DT' and . UPDATE tvarv SET low = g_wa_t001B-FRPE2 WHERE name = 'Z_ARC_CPA1_NM_FYP_L' and type = 'S' and NUMB = '0000'. IF sy-subrc <> 0. IF sy-subrc <> 0. CALL FUNCTION '/SAPHT/DRM_CALC_DATE' EXPORTING DATE = sy-datum DAYS = '00' MONTHS = '00' SIGN = '-' YEARS = '03' IMPORTING CALC_DATE = l_arch_wa_date. MESSAGE e127 WITH 'TVARV' 'Z_ARC_CPA1_NM_FYP_L' 'RC =' sy-subrc. write / 'TVARV Z_ARC_CPA1_NM_FYP_L updated sucessfully'. ENDIF. MESSAGE e127 WITH 'TVARV' 'ZARC_MATBEL_PD' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'ZARC_MATBEL_PD' 'updated sucessfully'. ENDIF. write / 'TVARV ZARC_MATBEL_PD updated sucessfully'.

IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'ZARC_VBAK_CRDT' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'ZARC_VBRK_CRDT' 'updated sucessfully'. . MESSAGE e127 WITH 'TVARV' 'ZARC_LIKP_CRDT' 'RC =' sy-subrc. MESSAGE e127 WITH 'TVARV' 'ZARC_EBAN_POREQ_DT' 'RC =' sy-subrc. *SD_VBRK UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_VBRK_CRDT' and type = 'S' and NUMB = '0000'. write / 'TVARV ZARC_VBRK_CRDT updated sucessfully'. *SD_VBAK UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_VBAK_CRDT' and type = 'S' and NUMB = '0000'. else. else.type = 'S' NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'ZARC_LIKP_CRDT' 'updated sucessfully'. ENDIF. MESSAGE s127 WITH 'TVARV' 'ZARC_EBAN_POREQ_DT' 'updated sucessfully'. and IF sy-subrc <> 0. write / 'TVARV ZARC_LIKP_CRDT updated sucessfully'. ENDIF. MESSAGE e127 WITH 'TVARV' 'ZARC_VBRK_CRDT' 'RC =' sy-subrc. *RV_LIKP UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_LIKP_CRDT' and type = 'S' and NUMB = '0000'. IF sy-subrc <> 0. ENDIF. write / 'TVARV ZARC_EBAN_POREQ_DT updated sucessfully'. IF sy-subrc <> 0. else. else.

IF sy-subrc <> 0. write / 'TVARV ZARC_EKKO_KEY_DT updated sucessfully'. write / 'TVARV ZARC_VBAK_CRDT updated sucessfully'. ENDIF. write / 'TVARV ZARC_EKKO_DOC_DT updated sucessfully'. *MM_EKKO UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_EKKO_DOC_DT' and type = 'S' and NUMB = '0000'. MESSAGE e127 WITH 'TVARV' 'ZARC_REBEL_DOC_DT' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'ZARC_EKKO_KEY_DT' 'updated sucessfully'.MESSAGE s127 WITH 'TVARV' 'ZARC_VBAK_CRDT' 'updated sucessfully'. else. ENDIF. write / 'TVARV ZARC_REBEL_DOC_DT updated sucessfully'. MESSAGE e127 WITH 'TVARV' 'ZARC_EKKO_KEY_DT' 'RC =' sy-subrc. ENDIF. MESSAGE e127 WITH 'TVARV' 'ZARC_EKKO_DOC_DT' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'ZARC_EKKO_DOC_DT' 'updated sucessfully'. IF sy-subrc <> 0. UPDATE tvarv SET high = l_arch_wa_date . *MM_REBEL UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_REBEL_DOC_DT' and type = 'S' and NUMB = '0000'. UPDATE tvarv SET low = sy-datum WHERE name = 'ZARC_EKKO_KEY_DT' and type = 'P' and NUMB = '0000'. else. else. IF sy-subrc <> 0. ENDIF. MESSAGE s127 WITH 'TVARV' 'ZARC_REBEL_DOC_DT' 'updated sucessfully'.

else. ENDIF. MESSAGE e127 WITH 'TVARV' 'ZARC_REBEL_POS_DT' 'RC =' sy-subrc. MESSAGE s127 WITH 'TVARV' 'ZARC_REBEL_POS_DT' 'updated sucessfully'. write / 'Z_ARC_FI_DOC_KEY_DT updated sucessfully'. CALL FUNCTION '/SAPHT/DRM_CALC_DATE' EXPORTING DATE = sy-datum . MESSAGE s127 WITH 'TVARV' 'Z_ARC_FI_DOC_KEY_DT' 'updated sucessfully'. *FI_SL_DATA UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'Z_ARC_SL_DATA_SL_PD' and type = 'S' and NUMB = '0000'. *substract 18 months from current Date. MESSAGE e127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_PD' 'RC =' sy-subrc. and and IF sy-subrc <> 0. MESSAGE e127 WITH 'TVARV' 'Z_ARC_FI_DOC_KEY_DT' 'RC =' sy-subrc.WHERE name = 'ZARC_REBEL_POS_DT' type = 'S' NUMB = '0000'. MESSAGE s127 WITH 'TVARV' 'Z_ARC_SL_DATA_SL_PD' 'updated sucessfully'. else. and and IF sy-subrc <> 0. write / 'Z_ARC_SL_DATA_SL_PD updated sucessfully'. else. ENDIF. *FI_DOCUMNT UPDATE tvarv SET low = sy-datum WHERE name = 'Z_ARC_FI_DOC_KEY_DT' type = 'P' NUMB = '0000'. *Posting Date for 18 Days *MM_ACCTIT clear l_arch_wa_date. ENDIF. IF sy-subrc <> 0. write / 'TVARV ZARC_REBEL_POS_DT updated sucessfully'.

p2 text *----------------------------------------------------------------------* FORM lock_program. End-of-selection. MESSAGE e127 WITH 'TVARV' 'ZARC_ACCTIT_PD_TO' 'RC =' sy-subrc. IF sy-subrc <> 0.DAYS MONTHS SIGN YEARS IMPORTING CALC_DATE = = = = '00' '18' '-' '00' = l_arch_wa_date. ENDFORM.'. *&---------------------------------------------------------------------* *& Form lock_program *&---------------------------------------------------------------------* * Subroutine to lock the program from concurrent executions *----------------------------------------------------------------------* * --> p1 text * <-. write / 'ZARC_ACCTIT_PD_TO updated sucessfully'. Write : 03 'The Archiving TVARV Variables not updated. MESSAGE s127 WITH 'TVARV' 'ZARC_ACCTIT_PD_TO' 'updated sucessfully'. else. endif. commit work. ENDIF. skip. Write at 03 'The Archiving TVARV Variables updated scucessfully'. . ENDIF. MESSAGE e000 WITH 'Another copy of the program' 'currently running' space space. IF sy-subrc <> 0. skip. * Enqueue report to disallow concurrent execution CALL FUNCTION 'Z_LOCK_PROGRAM' EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. else. UPDATE tvarv SET high = l_arch_wa_date WHERE name = 'ZARC_ACCTIT_PD_TO' and type = 'S' and NUMB = '0000'.

Sign up to vote on this title
UsefulNot useful