Do you have any question about this error?
Message type: E = Error
Message class: OO - Class Builder/API
Message number: 036
Message text: Choose either 'Instance method' or 'Class method'
Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of messages in the SAP system have a message text, however this is frequently insufficient to comprehend or resolve the problem.
To make things easier, more detailed information is frequently added to describe the issue, how to fix it, and the necessary steps or configuration modifications.
Unfortunately, there isn't any extra information in this error notice.
First, use our AnswerBot below to get a possible cause and solution (requires a premium subscription).
Also, review the in-depth Common Questions & Answers listed below; you could discover a solution there or be able to connect with others who have faced similar challenges.
You can also try searching the SAP support portal (support.sap.com) but you need a special user ID to access it. It is possible that an SAP support note exists that provides additional details about the mistake or even steps for fixing it.
OO036
- Choose either 'Instance method' or 'Class method' ?The SAP error message OO036, which states "Choose either 'Instance method' or 'Class method'," typically occurs in ABAP Object-Oriented programming when there is ambiguity in method calls or definitions. This error arises when the system cannot determine whether to treat a method as an instance method or a class method.
Cause:
- Ambiguous Method Call: The method being called is defined in both the class and its superclass, and the system cannot determine which one to use.
- Incorrect Method Definition: The method may be defined incorrectly in the class or interface, leading to confusion about its type.
- Missing Specification: The method call does not specify whether it is an instance method (which requires an object of the class) or a class method (which can be called directly on the class itself).
Solution:
Clarify Method Call:
- If you are calling an instance method, ensure that you have created an instance of the class and are calling the method on that instance.
- If you intend to call a class method, ensure that you are using the correct syntax to call it directly on the class.
Example:
DATA: lo_instance TYPE REF TO your_class. CREATE OBJECT lo_instance. lo_instance->instance_method( ). " Instance method call your_class=>class_method( ). " Class method call
Check Method Definitions:
- Review the class and its superclasses to ensure that the method is defined correctly and that there are no conflicting definitions.
- Ensure that the method is declared as either a class method (using
CLASS-METHODS
) or an instance method (usingMETHODS
).Use Explicit Method Type:
- If the method is defined in both the class and its superclass, you can specify the class name to avoid ambiguity.
- Example:
your_class=>method_name( ). " Calls the class method lo_instance->method_name( ). " Calls the instance method
Related Information:
By following these guidelines, you should be able to resolve the OO036 error and clarify the method calls in your ABAP code.
Get instant SAP help. Start your 7-day free trial now.
OO035
The typing method can be 'Like', 'Type', or 'Type Ref To'
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
OO034
Specify the typing method more precisely
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
OO037
Chose either 'Instance event' or 'Class event'
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
OO038
Parameters and exceptions of set or get methods cannot be changed
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
Click on this link to search all SAP messages.