The following sample code used to create the agreement journals using PricePriceDiscJournalService.
static void Krishh_ImportPriceTradeAgreementJournals(Args _args)
{
// variable declaration
PricePriceDiscJournalService PriceDiscSvc;
PricePriceDiscJournal PriceDiscJour;
PricePriceDiscJournal_PriceDiscAdmTrans PriceDiscJourAdmTrans;
PricePriceDiscJournal_InventDim PriceDiscJourDim;
AifEntityKeyList keys;
// Instantilization
PriceDiscSvc = PricePriceDiscJournalService::construct();
PriceDiscJour = new PricePriceDiscJournal();
PriceDiscJourAdmTrans = PriceDiscJour.createPriceDiscAdmTrans().addNew();
PriceDiscJourDim = PriceDiscJourAdmTrans.createInventDim().addNew();
// Set PriceDiscJourDim by getting the invent Item from EcoResProduct
PriceDiscJourDim.parminventDimId(InventDimCombination::
findByDistinctProductVariant(
EcoResProduct::findByDisplayProductNumber(
"PT SKRUE WN 5451 K30").RecId)
.InventDimId);
//PriceDiscJourAdmTrans
//you can pass the field parameters based on the fields that available with you.'
PriceDiscJourAdmTrans.parmInventDim().add(PriceDiscJourDim);
PriceDiscJourAdmTrans.parmItemRelation("1-02-51400");
PriceDiscJourAdmTrans.parmItemCode(TableGroupAll::Table);
PriceDiscJourAdmTrans.parmAmount(98.00);
PriceDiscJourAdmTrans.parmFromDate(today());
PriceDiscJourAdmTrans.parmAccountCode(TableGroupAll::All);
//define the purch prices or sales prices by defining the enum below
PriceDiscJourAdmTrans.parmrelation(PriceType::PriceSales);
// you can pass your own currency or you can get company standard currency
PriceDiscJourAdmTrans.parmCurrency(CompanyInfo::standardCurrency());
// creates the journal
// open the Procurement and sourcing and inquires you can click on price discount agreement journals.
// you can review the journal and post the journal.
keys = PriceDiscSvc.create(PriceDiscJour);
}
Hi Mate,
ReplyDeleteIs there a way to post the journal automatically as well?
Thanks!!!!
Hi Krishna,
ReplyDeleteis there a way to update a price agreement journal?
Thanks,
Waseem.
Hi Krishna,
ReplyDeleteHow we can create price discount journal from EP Ax 2012?