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