Application Development and Automation 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: 
Read only

date prob

Former Member
0 Likes
1,203

hi friends,

i wanted to enter the default date in my selection screen.

my default date is 30 days before the today's date.

i.e. if today is 31 dec then it will display in selection screen

date 1/12/06 to 31/12/06.

will anybody send the coding??

10 REPLIES 10
Read only

Former Member
0 Likes
1,122

select-options : s_date type d.

initialization.
  s_date-low = sy-datum.
  subtract 30 from s_date-low.
  s_date-high = sydatum.
Read only

0 Likes
1,122

Hi,

Just curious. If today is 27 June, then what do you want on the screen ? <b>1 june - 27 june</b> or <b>27 may - 27 june</b>

The above code will give you 30 day's difference. but if you want the dates to be populated from the first of the month to the current date, then do as follows -

select-options : s_date type d.
 
initialization.
  s_date-low = sy-datum.
  s_date+6(2) = '01'.
  s_date-high = sydatum.

Regards,

Anand Mandalika.

Read only

Former Member
0 Likes
1,122

select-options: p_date for sy-datum.

In initialization

do this:

p_date-low = sy-datum - 30.

p_date-high = sy-datum.

p_date-sign = 'I.

p_date-option = 'BT'.

append p_date.

clear p_date.

Regards,

ravi

Read only

Former Member
0 Likes
1,122

Hi Salil,

As the initialization event is called before the selection screen you can set your date in this event.

Use the code.

INITIALIZATION.

data : l_date type sy-datum.

l_data = sy-datum - 30.

write l_date.

Read only

Former Member
0 Likes
1,122

you can use these two Fm's to calculate date

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

DATE = IT_HEADER-INVOICE_DATE

DAYS = '00'

MONTHS = '01'

SIGNUM = '-'

YEARS = '00'

IMPORTING

CALC_DATE = BILLING_PERIOD-LOW

or

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

DATE = IT_HEADER-INVOICE_DATE

DAYS = '00'

MONTHS = '01'

SIGNUM = '-'

YEARS = '00'

IMPORTING

CALC_DATE = BILLING_PERIOD-LOW

reward if you find this helpful.

Read only

Former Member
0 Likes
1,122

Hi Salil,

I suppose you are using a select options for displaying the default dates...

One method is to use the DEFAULT addition of select options to do that...

Just refer this SDN Forum link.

Regards,

SP.

Read only

Former Member
0 Likes
1,122

Hi,

I'm assuming that date field is a parameter field (p_date).

INITIALIZATION.

p_date = sy-datum - 30.

Regs,

Venkat Ramanan

Read only

Former Member
0 Likes
1,122

Hi salil,

1. we have to use APPEND for select options.

2. just copy paste

3.

report abc.

*----


select-options : mydate for sy-datum.

INITIALIZATION.

MYDATE-LOW = SY-DATUM - 30.

MYDATE-HIGH = SY-DATUM.

append mydate.

regards,

amit m.

Read only

Former Member
0 Likes
1,122

Hi,

Do this way...


select-options: date for sy-datum.
initialization.
date-low = sy-datum - 30.
date-high = sy-datum.
date-sign = 'I.
date-option = 'BT'.
append date.
clear date.

Regards

vijay

Read only

Former Member
0 Likes
1,122

Hi Salil,

In order to find out the date 30 days in advance just do this calculation.

Data: ws_date type sy-datum.

ws_date = sy-datum - 30.

If you want the starting date and ending date of this month. then use this function module <b>"HR_JP_MONTH_BEGIN_END_DATE"</b>

CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

EXPORTING

iv_date = sy-datum

IMPORTING

ev_month_begin_date = s_date-low

ev_month_end_date = s_date-high.

s_date-sign = 'I'.

s_date-option = 'BT'.

APPEND s_date.

now your

s_date-low = 20060601. "(01/06/2006)

s_date-high = 20060630. "(30/06/2006)

So you can use either of the two above.

Hope this solves ur issue. Reward if helpful.

Regards,

Tushar