2008 Jul 15 8:22 AM
See I have this problem I have table A and Table B
Let's say for example,Table A has field customer of,
1
2
3
4
5
And table b has field customer of,
3
4
5
6
I am suppose to compare A with B if A has a customer number equal to one of the values in B. It has to increment until it reaches a number not available in B. so in table A 1 is ok. 2 as well. but 3 has to be incremented to 7. 4 is next from table A next available is 7, but im suppose to make the customer field unique so next increment is 8. How do I go about doing this. Having a hard time checking while looping
2008 Jul 15 8:30 AM
Hi,
In the loop you can have the value in a seprate variable which you are updating.
e.g.
Sort A by customer number descending.
v_custno = a-custno. ( This will have value as 6 )
v_custno = v_custno + 1.
Loop at A.
read table b with key custno = A-custno.
if sy-subrc is initial.
A-custno = v_custno.
v_custno = v_custno + 1.
endif.
endloop.
Hope this logic shud meet your requirement.
Regards,
Lalit