How to call Abstract class methods.

Hi everyone,

I want to call ParmId() form FormLetter class to the class Salespackingslipjournalcreate class

can any one tell me how to call…


ParmId() method is not exist in the FormLetter class, that is the reason you were not able to use it.

pls check once again whether the method exists or not.


Hi Kumaran

Thanks for reply.

I have ParmId() in FormLetter Class AX 2012

As it is an Abstract class i’m unable to access it.

I’m getting the following error while posting SO for Packing slip

FormLetter object not initialized.

Stack trace

(S)\Classes\SalesPackingSlipJournalCreate\packingSlipWareHouse - line 7
(S)\Classes\SalesPackingSlipJournalCreate\allocateNumAndVoucher - line 102
(S)\Classes\FormletterJournalCreate\getNumAndVoucher - line 11
(S)\Classes\SalesPackingSlipJournalCreate\getNumAndVoucher - line 9
(S)\Classes\FormletterJournalCreate\getJournalNumber - line 9
(S)\Classes\SalesPackingSlipJournalCreate\initHeader - line 28
(S)\Classes\FormLetterJournalCreateInitialVersion\initJournalHeader - line 6
(S)\Classes\FormLetterVersionableJournalCreate\initJournalHeader - line 6
(S)\Classes\FormletterJournalCreate\createJournal - line 17
(S)\Classes\FormletterJournalCreate\run - line 6
(S)\Classes\FormletterService\createJournal - line 29
(S)\Classes\FormletterService\run - line 77
(S)\Classes\FormletterService\postSalesOrderPackingSlip - line 14
(S)\Classes\SysOperationServiceController\runOperation - line 93
(S)\Classes\SysOperationServiceController\runServiceOperation - line 22
(S)\Classes\SysDictClass\invokeStaticMethod - line 26
(S)\Classes\SysDictClass\invokeStaticMethodIL - line 39
(S)\Classes\SysOperationRPCFrameworkService\runServiceOperation - line 5
(C)\Classes\SysOperationServiceController\runOperationWithRunAs - line 7
(C)\Classes\SysOperationServiceController\run - line 22
(C)\Classes\FormLetterServiceController\run - line 3
(C)\Classes\SalesFormLetter\run - line 72
(C)\Classes\SalesFormLetter\main - line 100



I do have FormLetter.parmId() in my AX (AX 2012 R2 CU7), but it’s not related to the error.

You can’t call any methods because the object is null.

Hi Martin,

Thanks for reply

i created a method in SalesPackingSlipJournalCreate class for warehouse wise numbersequence for packingslip

InventLocationId packingSlipWareHouse()
SalesParmLine salesParmLineLocal;
FormLetter formLetter;
select salesParmLineLocal
where salesParmLineLocal.ParmId == formLetter.parmId();
return salesParmLineLocal.inventDim().InventLocationId;

and calling this method in allocateNumAndVoucher() as follows

packingSlipVoucher = SalesParameters::numRefSalesPackingSlipVoucher().NumberSequenceId;

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

return NumberSeq::newGetNumAndVoucherFromId(packingSlipNumber, packingSlipVoucher);
return NumberSeq::newGetNumAndVoucher(SalesParameters::numRefPackingSlipId(),

AllePackingSlipNum is Numbersequencecode EDT field which i created in InventLocation table in new tab

Now i want numbersequence for packingslip no for warehouse which i created manually in AllePackingSlipNum field

First time i run the same code it is worked i got the Numseq for packingslip for warehouse i selected in lines but now it is showing the error what i mentioned in the previous post…

Please help me to do this.



Look at your code:

SalesParmLine salesParmLineLocal;
FormLetter       **formLetter**;

select salesParmLineLocal
    where salesParmLineLocal.ParmId == **formLetter**.parmId();
return salesParmLineLocal.inventDim().InventLocationId;

You never assign any object to formLetter variable, therefore you never have anything to call methods on.

In your particular case, get the value from salesParmUpdate.ParmId.

Hi Martin,

Thank you very much for reply,

I will select from salesParmUpdate.ParmId instead of salesParmLineLocal.ParmId…

My question is: While creating object for FormLetter class im geeting error “Object cannot be created because FormLetter class is an abstract class”

Is there any other way to get ParmId()



You can’t create instances of abstract classes, that’s exactly why they are abstract. They typically contain only partial implementation which needs to be finalized in a child class. FormLetter is the same case - it’s too general to be useful by itself, but it defines useful methods inherited by all subclasses. You can’t create instances of FormLetter, but you can create instances of SalesFormLetter_PackingSlip, for example.

Note you can call methods defined in abstract classes in exactly the same as methods defined in non-abstract classes. The difference it whether you can create instances.

Nevertheless creating a new instance wouldn’t help you, because it would be empty - you wouldn’t get the parm ID you need.

Hi Martin,

Thanks for reply,

I changed the code i struck here

InventLocationId packingSlipWareHouse()
//SalesParmLine salesParmLineLocal;
SalesFormLetter_PackingSlip salesFormLetter_PackingSlip = new SalesFormLetter_PackingSlip();

select salesParmUpdate
where salesParmUpdate.ParmId == salesFormLetter_PackingSlip.parmId();

//return salesParmLineLocal.inventDim().InventLocationId;
return salesParmUpdate.

How can i get inventDim() & InventLocationId in salesParmUpdate table…



Your code makes no sense. You’re trying to find SalesParmUpdate with empty parm ID instead of using the value which is already in the instance variable.

You won’t find line details in SalesParmUpdate; they’re in SalesParmLine.

Hi martin

This is the actual code wrote in AX 2009 SalesFormLetter_Packingslip class

I want same thing to be done in AX2012 for warehouse wise Numseqnce for packingslip

Can you help me…

InventLocationId packingSlipWareHouse()
SalesParmLine salesParmLineLocal;

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

return salesParmLineLocal.inventDim().InventLocationId;