2006 Oct 20 10:34 AM
Hi all
What is ok_code used for and what is it exactly...can anybody explain me please...iam going thru sap help.sap.com..
Thanks and Regards
vijaya
2006 Oct 20 10:41 AM
2006 Oct 20 10:41 AM
2006 Oct 20 10:43 AM
OK_CODE is a 4 digit function code assigned to any control that you put on screen interface.
When the user chooses a pushbutton or a checkbox, the PAI event is triggered. The function code of the pushbutton is assigned to the screen field OK_CODE, which is then passed onto the ABAP field with the same name. The module USER_COMMAND, which is associated with PAI event, is then processed.
Firstly, the contents of the OK_CODE field are copied to the auxiliary variable SAVE_OK code, and OK_CODE is initialized. You should always do this, since it ensures that the screen field OK_CODE has always been initialized before the PBO event and can therefore not unintentionally contain an incorrect value.
Let me know if you have any further queries.
Don't forget to mark helpful answers!
Gaurav Parmar.
2006 Oct 20 10:45 AM
Hi gaurav
Thanks for ur helpful answer...but can i use my own fct code r do i have to definetly use only OK_CODE..for exam if i have ok button i can give my fct code as ok...
Thanks and Regards
vijaya
2006 Oct 20 10:50 AM
2006 Oct 21 7:35 PM
Hi Vijaya,
You are confusing two things.
OK_CODE is just a variable which is used to store the 'Function code' which is associated for example to a button. You can have your own Function codes and when the button is clicked or some user action occurs ( which is by user interaction ) then in PAI you check something like this:
case ok_code.
when <fct_code1>.
when <fct_code2>.
.
.
.
etc
endcase.
Now if you want to use someother variable in place of ok_code then you can simply assign the value of 'SY-UCOMM' in some other field and instead of having a 'case OK_CODE' you can have for example 'case MY_CODE'.
Hope this helps
Regards
Nishant
2006 Oct 20 10:51 AM
Hi
The OK_CODE is the screen variable where the system store the functional code assigned to command done by user.
Every buttom in the screen and in the bar has an own functional code, so it can decide what the program has to do when the user press a certain buttom.
The actions to be done are manage in PAI process, where PAI means PROCESS AFTER INPUT, so:
- The user press a buttom, the functional code of the buttom is stored in OK_CODE and in PAI the program decides what to do:
PROCESS PAI.
MODULE USER_COMMAND.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'BACK'.
....................
WHEN 'NEXT'.
...................
WHEN ........
ENDCASE.
ENDMODULE.
The functional code is assigned when the buttom is created.
Max
2006 Oct 20 10:51 AM
You can have your own function code as long as it is of 4 digit length. Whenever you put any control over the screen, you must put 4 digit function code in the properties screen for that particular control. Now it can be first four leter 'VIJA', 'DURG' or any 4 characters.
Please dont forget to mark the helpful answer.
Gaurav.
2006 Oct 22 12:21 PM
Hi
ok_code is just a variable...real job is done by sy-ucomm
it is capturing the user command eg: any push buttons click......for eg: you will be declaring
data : ok_code type sy-ucomm.
based on your requirement you can change variables,pop up messages anything you want to happen on click of a button or other actions
by checking the sy-ucomm...
instead of clearing sy-ucomm ,one can find the trend of moving value of moving sy-ucomm to ok_code and clearing it since one does not want to mess with standard....
thats what i think you are rectifying right now
nb:ok_code is a tech name ,you could name it anything as long as it is of type sy-ucomm
Regards
Bx
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |