Hi, experts.
How to refresh a screen( not GRID ). I would provide some information about mine programm:
I have a screen with 2 grids in it : left – alv_tree, right-alv_grid.
When i click to node of tree => Alv grid appears at the right side.
Also i have an custom button in mine AlvGrid Toolbar, after which i try to delete first record and refresh a screen, i
know i can do it with ‘refresh_table_display’, but is it possible to do with calling sy-dynnnr with updated values?
I try this, but there are no changes at screen.
SET PF-STATUS ‘1100’.
SET TITLEBAR ‘1100’.
if split_cont is INITIAL.
init=>init_tables( ).
endif.
init=>init_container( ).
ENDMODULE.
PUBLIC SECTION.
CLASS-METHODS : init_container,
init_tables.
ENDCLASS. “init DEFINITION
class lcl_controller DEFINITION FINAL.
PUBLIC SECTION.
METHODS : ITEM_DOUBLE_CLICK
FOR EVENT ITEM_DOUBLE_CLICK OF cl_gui_alv_tree
IMPORTING node_key FIELDNAME.
ENDCLASS. “lcl_controller DEFINITION
*Класс контроллер для ALV
class control_of_alv DEFINITION FINAL.
PUBLIC SECTION.
METHODS : handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
AFTER_USER_COMMAND FOR EVENT AFTER_USER_COMMAND of cl_gui_alv_grid
IMPORTING E_UCOMM,
USER_COMMAND FOR EVENT USER_COMMAND of cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
class lcl_controller IMPLEMENTATION.
METHOD ITEM_DOUBLE_CLICK.
w_variant-report = sy-repid.
ls_layout-cwidth_opt = ‘X’.
ls_layout-grid_title = ”.
case node_key.
WHEN text-001.
ls_layout-sel_mode = ‘A’.
CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE’
EXPORTING
I_STRUCTURE_NAME = ‘ZVA_VBELN_STATUS’
I_BYPASSING_BUFFER = ‘X’
CHANGING
CT_FIELDCAT = fieldcat_of_right
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
lo_alv->set_table_for_first_display(
EXPORTING
is_layout = ls_layout
i_save = ‘A’
is_variant = w_variant
CHANGING
it_outtab = tab_of_vblen_status
it_fieldcatalog = fieldcat_of_right
).
WHEN OTHERS.
ENDCASE.
ENDMETHOD. “ITEM_DOUBLE_CLICK “handle_toolbar
endclass. “lcl_controller IMPLEMENTATION
*
CLASS CONTROL_OF_ALV IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
* CLEAR ls_toolbar.
MOVE ‘&EXCH’ TO ls_toolbar-function. “#EC NOTEXT
MOVE 0 TO ls_toolbar-butn_type.
MOVE ICON_INTENSIFY TO ls_toolbar-icon.
MOVE ‘Подписать и Отправить'(202) TO ls_toolbar-quickinfo.
MOVE ‘Подписать и Отправить’ TO ls_toolbar-text.
MOVE ‘ ‘ TO ls_toolbar-disabled. “#EC NOTEXT
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. “handle_toolbar
METHOD AFTER_USER_COMMAND.
* MESSAGE ‘123’ TYPE ‘I’.
* CALL METHOD lo_alv->refresh_table_display( ).
init=>init_container( ).
ENDMETHOD.
METHOD USER_COMMAND.
if e_ucomm = ‘&EXCH’.
delete tab_of_vblen_status INDEX 1.
endif.
ENDMETHOD.
ENDCLASS. “CONTROLL_OF_ALV IMPLEMENTATION
CLASS init IMPLEMENTATION.
METHOD init_container.
CLEAR SCREEN.
FREE lo_alv.
FREE obj_tree.
clear lt_events.
clear gt_fieldcat.
FREE left_container.
FREE right_container.
if split_cont is NOT INITIAL.
FREE split_cont.
endif.
CREATE OBJECT split_cont
EXPORTING
parent = cl_gui_container=>screen0
no_autodef_progid_dynnr = ‘X’
rows = 1
columns = 2.
* split_cont->set_width( width = 2180 ).
split_cont->SET_COLUMN_WIDTH( id = 1 WIDTH = 13 ).
left_container = split_cont->get_container( row = 1 column = 1 ).
right_container = split_cont->get_container( row = 1 column = 2 ).
if obj_tree is INITIAL.
CREATE OBJECT obj_tree
EXPORTING
parent = left_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
NO_HTML_HEADER = ‘X’
NO_TOOLBAR = ‘X’.
endif.
call method obj_tree->get_registered_events
IMPORTING
events = lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
append l_event to lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_CLICK.
append l_event to lt_events.
CALL METHOD obj_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH ‘ERROR’. “#EC NOTEXT
ENDIF.
ls_fieldcat-fieldname = ‘NAME’.
ls_fieldcat-coltext = ‘Кол-во’.
ls_fieldcat-outputlen = 17.
ls_fieldcat-seltext = ‘Кол-во’.
ls_fieldcat-datatype = ‘INT’.
ls_fieldcat-intlen = 5.
ls_fieldcat-decimals = 0.
APPEND ls_fieldcat TO gt_fieldcat.
l_hierarchy_header-heading = ‘Раздел'(100).
l_hierarchy_header-width = 35.
l_hierarchy_header-width_pix = ‘ ‘.
call method obj_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
CHANGING
it_outtab = lt_of_tree
IT_FIELDCATALOG = gt_fieldcat.
data : gs_fieldcat like LINE OF lt_of_tree.
ls_layo-EXP_IMAGE =’@FQ@’.
ls_layo-n_IMAGE = ‘@FQ@’.
gs_fieldcat-name = lines( tab_of_vblen_status ).
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Загрузка на портал’
is_node_layout = ls_layo
is_outtab_line = gs_fieldcat
IMPORTING
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE =’@BP@’.
ls_layo-n_IMAGE = ‘@BP@’.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Получено с портала’
is_node_layout = ls_layo
IMPORTING
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE =’@01@’.
ls_layo-n_IMAGE = ‘@01@’.
data: l_carrid_key type lvc_nkey.
l_carrid_key = p_node_key.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = l_carrid_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Найдены Соответсвия’
is_node_layout = ls_layo
IMPORTING
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE =’@02@’.
ls_layo-n_IMAGE = ‘@02@’.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = l_carrid_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Соответсвия не найдены’
is_node_layout = ls_layo
IMPORTING
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE = ‘@F9@’.
ls_layo-n_IMAGE = ‘@F9@’.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Лог Загрузки’
* it_item_layout = ls_layo
is_node_layout = ls_layo
importing
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE =’@01@’.
ls_layo-n_IMAGE = ‘@01@’.
l_carrid_key = p_node_key.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = l_carrid_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Успешно’
is_node_layout = ls_layo
IMPORTING
e_new_node_key = p_node_key.
ls_layo-EXP_IMAGE =’@02@’.
ls_layo-n_IMAGE = ‘@02@’.
CALL METHOD obj_tree->add_node
EXPORTING
i_relat_node_key = l_carrid_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ‘Неуспешно’
* it_item_layout = ls_layo
is_node_layout = ls_layo
importing
e_new_node_key = p_node_key.
DATA : mo_controller type ref to lcl_controller.
CREATE OBJECT mo_controller.
set HANDLER mo_controller->ITEM_DOUBLE_CLICK FOR obj_tree.
CREATE OBJECT lo_alv
EXPORTING
i_parent = right_container.
DATA : alv_controller type ref to CONTROL_OF_ALV.
CREATE OBJECT alv_controller.
set HANDLER alv_controller->handle_toolbar FOR lo_alv.
set HANDLER alv_controller->AFTER_USER_COMMAND for lo_alv.
set HANDLER alv_controller->USER_COMMAND for lo_alv.
call method obj_tree->frontend_update.
*MODIFY SCREEN.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
MODIFY SCREEN.
ENDMETHOD. “init_container
METHOD init_tables.
select * from ZVA_VBELN_STATUS
into CORRESPONDING FIELDS OF TABLE tab_of_vblen_status
where status = ’01’.
ENDMETHOD. “init_tables
ENDCLASS.