Application Development 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: 

GET First date in a year

Former Member
0 Kudos

How to get a first day for a year like if i have year as 2006 ...the date should be 1.1.2006 and i need to add 5 years and display should be 1.1.2011.

9 REPLIES 9

Former Member
0 Kudos

Please check the FM

FIRST_AND_LAST_DAY_IN_YEAR_GET

Former Member
0 Kudos

what is the value to be passed for this

0 Kudos

also check

'HR_JP_MONTH_BEGIN_END_DATE'

IF you have the year why dont you just concatenate '0101' to the year

CONCATENATE year '0101' to get the first date of the year.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos


report zrich_0001.

data: first_day type sy-datum.

first_day = sy-datum.
first_day+4(4) = '0101'.

first_day(4) =  first_day(4) + 5.

write:/ first_day.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Saranya,

Use FM 'FIRST_AND_LAST_DAY_IN_YEAR_GET' and pass GJAHR as '2006' and PERIV as '24' or 'C1'.

Regards,

Vivek

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Use Fm :FIRST_AND_LAST_DAY_IN_YEAR_GET and pass GJAHR as 2006 and PERIV for fiscal year variant.

Former Member
0 Kudos

Here it is,


REPORT  zkb_test3.

PARAMETERS: p_year(4) TYPE c, "Year
            p_noyr(4) TYPE c. " No of Years to add

START-OF-SELECTION.

  DATA: v_year_begin TYPE sy-datum,
         v_year_new TYPE sy-datum.

  v_year_begin(4) =  p_year.
  v_year_begin+4(4) = '0101'.
  v_year_new(4) = p_year + p_noyr.
  v_year_new+4(4) = '0101'.

  WRITE:/ v_year_begin, v_year_new.

Regards

Kathirvel

Former Member
0 Kudos

Hi Saranya,

Use function module <b>HR_PSF_GET_BEGIN_END_OF_YEAR</b> to get the first and last date of the year.

Just pass date to this fm and it returns first and last day of the year.

DATA:

V_BEGIN_DATE TYPE SY-DATUM,

V_END_DATE TYPE SY-DATUM.

CALL FUNCTION <b>'HR_PSF_GET_BEGIN_END_OF_YEAR'</b>

EXPORTING

imp_begda = SY-DATUM

IMPORTING

EXP_BEGDA = V_BEGIN_DATE

EXP_ENDDA = V_END_DATE.

WRITE:/ 'START DATE: ', V_BEGIN_DATE.

WRITE:/ 'END DATE: ', V_END_DATE.

Thanks,

Vinay

Former Member
0 Kudos

check this ..

execute the code.

data : v_date like sy-datum.
data :next_Date like sy-datum.


v_date = sy-datum.

v_date+4(4) = 0101.
write:/ v_date.      "first date in a yr
*to get the next date after 5 yrs

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    date            = v_date
    days            = 00
    months          = 00
   SIGNUM           = '+'
    years           = 05
 IMPORTING
   CALC_DATE       = next_date.

   write:/ 'date 5 yrs aftr',  next_date.

regards,

vijay

Message was edited by:

Vijay