Application Development 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: 

SCREENS

Former Member
0 Kudos

This is lalitha .

In the below report I am not able to solve the error in "case-endcase' .

This is my program for getting a checkbox in screens .

REPORT ZLAL_CHECKBBOX .

DATA: CB1,

CB2,

X(30) VALUE 'SAI',

Y(30) VALUE 'PRANEETH',

TEMP(30),

E(4) .

CALL SCREEN 100 .

MODULE CHBK INPUT .

CASE sy-ucomm.

when CB1.

IF CB1 = 'X' AND CB2 <> 'X' .

TEMP = X .

ELSE. IF CB1 = 'X' AND CB2 = 'X' .

concatenate Y X INTO TEMP .

ELSE. IF CB1 = 'X' AND CB2 = 'X' .

TEMP = Y .

ELSE. CLEAR TEMP .

ENDIF .

WHEN CB2 .

IF CB1 = 'X' AND CB2 <> 'X' .

TEMP = Y .

ELSEIF CB1 = 'X' AND CB2 = 'X' .

concatenate X Y INTO TEMP .

ELSEIF CB2 <> X AND CB1 = 'X' .

TEMP = X .

ELSE .

CLEAR TEMP .

ENDIF .

WHEN E .

LEAVE PROGRAME .

ENDIF .

ENDCASE .

ENDMODULE CHBK INPUT .

4 REPLIES 4

former_member589029
Active Contributor
0 Kudos

Hello Lalitha,

Within your 'WHEN cb1' block you open an if statement and within that if another if statement and only then you call 'WHEN cb2'.

The syntax of case is:

case xx.

when 1.

if condition.

coding

else.

if condition

coding

else.

cosing.

endif.

endif.

when 2.

when others.

endcase.

Meaning you have to 'close' any open if-statements BEFORE you put another WHEN statement. You cannot have a WHEN within an if statement unless there is a CASE within that if statement as well.

Hope that this helps. If not, what exactly are you trying to achieve?

Regards,

Michael

Former Member
0 Kudos

First of all instead of

when CB1 make it when <b>'CB1'</b>.

CB1 shud be in single quotes..

secondly its <b>leave program</b> not programme

Reward if it helps..

Former Member
0 Kudos

infact after keyword WHEN put the values in single quotes everywhere in ur prog

WHEN 'CB1'..

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi Try this below coding it is ur coding i changed some lines

DATA: CB1,

CB2,

X(30) VALUE 'SAI',

Y(30) VALUE 'PRANEETH',

TEMP(30),

E(4) .

CALL SCREEN 100 .

MODULE CHBK INPUT .

CASE sy-ucomm.

when 'CB1'.

IF CB1 = 'X' AND CB2 <> 'X' .

TEMP = X .

ELSE IF CB1 = 'X' AND CB2 = 'X' .

concatenate Y X INTO TEMP .

ELSEIF CB1 = 'X' AND CB2 = 'X' .

TEMP = Y .

ELSE. CLEAR TEMP .

ENDIF .

WHEN 'CB2' .

IF CB1 = 'X' AND CB2 <> 'X' .

TEMP = Y .

ELSEIF CB1 = 'X' AND CB2 = 'X' .

concatenate X Y INTO TEMP .

ELSEIF CB2 <> X AND CB1 = 'X' .

TEMP = X .

ELSE .

CLEAR TEMP .

ENDIF .

WHEN 'E' .

LEAVE PROGRAME .

ENDIF .

ENDCASE .

ENDMODULE CHBK INPUT .

Thanks & Regards,

vallamuthu.M