I have been trying to post packing slip from code. I have tried several ways but unfortunately without success.

My code is below:

purchTable = PurchTable::find('PO0012555');
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);
purchformLetter.getLast();
purchFormLetter.transDate(transDate);
numberSeq  = NumberSeq::newGetNum(PurchParameters::numRefPurchPackingSlipId()).num();
purchFormLetter.update(purchTable,
"14",// numberSeq, //this is coming out blank
transDate,
PurchUpDate::All,
AccountOrder::None,
       false,
       false);

When I tried to execute, I was getting this error:

Inventory is closed for physical and financial transactions until

Do you have any idea? Any help will be appreciated. Thanks

有帮助吗?

解决方案 3

Thanks to masters who tried to help me but I figured out my problem. There is no problem about my code or anywhere.

We are working on this project with another consulting company. Somehow, one of developer who works other company remarked (commented) transdate line at PurchFormLetter class without any information.

So, when I tried to set transdate value at "purchFormLetter.transDate(transDate)" line, PurchFormLetter could not able to set the value cause of remarked line.

I uncommented the line and the code worked like a charm.

其他提示

My guess: your transDate variable does not have a valid date.

Using the cross reference you see the error only occurs in the checkOpen method of the table InventClosing. Feel free to add a breakpoint here!

The method will fail if called with a blank transaction date.

Are you posting to a closed period? What is transdate? Check (General Ledger>Setup>Periods>Periods)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top