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: 

Syntax Error in Test - Class Method

Former Member
0 Kudos

Hello all,

I've created a Class, and when I try to test one of the methods (from within SE24), I'm getting the following error: "Syntax error in test. Display generated test environment?" (When I say Yes, I'm taken to %_JJ_TESTFRAME_CLASS program)

The strange thing is that the code passed the sytax check, and has been activated. Additionally, there's no error logged in ST22.

Any ideas as to what might cause this?

Thanks in advance,

Lisa

1 ACCEPTED SOLUTION

Former Member
0 Kudos

a@s,

Thanks for the quick reply. I do not have anything in either the Protected or Private sections. Here's the definitions in my Public section:

public section.

  types TYPE_V_CUST type STRING .
  types TYPE_V_ZIP type STRING .
  types TYPE_V_OFFICE type STRING .
  types TYPE_SHORT type STRING .
  types TYPE_LONG type STRING .
  types TYPE_BDCDATA type BDCDATA .
  types:
    type_table_bdcdata type TABLE OF type_bdcdata .
  types TYPE_V_STATUS_FOUND type STRING .
  types:
    begin of type_statab,
      city_state(30),                   " City/State
      store_location(20),               " Store # or Loc Name
      service_office(20),               " Office Name
      phoned_in_by(20),                 " Phoned/Reported by
      date_phoned_in(10),               " Date phoned in
      response_date(10),                " Response date
      notification type qmel-qmnum,     " Notification #
      po_number type viqmel-bstnk,      " PO number
      invoice_number(80),               " Invoice #
      invoice_amount type vbak-netwr,   " Inv Amt
      invoice_due_date type vbak-erdat, " Inv Due date
      aufnr type aufk-aufnr,            " Service Order #
      text_line type zlbbil_repairs-text_line1,
      END OF type_statab .
  types:
    type_table_statab type TABLE OF type_statab .

  class-data WA_BDCDATA type BDCDATA .
  class-data BDCDATA type TYPE_TABLE_BDCDATA .
  class-data WA_VIQMEL type VIQMEL .
  class-data WA_VBAK type VBAK .
  class-data WA_STATAB type TYPE_STATAB .
  class-data:
    statab TYPE TABLE OF type_statab .

  class-methods CREATE_NOTIF
    importing
      !V_ZIP type TYPE_V_ZIP
      !V_CUST type TYPE_V_CUST
      !V_OFFICE type TYPE_V_OFFICE
      !V_SHORT_TEXT type TYPE_SHORT
      !V_LONG_TEXT type TYPE_LONG
    exporting
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO .
  class-methods FILL_BDC_DYNPRO
    importing
      !PROGRAM type BDCDATA-PROGRAM
      !DYNPRO type BDCDATA-DYNPRO .
  class-methods FILL_BDC_FIELD
    importing
      !FNAM type BDCDATA-FNAM
      !FVAL type BDCDATA-FVAL .
  class-methods EMAIL_NOTIF_OFF
    importing
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO .
  class-methods EMAIL_NOTIF_CUST
    importing
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO
      !V_EMAIL type STRING .
  class-methods GET_NOTIF_STATUS
    importing
      !V_NOTIF type BAPI2080_NOTHDRE-NOTIF_NO
    exporting
      !V_STATUS_FOUND type TYPE_V_STATUS_FOUND .
  class-methods GET_REPAIRS_DONE
    importing
      !WA_VIQMEL type VIQMEL
    changing
      !STATAB type TYPE_TABLE_STATAB
      !WA_STATAB type TYPE_STATAB .

Anything jump out?

5 REPLIES 5

former_member194669
Active Contributor
0 Kudos

Hi,

Have you define any private types in your class?. I think you cannot use your own private types with public class attributes. if yes you need to define a table type having line structure.

Former Member
0 Kudos

a@s,

Thanks for the quick reply. I do not have anything in either the Protected or Private sections. Here's the definitions in my Public section:

public section.

  types TYPE_V_CUST type STRING .
  types TYPE_V_ZIP type STRING .
  types TYPE_V_OFFICE type STRING .
  types TYPE_SHORT type STRING .
  types TYPE_LONG type STRING .
  types TYPE_BDCDATA type BDCDATA .
  types:
    type_table_bdcdata type TABLE OF type_bdcdata .
  types TYPE_V_STATUS_FOUND type STRING .
  types:
    begin of type_statab,
      city_state(30),                   " City/State
      store_location(20),               " Store # or Loc Name
      service_office(20),               " Office Name
      phoned_in_by(20),                 " Phoned/Reported by
      date_phoned_in(10),               " Date phoned in
      response_date(10),                " Response date
      notification type qmel-qmnum,     " Notification #
      po_number type viqmel-bstnk,      " PO number
      invoice_number(80),               " Invoice #
      invoice_amount type vbak-netwr,   " Inv Amt
      invoice_due_date type vbak-erdat, " Inv Due date
      aufnr type aufk-aufnr,            " Service Order #
      text_line type zlbbil_repairs-text_line1,
      END OF type_statab .
  types:
    type_table_statab type TABLE OF type_statab .

  class-data WA_BDCDATA type BDCDATA .
  class-data BDCDATA type TYPE_TABLE_BDCDATA .
  class-data WA_VIQMEL type VIQMEL .
  class-data WA_VBAK type VBAK .
  class-data WA_STATAB type TYPE_STATAB .
  class-data:
    statab TYPE TABLE OF type_statab .

  class-methods CREATE_NOTIF
    importing
      !V_ZIP type TYPE_V_ZIP
      !V_CUST type TYPE_V_CUST
      !V_OFFICE type TYPE_V_OFFICE
      !V_SHORT_TEXT type TYPE_SHORT
      !V_LONG_TEXT type TYPE_LONG
    exporting
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO .
  class-methods FILL_BDC_DYNPRO
    importing
      !PROGRAM type BDCDATA-PROGRAM
      !DYNPRO type BDCDATA-DYNPRO .
  class-methods FILL_BDC_FIELD
    importing
      !FNAM type BDCDATA-FNAM
      !FVAL type BDCDATA-FVAL .
  class-methods EMAIL_NOTIF_OFF
    importing
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO .
  class-methods EMAIL_NOTIF_CUST
    importing
      !V_NOTIF_FMT type BAPI2080_NOTHDRE-NOTIF_NO
      !V_EMAIL type STRING .
  class-methods GET_NOTIF_STATUS
    importing
      !V_NOTIF type BAPI2080_NOTHDRE-NOTIF_NO
    exporting
      !V_STATUS_FOUND type TYPE_V_STATUS_FOUND .
  class-methods GET_REPAIRS_DONE
    importing
      !WA_VIQMEL type VIQMEL
    changing
      !STATAB type TYPE_TABLE_STATAB
      !WA_STATAB type TYPE_STATAB .

Anything jump out?

0 Kudos

Hi,

Define a table type in Data Dicionary having line structure for

type_statab

I know this not right , but you can try.

Former Member
0 Kudos

a@s,

Thanks so much for the suggestion! It worked. I had already created the type as you mentioned, but just hadn't refered to it when defining the table. I did and it fixed it!! Now it seems to be working properly

Lisa

cuky
Participant
0 Kudos

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.