Show TOC

Procedure documentationAdd Generic Button

 

You can add a button in your application configuration, and use the reuse event GC_EVENT_DISPLAY (HRGRT_DISPLAY in the configuration).

Recommendation 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.

End of the recommendation.

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.

Procedure

  1. Add the following code (or similar) to your method GET_DEFINITION:

    Syntax Syntax

    1. expose_action_display_output( changing ct_action_definition = et_action_definition  ).
    End of the code.
  2. Choose Content Area: MAIN_SCREEN in the hierarchy on the left.

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

    A dialog box is displayed.

  4. In this dialog box, choose Button (without pressing OK).

  5. In the field Text, enter the text for your button, for instance Calculate.

  6. In the FPM Event ID field, enter the name of the event HRGRT_DISPLAY.

  7. Choose Save.

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

    Syntax Syntax

    1. case io_event->mv_event_id.
    2. 	when  gc_event_display.
    3. 		<your handling of event, e.g take results of input, generate output>
    4. 	when others.
    5. endcase.
    End of the code.
  9. 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.