02-29-2008 6:21 AM
Hi
I have a selection screen with input fields
1. period (month eg: 07)
2.year(fiscal year eg: 2008 )
If user enters 07 as month and 2008 as year, then I have to display 08/01/2008(MM/DD/YYYY) as output.
Requirement is to calculate the 'first day of next month'
I have written code for this requirement.But I am asked to use function mdule.
Please help me in this regard.
Thanks&Regards
Rama.Mekala
02-29-2008 6:26 AM
/message/4866914#4866914 [original link is broken]
Please give me reward points..
02-29-2008 6:38 AM
Use this FM to get the last day of the current month
SG_PS_GET_LAST_DAY_OF_MONTH
then add one to the output parameter..
will give u the first day of next month
Hope dis helps.
Reward if it does
02-29-2008 6:41 AM
02-29-2008 6:47 AM
hi try this FM ...
HR_JP_MONTH_BEGIN_END_DATE
it gives the Begin Date and End date of the month
rewards points if found useful
regards,
Balaji
02-29-2008 7:05 AM
11-28-2023 7:00 AM
DATA: L_LASTDT TYPE DATUM.
DATA: L_TODAY TYPE DATUM,
l_date TYPE datum.
L_TODAY = sy-datum.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
IV_DATE = L_TODAY
IMPORTING
* EV_MONTH_BEGIN_DATE =
EV_MONTH_END_DATE = L_LASTDT.
data: L_DAYSCOUNT TYPE numc2.
L_DAYSCOUNT = ( L_LASTDT - L_TODAY ) + 1.
L_DAYSCOUNT = |{ L_DAYSCOUNT ALPHA = OUT }|.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = L_TODAY
DAYS = L_DAYSCOUNT
months = '00'
signum = '+'
years = '00'
IMPORTING
CALC_DATE = L_DATE.
01-05-2024 9:48 AM
Use a simple FM to get the next month.
As your selection parameters are the month and year, you can pass the first day of the month to the FM so the output day will always be 01 as well:
DATA(result) = VALUE dats( ).
CALL FUNCTION 'OIL_GET_NEXT_MONTH'
EXPORTING
i_date = CONV dats( |{ p_year }{ p_month }01| )
IMPORTING
e_date = result.
WRITE / result.