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

Case statment

Former Member
0 Likes
1,023

Hi guys,

data: object_type like crmd_orderadm_h-object_type.

data: ok_code like sy-ucomm.

ok_code = sy-ucomm.

object_type = ok_code.

case object_type.

when 'PHC'.

Perform ....

endcase.

here in this code no values r coming when im debugging...i want to trigger object_type value when it checks.... in my code did i do any mistake... send me right code...plz....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
982

hi guys,

the values are not comming in SY-UCOMM and ok_code variables... its showing blank when iam debugging...

10 REPLIES 10
Read only

Former Member
0 Likes
982

Hi,

Make sure the object type is of data type syucomm..



data: object_type TYPE syucomm.
data: ok_code like sy-ucomm.
ok_code = sy-ucomm.
object_type = ok_code.

case object_type.
when 'PHC'.
Perform ....
endcase.


Thanks

Naren

Read only

Former Member
0 Likes
982

Hi

The error is that, you are trying to assign the sy-ucomm to object_type.

You can say,

CASE ok_code.

WHEN 'PHC'.

perform <subroutine name>

ENDCASE.

Regards

Raj

Read only

Former Member
0 Likes
982

I think its a module pool... if it is so then

you have to code it in PAI module..

like

module pai input.

ok_code = sy-ucomm.

object_type = ok_code.

case object_type.

when 'PHC'.

Perform ....

endcase.

endmodule.

now when user will interact with the screen (pressing push button or something) it will trigger and give you the correct output...

regards

shiba dutta

Read only

0 Likes
982

then you have to write the code in at user-command event and when user will make some interaction with menu bar then it will trigger else sy-ucomm will be initial. You can set your own menu bar also by set pf-status 'ZSPD' like this.

if you are not interacting with menu bar sy-ucomm remain initial.

at user-command.

ok_code = sy-ucomm.

object_type = ok_code.

case object_type.

when 'PHC'.

Perform ....

endcase.

regards

shiba dutta

Read only

Former Member
0 Likes
983

hi guys,

the values are not comming in SY-UCOMM and ok_code variables... its showing blank when iam debugging...

Read only

0 Likes
982

Hi,

Which kind of report is this. Is it a normal program or module pool?

Regards,

Atish

Read only

Former Member
0 Likes
982

This is a normal ABAP program in SE38....

Read only

0 Likes
982

in the screen painter, in 'element list' tab -> Genral attributes, have you filled in Name 'ok_code' for the type 'ok' ??

Let me know.

Read only

0 Likes
982

Hi,

In the normal ABAP program you can't get anything in the Sy-ucomm. As you can see from the field description itself this is User command field. In this program user is not interacting with the code so this field will be blank. This field will be filled if you convert this report into interactive report.

Hope it is clear. if you just want to see how CASE statement work see the code below.

data value TYPE i.

value = 1.

CASE value .

WHEN 1.

WRITE: / 'Value is 1'.

WHEN 2.

WHEN OTHERS.

ENDCASE.

Reward points if useful.

Regards,

Atish

Read only

Former Member
0 Likes
982

hi

if on click of object-type ur debugger is getting activated then probably u must have made a mistake somewhere else in the code.

had it been not taking value ur debugger wont let u to move to the code.

<b>have u clear the object type before using it.</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Message was edited by:

ravish goyal