Code Example for a FORM ImplementationThis is an example for a FORM implementation (the tables starting GT_*
are attributes of the class):
Syntax
METHOD if_fpm_guibb_form~get_definition.
DATA lo_guibb_definit TYPE REF TO cl_hress_fpm_guibb_services. DATA ls_fixed_values TYPE wdr_context_attr_value. DATA ls_action TYPE fpmgb_s_actiondef.
FIELD-SYMBOLS <ls_t516t> TYPE t516t. FIELD-SYMBOLS <ls_t5d2l> TYPE t5d2l. FIELD-SYMBOLS <ls_field_descr> TYPE fpmgb_s_formfield_descr.
**Step 1 ********************************************* call super method, because it is the done thing. super->if_fpm_guibb_form~get_definition( IMPORTING es_message = es_message eo_field_catalog = eo_field_catalog et_field_description = et_field_description et_action_definition = et_action_definition et_special_groups = et_special_groups ev_additional_error_info = ev_additional_error_info ).
**Step 2 ********************************************** Expose supermethod standard 'display' event to configurationexpose_action_display_output( changing ct_action_definition = et_action_definition ).* Action on Radio buttons Privat- or Freiwillig-/Gesetzlichversichert ls_action-id = GC_EVENT_RBHEALTH."'RBHEALTH'. ls_action-text = text-e02. ls_action-enabled = abap_true. ls_action-exposable = abap_true. APPEND ls_action TO et_action_definition.
**Step 3 *********************************************** Get field catalogue for Screen fields. (If a customer extends* structure HRESS_S_REP_DE_GHR for the screen parameters,* this method will automatically get the DDIC information for the* extended fields too. No modification necessary. ) CREATE OBJECT lo_guibb_definit. TRY. lo_guibb_definit->get_guibbf_definition_dstruc( EXPORTING iv_langu = sy-langu is_data = gs_screen_parameters IMPORTING eo_field_catalog = eo_field_catalog et_field_description = et_field_description ). CATCH cx_hress.* create a dump here ... MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDTRY.
**Step 4 ************************************************ Fill F4 values for ....* Religion SELECT * FROM t516t INTO TABLE gt_t516t WHERE sprsl = 'D'.
* Bundesland (State) SELECT * FROM t5d2l INTO TABLE gt_t5d2l.
* Insurance types for radio buttons CLEAR ls_in_type_values. ls_in_type_values-value = '01'. ls_in_type_values-text = text-v01." 'Freiwilling/Pflichtversichert' . APPEND ls_in_type_values TO gt_ins_type_values. ls_in_type_values-value = '02'. ls_in_type_values-text = text-v02."'Privatversichert' . APPEND ls_in_type_values TO gt_ins_type_values.
**Step 5 *********************************************** LOOP AT et_field_description ASSIGNING <ls_field_descr>. CASE <ls_field_descr>-name.* set currency for Gross Remuneration field WHEN 'BRUTT'. <ls_field_descr>-cq = 'C'. <ls_field_descr>-mandatory = abap_true. <ls_field_descr>-cq_ref = gv_currency. WHEN 'DATUM'. <ls_field_descr>-mandatory = abap_true.* set F4 helps* Church tax area WHEN 'KISTG'. LOOP AT gt_t5d2l ASSIGNING <ls_t5d2l>. CLEAR ls_fixed_values. ls_fixed_values-value = <ls_t5d2l>-brdld. ls_fixed_values-text = <ls_t5d2l>-ksttx. APPEND ls_fixed_values TO <ls_field_descr>-fixed_values. ENDLOOP.* Church tax WHEN 'KONFE'. LOOP AT gt_t516t ASSIGNING <ls_t516t>. CLEAR ls_fixed_values. ls_fixed_values-value = <ls_t516t>-konfe. ls_fixed_values-text = <ls_t516t>-ktext.-ktext. APPEND ls_fixed_values TO <ls_field_descr>-fixed_values. ENDLOOP.* no currency conversions.. WHEN 'WAERS'. <ls_field_descr>-read_only = abap_true.* fixed values for Privat/Gesetzlich/Freiw.Gesetzlich WHEN 'INS_TYPE'. <ls_field_descr>-fixed_values = gt_ins_type_values. WHEN OTHERS.
ENDCASE. ENDLOOP.ENDMETHOD.