I created some dynamic select options. On my table, I want to have one parameter predefined and not changeable for the User . The not changeable I made with a callback form on the event:
data: LS_EVENTS type RSDSEVENTS,
LT_EVENTS type standard table of RSDSEVENTS.
LS_EVENTS-EVENT = 'O'. "at selection screen output §§§
LS_EVENTS-PROG = SY-REPID.
LS_EVENTS-FORM = 'AT_SELECTION_SCREEN_OUT'.
append LS_EVENTS to LT_EVENTS.
call function 'FREE_SELECTIONS_INIT'
exporting
KIND = 'F' "
importing
SELECTION_ID = GV_SELECTION_ID
tables
TABLES_TAB = GT_TABLE
FIELDS_TAB = GT_FIELDSTAB
EVENTS = LT_EVENTS
exceptions
...
others = 20.
Now the callback form looks like this:
form AT_SELECTION_SCREEN_OUT tables
LT_RSSELDYN "selections
LT_RSFLDNUM. "dynpro info
field-symbols <FS_LINE> type ANY.
field-symbols <FS_FIELD> type ANY.
read table LT_RSFLDNUM assigning <FS_LINE> with key
('TABLENAME') = 'MyTab' ('FIELDNAME') = 'MyField' .
if <FS_LINE> is assigned.
assign component 'GROUP1' of structure <FS_LINE> to <FS_FIELD>.
if <FS_FIELD> is assigned. "Group1 ausgelesen
loop at screen.
if SCREEN-GROUP1 = <FS_FIELD>.
"Eingabe deaktiviert
SCREEN-INPUT = '0'.
"Ausblenden unnötiger Felder
if SCREEN-GROUP3 = 'TOT'
or SCREEN-GROUP3 = 'HGH'
or SCREEN-GROUP3 = 'VPU'.
SCREEN-INVISIBLE = 1.
endif.
modify screen."änderungen auf Screen speichern
endif.
endloop.
endif.
endif.
unassign: <FS_FIELD>, <FS_LINE>.
That works. It sets the right values unchangable. In the first table, as the documentation says, the current values are saved. But if I change them, that does not work.
read table LT_RSSELDYN assigning <FS_LINE> with key
('TABLENAME') = 'MyTab' ('FIELDNAME') = 'MyField' .
if <FS_LINE> is assigned.
"<>-low = 'MyValue', <>-sign = 'I', <>-option = 'EQ'
assign component 'LOW' of structure <FS_LINE> to <FS_FIELD>.
if <FS_FIELD> is assigned.
<FS_FIELD> = 'MyValue'.
endif.
unassign <FS_FIELD>.
assign component 'SIGN' of structure <FS_LINE> to <FS_FIELD>.
if <FS_FIELD> is assigned.
<FS_FIELD> = 'I'.
endif.
unassign <FS_FIELD>.
assign component 'OPTION' of structure <FS_LINE> to <FS_FIELD>.
if <FS_FIELD> is assigned.
<FS_FIELD> = 'EQ'.
endif.
unassign <FS_FIELD>.
endif.
unassign: <FS_FIELD>, <FS_LINE>.
endform.
Is there a possibility to restrict the change of those values? I just want them displayed in the Selectoptions if they are there.
As an option you can hide the fields you don't want to be changed by user and fill expressions and where tab manually afterwads. For this tabfields_not_display
parameter exists.
DATA: table TYPE string,
ev_expressions TYPE rsds_texpr,
ev_field_ranges TYPE rsds_trange,
ev_number_of_active_fields LIKE sy-tfill,
lt_field_tab TYPE TABLE OF rsdsfields,
lt_tabfields_not_display TYPE TABLE OF rsdsfields.
DATA: table_tab TYPE TABLE OF rsdstabs,
selid TYPE rsdynsel-selid,
cond_tab TYPE rsds_twhere.
table = 'USR02'.
table_tab = VALUE #( ( prim_tab = table ) ).
APPEND VALUE rsdsfields( tablename = 'USR02' fieldname = 'BNAME' ) TO lt_tabfields_not_display.
APPEND VALUE rsdsfields( tablename = 'USR02' fieldname = 'GLTGV' ) TO lt_tabfields_not_display.
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
kind = 'T'
IMPORTING
selection_id = selid
TABLES
tables_tab = table_tab
tabfields_not_display = lt_tabfields_not_display
EXCEPTIONS
OTHERS = 4.
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = selid
title = 'Free Selection'
as_window = ' '
IMPORTING
where_clauses = cond_tab
expressions = ev_expressions
field_ranges = ev_field_ranges
number_of_active_fields = ev_number_of_active_fields
TABLES
fields_tab = lt_field_tab
EXCEPTIONS
OTHERS = 4.
APPEND VALUE rsds_expr( tablename = table
expr_tab = VALUE rsds_expr_tab(
( logop = 'AND' arity = '2' )
( arity = '0' fieldname = 'BNAME' option = 'EQ' low = 'my_user' )
( arity = '0' fieldname = 'GLTGV' option = 'EQ' low = '20190503' ) )
) TO ev_expressions.
APPEND VALUE rsds_where( tablename = table
where_tab = VALUE rsds_where_tab(
( line = ` ( BNAME EQ 'my_user' ) ` )
( line = ` AND ( GLTGV EQ '20190503' ) ` ) )
) TO cond_tab.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.