AX / D365FO – Link between Load ID and Packing slip ID

When the packing slip ID is generated from the load or the shipment or the packing station, the table WHSLoadTableCustPackingSlipJour stores the link between the load ID and the packing slip ID.

The below example method gets Load from a given packing slip

public static WHSLoadTable findByCustPackingSlipJour(CustPackingSlipJourRecId _recId,boolean _selectforUdpate =  false)
{
	WHSLoadTable                    whsLoadTable;
	WHSLoadTableCustPackingSlipJour jour;

	if(_selectforUdpate)
	{
		whsLoadTable.selectForUpdate(_selectforUdpate);
	}

	select firstonly whsLoadTable
		exists join jour
		where whsLoadTable.LoadId               == jour.WHSLoadTableLoadId
			&& whsLoadTable.DataAreaId          == jour.WHSLoadTableDataAreaId
		&& jour.CustPackingSlipJourRecId        == _recId;

	return whsLoadTable;
}

Leave a comment