Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

previous date

Former Member
0 Likes
879

hi to all,

help me in this issue

how to calcuæate previous date

thanks in advance

kiran kuamr

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
835

Hi Kiran,

What do yo umean by previous date?

yesterday?

yesterday = sy-datum - 1.

n days ago?

n_days_ago = sy-datum - n.

Regards,

ravi

7 REPLIES 7
Read only

Former Member
0 Likes
836

Hi Kiran,

What do yo umean by previous date?

yesterday?

yesterday = sy-datum - 1.

n days ago?

n_days_ago = sy-datum - n.

Regards,

ravi

Read only

0 Likes
835

hi ravi,

it is wrt to yesterdays date.

thanks and advance,

kiran kumar

Message was edited by: kiran kumar

Read only

venkata_ramisetti
Active Contributor
0 Likes
835

Hi,

Use logic similar to below.

DATA: V_FIRST_DATE LIKE SY-DATUM.

DATA: V_SECOND_DATE LIKE SY-DATUM.

V_FIRST_DATE = SY-DATUM.

V_SECOND_DATE = V_FIRST_DATE - 1.

Thanks,

Ramakrishna

Read only

Former Member
0 Likes
835

Hi,

Please check FM RP_CALC_DATE_IN_INTERVAL.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
835

Hi Kiran,

Yesterday is always SY-DATUM - 1.

Regards,

Raj

Read only

Former Member
0 Likes
835

Hi Kiran,

if u want to calculate the last date using a fm

then

check

RS_VARI_V_TODAY_X

in here

S OP LOW HIGH

I LT 1- 0

low -1 will keep u for the previous date (yesterday's date)

low -2 will give date of two days before .

regards,

Vijay.

kindly close the thread if ur query is over .

u did not mention if ur looking for a factory calender date

if this is the case then

RS_VARI_V_TODAY_XWD

put sign = 'C' and proceed same as above .

Message was edited by: Vijay

Read only

Former Member
0 Likes
835

Check this code,it may help u.

data: prev_date like sy-datum.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = sy-datum

days = 3

months = 0

signum = '-'

years = 0

IMPORTING

calc_date = prev_date.

write:/ prev_date.

Regards