How to create 2+ records in V7 style "simultaneously"?

Hi,

How can I create two or more instances in V7 Style code (Leave request representation)?

In this specific case I want to create as many entrys in the table as contracts registered for the Employee.

I tried with a For Cycle in "AINSERT_AFTER" action but it gets in some kind of loop ( it gets inside AINSERT_AFTER everytime i do "STA=fmet YDEMCON.AINSERT").

Here is my code so far:

$AINSERT_AFTER

Filter [YCTR] Where [YCTR]REFNUM=this.REFNUM and [YCTR]CTRNUM<>this.CTRNUM and [YCTR]XITFNL <> 2
Read [YCTR]First
If !fstat
Local Instance YDEMCON Using C_DEMCONGEESS
YDEMCON=NewInstance C_DEMCONGEESS AllocGroup null

For [YCTR]
STA=fmet YDEMCON.AREAD(this.REFNUM,this.UID) : If STA<>[V]CST_AOK : Return : Endif
YDEMCON.CTRNUM = [YCTR]CTRNUM
STA=fmet YDEMCON.AINSERT
Next

FreeInstance YDEMCON
Endif"

Return"

Do you have any suggestions?

Best Regards