public static void InitVaues(SalesAgreementHeader _SalesAgreementHeader)
{
SalesAgreementForm salesAgreementForm;
AgreementLineDefault _agreementLineDefault;
AgreementLine _agreementLine;
AgreementLineQuantityCommitment _AgreementLineQuantityCommitment;
inventDim inventDim;
_AgreementLineQuantityCommitment = _agreementLine as AgreementLineQuantityCommitment;
_AgreementLineQuantityCommitment.clear();
_AgreementLineQuantityCommitment.initValue();
_AgreementLineQuantityCommitment.initFromAgreementHeader(_SalesAgreementHeader);
_AgreementLineQuantityCommitment.Agreement = _SalesAgreementHeader.RecId;
_AgreementLineQuantityCommitment.AgreementLineType = CommitmentType::ProductQuantity;
_AgreementLineQuantityCommitment.AgreementLineProduct = AgreementLineProduct::Item;
_AgreementLineQuantityCommitment.ItemId = "";
_AgreementLineQuantityCommitment.PricePerUnit = "";
_AgreementLineQuantityCommitment.CommitedQuantity = "";
_AgreementLineQuantityCommitment.LineDiscountPercent = "";
_AgreementLineQuantityCommitment.LineDiscountAmount ="";
_AgreementLineQuantityCommitment.LineDscAmount2 = "";
_salesLineDim = _AgreementLineQuantityCommitment.inventDim();
_AgreementLineQuantityCommitment.initFromInventTable();
inventDim = _AgreementLineQuantityCommitment.inventDim();
switch (_AgreementLineQuantityCommitment.agreementModuleType())
{
case ModuleSalesPurch::Sales:
inventDim.initFromInventTable(_AgreementLineQuantityCommitment.inventTable(), InventItemOrderSetupType::Sales, _salesQuotationLineDim);
break;
case ModuleSalesPurch::Purch:
inventDim.initFromInventTable(_AgreementLineQuantityCommitment.inventTable(), InventItemOrderSetupType::Purch, _salesQuotationLineDim);
break;
}
inventDim.InventDimId = InventDim::findOrCreate(_salesLineDim).InventDimId;
_AgreementLineQuantityCommitment.setInventDimId(_salesLineDim.InventDimId);
_AgreementLineQuantityCommitment.InventDimDataAreaId = curext();
_AgreementLineQuantityCommitment.ExpirationDate = _SalesAgreementHeader.DefaultAgreementLineExpirationDate;
_AgreementLineQuantityCommitment.DefaultDimension = _salesLineDim.DefaultDimension;
;
_AgreementLineQuantityCommitment.insert();
}
}