Piece of code need to convert from ax 2009 to ax 2012

Hi Every one,

I have a piece of code wrote in ax 2009

Can anyone help me write the same in AX 2012

Code wrote in SalesPackingSlipJournalCreate in Ax 2009

packingSlipVoucher = SalesParameters::numRefSalesPackingSlipVoucher().NumberSequence;
packingSlipNumber = inventLocation::find(this.packingSlipWareHouse()).AllePackingSlipNum;
if(packingSlipNumber)
{
return NumberSeq::newGetNumAndVoucherFromCode(packingSlipNumber,packingSlipVoucher);
}
else
{
return NumberSeq::newGetNumAndVoucher(SalesParameters::numRefPackingSlipId(),
SalesParameters::numRefSalesPackingSlipVoucher());
}

New method developer created

InventLocationId packingSlipWareHouse()
{
SalesParmLine salesParmLineLocal;

;
select salesParmLineLocal
where salesParmLineLocal.ParmId ==this.parmId();

return salesParmLineLocal.inventDim().InventLocationId;
}

Help me to convert it into Ax2012

Thanks&Regards

Raghu

This class is related to AX 2012. In AX 2009 this code will be handled in related form letter classes. (salesFormLetter, salesFormLetter_PackingSlip)

Hi Kranthi,

Thanks for reply,

I want to write that code in SalesPackingslipJournalCreate in AX2012 which is already there in SalesFormLetter_PackingSlip in Ax 2009

can u help me.

Thanks&regards

Raghu

It seems in AX 2009, you have modified \Classes\SalesFormLetter_PackingSlip\allocateNumAndVoucher

\Classes\SalesPackingSlipJournalCreate\allocateNumAndVoucher is the equivalent method in AX 2012.

Hi Kranthi,

Thanks for reply,

Yes what you said is right I wrote the code in 2012 SalesPackingSlipJournalCreate\allocateNumAndVoucher

packingSlipVoucher = SalesParameters::numRefSalesPackingSlipVoucher().NumberSequenceId;

packingSlipNumber = Numbersequencetable::findByNaturalKey(InventLocation::find(this.packingSlipWareHouse()).AllePackingSlipNum).RecId;

if

(packingSlipNumber)

{

return

NumberSeq::newGetNumAndVoucherFromId(packingSlipNumber, packingSlipVoucher);

}

else

{

return NumberSeq::newGetNumAndVoucher(SalesParameters::numRefPackingSlipId(),

SalesParameters::numRefSalesPackingSlipVoucher());

}


InventLocationId packingSlipWareHouse()

{

SalesParmLine salesParmLineLocal;

FormLetter formLetter;

;

select

salesParmLineLocal

where

salesParmLineLocal.ParmId == formLetter.parmId();

return

salesParmLineLocal.inventDim().InventLocationId;

}

Thanks&Regards

Raghu