2021 May 14 3:21 PM
Create a class, with a factory method, that returns an instance with an attribute "tcode".
call transaction zen_ca_test=>get_instance( somevar )->tcode with authority-check.
You get the error.
The class ZEN_CA_TEST=>GET_INSTANCE( cannot be created as "FOR TESTING" since it is already referenced by non-test source code.
I suspect this isn't quite right...
This works fine, btw.
DATA(test) = zen_ca_test=>get_instance(somevar ).
CALL TRANSACTION application->tcode WITH AUTHORITY-CHECK.
2021 May 14 6:27 PM
I agree that it doesn't sound quite right, what if you do it with a class that does not contain the word "test"? Could it be some weird thing like that? 🙂
I tried your call transaction in my 1909 dev edition and I got the error "No method can be specified in the current position". Which version are you on?
2021 May 17 9:16 AM
My actual code doesn't contain the word test!
1909? So... ABAP Restful?
I'm using full phat (deliberate misspelling due to poor implementation of automoderation "banned" words).
ABAP connected to a proper appserver. 750, SP17, Eclipse 2021-03, ADT 3.16.4
2021 May 19 8:21 AM
The position CALL TRANSACTION <tcode> ... is not expression enabled. The correct error message is "No method can be specified in the current position". It looks like the system you are using has a mixed-up translation for this message. This can occur if a usage of a syntax message was changed in the ABAP compiler but the adaption of the message table was not updated correctly (usually done during upgrade). You can check it in db table TRMSG. The key for this message is KEYWORD=MESSAGE and MSGNUMBER=G"5 with ADT data preview or SE16.
2021 May 19 9:51 AM
holger.janz Thanks for the feedback, but the text of the error I see isn't in TRMSG. Nor indeed is "No method can be specified in the current position",
My actual code is:
CALL TRANSACTION
zen_ca_email_application=>get_application( i_application )
WITH AUTHORITY-CHECK.
The class ZEN_CA_EMAIL_APPLICATION=>GET_APPLICATION( cannot be created as "FOR TESTING" since it is already referenced by non-test source code.
2021 May 26 12:51 PM
Strange. How is the class ZEN_CA_EMAIL_APPLICATION is defined? Just give me the CLASS statement from the Public Section of the class.
2021 May 26 1:39 PM
CLASS zen_ca_email_application DEFINITION
PUBLIC
FINAL
CREATE PRIVATE.
2021 Jun 01 6:11 AM
2024 Apr 01 4:39 PM
Got the same error and nothing is declared as "for testing", but I noticed that if in the method call I put "EXPORTING" before the parameters I dont get the error message anymore.