‎2009 Mar 12 1:55 PM
hi
i have just solved an example for method and i m reading the constructor ... the issue is i have read that the "Constructor's signature cannot have importing parameters or exception " where as in almost all examples i saw importing parameter passed by constructors.
kindly help me to remove my confusion
Regards
Ammad
‎2009 Mar 12 2:08 PM
Constructors can only have Importing and Execptions.
They are special methods that is called at runtime as soon as object has been generated in the memory.
Ex:
Calss <name> Definition.
Method Constructor
Importing
parameter type <type>
Execptions
Execption.
Endclass.[Refer|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abap%252bobjects%252b-%252bcreating%252byour%252bfirst%252blocal%252bclass%252b-%252busing%252binstance%252bconstructor]
Regards,
Gurpreet
‎2009 Mar 12 2:11 PM
‎2009 Mar 12 3:33 PM
Hi Ammad,
You probably missread something. What you say is oposite to the truth.
Instance contructor (so the one which is called an object of the class is created) can have only IMPORTING parameters and EXCEPTIONS (but doesn't have to). No EXPORTING and RETURNIG ones are possible though.
On contrary, class contructor (created only once when first object of class is created) cannot have any of the parameters (no interface to it is allowed).
Hope this claryfies your confusion.
Regards
Marcin
‎2009 Mar 13 5:04 AM
Hi:
have a look
[Constructor|http://help.sap.com/saphelp_erp2004/helpdata/EN/08/d27c03b81011d194f60000e8353423/content.htm]
Regards
Shashi
‎2009 Mar 13 5:36 AM
Hi,
Constructors only have importing and exceptions signatures