Вы находитесь на странице: 1из 5

ABAP STATMENTS FOR DEFINING THE SELECTION SCREENS

1>parameters
2>select-options
3>selection-screen
the standard selection screen of the executable program is predefined and has sc
reen number 1000.
parameters are used for simple queries of single value only.
syntax for parameters
parameter <name>[length] type <type>| like <variable> [decimal <no>].
if the parameter refers to data types from the dictionary, it adopts all the att
ributes of the dictionary field.
parameters can only refer to the fields of database tables views and structures
.
F1 = field help
F4 = possible entries help
parameters p_bukrs type bukrs obligatory.
when obligatory is defined with the parameters for particular field , the user c
annot contine with the program without entering a value in this field on the sel
ection-screen.
parameter <name> type <data type> value check.
parameters p_bukrs like knb1-bukrs obligatory value check.
the user can only enter the company code that are in t001.
the possible entries help of the input field for p_bukrs display the allowed val
ues.
paramater <name> as checkbox.
defining the radiobuttons.
parameter <name>(1) type c
parameter <name> radiobutton group <g1>.
parameter <name> is created with type C and length 1, and assigned to group <g1>
.
each radiobutton group has atleast 2 radionuttons and by default the first radio
button from the group is selected.
the value of the selected checkbox or radiobutton is 'X' and to deselect is 'SPA
CE'.
select-options:
range of input
4 components of select-options
low =lower value
high = higher value
sign = I -> inclusive and E ->exclusive
option = these are possible operations
-if high is empty you can use EQ,NE,GT,LE,LT,CP,NP
-if high is filled you can use BT(between) NB(not between)

syntaxselect-options <name> for <variable>.


providing default values.
data : v_bukrs type bukrs.
select-options : s_bukrs for v_bukrs default '1000' to '5000'
option BT sign I.
restricting entry to one row
select-options : s_kunnr for v_kunnr NO-EXTENSION.
resticting entry to single field
select-options : s_kunnr for v_kunnr NO INTERVALS.
EX:
data : v_bukrs type bukrs,
v_kunnr type kunnr,
v_lifnr type lifnr.
select-options B_bukrs for v_bukrs
default '1000' to '5000'
option BT sign I.
select-options s_kunnr for v_kunnr NO-EXTENSION
select-options s_lifnr for V_lifnr NO INTERVALs
formating the selection screen
the selection screens that you define when you use the PARAMETERS or SELECT-OPTI
ONS statments on their own has a standard layout in which all parameters apper l
ine by line.
this type of layout may not be always sufficent.
SELECTION-SCREEN statment has its own formating option that you can use to defin
e the layout of the parameter and selection criteria and display comments and un
derline on the screen .
selection-screen skip [<1>].
value can range from 1 to 9.
to place an underline on the selection screen
selection-screen uline [[/]<pos(length)>].
comments:
selection-screen comment [[/]<pos(length)> <comment here> {for field <f1>}].
the statment writes the comment on the selection screen.
{for field <f1>} to assign a field label to the comment .
<f> can be the name of the parameter or select-option.
BLOCKS of ELEMENTS.
SELECTION-SCREEN BEGIN OF BLOCK <BLOCK> [WITH FRAME [] TITLE <title>].
----selection-screen end of block <block>.

TRY TO EXECUTE THE PROGRAM BELOW AND UNDERSTAND.


---------------------------------------REPORT ZDEMO1.
TYPES : BEGIN OF ty_mara ,
matnr type matnr,
mtart TYPE mtart,
END OF ty_mara.
DATA : wa_mara TYPE ty_mara,
it_mara TYPE TABLE OF ty_mara.
data : v_matnr TYPE matnr ,
v_mtart TYPE mtart.
SELECTION-SCREEN BEGIN OF BLOCK b1 with FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr for v_matnr . " MATERIAL NUMBER
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETER : rb_raw RADIOBUTTON GROUP g1, " RAW
rb_sfin RADIOBUTTON GROUP g1, " SEMI FINISHED
rb_fin RADIOBUTTON GROUP g1, " FINISHED
rb_samp RADIOBUTTON GROUP g1. " SAMPLE
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER : cb_disp as CHECKBOX ,
cb_file as CHECKBOX .
SELECTION-SCREEN END OF BLOCK b3.
if rb_raw = 'X'.
v_mtart = 'ROH'.
ELSEIF rb_sfin = 'X'.
v_mtart = 'FERT'.
ELSEIF rb_fin = 'X'.
v_mtart = 'FERT'.
ELSEIF rb_samp = 'X'.
v_mtart = 'AEM'.
ENDIF.
SELECT matnr mtart INTO TABLE it_mara
FROM mara
WHERE matnr IN s_matnr.

if cb_disp = 'X'.
WRITE : / 'material no', 20 'material type'.
ULINE.
loop at it_mara INTO wa_mara.
WRITE : / wa_mara-matnr , 20 wa_mara-mtart .
ENDLOOP.
ELSEIF cb_file = 'X'.

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

CALL FUNCTION 'GUI_DOWNLOAD'


EXPORTING
BIN_FILESIZE
filename
FILETYPE
APPEND
WRITE_FIELD_SEPARATOR
HEADER
TRUNC_TRAILING_BLANKS
WRITE_LF
COL_SELECT
COL_SELECT_MASK
DAT_MODE
CONFIRM_OVERWRITE
NO_AUTH_CHECK
CODEPAGE
IGNORE_CERR
REPLACEMENT
WRITE_BOM
TRUNC_TRAILING_BLANKS_EOL
WK1_N_FORMAT
WK1_N_SIZE
WK1_T_FORMAT
WK1_T_SIZE
IMPORTING
FILELENGTH
tables
data_tab
FIELDNAMES
EXCEPTIONS
FILE_WRITE_ERROR
NO_BATCH
GUI_REFUSE_FILETRANSFER
INVALID_TYPE
NO_AUTHORITY
UNKNOWN_ERROR
HEADER_NOT_ALLOWED
SEPARATOR_NOT_ALLOWED
FILESIZE_NOT_ALLOWED
HEADER_TOO_LONG
DP_ERROR_CREATE
DP_ERROR_SEND
DP_ERROR_WRITE
UNKNOWN_DP_ERROR
ACCESS_DENIED
DP_OUT_OF_MEMORY
DISK_FULL

=
= 'D:\material.txt'
= 'ASC'
= ' '
= 'X'
= '00'
= ' '
= 'X'
= ' '
= ' '
= ' '
= ' '
= ' '
= ' '
= ABAP_TRUE
= '#'
= ' '
= 'X'
= ' '
= ' '
= ' '
= ' '
=
= it_mara
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

*
*
*
*
*

DP_TIMEOUT
= 18
FILE_NOT_FOUND
= 19
DATAPROVIDER_EXCEPTION
= 20
CONTROL_FLUSH_ERROR
= 21
OTHERS
= 22
.
IF sy-subrc = 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE 'download successfull' TYPE 'I'.
ENDIF.
ENDIF.