Skip to Content
Author's profile photo Łukasz Pęgiel

FALV -> Fast ALV Grid Object

Finally I’ve finished to work under FALV. You can find FALV classes in attachment and description under the links. But firstly let’s go through few following points:

  1. Why I’ve created FALV although SALV classes are provided by SAP?

    I know SALV classes although I haven’t used them often. The main reason was that they don’t provide edit mode. So at the end I’ve always worked with cl_gui_alv_grid class so then whenever users decided that they need one of the field to be editable then I can do it in few seconds/minutes.

  2. But there is a way to make SALV editable!

    Yes, I know the solutions of Naimesh Patel (found here) and Paul Hardy (in his ABAP to the Future book) and some other folks to make SALV editable. But In my own opinion, especially when you’re at least on 7.40 with SP5 making SALV editable is not needed as you can fast create ALV Grid which does everything you want. To be clear the big advantage of SALV, to call grid output of table in two, three lines when you goes to the code you’ll see it’s nothing more than call of REUSE_ALV_GRID_DISPLAY… really old FM, which at the end use CL_GUI_ALV_GRID. And yes I know about new SALV class for HANA, but that is another story…

  3. Direct reasons

    As I used CL_GUI_ALV_GRID so often then I came up with an idea to do some class which will make the creation faster, but I never had time to do it at work. You may know it, because of the time pressure you choose to create report/program/solution in the way you’re doing from years … and then comes another task….and another….

    So I’ve decided to do it at home…. yeah I’m crazy. But at least some of you can also use it.

  4. Advantages
    • Fast CL_GUI_ALV_GRID creation
    • Replacement of REUSE_ALV_GRID_DISPLAY and REUSE_ALV_GRID_DISPLAY_LVC for a simple editable reports to omit screen creation
    • All events are already handled and with redefinition of method I can faster use it
    • Faster setting of layout and field catalog attributes
    • Easy switch and copy between popup, full screen and container version
    • Easy toolbar handling (in grid and in full screen/popup using Dynamic GUI STATUS & TITLE with ABAP code )
    • One place to handle user commands of full screen/popup call -> event user_command
  5. Prerequisites

    I’ve worked on this on 7.40 SP8 but this should work also on SP5 as well. Sorry for the users bellow that versions but I’m so used to use new syntax that I couldn’t force myself to use old way of coding.

    UPDATE: Thanks to Santi Moreno we have now 7.31 version, you can find it here as an attachment in blog with name ZFALV_V1.1.0.zip. Also GitHub repository is now available here https://github.com/fidley/falv so if you’d like to join us, you’re more than welcomed.

  6. Source code

      Always updated source code in NUGG files and examples of usage will be available on my blog -> abapblog.com/falv . Bellow you can find some example videos with usage of FALV.



I really encourage you to try it and give me your feedback about FALV.


Cheers

Łukasz

Assigned Tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Richard Harper
      Richard Harper

      Hi Lukasz,

      I have the same type of thing called 'Themed ALV',  where you use a data base to them the alv grid and a wrapper around the alv grid class that takes away much of the grunt work.  It saves many hours of programming.

      Rich

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Hi Richard,

      exactly, it saves a lot of time. This is first version but I have some ideas how to make it better 🙂

      Cheers

      Łukasz

      Author's profile photo Richard Harper
      Richard Harper

      Consider:

      A front end to design what your grid looks like (ie specify the layout,  and the formatting in the field catalogs),  Automatic handling of hotspots - again Table driven - use a table that specifies the data element,  PID and transaction (it needs a primary and secondary data element and PID combo).  For more that 2 PID's allow it to have multiple lines for the same data element and sum those up.

      Then init your hotspot table by looking at the data elements in the field catalog (making sure all fields mentioned for the hotspot are there),  in the field catalog set the hotspot field.

      Auto colouring using colour schemes - take over from the 'Zebra' auto output and use brighter colours.  Check the CFIELDNAME and QFIELDNAME fields in the field catalog.  If they are populated then colour the fields red or green etc.  Handle the events and allow further redefinitions

      Create a standard header that outputs the parameters and logo in a dynamic document....  I can implement something like the below very quickly.  It goes on and on!  Fun while you're writing it,  easy to create good AVL grids when it's done!.

      Good luck and keep going!

      Rich

      Oh and PS... Don't forget to reduce the time delay for the DELAYED_CHANGE and DELAYED_CHANGE_SELECTION callbacks - makes the grid a lot snappier./wp-content/uploads/2016/01/sshot_865673.jpg

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Thanks Richard,

      for sure I'll try some of your hints!

      Cheers

      Łukasz

      Author's profile photo Former Member
      Former Member

      Did you have a look at this:

      (Full report example which shows full editable alv / just defined columns editable)

      Re: cl_salv_table --needs editable functionality -SAP please provide this

      Long story short:

      *** Create ALV with SALV class ***

      DATA: gr_alv TYPE REF TO cl_salv_table.

      cl_salv_table=>factory(

        IMPORTING

          r_salv_table  = gr_alv

        CHANGING

          t_table       = lt_tab ). "some internal table...

      *** Get CL_GUI_ALV_GRID object of SALV ***

      FIELD-SYMBOLS: <lr_grid> TYPE REF TO cl_gui_alv_grid.

      DATA: lv_layout       TYPE lvc_s_layo.

      ASSIGN ('(SAPLSLVC)G_ALV') TO <lr_grid>.

      IF sy-subrc = 0.

        CALL METHOD <lr_grid>->get_frontend_layout

          IMPORTING es_layout = lv_layout.

        lv_layout-edit = abap_true.

       

        CALL METHOD <lr_grid>->set_frontend_layout

          EXPORTING is_layout = lv_layout.

        CALL METHOD <lr_grid>->refresh_table_display( ).

      ENDIF.

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Yes, I've seen this way, also the others. But this does not suits me fully 🙂

      Author's profile photo Paul Hardy
      Paul Hardy

      Hello!

      If it is OK with you I will add a link to this blog in the 2nd edition of my book. I will just add a paragraph our two at the end of my ALV chapter to mention what you have achieved and point the readers to have a look for themselves.

      I managed to programmatically add toolbar ICONS to the SALV, and even get individual columns editable, but I could find no way of getting individual cells editable in a SALV report, as you have managed to do.

      For that reason amongst others I have come to the conclusion your solution is better than mine, and I am not ashamed to admit it.

      All I ever wanted was to have the benefits of the SALV (automatic generation of the field catalogue) with the benefits of the CL_GUI_ALV_GRID (editable) with the benefits of the "old fashioned" function modules (don't have to manually create a screen).

      If I could not get 100% there myself (due to not being to edit individual cells), despite many attempts, then I am more than happy to adopt a solution which gives me everything  want. It is not as if this is ever going to be provided in standard SAP, despite every single ABAP programmer begging for it for years.

      Well done and Cheersy Cheers

      Paul

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Thanks Paul,

      It would be an honour to me 🙂 If you can then once the 2nd edition is published please send me a copy in PDF 🙂 ( I already bought the first edition ).

      Although I'm happy that I've created this classes then it would be better for whole community if SAP would adapt SALV instead.... but as you have shown and written many times, this may be never provided.

      Cheers

      Łukasz

      Author's profile photo Simone Milesi
      Simone Milesi

      Hi Lukasz,

      do you mind if in my spare time I try to "downgrade" your code for poor fellows like me which works on older releases?

      Obviously, I'll send you the rework (if I manage to do it) for your approval 🙂

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Simone,

      that would be really great! Maybe we should think about Github for that? But please start without it, and we can setup this later.

      Cheers

      Łukasz

      Author's profile photo Simone Milesi
      Simone Milesi

      I'll work as soon as I finish the Fiori course and a couple of non-SAP projects (like designing and building the kites with my kids 😀 ) I'm working on.

      Author's profile photo Richard Harper
      Richard Harper

      Hey - how about pop-bottle rockets ?? 😎

      Author's profile photo Former Member
      Former Member

      Hello Łukasz,

      great work. Thank you very much!

      I have a question.

      If I want to use one of the added buttons, I implement a redefinition of method

      evf_user_command.

      How can I access the currently displayed table inside this method in an easy and clean way?

      For example, if I wanted to send or print data from the table without leaving the alv grid.

      I saw me->outtab, but it is of type ref to data.

      Is there an easy way to access the the data with the correct structure?

      What would you recommend?

      Best regards,

      Dominik

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Thanks a lot Dominik!

      As you know the type of your table then you can do following:

      field-symbols: <outtab> type tt_your_table_type.

      assign outtab->* to <outtab>.

      and now you can access your table with this field symbol.

      Cheers

      Łukasz

      Author's profile photo Dominik Di Lorenzo
      Dominik Di Lorenzo

      Thank you very much again, Łukasz!

      I did not see this solution.

      Best regards,

      Dominik

      Author's profile photo Alisson Alves
      Alisson Alves

      Hello Łukasz,


          I'm with the following difficulty, created the ZSAPLINK_INSTALLER program and follow all the steps of your blog to create the classes for FALV. What happens is that only the calls of Zs functions are implemented, I need the source code to create functions: Z_FALV_MASS_REPLACE, Z_FALV_CALL_MASS_SS and Z_FALV_DISPLAY.


      Best regards,

      Alisson.

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Hello Alisson,

      you need to import whole function group ZFALV, which is included in the nugget. Maybe you don't have Saplink plugin for function groups?

      Cheers

      Łukasz

      Author's profile photo Alisson Alves
      Alisson Alves

      Łukasz, 

          Thank you for your help, I could do and liked the result, will further explore the features now. Very good.