Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

append logic

Former Member
0 Likes
800

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
750

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

7 REPLIES 7
Read only

Former Member
0 Likes
751

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

Read only

0 Likes
750

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..:)

Read only

0 Likes
750

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

Read only

0 Likes
750

thanks a ton Shiba ,,,it worked

Read only

Former Member
0 Likes
750

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

Read only

Former Member
0 Likes
750

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.

Read only

Former Member
0 Likes
750

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