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: 

Need help.

Former Member
0 Kudos

Hi,

I have written the logic for below requirement

1.Check if operating concern(I_ERKRS) is 0001 than go to step 2 else go to step

2.Read each record of T_Item which is of structure CE10001 table and verify

the value for item category(CE10001-PSTYV) .

3. If the item Category (CE10001-PSTYV) is TAS Than change Warehouse cost value field (CE10001-VV504) value to 0.00 irrespective of its current value).

Else don’t change value of warehouse cost value field(CE10001-VV504).

4.Exit from the function module.

<b>Code is :</b>

DATA: ce1_0001 LIKE ce10001.

CASE i_erkrs.

WHEN '0001'.

LOOP AT t_item.

MOVE-CORRESPONDING t_item TO ce1_0001.

IF ce1_0001-pstyv = 'TAS'.

ce1_0001-vv504 = '0.00'.

ENDIF.

MOVE-CORRESPONDING ce1_0001 TO t_item.

MODIFY t_item FROM t_item.

ENDLOOP.

ELSE.

EXIT.

ENDCASE.

But it is showing error is NO open "IF" statement.

why it is showing error.Please give me suggestions,where i have change the code.

Thanks,

sudhakar

3 REPLIES 3

Former Member
0 Kudos

See you have put ELSE statement after the ENDIF.

Use else inside if.

DATA: ce1_0001 LIKE ce10001.

CASE i_erkrs.

WHEN '0001'.

LOOP AT t_item.

MOVE-CORRESPONDING t_item TO ce1_0001.

IF ce1_0001-pstyv = 'TAS'.

ce1_0001-vv504 = '0.00'.

ENDIF.

MOVE-CORRESPONDING ce1_0001 TO t_item.

MODIFY t_item FROM t_item.

ENDLOOP.

<b>ELSE.</b> " This is the error put it in right place where u need.

EXIT.

ENDCASE.

Reward Points if Iseful

Regards,

Vimal

former_member188827
Active Contributor
0 Kudos

da problem lies with else statement.u've already closed if with endif before sle statement.conclude it after else.

reward points if it helps

Former Member
0 Kudos

Thanks for repling.I will assign points.

sudhakar