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

Regarding Ok Code

Former Member
0 Likes
891

Hi all,

I am new to dialog programming. I have created a dialog program which is having a screen with two radiobuttons and one push button.

Now Push button is having fun code name- Create

and OK which has name OK_CODE .

I have written following code on PAI MODULE

PROGRAM Z82426_DP_ASSIGN.

data ok_code TYPE sy-ucomm. " command field

data copy_ok_code LIKE ok_code. " copy of ok_code

&----


*& Module USER_COMMAND_9000 INPUT

&----


  • text

----


module USER_COMMAND_9000 input.

copy_ok_code = OK_CODE.

CLEAR OK_CODE.

OK_CODE = sy-ucomm.

CASE copy_ok_code.

WHEN 'CREATE' .

CALL SCREEN 9010.

ENDCASE.

endmodule. " USER_COMMAND_9000 INPUT

but still pushing the button is not calling any screen.

Can anybody help me?

Regards,

Smita

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
860

Hi,

First give a name to the ok_code field in the elements list of the screen, then declare a variable in the program with the same name.

And in PAI write as;

clear copy_ok_code.
copy_ok_code = ok_code.
clear ok_code.

case copy_ok_code.
when 'CREATE'.
call screen 9010.
....
...
...

Try this and revert back.

Regards

Karthik D

7 REPLIES 7
Read only

Former Member
0 Likes
860

The OK_CODE should be defined in the Element list of the screen 9000, only then the OK_CODE will have the value 'CREATE', or any other function code.

regards,

Advait

Read only

Former Member
0 Likes
861

Hi,

First give a name to the ok_code field in the elements list of the screen, then declare a variable in the program with the same name.

And in PAI write as;

clear copy_ok_code.
copy_ok_code = ok_code.
clear ok_code.

case copy_ok_code.
when 'CREATE'.
call screen 9010.
....
...
...

Try this and revert back.

Regards

Karthik D

Read only

Former Member
0 Likes
859

Hi Smita,

Is there any reason to write the code as below

copy_ok_code = OK_CODE.

CLEAR OK_CODE.

OK_CODE = sy-ucomm.

CASE copy_ok_code. ??

Write like this

Data: ok_code like sy-ucomm.

Case ok_code.

When ' create'.

call screen 9010.

endcase.

Cheers!!

VEnk@

Read only

0 Likes
859

Hi venkat,

But sap recommends to use an intermediate variable to store and branch user commands. Also it will avoid unnecessary retention of a Function code in the ok_code variable.

For example in some cases after pressing a button and then when you press Enter or do any other action the Fcode of the button will be passed, so the above code will avoid that situation.

You can verify the same in all the example code given in ABAPDOCU.

Regards

Karthik D

Read only

0 Likes
859

Hi Karthik,

Thanks for the information. I am accepting your suggestion.

And i will try to implement the concept when i am in use of the discussed concept.

Thanks once again.

Cheers!!

VEnk@

Read only

Former Member
0 Likes
859

Hi,

If you got the solution please mark the question as answered.

Regards

Karthik D

Read only

Former Member
0 Likes
859

Hi Smita,

Have you declared the OK_CODE field in the screen 9000? The rest of the code seemed fine.

Just put a debug point and see what exactly is going on.

You can also have a look at the following demo ABAP reports which is handling the same Function Code.

DEMO_DYNPRO_PUSH_BUTTON.

Search SE38 with DYNPRO and you will get all the example code for the dynpro programing.

Hope this will help.

Thanks,

Samantak.