Process PBO and PAI when Enter key is pressed

Hello everyone,
I am making a program where there is a I/O Box component. When the user enters data in this field and hits the 'ENTER' key I want to process the PBO and the PAI of that screen.
The problem is what should i assign in the ok_code for this?
Please advise.
Thanks in advance,
Karan

>
Karan Kappal wrote:
> Hello everyone,
> I am making a program where there is a I/O Box component. When the user enters data in this field and hits the 'ENTER' key I want to process the PBO and the PAI of that screen.
> The problem is what should i assign in the ok_code for this?
>
> Please advise.
>
> Thanks in advance,
> Karan
You want to Go when user Press enter.
In PBO we will set the status,
SET PF-STATUS 'STATUS'. " double click on it or Go to SE41
here activate the Function code for the ENTER button.
in the FUnction keys you can see in the Beginning First Function (Green Tick mark) Give the Function code say ENTER , and give all necessary details and Activate .
Now Test your application.
When your enter the data and press enter, First it Goes to PAI
here you do what ever required based on the action code...
in PAI
case ok_code.
when 'ENTER'.
"your code here...
endcase.
and once it is done, Control backs to PBO ..

Similar Messages

  • Default button being clicked multiple times when enter key is pressed

    Hello,
    There seems to be a strange difference in how the default button behaves in JRE 1.4.X versus 1.3.X.
    In 1.3.X, when the enter key was pressed, the default button would be "pressed down" when the key was pressed, but wouldn't be fully clicked until the enter key was released. This means that only one event would be fired, even if the enter key was held down for a long time.
    In 1.4.X however, if the enter key is pressed and held for more than a second, then the default button is clicked multiple times until the enter key is released.
    Consider the following code (which is just a dialog with a button on it):
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(jButton1);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    new SimpleDialog().show();
    When you compile and run this code under 1.3.1, and hold the enter key down for 10 seconds, you will only see one print line statement.
    However, if you compile and run this code under 1.4.1, and then hold the enter key down for 10 seconds, you will see about 100 print line statements.
    Is this a bug in 1.4.X or was this desired functionality (e.g. was it fixing some other bug)?
    Does anyone know how I can make it behave the "old way" (when the default button was only clicked once)?
    Thanks in advance if you have any advice.
    Dave

    Hello all,
    I think I have found a solution. The behaviour of the how the default button is triggered is contained withing the RootPaneUI. So, if I override the default RootPaneUI used by the UIDefaults with my own RootPaneUI, I can define that behaviour for myself.
    Here is my simple dialog with a button and a textfield (when the focus is NOT on the button, and the enter key is pressed, I don't want the actionPerformed method to be called until the enter key is released):
    package focustests;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class SimpleDialog extends JDialog implements java.awt.event.ActionListener
    private JButton jButton1 = new JButton("button");
    public SimpleDialog()
    this.getContentPane().add(new JTextField("a text field"), BorderLayout.NORTH);
    this.getContentPane().add(jButton1, BorderLayout.SOUTH);
    this.getRootPane().setDefaultButton(jButton1);
    jButton1.addActionListener(this);
    this.pack();
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == jButton1)
    System.out.println("button pressed");
    public static void main(String[] args)
    javax.swing.UIManager.getDefaults().put("RootPaneUI", "focustests.MyRootPaneUI");
    new SimpleDialog().show();
    and the MyRootPaneUI class controls the behaviour for how the default button is handled:
    package focustests;
    import javax.swing.*;
    * Since we are using the Windows look and feel in our product, we should extend from the
    * Windows laf RootPaneUI
    public class MyRootPaneUI extends com.sun.java.swing.plaf.windows.WindowsRootPaneUI
    private final static MyRootPaneUI myRootPaneUI = new MyRootPaneUI();
    public static javax.swing.plaf.ComponentUI createUI(JComponent c) {
    return myRootPaneUI;
    protected void installKeyboardActions(JRootPane root) {
    super.installKeyboardActions(root);
    InputMap km = SwingUtilities.getUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    if (km == null) {
    km = new javax.swing.plaf.InputMapUIResource();
    SwingUtilities.replaceUIInputMap(root,
    JComponent.WHEN_IN_FOCUSED_WINDOW, km);
    //when the Enter key is pressed (with no modifiers), trigger a "pressed" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, false), "pressed");
    //when the Enter key is released (with no modifiers), trigger a "release" event
    km.put(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER,
    0, true), "released");
    ActionMap am = SwingUtilities.getUIActionMap(root);
    if (am == null) {
    am = new javax.swing.plaf.ActionMapUIResource();
    SwingUtilities.replaceUIActionMap(root, am);
    am.put("press", new HoldDefaultButtonAction(root, true));
    am.put("release", new HoldDefaultButtonAction(root, false));
    * This is a copy of the static nested class DefaultAction which was
    * contained in the JRootPane class in Java 1.3.1. Since we are
    * using Java 1.4.1, and we don't like the way the new JRE handles
    * the default button, we will replace it with the old (1.3.1) way of
    * doing things.
    static class HoldDefaultButtonAction extends AbstractAction {
    JRootPane root;
    boolean press;
    HoldDefaultButtonAction(JRootPane root, boolean press) {
    this.root = root;
    this.press = press;
    public void actionPerformed(java.awt.event.ActionEvent e) {
    JButton owner = root.getDefaultButton();
    if (owner != null && SwingUtilities.getRootPane(owner) == root) {
    ButtonModel model = owner.getModel();
    if (press) {
    model.setArmed(true);
    model.setPressed(true);
    } else {
    model.setPressed(false);
    public boolean isEnabled() {
    JButton owner = root.getDefaultButton();
    return (owner != null && owner.getModel().isEnabled());
    This seems to work. Does anyone have any comments on this solution?
    Tjacobs, I still don't see how adding a key listeners or overriding the processKeyEvent method on my button would help. The button won't receive the key event unless the focus is on the button. There is no method "enableEvents(...)" in the AWTEventMulticaster. Perhaps you have some code examples? Thanks anyway for your help.
    Dave

  • Code to call a function when enter key is pressed

    hi all,
    In a table control program i need to call a function when i press enter key...
    but im not able to do that since the function is always called when i press a push button on the screen.... can any one help me in this.. please....

    Hi John,
          You are not getting any value in SY-UCOMM when you press "Enter",because the function code is not set for 'Enter" key in "Function Key" of the GUI-STATUS..
    First define some fucntion code say 'ENT' for the Enter button available in "Fucntion key" of the GUI status.Once you done and activate the program and test it.The function code which u defined will be coming to SY-UCOMM field when you press 'ENTER" button and you can handle the various fucntionality whichevcer you want on "ENTER" .
    Eg:
    case sy-ucomm.
    When 'ENT'.
    Endcase.
    Regards,
    Vigneswaran S

  • Module Programming  PBO and PAI flow.

    Hi,
    I am new to module programming,
    My req are -  I have 4 input fields and button in my first screen(1000)
    After user enters these values then I have to validate this values in the database and then
    I need to update 1 field value in the database. After updating I need to display the results in second screen (2000).
    Can any one please let me know what is the process in PBO and PAI modules.
    How to write code .
    1.     where to validate field values
    2.     where to write code for updating database.
    3.     where to write code for displaying success/failure message in second screen(2000)
    4.     where to write declarations.
    Thanks a lot for ur time .
    I highly appreciate ur help.
    Venkat.

    Hello
    Check this out:
                                INCLUDES                                 *
    INCLUDE ZIMMFORM001_TOP.
    INCLUDE ZIMMFORM001_PBO.
    INCLUDE ZIMMFORM001_PAI.
    Main Process
    START-OF-SELECTION.
    CALL SCREEN 100. -> double click
    END-OF-SELECTION.
    Uncomment the following:
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.   -> double click
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.  -> double click
    *&  Include           ZIMMFORM001_TOP
    Global Definitions                                   *
    "Your definitions
    *&  Include           ZIMMFORM005_PBO
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MEN'.  -> double click -> CREATE SCREEN STATUS 'EXE' AND 'BACK'
      SET TITLEBAR 'ZTIT'.  -> double click
    INITIATE WHATEVER YOU NEED
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&  Include           ZIMMFORM001_PAI
    *&      Module  USER_COMMAND_0100  INPUT
          text
    INSIDE THE CASE YOU CAN VALIDATE.WHEN 'EXE' IS SELECTED FOR EXAMPLE.
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXE'.
          PERFORM validate_form.
          PERFORM save_form_to_db.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Hope this helps, dont forget to reward
    GABRIEL
    Message was edited by:
            Gabriel Fernando Pulido V.

  • First Text field in page submits when Enter key is hit. Don't want Submit

    Hi,
    I have searched and can't find this answer I got before...
    The Text field does not have the Submit always when pressed included, just a standard Text Item.
    because it is the first text field in the page.. or maybe it was because its the only text field on the page that causes it to "Submit" the page when the "Enter" key is pressed.
    I do not want the Enter key to Submit the page.
    Was it to add a dummy hidden text field before this text field?

    Awesome... I just found a post also with same answer!
    Thank you very much!
    http://djmein.blogspot.com/2007/04/stop-page-submission-when-enter-is.html

  • Screen enhancement in ME51N - control is not passing to PBO and PAI of exit

    HI ,
    I am doing screen Exit for the Tcode : Me51N / Me52N.
    I have to add 3 Text fields in item level, i am using Enhancement:MEREQ001(in CMOD).
    Initially i added those 3 fields in Structure CI_EBANDB.
    Then i designed Screen in Screen Exit:SAPLMEGUI Screen Num:111.
    Here in the PBO and PAI Module
    MODULE STATUS_0111 , MODULE USER_COMMAND_0111.
    the control is not going , i tried with break-point inside these modules.
    But while executing ME51N , debugger is not working.
    Code i wrote in both PAI and PBO
    MODULE STATUS_0111 and MODULE USER_COMMAND_0111.
    loop AT SCREEN.
           screen-output = '1'.
           screen-input = '0'.
           MODIFY SCREEN.
    endloop.
    I need to display the three screen in Display format not in editable format.
    Thanks and Regards,
    Prakash K

    Hi
    You need to write the code in PBO of that screen based on TRANSACTION TYPE.
    there is a method call 'get_transaction_state' from this you will get the transaction type (H -  create , 'V'-  change  'B' -display) at run time.
    If run time transaction type = B
      LOOP AT screen.
          IF screen-name eq c_name . "field names
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    endif.

  • Screen exit for co11n and problems in writting the PBO and PAI Logic ?

    Hi People,
    I am developing a screen exit for transaction co11n. I have found the exit ( CONFPP07 ) ... I created a project and have
    assigned this exit and activated the project. I have created a field named SHIFT  on clicking this field i have to give three
    possible values (a,b,c  ) and i have to store these values in some table .......... now my problem is in which include i
    have to write PBO and PAI logic ... should i have to write pbo logic in the include provided in the exit
    EXIT_SAPLCORU_S_100 and PAI in EXIT_SAPLCORU_S_101.......or .........Can any tel me what should i have to do to
    meet the requirements... and in which structure i have to add this field so that it gets stored in some table.
    Thanks in Advance.

    Hi,
    Use the includes in the program SAPLXCOF given in CONFPP07 Exit.
    You may use include zxcofzzz ( for Subprograms and Modules )
    by creating it upon double click.
    Regards,
    Wajid Hussain P.

  • Sample code in PBO and PAI

    Hi all,
    i created a new field in the customer master (xd03) screen with a button. if i click that button, it will display the next screen with the new field. now i need to write the code in PBO and PAI events in that screen to get the data from table and to change the already exiting data.
    can any body provide me the sample code wht to write in the PBO and PAI eventts.?
    thanks in advance.
    kp

    Hi,
    I think you find the answer but i still answered your question.
    You can use the function module 'DYNP_VALUES_READ' to read value you want and use the function module ' HELP_VALUES_GET_WITH_TABLE' to get the values from kna1 table.
    Good luck.

  • Why do we need to code  loop statement in both PBO and PAI in Table control

    Hi friends,
    i have 2 questions-
    Q1-why do we need to code a loop and endloop statement in both PBO and PAI in Table control,sometimes even empty as well?
    Q2-what r d dynpro keywords?

    Hi,
    It is required to pass information from internal table to table control so we loop it in PBO and to get the updated information back, we loop in PAI and update internal table content.
    To get more knowledge on Table controls check these threads -
    table control
    Table Control
    Hope this helps.
    ashish

  • Additional field in infotype 0009 issue ( PBO and PAI )

    Hi Guru,
    I need your help please.
    I have a additional field in IT0009 and when I want created a new infotype 0009, I fill all field but after ENTER or SAVE all field are save in the layout but not the additional field.
    To save the additional field in the layout, I must fill it again and after the ENTER or SAVE the field is save in the layout.
    I have checked in the debbugger, when I create a new infotype 0009 it goes to the PBO but after ENTER or SAVE it doesn't go to the PAI so I must do it again ( fill the additional field and ENTER or SAVE ) and then it goes to the PAI.
    Thus I would like to know how I can make so that after the ENTER or SAVE the screen goes in PAI before the PBO and at the first time.
    Thanks very much in advance.
    Regards.

    Hi Srini Vas, hi Pedro Guarita and thanks for your reply,
    After more investigation, the probleme come from a check over country bank.
    In fact, the screen of the infotype 0009 must be adpated following the country bank but to do this, the standard module pool (mp000900) check if the country bank have changed.
    call method cl_hrpad00_iban=>process_iban_pai
          changing
            cs_bankdata = ls_bank_data_current
          exceptions
            error_iban  = 1
            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.
        call method cl_hrpad00_iban=>get_bank_data_old
          importing
            bank_data_old = ls_bank_data_old.
        if ls_bank_data_current-banks <> ls_bank_data_old-banks. "MELN1357200
    bank country changed -> leave screen needs to be done
          leave_screen = 'X'.
        endif.
    But when you create a new infotype 0009, the ls_bank_data_old-banks is always initial. So when module pool compared the ls_bank_data_old-banks with the ls_bank_data_current-banks, those are always different.
    In conclusion, when you create a new infotype 0009 it is always mandatory to push ENTER before to fill any additional field because at each first time that the standard module pool go in the PAI, it make a leave screen.
    Thanks in advance for all yours reply.

  • Cocode check at PBO and PAI

    Hi
    I  should not allow Cocode AD01 records to update and Display when user has authorization for CoCode AD01.
    i know in Event its possible, but we need to do it in PBO PAI of Screen.
    PBO
    *First statement
    Module Authorictycheck.
    Include LZXXXO01
    module Authoritycheck
      LOOP AT EXTRACT.
        AUTHORITY-CHECK OBJECT 'ZCHECK_BUK'
                            ID 'BUKRS' FIELD ZTTL01-BUKRS.
        IF sy-subrc <> 0.
    *delete the record from EXTRACT table.
    Append Extract.
        ENDIF.
      ENDLOOP.
    endmodule
    Does the above PBO code will work for display nonauthorized company code?
    In PAI, No idea where to write and which table should i have to loop. Pls advice.
    Regards
    Prince

    Hi
    When the user tries to change the record in SM30, Authorization check
    for the BUKRS has to be done and display error if no authority.
    In PAI, under LOOP at Extract, i have added AUTHORITY_BUKRS module
    and made below code. but the Authority check occurs when i click the edit button in SM30 screen.
    but requirement is error should trigger only after change occurred for record.
    Can you pls suggest how to handle this problem?
    LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZXXXX-COCODE .
        FIELD ZXXXX-MATKL .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZXXXX-COCODE .
        MODULE AUTH_CHECK_UPDATE.       <-Added Module
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
    MODULE AUTH_CHECK_UPDATE INPUT.
    Authority-check OBJECT 'Z_XXX_BUK'
                  ID 'BUKRS' FIELD ZTAUTH-COCODE.
    If sy-subrc <> 0.
    MESSAGE E105(ZSCM01).
    ENDIF.
    ENDMODULE.
           Regards
    prince
    Edited by: princeck on Sep 16, 2011 3:33 PM
    Edited by: princeck on Sep 16, 2011 3:42 PM

  • 'Confirm before sending SMS' when enter key is pre...

    Many will agree with me,
    While creating SMS we press 'Enter key' for next line, and then we realise that incomplete SMS has been sent and we got charged for it.
    There should be checkbox in Skype's Settings/Preferences for Messegeing:
    [√] "Confirm before sending SMS"
    Please push this feature if you agree with me.
    Thanks,
    Nitin

    The text of the submit button is transmitted to tell you which submit button was clicked, so naturally it doesn't send it if you don't click that button.
    The usual trick is to create an field like <INPUT TYPE="hidden" id="actionfield" name="action" value="enter">
    When an element that causes a submit, like clicking a button, happens then Javascript sets the value of the field to indicate the entry method. e.g.
    onClick="document.getElementById('actionField').value='ok'; return true"
    Obviously if the submit occurs due to hitting ENTER the action parameter will be "enter".
    Actually few forms use submit buttons these days because they look a bit clunky, most use images for buttons and power them with JavaScript.

  • Apple, why did you change my Keyboard and remove the enter key?

    Hi all,
    I had my new black MacBook delivered just before Christmas. The keyboard has changed from my previous Black MacBook (the one a colleague poured wine over and killed... grrr).
    Apple have changed the look of the command key and removed the Apple logo (very sad), but more frustratingly have replaced the 'enter' key with another 'option' key.
    I found the 'enter' key really useful, especially for pull down menu and really miss having one.
    Does anyone know if there is a way to assign the new 'option' key to be an 'enter' key?
    Cheers
    Scott.

    I just received a new(refub) MacBook 2.2GHz today and was very disappointed to find the enter key missing. After selling my G4 PowerBook six months ago, I was so looking forward to having the convenience of being able to slap the enter key for dialog boxes with and submitting forms without having to move my hand from the trackpad. I hope that someone will come up with a way to replace the functionality of the missing enter key.
    Which brings me to my next point- There has been a big oversight in the implementation of the MacBook's replacement of the Enter Key, which is to use the FN+Return keys. It seems that when using the FN key with the Return key, the system will ignore the Command key being invoked. I discovered this very quickly. Anyone who uses Apple Remote Desktop knows that in order to send a Unix command to a remote machine, you type the command in the 'send UNIX command' window, then hit Command+Enter to send the command. Return produces a carriage return, FN+Return does nothing, and FNCommandReturn does nothing. The only current work around is to use the track pad to the "Send" button and click, which really slows things down.

  • Pai module enter key from key board

    hi
    can any one tell me how can i display material description after entering material no in screen  .
    by just clicking enter key from keyboard .
    Regards
    Rakesh singh

    Use a case statement.
    CASE ok_code.
    When Others.
    *********Write code to read material description from table or Internal table ***********
    Pass the description to the field on the screen. To do this define a work area with same name of screen element
    End case.
    Now the value will automatically be populated.

  • How come multiple audiotags in ebook can play all together in the last version of ibooks and ios6 while before they fade eachother when play key is pressed ?

    in ipad1 with ios5.1.1 and latest ibooks app audiotags stop the last music played when the new music starts
    in ipad3 with ios6 and latest ibooks let all the music play together with a resulting mess
    in ipad2 with ios6  ibooks fade the last tag that is playing when the play key is pressed in the new audiotag

    Gah. So It looks like the first version of the song on your iPod is the definitive version of a song (as is the case in iTunes). So in order to ensure that the version you want plays, you have to:
    1. make that the only version in iTunes (or first in the file structure)
    2. update Genius
    3. sync your iPod
    BOO. Too much work (I'm still going to do it though...)
    I would really like a feature that allowed you to specify which song would be chosen (the existing rating system would seem to be easiest).
    Another solution I thought of still requires a lot of work. This is assuming you prefer It would go something like this:
    1. Create an directory structure at the root of your library that would prioritize tracks, such as:
    a) Albums (for full length albums)
    b) Collections (for best ofs etc.)
    c) EPs (for singles or remix albums)
    e) Live Performances
    -assuming you prefer album versions over remixes over live versions, or more directly:
    a) High Priority
    b) Low Priority
    2. Place Each Album or individual tracks in their appropriate folder.
    3. Reset your iPod
    4. Sync
    The directory structure will intrinsically place higher priority versions on you iPod first, making them a priority version there. Pain in the...

Maybe you are looking for

  • Add header to spreadshee​t file

    What is the simplest way to add a header to the spreadsheet file? Peter Liu

  • Target disk mode only shows bootcamp partition

    My mid 2006 MBP doesn't boot anymore, I am getting the gray screen with the rotating wheel. When trying to boot in target disk mode and connect it to my iMac only the bootcamp partition is mounting, but not the Macintosh HD, I could like to make a ba

  • Storing streaming video in OrdVideo

    Hi, I have looked through the documentation and some examples, but am still wondering whether the URL used for a HTTP data source has to have a file name in it or it can be just a URL with no file name (a true video streaming server). Also, if a stre

  • Need Information on ROWID

    Hi All, I am using Oracle 9i eneterprise edition. I have a question on ROWID to use it against a partitioned table. I am creating a new table with ROWIDS for the records that are to be updated in a partitioned table in the below query. CREATE TABLE p

  • Are all the bugs fixed in the iPhoto 11?

    Have all the bugs been fixed in the iPhoto 11.  I have read about the editing problems.  I don't want to download otherwise. I have the 8.2 iPhoto software now.