Application Development 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: 

Error in class while executing in SE24

former_member244346
Participant
0 Kudos
849

Hello Experts,

I have created a global class in SE24 and when i am trying to execute that class in direct SE24 its giving some error "Syntax error in test Display generated test environment?" but when i am calling into program and executing its working fine and when i am checking syntax check there no error. Anybody can help me on this.

Referred below link but couldn't understand.

https://archive.sap.com/discussions/thread/525480

Thanks,

6 REPLIES 6

SimoneMilesi
Active Contributor
0 Kudos
379

Did you try to perform a syntax check?

Maybe in your report you invoke a method not afflicted by the error, but something is going wrong somewhere else.

former_member244346
Participant
0 Kudos
379

Issue resolved...

SimoneMilesi
Active Contributor
379

And it was.... ?

If the issue is resolved, please, share the answer and close the question so other people stumbling on it will get an help.

cuky
Participant
0 Kudos
379

I had the same error and discovered that the cause was a line in my class code that was too long. I declared some local types, and some of the parameters in my methods were defined of that type, so that the whole line of code looked something like this:

CLASS-METHODS do_something
IMPORTING iv_parameter_name TYPE zcl_my_long_class_name=>ts_my_structure_type-field_in_structure.

This line of code was too long. I've changed the parameter's type to a dictionary type, made sure that there were no other long lines of code in the class, tried to re-generate the test class environment, and it worked.

Sandra_Rossi
Active Contributor
0 Kudos
379

Probably there are other possible syntax errors (as I could see by searching the SAP notes), would you recommend a place where to add a break-point in the standard code of SE37 to know which exact syntax error it is? Maybe adding a break-point at statement SYNTAX-CHECK, INSERT REPORT or something like that could be sufficient?

0 Kudos
379

Hi Sandra,

The steps I took to discover this are as follows:

  1. I tried to execute the class Test Environment by click F8 when inside the class.
  2. I got a popup: "Syntax error in test. Display generated test environment?" I clicked "Yes".
  3. I got a status-bar error message: "Test frame could not be generated". I double-clicked it and discovered it is message OO751 (ID 'OO', number 751).
  4. I navigated there using the Technical Information button (also possible by going to SE91 of course), and clicked Where-used.
  5. I set a break-point in every usage. The one that turned out to be relevant was in function SETS_GN_CLASS_FRAME_GENERATE, line 76.

  6. I executed the class again, entered the debugger, cleared the value of L_SUBRC, skipped the MESSAGE statement and resumed the operation. I got the same popup as before, clicked "Yes", entered the debugger again, cleared L_SUBRC and skipped the MESSAGE statement again, then I ended up in the generated report %_JJ_TESTFRAME_CLASS.
  7. I tried to execute (F8) this report, but it jumped to a problematic line of code, with a red text below it saying 'LINE_TOO_LONG':
  8. I went back to my class, clicked on 'Source-code Based' (Ctrl+Shift+0) and entered the source-code view of the whole class.
  9. I edited this code and made sure no line of code exceeds 115 characters, which appears to be the maximum line length in a class that allows the generation of the Test Environment.

So, in summary:

  1. Go to message class 'OO' number 751.
  2. Click Where-used.
  3. Put a break-point in every usage.
  4. Debug, clear L_SUBRC and skip the MESSAGE statements.
  5. Find out what is wrong with the code of the generated test environment.

Good luck!