In ALV display model ,how to accept the ENTER key event?

Dear All,
I have used ALV by  GRID DISPLAY model ,not class model.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'SET_PF_STATUS'
      i_callback_user_command  = 'USER_COMMAND'
      i_structure_name         = 'T_ITAB'
      is_layout                = gs_layout
      it_fieldcat              = t_fieldcat[]
      i_default                = 'X'
      i_save                   = 'A'
    TABLES
      t_outtab                 = t_itab
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
For example :
IN ALV DISPLAY, there are two fields, one is MATNR, the other is MAKTX.
When user input the material value in MATNR field and press ENTER, then ALV can run my code to select the MAKTX into MAKTX field and display it synchronization.
Now I have realized update edit in ALV,but I found only I double click ALV row, then the MAKTX can update.
Please give me help,
Thanks
Sun

This is the document written by me on Interactive ALV.. hope this maybe helpful for u..
When an Interactive Report is needed in Classical Display, we go for AT LINE-SELECTION. But when the same is needed in ALV Display, this method won't work. Instead, we need to use other way which is explained below:
We use REUSE_ALV_GRID_DISPLAY for ALV Display. Now, normally we call that FM in the following way:
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program      = 'PROGRAM_NAME'
            it_fieldcat             = tb_fieldcat
       TABLES
            t_outtab                = tb_output.
When it is needed to get an Interactive ALV, call the same FM in the following manner:
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program      = 'ZTEST75599_1'
            it_fieldcat             = tb_fieldcat
            i_callback_user_command = 'USER_COMMAND'
       TABLES
            t_outtab                = tb_output.
Now, in the report, create a subroutine with the name USER_COMMAND as follows:
FORM user_command  USING p_ucomm    LIKE sy-ucomm
                         p_selfield TYPE slis_selfield.
  CASE p_ucomm.
    WHEN '&IC1'.   " &IC1 - SAP standard code for double-clicking
Based on the requirement, write the logic                          *
  ENDCASE.
ENDFORM.
No need to call the subroutine as PERFORM user_command. This will be takane care by REUSE_ALV_GRID_DISPLAY. We need to just write the subroutine in the report. That suffices.
Some more useful points for Interactive ALV:
1. If Hotspot is needed, then that should be done by declaring hotspot (one field in slis_t_fieldcat_alv) as 'X' in tb_fieldcat which is of type slis_t_fieldcat_alv. When hotspot is active, single click will be enough or else you should double click on the output data.
2. In Classical Display, when it is needed to read the record on which we double clicked, we do that in following way:
   AT LINE-SELECTION.
       GET CURSOR LINE wf_line. " wf_line gives the line number on which it has been clicked
         READ LINE wf_line OF CURRENT PAGE.
  But this won't work for ALV. Instead, the following logic can be used:
FORM user_command  USING p_ucomm    LIKE sy-ucomm
                         p_selfield TYPE slis_selfield.
  CASE p_ucomm.
    WHEN '&IC1'.   " &IC1 - SAP standard code for double-clicking
      READ TABLE tb_output INTO wa_output INDEX p_selfield-tabindex.
      IF sy-subrc EQ 0.
Based on the requirement, write the logic                          *
      ENDIF.
  ENDCASE.
ENDFORM.

Similar Messages

  • How to press the enter key then execution Form?

    Using:SAP B1 UI Form for C#
    How to press the enter key then execution Form?
    thanks
    Edited by: JackyChang on Jul 5, 2010 5:35 AM

    Hi JackyChang,
    Use the SendKeys method.
    VB Sample
    oApplication.SendKeys("{ENTER}")
    Regards,
    Vítor Vieira

  • Help!! I can't find how to get the enter key......

    Hi...
    I am information technology student. I am now first year second semester
    I need help because I don't know how to catch the enter key in JTextField.
    I want to submit the form when user press the enter key in JTextField....
    I only can find KeyEvent.VK_ENTER ( actually that is not what I want)
    Another thing is
    "How to add a JMenuItem into a JMenuItem...."
    I want to do like this.... When you click the "Tools bar" in View item.. another menu comes out...???"
    He he... I hope you all can understand what I mean.. because I know my english is not so good... because I am from Myanmar.
    for(int i=0;i<1;i--)
    System.out.println("Thanks A lot");
    Thu Rein Nyo...
    You also can reply by e-mail.. thanks

    Hi...
    I am information technology student. I am now first
    year second semester
    I need help because I don't know how to catch the
    enter key in JTextField.it can be done easily by adding an actionListener to the JTextField. So when u enter something in the field and press enter the event will be caught and the code which u write in that will get executed.
    Eg:
    JTextField.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    Your code comes here.
    Another thing is
    "How to add a JMenuItem into a JMenuItem...."
    I want to do like this.... When you click the "Tools
    bar" in View item.. another menu comes out...???"I think you are gettin confused with JMenu and JMenuItem. What u need to do is create a JMenu add another JMenu to it and add JMenuItems to it.. and ur problem will be solved.
    He he... I hope you all can understand what I mean..
    because I know my english is not so good... because I
    am from Myanmar.
    for(int i=0;i<1;i--)
    System.out.println("Thanks A lot");
    Thu Rein Nyo...
    You also can reply by e-mail.. thanks

  • HOW to simulate the enter key???

    Hi , I have a jTable ,and i want that by leaving a specific
    cell ,to perform the same action that the enter key does!
    when im leaving my specific cell the following function is being called:
    public void editingStopped(ChangeEvent e) {
    //here I want to simulate the enter-key's action
    HOW to simulate the enter key???
    10x in advance
    Nir.
    p.s. My initial problem was that when i left my specific
    cell (the cell is editable combo box), an edited words
    which were written by me vanished , and when i get back to that cell the edited word showed again!!!
    when i pressed the enter key the edited word were stable in the cell!!!
    when I chose a word from the combo evrything was ok!!
    so if any one can solve me that problem ill be appreciate.
    thanks Nir

    yourActionListener.actionPerformed(new ActionEvent(yourCell))
    I am not sure about the constructor of actionevent.
    you could try if setText(getText()) produces a good result

  • How to disable the F4 Key Event?

    Hi Guys,
    I have written my own FocusManager which allows me to traverse through disabled components. If a user presses the F4 key while the focus is in a disabled JComboBox, the popup becomes activated. Is there any way deactivate the F4 keystroke?
    I have tried:
    event.consume();
    combobox.setPopupVisible(false);
    combobox.hidePopup();
    I also read that F4 is a low-level event maintained by Windows. Is this true? Is there no alternative?
    -Sri :)

    To anyone who may be interested:
    I have tried all available solutions:
    1. hidePopup()
    2. setPopupVisible(false)
    3. unregistering the F4 key event
    4. catching the F4 key event and snubbing it
    I have had no luck with the above solutions. It leads me to believe that F4 key is registered under the windows environment and it is a low-level event.
    -Sri :)

  • How to make the TAB Key Event called

    Hi ,
    I want to make the tab key called twice when I hit on a button. It should jump to the next 2 cell.
    Thanks.
    DT

    Here's a couple related threads
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=583877
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=712386
    I'd also suggest exploring the Search Forums available on the left,
    which is how I found those threads:
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=focus+traversal+tab+text&subCat=siteforumid%3Ajava57&site=dev&dftab=siteforumid%3Ajava57&chooseCat=javaall&col=developer-forums

  • How to fix the enter key not opening sites in the URL box?

    Ever since the update to 10.0.1 pressing enter to open a site in the URL entry box doesn't work. Anyone know why? I have to click the arrow key to the side of the URL pannel, and enter key works as normally everywhere.
    It is INCREDIBLY annoying.

    Try disable "AVG Safe Search", that should work.

  • How to make the Enter key close a JDialog?

    I have a dialog box which extends JDialog. I have several buttons and other components, but I would like to make the OK button the one which reacts when the user presses Enter. Are there any specific methods to get this behaviour?

    dialog.getRootPane().setDefaultButton(okButton);

  • How to make the enter key act as a button?

    I have a CREATE and UPDATE button and I would like the user just to be able to press enter and perform the create or update as appropriate as if the button was pressed.
    Thanks in advance for your help.
    Greg

    Greg,
    Use the following so you don't loose the delete message:
    <script type="text/javascript">
    //<![CDATA[
       htmldb_delete_message='"DELETE_CONFIRM_MSG"';
       document.onkeypress = keyHandler;
       function keyHandler(e) {
          var keycode;
          var id = $v('PXX_ID');
          if(window.event){keycode = window.event.keyCode;
          }else if(e){keycode = e.which;
          }else{return true;}
          if (keycode == 13){
             if (id) {
                doSubmit('UPDATE');
             } else {
                doSubmit('INSERT');
             return false;
          }else{
             return true;
    //]]>
    </script>What is the name of your primary key item?
    Are you getting any JavaScript errors?
    Did anything happen?
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    http://sourceforge.net/projects/plrecur

  • Remove the Enter key binding from a JPopupMenu

    Hi,
    Does anyone know how to remove the Enter key binding from a JPopupMenu?
    So when the popupmenu is showing and you type Enter, nothing should happen and the menu should stay where it is.
    I have tried:
    popup.getActionMap().put("enter", null);
    popup.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");but the popup always disappears.
    Any ideas?
    Cheers,
    patumaire

    First of all, that is not the proper way to "remove" a key binding. Read the Swing tutorial on [How to Use Key Bindings|http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html#howto] for more information.
    However, we still have a couple of problems:
    a) the input map is dynamically built as the popup menu is displayed
    b) the input map is built for the root pane, not the popup menu
    The following seems to work:
    popup.show(...);
    InputMap map = getRootPane().getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW);
    map.put(KeyStroke.getKeyStroke("ENTER"), "none");
    KeyStroke[] keys = map.allKeys();
    for (int i = 0; i < keys.length; i++)
         KeyStroke key = keys;
         Object action = map.get( key );
         System.out.println(key + " : " + action);

  • Customizing the "enter" key

    Does anyone know how to reset the "enter" key (to the right of the right-hand "command" key) on the iBook G4 keyboard so that it functions as a second "control" key? I've heard that this is possible, but the Keyboard & Mouse pane in System Preferences seems to be no help with this. I've just begun using emacs, which requires the "control" key all over the place, and it would be really nice to have "control" keys on both sides of the keyboard.
    Thanks,
    Nick

    Hi Nick,
    that's excellent. However, please keep in mind that this app is a "hack" as much as the "handmade" one in the link I gave you. Therefore you should always check the developers website for any known incompatibilities before you perform any system upgrade or things may go haywire.
    Take care,
    -Petra

  • I am going to buy myself a MacBook Pro in the near future and was wondering if the new Retina Display model would be worth the extra cash. I will mostly be doing photo/video/music editing.

    I am going to buy myself a MacBook Pro in the near future and was wondering if the new Retina Display model would be worth the extra cash. I will mostly be doing photo/video/music editing.

    if you're not in a big rush - why not hold off until Adobe and Microsoft releases an update to support the Retina Screen.
    Don't get me wrong - the Macbook Retina is a good and videos look great - but when it comes to Photoshop, it's a little blurry and the fonts in Excel and Word is pretty blurry too.....I own one....
    In any event, if it's something you can live with - then by all means - go for it.....
    Otherwise - get the non Retina Macbook Pro - it's cheaper, and it's user upgradeable in both RAM and Hard Drive.
    Good luck.

  • How to capture the enter even in alv

    hi, experts
    my requirement is that:
    i create an alv ,set it response to the enter even, if the content has changed, a class will be response it .
    the code like below:
        CALL METHOD g_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CREATE OBJECT g_event_receiver.
        SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
    but if the alv content has no changed, nothing will be happen, i want to do something such as popup a message even if the content has not changed and user press enter.
    pls help me ,thanks

    I don't think this is possible.
    may be you can do is
    during the enter key is pressed
        call method cl_gui_cfw=>set_new_ok_code
                 exporting
                     new_code = 'DUMMY'.
    and in the user command
    if ok_code eq 'DUMMY'
        call method g_grid->check_changed_data
          importing
            e_valid = v_valid.
        if v_valid ne c_x.
          call function 'POPUP_TO_CONFIRM'
            exporting
              titlebar              = text-025
              text_question         = text-026
              text_button_1         = text-027
              text_button_2         = text-028
              display_cancel_button = ' '
            importing
              answer                = v_answer.
    endif.
    a®s
    Edited by: a®s on Jul 2, 2008 10:37 AM

  • How to solve the "Enter" when include a file?

    Hello everyone!
    I want to add the following line in JSP:
    <%@ include file="gris.txt" %>
    But the JSP page can't identify the "Enter" key so that it shows the file as a string which is meaningless.
    Who can help me to show it normally?
    And I could show a string including "Enter" symbal normally but on the other hand I don't know how to read a file as a string.
    Anyone could help me?Thanks a lot!
    PS: The data in the file just like a table, and it's better that someone could give me a method to show it as a table.

    When I had a problem like this, I created a Servlet that translated the text to HTML:
    package servlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.html.*;
    public class TextDisplayServlet extends HttpServlet
                                                                  throws ServletException, IOException
      public void doGet(HttpServletRequest request, httpServletResponse response)
        String toRead = request.getParameter("file");
        if (null != toRead)
          File file = new File(toRead);
          if (file.exists())
            FileInputStream in = new FileInputStream(file));
            response.setContentType("text/html; charset=UTF-8");
            response.setBufferSize(5120);
            PrintWriter out = response.getWriter();
            //HTML to set title and make text display as written in file (the <pre> tag)
            //Not sure how puttong the <head></head> in here will afect the include...
            out.printl("<html><head><title>"+toRead+"</title></head><body><pre>");
            int ch = -1;
            while ((ch = in.read()) != -1)
              // These line escapes possible HTML tags in your file, so > and < get displayed correctly...
              if ('<' == ch) out.print("<");
              else if ('>' == ch) out.print(">");
              else out.print((char)ch);
            out.close();
            in.close();
    }The web.xml has the following servlet mappings:
      <servlet>
        <servlet-name>File_Servlet</servlet-name>
        <servlet-class>servlets.TextDisplayServlet</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>File_Servlet</servlet-name>
        <url-pattern>/File</url_pattern>
      </servlet-mapping>The I call the servlet like this (as an example)
    /File?file="C:\Full\Path\To\theFile.txt (escape \ to \\ in java string....)
    In the case above, I made it able to read any file in the file system, in exchange I have to use the full path to the file. If you want to limit the ability to read files to the context of your web-app, and as such only have to use relative paths, you could change the way you make your input stream:
       * replace this *
      File file = new File(toRead);
      if (file.exists())
        FileInputStream in = new FileInputStream(file));
       *   with this  *
      InputStream inStream = getServletContext().getResourceAsStream(toRead);
      if (null != inStream)
        InputStreamReader in = new InputStreamReader(inStream);
      }

  • как вернуть текущий ключ how to return the current key

    подскажите как вернуть текущий ключ виндовс.так как диска востановления нет
    tell me how to return the current key vindovs.tak as repairing disk no

    Hi Xolostjak,
    Welcome to the HP Community, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    It sounds like you are looking to to restore your original version of Windows because the Recovery Disk wasn't working. Is that correct? Since this is an English forum can you please respond back in English.
    I will be happy to help but I need some more information. I will need to know what your operating system is? What is the product number for your notebook?
    Thank you,
    Please click “Accept as Solution ” if you feel my post solved your issue.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Thank you,
    BHK6
    I work on behalf of HP

Maybe you are looking for

  • Message Driven Bean Reference Problem

    Hi, I have problems a MDB referencing other beans, I am getting Class Cast exception whenever my MDB tries to use narrow operation after the lookup is done. The Code is as follows: public void ejbCreate () throws CreateException { log("ejbCreate call

  • Transaction ME21N and ME22N - blocking orders

    We're implementing SAP ECC 6.0. We had implemented the user exit USEREXIT(EXIT_SAPMM06E_013). This user exit checks the order condition once you had saved the order nad it blocks all the order positions. For some days this user exit has worked out wi

  • Vendor Creation from external system

    Hi there, I have a requirement from the user: An external system is used for vendor registration. The current process is where users need to create the vendor manually in SAP as there is no integration between the systems. We can not make amendments

  • How do I replicate a desktop screen or have a choice of filters for one screen?

    I have built a reasonably elaborate desktop screen in Lightswhitch and I would like to use it with different filters. For instance, lets say I have an Order entity with Fields 1-100. I would like to be able to launch my elaborate screen where Field1

  • Photo recovery when iPhoto crashed while deleting imported images

    I was importing images into iPhoto when it finished and asked if I wanted to delete originals or not. I chose to delete originals. As it was finishing the import/deleting the images, iPhoto crashed. I could see the images right before the crash. Upon