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

HR-ABAP dates

Former Member
0 Likes
1,014

Hi,

I need to calculate the difference between the original hire date and system date and also diffrence between rehire date and system date from 0041 and I need the output in the form of months. Please help me with this.

Regards,

Srik

8 REPLIES 8
Read only

Former Member
0 Likes
966

get your dates from PA0041 ..

use FM HR_HK_DIFF_BT_2_DATES to get the difference in

months .. enter 04 for parameter OUTPUT_FORMAT

Read only

0 Likes
966

Hi,

Thank you for ur response. Please help me how to retrieve the dates as they vary from dar01 to dar12 and corresponding dates from dat01 to dat12.

Regards,

Srik

Read only

0 Likes
966

Hi,

Use FM 'HR_ECM_GET_DATETYP_FROM_IT0041' to get the date's for your respective date types (hire or rehire).

Regards,

Shrinivas

Read only

0 Likes
966

write the coding as :

loop at it_pa0041.

do 12 times varying w_DARXX from it_pa0041-DAR01

next it_pa0041-DAR02

varying w_DATXX from it_pa0041-DAT01

next it_pa0041-DAT02.

case w_DARXX .

when 'XX'. " XX <-- U need to give the original hire date

v_hiredate = w_DATXX.

when 'YY'. " YY <-- U need to give the rehire date

v_rehiredate = w_DATXX.

endcase.

enddo.

calculate the difference between the dates using

v_hiredate , v_rehiredate with the system date ...

endloop.

Read only

0 Likes
966

Hi SRIK,

This depends on the field DATE TYPE (DAR01).

For Hire the value is U1--->Hire Date.

Depending on the date type you need to select the value.

Best regards,

raam

Read only

Former Member
0 Likes
966

hi,

You can use this FM.

FIMA_DAYS_BETWEEN_TWO_DATES_2

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
966

hi,

You have to choose one of the date using DO VARYING loop.

DO VARYING W_DTYPE FROM WA_P0041-DAR01 NEXT WA_P0041-DAR02.

    IF W_DTYPE EQ P_DATE.
<Your Code >.
      EXIT.
    ENDIF.
  ENDDO

.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
966

HI

Check these FM's:

HR_99S_INTERVAL_BETWEEN_DATES

HR_99S_MONTHS_BETWEEN_DATES

Or check this code:


  data: begin of e_0041,
          darxx like p0041-dar01,
          datxx like p0041-dat01,
        end of e_0041.

    do 12 times varying e_0041 from p0041-dar01 next p0041-dar02.

      if e_0041-darxx eq '01'.
      endif.
    enddo.

Regards

Gregory