Posted: Sat Jan 26, 2008 5:02 pm Post subject: Refresh button
Code:
REPORT z_alv_grid_ctrl_refresh.
***********************************************************************
* ALV Grid Control - Refresh button *
*---------------------------------------------------------------------*
* Steps : *
* - Create the report Z_ALV_GRID_CTRL_REFRESH *
* - Create the Dynpro 0100 (size 27x120) *
* - Add OKCODE (type OK) in the element list *
* - Modify the flow logic of dynpro 0100 : *
* * PROCESS BEFORE OUTPUT. *
* MODULE status_0100. *
* * PROCESS AFTER INPUT. *
* MODULE user_command_0100. *
* - Create a status named 'MAIN' *
* with the buttons : REFRESH BACK and EXIT *
*---------------------------------------------------------------------*
* Author : Michel PIOUD *
* Email : [email protected] HomePage : http://www.geocities.com/mpioud *
***********************************************************************
TYPES:
BEGIN OF ty_mara,
ernam TYPE mara-ernam,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
brgew TYPE mara-brgew,
END OF ty_mara.
DATA:
gt_mara TYPE STANDARD TABLE OF ty_mara.
DATA :
go_container TYPE REF TO cl_gui_docking_container,
go_alv_grid TYPE REF TO cl_gui_alv_grid,
CASE gv_okcode.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'REFRESH'.
PERFORM f_refresh_table.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*---------------------------------------------------------------------*
* Form f_read_data
*---------------------------------------------------------------------*
FORM f_read_data.
STATICS :
l_rows TYPE i.
ADD 1 TO l_rows.
SELECT ernam matnr ersda brgew INTO TABLE gt_mara FROM mara
UP TO l_rows ROWS.
MESSAGE s208(00) WITH 'Reading data ...'.
ENDFORM. " F_READ_DATA
*---------------------------------------------------------------------*
* Form create_and_init_alv
*---------------------------------------------------------------------*
FORM create_and_init_alv.
* Macro definition
DEFINE m_fieldcat.
add 1 to ls_alv_cat-col_pos.
ls_alv_cat-fieldname = &1.
ls_alv_cat-ref_table = 'MARA'.
append ls_alv_cat to lt_alv_cat.
END-OF-DEFINITION.
DATA:
ls_variant TYPE disvariant,
lt_alv_cat TYPE lvc_t_fcat,
ls_alv_cat TYPE lvc_s_fcat,
ls_alv_lay TYPE lvc_s_layo,
l_offline TYPE char1.
IF l_offline EQ 0.
CREATE OBJECT go_container
EXPORTING
extension = 2000
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
MESSAGE e208(00) WITH 'The control could not be created'.
ENDIF.
ENDIF.
* Create an instance of alv control
CREATE OBJECT go_alv_grid
EXPORTING i_parent = go_container.
ENDFORM. " CREATE_AND_INIT_ALV
*---------------------------------------------------------------------*
* Form F_REFRESH_TABLE
*---------------------------------------------------------------------*
FORM f_refresh_table.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.