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: 

ABAP QUERY

Former Member
0 Kudos

Hi everyone.

Simple question ...

How to set default values for a selection field in an ABAP Query?

Thanks.

4 REPLIES 4

rahulkavuri
Active Contributor
0 Kudos
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
            GRID RADIOBUTTON GROUP G1.

SELECTION-SCREEN END OF BLOCK B2.

<b>The above is for parameters, this is for select values..</b>

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN,
                S_FKDAT FOR VBRK-FKDAT,
                S_MATNR FOR VBRP-MATNR.

SELECTION-SCREEN END OF BLOCK B1.


<b>INITIALIZATION.

  STR_DATE = SY-DATUM - 200.
  S_FKDAT-LOW = STR_DATE.
  S_FKDAT-HIGH = SY-DATUM.
  S_FKDAT-SIGN = 'I'.
  APPEND S_FKDAT.</b>

0 Kudos

OK, but that's pure ABAP ...

My question is from ABAP Query construction ... by means of transactions SQ01, SQ02 ... how can i set a default value for a specific field.

Your awnser is ABAP Programming point of view ... i also knew that ... but thanks anyway!

0 Kudos

Its quite simple. Go to SQ02. Go to Selections tab. Double click on the field for which you want to set the default value.

If say you want to set the default value to XXXX then just type in Extras field

DEFAULT 'XXXX'.

Please award points if useful

Former Member
0 Kudos

hii

FOR PARAMETERS YOU CAN PASS IT THERE ITSELF,

FOR SELECT OPTIONS SHOULD PASS IN INITIALIZATION.

<b>SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_VBELN TYPE VBAK-VBELN DEFAULT '1234556',

SELECT-OPTIONS: S_ERDAT TYPE VBAK-ERDAT .

SELECTION-SCREEN END OF BLOCK B1.</b>

DATA: INITIAL_DATE TYPE SY-DATUM ,

FINAL_DATE TYPE SY-DATUM .

INITIALIZATION.

<b>S_ERDAT-LOW = INITIAL_DATE.

S_ERDAT-HIGH = FINAL_DATE.

S_ERDAT-SIGN = 'I'.

S_ERDAT-OPTION = 'I' .

APPEND S_ERDAT .</b>

Hope This helps

Thanks&Regards

Naresh