Skip to Content
Author's profile photo Niyaz Ahamed

Top of page in SALV

Day 1

I was given a report to develop which would have a parameter as input on selection screen and display an ALV Grid report as output with required details. The purpose of the report was to download ALV output into excel and send it to vendor.

I wanted to make this report more user friendly and hence planned to develop this report using OOPS ALV with splitters & containers. Left pane showing the list of recently created data and the right pane showing details of the selected record.

Day 2 & 3

I figured out all the required database tables, created structures, internal tables and completed the business logic.

Created screens, used splitter container and build 2 ALV Grid (30% left and 70% right) using SALV class. Wrote handlers for click and double click. Everything was working fine at this instance.

Day 4

Since report was ready, I started adding top of page. Here came the hurdle. The report was not showing the top of page as I had used containers 😯 . I had looked in SDN and many had suggested to create a container on top and populate it. But when I did that and exported the report to excel, the heading(TOP-OF-PAGE) was missing 🙁 .

I commented the parameter  r_container  in cl_salv_table=>factory, the report was showing properly. But this time, my hitlist(Left container) was missing.


I found the program and screen number which SALV was using to display the report. I created a docking container instead of splitter and placed the docking container on that screen. Sample code below.


CREATE OBJECT go_dockcontainer


        repid = ‘SAPLSLVC_FULLSCREEN’ ” This is the program which uses SALV

        dynnr = ‘0500’ “Screen number

*     NO_FLUSH     = ‘X’

*     DOCK_AT      = DOCK_AT_LEFT

       extension    = 300

*     HEIGHT       = 42


       create_error = 1

       OTHERS       = 2.

Then I placed the hit list ALV on this docking container.





           r_container = go_dockcontainer


           r_salv_table = go_hit_list_salv


           t_table      = gt_sflight ).

     CATCH cx_salv_msg.                                  “#EC NO_HANDLER


The rest of the logic remained the same.  I also found that I had to call  set_top_of_list_print along with  set_top_of_list in order to get exported to excel.

Another hurdle

Now, everything looked fine but I faced another issue. SALV was not refreshing. It was expecting an event in order to get refreshed.

I had created a dummy button and assigned to PF status. Triggered this OK_CODE via below code during event handling of hit list.




       new_code = ‘DUMMY’    ” New OK_CODE


I had refreshed the grid in user command of the second ALV.


– Every time something is selected on the hit list, an event is triggered. So if data is high, it might create a performance issue.

Comments and suggestions are most welcomed

Assigned Tags

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

      Four days to write a SALV? Really?

      Author's profile photo Former Member
      Former Member

      "You don't need no stinkin' trainin'!"

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      That's OOP surcharge. 🙂 (Hey, don't blow up the consultants' cover, people have families to feed too.)

      But jocking aside - wasn't there a demo report to copy from? E,g, BCALV_GRID_DND_TREE, it has some header (CREATE_HEADER routine), from what I see. Full width top of page is usually quite annoying and waster of space anyway...

      Author's profile photo Niyaz Ahamed
      Niyaz Ahamed
      Blog Post Author

      That was written to make blog interesting.... 🙂 It didn't took 4 days for me...

      Author's profile photo Matthew Billingham
      Matthew Billingham

      I believe you. No matter what anyone else might think! 😉