Skip to Content
0
Former Member
Jul 06, 2009 at 12:07 PM

how to do comparison in a loop.

311 Views

Hi all,

TYPES: BEGIN OF ZROUTE,

VBELN TYPE VBELN,

ROUTE TYPE ROUTE,

END OF ZROUTE.

DATA : IT_ZROUTE TYPE STANDARD TABLE OF ZROUTE,

WA_ZROUTE TYPE ZROUTE.

LOOP AT I_XVTTP_TAB INTO LW_XVTTP.

WA_ZROUTE-VBELN = LW_XVTTP-VBELN.

SELECT SINGLE ROUTE

INTO WA_ZROUTE-ROUTE

FROM LIKP

WHERE VBELN = LW_XVTTP-VBELN

APPEND WA_ZROUTE TO IT_ZROUTE.

ENDLOOP.

results from IT_ZROUTE

vbeln route

1111 A

2222 B

I have some problem in with the code below. I tried to collect vbeln and route into IT_ZROUTE.

However, after i've got the result, i want to do distiguish between the route.

If route A ne route B, then display an error messages.

My problem is, how do i compare the record by looping IT_ZROUTE? if i set into a temporary variable, the value will always change and i have prb in doing the comparison. eg:

loop it_zroute into wa_route.

zroute = wa_route-route. "set into a variable

if zroute = wa_route-route

"display error message

endif.

endloop.

Could anyone give me some tips to enhance my code? Really appreciate your help.