Skip to Content

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.

Approach

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.

Sample

CREATE OBJECT go_dockcontainer

     EXPORTING

        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

     EXCEPTIONS

       create_error = 1

       OTHERS       = 2.

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

Sample

TRY.

       cl_salv_table=>factory(

         EXPORTING

           r_container = go_dockcontainer

         IMPORTING

           r_salv_table = go_hit_list_salv

         CHANGING

           t_table      = gt_sflight ).

     CATCH cx_salv_msg.                                  “#EC NO_HANDLER

   ENDTRY.

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.

Sample

  cl_gui_cfw=>set_new_ok_code(

     EXPORTING

       new_code = ‘DUMMY’    ” New OK_CODE

   ).

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

Note:

– 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

To report this post you need to login first.

5 Comments

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

    1. 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…

      (0) 

Leave a Reply