‎2005 Jul 05 4:10 PM
hi folks,
I need your help here.I have the parameter option defined on the screen. depending upon which number i enter in the paramter the last date of the month has to be assigned to a variable.
i.e if I enter 07 in the parameters box, it the july month of the year and it should display 07/31/05 (dd/mm/yy) format.
What I have done is read the data from the parameter option into the variable using the case ... endcase i have been working on getting the last date of that month.
Is there any keyword that can generate the last date of the month in 'dd/mm/yy' format.
How can I take this further?
Thanks in advance.
Santhosh
‎2005 Jul 05 4:17 PM
Hello,
Try FM RP_LAST_DAY_OF_MONTHS
Hope this helps you.
Regds, Murugesh AS
‎2005 Jul 05 4:17 PM
Hello,
Try FM RP_LAST_DAY_OF_MONTHS
Hope this helps you.
Regds, Murugesh AS
‎2005 Jul 05 4:21 PM
Check out the "write" statement options.
write w_date to w_date_out dd/mm/yy .
Regards,
Erwan.
‎2005 Jul 05 4:31 PM
Hi Murugesh,
The FM asks for the current date. Is there a way where in the number of the month entered in the parameter option can be taken and the last day of the month be generated?
because I need this to run the monthly end financial statements.
And I need to capture that value(last day of the month) depending on the month number I enter in the parameter option and transfer into the form.
If you could just elaborate how can I use this module that owuld be great too.
thanks
‎2005 Jul 05 4:37 PM
Implement the following program. Run it, enter the date in the first field. Hit Enter. The end of that month will show in the second field.
report zrich_0001.
parameters: s_date type sy-datum,
e_date type sy-datum.
at selection-screen.
call function 'RP_LAST_DAY_OF_MONTHS'
exporting
day_in = s_date
importing
last_day_of_month = e_date.
Regards,
Rich Heilman
‎2005 Jul 05 4:56 PM
Hello,
Here is the sample code. Hope this helps you.
REPORT ylastdate .
tables: bsid.
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
data: g_datum like sy-datum.
data: g_lastdatum like sy-datum.
PARAMETERS: p_monat(2) AS LISTBOX VISIBLE LENGTH 5 OBLIGATORY.
AT SELECTION-SCREEN OUTPUT.
PERFORM p_monat.
at selection-screen.
perform fill_g_datum.
start-of-selection.
perform get_last_day.
*&---------------------------------------------------------------------*
*& Form p_monat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form p_monat.
name = 'P_MONAT'.
value-key = '01'.
value-text = 'Jan'.
APPEND value TO list.
value-key = '02'.
value-text = 'Feb'.
APPEND value TO list.
value-key = '03'.
value-text = 'Mar'.
APPEND value TO list.
value-key = '04'.
value-text = 'Apr'.
APPEND value TO list.
value-key = '05'.
value-text = 'May'.
APPEND value TO list.
value-key = '06'.
value-text = 'Jun'.
APPEND value TO list.
value-key = '07'.
value-text = 'Jul'.
APPEND value TO list.
value-key = '08'.
value-text = 'Aug'.
APPEND value TO list.
value-key = '09'.
value-text = 'Sep'.
APPEND value TO list.
value-key = '10'.
value-text = 'Oct'.
APPEND value TO list.
value-key = '11'.
value-text = 'Nov'.
APPEND value TO list.
value-key = '12'.
value-text = 'Dec'.
APPEND value TO list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list.
endform. " p_monat
*&---------------------------------------------------------------------*
*& Form fill_g_datum
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form fill_g_datum.
clear:g_datum.
concatenate sy-datum(4) p_monat '01' into g_datum.
endform. " fill_g_datum
*&---------------------------------------------------------------------*
*& Form get_last_day
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form get_last_day.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = g_datum
IMPORTING
LAST_DAY_OF_MONTH = g_lastdatum
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.
else.
write:/ g_lastdatum.
ENDIF.
endform. " get_last_dayRegds, Murugesh AS
‎2005 Jul 05 4:58 PM
thanks Rich, how can I extend this to have the month name too because I need to display that too.
santhosh
‎2005 Jul 05 5:11 PM
Here ya go.
report zrich_0001.
data: xt247 type t247.
parameters: s_date type sy-datum,
e_date type sy-datum,
monthn(30) type c.
at selection-screen.
call function 'RP_LAST_DAY_OF_MONTHS'
exporting
day_in = s_date
importing
last_day_of_month = e_date.
select single * from t247 into xt247
where spras = sy-langu
and mnr = e_date+4(2).
monthn = xt247-ltx.
If these posts have helped you solve your problem, please award points and close the post. Thanks.
Regards,
Rich Heilman
‎2005 Jul 05 6:14 PM
‎2005 Jul 05 6:15 PM
hi Murugesh,
Thanks alot for your input it really helped.I have awarded points to you too.
Santhosh