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: 
Read only

syntax error in class pool : "'method argument'" is not valid (MESSAGEG07)

Sandra_Rossi
Active Contributor
1,474

I just had an issue with the syntax check, I couldn't post the question because I couldn't make you reproduce it, so now I can tell you how to reproduce but it's also the answer.

To reproduce, create the following program with 3 local classes, convert them automatically into class pools (SE24, menu Object type -> Import -> Local classes in program):

REPORT ztestprog.
CLASS animal DEFINITION ABSTRACT CREATE PROTECTED.
  PROTECTED SECTION.
    METHODS constructor IMPORTING animal_name TYPE csequence.
ENDCLASS.
CLASS arthropod DEFINITION ABSTRACT INHERITING FROM animal.
ENDCLASS.
CLASS crustacean DEFINITION CREATE PROTECTED INHERITING FROM arthropod.
  PROTECTED SECTION.
    METHODS constructor IMPORTING animal_name TYPE csequence.
ENDCLASS.

CLASS animal IMPLEMENTATION.
  METHOD constructor.
  ENDMETHOD.
ENDCLASS.
CLASS arthropod IMPLEMENTATION.
ENDCLASS.
CLASS crustacean IMPLEMENTATION.
  METHOD constructor.
    super->constructor( 'method argument' ).
  ENDMETHOD.
ENDCLASS.

There's a little issue with the tool for ABSTRACT classes, so manually edit the class pools via the source-based editor of SE24 or via ADT, and respectively set CREATE PROTECTED for ZCL_ANIMAL and remove CREATE PUBLIC for ZCL_ARTHROPOD.

Activate all the 3 class pools.

Now edit ZCL_ARTHROPOD and remove the line "PROTECTED SECTION" (it's an empty block) and activate.

Go to ZCL_CRUSTACEAN and the syntax check says "'method argument'" is not valid (corresponds to MESSAGEG07 in the table TRMSG).

Why?

Thanks.

Sandra

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
1,255

Edit the abstract class pool from which the method originates (ZCL_ARTHROPOD in my example), add the following line:

PROTECTED SECTION.

Activate.

Go to the subclass which had the syntax error message (ZCL_CRUSTACEAN in my example) and activate it, it should now work.

I just had an issue with the syntax check, I couldn't post the question because I couldn't make you reproduce it, so now I can tell you how to reproduce but it's also the answer.

To reproduce, create the following program with 3 local classes, convert them automatically into class pools (SE24, menu Object type -> Import -> Local classes in program):

REPORT ztestprog.
CLASS animal DEFINITION ABSTRACT CREATE PROTECTED.
  PROTECTED SECTION.
    METHODS constructor IMPORTING animal_name TYPE csequence.
ENDCLASS.
CLASS arthropod DEFINITION ABSTRACT INHERITING FROM animal.
ENDCLASS.
CLASS crustacean DEFINITION CREATE PROTECTED INHERITING FROM arthropod.
  PROTECTED SECTION.
    METHODS constructor IMPORTING animal_name TYPE csequence.
ENDCLASS.

CLASS animal IMPLEMENTATION.
  METHOD constructor.
  ENDMETHOD.
ENDCLASS.
CLASS arthropod IMPLEMENTATION.
ENDCLASS.
CLASS crustacean IMPLEMENTATION.
  METHOD constructor.
    super->constructor( 'method argument' ).
  ENDMETHOD.
ENDCLASS.

There's a little issue with the tool for ABSTRACT classes, so manually edit the class pools via the source-based editor of SE24 or via ADT, and respectively set CREATE PROTECTED for ZCL_ANIMAL and remove CREATE PUBLIC for ZCL_ARTHROPOD.

Activate all the 3 class pools.

Now edit ZCL_ARTHROPOD and remove the line "PROTECTED SECTION" (it's an empty block) and activate.

Go to ZCL_CRUSTACEAN and the syntax check says "'method argument'" is not valid (corresponds to MESSAGEG07 in the table TRMSG).

Why?

Thanks.

Sandra

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
1,256

Edit the abstract class pool from which the method originates (ZCL_ARTHROPOD in my example), add the following line:

PROTECTED SECTION.

Activate.

Go to the subclass which had the syntax error message (ZCL_CRUSTACEAN in my example) and activate it, it should now work.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,255

ABAP 7.52 SP 1.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,255

Little summary: the message ""'method argument'" is not valid" happens when the argument is not expected i.e. there's no corresponding parameter in the called method, but in my example snippet this parameter exists so the argument is valid... but there's a little "bug/flaw" in the ABAP syntax check.