Application Development and Automation 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: 
Read only

ALV grid toolbar

Former Member
0 Likes
1,421

Hello everyone,

i'm using control ALV Grid in my program and displayed it using method set_table_for_first_display, but it's toolbar is not working , i want to know the methods used to make it work, how can i use all of it's functionalities.

Thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
941
This code is used to delete unwanted icons from grid toolbar




CLASS LCL_EVENT_RECEIVER DEFINITION.
 
  PUBLIC SECTION.
    METHODS:
**method to handle toolbar
    HANDLE_TOOLBAR
        FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
            IMPORTING E_OBJECT E_INTERACTIVE.
*
ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
 
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
*method to remove unwanted icons from toolbar
 
  METHOD HANDLE_TOOLBAR.
    DATA: WA_TOOLBAR  TYPE STB_BUTTON.
    CLEAR WA_TOOLBAR.
 
    DELETE E_OBJECT->MT_TOOLBAR WHERE
                        FUNCTION = 'SELECT ALL'
                      OR FUNCTION = 'DESELECT ALL'.
 
    MOVE 'SELECT ALL' TO WA_TOOLBAR-FUNCTION.
    MOVE '@4B@' TO WA_TOOLBAR-ICON.
    MOVE ' ' TO WA_TOOLBAR-DISABLED.
    APPEND WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
 
    MOVE 'DESELECT ALL' TO WA_TOOLBAR-FUNCTION.
    MOVE '@4D@' TO WA_TOOLBAR-ICON.
    MOVE ' ' TO WA_TOOLBAR-DISABLED.
    APPEND WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
 
    LOOP AT E_OBJECT->MT_TOOLBAR INTO WA_TOOLBAR.
      IF WA_TOOLBAR-FUNCTION = '&&SEP01' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&CUT' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&COPY' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&PASTE' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&UNDO' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&APPEND' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&INSERT_ROW' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&DELETE_ROW' OR
         WA_TOOLBAR-FUNCTION = '&LOCAL&COPY_ROW' OR
         WA_TOOLBAR-FUNCTION = '&MB_SUBTOT' OR
         WA_TOOLBAR-FUNCTION = '&MB_SUM'.
 
 
        DELETE E_OBJECT->MT_TOOLBAR INDEX SY-TABIX.
      ENDIF.
    ENDLOOP.
 
  ENDMETHOD.                    "handle_toolbar
ENDCLASS.
 
 
*sets toolbar event
  SET HANDLER W_EVENT_RECEIVER->HANDLE_TOOLBAR FOR W_GRID.
Read only

Former Member
0 Likes
941
*-- Method for Handle toolbar 
           handle_toolbar for event toolbar of cl_gui_alv_grid
                      importing e_object e_interactive,
 
*-- Add toolbar functionality to add/copy/delete ---------------------*
  method handle_toolbar.
    perform handle_toolbar using e_object.
  endmethod.
 
 
FORM handle_toolbar USING  pr_object TYPE REF TO
                             cl_alv_event_toolbar_set.
  DATA: wal_toolbar  TYPE stb_button.
 
*-- Add Insert Icon 
  wal_toolbar-function  = c_insert.
  wal_toolbar-icon      = icon_insert_row.
  wal_toolbar-quickinfo = text-009.
  wal_toolbar-butn_type = 0.
  wal_toolbar-disabled  = space.
  INSERT wal_toolbar INTO pr_object->mt_toolbar INDEX 1.
 
*-- Add Delete Icon 
  wal_toolbar-function  = c_delete.
  wal_toolbar-icon      = icon_delete_row.
  wal_toolbar-quickinfo = text-010.
  wal_toolbar-butn_type = 0.
  wal_toolbar-disabled  = space.
  INSERT wal_toolbar INTO pr_object->mt_toolbar INDEX 2.
 
*-- Add Undelete Icon 
  wal_toolbar-function  = c_undelete.
  wal_toolbar-icon      = icon_status_reverse.
  wal_toolbar-quickinfo = text-011.
  wal_toolbar-butn_type = 0.
  wal_toolbar-disabled  = space.
  INSERT wal_toolbar INTO pr_object->mt_toolbar INDEX 3 .
 
*-- Add Copy Button 
  wal_toolbar-function  = c_copy.
  wal_toolbar-icon      = icon_copy_object .
  wal_toolbar-quickinfo = text-012.
  wal_toolbar-butn_type = 0.
  wal_toolbar-disabled  = space.
  INSERT wal_toolbar INTO pr_object->mt_toolbar INDEX 4 .
Read only

anversha_s
Active Contributor
0 Likes
941

hi,

INCLUDE .

TYPE-POOLS: slis.

CLASS lcl_event_receiver DEFINITION DEFERRED.

TABLES : zmpets_cil, zmpets_shipactiv, zmpets_chargebk, zmpets_shiphdr.

DATA: p_output_options TYPE ssfcompop, "occurs 0 with header line

p_control_parameters TYPE ssfctrlop. "occurs 0 with header line

DATA : BEGIN OF int_cil OCCURS 0,

sel TYPE char1,

icon TYPE icon_d,

pernr LIKE zmpets_cil-pernr,

vorna LIKE pa0002-vorna,

cashinlieu LIKE zmpets_cil-cashinlieu,

bldat LIKE zmpets_cil-bldat,

movreason LIKE zmpets_cil-movreason,

kostl LIKE zmpets_cil-kostl,

currency LIKE zmpets_cil-currency,

airentitle LIKE zmpets_cil-airentitle,

surentitle LIKE zmpets_cil-surentitle,

payamt LIKE zmpets_cil-surentitle,

version LIKE zmpets_shipactiv-version,

activity LIKE zmpets_shipactiv-activity,

celltab TYPE lvc_t_styl,

END OF int_cil.

DATA : int_cil_ver LIKE int_cil OCCURS 0 WITH HEADER LINE.

DATA : int_shipactiv LIKE zmpets_shipactiv OCCURS 0 WITH HEADER LINE.

DATA : v_form_name TYPE rs38l_fnam.

DATA : wf_res TYPE c.

DATA: gt_fieldcatalog TYPE lvc_t_fcat.

DATA : wf_tabix TYPE sy-tabix.

DATA: BEGIN OF int_sin OCCURS 0,

cashinlieu LIKE zmpets_shipactiv-petsdocnumber,

END OF int_sin.

DATA: ok_code LIKE sy-ucomm,

w_repid LIKE sy-repid,

wf_layout TYPE lvc_s_layo,

cont_on_main TYPE scrfname VALUE 'GRID_CONTROL',

cont_on_dialog TYPE scrfname VALUE 'GRID_CONTROL',

grid1 TYPE REF TO cl_gui_alv_grid,

grid2 TYPE REF TO cl_gui_alv_grid,

custom_container1 TYPE REF TO cl_gui_custom_container,

custom_container2 TYPE REF TO cl_gui_custom_container,

event_receiver TYPE REF TO lcl_event_receiver,

lt_exclude TYPE ui_functions,

ls_celltab TYPE lvc_s_styl,

lt_celltab TYPE lvc_t_styl.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-001.

PARAMETERS : p_cash AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK b3.

PERFORM fieldcatalog_init USING gt_fieldcatalog[].

*----


Selection-Screen----


*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.

SELECT-OPTIONS:s_date FOR zmpets_cil-bldat ,

s_pernr FOR zmpets_cil-pernr,

s_mvrsn FOR zmpets_shiphdr-movreason,

s_cost FOR zmpets_cil-kostl.

SELECTION-SCREEN END OF BLOCK b1.

PERFORM f_clearfields.

CALL SCREEN 100.

*----


*

  • CLASS lcl_event_receiver DEFINITION

*----


*

*

*----


*

CLASS lcl_event_receiver 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,

catch_doubleclick

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING

e_column

es_row_no

sender.

PRIVATE SECTION.

ENDCLASS. "lcl_event_receiver DEFINITION

*----


*

  • CLASS lcl_event_receiver IMPLEMENTATION

*----


*

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_toolbar.

*if the pending documents chk box clicked then only this should come.

IF p_cash = 'X'.

  • § 2.In event handler method for event TOOLBAR: Append own functions

  • by using event parameter E_OBJECT.

DATA: ls_toolbar TYPE stb_button.

  • append a separator to normal toolbar

CLEAR ls_toolbar.

MOVE 3 TO ls_toolbar-butn_type.

APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 'PROCESSED' TO ls_toolbar-function.

  • MOVE icon_UPDATE TO ls_toolbar-icon.

MOVE icon_execute_object TO ls_toolbar-icon.

MOVE 'Process the Record'(110) TO ls_toolbar-quickinfo.

MOVE 'Process'(122) TO ls_toolbar-text.

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO e_object->mt_toolbar.

ENDIF.

ENDMETHOD. "handle_toolbar

METHOD handle_user_command.

  • § 3.In event handler method for event USER_COMMAND: Query your

  • function codes defined in step 2 and react accordingly.

DATA: lt_rows TYPE lvc_t_row.

CASE e_ucomm.

WHEN 'PROCESSED'.

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'

EXPORTING

defaultoption = 'N'

textline1 = 'Do you want to process the selected documents?'

  • TEXTLINE2 = ' '

titel = 'Process Documents'

  • START_COLUMN = 25

  • START_ROW = 6

  • CANCEL_DISPLAY = 'X'

IMPORTING

answer = wf_res.

*--IF THE USER CONFIRMS 'YES',

IF wf_res = 'J'.

PERFORM f_modify_activity.

CALL METHOD grid1->refresh_table_display.

ENDIF.

ENDCASE.

ENDMETHOD. "handle_user_command

METHOD catch_doubleclick.

  • If the user clicked on another column there is

  • nothing to do.

IF e_column-fieldname NE 'CASHINLIEU'.

EXIT.

ENDIF.

READ TABLE int_cil INTO int_cil INDEX es_row_no-row_id.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z_PETS_CIL_DOCUMENT_DETAILS'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = v_form_name

EXCEPTIONS

no_form = 1

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

p_control_parameters-no_dialog = 'X'.

p_control_parameters-preview = 'X'.

p_output_options-tddest = 'LP01'.

CALL FUNCTION v_form_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMETERS =

control_parameters = p_control_parameters

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = p_output_options

user_settings = ' '

  • ARCHIVE_INDEX_TAB =

in_cashinlieu = int_cil-cashinlieu

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

IF sy-subrc <> 0.

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

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

ENDIF.

CALL METHOD sender->refresh_table_display.

ENDMETHOD. "catch_doubleclick

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

**----


*

    • MODULE pbo_100 OUTPUT

**----


*

**

**----


*

MODULE pbo_100 OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

w_repid = sy-repid.

IF custom_container1 IS INITIAL.

  • get the details fom zmpets_cil table.

PERFORM select_table_cil.

  • create a custom container control for our ALV Control

CREATE OBJECT custom_container1

EXPORTING

container_name = cont_on_main

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

IF sy-subrc NE 0.

  • add your handling, for example

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = w_repid

txt2 = sy-subrc

txt1 = 'The control could not be created'(510).

ENDIF.

CREATE OBJECT grid1

EXPORTING i_parent = custom_container1.

*

  • Set a titlebar for the grid control

*

wf_layout-grid_title = 'Cash In Lieu'(100).

  • allow to select multiple lines

wf_layout-sel_mode = 'C'.

wf_layout-stylefname = 'CELLTAB'.

*

  • Exclude all edit functions in this example since we do not need them:

PERFORM exclude_tb_functions CHANGING lt_exclude.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

is_layout = wf_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

it_toolbar_excluding = lt_exclude

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

CHANGING

it_outtab = int_cil[]

it_fieldcatalog = gt_fieldcatalog.

CREATE OBJECT event_receiver.

SET HANDLER event_receiver->handle_user_command FOR grid1.

SET HANDLER event_receiver->handle_toolbar FOR grid1.

SET HANDLER event_receiver->catch_doubleclick FOR grid1.

CALL METHOD grid1->set_toolbar_interactive.

ENDIF. "IF grid1 IS INITIAL

CALL METHOD cl_gui_control=>set_focus

EXPORTING

control = grid1.

ENDMODULE. "pbo_100 OUTPUT

*----


*

  • MODULE pai_100 INPUT

*----


*

*

*----


*

MODULE pai_100 INPUT.

CASE ok_code.

WHEN 'EXIT'.

PERFORM f_clearfields.

LEAVE PROGRAM.

WHEN 'CANCEL'.

PERFORM f_clearfields.

LEAVE TO SCREEN 0.

  • CALL SELECTION-SCREEN 1000.

WHEN 'BACK'.

PERFORM f_clearfields.

LEAVE TO SCREEN 0.

  • CALL SELECTION-SCREEN 1000.

ENDCASE.

CLEAR ok_code.

ENDMODULE. "pai_100 INPUT

*

**&----


*

**& Form select_table_PA0045

**&----


*

    • text

**----


*

    • -->P_WF_PA0045

**----


*

FORM select_table_cil.

IF p_cash = 'X'.

*Consider the pending documents also.

*get the documents which are not processed yet, ie activity code

*other than '79'.

*Doctype -> 01 = Cash in lieu.

SELECT zmpets_cilpernr pa0002vorna zmpets_cil~cashinlieu

zmpets_cilbldat zmpets_cilmovreason zmpets_cil~kostl

zmpets_cilcurrency zmpets_cilairentitle zmpets_cil~surentitle

zmpets_shipactivactivity zmpets_shipactivversion

INTO CORRESPONDING FIELDS OF TABLE int_cil_ver

FROM zmpets_cil JOIN pa0002

ON zmpets_cilpernr = pa0002pernr

JOIN zmpets_shipactiv

ON zmpets_cilcashinlieu = zmpets_shipactivpetsdocnumber

WHERE zmpets_shipactiv~doctype = '01'

AND zmpets_cil~loekz NE 'X'

AND zmpets_shipactiv~loekz NE 'X'.

LOOP AT int_cil_ver.

int_cil_ver-payamt = int_cil_ver-airentitle + int_cil_ver-surentitle.

*Not yet processed. set to red

int_cil_ver-icon = '@0A@'.

MODIFY int_cil_ver.

ENDLOOP.

IF sy-subrc <> 0.

*Message is 'No Pending Documents Available.'.

MESSAGE s196(zm050).

ELSE.

PERFORM f_filter_data_pending.

ENDIF.

ELSE.

SELECT zmpets_cilpernr pa0002vorna zmpets_cil~cashinlieu

zmpets_cilbldat zmpets_cilmovreason zmpets_cil~kostl

zmpets_cilcurrency zmpets_cilairentitle zmpets_cil~surentitle

zmpets_shipactivactivity zmpets_shipactivversion

INTO CORRESPONDING FIELDS OF TABLE int_cil_ver

FROM zmpets_cil JOIN pa0002

ON zmpets_cilpernr = pa0002pernr

JOIN zmpets_shipactiv

ON zmpets_cilcashinlieu = zmpets_shipactivpetsdocnumber

WHERE zmpets_cil~bldat IN s_date

AND zmpets_cil~pernr IN s_pernr

AND zmpets_cil~movreason IN s_mvrsn

AND zmpets_cil~kostl IN s_cost

  • AND zmpets_shipactiv~activity = '77'

AND zmpets_shipactiv~doctype = '01'

AND zmpets_cil~loekz NE 'X'

AND zmpets_shipactiv~loekz NE 'X'.

LOOP AT int_cil_ver.

int_cil_ver-payamt = int_cil_ver-airentitle +

int_cil_ver-surentitle.

MODIFY int_cil_ver.

ENDLOOP.

IF sy-subrc <> 0.

*Message is 'No Cash In lieu Documents Available.'.

MESSAGE s197(zm050).

ELSE.

PERFORM f_filter_data .

ENDIF.

ENDIF.

ENDFORM. "select_table_cil

**&----

-


**& Form fieldcatalog_init

**&----

-


    • text

**----

-


**

    • -->P_GT_FIELDCATALOG[] text

**----

-


**

FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat.

DATA: ls_fieldcatalog TYPE lvc_s_fcat.

CLEAR ls_fieldcatalog.

IF p_cash = 'X'.

ls_fieldcatalog-fieldname = 'SEL'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-datatype = 'C'.

ls_fieldcatalog-col_pos = 1.

ls_fieldcatalog-edit = 'X'.

ls_fieldcatalog-reptext = 'Select for Processing'.

ls_fieldcatalog-coltext = 'Select for Processing'.

ls_fieldcatalog-seltext = 'Select for Processing'.

ls_fieldcatalog-tooltip = 'Select for Processing'.

ls_fieldcatalog-checkbox = 'X'.

ls_fieldcatalog-key = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

ENDIF.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'ICON'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-datatype = 'CHAR'.

ls_fieldcatalog-col_pos = 2.

ls_fieldcatalog-intlen = '4'.

ls_fieldcatalog-reptext = 'Status'.

ls_fieldcatalog-coltext = 'Status'.

ls_fieldcatalog-seltext = 'Status'.

ls_fieldcatalog-tooltip = 'Status'.

  • ls_fieldcatalog-key = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'VORNA'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 3 .

ls_fieldcatalog-datatype = 'CHAR'.

ls_fieldcatalog-outputlen = '20'.

ls_fieldcatalog-reptext = 'Employee Name'.

ls_fieldcatalog-coltext = 'Employee Name'.

ls_fieldcatalog-seltext = 'Employee Name'.

ls_fieldcatalog-tooltip = 'Employee Name'.

  • ls_fieldcatalog-key = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'CASHINLIEU'..

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 4.

ls_fieldcatalog-datatype = 'CHAR'.

ls_fieldcatalog-outputlen = '10'.

ls_fieldcatalog-reptext = 'Document Number'.

ls_fieldcatalog-coltext = 'Document Number'.

ls_fieldcatalog-seltext = 'Document Number'.

ls_fieldcatalog-tooltip = 'Document Number'.

  • ls_fieldcatalog-key = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'BLDAT'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-datatype = 'DATS'.

ls_fieldcatalog-col_pos = 5.

ls_fieldcatalog-reptext = 'Document Date'.

ls_fieldcatalog-coltext = 'Document Date'.

ls_fieldcatalog-seltext = 'Document Date'.

ls_fieldcatalog-tooltip = 'Document Date'.

  • ls_fieldcatalog-key = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'MOVREASON'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 6.

ls_fieldcatalog-datatype = 'NUMC'.

ls_fieldcatalog-outputlen = '3'.

ls_fieldcatalog-reptext = 'Move Reasons'.

ls_fieldcatalog-coltext = 'Move Reasons'.

ls_fieldcatalog-seltext = 'Move Reasons'.

ls_fieldcatalog-tooltip = 'Move Reasons'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'KOSTL'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 7.

ls_fieldcatalog-datatype = 'CHAR'.

ls_fieldcatalog-outputlen = '10'.

ls_fieldcatalog-reptext = 'Cost Center'.

ls_fieldcatalog-coltext = 'Cost Center'.

ls_fieldcatalog-seltext = 'Cost Center'.

ls_fieldcatalog-tooltip = 'Cost Center'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'CURRENCY'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 8.

ls_fieldcatalog-datatype = 'CUKY'.

ls_fieldcatalog-outputlen = '5'.

ls_fieldcatalog-reptext = 'Currency'.

ls_fieldcatalog-coltext = 'Currency'.

ls_fieldcatalog-seltext = 'Currency'.

ls_fieldcatalog-tooltip = 'Currency'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'AIRENTITLE'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 9.

ls_fieldcatalog-datatype = 'CURR'.

ls_fieldcatalog-outputlen = '13'.

ls_fieldcatalog-reptext = 'Air Freight Entitlement'.

ls_fieldcatalog-coltext = 'Air Freight Entitlement'.

ls_fieldcatalog-seltext = 'Air Freight Entitlement'.

ls_fieldcatalog-tooltip = 'Air Freight Entitlement'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'SURENTITLE'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 10.

ls_fieldcatalog-datatype = 'CURR'.

ls_fieldcatalog-outputlen = '13'.

ls_fieldcatalog-reptext = 'Surface Freight Entitlement'.

ls_fieldcatalog-coltext = 'Surface Freight Entitlement'.

ls_fieldcatalog-seltext = 'Surface Freight Entitlement'.

ls_fieldcatalog-tooltip = 'Surface Freight Entitlement'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'PAYAMT'.

ls_fieldcatalog-tabname = 'INT_CIL'.

ls_fieldcatalog-col_pos = 11.

ls_fieldcatalog-datatype = 'CURR'.

ls_fieldcatalog-outputlen = '13'.

ls_fieldcatalog-reptext = 'Payable Amount'.

ls_fieldcatalog-coltext = 'Payable Amount'.

ls_fieldcatalog-seltext = 'Payable Amount'.

ls_fieldcatalog-tooltip = 'Payable Amount'.

  • ls_fieldcatalog-DO_sum = 'X'.

APPEND ls_fieldcatalog TO lt_fieldcatalog.

CLEAR ls_fieldcatalog.

ENDFORM. "fieldcatalog_init

*&----


*

*& Form f_modify_activity

*&----


*

  • Modify the activity to 79 in zmpets_shipaciv table.

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_modify_activity .

*All the document number which is to be processed is stored in

*the internel table 'INT_SIN'.

*Removing the already processed documents.

LOOP AT int_cil INTO int_cil.

IF int_cil-sel ='X'.

MOVE int_cil-cashinlieu TO int_sin.

APPEND int_sin.

CLEAR int_sin.

*Removing the processed documents.

DELETE int_cil.

ENDIF.

CLEAR int_cil.

ENDLOOP.

*Get the details from shipactiv table.

IF int_sin[] IS NOT INITIAL.

SELECT * FROM zmpets_shipactiv

INTO TABLE int_shipactiv

FOR ALL ENTRIES IN int_sin

WHERE petsdocnumber = int_sin-cashinlieu.

*Modify the activity code, version, actual date and last changed date.

SORT int_shipactiv BY petsdocnumber version DESCENDING.

LOOP AT int_shipactiv.

wf_tabix = sy-tabix.

AT NEW petsdocnumber.

READ TABLE int_shipactiv INDEX wf_tabix.

int_shipactiv-activity = '079'.

int_shipactiv-version = int_shipactiv-version + 1.

int_shipactiv-actdate = sy-datum.

int_shipactiv-lastchangedby = sy-uname.

int_shipactiv-lastchangedt = sy-datum.

*Modify the data base table

MODIFY zmpets_shipactiv FROM int_shipactiv.

ENDAT.

AT LAST.

*Message is 'Data Processed Successfully.'.

MESSAGE s203(zm050).

ENDAT.

CLEAR int_shipactiv.

ENDLOOP.

  • CALL SELECTION-SCREEN 1000.

ELSE.

*Message is 'No Data Selected for Processing.'.

MESSAGE s200(zm050).

ENDIF.

ENDFORM. " f_modify_activity

*&----


*

*& Form f_clearfields

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_clearfields .

CLEAR int_cil.

CLEAR int_sin.

REFRESH int_sin.

CLEAR int_shipactiv.

REFRESH int_shipactiv.

CLEAR int_cil_ver.

REFRESH int_cil_ver.

  • CLEAR wf_flag.

ENDFORM. " f_clearfields

*&----


*

*& Form f_filter_data

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_filter_data .

*Take the latest Version Data.

*take all the activities, including the activity '30'.

*then filter it with out the activities '30' and having the lastest

*version. then put the details in internal table 'INT_CRB'.

SORT int_cil_ver BY cashinlieu version DESCENDING.

CLEAR wf_tabix.

CLEAR int_cil.

REFRESH int_cil.

CLEAR int_cil_ver.

*----

-


LOOP AT int_cil_ver.

wf_tabix = sy-tabix.

AT NEW cashinlieu.

READ TABLE int_cil_ver INDEX wf_tabix.

MOVE-CORRESPONDING int_cil_ver TO int_cil.

APPEND int_cil.

CLEAR int_cil.

ENDAT.

ENDLOOP.

*----

-


IF int_cil[] IS INITIAL.

*Message is 'No Records Available.'.

MESSAGE s202(zm050).

ELSE.

CLEAR wf_tabix.

LOOP AT int_cil.

wf_tabix = sy-tabix.

REFRESH lt_celltab.

ls_celltab-fieldname = 'SEL'.

IF int_cil-activity = '079'.

*Check box making inactive

ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.

  • status becomes green. ie processed

int_cil-icon = '@08@'. "Green

ELSE.

*Activate the check box

ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

*status set to red. ie not yet processed

int_cil-icon = '@0A@'. "Red

ENDIF.

INSERT ls_celltab INTO TABLE lt_celltab.

INSERT LINES OF lt_celltab INTO TABLE int_cil-celltab.

MODIFY int_cil INDEX wf_tabix.

ENDLOOP.

ENDIF.

ENDFORM. " f_filter_data

*&----


*

*& Form EXCLUDE_TB_FUNCTIONS

*&----


*

  • text

*----


*

  • <--P_LT_EXCLUDE text

*----


*

FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.

DATA ls_exclude TYPE ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

APPEND ls_exclude TO pt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

APPEND ls_exclude TO pt_exclude.

ENDFORM. " EXCLUDE_TB_FUNCTIONS

*&----


*

*& Form f_filter_data

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_filter_data_pending.

*Take the latest Version Data.

*take all the activities, including the activity '30'.

*then filter it with out the activities '30' and having the lastest

*version. then put the details in internal table 'INT_CRB'.

SORT int_cil_ver BY cashinlieu version DESCENDING.

CLEAR wf_tabix.

CLEAR int_cil.

REFRESH int_cil.

CLEAR int_cil_ver.

*----

-


LOOP AT int_cil_ver.

wf_tabix = sy-tabix.

AT NEW cashinlieu.

READ TABLE int_cil_ver INDEX wf_tabix.

IF int_cil_ver-activity = '077'.

MOVE-CORRESPONDING int_cil_ver TO int_cil.

APPEND int_cil.

CLEAR int_cil.

ENDIF.

ENDAT.

ENDLOOP.

*----

-


IF int_cil[] IS INITIAL.

*Message is 'No Records Available.'.

MESSAGE s202(zm050).

ENDIF.

ENDFORM. " f_filter_data

kindly go thru this program

this will gef help u. pls reward.

regards,

anversha

Read only

uwe_schieferstein
Active Contributor
0 Likes
941

Hello Abhishek

If you want to exclude functions from the grid toolbar there is no coding needed. Simply collect all unwanted functions into an itab (e.g. lt_excl_functions, of type UI_FUNCTIONS. When calling SET_TABLE_FOR_FIRST_DISPLAY set parameter

it_toolbar_excluding = lt_excl_functions

.

If you want to add additional function you have to call method SET_TOOLBAR_INTERACTIVE and create an event handler method for event TOOLBAR. The interface of this method provides you with the reference to the toolbar instance. There you can completely manipulate the toolbar functions.

For more details have a look at the sample programs in the reuse library (SE83, Controls -> ALV Grid -> Toolbar).

Regards

Uwe