// I added below code in Clicked() of button control
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
InventDim inventDimm;
container c;
int i ;
Args args;
FormRun formRun;
// declare macro for progress bar
#AviFiles
// for progress bar
SysOperationProgress progress = new SysOperationProgress();
// To get multiple selected items from "SysLookupMultiselectCtrl msCtrl;" adding to container
c = msCtrl.getSelectedFieldValues();
ttsbegin;
numberSeq =NumberSeq::newGetNum(purchparameters::numRefPurchId(),true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = 'US_TX_001';
Purchtable.CurrencyCode = 'USD';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
//For progress bar
progress.setCaption("Creating PO Lines");
progress.setAnimation(#AviUpdate);
progress.setTotal(conlen(c));
for(i = 1; i<= conLen(c); i++ )
{
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = conPeek(c,i);
// for progress bar
progress.setText(strfmt("creating line for Item %1", conPeek(c,i)));
progress.setCount(i, 1);
inventDimm.InventLocationId = InventDim_InventLocationId.valueStr();
inventDimm.InventSiteId = InventDim_InventSiteId.valueStr();
PurchLine.PurchQty = PurchLine_PurchQty.realValue() ;
PurchLine.createLine(true, true, true, true, true, false);
PurchLine.clear();
}
ttsCommit;
args = new Args(formstr(PurchTable));
formRun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
InventDim inventDimm;
container c;
int i ;
Args args;
FormRun formRun;
// declare macro for progress bar
#AviFiles
// for progress bar
SysOperationProgress progress = new SysOperationProgress();
// To get multiple selected items from "SysLookupMultiselectCtrl msCtrl;" adding to container
c = msCtrl.getSelectedFieldValues();
ttsbegin;
numberSeq =NumberSeq::newGetNum(purchparameters::numRefPurchId(),true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = 'US_TX_001';
Purchtable.CurrencyCode = 'USD';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
//For progress bar
progress.setCaption("Creating PO Lines");
progress.setAnimation(#AviUpdate);
progress.setTotal(conlen(c));
for(i = 1; i<= conLen(c); i++ )
{
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = conPeek(c,i);
// for progress bar
progress.setText(strfmt("creating line for Item %1", conPeek(c,i)));
progress.setCount(i, 1);
inventDimm.InventLocationId = InventDim_InventLocationId.valueStr();
inventDimm.InventSiteId = InventDim_InventSiteId.valueStr();
PurchLine.PurchQty = PurchLine_PurchQty.realValue() ;
PurchLine.createLine(true, true, true, true, true, false);
PurchLine.clear();
}
ttsCommit;
args = new Args(formstr(PurchTable));
formRun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
No comments:
Post a Comment