In this tutorial i explain how to simply create your first application with the Floorplan Manager(FPM) based on web dynpro ABAP.

We create a simple selection and show the results in a list UIBB. For the data exchange between the two GUIBBs we use eventing. The data come from the well known sflight table.

 

1. Create empty application

Open tool for creating FPM-applications (SE80 -> Web Dynpro[right click] -> Create -> FPM-application) or TCODE: FPM_WB

Now we save our new application (local or in a package and select transport request if needed)
now we could test your empty application, but at for now this is senseless so we should edit the configuration in FLUID.

Now we can insert a title for our application. Maybe “My first steps with the Floorplan Manager”? 🙂

2. An easy list

Before we can add our list to the Floorplan we must create a feeder class for the list,
so that the list knows what data to show, how to display this data and some other things.

You can do thas in Eclipse, or in SE24(oldschool:-)).
But as more developers (still) use SE24 to do that i decided also to use SE24 for this tutorial.

In our class we must implement the Interface IF_FPM_GUIBB_LIST

Now we must create all methods by clicking on them or using quick help in Eclipse.

2.1 Define table form

Now we have to define how the list in our application should look like. We do that in the get_definition method ouf our class.

DATA lt_sflight TYPE STANDARD TABLE OF sflight.

    DATA ls_field_description LIKE LINE OF et_field_description.

    eo_field_catalog = CAST #( cl_abap_tabledescr=>describe_by_data( p_data = lt_sflight ) ).

    DATA(lo_sflight_line_descr) = CAST cl_abap_structdescr( eo_field_catalog->get_table_line_type( ) ).

    LOOP AT lo_sflight_line_descr->components ASSIGNING FIELD-SYMBOL(<ls_sflight_line_descr>).

      ls_field_description-name = <ls_sflight_line_descr>-name.
      ls_field_description-allow_aggregation = abap_true.
      ls_field_description-allow_filter = abap_true.
      ls_field_description-allow_sort = abap_true.
      APPEND ls_field_description TO et_field_description.

 ENDLOOP.

now we could show an empty list. Wow 🙂

2.2 Fill list with data

Before we add our list to the Floorplan, we must fill it with data. We do that in the get_data method.

data lt_sflight TYPE STANDARD TABLE OF sflight.

    select * from sflight into corresponding fields of TABLE lt_sflight.

    ct_data = lt_sflight. 
    ev_data_changed = abap_true. 

2.3 Add list to Floorplan

Now we have done the magic and only have to add our list to the Floorplan. We do that in the FLUID.

Select list component.

Now we must define a configuration for the list and add a title for it. We must click on save and select “create configuration” on top right
or select the wrench on top right on the list uibb when hovering it.

Now we must choose a package and a transport request or save it as a local object. We do the last.
Finaly we can choose our feeder class. We insert the name of our created class and click enter.

Now we have to select the columns we want to show in the list.


Then we save the application and if we test it (directly in SE80 or if we choose “Test” on
additional features on top right in the fluid) we see our list works 🙂

2.4 Filter, group, search…

We have done the most in our get_definition method. Now we must activate the functions in FLUID.

Save

3. Search and eventing

3.1 Search-UIBB

We must create a feeder class again and have to implement the interface IF_FPM_GUIBB_SEARCH for the search.
We only had to implement get_defiinition method for the beginning.

DATA ls_sflight TYPE sflight.

    eo_field_catalog_attr = CAST #( cl_abap_structdescr=>describe_by_data( ls_sflight ) ).

Now we must add a search-UIBB to the Floorplan according to the same principle than we do with our list. In the component configuration of our list we choose the search fields and save.

Now we have a searchmask in our application.

3.2 Eventing

The last step is the communication between searchmask and the list. The best variant to do that is the eventing(my opinion :-)). If you click on the search button an event gets fired and then gets collected by the list. We can attach data to the event like our search criteria.

Now we must expand our feeder class for the list.

 

Public Section:

DATA mo_field_catalog TYPE REF TO cl_abap_structdescr.

get_definition:

DATA mo_field_catalog TYPE REF TO cl_abap_structdescr.

process_event:

    DATA lt_where_string TYPE rsds_where_tab.

    IF io_event->mv_event_id = 'FPM_EXECUTE_SEARCH'.
      DATA(lo_fpm_event_params) = NEW cl_fpm_parameter( ).
      TRY.
          cl_fpm_guibb_search_conversion=>to_abap_select_where_tab(
            EXPORTING
              it_fpm_search_criteria = it_fpm_search_criteria
              iv_table_name          = 'SFLIGHT'
              io_field_catalog       = mo_field_catalog
            IMPORTING
              et_abap_select_table   = lt_where_string
          ).
        CATCH cx_fpmgb.
          RETURN.
      ENDTRY.


      lo_fpm_event_params->if_fpm_parameter~set_value( EXPORTING
                                                  iv_key = 'SEARCH_CRITERIA'
                                                  iv_value = lt_where_string ).

      DATA(lo_fpm_event) = NEW cl_fpm_event(
          iv_event_id         = CONV #( 'EV_SEARCH_CRITERIA' )
          io_event_data       = lo_fpm_event_params
      ).


      DATA(lo_fpm) = cl_fpm=>get_instance( ).

      lo_fpm->raise_event( io_event = lo_fpm_event ).

Now the event gets fired if a an user clicks on “Search”. But now we must collect the event in our list and use the search criteria for our selection. We must expand our get_data method for the list.

data lt_sflight TYPE STANDARD TABLE OF sflight.
    data lt_where_tab TYPe rsds_where_tab.

    if iv_eventid->mv_event_id EQ 'FPM_START'. 

    select * from sflight into corresponding fields of TABLE lt_sflight.

    ct_data = lt_sflight. 
    ev_data_changed = abap_true. "Nach jeder Datenänderung muss das Event auf true gesetzt werden

    elseif iv_eventid->mv_event_id EQ 'EV_SEARCH_CRITERIA'. 

      CLEAR ct_data.

      iv_eventid->mo_event_data->get_value(
        EXPORTING
          iv_key   = 'SEARCH_CRITERIA'
        IMPORTING
          ev_value = LT_WHERE_TAB
      ).

      select * from sflight into corresponding fields of TABLE lt_sflight where (lt_where_tab).

      ct_data = lt_sflight.
      ev_data_changed = abap_true.

    endif.

Now if the search is excecuted the list could change its result based on the search criteria and the result looks like this.

 

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Thomas Wuercher

    Hi Sascha,

     

    there are dozens of similar blogs – with the first entries dating back to 2012 when this technology was introduced.

     

    What exactly is the benefit of another blog covering the same old topic – besides a new ABAP syntax?

     

    Regards

    Thomas

    (1) 
    1. Sascha Wächter Post author

      Hi Thomas,

      i know it’s nothing new or special, but i used it for me to start into my blogging career. 🙂 So I used a simple topic I’m familiar with.

      I have written the tutorial long ago for our own developers and have taken it here as a basis.

      Also, I do not think there can be too many tutorials on a topic. It always extends the angle of view and if not then it does not hurt.

      Since the original is already older I have not even used the new syntax consistently 😉

      Best regards

      Sascha

      (1) 
      1. Jelena Perfiljeva

        I’m with Thomas here. Had to check the calendar, also thought an old blog came up in my RSS feed by accident. Sorry but I feel “too many tutorials” is not very helpful actually. It is the same issue as Link Jungle, essentially. Google -> Floorplan Manager tutorial site:sap.com -> 1560 results. How is one supposed to know which tutorial is better?

        It’s not at all an expectation on SCN that the blogs must be about the cutting edge stuff only. But there are much better ways to write blogs on the subjects that have already been written about at length.

        Why not start with acknowledging the fact and providing the links to other similar blogs? Then follow by explaining why you felt compelled to write. E.g. “I decided to write this blog because… SAP official tutorials are a snooze-fest / other authors did not cover X or Y / there is some new stuff / I can offer better explanation / I just wanted to post a blog on SCN because it was on my resolution list for this year” (choose one).

        In this way you are not only promoting other SCN authors but also providing valuable additional reference to your readers. Seems like a win-win, doesn’t it?

        (0) 
      2. Julia Bender

        Hello everybody,

        it seems that there is a kind of overwhelm-feeling when it comes to tutorials – but this is an issue of the overall blogger and social media world. Everybody is allowed to write blogs – also here in the community.

        Which blog is good and which blog isn’t can be a question of taste – and for that we can discuss until the end of the world 😉

        So I would rather discuss or suggest using a kind of title-prefix or whatever or a search for a certain developer writing blogs to point out which kind of quality is behind.

        I would let everybody on his own decide which blogs or tutorials to read. Yes – one can get lost, but this is an overall issue – not only for this blog and this area.

        So my opinion is that I rather have a lot of documentation and blogs where I can decide on my own what to read – for me the big choice is important (of course the quality, too). At the very beginning it could indeed take me some time to find out in which direction I have to search. But then I get used to my own! search criteria.

        “Good” can be a very personal judgement.

        And for the FPM area we refer at first hand and as a starting point our learning area:

        https://wiki.scn.sap.com/wiki/display/WDABAP/Floorplan+Manager+-+Learning+Material

        What one will read additionaly is everybody’s choice 🙂

        Just my 2 cents…

        All the best,

        Julia

        (also writing blogs 😉 )

        (1) 
  2. Julia Bender

    Thanks for this very good structured blog. A further improvement is that your screenshots are made with theme SAP_CORBU – which is also not known to everybody.

    In my eyes it is also good having several blogs in different styles also to the same topic as people have different reading and learning styles.

    I’m curious about blogs from you which will follow 🙂

    All the best, Julia

    (1) 

Leave a Reply