[英]How to change values on events of FM 'FREE_SELECTIONS_INIT'
I created some dynamic select options.我创建了一些动态选择选项。 On my table, I want to have one parameter predefined and not changeable for the User .在我的桌子上,我希望有一个预定义且不可更改的参数 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.如果它们在那里,我只希望它们显示在 Selectoptions 中。
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.对于此tabfields_not_display
参数存在。
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.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.