cancel
Showing results for 
Search instead for 
Did you mean: 

subtraction of date

Former Member
0 Kudos

If the date is 01.01.2005 and i am storing in an numerical var in the form MMYYYY.I need to subtract 1 or more than a month .

How should i do????

kindly help me out ASAP.

Reply immm

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi ,

U can use the FM MONTH_PLUS_DETERMINE and pass the months parameter as negative values...( for 1 month subtract pass -1).... This FM takes the total 8 char date and ouptuts date...u can retrieve only MMYYYY by offsetting later.

Sreedhar

Former Member
0 Kudos

Use the FM RP_CALC_DATE_IN_INTERVAL and pass the date, months as 1 or more, signum as -

Former Member
0 Kudos

Hi Jayasree,

You can use MONTH_PLUS_DETERMINE . See the example below.

Hope This Info Helps YOU.

<i>Reward Points If It Helps YOU.</i>

Regards,

Raghav

data: new_date type d.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months        = -5       " Negative to subtract from old date, positive to add
    olddate       = sy-datum
 IMPORTING
   NEWDATE       = new_date.

write: / new_date.

Former Member
0 Kudos

Use the FM CCM_GO_BACK_MONTHS

here U can give the No of Months U desire

and get the Output

abdul_hakim
Active Contributor
0 Kudos

HI

you need to find the offset for subtraction.

Abdul

sreemsft
Contributor
0 Kudos

Hi,

Do this..


  V_DATE      = SY-DATUM.
  V_MONTH     = V_DATE+4(2).
  V_YEAR      = V_DATE+0(4) - 2.
  CONCATENATE V_YEAR V_MONTH INTO V_CALMONTH.

You can subtract month also... and can concatenate..

There are some Function Modules which can subtract the months from a date..

Try the below FM....


CCM_GO_BACK_MONTHS

For the above function module..if you give some date and number of months..you should subtract.. it will gives you back the date after subtracting the months..

Plz rewards points if it helps you...

Thanks,

Sreekanth G

Message was edited by: Sreekanth G

Former Member
0 Kudos

Hi Jayashree,

You need to offset the month, and subtract 1, if the entity is less than 0, then make it 12, and make the YYYY to YYYY - 1.

If you need the date also, then u can use FM,like LAST_DATE_OF_PERIOD_GET etc..

Let me know if you need more inpouts

former_member188685
Active Contributor
0 Kudos

check this

FM HR_HK_DIFF_BT_2_DATES

or try this..

FIMA_DAYS_AND_MONTHS_AND_YEARS

thanks

vijay