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

Regarding Date

Former Member
0 Likes
737

Hi Frnds,

Actually im having on selection screen i will having months input /output field.

If give 3 months on selection-screen means , it has to fetch 3 months before date.

for example : today is dec 20th.

then it should take sep 1st as the range .

Based on that date range from sep 1 st to dec 20 th i will fetch all the accounting details.

Please do some Needful Help.

Regards,

Murthy

8 REPLIES 8
Read only

JozsefSzikszai
Active Contributor
0 Likes
713

hi Murthy,

DATA : lv_date_b TYPE sy-index,

lv_month(2) type n.

lv_month = sy-datum+4(2).

CASE lv_month.

WHEN 01.

lv_month = 10.

WHEN 02.

lv_month = 11.

WHEN 03.

lv_month = 12.

WHEN OTHERS.

lv_month = lv_month - 3.

ENDCASE.

CONCATENATE sy-datum(4) lv_month '01' INTO lv_date_b.

hope this helps

ec

Read only

Former Member
0 Likes
713

Hi narayana,

try this..

DATA : old_date LIKE sy-datum.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

months = '-3' "here minus NO of months

olddate = sy-datum

IMPORTING

newdate = old_date.

.

old_date+6(2) = '01'.

WRITE 😕 old_date.

Read only

Former Member
0 Likes
713

Hi,

Just use this Function Module 'MONTH_PLUS_DETERMINE'

here in this just in exporting parameters

ie, months gives the value as -3 and old date as the present date.

you will get the required output in the newdate(importing parameter side).

just have a look at this FM in SE37.

hope this works.

Read only

Former Member
0 Likes
713

Hi Narayana,

Use FM HR_PT_ADD_MONTH_TO_DATE to subtract 3 months from the current date.

Pass parameters as:

DMM_DATIN = sy-datum

DMM_COUNT = 3

DMM_OPER = '-'.

DMM_POS = 'X'.

You will get 3 months before date.

write '01' to DMM_DAOUT+0(2).

You can use this date as the start range of the date...

Lokesh

Read only

Former Member
0 Likes
713

Hi,

Use FM HR_JP_MONTH_BEGIN_END_DATE to get the first date of the month based on the date you give on selection screen.

Then from that you can subtract the months using the following FM:

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = input_date

days = '00'

months = '20'

signum = '-'

years = '00'

IMPORTING

calc_date = output_date.

This should help you.

Reward if useful.

Regards,

Lalit

Read only

Former Member
0 Likes
713

Hi

data:

date like sy-datum.

data:

date_req like date.

date = sy-datum.

data:

year(4) type c,

month(2) type c,

day(2) type c.

month = date+4(2).

if month gt 3.

month = month - 3.

else.

month = month - 3.

if month eq 0.

month = 12.

year = year - 1.

elseif month eq -1.

month = 11.

year = year - 1.

elseif month eq -2.

month = 10.

year = year - 1.

endif.

endif.

day = '01'.

concatenate year month date into date_req.

plzz reward if usefull

donr forget to reward plzzz

if u have any quiries my mail id mutyalasunilkumar@gmail.com

Edited by: Sunil Kumar Mutyala on Dec 20, 2007 12:39 PM

Read only

Former Member
0 Likes
713

Hi,

You can use the below FM.

[code]

data : gv_datum like sy-datum.

CALL FUNCTION 'CCM_GO_BACK_MONTHS'

EXPORTING

currdate = sy-datum

backmonths = '3'

IMPORTING

newdate = gv_datum.

[code]

Now, you will have 3 months back start date in gv_datum.

Thanks,

Sriram Ponna.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
713

data:wk_frm_date type sy-datum.

CALL FUNCTION 'CCM_GO_BACK_MONTHS'

EXPORTING

CURRDATE = sy-datum

BACKMONTHS = '003'

IMPORTING

NEWDATE = wk_frm_date.

wk_frm_date+6(2) = '01'.

write:'From Date:' , wk_frm_date.

write:/ 'To Date:', sy-datum.

Reward if useful