Call PurchEditLines form and fill lines

Hi All,

I need to call PurchEditLines form for picking list and get some lines from some purchases like pushing select button at PurchEditLines form. I couldn’t found anything about this.

I just found create picking list from purchase code…

Fix for writing mistakes:

I need to call PurchEditLines form for generate one packing slip from some lines of some purchases like pushing “select” button at PurchEditLines form. I couldn’t found anything about this.

I looked up purchformletter class without any success…

any opinion???

Updated because of bad english:

You can run PurchEditLines and select some lines of some purchases with select button. I just want to do this with X++:

1-Select some purchases with purchFormLetter class (I just succeded select one purchase).

2-Filter some lines of these purchases. (I couldn’t succeded)

3-Show these at PurchEditLines form.

This is my code part:

l = purchformletter::construct(DocumentStatus::PackingSlip);

args.object(l);

args.record(tmpPurchTable);

args.parm(VendReceiptsListJour.ReceiptsListId);

mf = new menufunction(identifierstr(purchformletter_packingslip), MenuItemType::Action);

mf.run(args);

There are more than one record at my tmpPurchTable temporary table but it see just one of them. Also I need to filter some lines of these purchases, I couldn’t find out a way…

Please, I’m waiting an answer… :slight_smile:

I hope I could tell me at this time… :frowning:

Found solution. It was hard for me to find out:

Object formRun;
Args args = new Args();
PurchFormLetter purchFormLetter;
purchTable purchTable;
VendReceiptsListTrans ListTrans;
PurchParmLine purchParmLine;
PurchParmTable purchParmTable;
;
select purchTable where purchTable.PurchId == this.PurchId;
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);
purchFormLetter.parmSourceTable(purchTable);
purchFormLetter.initLinesQuery();
purchformletter.createParmUpdate();
purchformletter.chooseLines();
while select OrigpurchId from ListTrans
group by ListTrans.OrigPurchId
where ListTrans.ReceiptsListId == this.ReceiptsListId && ListTrans.OrigPurchId != this.PurchId
{
select purchTable where purchTable.PurchId == ListTrans.OrigPurchId;
purchformletter.updateQueryAndChooseLines(purchTable);
}
ttsbegin;
while select forupdate purchParmLine
where purchParmLine.ParmId == purchformletter.parmId()
{
select firstonly ListTrans where ListTrans.ReceiptsListId == this.ReceiptsListId && ListTrans.OrigPurchId == purchParmLine.OrigPurchId &&
ListTrans.ItemId == purchParmLine.ItemId;
if (ListTrans.RecId == 0)
purchParmLine.delete();
}
update_recordset purchParmTable setting num = this.ETGpackingSlipId where purchParmTable.ParmId == purchformletter.parmId();
ttscommit;
purchformletter.reArrange(true);
args.name(formstr(PurchEditLines));
args.caller(purchformletter);
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.ETGfromVendReceiptJour(this.RecId);
formRun.run();
formRun.wait();

Hi,

The above code was in ax2009. I was struggling a lot to write above code in Ax2012 ( posting of multiple sales or purchase orders to a single sales or purchase invoice.

Pls, help me… if you get any solution.

Thanks a lot in advance…

Daxing

Sorry, my case was with 2009, I haven’t got tried with 2012… :frowning:

Hi ,

Could you try in Ax2012 and help me … i tried but, only blank form i am able to get. But for 1 SO i can popup the posting form(SalesEditLines Form).

Daxing :slight_smile:

Sorry, it was four days work just done with 2009 for me… I need a big spare time for try this…

Maybe you have to get help from experts like Martin Drab… :slight_smile:

Hi,

This code was wrong for ax2009 too. I fixed it, maybe it would be run for 2012 now:

change these lines;

args.name(formstr(PurchEditLines));
args.caller(purchformletter);
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.ETGfromVendReceiptJour(this.RecId);
formRun.run();
formRun.wait();

with these:

dialog = purchformletter.dialog( );

dialog.run() ;
dialog.wait( );
if (dialog.closedOk( ))
{
purchformletter.run() ;