Skip to Content

Does a quick fix exist to create a constructor?

I really like to work with quick fixes, but I’m missing one feature in creation of methods from quick fix. If I take an existing class “ZCL_NEW_CLASS” and try to instatiate an object from it there is no quick fix to add a constructor from the given context. Is this planned or could it be added to the list of quick fixes to enable in future?

Example:

DATA(example) = NEW ZCL_NEW_CLASS( is_marc = ls_marc ).

CTRL+1 on “ZCL_NEW_CLASS” should give the suggestion “Create constructor” with parameter is_marc with type of the supplied ls_marc, as in the normal object->new_method( ) Quick fix.

Regards, Phillip

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Sep 11, 2018 at 11:31 AM

    Quick fixes exist to create constructors, class constructors and factory methods. But you need to do it from the class, just position your cursor on the class definition statement. It will ask you which attributes to create importing parameters for and generate the code for those too.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.