‎2007 Sep 19 11:19 AM
int_a with values:
order item good qty rej qty
200 1 10 0
200 2 0 2
201 1 20 0
201 2 0 6
sort int_a by order item
loop at int_a
v_good = v_good + int_a-good
v_rej = v_rej + int_a-rej
at new order.
v_index = 1.
endat.
if v_index = 1.
move-corresponding int_a to int_b.
int_b-good = v_good.
int_b_rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endif.
endloop.
int_b-rej values coming topsy turvy.. i tried at end of ord,, still no use..
can any one tell me how to append the 2 line item values(good and rej) of int_a into int_b in single line?
‎2007 Sep 19 11:26 AM
sort int_a by order item
clear: v_index,int_b,v_good,v_rej.
loop at int_a
v_good = v_good + int_a-good
v_rej = v_rej + int_a-rej
<b>at end of order.</b> " not at new
v_index = 1.
endat.
if v_index = 1.
move-corresponding int_a to int_b.
int_b-good = v_good.
int_b_rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endif.
endloop.
regards
shiba dutta
‎2007 Sep 19 11:26 AM
sort int_a by order item
clear: v_index,int_b,v_good,v_rej.
loop at int_a
v_good = v_good + int_a-good
v_rej = v_rej + int_a-rej
<b>at end of order.</b> " not at new
v_index = 1.
endat.
if v_index = 1.
move-corresponding int_a to int_b.
int_b-good = v_good.
int_b_rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endif.
endloop.
regards
shiba dutta
‎2007 Sep 19 11:33 AM
Hi Shiba,
thanks a lot for quick reply,,
i was using at end of before. but when i use that the item value is getting as 2..i want item as 1 in my Int_b.
does the <b>clear: v_index,int_b,v_good,v_rej before looping will work?</b>
Sorry for asking silly questions, but my mind got jammed..:)
‎2007 Sep 19 11:38 AM
just change this part
if v_index = 1.
move-corresponding int_a to int_b.
<b>int_b-item = v_index.</b> " or int_b-item = 1.
int_b-good = v_good.
int_b_rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endif.
regards
shiba dutta
‎2007 Sep 19 11:43 AM
‎2007 Sep 19 11:26 AM
Hi Nihi
you can modify code like this , using collect statement to sum the data .
sort int_a by order.
loop at int_a.
move-corresponding int_a to int_b. " no item in int_b
collect int_b " you can collect
endloop.
Regards
Wiboon
‎2007 Sep 19 11:28 AM
int_a with values:
order item good qty rej qty
200 1 10 0
200 2 0 2
201 1 20 0
201 2 0 6
sort int_a by order item
loop at int_a
v_good = v_good + int_a-good
v_rej = v_rej + int_a-rej
at end order.
move-corresponding int_a to int_b.
int_b-good = v_good.
int_b_rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endat.
endloop.
‎2007 Sep 19 12:01 PM
Try this, this will surely resolve your requirement.
sort int_a by order item.
loop at int_a.
v_good = v_good + int_a-good.
v_rej = v_rej + int_a-rej.
at END OF order.
CLEAR V_INDEX.
v_index = 1.
endat.
if v_index = 1.
move-corresponding int_a to int_b..
move int_a-ORDER to int_b-ORDER.
move int_a-ITEM to int_b-ITEM.
int_b-good = v_good.
int_b-rej = v_rej.
append int_b.
clear: v_index,int_b,v_good,v_rej.
endif.
endloop.
Regards
Amit Singla