‎2010 Jul 17 7:18 AM
I have a Report based program with Selection Screen
Upon entering valid Inputs program calls screen 100.
On Screen 100, I placed following elements
Docking Container
Splitter Container with 2 rows with Docking container as Parent
Placed a Toolbar object on the Top container of the split. Toolbar has 2 buttons BSID & BSAD
If user clicks BSID, then I have to show a SALV report in Lower Split
If user clicks BSAD, then I have to show a bit different data SALV report in same Lower Split
I tried several methods to refresh the data in SALV( I used 1 SALV)
Data is not refreshing in the second split...
I see that Lower Split container has children attribute set.. I tried to free() the lower container, but it deletes cmplete container itself, what can I do to refresh the data without completely redoing all the container stuff?
Also Children attribute in Split container is Read-only, how can I change this one ?
Valid answers would receive points...
‎2010 Jul 18 3:25 PM
Hi vinod,
if you want an answer, you should never offer like Valid answers would receive points...
Anyway: If you already created 2 containers, you should have 2 object references of CL_GRID instances. Modify the tables passed with ...first_display, call refresh (check all parameters) for the instances of the grid objects, call CL_GUI_VFW=>FLUSH.
If this does not work, üpost some relevant code.
Regards,
Clemens
‎2010 Jul 18 3:25 PM
Hi vinod,
if you want an answer, you should never offer like Valid answers would receive points...
Anyway: If you already created 2 containers, you should have 2 object references of CL_GRID instances. Modify the tables passed with ...first_display, call refresh (check all parameters) for the instances of the grid objects, call CL_GUI_VFW=>FLUSH.
If this does not work, üpost some relevant code.
Regards,
Clemens
‎2010 Jul 19 7:35 PM
PROGRAM yvtest3 LINE-SIZE 512.
*----
CLASSES
*----
CLASS: lcl_main DEFINITION DEFERRED,
lcl_event DEFINITION DEFERRED.
*----
TYPES
*----
TYPES: BEGIN OF t_kna1, " Customer Info
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
END OF t_kna1.
TYPES: BEGIN OF t_lfa1, " Vendor Info
lifnr TYPE lfa1-kunnr,
name1 TYPE lfa1-name1,
END OF t_lfa1.
*----
OBJECTS
*----
DATA: o_tlbar TYPE REF TO cl_gui_toolbar,
o_split TYPE REF TO cl_gui_splitter_container,
o_dock TYPE REF TO cl_gui_docking_container,
o_main TYPE REF TO lcl_main,
o_event TYPE REF TO lcl_event,
o_top TYPE REF TO cl_gui_container,
o_down TYPE REF TO cl_gui_container.
*----
INTERNAL TABLES
*----
DATA: i_kna1 TYPE STANDARD TABLE OF t_kna1,
i_lfa1 TYPE STANDARD TABLE OF t_lfa1.
*----
PARAMETERS
*----
PARAMETERS: p_dbcnt TYPE sy-dbcnt DEFAULT '500'.
----
CLASS lcl_event DEFINITION
----
Events Definition
----
CLASS lcl_event DEFINITION.
PUBLIC SECTION.
METHODS: on_click FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode.
ENDCLASS. "lcl_event DEFINITION
----
CLASS lcl_main DEFINITION
----
Main Definition
----
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
METHODS: constructor.
ENDCLASS. "lcl_main DEFINITION
*----
GET DATA
*----
START-OF-SELECTION.
Get Customers
SELECT kunnr name1
FROM kna1
INTO TABLE i_kna1
UP TO p_dbcnt ROWS.
IF sy-subrc = 0.
SORT i_kna1 BY kunnr.
ENDIF.
Get Customers
SELECT kunnr name1
FROM kna1
INTO TABLE i_kna1
UP TO p_dbcnt ROWS.
IF sy-subrc = 0.
SORT i_lfa1 BY lifnr.
ENDIF.
IF i_kna1 IS NOT INITIAL OR i_lfa1 IS NOT INITIAL.
CALL SCREEN '0100'.
ELSE.
MESSAGE 'No data exists for entry criteria'(001) TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
----
CLASS lcl_event IMPLEMENTATION
----
Events Implementation
----
CLASS lcl_event IMPLEMENTATION.
METHOD on_click.
CASE fcode.
WHEN 'KNA1'.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = o_down
CHANGING
t_table = i_kna1.
CATCH cx_salv_msg.
MESSAGE 'SALV - error'(007) TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDTRY.
WHEN 'LFA1'.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = o_down
CHANGING
t_table = i_lfa1.
CATCH cx_salv_msg.
MESSAGE 'SALV - error'(007) TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDTRY.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
cl_gui_cfw=>flush( ).
ENDMETHOD. "on_click
ENDCLASS. "lcl_event IMPLEMENTATION
----
CLASS lcl_main IMPLEMENTATION
----
Main Implementation
----
CLASS lcl_main IMPLEMENTATION.
METHOD constructor.
DATA: lw_evnt TYPE cntl_simple_event. " Events
DATA: li_evnt TYPE cntl_simple_events. " Events
*----
Create Docking Container
FREE o_dock.
CREATE OBJECT o_dock
EXPORTING
repid = sy-cprog
dynnr = '0100'
side = 1 " dock_at_left
extension = 400
lifetime = 1 " Dynpro
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE 'Error creating Docking Container'(002) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
*----
Create Split Screen
FREE: o_split,o_top,o_down.
CREATE OBJECT o_split
EXPORTING
parent = o_dock
rows = 2
columns = 1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE 'Error creating Splitter Container'(003) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
Set Sash Invisible
o_split->set_row_sash( id = 1
type = o_split->type_sashvisible
value = o_split->false ).
Set Row Height of 1st Container to fit Buttons
o_split->set_row_height( id = 1 height = 5 ).
o_top = o_split->get_container( row = 1 column = 1 ).
o_down = o_split->get_container( row = 2 column = 1 ).
*----
Create Toolbar
CREATE OBJECT o_tlbar
EXPORTING
parent = o_top
lifetime = 1
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'Error creating Toolbar'(004) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
Add Buttons to the Toolbar
CALL METHOD o_tlbar->add_button
EXPORTING
fcode = 'KNA1'
icon = ' '
butn_type = 0
text = 'KNA1'
EXCEPTIONS
cntl_error = 1
cntb_btype_error = 2
cntb_error_fcode = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'Error creating Button on Toolbar'(005) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
CALL METHOD o_tlbar->add_button
EXPORTING
fcode = 'LFA1'
icon = ' '
butn_type = 0
text = 'LFA1'
EXCEPTIONS
cntl_error = 1
cntb_btype_error = 2
cntb_error_fcode = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'Error creating Button on Toolbar'(005) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
CALL METHOD o_tlbar->add_button
EXPORTING
fcode = 'EXIT'
icon = ' '
butn_type = 0
text = 'Exit'
EXCEPTIONS
cntl_error = 1
cntb_btype_error = 2
cntb_error_fcode = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE 'Error creating Button on Toolbar'(005) TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
Add Events
register events for toolbar-control
lw_evnt-eventid = o_tlbar->m_id_function_selected.
APPEND lw_evnt TO li_evnt.
o_tlbar->set_registered_events( li_evnt ).
*----
Create Event Handler
CREATE OBJECT o_event.
SET HANDLER o_event->on_click FOR o_tlbar.
ENDMETHOD. "constructor
ENDCLASS. "lcl_main IMPLEMENTATION
&----
*& Module STATUS_0100 OUTPUT
&----
Screen 100 Init
----
MODULE status_0100 OUTPUT.
IF o_main IS NOT BOUND.
CREATE OBJECT o_main.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
‎2010 Jul 19 7:40 PM
Clemens,
You are right... if I need answers... why care for awarding points
Here is the code snippet....
‎2010 Jul 19 10:42 PM
Also while selecting for LFA1 use
Select lifnr name1
into table i_lfa1
from lfa1
up to p_dbcnt rows.
‎2010 Jul 20 9:45 PM
Hello Vinod
The following sample report shows how you can switch the displayed data on the same CL_SALV_TABLE list:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_SALV_SPLITTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_salv_splitter.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
*
gt_kna1 TYPE STANDARD TABLE OF kna1,
gt_lfa1 TYPE STANDARD TABLE OF lfa1,
go_docking TYPE REF TO cl_gui_docking_container,
go_table TYPE REF TO cl_salv_table.
START-OF-SELECTION.
CREATE OBJECT go_docking
EXCEPTIONS
OTHERS = 6.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
EXCEPTIONS
OTHERS = 4.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = go_docking
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_kna1.
CATCH cx_salv_msg .
ENDTRY.
go_table->display( ).
PERFORM select_customers.
CALL SCREEN '0100'.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form SELECT_CUSTOMERS
*&---------------------------------------------------------------------*
FORM select_customers .
SELECT * FROM kna1 INTO TABLE gt_kna1 UP TO 20 ROWS.
TRY.
CALL METHOD go_table->set_data
CHANGING
t_table = gt_kna1.
CATCH cx_salv_no_new_data_allowed .
ENDTRY.
ENDFORM. " SELECT_CUSTOMERS
*&---------------------------------------------------------------------*
*& Form SELECT_SUPPLIERS
*&---------------------------------------------------------------------*
FORM select_suppliers .
SELECT * FROM lfa1 INTO TABLE gt_lfa1 UP TO 20 ROWS.
TRY.
CALL METHOD go_table->set_data
CHANGING
t_table = gt_lfa1.
CATCH cx_salv_no_new_data_allowed .
ENDTRY.
ENDFORM. " SELECT_SUPPLIERS
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN_0100'.
SET TITLEBAR 'MAIN_0100'.
go_table->refresh( ).
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'CUSTOMER'.
PERFORM select_customers.
WHEN 'SUPPLIER'.
PERFORM select_suppliers.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Uwe