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

Select Option

Former Member
0 Likes
1,452

In select-options, how to get the default values as current month first date and last date by default?

Eg: 1/12/2004 and 31/12/2004

Thanks

Vicky

13 REPLIES 13
Read only

LucianoBentiveg
Active Contributor
0 Likes
1,373

In INITIALIZATION event, do:

S_BUDAT-LOW = 1/12/2004

S_BUDAT-HIGH = 31/12/2004

Regards

Read only

0 Likes
1,373

Not for One month!!It should be with respect to sy-datum..

Thanks

Vicky

Read only

0 Likes
1,373

Hi,

Use this in INITIALIZATION

Use Fm 'FIRST_DAY_IN_PERIOD_GET' to get first day of month.

Export parameters:

I_GJAHR = sy-datum+0(4)

I_PERIV = K4

I_POPER = sy-datum+4(2)

Use Fm 'LAST_DAY_IN_PERIOD_GET' to get first day of month.

Export parameters:

I_GJAHR = sy-datum+0(4)

I_PERIV = K4

I_POPER = sy-datum+4(2)

regrds..

jaison

Read only

0 Likes
1,373

Try:

SELECT-OPTIONS: s_date FOR sy-datum.

DATA: date_lo LIKE sy-datum,
      date_hi LIKE sy-datum.

INITIALIZATION.

  date_lo = sy-datum.
  date_lo+6 = '01'.

  date_hi = date_lo + 33.
  date_hi+6 = '01'.
  date_hi = date_hi - 1.

  s_date-option = 'EQ'.
  s_date-sign   = 'I'.
  s_date-low    = date_lo.
  s_date-high   = date_hi.

  APPEND s_date.

Rob

Read only

0 Likes
1,373

This message was moderated.

Read only

Former Member
0 Likes
1,373

Hi

In Initialization write the following.

s_date-option = 'EQ'.

s_date-sign = 'I'.

S_date-low = '20041201'.

s_date-high = '20041231'.

append s_date.

clear s_date.

Regards,

Raj

Read only

Former Member
0 Likes
1,373

Hi

Use FM <b>HR_JP_MONTH_BEGIN_END_DATE</b>

and pass <b>Sy-datum</b>, you will get first date of month and last date..populate in s_date (select-option field)

Regards,

Raj

For eg:

Test for function group HRJE

Function module

HR_JP_MONTH_BEGIN_END_DATE

Import parameters

Value

IV_DATE 21.09.2006

Export parameters Value

EV_MONTH_BEGIN_DATE 01.09.2006

EV_MONTH_END_DATE 30.09.2006

Message was edited by: Rajasekhar Dinavahi

Read only

0 Likes
1,373

hi,

check this sample code...

tables: mkpf.

data date like sy-datum.

data date1 like sy-datum.

select-options: s_date for mkpf-budat.

initialization.

CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

EXPORTING

iv_date = sy-datum

IMPORTING

EV_MONTH_BEGIN_DATE = date

EV_MONTH_END_DATE = date1

.

s_date-option = 'EQ'.

s_date-sign = 'I'.

s_date-low = date.

s_date-high = date1.

append s_date.

reward if it helps..

Message was edited by: srinu k

Read only

0 Likes
1,373

You can use sy-datum and find the month by offsetting method.

Start date is always going to be 1st. So no issues. you can concatenate and find.

Now the problem is to find the end date, it might be 28,29,30, 31.

use this functional module to find the last date of the month.

SLS_MISC_GET_LAST_DAY_OF_MONTH

Then you have to assign

sel_date-option = EQ'.

sel_date-sign = 'I'.

Sel_date-low =

sel_date-high =

append sel-date

regards

Vivek

<b> reward points for all the useful answers </b>

Read only

Former Member
0 Likes
1,373

in INITIALIZATION use:

<b>I_BUDAT-OPTION = 'EQ'.

I_BUDAT-SIGN = 'I'.</b>

<b>I_BUDAT-LOW = sy-datum. "lets say 20060922

I_BUDAT-LOW+6(2) = '01'.<-- Populate 1 day of that month</b>

here this I_BUDAT-LOW becomes 20060901

i_budat-high = sy-datum.

CALL FUNCTION 'LAST_DAY_OF_MONTHS'

EXPORTING

DAY_IN = I_BUDAT-HIGH "20060922

IMPORTING

LAST_DAY_OF_MONTH = <b>I_BUDAT-HIGH</b>. 20060930

-> Gives you the last day of a Month

<b>APPEND I_BUDAT.</b>

this function module will get Last day of the month in date format,if we pass current date.

Regards

Srikanth

Message was edited by: Srikanth Kidambi

Read only

Former Member
0 Likes
1,373

Hey just follow these steps.

<b>No need to code anything.</b>

Create a variant.

1. While Saving the variant Check the box for the your date field and Selection variable "L" and

2. Click on the Selection variable button.

3. Choose option "D"

4. Below your date field you can find a down arrow, press it.

5. Select the opotion "Current period" and choose.

6. Save it.

Whenever you use this variant again, you can find the low & high fields got pupulated with the First & Last date's of the current month.

Reward if useful,

-Vinodh.

Read only

Former Member
0 Likes
1,373

Hello,

In the event INITIALIZATION,

S_MATHR-LOW = MUM7000.

S_MATNR-HIGH = MUM7999.

Regs,

Venkat

Read only

shishupalreddy
Active Contributor
0 Likes
1,373

use

FIRST_DAY_IN_PERIOD_GET to get the first day of the month .

LAST_DAY_IN_PERIOD_GET to get the last day of the period .

provide the required exporting parmeters .

Store the result in selection screen parameters.

use these function modules in initilazation event to get the default values ion to the selction screen