08-04-2008 5:13 AM
Hi All,
I'm developing a report program which contains screen to accept user input.One of the field in the selection screen accepts date, by default this field should contain last day of the month.
For example if the month is August then the field should contain 31/08/08 by dafault.
Can anyone suggest me how to do this?
08-04-2008 5:18 AM
Hi,
use this function module
SG_PS_GET_LAST_DAY_OF_MONTH
Regards,
Jagadeesh.
08-04-2008 5:19 AM
Hi Balu,
check this code<
Check for Initialize plant.
----
Includes
----
*Global Declarations
INCLUDE /dceur/mbp_rcms_interface_top.
*Subroutines
INCLUDE /dceur/mbp_rcms_interface_subr.
----
Initialization
----
INITIALIZATION.
PERFORM initialize_plant.
----
AT SELECTION SCREEN
----
AT SELECTION-SCREEN.
----
Validation
----
PERFORM authority_check.
PERFORM date_check.
----
START OF SELECTION
----
START-OF-SELECTION.
PERFORM fetch_data.
PERFORM fill_output.
PERFORM write_applserv.
----
*END-OF-SELECTION
----
END-OF-SELECTION.
FORM initialize_plant.
CLEAR wf_plant.
CALL FUNCTION '/DCEUR/GET_PLANT_COUNTRY'
IMPORTING
plant_value = wf_plant.
pa_werks = wf_plant.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = sy-datum "SY-DATUM
IMPORTING
last_day_of_month = pa_date.
ENDFORM. " initialize_plant
Mohinder
Edited by: Mohinder Singh Chauhan on Aug 4, 2008 6:19 AM
08-04-2008 5:20 AM
use the function
FKK_LAST_DAY_OF_MONTH
pass the current date, you will get the last day of the month.
assign it to selection screen field in the INITIALIZATION field.
08-04-2008 5:45 AM
Hi balu,
Try this...
PARAMETER p_date TYPE sy-datum.
DATA :date TYPE sy-datum,
initialization.
CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = sy-datum
IMPORTING
last_day_of_month = date.
p_date = date.
regards,
Alok Arun
08-04-2008 5:50 AM
Hi
use the function modules
FKK_LAST_DAY_OF_MONTH
SG_PS_GET_LAST_DAY_OF_MONTH
08-04-2008 5:51 AM
Hi Bula,
Try the FM below in the initialization event and send sy-datum
to it:
RP_LAST_DAY_OF_MONTHS
Determine last day of month
INITIALIZATION.
CALL FUNCTION RP_LAST_DAY_OF_MONTHS
With luck,
Pritam.
08-04-2008 5:55 AM
08-04-2008 5:57 AM
Hi,
check the code
DATA: ULTIMO TYPE D.
ULTIMO = SY-DATUM.
ULTIMO+6(2) = '01'. " = first day of this month
ULTIMO = ULTIMO - 1. " = last day of last month
REF: SAP LIBRARY
REGARDS,
ANIRBAN