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: 

For selection parameter the default date should be of the previous month.

Former Member
0 Kudos

Hi all,

In my selection-screen what i want is for the selection parameter "Selection period month" the default value to be the previous month.

For example today is 24.09.2008 so the default value of this field has to be 200808 instead of 200809 today.

please tell me how should i do this.

thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this.

Use the function module 'HR_JP_ADD_MONTH_TO_DATE' and give the value for IV_MONTHCOUNT as -1 to get the previous month.

Sharin.

9 REPLIES 9

Former Member
0 Kudos

Hi,

Try this.

Use the function module 'HR_JP_ADD_MONTH_TO_DATE' and give the value for IV_MONTHCOUNT as -1 to get the previous month.

Sharin.

former_member181995
Active Contributor
0 Kudos

F1 on INITIALIZATION?

former_member181995
Active Contributor
0 Kudos

F1 on INITIALIZATION?(Information)

And concatenate with above reply to get the previous month

Former Member
0 Kudos

write the code in initialization and u can use this function module 'HR_JP_ADD_MONTH_TO_DATE'

0 Kudos

What is the added information than?

0 Kudos

Combined two posts into one. Does that account for added information??

pk

0 Kudos

There is no added information, just removed some information.

former_member585060
Active Contributor
0 Kudos

Hi,

Try this code

************************************************************

PARAMETERS : date(6) TYPE c.

DATA : datum TYPE sy-datum,

year(4) TYPE n,

month(2) TYPE n.

INITIALIZATION.

datum = sy-datum.

year = datum+0(4).

month = datum+4(2).

IF month EQ '01'.

month = '12'.

year = year - 1.

ELSE.

month = month - 1.

ENDIF.

CONCATENATE year month INTO date.

BREAK-POINT.

************************************************

Regards

Bala Krishna

Former Member
0 Kudos

Hi,

Check the following code:

data: f_date type sy-datum,

f_dd(2) type c,

f_mm(2) type c,

f_yyyy(4) type c,

f_pdt type sy-datum.

parameters: p_date like sy-datum.

initialization.

f_date = sy-datum.

f_dd = sy-datum+6(2).

f_mm = sy-datum+4(2) - 1.

f_yyyy = sy-datum+0(4).

if f_mm eq 0.

concatenate f_yyyy '12' f_dd into f_pdt.

elseif f_mm eq 1 or

f_mm eq 2 or

f_mm eq 3 or

f_mm eq 4 or

f_mm eq 5 or

f_mm eq 6 or

f_mm eq 7 or

f_mm eq 8 or

f_mm eq 9.

concatenate f_yyyy '0' f_mm f_dd into f_pdt.

else.

concatenate f_yyyy f_mm f_dd into f_pdt.

endif.

p_date = f_pdt.

start-of-selection.

write : / f_date,

/ f_pdt.

Regards,

Bhaskar

Edited by: Bhaskar Chikine on Sep 24, 2008 12:49 PM