Show TOC

Syntax documentationCode Example for a FORM Implementation

This is an example for a FORM implementation (the tables starting GT_* are attributes of the class):

Syntax Syntax

  1. METHOD if_fpm_guibb_form~get_definition.
    
  2. 	DATA lo_guibb_definit		TYPE REF TO  cl_hress_fpm_guibb_services.
  3. 	DATA ls_fixed_values		TYPE wdr_context_attr_value.
  4. 	DATA ls_action					TYPE fpmgb_s_actiondef.
    
  5. 	FIELD-SYMBOLS <ls_t516t> TYPE t516t.
  6. 	FIELD-SYMBOLS <ls_t5d2l> TYPE t5d2l.
  7. 	FIELD-SYMBOLS <ls_field_descr> TYPE fpmgb_s_formfield_descr.
    
  8. **Step 1 ********************************************
  9. * call super method, because it is the done thing.
  10. 	super->if_fpm_guibb_form~get_definition(
  11. 		IMPORTING
  12. 			es_message               = es_message
  13. 			eo_field_catalog         = eo_field_catalog
  14. 			et_field_description     = et_field_description
  15. 			et_action_definition     = et_action_definition
  16. 			et_special_groups        = et_special_groups
  17. 			ev_additional_error_info = ev_additional_error_info ).
    
  18. **Step 2 *********************************************
  19. * Expose supermethod standard 'display' event to configuration
  20. expose_action_display_output( changing ct_action_definition =
  21. 		et_action_definition   ).
  22. * Action on Radio buttons Privat- or Freiwillig-/Gesetzlichversichert
  23. 	ls_action-id        = GC_EVENT_RBHEALTH."'RBHEALTH'.
  24. 	ls_action-text      = text-e02.
  25. 	ls_action-enabled   = abap_true.
  26. 	ls_action-exposable = abap_true.
  27. 	APPEND ls_action TO et_action_definition.
    
  28. **Step 3 **********************************************
  29. * Get field catalogue for Screen fields. (If a customer extends
  30. * structure HRESS_S_REP_DE_GHR for the screen parameters,
  31. * this method will automatically get the DDIC information for the
  32. * extended fields too. No modification necessary.  )
  33. 	CREATE OBJECT lo_guibb_definit.
  34. 	TRY.
  35. 		lo_guibb_definit->get_guibbf_definition_dstruc(
  36. 			EXPORTING
  37. 				iv_langu             = sy-langu
  38. 				is_data              = gs_screen_parameters
  39. 			IMPORTING
  40. 				eo_field_catalog     = eo_field_catalog
  41. 				et_field_description = et_field_description
  42. 				   ).
  43. 		CATCH cx_hress.
  44. *     	create a dump here ...
  45. 			MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  46. 				  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  47. 	ENDTRY.
    
  48. **Step 4 ***********************************************
  49. * Fill F4 values for ....
  50. * Religion
  51. 	SELECT * FROM t516t INTO TABLE gt_t516t
  52. 			WHERE sprsl = 'D'.
    
  53. * Bundesland (State)
  54. 	SELECT * FROM t5d2l INTO TABLE gt_t5d2l.
    
  55. *  Insurance types for radio buttons
  56. 	CLEAR ls_in_type_values.
  57. 	ls_in_type_values-value = '01'.
  58. 	ls_in_type_values-text  = text-v01." 'Freiwilling/Pflichtversichert' .
  59. 	APPEND ls_in_type_values TO  gt_ins_type_values.
  60. 	ls_in_type_values-value = '02'.
  61. 	ls_in_type_values-text  = text-v02."'Privatversichert' .
  62. 	APPEND ls_in_type_values TO  gt_ins_type_values.
    
  63. **Step 5 ***********************************************
  64. 	LOOP AT et_field_description ASSIGNING <ls_field_descr>.
  65. 		CASE <ls_field_descr>-name.
  66. *     set currency for Gross Remuneration field
  67. 			WHEN 'BRUTT'.
  68. 				<ls_field_descr>-cq = 'C'.
  69. 				<ls_field_descr>-mandatory = abap_true.
  70. 				<ls_field_descr>-cq_ref = gv_currency.
  71. 			WHEN 'DATUM'.
  72. 				<ls_field_descr>-mandatory = abap_true.
  73. *     set F4 helps
  74. *     Church tax area
  75. 			WHEN 'KISTG'.
  76. 				LOOP AT gt_t5d2l ASSIGNING <ls_t5d2l>.
  77. 					CLEAR ls_fixed_values.
  78. 					ls_fixed_values-value = <ls_t5d2l>-brdld.
  79. 					ls_fixed_values-text  = <ls_t5d2l>-ksttx.
  80. 					APPEND ls_fixed_values TO <ls_field_descr>-fixed_values.
  81. 				ENDLOOP.
  82. *     Church tax
  83. 			WHEN 'KONFE'.
  84. 				LOOP AT gt_t516t ASSIGNING <ls_t516t>.
  85. 					CLEAR ls_fixed_values.
  86. 					ls_fixed_values-value = <ls_t516t>-konfe.
  87. 					ls_fixed_values-text  = <ls_t516t>-ktext.-ktext.
  88. 					APPEND ls_fixed_values TO <ls_field_descr>-fixed_values.
  89. 				ENDLOOP.
  90. *     no currency conversions..
  91. 			WHEN 'WAERS'.
  92. 				<ls_field_descr>-read_only = abap_true.
  93. *     fixed values for Privat/Gesetzlich/Freiw.Gesetzlich
  94. 			WHEN 'INS_TYPE'.
  95. 				<ls_field_descr>-fixed_values = gt_ins_type_values.
  96. 			WHEN OTHERS.
    
  97. 		ENDCASE.
  98. 	ENDLOOP.
  99. ENDMETHOD.
End of the code.