how to insert PurchId to PurchLineTable


When we create new purchase Order then PurchId is insert into PurchTable as well as PurchLine. But, how to insert PurchId into PurchLine.

Please help me…

Thank You

If you are creating through code

use \Data Dictionary\Tables\PurchLine\Methods\initFromPurchTable method

Hi Kranthi,

Actually I have created a new form CT3Form same as PurchTable. And when we select PurchId in Header then this purchId Is insert into header related Table as well as Line related Table. But this purchId is insert only Header Table not a Line Table.

And I am using this initfrom(HeaderTableName) method . But PurchId is not insert into Line Table.

Please help me…

Thank You

Hello Darshana,

In the “PurchTable” form, for the assignment of PurchId to the PurchLine Table below is the sequence of the methods called:

  1. In \Forms\PurchTable\Data Sources\PurchLine\Methods\initValue

void initValue()


if (purchTable)







  1. In \Data Dictionary\Tables\PurchLine\Methods\initFromPurchTable

void initFromPurchTable(PurchTable purchTable)

  1. In \Classes\PurchLineType\initFromPurchTable

void initFromPurchTable(PurchTable _purchTable)
ProjTable projTable;
InventDim inventDim = purchLine.inventDim();
purchLine.PurchaseType = _purchTable.PurchaseType;
purchLine.PurchId = _purchTable.PurchId;
purchLine.CurrencyCode = _purchTable.CurrencyCode;
purchLine.TaxGroup = _purchTable.TaxGroup;


So it is the initFromPurchTable method of the class PurchLineType where the PurchId, PurchaseType, CurrencyCode etc. fields of the PurchLine table are initialized with the default values from the PurchTable table.

Just check this sequence of the methods called and the code in these methods.

What you’ll have to do is to:

  1. Call the initFromExampleTable method of the ExampleLine table in the initValue method of your forms datasource table i.e. ExampleLine table.

  2. Assign the default values to the fields of the ExampleLine table in the initFromExampleTable method.

Does the form uses the purchTable and purchLine. what exactly you are doing?

Thank you so much it working like

Thanks Shankar

Hi Shankar**,**

Now I want to create a new form : In this form, when we select a BOMID in header at that time related item of BOMId is automatically display on Grid of line.

Please help me…