Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Date format

hi,

my requirement is i have month and year which i am getiing in select option from the user

in the format eg: '11.2007' and '06.2007' (he enters in the screen) i have to find the months

between and do some calculation.

i have the function module for it HR_HK_DIFF_BT_2_DATES .my problem is i concatenated and passed two days in the format like '20071101' and '20070630' but its not showing the month between .is that the format i give is wrong...plz help me

regards,

karthik.

Tags:
Former Member
Former Member replied

Here is the code:

report ztesttej13.

parameters: p_date(10),

p_date1(10).

data: v_date like p0001-begda,

v_date1 like p0001-endda,

v_months like P0347-SCRMM.

v_date = p_date.

v_date1 = p_date1.

CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'

EXPORTING

DATE1 = v_date

DATE2 = v_date1

OUTPUT_FORMAT = '08'

IMPORTING

  • YEARS =

MONTHS = v_months

  • DAYS =

EXCEPTIONS

INVALID_DATES_SPECIFIED = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

ENDIF.

write: v_months.

And I am passing 20071101 to P_date and 20070601 to p_date1.

I am thinking the way you defined your date parameters may be wrong.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question