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: 

how to get the last day according to fiscal period input in selection scree

Former Member
0 Kudos

Hello expert

how to get the last day of fiscal period input.

the fiscal period inculdes 1-16

when fiscal period is greater than 12, only calculate the last day of 12nd month

your solution will be apprecaited, FM existing?

thank you

Kevin

4 REPLIES 4

Former Member
0 Kudos

Hi,

when you give a particular date in any month

the following fm will give you the last date of that month

here you can give

R_FDATE-HIGH as 01 and month as the period you wnat and year for current year

concatenates '01' month year into r_fdate-high separated by '.'.

then it will give g_ltdt for that month and year which wil be the last date of that month

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

EXPORTING

DAY_IN = R_FDATE-HIGH

IMPORTING

LAST_DAY_OF_MONTH = G_LTDT

EXCEPTIONS

DAY_IN_NO_DATE = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

thanks & regards,

Venkatesh

varma_narayana
Active Contributor
0 Kudos

Hi..

Call the FM

RKE_GET_LAST_DAY_IN_PERIOD

CALL FUNCTION 'RKE_GET_LAST_DAY_IN_PERIOD'

EXPORTING PERFLAG = PERFLAG2

PERIV = PERIV2

PERIO = WORK-ALTPERIO

IMPORTING DATE = LAST_ALTPERIO_DATE.

<b>reward if Helpful</b>

0 Kudos

give me a example, what parameters should i set?

0 Kudos

IF vperiod >= '12'.

ldf_month = '12'.

ELSE.

ldf_month = vperiod + 1.

ENDIF.

IF ldf_month < 10.

CONCATENATE '0' ldf_month INTO ldf_month.

ENDIF.

CONCATENATE vyear ldf_month '01' INTO ldf_firstdate.

ldf_lastdate = ldf_firstdate - 1.

CONCATENATE ldf_lastdate(4)

'&#24180;'

ldf_lastdate+4(2)

'&#26376;'

ldf_lastdate+6(2)

'&#26085;'

INTO vdate .