Skip to Content
avatar image
Former Member

Loop... Where clause is not working

Hello experts.

There is program , which i want to add conditions to a loop command.

The constraints is considered only for this condition : blart = lv_blart , and doesn't consider for the second one opbel <> lv_opbel (meaning the loop continues even if this condition is FALSE ).

On the other hand , when i write with IF clause, the constraints is valid .

The program is :

data : lv_blart TYPE blart_kk,

lv_opbel TYPE opbel_kk,

it_blart TYPE TABLE OF dfkkop,

wa_dfkkop TYPE dfkkop.

.

.

.

.

/// Loop where ///

lv_blart = 'DI'.

LOOP AT it_blart INTO wa_dfkkop WHERE

( ( opbel <> lv_opbel ) AND ( blart = lv_blart ) ) .

*********************************

/// IF clause ///

lv_blart = 'DI'.

LOOP AT it_blart INTO wa_dfkkop.

IF ( wa_dfkkop-opbel <> lv_opbel )

AND ( wa_dfkkop-blart = lv_blart ).

***************************************

Thanks for help.

Avi.

Edited by: avi azulay on Jun 11, 2008 2:07 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jun 11, 2008 at 12:10 PM

    Hi,

    I think there is no relational operator in the condition.

    Please check.

    ( opbel lv_opbel ) . " In both loop and IF
    

    Thanks,

    Sriram Ponna.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 11, 2008 at 12:14 PM

    Hi,

    Change your code in the below way...

    LOOP AT it_blart INTO wa_dfkkop WHERE

    opbel = lv_opbel AND (= is missing in your posted code, pls check)

    blart = lv_blart.

    Rgds,

    Bujji

    Add comment
    10|10000 characters needed characters exceeded