<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Syntax Error: May not use object or type in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323283#M510357</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You on ramp-up?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2007 21:35:55 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-06-13T21:35:55Z</dc:date>
    <item>
      <title>Syntax Error: May not use object or type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323280#M510354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to make a method call to a static method&lt;/P&gt;&lt;P&gt;I get the following syntax error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Include Z_TEST_FRAMEWORK_TOP&lt;/P&gt;&lt;P&gt;(E) Package "TESTFRAMEWORK" must not use object "CLAS CL_AUNIT_ASSERT CLAS" from Package "SABP_UNIT_CORE_API" in one of the following ways:&lt;/P&gt;&lt;P&gt;"Use object or type"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The original message in German:&lt;/P&gt;&lt;P&gt;Include Z_TEST_FRAMEWORK_TOP&lt;/P&gt;&lt;P&gt;(E) Paket "TESTFRAMEWORK" darf das Objekt "CLAS CL_AUNIT_ASSERT CLAS"&lt;/P&gt;&lt;P&gt;aus Paket "SABP_UNIT_CORE_API" in keiner der folgenden Arten verwenden:&lt;/P&gt;&lt;P&gt;"Use object or type"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to write a unit test in ABAP Unit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Include Z_TEST_FRAMEWORK_TOP                              Report Z_TEST_FRAMEWORK_P
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT   Z_TEST_FRAMEWORK_P.

CLASS ZCalculator DEFINITION.
  PUBLIC SECTION.
    METHODS:
      constructor,
      type_in IMPORTING x TYPE i,
      add IMPORTING x TYPE i,
      sub IMPORTING x TYPE i,
      get_res RETURNING value(r) TYPE i.

  PRIVATE SECTION.
    DATA:
      res TYPE i. "The Value shown on the calculators display.

ENDCLASS.

START-OF-SELECTION.

WRITE 'Running Calculator Test'.
DATA: lv_calc TYPE REF TO ZCalculator.
CREATE OBJECT lv_calc.
CALL METHOD lv_calc-&amp;gt;type_in( 5 ).
CALL METHOD lv_calc-&amp;gt;add( 3 ).

DATA: lv_res TYPE i.
lv_res = lv_calc-&amp;gt;get_res( ).
WRITE: /, 'LV_RES= ', lv_res.

CLASS ZTestCalculator DEFINITION
                      FOR TESTING
                      RISK LEVEL HARMLESS
                      DURATION SHORT.
  PRIVATE SECTION.
    DATA: lo_calc TYPE REF TO ZCalculator.

    METHODS:
      setup FOR TESTING,
      test_type_in FOR TESTING,
      test_add     FOR TESTING,
      test_sub     FOR TESTING,
      test_get_res FOR TESTING.
ENDCLASS.

CLASS ZCalculator IMPLEMENTATION.
  METHOD constructor.
    res = 0.
    "WRITE: /, 'RES= ', res.
  ENDMETHOD.

  METHOD type_in.
    res = x.
    "WRITE: /, 'RES= ', res.
  ENDMETHOD.

  METHOD add.
    res = res + x.
    "WRITE: /, 'RES= ', res.
  ENDMETHOD.

  METHOD sub.
    res = res - x.
    "WRITE: /, 'RES= ', res.
  ENDMETHOD.

  METHOD get_res.
    r = res.
  ENDMETHOD.
ENDCLASS.

CLASS ZTestCalculator IMPLEMENTATION.
  METHOD setup.
    CREATE OBJECT lo_calc.
  ENDMETHOD.

  METHOD test_type_in.
    DATA: lv_res TYPE i.
    lv_res = lo_calc-&amp;gt;get_res( ).

    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).
    lo_calc-&amp;gt;type_in( x = 5 ).
    lv_res = lo_calc-&amp;gt;get_res( ).
    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 5 ).

  ENDMETHOD.

  METHOD test_add.
    DATA: lv_res TYPE i.
    lv_res = lo_calc-&amp;gt;get_res( ).

    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).
    lo_calc-&amp;gt;type_in( x = 5 ).
    lo_calc-&amp;gt;add( x = 5 ).
    lv_res = lo_calc-&amp;gt;get_res( ).
    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 11 ).
  ENDMETHOD.

  METHOD test_sub.
    DATA: lv_res TYPE i.
    lv_res = lo_calc-&amp;gt;get_res( ).

    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).
    lo_calc-&amp;gt;type_in( x = 5 ).
    lo_calc-&amp;gt;sub( x = 5 ).
    lv_res = lo_calc-&amp;gt;get_res( ).
    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).
  ENDMETHOD.

  METHOD test_get_res.
    DATA: lv_res TYPE i.
    lv_res = lo_calc-&amp;gt;get_res( ).

    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).
    lo_calc-&amp;gt;type_in( x = 5 ).
    lv_res = lo_calc-&amp;gt;get_res( ).
    cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 5 ).
  ENDMETHOD.
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error happens in first line where the test method calls:&lt;/P&gt;&lt;P&gt;cl_aunit_assert=&amp;gt;assert_equals( ACT = lv_res EXP = 0 ).&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error does not happen if I remove all cl_aunit_assert=&amp;gt;assert_equals from my test class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I have to import the ABAP Unit Package before I can use it in my project?&lt;/P&gt;&lt;P&gt;I am a abap novice, how can I import a package?&lt;/P&gt;&lt;P&gt;Could it be possible that my project does not have enough permissions to call a method from ABAP Unit or other projects?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Yours,&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 18:34:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323280#M510354</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T18:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Error: May not use object or type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323281#M510355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No need to import anything, but I see something interesting in your coding, can you please tell me what NetWeaver release you are using?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 18:42:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323281#M510355</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-06-13T18:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Error: May not use object or type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323282#M510356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My SAP's component version is ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Tom Dinkelaker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 20:54:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323282#M510356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T20:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Error: May not use object or type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323283#M510357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You on ramp-up?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 21:35:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323283#M510357</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-06-13T21:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax Error: May not use object or type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323284#M510358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahh,  I see that you are an SAP employee, you would probably get better support on this issue internally since 7.10 is only in ramp-up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 21:47:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-error-may-not-use-object-or-type/m-p/2323284#M510358</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-06-13T21:47:35Z</dc:date>
    </item>
  </channel>
</rss>

