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 Endcase

Former Member
0 Likes
504

Hi all,

I am new to ABAP. I am creating a prog. in which i am using Case-EndCase.

Code:

PARAMETERS: CH TYPE I.

CASE CH.

WHEN 1.

WRITE: 'I AM CASE 1'.

WHEN 2.

Parameter : string1(20) type c , string2(20) type c .

if string1 ca string2 .

write : ' contain any '.

elseif string1 co string2 .

write : 'Contain only'.

else .

write : 'doesnot contain '.

endif.

ENDLOOP.

ENDCASE.

In this Code i want screen should ask for parameters only when i enter choice = 2. but it is asking for all parameters without entering choice.

Pls. help me out.

Any Help willl be rewarded.

<b>Sachin</b>

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
440

Hi,

All PARAMTERS will be displayed in any case you need to hide them using SCREEN structure modifications.

What you can do is.

WRITE YOUR CODE to hide and display the fields in the event block

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF CH = 1.

CHECK SCREEN-NAME = 'STRING1' OR SCREEN-NAME = 'STRING2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSEIF CH = 2.

CHECK SCREEN-NAME = 'STRING1' OR SCREEN-NAME = 'STRING2'.

SCREEN-ACTIVE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards,

Sesh

3 REPLIES 3
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
441

Hi,

All PARAMTERS will be displayed in any case you need to hide them using SCREEN structure modifications.

What you can do is.

WRITE YOUR CODE to hide and display the fields in the event block

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF CH = 1.

CHECK SCREEN-NAME = 'STRING1' OR SCREEN-NAME = 'STRING2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSEIF CH = 2.

CHECK SCREEN-NAME = 'STRING1' OR SCREEN-NAME = 'STRING2'.

SCREEN-ACTIVE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards,

Sesh

Read only

VXLozano
Active Contributor
0 Likes
440

I think you cannot that kind of things.

Luckily, you will be able to CALL SELECTION-SCREEN xxxx. (look help at this sentence).

Or you can use any FM to get values (check SE37 for POPUPGET*)

Read only

Former Member
0 Likes
440

Need to write the code at the event AT SELECTION-SCREEN OUTPUT for these parameters and modify the screen as per the option entered.Something like..

Loop at screen.

....

Endloop.