cancel
Showing results for 
Search instead for 
Did you mean: 

data till last day in Bex (MTD)

former_member267487
Participant
0 Kudos

Hi grurus,

Please help me to provide the step to get data One day before in mTD dta ..As user required to get the current MTD as the day from 1st day of the month till yesterday ..Not Today..I have already created a current MTD field in Bex query which gives data from the 1st day of the month till today..

suppose he is running a report today(6/8/2017) so MTD will give from 1st day may till 6/7/2017)

Please Advise.

Accepted Solutions (0)

Answers (4)

Answers (4)

govind_ramesh
Active Participant

Dear Siddique,

Please use the code as mentioned below for your variable

Say you have chosen the variable for MTD as ZCAL_MTD.

WHEN 'ZCAL_MTD'.
v_loc_date = sy-datum.
v_loc_date1 = sy-datum - 1.
l_s_range-low = v_loc_date.
l_s_range-high = v_loc_date1.
l_s_range-low+0(4) = sy-datum+0(4).
l_s_range-low+4(2) = sy-datum+4(2).
l_s_range-low+6(2) = '01'.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range_c.
EXIT.

Regards,

Loed
Active Contributor
0 Kudos

Hi,

Use the code below. It also caters the MTD for every 1st day of month which will have the result of full month last month.


gv_date type sy-datum.

WHEN 'ZCAL_MTD'.
gv_date = sy-datum - 1.
concatenate gv_date(6) '01' into L_S_RANGE-LOW.
L_S_RANGE-HIGH = gv_date.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.


Regards,

Loed

former_member267487
Participant
0 Kudos

Thanks for you help..

ravi_chandra3
Active Contributor
0 Kudos

Hi Siddique,

In the e_t_range Internal table , Please give the high field values as sy-datum - 1, it will work now.

Regards,

RC.