rohan_rege
10th October 2002, 00:36
hi ,
i am reading a ascii record and then zooming to tfacp1120s000 from tfacp1110s000
and then inserting a record ...

i then get another record from the ascii file...
and then try to insert another record in the already open tfacp1120s000...

but it gives a error on the ledger account field...saying that
Ledger Account not allowed....even when its correct..

i have checked this by inserting the two records in tfacp1120s000
manually...but it doesnot give me any error .

following is the code :
stpapi.put.field( "tfacp1120s000", "tfgld102.leac", read.leac)
stpapi.put.field( "tfacp1120s000", "tfgld102.dim1", read.dim1)
stpapi.put.field( "tfacp1120s000", "tfgld102.dim2", read.dim2)
stpapi.put.field( "tfacp1120s000", "tfgld102.dim3", read.dim3)
stpapi.put.field( "tfacp1120s000", "tfgld102.dim4", read.dim4)
stpapi.put.field( "tfacp1120s000", "tfgld102.dim5", read.dim5)
stpapi.put.field( "tfacp1120s000", "amount",read.leac.amt)
ret = stpapi.insert( "tfacp1120s000", 1, error.mess )
message(error.mess)


rem.amt=f1120s000.get.Remaining_Amount( )
message(str$(rem.amt))


After I insert the first record I keep the tfacp1120s000 session open and then after i read the next record ..i try inserting the new record in already open tfacp1120s000....

Basically there are two Transactions to be entered for a particular
Invoice in tfacp1120s000...

Any Suggestions?

Rgds
Rohan

gfasbender
10th October 2002, 01:35
After your 1st stpapi.insert(), try using a stpapi.save() call to commit the record. If it's a type-3 form, don't forget to use stpapi.change.view to re-set the key fields.

rohan_rege
10th October 2002, 17:02
i actually tried stpapi.save after stpapi.insert , but it wont work.

also i tried to use stpapi.change.view...but the problem is to change .view on tfacp1120s000 we have to put three fields
out of which the third is a series no.........how do i take care of it ?

rgds
Rohan

mark_h
10th October 2002, 17:36
Somethings I have done in the past is to do a insert or update with mode=0, followed by a save.
So you could try
ret = stpapi.insert( "tfacp1120s000", 0, error.mess ) followed by a stpapi.save. Or maybe even try a stpapi.save without a insert.

Mark

rohan_rege
10th October 2002, 19:37
hi...

mark , actually i already tried that..but i wudnt work

so finally i just tried to enter manually and see what might be causing the problem....

there was this serial no field on tfacp1120s000 , which defaulted to a next incremental value when insert button was pressed manually.


i just guessed that it might be causing the prob..
so for each record i started inputting a value in it (starting with 1)instead of assuming that like the manual process it might default to the next incr value.
and then programatically incremented it by 1 for the next record and so on.

its working fine now.......

rgds
Rohan

rohan_rege
10th October 2002, 21:12
hi ,
actually...i forgot to mention that i had to also use ,a change.view on the session tfacp1110s000 which is the session before tfacp1120s000 ,before i put the value in the series field of the tfacp1120s000

rgds
Rohan