Extensive Tips and Tricks for Interactive SAP ALV

Extensive ALV Report Programming
Share on Facebook12Share on LinkedIn56Tweet about this on TwitterShare on Google+3
Please Share!!

After working on different projects and using interactive ALV OOPs concepts extensively, I thought of drafting one document with some useful information, which will help every developer to overcome most of the design requirements in any interactive ALV Report.

Do you know, you can Check the Consistency of an ALV with just SHIFT + 2 RIGHT Clicks?

Let us start our Today’s topic.

1. Create a Container in the screen, say ‘ALV_CONT’.

2. Create Reference Object for the Container:

3. Create Reference Object for the ALV Grid as below:

4. Define the ALV Layout as below:

5. Populate the Field Catalog data for display as below:

5.1. For Field Editable:

Also Read: ALV with an Editable Row.

5.2. For field No Display in output:

5.3. For field display as a Checkbox:

5.4. For the field where customized F4-Help is required:

5.5. For the field where the Summation is required:

Additionally, the field based on which summation will appear needs to be defined as below(eg. ANLKL):

6. To Restrict Functions from ALV display:

7. Populate the Data in table GT_DATA.

8. Call the method set_table_for_first_display for Display of data.

Data declaration for Reference:

9. If the Data just needs to be Refreshed:

10. To make fields Editable, call the below method while calling ALV for display:

11. Now to Validate the Data Changed in the grid we need to do the following:

11.1. Define a class (lcl_application_alv) definition and implementation and define event (handle_data_changed) for event data_changed of class cl_gui_alv_grid in it.

11.2. In method handle_data_changed call methods get_cell_value and modify_cell to get and modify cell values like below –

12. Now before calling method set_table_for_first_display, write the below code:

13. If the Field Catalog is required to change when different actions are executed for the ALV grid data display, call method set_frontend_fieldcatalog after populating the field catalog data to refresh the field catalog settings.

14. If Conditional F4 Help is required to be populated in the ALV, say based on one data in ALV, another field F4-Help data needs to be populated then do the following:

14.1. Before calling method set_table_for_first_display, we have to Register the fields we want to have the customized F4-help like below:

14.2. In class lcl_application_alv, define the method and then implement it.

14.3. In class lcl_application_alv implementation, implement the method handle_on_f4.

14.4. Now after Register_F4_for_Fields is called, add below code:

15. When the Back button is pressed, clear and refresh as below:

16. To make an ALV invisible add below code:

17. To make Row Selection through code: Pass the row ids into lt_lvc_s_roid-

18. To Reset Scroll Bar Position after selecting rows through code, add the below code:

19. Display Top-of-Page data:

19.1. To display To-of-page details first the main container needs to be split into two halves – one will be assigned to the GRID and the other for populating the top header details as below:

Also Check: OOPs Report Using Splitter and ALV Tree Combination

19.2. Now in the local class, define method handle_top_of_page as below:

19.3. In the class implementation, define the method details:

19.4. Logic in the Subroutine:

19.5. Before method set_table_for_first_display is called write the below code:

Some data declaration help:

So…What Do You Think?

Now we want to hear from you.

Do you think, we have covered most of the points in ALV?

Whether you think we have mentioned all or not, in either case, please leave a quick comment below.

SAP ABAP Expert

About the Author: Averi Sengupta
Averi is playing the role of Delivery Lead of an SAP Implementation project in IBM. She has more than thirteen years of SAP Technical experience. She is Subject Matter Expert in SAPScripts/Smartforms, Web Dynpro, Interfaces, HANA-ABAP and Mobility Area (OData).

Averi has excellent communication, interpersonal skills, and leadership qualities. She has been handling multiple high visibility projects in IBM. She has worked in different SAP functional areas like MM, SD, FI, SRM, CRM and EHSM (Incident Management).

Find more about Averi Sengupta at LinkedIn.

Share on Facebook12Share on LinkedIn56Tweet about this on TwitterShare on Google+3
Please Share!!

About the Author

Averi Sengupta
Averi Sengupta
Averi is playing the role of Delivery Lead of an SAP Implementation project in IBM. She has more than thirteen years of SAP Technical experience. She is Subject Matter Expert in SAPScripts/Smartforms, Web Dynpro, Interfaces, HANA-ABAP and Mobility Area (OData). Averi has excellent communication, interpersonal skills, and leadership qualities. She has been handling multiple high visibility projects in IBM. She has worked in different SAP functional areas like MM, SD, FI, SRM, CRM and EHSM (Incident Management). Find more about her on LinkedIn

6 Comments on "Extensive Tips and Tricks for Interactive SAP ALV"

  1. I could have really used this 10 years ago! Impressive piece of work, I added this to my documentation.

    • Dear Steven – Thank you for your message. Hopefully beginners and new ABAPers can use this as ready reference. 🙂

      Thanks to Averi who shared this document.

      Regards,
      Raju.

  2. Could not refrain myself from commenting on this. This can be a real one-shot guide for ALV development. Kudos to the author and publisher!

    • On behalf of Averi, I would like to Thank you Saswata for your appreciation. 🙂
      Indeed this is a very handy guide for ABAPers.. 🙂

      Raju

  3. Hello Averi !!
    You Rocked it.. Excellent article on ALV..Thank you Averi And Raju – SAP Yard !! Good job Guys!! 🙂

    • Thank you Ram.. You are SAPYard.. 😀
      We are waiting for your next Adobe Tip.. 🙂

      Thanks to Averi for sharing this useful document on ALV.

      Regards,
      Raju.

Please help us improve. Please Shout Often & Loud!!