Disable ALV grid context menu

Hello ABAP experts,
I have developed a program which shows some output in ALV grid (CL_GUI_ALV_GRID). I don't want the user to play with columns and rows of grid, so I have removed toolbar using following:
LVC_S_LAYO-NO_TOOLBAR
I have noticed, still user can hide or show columns and delete rows by right clicking on the grid. I want to disable right click or context menu. I am unable to get any hint so far.
I appreciate for some good solution.
Thanks,
Waqas Rashid

Hi,
Just as stated by Max you can use the event 'CONTEXT_MENU_REQUEST' in the class 'CL_GUI_ALV_GRID'. In fact I just tried out calling the event. I set the handler for the event 'CONTEXT_MENU_REQUEST'. And then in the implementation I just called the clear method. Example is below.
class lcl_events_split definition.
  public section.
    methods:
    CONTEXT_MENU_REQUEST   for event CONTEXT_MENU_REQUEST
                                                    of cl_gui_alv_grid importing E_OBJECT.
endclass.                    "lcl_events_split DEFINITION
class lcl_events_split implementation.
  method CONTEXT_MENU_REQUEST.
      e_object->CLEAR( ).  "THIS SHOULD STOP THE RIGHT CLICK MENU BAR
    endmethod.
endclass. 
    CREATE OBJECT O_CC
      EXPORTING  CONTAINER_NAME = 'CC_ALV'.
    CREATE OBJECT O_ALV
      EXPORTING     I_PARENT = O_CC.
And before you call you grid for display below code is required.
  data: ls_spl_events   type ref to  lcl_events_split.   "Event Handler class
    set handler ls_spl_events->CONTEXT_MENU_REQUEST  for O_ALV.
    CALL METHOD O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
      CHANGING
        IT_OUTTAB = T_MARA
        IT_FIELDCATALOG = LS_FIELDCATALOG. 
Hope this helps ......
Regards,
Imran,
Edited by: Mujtaba Imran on Sep 11, 2011 7:34 PM

Similar Messages

  • Control BEx Analysis Grid context menu entries via VBA

    Hey Forum,
    I have kind of a tricky question for you. I want to control BEx Analysis Grid context menu entries via VBA, namely the Expand Hierarchy Node function when I right click on a Hierarchy node entry.
    Does anyone know how to access this function via VBA?
    I also thought about adding a BEx button and access it via VBA but I am lacking the correct Button Parameters to expand/collapse a hierarchy node.
    Anyone has a tipp for me?
    Thanks,
    R.

    Hello, DDrazdou and All too
    Did you have any information about requested function?
    I need to call binded transaction in R\3, and meanwhile, I just write wrapping functional module in the R\3, and making RFC call from VBA...
    It seems to work fine, but may be the better(standart) way is posible.
    with best regards, Alex.

  • PowerPoint 2010: deactivate/disable right click context menu

    Hi,
    I am looking for a way to deactivate/disable the right click context menu in PowerPoint 2010/365.
    For the editing font menu it works with the registry entry
    Go to: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Toolbars\PowerPoint Create a Dword AllowMenuFloaties and set the value to zero. Set to 1 to enable again.
    NOTE This will kill ALL floatie Menus not just the one you mention.
    Does anybody know, how it works for the main right click context menu?

    Hi,
    Hi,
    We can custom the existing right-click context menu in PowerPoint 2010 via VBA.
    A similar issue is addressed here, we can learn from this experience  :
    http://social.msdn.microsoft.com/Forums/en-US/f8c7ee04-2a08-4300-9a73-48ccf084723d/how-to-remove-munu-item-from-popup-menu?forum=worddev
    http://social.msdn.microsoft.com/Forums/office/en-US/c1eb22ba-6ca8-4c21-8100-62185355aa53/customize-rightclick-context-menu-in-powerpoint-2010?forum=officegeneral
    There is an example of Customizing Context Menus in All Versions of Microsoft Excel
    http://msdn.microsoft.com/en-us/library/gg469862(v=office.14).aspx
    If you need detail help, please post it in MSDN forum.
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

  • Define F-Code for ALV Button & context menu for ALV table

    Hi,
    I have some Buttons in ALV Toolbar like for example 'copy row'. Is it in browser environment possible to assign f-code to the button? Like by pushing e.g. F4 the method for 'copy row' action is fired?
    Or additionaly, is it possible to define a custom context menu in alv table?
    Thanks in advance,
    Tan

    Hi Tan,
    This Functionality is working on..Pelase check this...
    Re: How to improve Web accessibility with Function keys
    Re: Hot key(Ctrl+F1) for More field help not working
    Re: GUI Status?
    For help..
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b951297a6d2d65e10000000a42189c/content.htm
    Cheers,
    Kris.
    Edited by: kissnas on Jun 21, 2011 11:46 AM

  • Disable Right Click Context Menu in XP "OPEN WITH ADOBE READER 8"

    How can I eliminate the right click context menu "OPEN WITH ADOBE READER 8" in Windows XP?
    I have general familiarity with removing context menus. I see no option for this one in msconfig, or various context menu editors. I am unable to find a setting in Adobe Reader 8. If you know where the setting is, or have solved this problem, please let me know.
    Thanks,
    Joey

    That would be the device Metadata from the print driver vendor. It's part of the Device Stage feature mainly for client OS.
    Here is some MSDN documentation on the feature.
    http://windows.microsoft.com/en-us/windows7/products/features/device-management
    If this is a print server, use the tools include by the print team if you are performing any management on the server.
    Printmanagement.msc
    The Devices UI is really about devices it's not designed for print management, the spooler team had minimal input on the UI design.
    Alan Morris formerly with Windows Printing Team

  • Disabling context menu

    Dear Expert,
    My requirement is to disable the context menu for certain / all parts of BExweb report.
    How could this be possible for either the whole report or just some parts of the report? Seems like whatever is shown on the report I can click and the context menu comes out. I want to suppress this.
    Thanks & Regards,
    Shankell Pong

    Hi,
    Select your web item, e.g. a table in your web template and in the properties for that web item, remove the check mark in the option: "Objects with navigation links". This will disable the (BW) context menu for that web item.
    If your using the standard web template 0ADHOC for displaying your web reports, you need to copy 0ADHOC, change the option mentioned above for the web items you want and then change the default web template in the BW customizing.
    Hope this helps,
    -Jacob

  • Disable WD ABAP default context menu

    Hi All,
              Can anyone tell me how i can disable default context menu of wed dynpro applications.
    I have an application open to business users. I was able to disable 'user settings' option but i still get the 'display quick help' and 'more field help' option when the user right clicks on the web dynpro page
               I want to disable the default context menu completely to show Internet explorer context menu when a user right clicks on the web dynpro page.
               Please help
    Thanks
    WD dev

    Hi ,
    You will need to pass the WebDynpro Application,parameter WDDISABLEUSERPERSONALIZATION
    set its value as X  to disable users right click & personalization. Select ur webdynpro application double click, select parameters TAB.
    check below link for details.
    [http://help.sap.com/saphelp_nw70/helpdata/en/7b/fb57412df8091de10000000a155106/content.htm]
    Greetings
    Prashant
    P.S.- Points Welcome

  • Windows Explorer folder context menu crash

    Hello, On a PC running Windows 7x64 Ultimate,  Windows Explorer closes with a
    "Windows Explorer has stopped working" message, and needs to be restarted.
    It quits when I right click on a folder, while right clicking on a file doesn't cause it
    to quit. So far I've tried:
    Uninstalling and reinstalling graphics drivers, SVC scan, malware scans, virus scan,
    hijack this, safe mode, clean boot, shexview,  shmnview, reliability monitor, and event
    viewer. I could use some help with what shell extensions to modify, if that is
    even the problem.  Thanks
       Event Viewer Windows applications log has entries for event ID 1000 error,
    with these details:  
       Explorer.EXE
       6.1.7601.17567
       4d672ee4
       SHELL32.dll
       6.1.7601.18517
       53aa2e07
       c0000005
       0000000000050506
       13d4
       01cfff64b8cef67f
       C:\Windows\Explorer.EXE
       C:\Windows\system32\SHELL32.dll
       0639a5f1-6b59-11e4-9316-5404a64c920b
    Non-Windows context menu entries  from shexview-x64 ==================================================
    Extension Name    :
    Disabled          : No
    Type              : Context Menu
    Description       : 7-Zip Shell Extension
    Version           : 9.20
    Product Name      : 7-Zip
    Company           : Igor Pavlov
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files\7-Zip\7-zip.dll
    CLSID             : {23170F69-40C1-278A-1000-000100020000}
    File Created Time : 11/18/2010 9:08:50 PM
    CLSID Modified Time: 1/28/2014 4:45:12 PM
    Microsoft         : No
    File Extensions   : *, Directory
    File Attributes   : A
    File Size         : 86,016
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    :
    Disabled          : No
    Type              : Context Menu
    Description       : Backup Shell
    Version           : 8.2.0.21
    Product Name      : Backup
    Company           : Symantec Corporation
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Norton 360\Engine64\21.6.0.32\buShell.dll
    CLSID             : {F7CAA2A1-67A2-44BB-B20F-202FD8EB1DAB}
    File Created Time : 10/3/2014 9:10:50 AM
    CLSID Modified Time: 4/5/2014 7:47:01 PM
    Microsoft         : No
    File Extensions   : *, Folder, opensearchfilefolderresult
    File Attributes   : AR
    File Size         : 2,657,632
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : AccExt Class
    Disabled          : No
    Type              : Context Menu
    Description       : Core Sync
    Version           : 1.3.1.405
    Product Name      : CoreSync
    Company           :
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Adobe\Adobe Creative Cloud\CoreSyncExtension\CoreSync_x64.dll
    CLSID             : {2A118EB5-5797-4F5E-8B3D-F4ECBA3C98E4}
    File Created Time : 9/26/2014 2:41:22 PM
    CLSID Modified Time: 11/3/2014 11:56:29 AM
    Microsoft         : No
    File Extensions   : *, Folder, opensearchfilefolderresult
    File Attributes   : A
    File Size         : 1,021,088
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : Acrobat Elements Context Menu
    Disabled          : No
    Type              : Context Menu
    Description       : Adobe Acrobat Context Menu
    Version           : 11.0.0
    Product Name      : Adobe Acrobat Elements
    Company           : Adobe Systems Inc.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat Elements\ContextMenuShim64.dll
    CLSID             : {A6595CD1-BF77-430A-A452-18696685F7C7}
    File Created Time : 9/23/2012 7:43:36 PM
    CLSID Modified Time: 8/23/2013 8:36:01 PM
    Microsoft         : No
    File Extensions   : *, Folder, opensearchfilefolderresult
    File Attributes   : A
    File Size         : 2,288,288
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : ContextMenuHandler Class
    Disabled          : No
    Type              : Context Menu
    Description       : Apple Photostreams UI Shell Extension
    Version           : 7.15.7.1
    Product Name      : iCloud Control Panel
    Company           : Apple Inc.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files\Common Files\Apple\Internet Services\ShellStreams64.dll
    CLSID             : {89D984B3-813B-406A-8298-118AFA3A22AE}
    File Created Time : 8/11/2014 10:53:42 AM
    CLSID Modified Time: 10/31/2014 10:56:07 PM
    Microsoft         : No
    File Extensions   : *
    File Attributes   : A
    File Size         : 1,130,280
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : DropboxExt
    Disabled          : No
    Type              : Context Menu
    Description       : Dropbox Shell Extension
    Version           : 1.0.0.24
    Product Name      : Dropbox
    Company           : Dropbox, Inc.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Users\Paul\AppData\Roaming\Dropbox\bin\DropboxExt64.24.dll
    CLSID             : {FB314ED9-A251-47B7-93E1-CDD82E34AF8B}
    File Created Time : 6/24/2014 5:04:54 PM
    CLSID Modified Time: 7/23/2014 7:36:21 AM
    Microsoft         : No
    File Extensions   : Directory\Background, *, .lnk, Directory, lnkfile
    File Attributes   : A
    File Size         : 164,760
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : GDContextMenu Class
    Disabled          : No
    Type              : Context Menu
    Description       : Google Drive shell extension
    Version           : 1.18.7821.2489
    Product Name      : Google Drive
    Company           : Google
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Google\Drive\contextmenu64.dll
    CLSID             : {BB02B294-8425-42E5-983F-41A1FA970CD6}
    File Created Time : 10/21/2014 5:52:26 PM
    CLSID Modified Time: 11/9/2014 9:18:01 PM
    Microsoft         : No
    File Extensions   : *, .lnk, Directory, lnkfile
    File Attributes   : A
    File Size         : 141,640
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : IEContextMenu Class
    Disabled          : No
    Type              : Context Menu
    Description       : Norton Internet Security Shell Extension Module
    Version           : 21.6.0.32
    Product Name      : Norton Internet Security
    Company           : Symantec Corporation
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Norton 360\Engine64\21.6.0.32\NavShExt.dll
    CLSID             : {FAD61B3D-699D-49B2-BE16-7F82CB4C59CA}
    File Created Time : 10/3/2014 9:10:50 AM
    CLSID Modified Time: 4/5/2014 7:47:02 PM
    Microsoft         : No
    File Extensions   : *, Drive, file, Folder, opensearchfilefolderresult
    File Attributes   : AR
    File Size         : 267,080
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : Incinerator Context Menu Handler
    Disabled          : No
    Type              : Context Menu
    Description       : iolo Incinerator ®
    Version           : 12.5.0.86
    Product Name      : Incinerator
    Company           : iolo technologies, LLC
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Windows\system32\Incinerator64.dll
    CLSID             : {E8215BEA-3290-4C73-964B-75502B9B41B2}
    File Created Time : 6/28/2013 5:46:02 AM
    CLSID Modified Time: 2/12/2014 9:54:22 AM
    Microsoft         : No
    File Extensions   : *, .lnk, Directory, lnkfile
    File Attributes   : A
    File Size         : 2,155,152
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : Incinerator Junction Point Context Menu Handler
    Disabled          : No
    Type              : Context Menu
    Description       : iolo Incinerator ®
    Version           : 12.5.0.86
    Product Name      : Incinerator
    Company           : iolo technologies, LLC
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Windows\system32\Incinerator64.dll
    CLSID             : {9081C77F-9FAF-4551-A878-10A4249CD1FA}
    File Created Time : 6/28/2013 5:46:02 AM
    CLSID Modified Time: 2/12/2014 9:54:22 AM
    Microsoft         : No
    File Extensions   : .SendToIncinerator
    File Attributes   : A
    File Size         : 2,155,152
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : MShellExtMenu Class
    Disabled          : No
    Type              : Context Menu
    Description       : MagicISO Shell Extension Module
    Version           : 5, 3, 0, 198
    Product Name      : MagicISO Shell Extension Module
    Company           : MagicISO, Inc.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\MagicISO\misosh64.dll
    CLSID             : {DB85C504-C730-49DD-BEC1-7B39C6103B7A}
    File Created Time : 10/4/2014 6:41:04 PM
    CLSID Modified Time: 10/4/2014 6:41:05 PM
    Microsoft         : No
    File Extensions   : *, Directory, Folder, opensearchfilefolderresult
    File Attributes   : A
    File Size         : 43,520
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : NVIDIA CPL Context Menu Extension
    Disabled          : No
    Type              : Context Menu
    Description       : NVIDIA Display Shell Extension
    Version           : 344.65
    Product Name      : NVIDIA Shell Extensions
    Company           : NVIDIA Corporation
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Windows\system32\nvshext.dll
    CLSID             : {3D1975AF-48C6-4f8e-A182-BE0E08FA86A9}
    File Created Time : 11/13/2014 11:57:26 AM
    CLSID Modified Time: 11/13/2014 12:03:23 PM
    Microsoft         : No
    File Extensions   : Directory\Background
    File Attributes   : A
    File Size         : 61,640
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : RUShellExt Class
    Disabled          : No
    Type              : Context Menu
    Description       : Revo Uninstaller Pro Extension
    Version           : 1.0.0.3
    Product Name      : Revo Uninstaller Pro Extenison
    Company           : VS Revo Group
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files\VS Revo Group\Revo Uninstaller Pro\RUExt.dll
    CLSID             : {2C5515DC-2A7E-4BFD-B813-CACC2B685EB7}
    File Created Time : 6/28/2013 8:26:20 PM
    CLSID Modified Time: 6/28/2013 8:26:21 PM
    Microsoft         : No
    File Extensions   : .exe, .msi, exefile, Folder, opensearchfilefolderresult
    File Attributes   : A
    File Size         : 123,120
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : Spybot-S&D Explorer Integration
    Disabled          : No
    Type              : Context Menu
    Description       : Windows Explorer context menu integration
    Version           : 2.3.39.113
    Product Name      : Spybot - Search & Destroy
    Company           : Safer-Networking Ltd.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Spybot - Search & Destroy 2\SDECon64.dll
    CLSID             : {44176360-2BBF-4EC1-93CE-384B8681A0BC}
    File Created Time : 11/2/2014 6:40:12 PM
    CLSID Modified Time: 11/2/2014 6:40:13 PM
    Microsoft         : No
    File Extensions   : *, Folder, opensearchfilefolderresult
    File Attributes   : A
    File Size         : 484,304
    .NET Extension    : No
    Digital Signature :
    ==================================================
    ==================================================
    Extension Name    : STKContextMenu Class
    Disabled          : No
    Type              : Context Menu
    Description       : Send to Kindle Context Menu dll
    Version           : 1,0,1,240
    Product Name      : Send to Kindle
    Company           : Amazon.com, Inc.
    My Computer       : No
    Desktop           : No
    Control Panel     : No
    My Network Places : No
    Entire Network    : No
    Remote Computer   : No
    Filename          : C:\Program Files (x86)\Amazon\SendToKindle\stkContextMenu_240.dll
    CLSID             : {90DD7445-E924-4c6e-92AC-01F8C3A7E0C7}
    File Created Time : 11/4/2014 1:40:41 PM
    CLSID Modified Time: 11/4/2014 1:40:41 PM
    Microsoft         : No
    File Extensions   : AllFilesystemObjects
    File Attributes   : A
    File Size         : 255,808
    .NET Extension    : No
    Digital Signature :
    ==================================================

    Hi,
    In addition to above suggestions, please help to collect crash dump file for explorer.exe, let's see what exacted file cause your issue:
    First enable app crash dump collection by copying following words into notepad, saving it as dump.reg and importing it:
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\localdumps\explorer.EXE]
    "DumpFolder"=hex(2):63,00,3a,00,5c,00,63,00,72,00,61,00,73,00,68,00,64,00,75,\
      00,6d,00,70,00,73,00,00,00
    "DumpCount"=dword:00000010
    "DumpType"=dword:00000001
    "CustomDumpFlags"=dword:00000000
    Then, open explorer to repro the issue. If crash issue appeared, please find the crashdump file under c:\.
    To further help you, please upload this file into Onedrive and shared the link here.
    Kate Li
    TechNet Community Support

  • Context menu's in Alv Report (Grid)

    hello,
    what i have done- i have created a ALV report  by using the function modlue REUSE_ALV_GRID_DISPLAY.
    what i want-  When  user clicks with Right mouse button on some cell.
                              context menu should get displayed. a list of menu should appear  then user can select one of these options        and   eventually i'll on user command.
    however i know the concept of context menu's and i have created context menu on screen elements in module pool.
    but i have no idea whether these menu's can be created on ALV Grid.(simple ALv Grid----not ABAP OOPS)

    check the program BCALV_GRID_06, it gives a demo of context menu functionalty,
    but it uses cl_gui_alv_grid

  • ALV grid disable right click options

    Hi experts,
    Iam working on <b>normal</b> ALV grid.
    In the output of the ALV, if we click right click,
    we can see 'Cut', 'Copy text', 'Insert with Overwirte' options.
    How can i disable(or remove) these 3 options?
    Pls give me suggestions
    Reward guaranteed,
    thanks
    kaki

    Hello Kaki
    You have to handle event <b>CONTEXT_MENU_REQUEST</b> (of class CL_GUI_ALV_GRID). The following sample report shows how to do that:
    *& Report  ZUS_SDN_ALV_CONTEXT_MENU_1
    *& Flow logic of screen 100 (no screen elements; ok_code = GD_OKCODE)
    *&    PROCESS BEFORE OUTPUT.
    *&      MODULE STATUS_0100.
    *&    PROCESS AFTER INPUT.
    *&      MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_alv_context_menu_1.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender,
          handle_context_menu_request FOR EVENT context_menu_request
                                                     OF cl_gui_alv_grid
            IMPORTING
              e_object
              sender,
          handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING
              e_ucomm
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
      METHOD handle_context_menu_request.
    *   define local data
        DATA: lt_fcodes    TYPE ui_funcattr,
              ls_fcode     TYPE uiattentry,
              ls_func      TYPE ui_func,
              lt_func      TYPE ui_functions.
        "   Inactivate all standard functions
        CALL METHOD e_object->get_functions
          IMPORTING
            fcodes = lt_fcodes.
        LOOP AT lt_fcodes INTO ls_fcode.
          ls_func = ls_fcode-fcode.
          APPEND ls_func TO lt_func.
        ENDLOOP.
        e_object->disable_functions( lt_func ).
    "   Add new functions
        e_object->add_separator( ).
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'XD03'
            text  = 'Call Transaction'.
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'DETAILS'
            text  = 'Display Details'.
      ENDMETHOD.                    "handle_context_menu_request
      METHOD handle_user_command.
    *   define local data
        DATA:
          ls_knb1   TYPE knb1,
          ls_row    TYPE lvc_s_row,
          ls_col    TYPE lvc_s_col.
        "   NOTE: in case of CL_GUI_ALV_GRID the functions of a context menu
        "         are handled in method USER_COMMAND.
        CHECK ( e_ucomm = 'XD03'      OR
                e_ucomm = 'DETAILS' ).
        CALL METHOD sender->get_current_cell
          IMPORTING
            es_row_id = ls_row
            es_col_id = ls_col.
        CASE e_ucomm.
          WHEN 'XD03'.
            READ TABLE gt_knb1 INTO ls_knb1 INDEX ls_row-index.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'DETAILS'.
      "       NOTE: only for the sake of simplicity the event handler method
            "             is called
            CALL METHOD lcl_eventhandler=>handle_double_click
              EXPORTING
                e_row  = ls_row
                sender = go_grid1.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_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.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click         FOR go_grid1,
        lcl_eventhandler=>handle_context_menu_request FOR go_grid1,
        lcl_eventhandler=>handle_user_command         FOR go_grid1.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          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.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          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.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
      Uwe

  • TO enable the menu button in ALV Grid Display

    Hi Mates,
    I have a peculiar problem while doing ALV Grid display for screens.
    In the main Screen i have Three coloumns.The 1st coloum will interacted
    next screen 101 and 2nd coloum will interacted to screen 102.
    Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
    101 and same button is disabled in screen 102.
    But the code semms to be fine .
    Below i have pasted the code and please have a look and help to come out of this cris.
    My Code  :
    FORM CREATE_ALV_GRID USING R_SCREEN.
      DATA: LS_LAYOUT TYPE LVC_S_LAYO,
      ITAB_FUNCTIONS     TYPE UI_FUNCTIONS.   "MHTK903257(+)(add)
      CASE R_SCREEN.
    *--> SCREEN 9000
        WHEN C_SCREEN_9000.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' 'WADAT'     'Due date'(004)  'X' 'D' ' ' ' ' ' ' 'C100',
    *'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500',  "MHTK903257(-)
    'ITAB_OVERVIEW' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
    'ITAB_OVERVIEW' 'EST_TO'    'Estim TO'(030)    ' ' 'I' ' '  ' ' ' ' 'C500'.
          LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'.  "MHTK903418
            ENDLOOP.
          LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1000
            EXPORTING
              I_PARENT  = PT_DOCK_1000.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1000
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_OVERVIEW
              IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
    *--> SCREEN 9100
        WHEN C_SCREEN_1100.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETIAL' 'WAUHR'     'Due time'(007)  ' ' 'T' ' ' 'X' ' ' 'C100',
    'ITAB_DETAIL' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    'ITAB_DETAIL' 'EST_TO'    'Estim TO'(030)   ' ' 'I' ' '  ' ' ' ' 'C500'.
       CLEAR ITAB_INB_LOC.
        LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
             CHECK SY-SUBRC EQ 0.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
         ENDLOOP.
         CLEAR: ITAB_STORAGE_TYPE.
          LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
            CHECK SY-SUBRC EQ 0.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1100
            EXPORTING
              I_PARENT  = PT_DOCK_1100.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1100
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_DETAIL
              IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
    screen 1300 TO detail.
    *--> SCREEN 9300
        WHEN C_SCREEN_1300.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_TO2' 'TANUM' 'TO'(020)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_TO2' 'NLPLA' 'Location'(021) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'LETY1' 'SUT'(013)  ' ' 'C'  ' ' ' ' ' ' 'C500',
    'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    *'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1300
            EXPORTING
              I_PARENT  = PT_DOCK_1300.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1300
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_TO2 BY TANUM VBELN POSNR.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_TO2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
    screen 9400 Pre Processing detail.
    *--> SCREEN 9400
        WHEN C_SCREEN_9400.          "MHTK903418(BEgin Of change)
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' '   'C' ' '  ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' '   'C' ' '  ' ' ' ' 'C500'.
    *'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    **'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1400
            EXPORTING
              I_PARENT  = PT_DOCK_1400.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1400
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_PRE_PROC2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1400.  "MHTK903418(End of change)
      ENDCASE.

    Hi
    U copy from standard program and paste ur report ...It will work..'
    Regards:
    Prabu

  • How do I create a context menu in the new ALV object model (cl_salv_table)?

    Hi,
    Does anyone know how to create a context menu (right click on line or field) in the new ALV object model (class CL_SALV_TABLE)?
    Thanks in advance
    Keld Gregersen
    PS: In the past we could use event CONTEXT_MENU_REQUEST in class CL_GUI_ALV_GRID, so it must be possible

    I don't think there's "any such animal" in the new class. I'm not 100% certain however but the new class is only useful for fairly simple display only type grids.
    There's no edit capability either.
    I'd stick with cl_gui_alv_grid until there's some decent extra functionality in the cl_salv_table class.
    It's fine for quick "bog standard" displays as it doesn't need a field catalog or any screens to be created by the user or developer  - but you pay a price for that in limited fnctionality.
    Cheers
    jimbo

  • How to create Context Menu for Full Screen ALV

    Dear Experts,
    Please tell me the procedure to create Context Menu for ALV Grid (full screen ALV using SLIS ).
    Regards
    Arnab

    Hi,
    Check the demo program BCALV_GRID_06

  • ALV: Right Button Click and Context Menu

    Hi Experts,
    I have to implement an ALV which should act on a right button click and show a context menu.
    Is this possible? I found only events for "on_double_click" or "on_link_click" and is it possible to show a context menu?
    Thanks in advanced.
    Best regards,
    Markus

    Hello Markus
    The relevant events are:
    CONTEXT_MENU_REQUEST
    USER_COMMAND
    Have a look at my sample report ZUS_SDN_ALV_CONTEXT_MENU_1.
    *& Report  ZUS_SDN_ALV_CONTEXT_MENU_1
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="910750"></a>
    *& Thread: ALV: Right Button Click and Context Menu
    *& Flow logic of screen 100 (no screen elements; ok_code = GD_OKCODE)
    *&    PROCESS BEFORE OUTPUT.
    *&      MODULE STATUS_0100.
    *&    PROCESS AFTER INPUT.
    *&      MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_alv_context_menu_1.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender,
          handle_context_menu_request FOR EVENT context_menu_request
                                                     OF cl_gui_alv_grid
            IMPORTING
              e_object
              sender,
          handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING
              e_ucomm
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
      METHOD handle_context_menu_request.
    *   define local data
        DATA: lt_fcodes    TYPE ui_funcattr,
              ls_fcode     TYPE uiattentry,
              ls_func      TYPE ui_func,
              lt_func      TYPE ui_functions.
        "   Inactivate all standard functions
        CALL METHOD e_object->get_functions
          IMPORTING
            fcodes = lt_fcodes.
        LOOP AT lt_fcodes INTO ls_fcode.
          ls_func = ls_fcode-fcode.
          APPEND ls_func TO lt_func.
        ENDLOOP.
        e_object->disable_functions( lt_func ).
    "   Add new functions
        e_object->add_separator( ).
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'XD03'
            text  = 'Call Transaction'.
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'DETAILS'
            text  = 'Display Details'.
      ENDMETHOD.                    "handle_context_menu_request
      METHOD handle_user_command.
    *   define local data
        DATA:
          ls_knb1   TYPE knb1,
          ls_row    TYPE lvc_s_row,
          ls_col    TYPE lvc_s_col.
        "   NOTE: in case of CL_GUI_ALV_GRID the functions of a context menu
        "         are handled in method USER_COMMAND.
        CHECK ( e_ucomm = 'XD03'      OR
                e_ucomm = 'DETAILS' ).
        CALL METHOD sender->get_current_cell
          IMPORTING
            es_row_id = ls_row
            es_col_id = ls_col.
        CASE e_ucomm.
          WHEN 'XD03'.
            READ TABLE gt_knb1 INTO ls_knb1 INDEX ls_row-index.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'DETAILS'.
      "       NOTE: only for the sake of simplicity the event handler method
            "             is called
            CALL METHOD lcl_eventhandler=>handle_double_click
              EXPORTING
                e_row  = ls_row
                sender = go_grid1.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_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.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click         FOR go_grid1,
        lcl_eventhandler=>handle_context_menu_request FOR go_grid1,
        lcl_eventhandler=>handle_user_command         FOR go_grid1.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          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.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          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.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
      Uwe

  • ALV: Context Menu: Standard Functions: Copy to clipboard: How to throw?

    How can I throw the standard function "copy to clipboard"
    CL_GUI_ALV_GRID=>MC_FC_LOC_COPY <&LOCAL&COPY>
    If I try to throw it with the method
    <ref to cl_gui_alv_grid>->set_user_command(
    EXPORTING i_ucomm = cl_gui_alv_grid=>mc_fc_loc_copy )
    , it doesn't work.
    This standard function is a feature of every context menu of an ALV grid control.
    It is possible to inactivate it via the method
    <ref to cl_gui_alv_grid>->disable_functions
    , so it must be the right function code.
    I visited that the "application server is working"-logo
    (the blue waving-water-picture in the upper right corner of
    every SAP GUI window) doesn't move if I use this function via
    context menu.
    So possibly there is no server-turn-around between the
    presentation server an the application server when using this
    function. The application server only catches an event
    cl_gui_alv_grid_base=>evt_copy_clipboard_failed <34>
    on copy malfunction.

    Hi,
    there is a simple method to put something to the clipboad. I have done it a couple of times and it works fine.
    Data Definitions:
    DATA: BEGIN OF clippboard OCCURS 0,
            line(172) TYPE c,
          END OF clippboard.
    cnt1 type i.
    ABAP Example:
              refresh clippboard.
              append xx_outtab_pos-prodh to clippboard.
              CALL METHOD cl_gui_frontend_services=>clipboard_export
                IMPORTING
                  data = clippboard[]
                CHANGING
                  rc   = cnt1.
    In this example the content of the field xx_outtab_pos-prodh has been put to the clipborad and can be inserted anywhere by pressing Ctrl/V.
    If you want to restore it from the clipboard, there is a m
    ethod called cl_gui_frontend_services=>clipboard_import. It works the same as the clipboard_export.
    Best regards
    Peter

Maybe you are looking for

  • Missing 3d tools in Photoshop CS6 extended

    Hi everyone, I thought that I would seek help here before I endure the agony of Adobe technical help. I just installed the upgrade to CS6 Design and Web Premium yesterday. Received my email for the free upgrade yesterday morning and all went fine for

  • IMac Help - won't start up in OSX, starts to text...

    I was wiping my hard drive so that I could give away my old 20" white iMac G5. It worked fine the first time using the OSX Installation disk, but someone told me I should do it several times to be sure to remove all the data in the binary. So I did i

  • Error when uploading book to Blurb from LR 4.1 and after 4.3 update

    I have been trying for over 24 hours to upload a 75 page book successfully from LR 4.1, and also after updating to LR 4.3!  I was initially able to upload to pdf format in LR 4.1, then it stopped working.  Book upload to Blurb took a very long time t

  • DFM 3.2.0 E-mail Notification

    Hi, I don't know if i missed this somewhere, if i did, kindly refer me to the right location for the soluiton. 1. I just installed LMS 3.2 on windows 2003 Server with DFM 3.2.0 AND funny enough i get the same challenge as i use to in LMS 3.1. DFM sen

  • R/3 source system creation error(Idoc is missing)

    Hi expert's. i have created an r/3 source system in BI 7. but it's showing error when i am activating it. error as follows. 1. Basic type ZSMA087 does not exist     EA     447      2. Incorrect IDoc type ZSDF085 in the ALE definition of the source sy