Post Packing slip from shipment

Hi All,

I am trying to post packing slip from button created in shipment form without showing the standard dialog.

here my job is and it is posting packing slip for all the shipment orders available .

static void my_testPosting(Args _args)
SalesFormLetter salesFormLetter;
WMSShipment shipment;
WMSShipmentId shipmentId = ‘008431_113’;

salesFormLetter = SalesFormLetter_PackingSlip::newPackingSlip();
shipment = WMSShipment::find(shipmentId);
SalesFormletter.update(shipment, systemDateGet(), SalesUpdate::PickingList, AccountOrder::None, false, true);

When I pass in the update call with salesTable, everything was fine.

But when I pass in WMSShipment, and set breakpoint on FormLetterParmData.DoChooseLines(), i found that variable chooseLines (a sysQueryRun) is simply as same as QueryStr(SalesUpdate), has no criteria on shipment Id at all. Therefore, instead of posting packing slip for one specified shipment, this job is trying to post ALL sales orders that have status equal to 2 (Delivered?) or 13 (ToBePicked).

I tested this in Standard AX with demo data. Both Kernel and application version are 6.0.947.280.

Could someone please tell me if I can use the salesFormLetter.update to post packing slip per shipment and how? or is this a known issue?