Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How trigger keys programmatically

0 Likes
2,718

I know this sounds weired, but is there a command that executes keyboard-keypresses?

Like i got some code (Dynpro pai) and after its execution i need to press enter to continue. If i could execute the enter-command automatically the usability would increase. (Since i dont have full access to the System i cant change that the entercommand is needed.)

Is there a way to do this?

Best regards

6 REPLIES 6
Read only

geert-janklaps
SAP Mentor
SAP Mentor
2,335

Hi,

I'm afraid an automatic enter is not possible from within ABAP. It wouldn't make any sense as well. Because the system would never know when the user is done with entering his value.

For example if your input field would be an order number, valid order numbers are 1,11,111,1111. There's no way you can ever determine when the system needs to trigger the enter command.

There is however one exception, in case this is a transaction for an RF scanner. The scanner can be programmed to scan a barcode, enter the value in the field and trigger an enter command. But all of that is programmed in the scanners itself.

Best regards,

Geert-Jan Klaps

Read only

2,335

... because the scanner driver is a keyboard driver and simulates real keystrokes. You can't do this within ABAP.

Read only

2,335

I agree - in dynpro, to trigger pai you have to press either <enter> or <function key>. The requirement doesn't make sense or we don't understand it.

Read only

Sandra_Rossi
Active Contributor
2,335

Yes. It's been discussed a "lot" in the forum. There are several solutions. Search things like refresh screen automatically, or CL_GUI_TIMER, SET USER-COMMAND, CL_GUI_CFW=>SET_NEW_OK_CODE.

Read only

venkateswaran_k
Active Contributor
0 Likes
2,335

Please put the following code - to force enter key as you asked. (in the user-command section)

I am using this for the same situation you asked for

Example :

        WHEN 'XXXX'.
             CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'
            EXPORTING
              functioncode = '='.
          IF sy-subrc <> 0.
*           Implement suitable error handling here
          ENDIF.

This will force the enter key internally

Regards,

Venkat

Read only

0 Likes
2,335

It has to be combined with CL_GUI_TIMER or aRFC so that to execute it automatically at regular intervals to refresh the screen every X second(s).

Note that SAPGUI_SET_FUNCTIONCODE is equivalent to the officially-released method CL_GUI_CFW=>SET_NEW_OK_CODE.