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

Custom OO Class Error in Class-data

sap_cohort
Active Contributor
0 Likes
435

I have a class I defined with some public class attributes. I have an internal table defined. When I go to test the class I get an error

"Syntax Error in test"

"Display Generated test environment?"

When I say yes it presents an ABAP program

"%_JJ_TESTFRAME_CLASS" that syntax checks with some error on code that is using my table name.

The Class activates fine and as soon as I take out the reference to the table I can test again with no problems.

Anyone know why an internal table defined in a public class would cause such an error?

The type of "OBJECT-FAILED_STEPS" cannot be converted to the type of

"ZCLDW_ALERTS2=>FAILED_STEPS".

CLASS ZCLDW_ALERTS2 DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

*"* public components of class ZCLDW_ALERTS2
*"* do not include other source files here!!!
  PUBLIC SECTION.

    CLASS-DATA STARTING_TIMESTAMP TYPE RSTIMESTMPL .
    CLASS-DATA FAILED_STEPS       TYPE STANDARD TABLE OF ZBILOG .

    CLASS-METHODS GET_LAST_TIME_STAMP
      IMPORTING
        VALUE(BEG_DATE) TYPE SYDATUM
        VALUE(BEG_TIME) TYPE SYUZEIT
      EXPORTING
        !STARTING_TIMESTAMP TYPE RSTIMESTMPL .

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
353

Hello Kenneth

If you want to define your own types (including itab's) you have to use the TYPES section of the class (push button "TYPES").

These types are, of course, private. Thus, you cannot use your private types with public class attributes.

I would recommend to define a table type having line structure ZBILOG.

Regards

Uwe

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
354

Hello Kenneth

If you want to define your own types (including itab's) you have to use the TYPES section of the class (push button "TYPES").

These types are, of course, private. Thus, you cannot use your private types with public class attributes.

I would recommend to define a table type having line structure ZBILOG.

Regards

Uwe

Read only

0 Likes
353

> I would recommend to define a table type having line

> structure ZBILOG.

>

> Regards

> Uwe

That's just wrong! But it works...

Thanks!