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

What is the diff between OK_CODE and SY-UCOMM

Former Member
0 Likes
3,737

Dear All,

I am trying to develop on module pool program using push buttons to pass the data to input/out filed. When I do the debugging the sy-ucomm is showing the data but not OK_CODE in case statement.

Case OK_CODE.

When 'one'.

num = '1'.

call function 'ZCA_INPUT_OUT'.

Import

numz = num

export

number = inputi. " input/output field in screen painter

end case.

Can you pls give me a solutions what is the main mistake I did here.

I could not able to pass the data through push button to input/out field.

Regards,

Chandra.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,736

hi,

i think you are write OK_CODE entry in the Module pool screen's Element list is not there.enter OK_CODE in last of the element list.

Regards

Gaurav

22 REPLIES 22
Read only

JoffyJohn
Active Contributor
0 Likes
2,735

have you declared ok_code in the top include of your module pool program

DATA: ok_code TYPE sy-ucomm.

In the element list of your screen.

give Name of a Screen Element : OK_CODE .

then it will have value same as sy-ucomm.(system varaible to hold the user selected function code value)

Read only

Former Member
0 Likes
2,735

You need to declare OK_CODE TYPE SY_UCOMM. And pass sy-ucomm value to ok_code.

Read only

Former Member
0 Likes
2,735

hi,

OK_code is a user define variable where as SY_UCOMM is a system variavle to store the user action for example double click, etc.

what you have to do.



DATA: ok_code type sy-ucomm.

ok_code = sy-ucomm

use the above code before the case statement in your code its works fine.

hope this helps

Regards

Ritesh

Read only

0 Likes
2,735

I have written this code in main program. When I am declaring the data types.

Read only

0 Likes
2,735

Hi Chandra,

>John wrote:

>

>In the element list of your screen.

>give Name of a Screen Element : OK_CODE .

>

>then it will have value same as sy-ucomm.(system varaible to hold the user selected function code value)

You declared this one?

Regards,

Swarna Munukoti

Edited by: Rob Burbank on Feb 11, 2010 1:21 PM

Read only

0 Likes
2,735

OK_CODE is just a user define field to transfer SY-UCOMM data to your main program....You have to link them in Element List --> General attributes to field of type OK....If you define variable with same name (OK_CODE) in your main program, values of SY-UCOMM will automatically get transferred to it...

You may very define this variable as OKIE_CODE, OKKKK_CODE or whatever you like

Thanks,

Regards,

Mohaiyuddin

Read only

0 Likes
2,735

Hi Swarna,

I have not created this field in screen painter.

Can you pls explain how to assign this field in screen painter. Do you want me to just mention in field attributes ... or some where else I need to assign .........

pls give me the replay asap.

Regards,

Chandra.

Read only

0 Likes
2,735

Hi,

In screen painter you have Attributes, Element list and Flowlogic tabs. In the Element list tab create OK_CODE.

Thanks,

Sri.

Read only

0 Likes
2,735

You don't have to create it, there will be field with type OK created by default...You have to mention OK_CODE as it's name and define same in your main program

Data : OK_CODE type sy-ucomm.

Read only

0 Likes
2,735

Only one answer.Do not copy the codes.Just understand them first

Read only

0 Likes
2,735

Hi Chandra,

This is not a seperate field to create. In the element list tab, the last row contains a type - OK. Write ok_code in the Name column against this OK type.

Hope you already know the path to elementary list tab.

Regards,

Swarna Munukoti.

Read only

0 Likes
2,735

Hi Aditya,

Can you please elaborate your comment ?? "COPY THE CODE???"

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
2,735

In SCREEN PAINTER (SCREEN LAYOUT) you give push button name = ONE

and Fctcode = ONE

CASE sy-ucomm

WHEN 'ONE'

Read only

0 Likes
2,735

yes, you are correct.

Read only

Former Member
0 Likes
2,737

hi,

i think you are write OK_CODE entry in the Module pool screen's Element list is not there.enter OK_CODE in last of the element list.

Regards

Gaurav

Read only

Former Member
0 Likes
2,735

Hi ,

In the element list tab, the last row contains a type - OK. and there have you write OK_CODE in 1st column last where ok is written in front of that and activate .......

Regards,

gaurav

Read only

0 Likes
2,735

Hi all,

still I have same problem.

below is my program code.

REPORT ZCA_CALCULATOR_DEMO.

DATA INPUTI TYPE string.

Data num type string.

DATA: OK_CODE TYPE SY-UCOMM,

save_ok like ok_code.

call screen '100'.

INCLUDE ZCA_CALCULATOR_DEMO_STATUS_O03.

----


***INCLUDE ZCA_CALCULATOR_DEMO_STATUS_O03 .

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI100'.

SET TITLEBAR 'ZCHAR'.

ENDMODULE. " STATUS_0100 OUTPUT

INCLUDE ZCA_CALCULATOR_DEMO_USER_COI01.

----


***INCLUDE ZCA_CALCULATOR_DEMO_USER_COI01 .

----


&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

save_ok = ok_code.

clear ok_code.

CASE save_ok.

WHEN 'one'.

num = '1'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'two'.

num = '2'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'three'.

num = '3'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'FOUR'.

num = '4'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'FIVE'.

num = '5'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'SIX'.

num = '6'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'SEVEN'.

num = '7'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'EIGHT'.

num = '8'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'NINE'.

num = '9'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

WHEN 'ZERO'.

num = '0'.

CALL FUNCTION 'ZCA_CAL_INPUT'

EXPORTING

NUM = num

IMPORTING

NUMBER = inputi.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

function zca_cal_input.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(NUM) TYPE STRING

*" EXPORTING

*" REFERENCE(NUMBER) TYPE STRING

*"----


data: nextnum type string,

currnum type string.

loop at screen.

if screen-name = 'inputi'.

nextnum = num.

concatenate currnum nextnum into currnum.

number = currnum.

endif.

endloop.

endfunction.

this is my entire program code.

now I have mention OK_code type ok in screen painter attribute also.

but still haveing sample problem .......

can you pls some one will explain what need to be done in this case.

Regards,

Chandra V

Read only

0 Likes
2,735

I hope function codes ONE, TWO.....ZERO are defined in PF-STATUS...-- just to cross check.

Also check if PF-STATUS is activated to be on safer side..

If I am correct, are you defining these buttons on Screen?

Regards,

Mohaiyuddin

Edited by: Mohaiyuddin Soniwala on Feb 12, 2010 12:55 PM

Read only

Former Member
0 Likes
2,735

hi,

code looks fine...

recheck ....ok_code entry in elementary list & Activate screen painter,screen again.

regards

Gaurav

Read only

Former Member
0 Likes
2,735

In screen painter you have to assign push button's fcode and name then and then your code is work

Read only

Former Member
0 Likes
2,735

This message was moderated.

Read only

Former Member
0 Likes
2,735

This message was moderated.