Skip to Content
0

data till last day in Bex (MTD)

Jun 08, 2017 at 09:47 AM

75

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Jun 13, 2017 at 09:45 AM
1

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,

Share
10 |10000 characters needed characters left characters exceeded
T Ravi Chandra Jun 13, 2017 at 03:21 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jun 22, 2017 at 07:44 AM
0

Thanks for you help..

Share
10 |10000 characters needed characters left characters exceeded
Loed Despuig Jun 27, 2017 at 07:05 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded