Hi,
what is the result of your code ?
what is the structure of t_prod_detail ?
I think your code have a problem with the AT NEW. If your table have the field : VBELN & PRODH
when you write at new PRODH, that will occurs each time VBELN or PRODH change. For example
VBELN PRODH
1 10
1 20
2 20
your program will go in the AT NEW PRODH 3 times. the last time just because the VBELN change.
stop using the AT NEW.
regards
Fred