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: 

Check Initial Condition Using Case.

0 Kudos
3,906

Hi all,

In my req.....need to change the status field based on the updated values of other fields in the ALV.

          If  not gs_final-matnr is initial or not gs_final-erdat is initial or not gs_final-ernam is initial.

               gs_final-status = 'CLOSED'.

             Elseif not gs_final-org_id is initial or not gs_final-item is initial.

                gs_final-status = 'OPEN'.

          endif.

Is that possible to use CASE statement instead of IF or ELSEIF. Since the condition is carried out inside LOOP & ENDLOOP there is performce issue.

Regards,

Meenakshi.

2 REPLIES 2

former_member210008
Active Participant
0 Kudos
740

Hi.

Why do you think CASE will be faster than IF? Did you check your program in SAT/ST12?

I think you should provide a problem piece of code.

former_member289261
Active Contributor
0 Kudos
740

Hi,

CASE can only be used when the initial values are same for all cases. But here, matnr has initial value blank while date has initial value '00000000' therefore CASE cannot be used.

I suggest using field symbols instead of work area for the  LOOP. It will drastically improve the loop execution time.