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: 

scenarios

Former Member
0 Kudos

can any post soe realltime scenarios, operations that will be done in real time regarding 'PREDEFINED TABLES','ZTABLES','SELECTION-SCREEN'.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Defining Selection Screens

There are three ABAP statements for defining selection screens:

· PARAMETERS for single fields

· SELECT-OPTIONS for complex selections

· SELECTION-SCREEN for formatting the selection screen and defining user-specific selection screens

These ABAP statements are included in the declaration part of an ABAP program. When defining selection screens, you must distinguish between standard selection screens for executable programs and user-defined selection screens for all types of program.

Standard Selection Screens

The standard selection screen of executable programs is predefined and has the screen number 1000. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that do not occur in the definition of a user-defined selection screen in executable programs – that is, that are not included between the statements –

SELECTION-SCREEN BEGIN OF ...

...

SELECTION-SCREEN END OF ...

define the input fields and the formatting of the standard selection screen. For the sake of clarity, you should group together all statements that make up the standard selection screen before defining additional selection screens. You can define input fields of a standard selection screen only in executable programs. In all other programs, the PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREENstatements must be included in the above statements.

User-defined selection screens

The two statements:

SELECTION-SCREEN BEGIN OF SCREEN numb .

...

SELECTION-SCREEN END OF SCREEN numb.

define a user-defined selection screen with screen number numb. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that occur between these two statements define the input fields and the formatting of this selection screen. Screen number numb can be any four-digit number apart from 1000, which is the number of the standard selection screen. You must also ensure that you do not accidentally assign a number to a selection screen which is already in use for another screen of the program.

The TITLE tit addition allows you to define a title for a user-defined selection screen. The title tit can either be a static text symbol or a dynamic character field. If you use a character field, you must not define it using the DATA statement - the system generates it automatically. The character field can be filled during the INITIALIZATION event. The title of standard selection screens is always the name of the executable program.

You can use the AS WINDOWaddition to call a user-defined selection screen as a modal dialog box. You enter the definition of the window only when you perform the call itself. The AS WINDOWaddition ensures that warnings and error messages associated with the selection screen are also displayed as modal dialog boxes, and not in the status bar of the selection screen.

If you define more than one selection screen in a program, you can re-use elements of one selection screen in another using the following statement: For this purpose, yse the statement:

SELECTION SCREEN INCLUDE BLOCKS block

| PARAMETERS p

| SELECT-OPTIONS selcrit

| COMMENT comm

| PUSH-BUTTON push

You can specify any of the following elements that have already been declared in another selection screen:

· Blocks with the name block

· Parameters with the name p

· Selection criteria with the name selcrit

· Comments with the name comm

· Pushbuttons with the name push

Example

REPORT selscreendef.

...

PARAMETERS par1 ....

SELECT-OPTIONS sel1 FOR ... .

...

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

PARAMETERS par2 ... .

SELECT-OPTIONS sel2 FOR ... .

...

SELECTION-SCREEN END OF SCREEN 500.

SELECTION-SCREEN BEGIN OF SCREEN 600 TITLE text-100.

SELECTION-SCREEN INCLUDE: PARAMETERS par1,

SELECT-OPTIONS sel1.

PARAMETERS par3 ... .

SELECT-OPTIONS sel3 ... .

...

SELECTION-SCREEN END OF SCREEN 600.

Three selection screens - the standard selection screen and two user-defined selection screens - are defined. The program must be executable so that a standard selection screen can be defined. Selection screen 500 is defined to be called as a modal dialog box. Selection screen 600 contains text symbol 100 as its title, and uses elements par1 and sel1 from the standard selection screen.

4 REPLIES 4

Former Member
0 Kudos

Defining Selection Screens

There are three ABAP statements for defining selection screens:

· PARAMETERS for single fields

· SELECT-OPTIONS for complex selections

· SELECTION-SCREEN for formatting the selection screen and defining user-specific selection screens

These ABAP statements are included in the declaration part of an ABAP program. When defining selection screens, you must distinguish between standard selection screens for executable programs and user-defined selection screens for all types of program.

Standard Selection Screens

The standard selection screen of executable programs is predefined and has the screen number 1000. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that do not occur in the definition of a user-defined selection screen in executable programs – that is, that are not included between the statements –

SELECTION-SCREEN BEGIN OF ...

...

SELECTION-SCREEN END OF ...

define the input fields and the formatting of the standard selection screen. For the sake of clarity, you should group together all statements that make up the standard selection screen before defining additional selection screens. You can define input fields of a standard selection screen only in executable programs. In all other programs, the PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREENstatements must be included in the above statements.

User-defined selection screens

The two statements:

SELECTION-SCREEN BEGIN OF SCREEN numb .

...

SELECTION-SCREEN END OF SCREEN numb.

define a user-defined selection screen with screen number numb. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that occur between these two statements define the input fields and the formatting of this selection screen. Screen number numb can be any four-digit number apart from 1000, which is the number of the standard selection screen. You must also ensure that you do not accidentally assign a number to a selection screen which is already in use for another screen of the program.

The TITLE tit addition allows you to define a title for a user-defined selection screen. The title tit can either be a static text symbol or a dynamic character field. If you use a character field, you must not define it using the DATA statement - the system generates it automatically. The character field can be filled during the INITIALIZATION event. The title of standard selection screens is always the name of the executable program.

You can use the AS WINDOWaddition to call a user-defined selection screen as a modal dialog box. You enter the definition of the window only when you perform the call itself. The AS WINDOWaddition ensures that warnings and error messages associated with the selection screen are also displayed as modal dialog boxes, and not in the status bar of the selection screen.

If you define more than one selection screen in a program, you can re-use elements of one selection screen in another using the following statement: For this purpose, yse the statement:

SELECTION SCREEN INCLUDE BLOCKS block

| PARAMETERS p

| SELECT-OPTIONS selcrit

| COMMENT comm

| PUSH-BUTTON push

You can specify any of the following elements that have already been declared in another selection screen:

· Blocks with the name block

· Parameters with the name p

· Selection criteria with the name selcrit

· Comments with the name comm

· Pushbuttons with the name push

Example

REPORT selscreendef.

...

PARAMETERS par1 ....

SELECT-OPTIONS sel1 FOR ... .

...

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

PARAMETERS par2 ... .

SELECT-OPTIONS sel2 FOR ... .

...

SELECTION-SCREEN END OF SCREEN 500.

SELECTION-SCREEN BEGIN OF SCREEN 600 TITLE text-100.

SELECTION-SCREEN INCLUDE: PARAMETERS par1,

SELECT-OPTIONS sel1.

PARAMETERS par3 ... .

SELECT-OPTIONS sel3 ... .

...

SELECTION-SCREEN END OF SCREEN 600.

Three selection screens - the standard selection screen and two user-defined selection screens - are defined. The program must be executable so that a standard selection screen can be defined. Selection screen 500 is defined to be called as a modal dialog box. Selection screen 600 contains text symbol 100 as its title, and uses elements par1 and sel1 from the standard selection screen.

Former Member
0 Kudos

hI

Elaboration on each of the definitions

A transparent table is automatically created on the database when it is activated in the ABAP Dictionary. At this time the database-independent description of the table in the ABAP Dictionary is translated into the language of the database system used.

The database table has the same name as the table in the ABAP Dictionary. The fields also have the same name in both the database and the ABAP Dictionary. The data types in the ABAP Dictionary are converted to the corresponding data types of the database system.

The order of the fields in the ABAP Dictionary can differ from the order of the fields on the database. This permits you to insert new fields without having to convert the table. When a new field is added, the adjustment is made by changing the database catalog (ALTER TABLE). The new field is added to the database table, whatever the position of the new field in the ABAP Dictionary.

Tables can also reside on the database as Pooled tables or cluster tables

Pooled Tables: Different tables which are not linked to each other with a common key can be combined into a Table Pool. The tables contained within this pool are called Pooled Tables. A table pool is stored in the database a simple table. The table's data sets contain, in separate fields, the actual key for the data set to be stored, the name of the pooled table and the contents of the data set to be stored.

Using this schema, several logical tables are combined into a single real database table. Although the data structure of each set is lost during the write to the table pool, it is restored during the read by the ABAP/4 Data Dictionary. The ABAP/4 Data Dictionary utilizes its meta-data to accomplish this.

Since information must be prepared (defined) within the ABAP/4 Data Dictionary when it is read or written to (or accessed), this process itself defines these as not transparent tables

Cluster Tables: Occasionally, several tables may be linked by a common key. The ABAP/4 Data Dictionary can also combine these tables into a single table. Each data set of the real table within the database contains a key and in a single data field, several data sets of the subsequent table for this key.

As mentioned above, these table types require special data handling, therefore they are not transparent tables.

In contrast to append structures, Customizing includes can be inserted into more than one table.

As an example the customizing include that we created (CI_DEMO) could be a part of multiple tables in the database whereas the append structure (ZDEMO_APPEND) can only be assigned to one table. (here MARA).

This provides for data consistency throughout the tables and structures affected whenever the include is altered.

Former Member
0 Kudos

Hello Sandeep...

You have to use the correct terminology... Not predefined talbles, its standard tables.

Standard Tables

are the tables which are created by SAP. Like mara, marc, vbak, etc.

There are 3 types of tables:

i)Transparent tables

- Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. Both Opensql and Nativesql can be used.

ii)Pool tables & iii)Cluster tables

- These are logical tables that are arranged as records of transparent tables. one cannot use native sql on these tables (only open sql).They are not managable directly using database system tools

more info..

I. Transparent tables (BKPF, VBAK, VBAP, KNA1, COEP)
· Allows secondary indexes (SE11->Display Table->Indexes)
· Can be buffered (SE11->Display Table->technical settings) Heavily updated tables should not be buffered.
II. Pool Tables (match codes, look up tables)
· Should be accessed via primary key or
· Should be buffered (SE11->Display Table->technical settings)
· No secondary indexes
· Select * is Ok because all columns retrieved anyway
III. Cluster Tables (BSEG,BSEC)
· Should be accessed via primary key - very fast retrieval otherwise very slow
· No secondary indexes
· Select * is Ok because all columns retrieved anyway. Performing an operation on multiple rows is more efficient than single row operations. Therefore you still want to select into an internal table. If many rows are being selected into the internal table, you might still like to retrieve specific columns to cut down on the memory required.
· Statistical SQL functions (SUM, AVG, MIN, MAX, etc) not supported
· Can not be buffered
IV. Buffered Tables (includes both Transparent & Pool Tables)
While buffering database tables in program memory (SELECT into internal table) is generally a good idea for performance, it is not always necessary. Some tables are already buffered in memory. These are mostly configuration tables. If a table is already buffered, then a select statement against it is very fast. To determine if a table is buffered, choose the 'technical settings' soft button from the data dictionary display of a table (SE12). Pool tables should all be buffered.
"Major difference betwen Standard tables,Pooled tables and Cluster Tables?


1.A transparent table is a table that stores data directly. You can read these tables directly on the database from outside SAP with for instance an SQL statement.

2.Transparent table is a one to one relation table i.e. when you create one transparent table then exactly same table will create in data base and if is basically used to store transaction data.

3.A clustered and a pooled table cannot be read from outside SAP because certain data are clustered and pooled in one field.

4.One of the possible reasons is for instance that their content can be variable in length and build up. Database manipulations in Abap are limited as well.

5.But pool and cluster table is a many to one relationship table. This means many pool table store in a database table which is know as table pool.

6.All the pool table stored table in table pool does not need to have any foreign key relationship but in the case of cluster table it is must. And pool and cluster table is basically use to store application data.

7.Table pool can contain 10 to 1000 small pool table which has 10 to 100 records. But cluster table can contain very big but few (1 to 10) cluster table.

8.For pool and cluster table you can create secondary index and you can use select distinct, group for pool and cluster table. You can use native SQL statement for pool and cluster table.

9.A structure is a table without data. It is only filled by program logic at the moment it is needed starting from tables.

10.A View is a way of looking at the contents of tables. It only contains the combination of the tables at the basis and the way the data needs to be represented. You actually call directly upon the underlying tables.
'The table which store information about Structures and Tables are as follows:


DD02L - table properties
DD02T - table texts
DD03L - field properties
DD03T - field texts

Creating cluster/pool tables:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f0b7446011d189700000e8322d00/content.htm
creating transparent tables
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/frameset.htm

Ztables

are created by the customers. We can create tables stating with Y.
we will create these tables only when no relevent standard table is provided by SAP. with our own fields we will create Z or Y Tables.

SELECTION-SCREEN

Selection screen is the screen where we can select our criteria like... range of material numbers to display the details of materials... like that...

we i'm giving varients of selection screen.. just go thru this...

1. SELECTION-SCREEN BEGIN OF LINE.

2. SELECTION-SCREEN END OF LINE.

3. SELECTION-SCREEN SKIP n.

4. SELECTION-SCREEN ULINE.

5. SELECTION-SCREEN POSITION pos.

6. SELECTION-SCREEN COMMENT fmt name.

7. SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.

8. SELECTION-SCREEN BEGIN OF BLOCK block.

9. SELECTION-SCREEN END OF BLOCK block.

10. SELECTION-SCREEN FUNCTION KEY n.

11. SELECTION-SCREEN BEGIN OF VERSION ver TEXT-xxx.

12. SELECTION-SCREEN END OF VERSION ver.

13. SELECTION-SCREEN EXCLUDE ... .

14. SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab.

15. SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab.

Effect

The key word SELECTION-SCREEN only makes sense in reports, i.e. programs specified as type "1" in the attributes. You use it to design the selection screen in the program or logical database access routine.

The selection screen is normally generated from the SELECT-OPTIONS and PARAMETERS statements in the report and logical database access routine. Each of these objects occupies a separate line on the selection screen.

SELECTION-SCREEN allows you to form blocks, combine several parameters and comments together on one line, generate pushbuttons on the screen or activate them in the application toolbar, as well as insert blank lines, underscore lines and comments.

Like SELECT-OPTIONS and PARAMETERS , you can use SELECTION-SCREEN statements in reports and in the include program DBldbSEL of the logical database ldb assigned to the report in the attributes. Some variants are defined only for logical databases and can therefore only be used in the include program DBldbSEL .

Variant 1

SELECTION-SCREEN BEGIN OF LINE.

Variant 2

SELECTION-SCREEN END OF LINE.

Effect

Allows you to combine several parameters and comments specified between the SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE statements and output them on one line. As a result, there is no automatic new line for each PARAMETER and no selection texts are displayed.

Example

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(10) TEXT-001.

PARAMETERS: P1(3), P2(5), P3(1).

SELECTION-SCREEN END OF LINE.

Selection screen:

Comment ___ _____ _

Note

You cannot order SELECT-OPTIONS between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE because several objects are generated on the selection screen for a SELECT-OPTION (e.g. fields for the lower and upper limits of ranges).

Variant 3

SELECTION-SCREEN SKIP n.

Additions

1. ... FOR TABLE dbtab

2. ... ID id

Effect

Generates n blank lines (see also SKIP ).

You must specify a value for n between 1 and 9. If you want to output just one blank line, you can omit n .

Addition 1

... FOR TABLE dbtab

Effect

This addition is allowed only in the database include program DBldbSEL . It is, in fact, a requirement. If you use SELECTION-SCREEN SKIP in DBldbSEL , you must assign the statement to a table (or to a field - see the variant COMMENT .

This assignment is necessary in order to restrict the SELECTION-SCREEN statements for a report selection screen to those relevant for the tables used in the report, i.e. those which refer to a table used in the report. Any SELECTION-SCREEN statement assigned to a table not used in the report with the addition FOR TABLE dbtab are ignored when the report selection screen is generated.

Note

A table dbtab of the logical database ldb is considered as "used in the report" if it is either declared in a TABLES statement or its position in the database hierarchy lies somewhere between the root and a table dbtab_2 declared in the report.

Example

Hierarchy of logical database ldb :

SPFLI

|

-

-


SAPLANE

|

-

-


SFLIGHT

|

-

-


SBOOK

In the report:

TABLES SFLIGHT.

Tables considered as "used" include SFLIGHT (since it is

declared directly), as well as SAPLANE and SPFLI (since

they lie on the path from the hierarchy root " SPFLI " to the

declared table SFLIGHT ). The table SBOOK is not

considered as used, i.e. all the SELECTION-SCREEN statements

qualified with the addition " FOR TABLE SBOOK " in DBldbSEL

are ignored.

Addition 2

... ID id

Effect

This addition is allowed only in the database include program DBldbSEL . It is used to identify a SELECTION-SCREEN object (in this case blank lines) via an ID which can be up to 3 characters long. This ID is then specified in SELECTION-SCREEN EXCLUDE IDS id in order to exclude the object from a selection screen version.

Variant 4

SELECTION-SCREEN ULINE.

Additions

1. ... fmt

2. ... FOR TABLE dbtab

3. ... MODIF ID mod

4. ... ID id

Effect

Generates an underline (see also ULINE ).

Addition 1

... fmt

Effect

Format specification with the form /pos(len) , pos(len) or (len) . The slash ( / ) generates a new line and is therefore not allowed between BEGIN OF LINE and END OF LINE . The effect of the statement is to underscore the current line starting from the position pos for the length len . The variant (len) (without position specification) is allowed only between BEGIN OF LINE and END OF LINE . In this case, the current position in the line is used. See also WRITE .

You can specify the position pos as a number (in this case, it is relative to the frame if the statement comes between SELECTION-SCREEN BEGIN OF BLOCK ... WITH FRAME ... and SELECTION-SCREEN END OF BLOCK ... ). Also allowed are the symbolic positions POS_LOW and POS_HIGH . These are the positions at which the input fields of the SELECT-OPTI ONS are output ( POS_LOW is also the position of PARAMETERS .

Note

Format specifications which do not generate a new line can produce overlapping objects on the selection screen. Therefore, you should be particularly careful with position and length specifications.

Example

SELECTION-SCREEN ULINE /1(10).

SELECTION-SCREEN ULINE POS_LOW(10).

SELECTION-SCREEN ULINE POS_HIGH(10).

This generates three underscore blocks, each with a length of 10, on one line.

Addition 2

... FOR TABLE dbtab

Effect

See variant 3 ( SELECTION-SCREEN SKIP ).

Addition 3

... MODIF ID mod

Effect

The specified modification group ( SCREEN-GROUP1 ) is assigned to the underscore. You can use this under AT SELECTION-SCREEN in the report or in the PAI routine of the database program SAPDBldb to modify the screen.

Note

The name of the modification group must be specified without quotation marks. It can be up to three characters long.

Addition 4

... ID id

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Variant 5

SELECTION-SCREEN POSITION pos.

Addition

... FOR TABLE dbtab

Effect

Outputs the parameter starting from the position pos .

This variant is allowed only between SELECTION-SCREEN BEGIN OF LINE< /> and SELECTION-SCREEN END OF LINE .

As with the addition ULINE , you can specify the position as fixed (if necessary relative to the frame) or symbolically in the form POS_LOW or POS_HIGH .

Addition

... FOR TABLE dbtab

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Variant 6

SELECTION-SCREEN COMMENT fmt name.

Additions

1. ... FOR TABLE dbtab

2. ... FOR FIELD f

3. ... MODIF ID mod

4. ... ID id

Effect

Generates a comment on the selection screen. For the name name , there are two options:

name takes the form TEXT-xxx where xxx is a three-character name for a text symbol. In this case, the contents of the text symbol are displayed at runtime, i.e. the text cannot be changed dynamically. name is another eight-character name. Here, you create a field with the name name in the length specified in the format fmt< /> and it is then generated as an output field on the selection screen. The contents of these comments must therefore be set at runtime (e.g. at INITIALIZATION or - in the case of comments in the database include program DBldbSEL - in the routine INIT of the database program SAPDBldb . They can also be changed when the selection screen is being processed.

Note

The field name is generated automatically and so cannot be defined with DATA .

With comments, you must always specify a format fmt (see variant ULINE ).

Note

You must program a new line yourself via the format fmt .

Addition 1

... FOR TABLE dbtab

Note

See variation 3 (SELECTION-SCREEN SKIP).

Addition 2

... FOR FIELD f

Effect

Since the comment is assigned to a parameteror a select-option , the help display shows the documentation of the reference field if this parameter or selection option.

In addition, the comment is suppressed if the reference object was set to 'invisible' via a selection variant.

Note

In database access routines, the comment is generated whenever the reference field is output. Therefore, you should not use the addition FOR TABLE with this 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.

This code displays a 20-byte long comment followed by the parameter at the normal position ( POS_LOW ) on the same line. If the user presses F1 for both objects, the documentation of SAPLANE-PLANETYPE is displayed.

Addition 3

... MODIF ID mod

Effect

See variant 4 ( SELECTION-SCREEN ULINE )

Addition 4

... ID id

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Variant 7

SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.

Additions

1. ... FOR TABLE dbtab

2. ... MODIF ID mod

3. ... ID id

Effect

Generates a pushbutton on the selection screen. Also specified is the user command ucom (without quotation marks) which can be up to 4 characters long. This is generated when the user presses the button. Apart from this, the syntax is largely similar to that of SELECTION-SCREEN COMMENT :

For the name name , there are two options:

name takes the form TEXT-xxx where xxx is a three-character name for a text symbol. In this case, the contents of the text symbol are displayed at runtime, i.e. the text cannot be changed dynamically. name is another eight-character name. Here, you create a field with the name name in the length specified in the format fmt< /> and it is then generated as an output field on the selection screen. The contents of these comments must therefore be set at runtime (e.g. at INITIALIZATION or - in the case of comments in the database include program DBldbSEL - in the routine INIT of the database program SAPDBldb . They can also be changed when the selection screen is being processed.

Note

The field name is generated automatically and so cannot be defined with DATA .

With pushbuttons, you must always specify a format fmt (see variant ULINE ).

Note

You must program a new line yourself via the format fmt .

The best way to respond to the user pressing the pushbutton is in the event AT SELECTION-SCREEN or - in the case of pushbuttons in the database include program DBldbSEL - in the routine PAI (with FNAME = '*' and MARK = SPACE ) in the database program SAPDBldb . Here, the field SSCRFIELDS-UCOMM contains the user command ucom (the table SSCRFIELDS must be declared with the TABLES statement).

Addition 1

... FOR TABLE dbtab

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Addition 2

... MODIF ID mod

Effect

See variant 4 ( SELECTION-SCREEN ULINE )

Addition 3

... ID id

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

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.

The selection screen displays a pushbutton with the text 'My text' . With AT SELECTION-SCREEN , the field SSCRFIELDS-UCOMM contains ABCD after the user has pressed the button.

Variant 8

SELECTION-SCREEN BEGIN OF BLOCK block.

Additions

1. ... WITH FRAME

2. ... TITLE title

3. ... NO INTERVALS

Effect

Starts a logical block on the selection screen. If you use the addition WITH FRAME , a frame is generated around the block. The addition TITLE title is allowed only in conjunction with WITH FRAME .

For the title title ,there are two options (see also the variants COMMENT and PUSHBUTTON 😞

title takes the form TEXT-xxx where xxx is a three-character name for a text symbol. In this case, the contents of the text symbol are displayed at runtime, i.e. the text cannot be changed dynamically. title is another eight-character name. Here, you create a field with the name title in the length specified in the format fmt< /> and it is then generated as an output field on the selection screen. The contents of these comments must therefore be set at runtime (e.g. at INITIALIZATION or - in the case of comments in the database include program DBldbSEL - in the routine INIT of the database program SAPDBldb . They can also be changed when the selection screen is being processed.

Note

The field title is generated automatically and so cannot be defined with DATA .

At runtime, the event AT SELECTION-SCREEN ON BLOCK block is executed for every block in the PAI module of the selection screen (with database- specific blocks, the PAI module in the program SAPDBldb is also executed with the parameters FNAME = BLOCK_block and MARK = SPACE ). If this produces an error message, just the fields of this block are ready for input.

You can nest blocks. The maximum nesting depth for blocks with frames is 5.

Addition 3

... NO INTERVALS

Effect

Displays all SELECT-OPTIONS within the block in simplified form without a 'to' field on the selection screen (like the addition " NO INTERVALS " with SELECT-OPTIONS ). If the block has a frame, this is correspondingly small.

Note

In the case of blocks without frames, the attribute " NO INTERVALS " is not inherited by subordinate blocks. However, all subordinate blocks of blocks with frames inherit this attribute because the generated frame is smaller and there is no space for the 'to' field.

Variant 9

SELECTION-SCREEN END OF BLOCK block.

Effect

Closes the block opened by SELECTION-SCREEN BEGIN OF BLOCK block . If the block has a frame, the frame is closed here. Blocks opened in the include program DBldbSEL must also be closed there.

Note

Blocks defined in the database include program DBldbSEL must also be close there. As with SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE , you cannot use the addition FOR TABLE with blocks. Instead, the objects in the blocks (selection options , parameters , comments, underscores ...) are omitted if the table to which they belong is not used in the report (see note under variant SELECTION-SCREEN SKIP ). Empty blocks (possibly with frames) are also omitted.

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.

(Let TEXT-001 contain 'Block Charly' ).

Selection screen:

Block Charly--

-


PARM _____

| SEL ________ bis ________ |

-

-


Variant 10

SELECTION-SCREEN FUNCTION KEY n.

Additions

1. ... FOR TABLE dbtab

2. ... ID id

Effect

With this variant, you can activate up to 5 function keys in the application toolbar on the selection screen ( n is one of the numbers 1 to 5).

At runtime, the text must be placed in the Dictionary field SSCRFIELDS-FUNCTXT_01 or ... SSCRFIELDS-FUNCTXT_05 .

The function code placed in the field SSCRFIELDS-UCOMM is 'FC01' or ... 'FC05' . You can read this function code under AT SELECTION-SCREEN or in the PAI module of the database access program SAPDBldb .

Addition 1

... FOR TABLE dbtab

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Addition 2

... ID id

Effect

See variant 3 ( SELECTION-SCREEN SKIP )

Example

TABLES SSCRFIELDS.

...

SELECTION-SCREEN FUNCTION KEY 1.

...

INITIALIZATION.

MOVE 'My text' TO SSCRFIELDS-FUNCTXT_01.

...

AT SELECTION-SCREEN.

IF SSCRFIELDS-UCOMM = 'FC01'.

...

ENDIF.

The selection screen displays a pushbutton with the text 'My text' . With AT SELECTION-SCREEN , the field SSCRFIELDS-UCOMM contains FC01 after the user has pressed the button.

Variant 11

SELECTION-SCREEN BEGIN OF VERSION ver TEXT-xxx.

Variant 12

SELECTION-SCREEN END OF VERSION ver.

Variant 13

SELECTION-SCREEN EXCLUDE ... .

Effect

Defines a selection screen version (with a three-character name ver ). These variants are only allowed in the database include program DBldbSEL . Between BEGIN OF VERSION and END OF VERSION , you can exclude selection screen objects for the version ver , i.e. remove them from the selection screen with SELECTION-SCREEN EXCLUDE. .

For a report, you activate a selection screen by making an entry in the attributes. If the database access program SAPDBldb itself has a selection screen version in the attributen, this applies for all reports which use this logical database and have attributes where no separate selection screen version is declared.

The text symbol TEXT -xxx is used merely to facilitate selection of a selection screen version via F4 help when maintaining the attributes.

Additions

(to SELECTION-SCREEN EXCLUDE )

1. ... PARAMETERS par

2. ... SELECT-OPTIONS sel

3. ... RADIOBUTTON GROUPS radi

4. ... BLOCKS block

5. ... IDS id

Effect

Excludes selection screen objects between SELECTION-SCREEN BEGIN and END OF VERSION . This allows you to exclude individual parameters or selection options , radiobutton groups , blocks defined by SELECTION-SCREEN BEGIN/END OF BLOCK and other objects such as comments and underscores specified by the addition ID id .

Note

The database program SAPDBldb can get the active version for the current report with the function module RS_SELSCREEN_VERSION .

Example

PARAMETERS PAR_1 LIKE dbfield_1 FOR TABLE dbtab_1.

SELECT-OPTIONS SEL_1 FOR dbfield_01.

SELECT-OPTIONS SEL_2 FOR dbfield_02.

SELECT-OPTIONS SEL_3 FOR dbfield_03.

SELECTION-SCREEN COMMENT /10(20) TEXT-100 FOR TABLE dbtab_1 ID 001.

SELECTION-SCREEN COMMENT /8(30) TEXT-200 FOR TABLE dbtab_2 ID 002.

PARAMETERS PAR_2 LIKE dbfield_1 FOR TABLE dbtab_2.

PARAMETERS PAR_3 LIKE dbfield_1 FOR TABLE dbtab_2.

...

SELECTION-SCREEN BEGIN OF VERSION ABC TEXT-008.

SELECTION-SCREEN EXCLUDE PARAMETERS: PAR_1, PAR_3.

SELECTION-SCREEN EXCLUDE SELECT-OPTIONS: SEL_2.

SELECTION-SCREEN EXCLUDE IDS: 001.

SELECTION-SCREEN END OF VERSION ABC.

If the report attributes (or the attributes of the database program SAPDBldb ) contain the selection screen version ABC , the parameters PAR_1 and PAR_3 , the selection option SEL_2 and the comment with the text number 100 ( ID 001 ) are not displayed on the selection screen. When you maintain the attributes, the text symbol 008 of SAPDBldb is displayed if you press F4 on the field 'Selection screen version'.

Variant 14

SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab.

Addition

... ID id

Effect

This variant is allowed only in the database include program DBldbSEL . It informs you for which logical database tables additional selections are supported. If one of these tables is active in the report (i.e. it is declared under TABLES or lies somewhere on the path from the root of the database hierarchy to a table declared with TABLES ), a psuhbutton called 'Dynamic selections' appears on the selection screen. On pressing this button, the user branches to a dialog Taste where it is possible to enter selections for the fields of the relevant tables in the logical database. You can define the field list in two different ways:

Via a selection view defined for the purpose:

You can maintain selection views within the logical database maintenance transaction. They consist of a set of fields from logical database tables which are divided into groups. It is also possible to preselect fields. Customers can overlay these selection views with their own (i.e. in this case, the system searches first for the customer selection view and only accesses the SAP selektion view if no customer-specific view exists).

If a preselection has already been made in the selection view, the user immediately sees the selection screen for the preselected fields and can enter selections. Otherwise, a fields must be selected first.

Via all fields of all tables

In this case, the user must first choose the tables and then select the fields for which additional selections are to be made before branching to the selection screen to enter the dynamic selections.

The database access programm SAPDBldb then receives the WHERE clauses generated from the user entries in the form of a complex data object DYN_SEL .

Addition

... ID id

Effect

Similar to the addition 2 ( SKIP ). This allows you to exclude tables from the possibility of dynamic selection via the selection screen versions.

Note

The exact definition of the object DYN_SEL is stored in the TYPE-POOL RSDS and is as follows:

TYPES: BEGIN OF RSDS_WHERE,

TABLENAME LIKE RSDSTABS-PRIM_TAB,

WHERE_TAB LIKE RSDSWHERE OCCURS 5,

END OF RSDS_WHERE.

...

TYPES: BEGIN OF RSDS_TYPE,

CLAUSES TYPE RSDS_WHERE OCCURS 5,

TEXPR TYPE RSDS_TEXPR,

TRANGE TYPE RSDS_TRANGE,

END OF RSDS_TYPE.

DATA DYN_SEL TYPE RSDS_TYPE.

The object DYN_SEL thus contains a component ( CLAUSES ) which is an internal table. Each line of this internal table contains a table name ( TABLENAME ) and another table ( WHERE_TAB ) which contains the WHERE clauses for the table ( TABLENAME ).

You can find the structure of the other components in the type pool RSDS .

TEXPR contains the selections in a format which allows storage and can be used for the "freely callable" function modules when entering dynamic selections ( FREE_SELECTIONS_INIT , FREE_SELECTIONS_DIALOG ). TRANGE contains the selections in the form of RANGES tables which can be used with the IN operator in SELECT , CHECK and IF .

Note

Neither the TYPE-POOL RSDS nor the declaration of DYN_SEL must appear in the database program. Both are automatically included by the system.

In the database program SAPDBldb , an access to a table XXXX could look something like below:

FORM PUT_XXXX.

DATA L_DS_CLAUSES TYPE RSDS_WHERE.

MOVE 'XXXX' TO L_DS_CLAUSES-TABLENAME.

READ TABLE DYN_SEL-CLAUSES WITH KEY L_DS_CLAUSES-TABLENAME

INTO L_DS_CLAUSES.

SELECT * FROM XXXX

WHERE field1 IN ...

AND field2 ....

...

AND (L_DS_CLAUSES-WHERE_TAB).

PUT XXXX.

ENDSELECT.

ENDFORM.

Note

If the table L_DS_CLAUSES-WHERE_TAB is empty, i.e. if no dynamic selections are entered for the table XXXX , the addition ... AND (L_DS_CLAUSES-WHERE_TAB) is ignored during the SELECT .

Variant 15

SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab.

Addition

... ID id

Effect

This variant is allowed only in the database include program DBldbSEL . It informs you for which logical database tables field selection is supported.

For these tables, you can fill just those database fields which the report actually needs. In the report, you determine these fields with GET dbtab FIELDS f1 ... fn or GET dbtab LATE FIELDS f1 ... fn (the field list is then supplemented by the key fields of the table dbtab ).

By restricting to the really necessary field, you considerably improve performance. The database access program SAPDBldb receives the desired fields for the dynamic field selection in the form of an internal table SELECT_FIELDS .

Note

The exact definition of the object SELECT_FIELDS is stored in the TYPE-POOL RSFS and looks something like below:

TYPES: BEGIN OF RSFS_TAB_FIELDS,

TABLENAME LIKE RSDSTABS-PRIM_TAB,

FIELDS LIKE RSFS_STRUC OCCURS 10,

END OF RSFS_TAB_FIELDS.

...

TYPES: RSFS_FIELDS TYPE RSFS_TAB_FIELDS OCCURS 10.

DATA SELECT_FIELDS TYPE RSFS_FIELDS.

SELECT_FIELDS is thus an internal table. Each line of this internal table contains a table name ( TABLENAME ) and another internal table ( FIELDS ) which contains the desired fields of the table ( TABLENAME ).

Note

Neither the TYPE-POOL RSFS nor the declaration of SELECT_FIELDS has to appear in the database program. Both are automatically included by the system. Unlike the objects connected with the addition DYNAMIC SELECTIONS , SELECT_FIELDS is also available in the report.

In the database program SAPDBldb , an access to a table XXXX could look something like below:

FORM PUT_XXXX.

DATA L_TAB_FIELDS TYPE RSFS_TAB_FIELDS.

MOVE 'XXXX' TO L_TAB_FIELDS-TABLENAME.

READ TABLE SELECT_FIELDS WITH KEY L_TAB_FIELDS-TABLENAME

INTO L_TAB_FIELDS.

SELECT (L_TAB_FIELDS-FIELDS)

INTO CORRESPONDING FIELDS OF XXXX

FROM XXXX

WHERE field1 IN ...

AND field2 ....

...

PUT XXXX.

ENDSELECT.

ENDFORM.

Note

If the table L_TAB_FIEDLS is empty, i.e. if no dynamic selections are entered for the table XXXX , SELECT (L_TAB_FIELDS) ... works like SELECT * ... , i.e. all fields of the table XXXX are filled.

The internal table SELECT_FIELDS already contains values when the routine INIT is executed in the database program or when the INITIALIZATION processing is executed in the report. It can be manipulated by the appropriate program if it is absolutely necessary to fill another field for the logical database.

Reward If Helpful.

Regards

-

-


Sasi.

Former Member
0 Kudos

SCENARIOS ARE SIMPLE.

whenever we make any report we go for selection-screen.in any custom reports we go for selection screen.

in very rare condition we go for making custom table. we compare our required fields and try to find out in the database. if available its fine if not we go for a custom table.we basically update these tables using BAPI.

standard tables we always use. these are the backbone of abap. all the values are stored here and we need to fetch it whenevr we require it.

REWARD ME IF HELPFUL WITH GOOD POINTS.