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

Passing Ok Code

Former Member
0 Likes
1,847

Hi,

I have text box in one screen. I am passing the Value to the text box through the Program. Then it should trigger the PAI according to the Value in the Text Box. For this purpose How can I pass the Ok_code ?

If i pass the ok_code through the Program will it trigger the PAI or NOT ?

Regards,

satya.

4 REPLIES 4
Read only

Former Member
0 Likes
892

Hi,

PAI triggers after user input.

Assign a function code to the push button. then in program,

case sy-ucomm.

when 'SAVE'.

if wrk_text eq 'Something you want to give'.

<code for save.>

endif.

when 'CANCEL'.

<code for cancel> etc..

endcase.

In that way you can code.

Regards,

Renjith Michael.

Read only

Former Member
0 Likes
892

hope this code helps u

DATA:

  • Global variable to store OK code

ok_code(4),

  • Temporary store the value of the OK code

save_ok_code(4).

Create code for the screen

PROCESS BEFORE OUTPUT.

MODULE status_0001.

PROCESS AFTER INPUT.

MODULE user_command_0001.

MODULE status_0001 OUTPUT.

SET PF-STATUS '0001'.

SET TITLEBAR '001'.

  • Example of how deactivate a field on the screen

  • ZCOSTAFSTM-ZAFSTEMNR is the name of the screen field we want to

  • deactivate.

LOOP AT SCREEN.

CHECK screen-name = 'ZCOSTAFSTM-ZAFSTEMNR'.

screen-input = '0'.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

ENDMODULE.

MODULE user_command_0001 INPUT.

    • Here you can catch when user pushes a pushbutton*

    • Save the OK code in save_ok_code and clear it*

save_ok_code = ok_code.

CLEAR ok_code.

CASE save_ok_code.

WHEN '0010'.

    • Afstemninger*

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

PERFORM my_list.

WHEN '0020'.

CALL TRANSACTION 'ZCO1'.

WHEN 'RETU'.

LEAVE TO SCREEN '0000'.

ENDCASE.

ENDMODULE.AT USER-COMMAND.

  • Here you can catch when the user psuh a button on the menu bar or presses a function key

CASE sy-ucomm.

WHEN 'OPRT'.

PERFORM something.

ENDCASE.

Read only

0 Likes
892

Hi,

Here there is no user Input . We have to trigger the PAI by sending the Enterkey value.

Through program we have to press the enter key.

How is it possible ?

Regards,

Satya.

Read only

0 Likes
892

Hi,

Plase try using the command:

SET USER-COMMAND 'your user command'..

for example,

WRITE: 'List'... "Create a list

SET USER-COMMAND 'FUN'.

Processes the event AT USER-COMMAND immediately; the system field SY-UCOMM contains the function code FUN.

for ENTER key the default value is ' '. (space)

Regards,

Renjith Michael.

Edited by: Renjith Michael on Jan 4, 2008 5:02 PM