Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

updating a table through ALV

Former Member
0 Kudos

Hi all,

I have one requirement.

I need to display output using alv grid display.Next when somebody select the rows in the grid display and press a push button then the selected fields are updated in the ztable created.

How can i achieve this.

How to get a push button on the alv.

how to update the the table with the selected rows.

Please give some suggestions for this.

Thanks to all in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

DATA: LS_OUTTAB TYPE ZTMW_HEADER_HIS.

DATA:L_VALID TYPE C,

LT_ROW_NO TYPE LVC_T_ROID WITH HEADER LINE.

CALL METHOD GRID1->CHECK_CHANGED_DATA"checking whether the grid data is changed or not

IMPORTING

e_valid = l_valid.

IF L_VALID EQ 'X'.

CALL METHOD GRID1->GET_SELECTED_ROWS

IMPORTING

ET_ROW_NO = LT_ROW_NO[].

LOOP AT LT_ROW_NO.

READ TABLE GT_ZTMW_HEADER_HIS INTO LS_OUTTAB INDEX LT_ROW_NO-ROW_ID."reading the selected row from the grid

update ZTMW_HEADER_HIS from LS_OUTTAB.

ENDLOOP.

regards,

bharat.

3 REPLIES 3

Former Member
0 Kudos

CHk this program...

U have to mention button names in PF-status creation

REPORT ZVA0T_PRCTR_FAL NO STANDARD PAGE HEADING MESSAGE-ID RA.

************************************************************************

  • *

  • Modification Log *

  • *

  • Program Name : ZVA0T_PRCTR_FAL *

  • *

  • Author : Suman K *

  • Date Written : 04/27/2004 *

  • Request # : SAGK901471 *

  • Requested by : Torrence Roundtree *

  • Description : This program is for maintainance of table *

  • ZVA0T_PRCTR_FAL. The program has been copied from *

  • custom program named ZSSVT_USR_TBL_MAINTENANCE and *

  • done with essential changes to include table *

  • ZVA0T_PRCTR_FAL and selection screen options. The *

  • existing program documentation is as below *

  • *

  • Program Specifications: *

  • *

  • Mod date Programmer Reference Description *

----


*04/27/2005 Suman K SAGK901471 Initial Development *

  • *

************************************************************************

************************************************************************

  • Type pools *

************************************************************************

TYPE-POOLS : slis. " Used for ALV display

************************************************************************

  • Tables

************************************************************************

TABLES: ZVA0T_PRCTR_FAL . " LO43 Profit Center Listings

************************************************************************

  • Constants

************************************************************************

CONSTANTS:

  • For authorization check for modifying Table Entries

c_act_auth_01 LIKE tactz-actvt VALUE '01',

c_act_auth_02 LIKE tactz-actvt VALUE '02',

c_act_auth_06 LIKE tactz-actvt VALUE '06',

c_table LIKE dd02l-tabname VALUE 'ZVA0T_PRCTR_FAL',

" Table name

c_save TYPE c VALUE 'A', " Save

c_chg(3) TYPE c VALUE 'CHG', " Change Group

c_a TYPE c VALUE 'A', " Cancel Indicator

c_ct(2) TYPE c VALUE 'CT'. " Style Name

************************************************************************

  • Work Variables declaration

************************************************************************

DATA:

w_transaction_code LIKE tstc-tcode, " Transaction Code

w_variant TYPE disvariant, " Variant

ok_code LIKE sy-ucomm. " OK Code

  • Reference variables for the ALV grid control........................

DATA:

w_grid TYPE REF TO cl_gui_alv_grid, " ALV Grid

w_custom_container TYPE REF TO cl_gui_custom_container.

" Reference to Container

  • Variables used in User_command_0100

DATA:

w_confirm_ind TYPE c, " Deletion Indicator

W_SUBRC LIKE SY-SUBRC. " Subrc

  • Flag declaration

DATA:

fl_chng TYPE c, " Flag

fl_cancel TYPE c. " Flag

************************************************************************

  • Internal tables declaration

************************************************************************

  • To store the function codes.........................................

DATA:

BEGIN OF wa_fcode,

fcode LIKE sy-ucomm, " User Command

END OF wa_fcode.

  • Table for User Command

DATA: t_fcode LIKE STANDARD TABLE OF wa_fcode.

  • To store the data of ZVA0T_PRCTR_FAL table

DATA:

T_ZVA0T_PRCTR_FAL LIKE STANDARD TABLE

OF ZVA0T_PRCTR_FAL.

  • Table used in User_command_0100

DATA:

t_selected_rows TYPE lvc_t_row. " Selected row information

DATA:

FS_SELECTED_ROWS LIKE LINE OF T_SELECTED_ROWS.

" Work area for Selected Rows

***********************************************************************

  • Selection screen elements

***********************************************************************

SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-008.

SELECT-OPTIONS:

s_prctr FOR ZVA0T_PRCTR_FAL-leg_prctr.

" Profit Center

SELECTION-SCREEN: END OF BLOCK blk1.

SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-009.

PARAMETERS:

p_varant LIKE ltdx-variant. " ALV variant

SELECTION-SCREEN: END OF BLOCK blk2.

************************************************************************

  • Initialization

************************************************************************

INITIALIZATION.

  • Authorization check for transaction code

SELECT tcode

FROM tstc

INTO w_transaction_code

UP TO 1 ROWS

WHERE pgmna EQ sy-repid.

ENDSELECT.

IF sy-subrc EQ 0.

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD w_transaction_code.

IF sy-subrc NE 0.

MESSAGE e100 WITH text-e01 w_transaction_code.

ENDIF. " IF SY-SUBRC NE 0

ENDIF. " IF SY-SUBRC EQ 0

***********************************************************************

  • At selection screen *

***********************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.

  • to get the existing values for the display variant

PERFORM f4_on_display_variant CHANGING p_varant.

AT SELECTION-SCREEN ON p_varant.

  • validates the diplay variant

IF p_varant IS NOT INITIAL.

PERFORM validate_variant.

ENDIF. " IF P_VARANT IS NOT INITIAL

************************************************************************

  • Start Of Selection

************************************************************************

START-OF-SELECTION.

CALL SCREEN 0100.

&----


*& Form f4_on_display_variant

&----


  • This subroutine is used to get the existing values for display variant

----


  • The parameter passed to the subroutine is Variant parameter

----


FORM f4_on_display_variant CHANGING p_varant TYPE any.

DATA: lw_variant LIKE disvariant. " Variant

lw_variant-report = sy-repid.

lw_variant-username = sy-uname.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = lw_variant

i_save = c_save

IMPORTING

es_variant = lw_variant

EXCEPTIONS

OTHERS = 1.

IF sy-subrc EQ 0.

p_varant = lw_variant-variant.

ELSE.

MESSAGE s100 WITH text-012.

ENDIF. " IF SY-SUBRC EQ 0

ENDFORM. " F4_ON_DISPLAY_VARIANT

*

&----


*& Form validate_variant

&----


  • This subroutine validates the variant entered onthe selection screen

----


  • There are no interface parameters to be passed to the subroutine

----


FORM validate_variant .

CLEAR w_variant.

w_variant-report = sy-repid.

MOVE p_varant TO w_variant-variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'

EXPORTING

i_save = c_save

CHANGING

cs_variant = w_variant

EXCEPTIONS

wrong_input = 1

not_found = 2

program_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF. " IF SY-SUBRC <> 0

ENDFORM. " VALIDATE_VARIANT

&----


*& Module STATUS_0100 OUTPUT

&----


  • This is the PBO module for the ALV GRid dispaly

----


MODULE status_0100 OUTPUT.

  • Check the User authorizations and display the PF status accordingly

PERFORM check_authorizations.

  • Set the user status as per Authorizations

SET PF-STATUS 'ZVA0T_PRCTR_FAL' EXCLUDING t_fcode.

SET TITLEBAR 'ZVA0T_PRCTR_FAL'.

  • Instantiate the container control and Grid control.

IF w_custom_container IS INITIAL.

CREATE OBJECT w_custom_container

EXPORTING

container_name = 'CUSTOM_CONTAINER'.

CREATE OBJECT w_grid

EXPORTING

i_parent = w_custom_container.

ENDIF. " IF W_CUSTOM_CONTAINER IS ...

  • Clearing the work variables

PERFORM intialize.

  • Retrieve the table contents

PERFORM get_data.

  • Display the data in the ALV Grid control

PERFORM display_data.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form check_authorizations

&----


  • This subroutine is used to check the user authorizations

----


  • There are no interface parameters to be passed

----


FORM check_authorizations .

REFRESH t_fcode.

  • Authorization check for Create entry

AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'

ID 'ACTVT' FIELD c_act_auth_01

ID 'TABLE' FIELD c_table.

IF sy-subrc NE 0.

PERFORM fillcode USING 'CREA'.

PERFORM fillcode USING 'COPY'.

ENDIF. " IF SY-SUBRC NE 0

  • Authorization check for Change the entry

AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'

ID 'ACTVT' FIELD c_act_auth_02

ID 'TABLE' FIELD c_table.

IF sy-subrc NE 0.

PERFORM fillcode USING 'CHNG'.

ENDIF. " IF SY-SUBRC NE 0

  • Authorization check for Delete the entry

AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'

ID 'ACTVT' FIELD c_act_auth_06

ID 'TABLE' FIELD c_table.

IF sy-subrc NE 0.

PERFORM fillcode USING 'DELE'.

ENDIF. " IF SY-SUBRC NE 0

ENDFORM. " CHECK_AUTHORIZATIONS

&----


*& Form fillcode

&----


  • This subroutine is used to fill the function code in the table t_fcode

----


  • The parameter that passed to this subroutine is function code

----


FORM fillcode USING value(p_fcode) TYPE any.

CLEAR wa_fcode.

MOVE p_fcode TO wa_fcode-fcode.

APPEND wa_fcode TO t_fcode.

ENDFORM. " FILLCODE

&----


*& Form intialize

&----


  • This subroutine is used to initialize the work variables

----


  • There are no interface parameters that need to be passed

----


FORM intialize .

CLEAR t_ZVA0T_PRCTR_FAL.

REFRESH t_ZVA0T_PRCTR_FAL.

ENDFORM. " INITIALIZE

&----


*& Form get_data

&----


  • This subroutine is used to get data from the table

----


  • There are no interfaces parameters that need to be passed

----


FORM get_data .

  • retrieve the status and codegroup from the table

REFRESH t_ZVA0T_PRCTR_FAL.

SELECT *

FROM ZVA0T_PRCTR_FAL

INTO TABLE t_ZVA0T_PRCTR_FAL

WHERE leg_prctr IN s_prctr.

IF sy-subrc NE 0.

ENDIF. " IF SY-SUBRC NE 0

ENDFORM. " GET_DATA

&----


*& Form display_data

&----


  • This subroutine is used to display the data in the ALV Grid control

----


*There are no interface parameters that need to be passed to subroutine

----


FORM display_data .

DATA:

w_grid_layout TYPE lvc_s_layo, " Grid Layout

LT_fieldcat TYPE lvc_t_fcat. " Field Catalog

DATA:

FS_FIELDCAT LIKE LINE OF LT_FIELDCAT.

  • Filling the Layout

w_grid_layout-grid_title = text-001.

w_grid_layout-sel_mode = c_save.

w_grid_layout-stylefname = c_ct.

w_grid_layout-cwidth_opt = 'X'.

  • Filling the Variant structure

w_variant-report = sy-repid.

w_variant-username = sy-uname.

w_variant-variant = p_varant.

    • Filling the fieldcatalog.............................................

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = c_table

CHANGING

ct_fieldcat = lt_fieldcat.

  • To make the ALV list use the medium text label from DDIC

LOOP AT lt_fieldcat INTO FS_FIELDCAT.

MOVE 'M' TO fs_fieldcat-colddictxt.

MODIFY lt_fieldcat FROM FS_FIELDCAT.

ENDLOOP. " LOOP AT T_FIELDCAT

CALL METHOD w_grid->set_table_for_first_display

EXPORTING

i_structure_name = c_table

is_variant = w_variant

i_save = c_save

is_layout = w_grid_layout

CHANGING

it_outtab = t_ZVA0T_PRCTR_FAL

it_fieldcatalog = lt_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF. " IF SY-SUBRC NE 0

ENDFORM. " DISPLAY_DATA

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • This is the PAI module for the screen 100.

----


MODULE user_command_0100 INPUT.

REFRESH t_selected_rows.

CLEAR FS_SELECTED_ROWS.

CLEAR fl_chng.

  • Getting the selected rows

CALL METHOD w_grid->get_selected_rows

IMPORTING

et_index_rows = t_selected_rows.

  • If more than one record is selected, error message

DESCRIBE TABLE t_selected_rows.

IF sy-tfill GT 1

AND SY-UCOMM NE 'REFR'

AND SY-UCOMM NE 'CREA'

AND SY-UCOMM NE 'DELE'.

MESSAGE e048(zcsv_sfdr).

ENDIF. " IF SY-TFILL GT 1

  • Read the first record

READ TABLE t_selected_rows INTO FS_SELECTED_ROWS INDEX 1.

READ TABLE t_ZVA0T_PRCTR_FAL

INTO ZVA0T_PRCTR_FAL INDEX fs_selected_rows-index.

CLEAR W_SUBRC.

W_SUBRC = SY-SUBRC.

CASE ok_code.

WHEN 'CREA'.

CLEAR ZVA0T_PRCTR_FAL.

CALL SCREEN 0200.

WHEN 'COPY'.

IF W_SUBRC EQ 0.

IF t_selected_rows IS NOT INITIAL.

CALL SCREEN 0200.

ELSE.

MESSAGE e100 WITH text-013.

ENDIF. " IF T_SELECTED_ROWS IS NOT ...

ELSE.

MESSAGE e100 WITH text-014.

ENDIF. " IF W_SUBRC EQ 0

WHEN 'CHNG'.

IF W_SUBRC EQ 0.

MOVE 'X' TO fl_chng.

IF t_selected_rows IS NOT INITIAL.

CALL SCREEN 0200.

ELSE.

MESSAGE e100 WITH text-e04.

ENDIF. " IF T_SELECTED_ROWS IS NOT ...

ELSE.

MESSAGE e100 WITH text-014.

ENDIF. " IF W_SUBRC EQ 0

WHEN 'DELE'.

IF t_selected_rows IS NOT INITIAL.

IF W_SUBRC EQ 0.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = text-002

text_question = text-003

text_button_1 = text-004

text_button_2 = text-005

default_button = '1'

display_cancel_button = 'X'

IMPORTING

answer = w_confirm_ind.

IF w_confirm_ind EQ '1'.

LOOP AT T_SELECTED_ROWS INTO FS_SELECTED_ROWS.

CLEAR ZVA0T_PRCTR_FAL.

READ TABLE T_ZVA0T_PRCTR_FAL

INTO ZVA0T_PRCTR_FAL INDEX fs_selected_rows-index.

IF SY-SUBRC EQ 0.

DELETE ZVA0T_PRCTR_FAL.

IF sy-subrc NE 0.

W_SUBRC = 4.

ENDIF. " IF SY-SUBRC EQ 0

ENDIF. " IF SY-SUBRC EQ 0

ENDLOOP. " LOOP AT T_SELECTED_ROWS ...

IF W_SUBRC EQ 0.

MESSAGE s100 WITH text-010.

ELSE.

MESSAGE e100 WITH text-e03.

ENDIF. " IF W_SUBRC EQ 0

ELSEIF w_confirm_ind EQ '2'.

ENDIF. " IF W_CONFIRM_IND EQ '1'

ELSE.

MESSAGE e100 WITH text-014.

ENDIF. " IF W_SUBRC EQ 0

ELSE.

MESSAGE e100 WITH text-e05.

ENDIF. " IF T_SELECTED_ROWS IS NOT ...

WHEN 'BACK'.

SET SCREEN 0.

LEAVE SCREEN.

WHEN 'CANCEL'.

SET SCREEN 0.

LEAVE SCREEN.

ENDCASE. " CASE OK_CODE

CLEAR ok_code.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module exit INPUT

&----


  • This subroutine is used to leave the current screen

----


MODULE exit INPUT.

CALL METHOD w_custom_container->free.

CALL METHOD cl_gui_cfw=>flush.

SET SCREEN 0.

LEAVE SCREEN.

ENDMODULE. " EXIT INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


  • This module is used to set the PF Status of the modify screen

----


MODULE status_0200 OUTPUT.

SET PF-STATUS 'STATUS_200'.

ENDMODULE. " STATUS_0200 OUTPUT

&----


*& Module modify_0200 OUTPUT

&----


  • This module is used to print the values on the screen

----


MODULE modify_0200 OUTPUT.

IF NOT fl_chng IS INITIAL.

LOOP AT SCREEN.

IF screen-group1 EQ c_chg.

screen-required = '0'.

screen-output = '1'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP. " LOOP AT SCREEN

ELSE.

LOOP AT SCREEN.

IF screen-group1 EQ c_chg.

screen-required = '1'.

screen-output = '1'.

screen-input = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP. " LOOP AT SCREEN

ENDIF. " IF NOT FL_CHNG IS INITIAL

ENDMODULE. " MODIFY_0200 OUTPUT

&----


*& Module exit_0200 INPUT

&----


  • This module is used to exit from the screen on pressing exit button

----


MODULE exit_0200 INPUT.

IF sy-datar IS INITIAL

AND fl_cancel IS INITIAL.

CLEAR fl_chng.

LEAVE PROGRAM.

ELSE.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = text-011

text_question = text-006

text_button_1 = text-004

text_button_2 = text-005

default_button = '1'

display_cancel_button = 'X'

IMPORTING

answer = w_confirm_ind.

CASE w_confirm_ind.

WHEN '1'.

sy-ucomm = 'SAVE'.

CLEAR fl_cancel.

WHEN '2'.

CLEAR fl_chng.

CLEAR fl_cancel.

LEAVE PROGRAM.

WHEN c_a.

fl_cancel = 'X'.

ENDCASE. " CASE W_CONFIRM_IND

ENDIF. " IF SY-DATAR IS INITIAL

ENDMODULE. " EXIT_0200 INPUT

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • This module is used to update the database table with the user values

----


MODULE user_command_0200 INPUT.

IF sy-ucomm EQ 'SAVE'.

PERFORM SAVE.

ELSEIF SY-UCOMM EQ 'BACK'.

PERFORM BACK_CANCEL.

IF SY-UCOMM EQ 'SAVE'.

PERFORM SAVE. " IF SY-UCOMM EQ 'SAVE'

ENDIF.

ELSEIF SY-UCOMM EQ 'CANC'.

PERFORM BACK_CANCEL.

IF SY-UCOMM EQ 'SAVE'.

PERFORM SAVE. " IF SY-UCOMM EQ 'SAVE'

ENDIF.

ELSEIF SY-UCOMM EQ 'ENTE'.

fl_cancel = 'X'.

ENDIF. " IF SY-UCOMM EQ 'SAVE'

ENDMODULE. " USER_COMMAND_0200 INPUT

&----


*& Form BACK_CANCEL

&----


  • This subroutine provides functionality for BACK & CANCEL

----


form BACK_CANCEL .

IF sy-datar IS INITIAL

AND fl_cancel IS INITIAL.

CLEAR fl_chng.

SET SCREEN 0.

LEAVE SCREEN.

ELSE.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = text-011

text_question = text-006

text_button_1 = text-004

text_button_2 = text-005

default_button = '1'

display_cancel_button = 'X'

IMPORTING

answer = w_confirm_ind.

CASE w_confirm_ind.

WHEN '1'.

sy-ucomm = 'SAVE'.

CLEAR fl_cancel.

WHEN '2'.

CLEAR fl_chng.

CLEAR fl_cancel.

SET SCREEN 0.

LEAVE SCREEN.

WHEN 'A'.

fl_cancel = 'X'.

ENDCASE. " CASE W_CONFIRM_IND

ENDIF. " IF SY-DATAR IS INITIAL

endform. " BACK_CANCEL

&----


*& Form SAVE

&----


  • This subroutine provides functionality for SAVE

----


form SAVE .

MOVE:

SY-DATUM TO ZVA0T_PRCTR_FAL-erdat,

SY-UZEIT TO ZVA0T_PRCTR_FAL-erzet,

SY-UNAME TO ZVA0T_PRCTR_FAL-ernam.

IF fl_chng IS INITIAL.

INSERT ZVA0T_PRCTR_FAL.

IF sy-subrc EQ 0.

MESSAGE s100 WITH text-010.

ELSE.

MESSAGE e100 WITH text-e03.

ENDIF. " IF SY-SUBRC EQ 0

ELSE.

MODIFY ZVA0T_PRCTR_FAL.

IF sy-subrc EQ 0.

MESSAGE s100 WITH text-010.

ELSE.

MESSAGE e100 WITH text-e03.

ENDIF. " IF SY-SUBRC EQ 0

CLEAR t_ZVA0T_PRCTR_FAL.

ENDIF. " IF FL_CHNG IS INITIAL

SET SCREEN 0.

LEAVE SCREEN.

endform. " SAVE

Reward if helpful...

Former Member
0 Kudos

Hi,

DATA: LS_OUTTAB TYPE ZTMW_HEADER_HIS.

DATA:L_VALID TYPE C,

LT_ROW_NO TYPE LVC_T_ROID WITH HEADER LINE.

CALL METHOD GRID1->CHECK_CHANGED_DATA"checking whether the grid data is changed or not

IMPORTING

e_valid = l_valid.

IF L_VALID EQ 'X'.

CALL METHOD GRID1->GET_SELECTED_ROWS

IMPORTING

ET_ROW_NO = LT_ROW_NO[].

LOOP AT LT_ROW_NO.

READ TABLE GT_ZTMW_HEADER_HIS INTO LS_OUTTAB INDEX LT_ROW_NO-ROW_ID."reading the selected row from the grid

update ZTMW_HEADER_HIS from LS_OUTTAB.

ENDLOOP.

regards,

bharat.

0 Kudos

Hi,

CLASS LCL_APPLICATION1 DEFINITION DEFERRED.

DATA: G_APPLICATION1 TYPE REF TO LCL_APPLICATION1,

CLASS LCL_APPLICATION1 DEFINITION.

DEFINITION

PUBLIC SECTION.

METHODS:

HANDLE_TOOLBAR

FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID

IMPORTING E_OBJECT E_INTERACTIVE,

HANDLE_USER_COMMAND

FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID

IMPORTING E_UCOMM.

ENDCLASS.

CLASS LCL_APPLICATION1 IMPLEMENTATION.

METHOD HANDLE_TOOLBAR.

DATA: LS_TOOLBAR TYPE STB_BUTTON.

  • append SAVE icon

CLEAR LS_TOOLBAR.

MOVE 'UPDA' TO LS_TOOLBAR-FUNCTION.

MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.

MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.

MOVE ' ' TO LS_TOOLBAR-DISABLED.

APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.

CLEAR LS_TOOLBAR.

ENDMETHOD.

METHOD HANDLE_USER_COMMAND.

CASE E_UCOMM.

WHEN 'UPDA'.

PERFORM UPDATE.

ENDCASE.

ENDMETHOD.

ENDCLASS.

<b>this statements u have to write after CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY</b>

CREATE OBJECT G_APPLICATION1.

SET HANDLER G_APPLICATION1->HANDLE_USER_COMMAND FOR GRID1.

SET HANDLER G_APPLICATION1->HANDLE_TOOLBAR FOR GRID1.

CALL METHOD grid1->set_toolbar_interactive.

regards,

bharat.

Message was edited by:

Bharat Kalagara