Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Misleading error in ADT

matt
Active Contributor
1,366

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.
8 REPLIES 8

joltdx
Active Contributor
1,156

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?

matt
Active Contributor
0 Kudos
1,156

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

holger_janz
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,156

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.

matt
Active Contributor
0 Kudos
1,156

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.

holger_janz
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,156

Strange. How is the class ZEN_CA_EMAIL_APPLICATION is defined? Just give me the CLASS statement from the Public Section of the class.

matt
Active Contributor
0 Kudos
1,156
CLASS zen_ca_email_application DEFINITION
  PUBLIC
  FINAL
  CREATE PRIVATE.

matt
Active Contributor
0 Kudos
1,156

I got another one!

What's this about Interface?

RafaelDominguez
Newcomer
0 Kudos
1,112

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.