Quantcast
Channel: SCN : Discussion List - SAP Business Explorer (SAP BEx)
Viewing all articles
Browse latest Browse all 4032

MTD logic in Customer exit variable

$
0
0

Dear Friends,

I have a logic of MTD(Current date -1) in the reports and give option to just select month rather than date.If the user runs the query for current date(system Date) ex 30 June 2015, It should fetch the data from 1st june to 29 th june and also for previous 3 months ( MAR, APR,MAY from 1 to 29 for every month).

 

 

Report Run Date

Trend Output in Report

15th June

1st to 14th June for current month,

1st to 14th May for last month,

1st to 14th April

1st to 14th March

1st July

1st to 30th June for current month,

1st to 30th May for last month,

1st to 30th April

1st to 30th March

 

The logic i have written is :

WHEN 'ZVAR_V1'.



   IF I_STEP = 2.

IF SY-DATUM+6(2) >= 1.

   READ TABLE I_T_VAR_RANGE INTO WA_RANGE1
   WITH KEY VNAM = 'ZMTD_V1'.

    LV_CMON = WA_RANGE1-LOW+4(2).
    lv_cyer = WA_RANGE1-LOW+0(4).

   concatenate lv_cyer LV_CMON '01' into lv_day1.

   lv_date1 = SY-DATUM+6(2) - 1.
   concatenate lv_cyer LV_CMON lv_date1 into lv_day2.

   WA_RANGE-LOW = lv_day1.
   WA_RANGE-HIGH = lv_day2.
   WA_RANGE-SIGN = 'I'.
   WA_RANGE-OPT = 'BT'.
   append WA_RANGE to e_t_range.

ELSEIF SY-DATUM+6(2) = 1.

   READ TABLE I_T_VAR_RANGE INTO WA_RANGE1
   WITH KEY VNAM = 'ZCAL_MONV'.

    LV_CMON = WA_RANGE1-LOW+4(2).
    lv_cyer = WA_RANGE1-LOW+0(4).

   lv_cmon1 = lv_cmon - 1.
   lv_date2 = sy-datum+6(2).
   concatenate lv_cyer LV_CMON1 '01' into lv_day1.
   concatenate lv_cyer LV_CMON1 lv_date2 into lv_day2.

   CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
     EXPORTING
       DAY_IN                  = lv_day2
    IMPORTING
      LAST_DAY_OF_MONTH       = lv_day3
    EXCEPTIONS
      DAY_IN_NOT_VALID        = 1
      OTHERS                  = 2
             .

   WA_RANGE-LOW = lv_day1.
   WA_RANGE-HIGH = lv_day3.
   WA_RANGE-SIGN = 'I'.
   WA_RANGE-OPT = 'BT'.
append WA_RANGE to e_t_range.

ENDIF.
   ENDIF.


The query output :

CD for compare 401.02.2015..29.05.2015
CD for compare 301.03.2015..29.05.2015
CD for compare 201.04.2015..29.05.2015
CD for Compare 101.05.2015..29.05.2015
User input05.2015

 

 

I have created 4 variables for calday (CD). But the values care fetching till date for every variables. How to fix it.

 

Thanks

BASKAR


Viewing all articles
Browse latest Browse all 4032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>