SELECTION-SCREENS: Designing Selection Screens

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

SELECTION-SCREENS: Designing Selection Screens 

SELECTION-SCREEN - Designing Selection screens

Variants:

1. SELECTION-SCREEN BEGIN OF BLOCK block.


2. SELECTION-SCREEN END OF BLOCK block.
3. SELECTION-SCREEN BEGIN OF LINE. 
4. SELECTION-SCREEN END OF LINE.
5. SELECTION-SCREEN POSITION pos.
6. SELECTION-SCREEN ULINE.
7. SELECTION-SCREEN COMMENT fmt name.
8. SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.
9. SELECTION-SCREEN SKIP n.
10.SELECTION-SCREEN FUNCTION KEY n.

Effect

Reports, that is, programs with type "1" in their attributes, usually have
a selectionscreen, which is generated from the SELECT-
OPTIONS and PARAMETERS statements from the report and the access
routines for the logical database, where one line of the selection screen is
taken up by each of these objects.
Additionaly, you can define your own selection screen in any ABAP programs
(except type "S" programs), using SELECTION-SCREEN BEGIN/END OF
SCREEN. You call them in your program using the CALL SELECTION-
SCREEN statement.
You design selection screens using the SELECTION-SCREEN statement. In
the standard selection screen of a report, the SELECTION-SCREEN
statement in the report, and the selection include of the logical database ldb
assigned to the report in its attributes, control the screen design. The logical
database section is controlled by special additions.
SELECTION-SCREEN allows you to create blocks, combine several
parameters and comments into a single line, create pushbuttons on the
screen or in the application toolbar, and include spaces, underlines and
comments on the screen.
There are other variants on SELECTION-SCREEN, which have been
designed exclusively for logical databases, and can therefore only be used in
the selection include.

Additions:
1. ... WITH FRAME
2. ... TITLE title
3. ... NO INTERVALS

Effect

The system opens a logical block on the selection screen. If you use the
WITH FRAME addition, the block is enclosed in a box. You can only use the
TITLE title addition in conjunction with WITH FRAME.

The title title can be defined either statically or at runtime (see also the


COMMENT, PUSHBUTTON and SELECTION-SCREEN BEGIN OF
SCREEN variants).

At runtime, the event

AT SELECTION-SCREEN ON BLOCK block is triggered in the PAI phase for


each block of the selection screen. (In database-specific blocks, the PAI
routine is started in program SAPDBldb, passing the parameters FNAME =
BLOCK_block and MARK = SPACE). If an error message is output, the fields in this
block are ready for input.

You can nest blocks. The maximum depth for blocks in boxes is five levels.

Effect

All SELECT-OPTIONS within the block are displayed in simplified form on the


selection screen without a 'to' field (corresponds to the "NO INTERVALS "
addition for the SELECT-OPTIONS statement). The frame for the block (if
applicable) is made smaller accordingly.

Note

The "NO INTERVALS" attribute is not inherited by blocks without boxes


nested deeper. However, if the blocks are in boxes, the attribute is inherited,
since a smaller box is generated, in which there is no room for the 'to' field.

Effect

Closes the block opened in SELECTION-SCREEN BEGIN OF BLOCK block.


If the block has a box, this is also closed.
Note

Blocks opened in the database selection include must also be closed in the
same program.

Example

TABLES SAPLANE.

SELECTION-SCREEN BEGIN OF BLOCK CHARLY


WITH FRAME TITLE TEXT-001.
PARAMETERS PARM(5).
SELECT-OPTIONS SEL FOR SAPLANE-PLANETYPE.
SELECTION-SCREEN END OF BLOCK CHARLY.

(TEXT-001 = 'Block Charly').

Selection screen:
--Block Charly-----------------------------------
| PARM _____ |
| SEL ________ to ________ |
-------------------------------------------------

Effect

This enables you to arrange several parameters, comments, pushbuttons or


underline blocks, included between the SELECTION-SCREEN BEGIN OF
LINE and SELECTION-SCREEN END OF LINE statements, in a single line.
The automatic newline after eachPARAMETER is suppressed. Furthermore,
the system does not output selection texts for parameters.

Example

SELECTION-SCREEN BEGIN OF LINE.


SELECTION-SCREEN COMMENT 1(10) TEXT-001 FOR FIELD P1.
PARAMETERS: P1 LIKE SAPLANE-PLANETYPE, P2(5), P3(1).
SELECTION-SCREEN END OF LINE.

Selection screen:

Comment 1________ _____ _ 

Note
You cannot include SELECT-OPTIONS between SELECTION-SCREEN
BEGIN OF LINE and SELECTION-SCREEN END OF LINE , since the system
generates more than one object on the selection screen in a SELECT-
OPTION (like fields for lower and upper limits).
You cannot use any variants of SELECTION-SCREEN that generate a
newline (like SELECTION-SCREEN SKIP) between SELECTION-SCREEN
BEGIN OF LINE and SELECTION-SCREEN END OF LINE.

Effect

The next object on the current line ( parameter, comment, pushbutton or


underline) is positioned at pos.
You may only use this variant between SELECTION-SCREEN BEGIN OF
LINE und SELECTION-SCREEN END OF LINE.
You can specify the position pos as a number (relative to the box) if you use
the statement between the SELECTION-SCREEN BEGIN OF BLOCK ...
WITH FRAME ... and SELECTION-SCREEN END OF BLOCK ... statements.
You can also use the symbolic positionsPOS_LOW and POS_HIGH. These are the
positions on the screen at which the system places the input fields
for SELECT-OPTIONS. (POS_LOW is also the screen position
for PARAMETERS).

Within the selection include: Addition FOR TABLE dbtab.

Additions:

1. ... fmt.
2. ... MODIF ID modid.

Effect

Generates an underline (similar to ULINE).


By specifying the format, you can control length, position and newlines.
By specifying a
Modif ID you can assign the underline to a modification group.

Within the selection include: Additions FOR TABLE dbtab und ID id.

Addition 1
... fmt

Addition 2

... MODIF ID modid

Effect

The underline is assigned to the modification group specified (SCREEN-GROUP1).


You can use the group to modify screens.

Additions:

1. ... FOR FIELD f


2. ... MODIF ID modid.
3. ... VISIBLE LENGTH vlen.

You can define the content (name) either statically or at runtime (as in the


BEGIN OF BLOCK, PUSHBUTTONand SELECTION-SCREEN BEGIN OF
SCREEN variants). If you use the FOR FIELD addition, you can omit name
(see below).

When you use comments, you must always specify a format fmt.

Effect

The comment is assigned to either a Parameter or a select-option f. When


the user displays help, the documentation for the reference field of the
parameter or select-option is displayed.
The comment is hidden if the reference object is set to 'invisible' in a selection
variant.

Example

SELECTION-SCREEN BEGIN OF LINE.


SELECTION-SCREEN COMMENT 10(20) TEXT-001
FOR FIELD PARM.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS PARM LIKE SAPLANE-PLANETYPE.
SELECTION-SCREEN END OF LINE.
The comment appears with length 20 in the normal position (POS_LOW , and in
the same line as the parameter. If the user presses F1for either object, the
system displays the documentation for SAPLANE-PLANETYPE.

Note

If you use the FOR FIELD addition, you can omit name . In this case, the
system displays the selection text for the parameter orselect-options.

Example

SELECTION-SCREEN BEGIN OF LINE


PARAMETERS PARM LIKE SAPLANE-PLANETYPE.
SELECTION-SCREEN COMMENT (20) FOR FIELD PARM.
SELECTION-SCREEN END OF LINE.

The parameter is displayed, followed immediately (the example specifies the


length, but no position) by up to 20 characters of its selection text.

By specifiying a
Modif ID , you can assign the comment to a modification group.

Effect

The comment is displayed in the shortedned length vlen. However, you can
still scroll through its full length as specified in the format definition (similarly
to SELECT-OPTIONS and PARAMETERS).

Within the selection include: Additi FOR TABLE dbtab und ID id .

Variant 8

SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.

Addition:

MODIF ID modid.

Effect
Generates a pushbutton on the selection screen. When you define the button,
you also define a user command ucom (no inverted commas), up to 20
characters long, which is triggered when the user pushes the button. The rest
of the syntax is the same as for SELECTION-SCREEN COMMENT

You can define the name name either statically or at runtime (see also the
BEGIN OF BLOCK, COMMENT and SELECTION-SCREEN BEGIN OF
SCREEN variants).

When you define a pushbutton, you must always specify a format fmt.

By specifying a

Modif ID , you can assign the pushbutton to a modification group.

 Notes

The best way of reacting to the pushbutton is in the AT SELECTION-


SCREEN event, or, for pushbuttons in the selection include, in the PAI routine
(with FNAME = '*' and MARK = SPACE ) in the database program SAPDBldb. The
field SSCRFIELDS-UCOMM contains the user command ucom. (You need to declare
the SSCRFIELDS table using the TABLES statement).

 You can create your own pushbuttons in the application toolbar using
the FUNCTION KEY n addition.

Within the selectoin include: Additions FOR NODE node, FOR TABLE


dbtab und ID id .

Example

TABLES SSCRFIELDS.
...
SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND
ABCD.
...

INITIALIZATION.
MOVE 'My text' TO CHARLY.
...
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'ABCD'.
...
ENDIF.

A pushbutton appears on the selection screen with the text 'My text'. In


the AT SELECTION-SCREEN event, the fieldSSCRFIELDS-UCOMM has the
contents ABCD after the button has been pushed.

Effect

Generates n blank lines (similar to SKIP)


n can have any value from 1 to 9. If you only want to insert one blank line, you
can leave out n.

Within the selection include: Additions FOR NODE node, FOR TABLE


dbtab and ID id .

Effect

Activates a pushbutton (one of a maximum of 5) in the application toolbar of


the selection screen (where n is between 1 and 5).
At runtime, you must insert the text for the pushbutton into the appropriate
ABAP Dictionary field SSCRFIELDS-FUNCTXT_01 ...SSCRFIELDS-FUNCTXT_05.
The function code placed in field SSCRFIELDS-UCOMM is 'FC01' ... 'FC05'. You can
query this function code in the AT SELECTION-SCREEN event or the PAI
routine in the database access program SAPDBldb.

Within the selection include: Additions FOR NODE node, FOR TABLE dbtab,


and ID id . FOR TABLE dbtab und ID id .

 Notes

If a pushbutton (ex. FUNCTION KEY 2,) is already defined in the selection


include, the system returns a syntax error if you try to include an equivalent
statement in your report.

 You can create your own pushbuttons directly on the screen using the
PUSHBUTTON addition.
Example

TABLES SSCRFIELDS.
...
SELECTION-SCREEN FUNCTION KEY 1.
...

INITIALIZATION.
MOVE 'My text' TO SSCRFIELDS-FUNCTXT_01.
...

AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01'.
...
ENDIF.

Generates a pushbutton in the application toolbar of the selection screen with


the text 'My text'. In the AT SELECTION-SCREENevent, SSCRFIELDS-
UCOMM has the contents FC01 when the button has been pushed.

SAP ABAP - Selection-Screen - Introduction, Syntax &


Examples.
INTRODUCTION:

- PARAMETERS statement/keyword is used for single field entries in the selection screen.

- SELECT-OPTIONS statement/keyword is used for complex selections.

- SELECTION-SCREEN statement/keyword is used for formatting the selection screen.

- Programmer gets a great deal of control on how to present the User Interface / Selection Screen to
the user. Using the options available with the SELECTION-SCREEN statement, the look of the screen
can be formatted as per the requirement.

- SELECTION-SCREEN is used to form blocks by combining several PARAMETERS, SELECT-OPTIONS,


comments etc. on one line.

- The standard selection screen of executable programs is predefined and has screen number 1000.

- A SELECTION-SCREEN block can contain keywords like PARAMETERS, SELECT-OPTIONS, COMMENT,


PUSH-BUTTON etc.

SYNTAX:
1) 
SELECTION-SCREEN BEGIN OF LINE.
...........
...........
SELECTION-SCREEN END OF LINE.

This option is used to have several elements in a single line. It places multiple fields
immediately adacent to one another. 
SELECT-OPTIONS cannot be used between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN
END OF LINE

2) 

SELECTION-SCREEN BEGIN OF BLOCK <block>


[ WITH FRAME [ TITLE <title> ] ] [ NOINTERVALS ].
......................
......................
SELECTION-SCREEN END OF BLOCK.

This option is used to have a block of elements.

The objects in the blocks can have SELECT-OPTIONS, PARAMETERS, COMMENTS, UNDERSCORES.

3)

SELECTION-SCREEN SKIP [ <n> ]

This option is used to create n number of blank lines on the screen.

4)

SELECTION-SCREEN ULINE [ [ / ] <pos (len)> ] [ MODIF ID <key> ].

This option is used to create under lines.. It places an underline on the screen at a location and length
specified.

5)

SELECTION-SCREEN COMMENT [ / ] <pos (len)> <comm> 


[ FOR FIELD <f> ] [ MODIF ID <key> ].

This option is used to place a comment which will be a user defined message on the screen at a
location and length specified.

6)

SELECTION-SCREEN BEGIN OF SCREEN <numb> [ TITLE <title> ] [ AS WINDOW ].


.........................
.........................
SELECTION-SCREEN END OF SCREEN <numb>.

This option is used to define user defined selection screen.

7)
SELECTION-SCREEN PUSHBUTTON [ / ] <pos ( len ) > <push>
USER-COMMAND <ucomm> [ MODIF ID <key> ].

This option is used to create pushbuttons on the selection screen. When the user clicks the pushbutton
on the selection screen, <ucomm> is entered in the UCOMM of the SSCRFIELDS structure..

The contents of the SSCRFIELDS-UCOMM field can be processed during the AT SELCTION-


SCREEN event.

The structue SSCRFIELDS must be mentioned in the TABLES statement.

8)

SELECTION-SCREEN FUNCTION KEY <n>.

This option is used to create pushbuttons on the application toolbar of the selection screen. 

<n> must be between 1 and 5. Hence it is not possible to create more than 5 pushbuttons using this
method.

SSCRFIELDS structure is associated with these pushbuttons.  Also SSCRFIELDS structure must be


declared with the TABLES statement.

When the user clicks on one of the pushbuttons, FC0<n> is placed into the SSCRFIELDS-UCOMM field and
the AT SELECTION-SCREEN event is triggered.

The text for the pushbutton is placed in SSCRFIELDS-FUNCTXT_<n>.

EXAMPLES WITH SCREENSHOTS:


1)

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.


PARAMETERS: x(10) TYPE c ,
y(10) TYPE c ,
z(10) TYPE c .
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.


PARAMETERS: a(10) TYPE c ,
b(10) TYPE c,
c(10) TYPE c .
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK tabbed FOR 5 LINES,


TAB (10) text-001 USER-COMMAND push1
DEFAULT SCREEN 100,
TAB (10) text-002 USER-COMMAND push2
DEFAULT SCREEN 200,
END OF BLOCK tabbed.
2)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.


PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN SKIP 1.

PARAMETERS : s_plant1 LIKE lips-werks OBLIGATORY.


SELECT-OPTIONS: s_deldt1 FOR likp-erdat DEFAULT '20110105' TO '20110210' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.

3)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.


PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE /1(10).
SELECTION-SCREEN ULINE POS_LOW(12).
SELECTION-SCREEN ULINE POS_HIGH(12).

SELECTION-SCREEN SKIP 1.

PARAMETERS : s_plant1 LIKE lips-werks OBLIGATORY.


SELECT-OPTIONS: s_deldt1 FOR likp-erdat DEFAULT '20110105' TO '20110210' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.

4)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.


PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(50) text.

AT SELECTION-SCREEN OUTPUT.
text = 'Please Note:Enter the details successfully'.

5)
SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(50) text-002.

6)

* TEXT-001 - Please Enter The Details.


* TEXT-002 - Fill The Details Carefully After studying carefully the requirements.
SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(80) text-002 visible length 40.

7)

SELECTION-SCREEN: BEGIN OF LINE,


PUSHBUTTON 1(8) text-001 USER-COMMAND fcode,
POSITION 12.
PARAMETERS para TYPE char20.
SELECTION-SCREEN: COMMENT 34(80) text-002,
END OF LINE.
8)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001 NO INTERVALS.


PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat OBLIGATORY.
SELECT-OPTIONS: s_delno FOR likp-vbeln.
SELECTION-SCREEN END OF BLOCK part1.

9)

SELECTION-SCREEN BEGIN OF BLOCK rad1


WITH FRAME TITLE text-001.
PARAMETERS: r1 RADIOBUTTON GROUP gr1,
r2 RADIOBUTTON GROUP gr1,
r3 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN END OF BLOCK rad1.

Sample Code For Selection Screen Output


I have created two radiobutton & I have two field where I have to put file path.
Whenever I check one radio button I want to only activate only one field and
other field should be deactivated. I am trying by using at seelction-screen output.
but I'm not getting desired output.

By: Hari

Here is the sample code for your requirement. 


   
selection-screen :begin of block test with frame title text-001. 
parameters:p_rad1 radiobutton group one user-command test, 
                 p_rad2 radiobutton group one. 
selection-screen:end of block test. 
selection-screen:begin of block test2 with frame title text-002. 
parameters:p_file(10) TYPE C MODIF ID TL, 
                 p_file1(10) TYPE C MODIF ID TT. 
selection-screen:end of block test2. 
    
AT SELECTION-SCREEN OUTPUT. 
  IF P_RAD1 = 'X'. 
      LOOP AT SCREEN. 
          CHECK SCREEN-GROUP1 = 'TT'. 
          SCREEN-INPUT = '0'. 
          MODIFY SCREEN. 
      ENDLOOP. 
  ENDIF.

  IF P_RAD2 = 'X'. 
      LOOP AT SCREEN. 
         CHECK SCREEN-GROUP1 = 'TL'. 
         SCREEN-INPUT = '0'. 
         MODIFY SCREEN. 
      ENDLOOP. 
  ENDIF.

Different Types of Selection Screens


What is: 
1. at selection-screen on field 
2. at selection-screen output 
3. at selection-screen block 
4. at selection-screen on value-request 
5. at selection-screen on help-request and their difference?

For knowing Selection-screens: 


    
First you must have right understanding of Events. 
- Events are introduced by Event Keyword.  They end when again next processs
begins.
Selection-screens are special screen defined in ABAP.   
- This ABAP at run time only controls the flow logic of Selection-screens.  The PBO
and PAI triggers the num of. selection-screens. 
    
The basic form of the selection screen events is the AT SELECTION-SCREEN event.
This event occurs after the runtime environment has passed all input data from the
selection screen to the ABAP program. The other selection screen events allow
programmers to modify the selection screen before it is sent and specifically check
user input.  
    
At Selection-screen OUTPUT is trigerred in PBO of selection-screen.   
- This allows you to modify the Selection-screen, before it is displayed. 
    
At Selection-screen On Field is triggered in PAI of selection-screens. 
- The input fields can b checked,in the corresponding event block. If an error message
occurs within this event block, the corresponding field is made ready for input again
on the selection screen. 
    
At Selection-screen On Block is trigerred in PAI event. 
- You define a block  by enclosing the declarations of the elements in the block
between the statements SELECTION-SCREEN BEGIN OF BLOCK block - END OF
BLOCK block. You can use this event block to check the consistency of the input
fields in the block. 
    
At Selection-screen On value request. 
- This event is trigerred for F4 help. 
    
At Selection-screen On help request . 
- This event is triggered when the user clicks F1 for help on fields Difference
Between Select-Options & Ranges
What are the difference between SELECT-OPTIONS & RANGES?

Here both SELECT-OPTIONS & RANGES works for the same purpose.  They both
are used for the range selection from selection screen.  The main diff. between them
is, while we use SELECT-OPTIONS system implicitly creates the select options
internal table which contains the fields of SIGN,OPTION,LOW & HIGH.  But in case
of RANGES, this internal table should be defined explicitly.

Eg. to SELECT-OPTIONS : 
-----------------------------------------

REPORT YARSELECT. 
TABLES YTXLFA1. 
SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR. 
INITIALIZATION. 
VENDOR-LOW    =   1000.               " It specifies the range starting value. 
VENDOR-HIGH    =   2000.               " It specifies the range ending value. 
VENDOR-OPTION  =  'BT'.                " specifies ranges value is in between. 
VENDOR-SIGN      = 'I'.                     "specifies both inclussive.

APPEND VENDOR.

- - - - 
- - - - 
SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB  
WHERE LIFNR IN VENDOR.

Eg. to RANGES: 
-------------------------

REPORT YARRANGE. 
TABLES YTXLFA1. 
RANGES: VENDOR FOR YTXFLA1-LIFNR.

- - - -  
- - - -- 
- - - - 

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB  


WHERE LIFNR IN VENDOR.

Here with RANGES  user has to design an internal table with fields -  
SIGN,OPTION,LOW and HIGH EXPLICITLY.

--------------------------------------------------------------------------------------------------------
->
Example: 
  
select-options: bukrs for zstock-bukrs. 
  
Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look
like this: 
  
IEQABFI 
  
This is because BUKRS is set as a table as follows: 
  
begin of bukrs occurs 0, 
  SIGN(1)    type c, 
  OPTION(2) type c, 
  LOW         like bukrs, 
  HIGH         like bukrs, 
end of bukrs. 
  
Now, when you create the following range, it will have the exact same fields set
inside its table: 
  
Ranges: bukrs for zstock-bukrs. 
  
The difference is, because ranges doesn't show on the selection screen, you will have
to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low &
bukrs-high all manually. 
  
Some tips: 
Sign is always I (for Include) or E (for Exclude) 
Option can be a whole range, which includes: 
EQ        (Equal)  
BT        (Between))  
CP        (Contain Pattern) 
So let's say you want to have the range check for all company codes not starting with
AB, you will set your code as follow: 
  
ranges: bukrs for zstock-bukrs. 
  
bukrs-sign = 'E'.             "Exclude 
bukrs-option = 'CP'.        "Pattern 
bukrs-low = 'AB*'.            "Low Value 
bukrs-high = ''.                "High Value 
append bukrs. 
  
Always remember to APPEND your range when you fill it, as the WHERE clause
checks against the lines of the range table, not against the header line. 
  
Hope this explains it well enough.

--------------------------------------------------------------------------------------------------------
->

What does SIGN "I" & "E" mean?

The "I" stands for Include, and the "E" for Exclude. 
  
The easiest way to learn how the range selections work is, create the following
dummy program: 
  
report dummy. 
tables: mara. 
select-options: matnr for mara-matnr. 
start-of-selection. 
loop at matnr. 
write: / matnr-sign, 
           matnr-option, 
           matnr-low, 
           matnr-high. 
endloop. 
  
Run this program, and fill in a lot of junk into MATNR. Fill in some includes, some
excludes, some ranges, etc., and you will soon realise how the system builds ranges
(select-options). Once you know that, you can fill your own ranges quickly and
efficiently.

Difference Between Select-Options & Ranges


What are the difference between SELECT-OPTIONS & RANGES?

Here both SELECT-OPTIONS & RANGES works for the same purpose.  They both
are used for the range selection from selection screen.  The main diff. between them
is, while we use SELECT-OPTIONS system implicitly creates the select options
internal table which contains the fields of SIGN,OPTION,LOW & HIGH.  But in case
of RANGES, this internal table should be defined explicitly.
Eg. to SELECT-OPTIONS : 
-----------------------------------------

REPORT YARSELECT. 
TABLES YTXLFA1. 
SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR. 
INITIALIZATION. 
VENDOR-LOW    =   1000.               " It specifies the range starting value. 
VENDOR-HIGH    =   2000.               " It specifies the range ending value. 
VENDOR-OPTION  =  'BT'.                " specifies ranges value is in between. 
VENDOR-SIGN      = 'I'.                     "specifies both inclussive.

APPEND VENDOR.

- - - - 
- - - - 
SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB  
WHERE LIFNR IN VENDOR.

Eg. to RANGES: 
-------------------------

REPORT YARRANGE. 
TABLES YTXLFA1. 
RANGES: VENDOR FOR YTXFLA1-LIFNR.

- - - -  
- - - -- 
- - - - 

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB  


WHERE LIFNR IN VENDOR.

Here with RANGES  user has to design an internal table with fields -  
SIGN,OPTION,LOW and HIGH EXPLICITLY.

--------------------------------------------------------------------------------------------------------
->

Example: 
  
select-options: bukrs for zstock-bukrs. 
  
Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look
like this: 
  
IEQABFI 
  
This is because BUKRS is set as a table as follows: 
  
begin of bukrs occurs 0, 
  SIGN(1)    type c, 
  OPTION(2) type c, 
  LOW         like bukrs, 
  HIGH         like bukrs, 
end of bukrs. 
  
Now, when you create the following range, it will have the exact same fields set
inside its table: 
  
Ranges: bukrs for zstock-bukrs. 
  
The difference is, because ranges doesn't show on the selection screen, you will have
to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low &
bukrs-high all manually. 
  
Some tips: 
Sign is always I (for Include) or E (for Exclude) 
Option can be a whole range, which includes: 
EQ        (Equal)  
BT        (Between))  
CP        (Contain Pattern) 
So let's say you want to have the range check for all company codes not starting with
AB, you will set your code as follow: 
  
ranges: bukrs for zstock-bukrs. 
  
bukrs-sign = 'E'.             "Exclude 
bukrs-option = 'CP'.        "Pattern 
bukrs-low = 'AB*'.            "Low Value 
bukrs-high = ''.                "High Value 
append bukrs. 
  
Always remember to APPEND your range when you fill it, as the WHERE clause
checks against the lines of the range table, not against the header line. 
  
Hope this explains it well enough.

--------------------------------------------------------------------------------------------------------
->

What does SIGN "I" & "E" mean?

The "I" stands for Include, and the "E" for Exclude. 
  
The easiest way to learn how the range selections work is, create the following
dummy program: 
  
report dummy. 
tables: mara. 
select-options: matnr for mara-matnr. 
start-of-selection. 
loop at matnr. 
write: / matnr-sign, 
           matnr-option, 
           matnr-low, 
           matnr-high. 
endloop. 
  
Run this program, and fill in a lot of junk into MATNR. Fill in some includes, some
excludes, some ranges, etc., and you will soon realise how the system builds ranges
(select-options). Once you know that, you can fill your own ranges quickly and
efficiently.

You might also like