11-30-2009 8:46 PM
Hi Guys,
I have some requirement like below.
Let say for example I have a Delivery with No 8000001 with Iternary(Order) as 5 in workarea.
Let say I have one Internal Table with deliveries and Iternary no as below.
VBELN ITERN
8000002 2
8000003 4
8000004 3
8000005 1
8000006 6
How to get the value into another ITAB1 for 8000001 with Iternary 5 from the above mentioned workarea has the nearest Iternary value is
8000006 6
OR
8000003 4
from the above ITAB.
Thanks in Advance.
Prasad.
Edited by: Dheeru Prasad on Nov 30, 2009 10:04 PM
12-01-2009 7:18 AM
Guys,
Any Ideas / suggestions for this scenario.
Did any one face this kind of senario.
Thanks,
Prasad.
Edited by: Dheeru Prasad on Dec 1, 2009 8:58 AM
12-01-2009 7:18 AM
Guys,
Any Ideas / suggestions for this scenario.
Did any one face this kind of senario.
Thanks,
Prasad.
Edited by: Dheeru Prasad on Dec 1, 2009 8:58 AM
12-01-2009 9:36 AM
modify the code as per your need .
types : begin of ty_order,
vbeln type vbeln,
itern type i,
end of ty_order.
data : i_order type standard TABLE OF ty_order,
wa_order type ty_order,
wa_order_result type ty_order,
value type i,
l_value type i,
l_vbeln type vbeln,
l_itern type i,
l_tabix type sy-tabix.
wa_order-vbeln = '8000002'.
wa_order-itern = 2.
append wa_order to i_order.
wa_order-vbeln = '8000003'.
wa_order-itern = 4.
append wa_order to i_order.
wa_order-vbeln = '8000004'.
wa_order-itern = 3.
append wa_order to i_order.
wa_order-vbeln = '8000005'.
wa_order-itern = 1.
append wa_order to i_order.
wa_order-vbeln = '8000006'.
wa_order-itern = 6.
append wa_order to i_order.
l_vbeln = 8000001.
l_itern = 5.
loop at i_order into wa_order.
l_tabix = sy-tabix.
value = wa_order-itern - l_itern.
if value < 0.
value = value * ( - 1 ).
endif.
if l_tabix NE 1.
if value lt l_value.
l_value = value.
wa_order_result = wa_order.
endif.
else.
l_value = value.
wa_order_result = wa_order.
endif.
endloop.
write / : wa_order_result-vbeln , wa_order_result-itern .
12-01-2009 10:14 AM