Create trigger to execute report upon pressing enter

Hi,
I have a screen where users input a vendor number and then have to click the execute button to view the report. I want to create some sort of trigger so when the user presses the enter button the program will execute instead of having to press the execute button or F8. Does anyone know how to create this event? Thanks for your help!
Shane

Hi,
You need to check sy-ucomm at selection screen.If its  for "enter" then execute the program.Same as the execute button does.
I am not sure if sy-ucomm gets captured there, It should be blank.Just try once.
Edited by: sap_wiz on May 26, 2011 10:39 AM

Similar Messages

  • Execute (F8) taking place upon pressing 'Enter' key

    Hi,
    I have developed two custom screens in separate programs. The second screen has been assigned a transaction code and is called from the first screen upon user command. Input in screen 1 is in the form of an IO field that takes two-character codes. The appropriate transaction is called depending on the value of the code input by the user.
    Before the second program is called (using call transaction statement), inputs are error checked using input checking modules. Pressing the enter key does not cause the second program to be called, which is as it should be. Only upon execution (F8) is the second program called. Once the second program has been called and exited (using leave program statement) it goes back to the first program (screen). This is alright. The issue is that now when the enter key is pressed, the transaction for the second program is called again. I don't want this to happen. This should happen only upon execute, not from pressing Enter. If I input a different value in the input field at this point then press enter it doesn't execute, which is ok. The issue I have described occurs only in the case of calling a transaction, exiting the second screen which is called (which takes you back to the first screen) and pressing Enter.
    My code:
    TABLES: ZSH_PROCS.
    Global data declarations.
    DATA: OK_CODE LIKE SY-UCOMM,
          PROC_INFO LIKE ZSH_PROCS,
          PROC_INPUT TYPE ZSH_DE_PN.
    Screen fields - Used in screen: '9500'.
    DATA: TBX_PROCESS    TYPE ZSH_DE_PN,
          LBL_PROC_STXT  TYPE ZSH_DE_PD.
    Modules
    MODULE INIT_9500 OUTPUT.
       SET PF-STATUS 'ZSH_GUIS_MAIN'.
       SET TITLEBAR  'ZSH_TITL_MAIN'.
    ENDMODULE.
    MODULE EXIT_9500 INPUT.
       OK_CODE = SY-UCOMM.
       CASE OK_CODE.
          WHEN 'BACK' OR 'EXIT' OR 'CANCEL' OR 'BTNEXIT'.
             LEAVE PROGRAM.
       ENDCASE.
    ENDMODULE.
    MODULE PROC_CHECK_9500 INPUT.
       PROC_INPUT = TBX_PROCESS.
       TRANSLATE PROC_INPUT TO UPPER CASE.
       SELECT SINGLE * FROM ZSH_PROCS INTO CORRESPONDING FIELDS OF
                                              PROC_INFO WHERE PRNAM EQ
                                              PROC_INPUT.
       IF SY-SUBRC NE 0.
          CLEAR: TBX_PROCESS,
                 LBL_PROC_STXT.
          MESSAGE E008(ZSH_MSGC).
       ELSE.
          LBL_PROC_STXT = PROC_INFO-PDESC.
       ENDIF.
    ENDMODULE.
    MODULE USER_COMMAND_9500 INPUT.
       OK_CODE = SY-UCOMM.
       CASE OK_CODE.
          WHEN 'EXECUTE'.
             CALL TRANSACTION PROC_INFO-TCODE.
       ENDCASE.
    Screen flow logic:
    PROCESS BEFORE OUTPUT.
       MODULE INIT_9500.
    PROCESS AFTER INPUT.
       MODULE EXIT_9500 AT EXIT-COMMAND.
       CHAIN.
          FIELD: TBX_PROCESS,
                 LBL_PROC_STXT.
          MODULE PROC_CHECK_9500.
       ENDCHAIN.
       MODULE USER_COMMAND_9500.
    Tha above code is for the first program (screen). Help is greatly appreciated. Thanks.
    Regards
    Edited by: Khan Awkhan on Jul 22, 2008 6:34 AM

    Hi,
    Clearing the ok_code should solve your problem.
    Try this:
    MODULE INIT_9500 OUTPUT.
    SET PF-STATUS 'ZSH_GUIS_MAIN'.
    SET TITLEBAR 'ZSH_TITL_MAIN'.
    " Clearing the ok code
    CLEAR OK_CODE. 
    ENDMODULE.
    Regards,
    Wajid Husssain P.

  • Execute query by pressing Enter

    hi all
    i created 5 text items and side by side of these 5 text items i created more 5 text items i want when i enter numeric value in text item and next to this item it display string values like, i tried to use execute_query in Key_Enter trigger
    9999---------------------after pressing enter key it display in next to item ------"Green Color"
    1000---------------------Yellow ....
    sarah

    sarah,
    There is no need to Call Sir, as every one is treated same, and helping each other. So its better to avoid calling Sir.
    And you have to write the SELECT INTO statement in KEY-NEXT-ITEM trigger, not in KEY-ENTER. But the KEY-NEXT-ITEM trigger will not fire if you use mouse to navigate to another item. So its better to use WHEN-VALIDATE-ITEM trigger.
    Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Trigg the 'Query' button when pressing 'Enter' on the keyboard

    I have a form with 2 buttons, 'query' and 'reset'.
    I would like that the 'query' button is triggerd (pressed) when the user presses 'Enter' on the keyboard. In regular html I think this is accomplished if the button is a 'submit' rather than a 'button' type, but I haven`t found a way to edit the
    type of button in Portal.
    Users belive it`s very annoying to have to move the mouse over the 'query' button to execute the query, and would rather like to just press 'Enter'.
    I`ve tried to use a javascript (onKeyPress), but if you make a javascript in Portal, you`re not allowed to add this to your button, only as an 'form-' or 'field validation' in a textbox.
    Is there anyone who knows a way to get this functionality?
    Regards,
    Orjan

    One of the AVG add-ons for Firefox has been reported to cause that to happen. Disable that add-on until AVG fixes it.

  • Upon Pressing Enter Key in an InputField

    Hi,
    I have an InputField where i have to enter AirlineId and followed by search button
    But my requirement here is <b>
    We have to press Enter key in INputField.Then all the AirLineIds which are there in the database has to be popuped and in that the one which selects has to be placed in the InputField</b>
    Regards
    Padma

    Hi Padma,
                      Create a onEnter event for the input field & inside that create a modal window. For that window u have to create a view also.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf</a>
    In this tutorial check the code for AddressBook(not for external window) .U can use this code
    IWDWindowInfo myWinInfo = wdComponentAPI.getComponentInfo().findInWindows("<window name>");
    myPopupWindow = wdComponentAPI.getWindowManager().createWindow(myWinInfo,true);
    myPopupWindow.setWindowPosition(300,150);
    myPopupWindow.open();
    regards
    Sumit

  • Question about submitting a button upon pressing "Enter"

    HI everyone, I am using 11.1.2.1.0.
    I have a Panel Form Layout with 2 buttons (let's say, bt1 and bt2). I would want to auto trigger bt2 when user press "Enter".
    Is using javascript the only to implement this ? If it is, how(where) shall I place the javascript code if I want to achieve proper placement of codes.
    Thank you.

    i have a idea , without using javascript
    let i consider you had jspx page in that you had af:command button/command toolbar button
    choose that button go to the propeties pallete in that, you can found access key property give value say as E
    run your page in mozila ffx > 3.0 press alt + ctrl + e it will trigger what you what?
    based on browser key will differ.
    but somtimes my idea will not match/suit with your requirement so
    i have another answer drag and drop the af:resource from the component pallete under jspx root
    <af:resource scripttype = "javascript">
    //here js code
    <af:resource>
    <af:commandbutton>
    use some listener to invoke your javascript say as clientlistener / serverlistners
    <af:commandbutton>

  • Execute Report, while pressing push button

    Hello friends,
    I have a selection-screen with some parameters or so..... now I want to place a pushbutton over this screen ( how to place a pushbutton, do I need a dynpro). when user press this pushbutton, I want to execute a report, and have to send parameters to this report?
    is this possible in ABAP ?
    Many thanks for your kind help....

    HI Syed,
      To call a report program from another report, use
    SUBMIT statement.
    You can pass the values from the first report to the second report using export /import statements or with ranges addition.
    Example
    The program report1 has a stand-alone selection screen with the screen number 1100. In the program report2, an internal table with row type RSPARAMS and a ranges table are filled for this selection screen. These are transferred at SUBMIT together with a single condition.
    Program accessed
    REPORT report1.
    DATA text(10) TYPE c.
    SELECTION-SCREEN BEGIN OF SCREEN 1100.
      SELECT-OPTIONS: selcrit1 FOR text,
                      selcrit2 FOR text.
    SELECTION-SCREEN END OF SCREEN 1100.
    Calling program
    REPORT report2.
    DATA: text(10)   TYPE c,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    Regards,
    Ravi

  • Use Enter key to execute report.

    I have a report that needs to be executed in background.It has a selection screen.The program should get executed when user presses 'ENTER' while he is inside the selection screen.At present,when 'ENTER' key is pressed,only validation is done.To execute we are  either pressing 'F8'  key or click execute button in screen.
    Now how to trap the 'ENTER' key press in  a report?

    Hi Jayaprakash,
    All PAI processing will depend on the Function Code that has been triggered at the selection screen.
    The ENTER key has no function code, whereas the "Execute" button has the function code 'ONLI'. SO what can be done is, when the user hits the ENTER key, we can programmatically set the function code to 'ONLI'. I shall give you a very small peice of code to illustrate my point.
    ===================================
    tables sscrfields.
    parameters p_vblen like vbak-vbeln obligatory.
    at selection-screen.
    if sscrfields-ucomm eq space.
    sscrfields-ucomm = 'ONLI'.
    endif.
    start-of-selection.
    write p_vblen.
    ===================================
    The above code will trigger the report output on hitting the ENTER key at the selection screen.
    What you only have to note here is that unlike with screen processing, in selection-screen processing, the function code will be made available in the field UCOMM of the structure SSCRFIELDS. However, you will have to declare this structure in your program ( using the TABLES statement as shown above ).
    Hope the explanation has been clear enough to drive the point home for you. Please get back to me otherwise.
    Regards,
    Anand Mandalika.

  • I want to execute selection screen by pressing enter button

    Hi,
    I have a requirement like after giveing values in selection screen I want to execute it by pressing enter button not by pressing execute button.
    Please give some sample code if u have any solution.
    Thanks & Regards
    Venkatrami Reddy B

    Hi,
    You can achive this.
    You just need to do all your coding under even AT SELECTION-SCREEN OUTPUT.
    But you have to put a check also say counter.
    Define a variable of type integer and then put the check on the mail block of code (whole program eccept selection screen) as mentioned below.
    IF lv_count > 1.
    program lines..
    ENDIF.
    lv_count = lv_count + 1.
    Regards,
    Raj Gupta

  • When pressing the "R" on the keyboard to record the following pop up - "Beta-only warning message-not to be localized Can't create record files please report" and then this "error occurred Result= -48"  What does this mean?

    When pressing the "R" key on the keyboard to record the following pops up - "Beta-only warning message-not to be localized.  Can't create record file, Please Report"  I press O.K. and this pops up - "Error occurred Result= -48".  Can't figure out why.  First time I have every had problems>  What's up with this?

    a -48 error is a duplicate filename.
    the first things i'd try are the oddball problems fixes:
    http://www.bulletsandbones.com/GB/GBFAQ.html#oddballprobs
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • When press Enter i want to display the input in Report calling Smartform

    Hello Masters,
    I am new in to abap and i want to know that how can we display data on the same screen when we enter the value and press enter , for example when i enter a employee code in input field and when i press enter before executing my report i want to see the name of the employee for which i have enter in the field before execution. i am developing a Report which is calling a smartform for print.
    tables sscrfields.
    parameters: p_pernr type pa0001-pernr obligatory.
    at selection-screen.
      if sscrfields-ucomm eq space.
        sscrfields-ucomm = 'p_pernr'.
      endif.
    I thought that this code could have worked for me but its no use , can any one please help me with my issue

    here is some code what i have used in my report program , i will still like to remind that its an Logical database program (PNP) for ABAP-HR , right now i tried the code mentioned above but not getting any result.
    TABLES: pernr,sscrfields,pa0001.
    *& Declaring Type-pools
    TYPE-POOLS : slis.
    *& Declaring Infotypes
    INFOTYPES: 0000,          " Action
                         0001.          " Org. Assignment
    *& Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK n1 WITH FRAME TITLE t1.
    PARAMETER : p_despat TYPE zhr_transfer-despt OBLIGATORY,              " Despatch Number
                r_pernr  TYPE pa0001-pernr OBLIGATORY,                                    " Reporting to
                re_pernr TYPE pa0001-pernr OBLIGATORY,                                   " Relieving Authority
                a_pernr  TYPE pa0001-pernr OBLIGATORY MODIF ID one.             " Authorize Person
    SELECTION-SCREEN END OF BLOCK n1.
    INITIALIZATION.
      t1 = 'Transfer Records'.
      LOOP AT SCREEN.
        IF screen-name = 'PNPPERNR-LOW'.                                  " Personnel Number (Mandatory)
          screen-required = 1.
            MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      IF a_pernr IS INITIAL.
        a_pernr = pa0001-ename.
      ENDIF.
    END-OF-SELECTION.

  • How to execute code when press the ENTER key

    Hello,
    I've write the code in Key-ENTER trigger, but it doesn't work when I press ENTER key.
    Best Regards
    Joe

    Matth M
    Thank you.
    The following msg. from help system shows that key-enter trigger will execute when the ENTER pressing event occurs. Need your more help.
    Regards
    Joe
    >
    (index: "DO_KEY" )
    Executes the key trigger that corresponds to the specified built-in subprogram. If no such key trigger exists, then the specified subprogram executes. This behavior is analogous to pressing the corresponding function key.
    Built-in............Key Trigger............Associated Function Key
    ENTER............Key-ENTER............[Enter]

  • Can I execute a code on pressing Enter key?

    Hi
    I want to execute a piece of code on pressing Enter key, while in a datablock in Query mode
    I tried KEY-ENTER trigger but nothing happens.
    Is that possible?
    Am I asking a nonsense thing?
    Thanks in advance
    Oscar

    no meaning to press enter in query mode. u can use buttons for directly running some other codes instead
    Thanks & Best Regards
    HuaMin
    Please remember to always mark the reply if it's helpful or related to your issue!

  • Event should trigger when press enter on select option in web dynpro.

    I want to trigger a event for validation when enter is pressed in select option in web dynpro.
    as the select option is created by the coding and there is no method to trigger the event.
    please advice.

    Pls post it ABAP Forum
    Rgds
    Sumanth.Gururaj
    Consultant/Systems Analyst- SAP SD/MM

  • Execute create trigger script in a procedure

    Is it possible to create a trigger with pl/sql?
    I have made a procedure thats makes the create or replace trigger statement.
    (when i copy and past the statement the trigger is created succesvol)
    How can i execute the create trigger statement on the end of the procedure?
    Thanks.

    Well, then proceed with dynamic SQL.
    Or, in my opinion much better: produce a SQL script with variables for table name and trigger name.
    Then run this script with the appropriate values every time you have created a table.
    Cheers,
    Guido
    Edited by: Guido on Oct 22, 2008 10:30 AM

Maybe you are looking for