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: 

Passing Last day of the month to a screen field.

Former Member
0 Kudos

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?

8 REPLIES 8

Former Member
0 Kudos

Hi,

use this function module

SG_PS_GET_LAST_DAY_OF_MONTH

Regards,

Jagadeesh.

Former Member
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

use the function modules

FKK_LAST_DAY_OF_MONTH

SG_PS_GET_LAST_DAY_OF_MONTH

Former Member
0 Kudos

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.

Former Member
0 Kudos

thnk u vry much.

Former Member
0 Kudos

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