Save new records into a new table defined by the developer

This question is not answered

I created a table called xLocalizacion with the following fields as Keys:

• DocType.

• No.

• VendId.

Additionally I have more fields which I want to keep in the PartCard which use within the page (51) Purchase Invoice.

That I did do, and even if there is information in the two tables I can give maintenance to the fields of xlocalizacion, but my problem is when in Purchase Header if there is a record but no xlocalizacion as putting editing, the fields the PartCard not enabled to record a new record and so the xlocalizacion purchase is linked with header.

To solve that I'm trying to do an insert to the table in the method xlocalizacion OnAfterGetRecord () of the Purchase Invoice page with the following code C / AL:

vDocType: = "Document Type";

vNo: = "No";

vVendId: = "Buy-from Vendor No.";

IF NOT xLocalizacion.GET (vDocType, vNo, vVendId) THEN BEGIN

xLocalizacion.INIT;

xLocalizacion.DocType: = vDocType;

xLocalizacion.RefNbr: = vNo;

xLocalizacion.VendId: = vVendId;

xLocalizacion.INSERT;

END

But that does not work, I get the following error when executing the Purchase Invoice page:

"Should start a transaction so that you can make changes to the database.

The Edit - Purchase Invoice has to close. "

All Replies
  • Why not just insert your fields OnValidate of the "Buy-from Vendor No." in the purchase header table?

  • Because that want to manage information and need a separate table because many columns or data that will attach to the purchase

  • then what you need is unclear. by you code it looks like you want to store the doc type . no & vendor # in another table.  is this not you want?

  • these are just the key fields of the table to relate it to the shopping bedside table, apart from those areas want to keep one for electronic billing, support, period, Invoice to applying a credit note and debit invoice branch, sales point invoice, etc..

  • As for your topic "As Defined By The Developer" are you the developer?

    You have to understand this is still unclear (at least to me).  This is a custom solution for you, it's highly unlikely that someone will understand what you are looking for if you are not absolutely clear.  For example "shopping bedside table"?  what's that? a custom table? what's it used for? etc, etc, etc.

    So when posting a problem in a forum try to stick with these points ( & be clear)

    1.What are you trying to achieve?

    2.What have you already tried?

    3.What problem or errors are you seeing?

    4.What version are you on?

    5.Are you the developer or end user?

    And sometimes if you explain your need clearly - forum members perhaps can suggest alternate methods you haven't though about yet.  or even better a already standard built-in way to achieve your goal.

  • Ok, I'm a developer, I have a table called xLocalizacion with the following fields:

    DocType (CLAVE), RefNbr  (CLAVE), VendId  (CLAVE), AutoNoAD, AutoNo, AplicaAnexos, CodigoSRI_InvcAD, CodigoSRI_Invc, CodigoSRI_Ret, CredGastAD, CredGast, Crtd_DateTime, Crtd_Prog, Crtd_User, DerDevol, DocDate, Estado_Invc, Estado_Ret, ImprRetFte, InvcNbrAD, InvcNbr, LUpd_DateTime, LUpd_Prog, LUpd_User, No_RetFte, PtoVenta_InvcAD, PtoVenta_Invc, PtoVenta_Ret, Periodo, RefNbrAD, RefNbr, SecuencialAD, Secuencial, Sucursal_InvcAD, Sucursal_Invc, Sucursal_Ret, Status, TipoAD, Tipo, Transaccion, User1, User2, User3, User4, User5, User6, User7, User8, User9, User10, User11, User12, User13, User14, User15, User16, User17, User18, User19, User20, User21, User22

    This table is an annex to Purchase Header, if you notice the first 3 fields are the keys to relate the Purchase Header table, the relationship must be one to one, to complete this information created a CardPart which I will use in page (51) Purchase Invoice, the problem is when I want to create a new record in the Purchase Header table and complete the information in xLocalizacion, but pressing the new button is only enabled fields Purchase Header table, but the fields xLocalizacion table full which CardPart not enabled. can you help me see what is the big deal, keep in mind that I am new to Navision C / SIDE and my English is not so good. but really need to solve my problem, I hope you understand my problem and can help me, I'll thank you very much in advance.