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

Date into month

former_member125931
Active Participant
0 Likes
1,841

Hi All,

I calculated opening stock,closing stock based on the date,now I need to calculate based on month also,

Is any functionmodule is there to convert date into month.

Thanks@regds,

Sree.

1 ACCEPTED SOLUTION
Read only

Subhankar
Active Contributor
0 Likes
1,769

Hi

You can use FM "HR_SGPBS_YRS_MTHS_DAYS". to get the interval between two dates.

Using this FM you not only get the diff. in months but also in year.

CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = s_budat-low <----


From date

end_da = s_budat-high <----


To date

IMPORTING

no_day = l_day

no_month = l_month

EXCEPTIONS

dateint_error = 1

OTHERS = 2.

14 REPLIES 14
Read only

Former Member
0 Likes
1,769

Use FM :

HR_HK_DIFF_BT_2_DATES

Pass 04 to output_format ..

Read only

Former Member
0 Likes
1,769

use FM RP_CALC_DATE_IN_INTERVAL

call function <b>'RP_CALC_DATE_IN_INTERVAL'</b>

exporting

date = '06/15/2006'

days = 14

months = 0

signum = '+'

years = 0

importing

calc_date = wa_date.

to add days month use + or use - to go back

Read only

Former Member
0 Likes
1,769

Use FM VELO03_DATE_TO_WEEK_OR_MONTH to convert ur date into month.

Please give reward point if above solution is applicable.

Read only

Subhankar
Active Contributor
0 Likes
1,770

Hi

You can use FM "HR_SGPBS_YRS_MTHS_DAYS". to get the interval between two dates.

Using this FM you not only get the diff. in months but also in year.

CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = s_budat-low <----


From date

end_da = s_budat-high <----


To date

IMPORTING

no_day = l_day

no_month = l_month

EXCEPTIONS

dateint_error = 1

OTHERS = 2.

Read only

Former Member
0 Likes
1,769

Hi,

check this links:

Regards

Adil

Read only

Former Member
0 Likes
1,769

Use the Function Module HR_AUPBS_MONTH_DAY and try

or else from the Transaction SE37 in the description type date or month and search.

U wil get number of function modules.

Read only

0 Likes
1,769

Hi All,

In my selection screen if the user gives the date from 11.01.2008 to 11.07.2008,

by using the start date I am finding start date of the month and end date of the month by using FM HR_JP_MONTH_BEGIN_END_DATE,these two dates helps me to calculate Opening stock and closing stock of this month,in the same way I need to calculate remaing months Opening stock and closing stock in the selected Period,how to calculate remaining months.

Thanks&regds,

Sree.

Read only

0 Likes
1,769

Hi ,

Find the start date of month for 11.01.2008 and end date of month for 11.07.2008 .Now Using these two dates calculate Opening stock and closing stock during that period.

Regards,

Sachin M M

Read only

0 Likes
1,769

Hi Sachin,

I need to calculate stock for each and every month,user only gives the date period,now I able to calculate starting month Opening stock ,closing stock,like way I need to find all the months selected in Selection screen date range.

Thanks&regds,

Sree.

Read only

Former Member
0 Likes
1,769

hi

list of FM try

A

CALCULATE_DATE : Calculates the future date based on the input .

v DATE_TO_DAY : Returns the Day for the entered date.

v DATE_COMPUTE_DAY : Returns weekday for a date

v DATE_GET_WEEK : Returns week for a date

v RP_CALC_DATE_IN_INTERVAL : Add days / months to a date

v DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified

v MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.

v END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.

v HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.

v FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.

v MONTH_NAMES_GET : Get the names of the month

hope this willl solv ut problem

Amit

Read only

0 Likes
1,769

Hi Amit,

Still my problem is not solved.

Thanks&regds,

Sree.

Read only

Former Member
0 Likes
1,769

data:L_date type datum,
l_month type char2,
wa_T247 type T247.
 
l_date = sy-datum.
*internal valye in format YYYYMMDD
l_month = l_date+4(2).
select single * from t247
into wa_t247 where SPRAS = sy-langu and
MNR = l_month.
if sy-subrc = 0. 
  write: /1 wa_t247-mnr,10 wa_t247-LTX.
endif.
Read only

pole_li
Active Participant
0 Likes
1,769

Hi,

Maybe you need function "DATE_TO_PERIOD_CONVERT"

Regards,

Pole

Read only

0 Likes
1,769

Hi Pole li,

I need to convert date range into months.