This is very similar to the toggling in a List UIBB, but is intended for the value list of a drop down field in a Form UIBB. You should use these standard HR reporting events (see super class attributes in AC_HRGRT_REPORTING_FROM_FEEDER
), and call the super class
method HANDLE_PREV_NEXT_VALUE_EVENT
, each time passing the appropriate event and the value list. This method ensures that the correct entry in your value list is visually ‘selected’ on the UI, based on whether the user has selected previous
or next
.
Example
In this code example for handling previous and next buttons/ events, there is one field in a form GUIBB that contains the year. This allows the user to toggle through year entries in that one field, just using the previous and next buttons:
Syntax
field-symbols:
<ls_report_data> type hrxss_report_data,
<ls_field_usage> type fpmgb_s_fieldusage,
<lv_year> type any.
assign cs_data to <ls_report_data> casting.
case io_event->mv_event_id.
when gc_event_next_value "buttons pressed
or gc_event_prev_value.
read table ct_field_usage assigning <ls_field_usage>
with key name = 'YEAR'. "#EC WARNOK
if sy-subrc eq 0.
* get next/previous value relative to actual value
* before: field <ls_report_data>-year contains actual value
lv_year = <ls_report_data>-year.
* after: field <ls_report_data>-year contains prev/next value -> new
actual value
me->handle_prev_next_value_event(
exporting
iv_eventid = io_event
it_value_list = <ls_field_usage>-fixed_values
changing
* ct_messages = ct_messages
cv_value = <ls_report_data>-year
).
if lv_year ne <ls_report_data>-year. "year have been changed!
lv_form = abap_true.
ev_data_changed = abap_true.
endif.
endif.
endcase.