cancel
Showing results for 
Search instead for 
Did you mean: 

Adding custom fields in FPM_FORM_UIBB using feeder class

Former Member
0 Kudos

Hi,

We have requirement to add custom fields in form uibb using feeder class in Health and safety module at incidents report.

Please provide me some usefull documents and reference links.

Thanks

Murali Papana.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member557553
Participant

Hello Murali,

1. Copy the Feederclass to customer namespace (ZCL_HRESS_PER_DETAIL_XX)

2. Create a new TYPE in you class; e.g. S_CUSTOM_FIELDS

3. Add a type definition

Example:

private section.
*"* private components of class ZCL_HRESS_PER_DETAIL_XX
*"* do not include other source files here!!!

 
"--- BEGIN - Enter here your type definition
  types:
    BEGIN OF S_CUSTOM_FIELDS,
      YOUR_FIELD       TYPE STRING,
    END OF S_CUSTOM_FIELDS .
"--- END - Enter here your type definition

  constants CV_ACTION_CODE_REFRESHFVALUES type FPM_EVENT_ID value '_REFRESH_VALUES_'. "#EC NOTEXT
  constants CV_ACTION_CODE_ON_CNTR_SELECT type FPM_EVENT_ID value '_ON_COUNTRY_SELECT_'. "#EC NOTEXT
  constants CV_ACTION_CODE_SELECTCOUNTRY type FPM_EVENT_ID value '_SELECT_COUNTRY_'. "#EC NOTEXT
  constants CV_DATA_SHARING type STRING value 'DATA_SHARING_TEXT'. "#EC NOTEXT
  constants CV_COMP_BOL_ATTR type STRING value 'BOL_OBJECT_ATTR'. "#EC NOTEXT
  constants CV_DATA_SHARING_SPACE type STRING value 'DATA_SHARING_SPACE'. "#EC NOTEXT
  constants CV_ADDRESS_COUNTRY_SPACE type STRING value 'COUNTRY_SPACE'. "#EC NOTEXT

  methods GET_INFTY
    returning
      value(RV_INFTY) type INFTY .
  methods CREATE_ADDRESS_ENTITY
    exporting
      !ET_MESSAGES type FPMGB_T_MESSAGES
      value(EV_RESULT) type FPM_EVENT_RESULT .

4. Edit method IF_FPM_GUIBB_FORM~GET_DEFINITION

Add the following:

DATA lt_component_tbl TYPE ABAP_COMPONENT_TAB.
DATA LS_CUSTOM_FIELDS TYPE S_CUSTOM_FIELDS.
DATA ls_new_component TYPE ABAP_COMPONENTDESCR.
DATA lo_new_component TYPE REF TO CL_ABAP_typeDESCR.
DATA lo_new_component2 TYPE REF TO CL_ABAP_STRUCTDESCR.

FIELD-SYMBOLS <ls_new_field_descr> TYPE FPMGB_S_FORMFIELD_DESCR.
FIELD-SYMBOLS <fs_wa_mand_field> TYPE FPMGB_S_FORMFIELD_DESCR.


APPEND INITIAL LINE TO ET_FIELD_DESCRIPTION ASSIGNING <ls_new_field_descr>.

      <ls_new_field_descr>-NAME = 'YOUR_FIELD'. "Enter here your field
      <ls_new_field_descr>-LABEL_BY_DDIC = 'X'.
      <ls_new_field_descr>-VISIBILITY = '02'.
      <ls_new_field_descr>-DEFAULT_DISPLAY_TYPE = 'IN'.


  " Get table of all fields, visible in GUIBB
  CALL METHOD EO_FIELD_CATALOG->GET_COMPONENTS
    RECEIVING
      P_RESULT = lt_component_tbl.

  " Describe data in LS_CUSTOM_FILED
  CALL METHOD CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA
    EXPORTING
      P_DATA      = LS_CUSTOM_FIELDS
    RECEIVING
      P_DESCR_REF = lo_new_component.

  lo_new_component2 ?= lo_new_component.

  " Add custom fields to field catalog
  ls_new_component-name       = 'LS_CUSTOM_FIELDS'.   "type string,
  ls_new_component-type       = lo_new_component2.    "type ref to cl_abap_datadescr,
  ls_new_component-as_include = 'X'.                   "type abap_bool,
  ls_new_component-suffix     = ''.                   "type string,
  APPEND ls_new_component TO lt_component_tbl.

  TRY.
  CALL METHOD CL_ABAP_STRUCTDESCR=>CREATE
    EXPORTING
      P_COMPONENTS = lt_component_tbl
*      P_STRICT     = TRUE
    RECEIVING
      P_RESULT     = eo_field_catalog
      .
   CATCH CX_SY_STRUCT_CREATION .
  ENDTRY.

5. In your GUIBB you have to replace the feeder class to your new customer feder class.

Hope, I could help you.

Best regards, Christian

former_member205613
Participant
0 Kudos

Dear Murali Papana.

The FPM Cookbook which can be found in the SDN as well provides you with some information about the Form feeder.

But here some information as well:

Within method get_definition the fieldcatalog is created and the fielddescription as well. So if you know the feederclass you can check how the fieldcatalog was created there.

If the fields are all in the same structure the normal way should be:

eo_field_catalog ?= cl_abap_structdescr=>describe_by_data( ms_data ). "MS_DATA is defined in the attributes and the data for the form are stored there. Within method get_data this structure ms_data will be filled and set as cs_data

or

lo_structdescr ?= cl_abap_typedescr=>describe_by_name( 'SCARR' ). "SCARR is a structure

eo_field_catalog = lo_structdescr.

Within the fielddescription make sure that the new fields you want to have are set as not technical so you can get them in the configuration.

If you have further questions please let me know. With the feederclass and the information where the customer fields are I can give you more help!

Regards

Heike