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: 

select-options

Former Member
0 Kudos

select-options : s_date for ekko-bedat.

in my select option High value should be current date.

PLZ help me with the solution..

1 ACCEPTED SOLUTION

Former Member
0 Kudos
select-options:
  s_date for sy-datum.

at selection-screen output.

    s_date-high = sy-datum.
    append s_date.
14 REPLIES 14

Former Member
0 Kudos

Hi,

Under the At selection-screen output event.

declare s_var-high = sy-datum.

Thanks & Regards,

Navneeth K.

Former Member
0 Kudos

Hi,

Just Try out this.


SELECT-OPTIONS : s_date FOR ekko-bedat.

INITIALIZATION.

  s_date-sign = 'I'.
  s_date-option = 'EQ'.
  s_date-high = sy-datum.
  APPEND s_date.

Cheers,

Kothand

Former Member
0 Kudos

s_date-sign = 'I'.

s_date-option = 'BT'.

s_date-high = sy-datum.

s_date-low = sy-datum.

append s_date.

NOTE : If you try to keep low as blank and high as non blank, system will give error message

Former Member
0 Kudos
select-options:
  s_date for sy-datum.

at selection-screen output.

    s_date-high = sy-datum.
    append s_date.

0 Kudos

Thanku navneeth

0 Kudos

if anyone reads this thread: the "solution" provided by Navneeth (and was awarded with 10 points) is comepletely wrong:

1. The sign and option are not filled, which makes the select option won't work at all

2. The code is placed in AT SELECTION-SCREEN OUTPUT, which is the PBO of the selection screen. This means, anytime an Enter is pressed on the selection screen, this small code will run, which is probably not necessary.

Pls. use the solution provided by Mohaiyuddin and also note that without low value it will result in an error message.

0 Kudos

Hi Eric,

Thanks for your inputs,

Ya we can put it into Initialization event rather than at selection-screen output event, which will trigegr for every enter.

I tried the following code its working fine, I am able to fetch the record from vbak:

TABLES:
  vbak.

SELECT-OPTIONS:
  s_date FOR sy-datum.

*INITIALIZATION.*

  s_date-high = sy-datum.
  APPEND s_date.


START-OF-SELECTION.

  SELECT SINGLE *
    FROM vbak
   WHERE erdat IN s_date.

Can you please tell me at what situation as you mentioned in point 1, the select-option will not work.

Thanks & Regards,

Navneeth K.

0 Kudos

Hi Eric,

I have not given any input for low and the following program is

running without a hitch.


REPORT  ykrtest                                 .
TABLES ekko.

SELECT-OPTIONS : s_date FOR ekko-bedat.

INITIALIZATION.

  s_date-sign = 'I'.
  s_date-option = 'BT'.
  s_date-high = sy-datum.
  APPEND s_date.


START-OF-SELECTION.

  SELECT * FROM ekko
   INTO ekko
   UP TO 10 ROWS
   WHERE bedat IN s_date.


    IF sy-subrc EQ 0.
      WRITE ekko-bedat.
    ELSE.
      WRITE 'wrong'.
    ENDIF.

  ENDSELECT.

Am i missing something?

Cheers,

Kothand

0 Kudos

sorry! it works! I thought it does not work without adding value to sign and option, but I just tried and saw that the I and BT are added automatically (however it is nicer and more readable to add it manually in the code). Your example selects all documents where the creation date (ERDAT) is lower or equal to system date - if that is the requirement, than it is fine. Sorry again!

Kohand: Your first example was with EQ. Interesting is that is works as well, the EQ was transfered to BT in the background (you can check in debug). I guess it is because the high gets a value, where only a range (==> BT) makes sense, not a single value (==> EQ).

0 Kudos

Hi Eric,

I have checked in debug mode and i could see the option changes beautifully from 'EQ' to 'BT' as mentioned by you.

yes i agree its a reasonable change.

A good learning again.

P.S - SAP is too smart to handle situations like this

Cheers,

Kothand

Former Member
0 Kudos

Hi

DATA : G_BEDAT TYPE EKKO-BEDAT,
       VAL1    TYPE SY-DATUM.

select-options : s_date for g_bedat default VAL1 to SY-DATUM.

Former Member
0 Kudos

Hi Pranu,

Write the code as shown in Initialization part.

INITIALIZATION.

bedat-sign = 'I'.

bedat-option = 'BT'.

bedat-low = 'Sy-datum-30'. "or according to your requirement u change

bedat-high = 'Sy-DATUM'.

APPEND bedat.

Cheers!!

Balu

Former Member
0 Kudos

Hi,

If you want to set this with the help with varient , then do like this...

Give your default values , then press the save option ....in it give the name and short text and in then for the field s_date-high select selection variable as D and in the field name of vriable give value as current date.

save it...whenever you will run the report use this saved varient , it will give your high value as current date.

Former Member
0 Kudos

hi,

can be done by;

select-options : s_date for ekko-bedat.

at selection-scren output.

s-date-sign = 'I'.

s_date-option = 'EQ'.

s_date-high = sy-datum.

append s_date