0% found this document useful (0 votes)
39 views8 pages

Selection Screen

The document describes how to create a dropdown list on an ABAP selection screen and populate it with values. It defines a form that builds a table of values from text elements and sets those values on the dropdown parameter using a function module. This allows dynamically setting options for a selection screen parameter.

Uploaded by

Stefan Fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views8 pages

Selection Screen

The document describes how to create a dropdown list on an ABAP selection screen and populate it with values. It defines a form that builds a table of values from text elements and sets those values on the dropdown parameter using a function module. This allows dynamically setting options for a selection screen parameter.

Uploaded by

Stefan Fernando
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Selection Screen - Drop Down List

PARAMETERS:p_notice TYPE c LENGTH 16 AS LISTBOX VISIBLE LENGTH 16


DEFAULT '1'
OBLIGATORY.

*&---------------------------------------------------------------------*
*& Form PF_SET_LISTBOX
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM pf_set_listbox .
DATA: lt_list_val TYPE vrm_values,

ls_list_val LIKE LINE OF lt_list_val.

ls_list_val-key = '1'.
ls_list_val-text = text-l01.
APPEND ls_list_val TO lt_list_val.
ls_list_val-key = '2'.
ls_list_val-text = text-l02.
APPEND ls_list_val TO lt_list_val.
ls_list_val-key = '3'.
ls_list_val-text = text-l03.
APPEND ls_list_val TO lt_list_val.
ls_list_val-key = '4'.
ls_list_val-text = text-l04.
APPEND ls_list_val TO lt_list_val.

IF lt_list_val IS NOT INITIAL.


CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_NOTICE'
values = lt_list_val
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc IS INITIAL.

ENDIF.
ENDIF.
ENDFORM.

Selection screen - month and year

PARAMETERS: p_spbup TYPE spbup DEFAULT sy-datum.


Button Maintain SM30

Logic Program:
CONSTANTS:
c_ucomm_maintain TYPE sy-ucomm VALUE '&MAINTAIN'.

INITIALIZATION.
SET PF-STATUS 'Z_SELSCR_STATBAR'.

AT SELECTION-SCREEN.
IF sy-ucomm EQ c_ucomm_maintain.
CALL TRANSACTION 'ZHR_IT19_NOTIF'.
ENDIF.

Modify Screen using PF Status


INITIALIZATION.
SET PF-STATUS 'Z_MAIN_STATUS'.

Add Button in toolbar selection Screen


https://acarahmet.medium.com/sap-abap-add-toolbar-button-with-icon-on-selection-screen-
16b834f6369

Selection Screen LowerCase/Casensitive Parameter


Use the addition LOWER CASE with the parameter statement.

PARAMETERS: p_path TYPE string DEFAULT '/itf/hrsap/' LOWER CASE.

Modif selection screen based on radio buton selected

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t04.


PARAMETERS: rb_sk RADIOBUTTON GROUP rb1 DEFAULT 'X' USER-COMMAND rb,
rb_oth RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-t03 MODIF ID sk.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-t05 MODIF ID oth.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.

Code above for this notes

LOOP AT SCREEN.

CASE abap_true.
WHEN rb_sk.
IF screen-group1 EQ 'SK'.
screen-active = fiehc_con_on.
ELSEIF screen-group1 IS NOT INITIAL.
screen-active = fiehc_con_off.
ENDIF.
WHEN rb_oth.
IF screen-group1 EQ 'OTH'.
screen-active = fiehc_con_on.
ELSEIF screen-group1 IS NOT INITIAL.
screen-active = fiehc_con_off.
ENDIF.

WHEN OTHERS.
"Do Nothing
ENDCASE.

MODIFY SCREEN
ENDLOOP.

Selection Screen Output


Pada screen, apabila ingin menghide atau menampilkan field, dapat disetting pada 'AT SELECTION-
SCREEN OUTPUT'.

Selection Screen Validation


Cek apakah field sudah diisi
Pada bagian start of selection, cek field sudah ada isi atau belum, jika tidak diisi, maka berikan message
dengan type 'S', dan display as 'E' kemudian leave to list processing. Maka error message akan muncul
pada selection screen.

Selection Screen Get Filename on F4


Pada selection screen, dapat diberikan function untuk mengambil directory file yang akan diupload
menggunakan FM 'KD_GET_FILENAME_ON_F4' pada 'AT SELECTION-SCREEN ON VALUE-
REQUEST FOR [nama field] '

Selection Screen Button


Simple generic popup selection screen for quick input or
output
*&---------------------------------------------------------------------*
*& Report YTESTSF15
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YTESTSF15.
start-of-selection.
perform main.
form main.
data: lv_bukrs type bukrs,
" select-options: type range of.. (must be dictionary type)
lrg_werks type ckf_werks_table,
" select-options: table, separate values
lt_werks TYPE plants ,
" checkbox + radiobutton ( must be DDIC types )
lv_simulate type xfeld,
lv_mode_open type xfeld,
lv_mode_close type xfeld,
lv_language TYPE spras.
lv_language = sy-langu.
" Generic screen call
cl_ci_query_attributes=>generic(
exporting
" unique screen ID
p_name = conv #( sy-repid )
" Screen title
p_title = 'Generic screen for input'
" Screen fields
p_attributes = value #(
" parameter field
( kind = 'S'
obligatory = abap_true
text = 'Company code'(001)
ref = ref #( lv_bukrs ) )
" select-option
( kind = 'S'
text = 'Plant'(002)
ref = ref #( lrg_werks ) )
" selec-option no intervals
( kind = 'T'
text = 'Additional plants'(008)
ref = ref #( lt_werks ) )
" Screen groupd
( kind = 'G'
text = 'Mode'(006)
ref = ref #( SY-INDEX ) )
" radiobuttons
( kind = 'R'
text = 'Open'(004)
button_group = 'MOD'
ref = ref #( lv_mode_open ) )
( kind = 'R'
text = 'Close'(005)
button_group = 'MOD'
ref = ref #( lv_mode_close ) )
" checkbox field
( kind = 'C'
text = 'Simulate'(003)
ref = ref #( lv_simulate ) )
" listbox field
( kind = 'L'
text = 'Language'(007)
ref = ref #( lv_language ) )
) " Table of Attribute Entries
p_display = abap_false " General Flag
).

endform.

Help input with selection

DATA:
lt_return TYPE STANDARD TABLE OF ddshretval,
lr_equnr TYPE RANGE OF equi-equnr,
lw_equnr LIKE LINE OF lr_equnr.

LOOP AT s_equnr.
lw_equnr = 'IEQ'.
lw_equnr-low = s_equnr-low.
APPEND lw_equnr TO lr_equnr.
ENDLOOP.

cl_ci_query_attributes=>generic(
EXPORTING
" unique screen ID
p_name = CONV #( sy-repid )
" Screen title
p_title = 'Generic screen for input'
" Screen fields
p_attributes = VALUE #(
" select-option
( kind = 'S'
text = 'Equipment'
ref = REF #( lr_equnr ) )
)
p_display = abap_false " General Flag
).

BREAK developer04.

SELECT imptt~psort,
imptt~pttxt
INTO TABLE @DATA(lt_imptt)
FROM imptt
INNER JOIN equi
ON equi~objnr EQ imptt~mpobj
WHERE equnr IN @lr_equnr.

IF sy-subrc EQ 0.
##FM_SUBRC_OK
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'PSORT' " Name of field in VALUE_TAB
value_org = 'S' " Value return: C: cell by cell, S: stru
ctured
TABLES
value_tab = lt_imptt " Table of values: entries cell by cell
return_tab = lt_return " Return the selected value
EXCEPTIONS
parameter_error = 1 " Incorrect parameter
no_values_found = 2 " No values found
OTHERS = 3.

READ TABLE lt_return INTO DATA(ls_return) INDEX 1.


cv_value = ls_return-fieldval.

ENDIF.

Hide High Selection Screen


SELECT-OPTIONS: s_pernr FOR zhr_contr_comp-pernr no INTERVALS.

Hide Ranges Selection Screen


SELECT-OPTIONS: s_pernr FOR zhr_contr_comp-pernr no-EXTENSION.
Email on selection screen
SELECT-OPTIONS: s_rec FOR adr6-smtp_addr NO INTERVALS.

You might also like