Skip to Content
Author's profile photo Former Member

FPM Enhancement : Auto Populate + Read Only

We will be going through a very common requirement,

How to make a Input Field as Read Only and then auto populate with default value ?

Just a few steps and then done..!!

1. Find the feeder class of the application.

2. Create a new Z global class by inheriting the standard feeder class.

3. In the newly created Z class, go to method GET_DATA,

    here first invoke the super class GET_DATA method,


LOOP AT ct_field_usage INTO l_field_usage WHERE name eq  <fld name>.
                        l_tabix = sy-tabix.
                        l_field_usage-read_only = abap_true.
                          MODIFY ct_field_usage FROM l_field_usage INDEX l_tabix TRANSPORTING read_only."This makes our field Noneditable
                          ev_field_usage_changed = abap_true.
                          ASSIGN COMPONENT <fld name>  OF STRUCTURE cs_data TO <l_data>.
                          IF <l_data> IS   ASSIGNED.
                            <l_data> = default value.
                            ev_data_changed = abap_true.
                            CLEAR l_change_log.
                            l_change_log-name = < fld name>.
                            GET REFERENCE OF <l_data> INTO l_change_log-new_value.
                            CLEAR lt_change_log.
                            INSERT l_change_log INTO TABLE lt_change_log.
                            GET REFERENCE OF cs_data INTO lcs_data.
                            CALL METHOD if_fpm_guibb_form~flush
                                it_change_log = lt_change_log
                                is_data       = lcs_data.

4. In the FPM config, now replace the standard feeder class with the new Z feeder class created now.

We are done now, we can test our application..!!

Further Reading :

It’s a real good article for Feeder Class related basics,

Generic UI Building Block – Service Provider Infrastructure (SPI) – SCN Wiki

Suggestion :

Please come up with comments / suggestion / feedback for this article,

which can help in further value addition of this blog.

Thanking You All..!!

Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Ulrich Miller
      Ulrich Miller

      Hi Ankit,
      it seems you are calling if_guibb_form~flush( ) within if_guibb_form~get_data( ).
      This seems not to be a good idea. It is just one should not call framework methods
      in application coding.

      Instead if you like to populate data, then use method if_guibb_form~get_data( ) and there
      just utilize parameter ct_data and ev_data_changed.


      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Ulrich,

      Thanks a lot for the guidance.

      But I had to use flush method because without using this method, even thou the required data was visible in UI, but it ( data ) was not getting carried forward.

      Even thou I had used ev_data_changed field and set its value as X, but it was not working.

      If there is some thing some to be done, would request you to kindly suggest..!!

      Thanking You All..!!

      Author's profile photo François Henrotte
      François Henrotte

      The display only attribute should be set in the GET_DEFINITION method of the feeder.

      The data part in the GET_DATA but not in the table CT_FIELD_USAGE : you just have to set the field in the structure CS_DATA.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi François,

      Thanks a lot for the suggestion but I am just thinking GET_DEFINITION is called only at startup then how can we write dynamic logic in this method.

      Let's suppose, we have to make EMAIL ID field based on USER CATEGORY value entered by the user, then this method will not work.

      I am not sure, if it is possible to use method GET_DEFINITION in this scenario. 😕

      It will be great, if you can kindly suggest.

      Thanking You All..!!

      Author's profile photo Former Member
      Former Member


      With Above approach the data being displayed on Screen but it is not getting saved in database.

      any idea how to save back to database?

      Author's profile photo François Henrotte
      François Henrotte

      indeed, that's why I said that can be done only in the GET_DATA method.

      the read-only attribute should be a field of the structure containing the data

      so you have to put an X in it, but this can be done only in method GET_DATA