You can add a button in your application configuration, and use the reuse event GC_EVENT_DISPLAY
(HRGRT_DISPLAY
in the configuration).
Recommendation
SAP recommends to use the generic event HRGRT_DISPLAY
but if you need an own event that is very distinct from the idea of producing a form, see Add Own Button.
At GET_DEFINITION
you must call the super method EXPOSE_ACTION_DISPLAY_OUTPUT
to expose the event to the configuration for you.
Then all you need to do is create a button in your application configuration and assign event HRGRT_DISPLAY
to the button in the configuration, and in your code at GET_DATA
react to the event by producing the form.
Add the following code (or similar) to your method GET_DEFINITION
:
Syntax
expose_action_display_output( changing ct_action_definition = et_action_definition ).
Choose Content Area
: MAIN_SCREEN
in the hierarchy on the left.
Choose Add Toolbar Element
followed by menu point to content area
.
A dialog box is displayed.
In this dialog box, choose Button
(without pressing OK
).
In the field Text, enter the text for your button, for instance Calculate
.
In the FPM Event ID
field, enter the name of the event HRGRT_DISPLAY
.
Choose Save
.
Add the following code (or similar) to your method GET_DATA
:
Syntax
case io_event->mv_event_id.
when gc_event_display.
<your handling of event, e.g take results of input, generate output>
when others.
endcase.
Activate your feeder class, place an external
break point at this point in the code and test your application: Use the link at the top of this window to go to the application configuration and choose Test
. Choose your new
button and the debugger should stop at your code.