RedBatz
29th August 2007, 18:32
Hi all,
I'm trying to fill tfgld102 using AFS of session tfacp1120s000.
So, I have several lines do record in the table, the first one is successfully recorded, but the second one gives the error "Ledger account not allowed"
Well, it seems that tfgld102.leac is not filled, but when I get the value of this field before the insert action it seems to be ok.
Here is the example:
dll1120.put.Conta_contabil.(sedmt015.leac)
|* fill other fields
leac = dll1120.get.Conta_contabil.()
message(leac) |* this works well
dll1120.insert(dummy, error_str) |* Gives error
Can someone help, please?
Am I missing something?
Regards,
Agostinho.
mark_h
29th August 2007, 19:13
Just from reading this I do not think you are missing anything, but then again maybe if you post the rest of the code someone will see something. It could very well be that the session is not doing what you want in the back ground. Do you have source code?
RedBatz
30th August 2007, 10:52
Hi!
Here is the code:
|* tfgld1101m000
dll1101.put.Data_introdu_o_lan_amento(btno.date)
dll1101.put.Refer._lan_amento("Transportes" & str$(prod) & " / " & str$(year))
dll1101.set.view()
dll1101.put.Transaction_Type_Code(sedmt000.ttyp)
dll1101.insert(dummy, error_str)
if not isspace(error_str) then
message("Erro a registar o tipo de lançamento " & sedmt000.ttyp)
else
dll1101.save(error_str)
if not isspace(error_str) then
message("Erro a gravar o tipo de lançamento " & sedmt000.ttyp)
else
dll1101.handle.sub.process("tfacp1110s000", "add")
dll1101.continue(error_str)
if not isspace(error_str) then
message("Erro na tentativa de lançamento do cabeçalho da factura.")
else
|* tfacp1110s000
dll1110.put.tfacp200.suno(sedmt000.suno)
dll1110.put.tfacp200.docd(btno.date)
valor.factura = 0.00
select sum(sedmt015.amnt):valor.factura
from sedmt015
where sedmt015._index1 = { :year, :prod }
and sedmt015.proc = tcyesno.no
selectdo
endselect
dll1110.put.Valor(valor.factura)
dll1110.put.tfacp200.refr("Transportes" & str$(prod) & " / " & str$(year))
dll1110.put.tfacp200.lvat(hold.lvat)
dll1110.handle.sub.process("tfacp1120s000", "kill")
dll1110.insert(dummy, error_str)
if not isspace(error_str) then
message("Erro a registar cabeçalho da factura")
else
dll1110.save(error_str)
if not isspace(error_str) then
message("Erro a gravar o cabeçalho da factura.")
else
dll1110.handle.sub.process("tfacp1120s000", "add")
dll1110.continue(error_str)
first = TRUE
db.retry.point()
select sedmt015.*
from sedmt015 for update
where sedmt015._index1 = { :year, :prod }
and sedmt015.proc = tcyesno.no
order by sedmt015._index1
selectdo
dll1120.put.N_mero_companhia(hold.ncmp)
dll1120.put.Companhia_dest.(hold.ncmp)
dll1120.put.Conta_contabil.(sedmt015.leac)
dll1120.put.C_digo_dimens_o_1(sedmt015.dim1)
dll1120.put.C_digo_dimens_o_2(sedmt015.dim2)
dll1120.put.C_digo_dimens_o_3(sedmt015.dim3)
dll1120.put.C_digo_dimens_o_4(sedmt015.dim4)
dll1120.put.C_digo_dimens_o_5(sedmt015.dim5)
dll1120.put.C_digo_IVA(sedmt015.cvat)
dll1120.put.Valor(sedmt015.amnt)
dll1120.put.Data_documento(hold.dbcr) |* Não é a data mas sim débito/ crédito
leac = dll1120.get.Conta_contabil.()
message(leac)
dll1120.insert(dummy, error_str)
if not isspace(error_str) then
message(error_str) |"Erro a registar linha de factura"
else
dll1120.save(error_str)
if not isspace(error_str) then
message("Erro a gravar a linha de factura")
else
sedmt015.proc = tcyesno.yes
db.update(tsedmt015, db.retry)
count = count + 1
if count > 50 then
commit.transaction()
count = 0
endif
endif
endif
endselect
endif
endif
endif
endif
endif
dll1120.end()
dll1110.end()
dll1101.end()
commit.transaction()
I had to "kill" tfacp1120s000 before the insert action in tfacp1110s000, otherwise it hangs. The first record in tfacp1120s000 is working well, the second gives the error "Ledger account not allowed".
I have the source code of tfacp1110s000 and tfacp1120s000, didn't find anything that could affect the background process.
Thanks in advance!
Eddie Monster
30th August 2007, 13:28
Is it possible that the account you are trying to use is one which cannot have entries placed against it? For example if you go to Maintain Financial Supplier Groups (tfacp0110m000) and then using the Special Menu go to the Maintain Ledger Accounts by Supplier Group (tfacp0111s000) you will see on of the entries is Control Account. This account is the master account that AP documents are booked against (through the system). Users cannot use this account number.
Just trying to take a different perspective, perhaps your code is fine, but the account is not a valid account for that action. Can you (or someone from Finance) take the raw data you are trying to enter through AFS and enter it through that session manually?
Also check to be sure that the account you are using is a 'zero' level account. Transactions cannot be posted to higher level accounts.
Just some off the wall thoughts.
mark_h
30th August 2007, 14:40
Hi!
I had to "kill" tfacp1120s000 before the insert action in tfacp1110s000, otherwise it hangs. The first record in tfacp1120s000 is working well, the second gives the error "Ledger account not allowed".
I have the source code of tfacp1110s000 and tfacp1120s000, didn't find anything that could affect the background process.
Thanks in advance!
First read the previous post from Eddie_monster - Eric is right in that I usually assume the data you are trying to load will work manually.
If the data is valid I would suggest that you put tfacp1120s000 into debug mode and run your code. I am wondering if for each record you need to close and re-open tfacp1120s000. I am thinking that with the code in debug mode you will see some where that the leac field is being reset for the second record. I have had problems where I left a sub-session open and then had problems with follow on records.
RedBatz
30th August 2007, 16:50
Hi!
Mark, you were right!
I had to close and re-open tfacp1120s000 for each record.
Thanks!
Agostinho.