‎2008 Jul 30 1:56 PM
in the below code i need to check whether the claim-brand doesnt contain any car,bry,pay if it contains any one then it need to take wa_claim-brand else if wa_claim-brand doenst contain any car, bry,pay then it should read kna1 and check the wa_kna1-katr8 not equal to car, bry, pay if the kna1-katr8 doesnt contain the above then it should pick the brand as car else it should use kna1-katr8 , but the code below is not working.
IF ( wa_claim-brand NE c_car OR
wa_claim-brand NE c_bry OR
wa_claim-brand NE c_pay ) .
READ TABLE i_kna1 into wa_kna1 WITH KEY kunnr = wa_claim-sapcustomer.
IF ( wa_kna1-katr8 NE c_car OR
wa_kna1-katr8 NE c_bry OR
wa_kna1-katr8 NE c_pay ).
IF SY-SUBRC = 0.
wa_cust_mvmt-brand = c_car.
ELSE.
wa_cust_mvmt-brand = wa_kna1-katr8.
ENDIF.
ENDIF.
ELSE.
wa_cust_mvmt-brand = wa_claim-brand.
ENDIF.
‎2008 Jul 30 2:07 PM
Hi Rocky,
IF ( wa_claim-brand EQ c_car OR
wa_claim-brand EQ c_bry OR
wa_claim-brand EQ c_pay ) .
wa_cust_mvmt-brand = wa_claim-brand.
else.
READ TABLE i_kna1 into wa_kna1 WITH KEY kunnr = wa_claim-sapcustomer.
IF SY-SUBRC = 0.
IF ( wa_kna1-katr8 EQ c_car OR
wa_kna1-katr8 EQ c_bry OR
wa_kna1-katr8 EQ c_pay ).
wa_cust_mvmt-brand = wa_kna1-katr8.
ELSE.
wa_cust_mvmt-brand = c_car.
ENDIF.
ENDIF.
ENDIF.
It should work.
Regards,
Subbu
‎2008 Jul 30 1:58 PM
hi Rocky,
in the conditions replace all ORs with ANDs.
hope this helps
ec
‎2008 Jul 30 2:02 PM
hi eric first condition is working but for kna1 the condition is not working its going to this else if record is there or not there
‎2008 Jul 30 2:07 PM
after the READ TABLE, I think you have to check if any record was found: CHECK sy-subrc EQ 0.
‎2008 Jul 30 1:58 PM
hi populate variables.. into the ranges.....and use it in the if
r_brand-low = c_car.
r_brand-sign = 'E'.
r_brand-option = EQ'.
append r_brand .
r_brand-low = c_bry .
r_brand-sign = 'E'.
r_brand-option = EQ'.
append r_brand .
r_brand-low = c_pay .
r_brand-sign = 'E'.
r_brand-option = EQ'.
append r_brand .
IF wa_claim-brand in r_brand .
do some thing..
do the same thing for the katr8
ELSE.
wa_cust_mvmt-brand = wa_claim-brand.
ENDIF.
‎2008 Jul 30 2:07 PM
Hi Rocky,
IF ( wa_claim-brand EQ c_car OR
wa_claim-brand EQ c_bry OR
wa_claim-brand EQ c_pay ) .
wa_cust_mvmt-brand = wa_claim-brand.
else.
READ TABLE i_kna1 into wa_kna1 WITH KEY kunnr = wa_claim-sapcustomer.
IF SY-SUBRC = 0.
IF ( wa_kna1-katr8 EQ c_car OR
wa_kna1-katr8 EQ c_bry OR
wa_kna1-katr8 EQ c_pay ).
wa_cust_mvmt-brand = wa_kna1-katr8.
ELSE.
wa_cust_mvmt-brand = c_car.
ENDIF.
ENDIF.
ENDIF.
It should work.
Regards,
Subbu