Show TOC

Procedure documentationAdd Own Button

 

Adding your own button is slightly more effort, but there may be situations where you need further application-specific buttons, or your button cannot really be described as Display.

Procedure

  1. Go to your OVP component configuration in change mode.

  2. In your feeder class, create a global constant GC_EVENT_RESET_DEFAULTS (type STRING) and give it the initial value RESET_DEFAULTS.

    To make this available to use in the configuration (but it works without this step) you can declare your event (also known as actions) in your method GET_DEFINITION:

    Syntax Syntax

    1. 	DATA ls_action           TYPE fpmgb_s_actiondef.
    2. * supply actions as available for configuration
    3. * Button 'Reset Defaults'
    4. 	ls_action-id        = GC_EVENT_ RESET_DEFAULTS.
    5. 	ls_action-text      = text-e01.
    6. 	ls_action-enabled   = abap_true.
    7. 	ls_action-exposable = abap_true.
    8. 	APPEND ls_action TO et_action_definition.
    End of the code.
  3. Choose Content Area: MAIN_SCREEN in the hierarchy on the left.

  4. Choose Add Toolbar Element followed by menu point to content area.

    A dialog box is displayed.

  5. In this dialog box, choose Button (don't press OK instead).

  6. In the field Text, enter the text for your button, for example, Reset Defaults.

  7. In filed FPM Event ID, enter the name of the event you will program for the event in your feeder class, for example RESET_DEFAULTS.

  8. Choose Save.

  9. Add the following code (or similar) to your method GET_DATA:

    Syntax Syntax

    1. case io_event->mv_event_id.
    2. 	when  gc_event_reset_defaults.
    3. 		<your handling of event, e.g retrieve default values>
    4. 	when others.
    5. 		endcase.
    End of the code.
  10. 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 the same screen to go to the application configuration and choose Test. Choose your new button and the debugger should stop at your code.