<?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: Error in Function Module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108347#M982422</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; If you want to use same structure then specify TABLES statement in the beginning of your program below report as TABLES: MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or else if you want to declare an internal table then go for declaring internal table like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
    itab like standard table of MARA,    " Internal table
   wa_mara like line of itab.                 "  Work area

And in select query

SELECT * 
      INTO  TABLE ITAB
    FROM  MARA
  WHERE MATNR = MATERIAL.
      
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above procedure would be better....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this could help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jul 2008 16:41:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-03T16:41:12Z</dc:date>
    <item>
      <title>Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108341#M982416</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;I have a FM in 4.6 with the same code but on syntax check it doesnt give any error, but if i create the same in ECC 6.0 i'm gettinga an error staing tht "A target area must be declared either explicitly with an INTO clause or implicitly with a TABLES statement".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the sample of wat the FM looks like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(MATERAIL) TYPE  MARM-MATNR&lt;/P&gt;&lt;P&gt;*"     VALUE(QUANTITY) TYPE  MSEG-MENGE&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(CONVERTED_QTY) TYPE  MSEG-MENGE&lt;/P&gt;&lt;P&gt;*"  CHANGING&lt;/P&gt;&lt;P&gt;*"     VALUE(FROM_UOM) TYPE  MARM-MEINH OPTIONAL&lt;/P&gt;&lt;P&gt;*"     VALUE(TO_UOM) TYPE  MARM-MEINH OPTIONAL&lt;/P&gt;&lt;P&gt;*"  EXCEPTIONS&lt;/P&gt;&lt;P&gt;*"      INVALID_MATERIAL&lt;/P&gt;&lt;P&gt;*"      INVALID_FROM_UOM&lt;/P&gt;&lt;P&gt;*"      INVALID_TO_UOM&lt;/P&gt;&lt;P&gt;*"      FROM_UOM_FACTOR_IS_ZERO&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;  DATA: INPUT_VALUE TYPE MENGE_D,&lt;/P&gt;&lt;P&gt;        OUTPUT_VALUE TYPE MENGE_D,&lt;/P&gt;&lt;P&gt;        UNIT_NEW_IMP LIKE T006-MSEHI,&lt;/P&gt;&lt;P&gt;        UNIT_OLD_IMP LIKE T006-MSEHI,&lt;/P&gt;&lt;P&gt;        VALUE_MEINS_TMP TYPE F.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is where i'm getting error&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM MARA&lt;/P&gt;&lt;P&gt;    WHERE MATNR = MATERIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    RAISE INVALID_MATERIAL.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 15:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108341#M982416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108342#M982417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In 4.6 MARA is most probably defined in the function group top include like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This creates a header line for MARA and when you do &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM MARA&lt;/P&gt;&lt;P&gt;WHERE MATNR = MATERIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it puts the data selected into the header line. In the 6.0 function group this statement seems to be missing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES is obsolete anyway, you should always declare a header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So your function should look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: LS_MARA TYPE MARA.

SELECT SINGLE * FROM MARA
  INTO LS_MARA
  WHERE MATNR = MATERIAL.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You then have the selected data available in ls_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 15:30:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108342#M982417</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T15:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108343#M982418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think u forgot to include statement&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;tables: Mara.&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;in top include.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Joy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 15:43:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108343#M982418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T15:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108344#M982419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramkumar,&lt;/P&gt;&lt;P&gt;                          According to the ECC5.0 and ECC6.0 versions they won't support tables declaration with Header line .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to your declaration :&lt;/P&gt;&lt;P&gt;TABLES: MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This don't creates a header line for MARA .&lt;/P&gt;&lt;P&gt;So you have to create a work area for the table MARA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and have to use into &amp;lt;workarea&amp;gt; statement in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this answers your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Greetson&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 15:50:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108344#M982419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T15:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108345#M982420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;As this has been done in the top include.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  tables: MARA.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*"----------------------------------------------------------------------
""Local Interface:
*" IMPORTING
*" VALUE(MATERAIL) TYPE MARM-MATNR
*" VALUE(QUANTITY) TYPE MSEG-MENGE
*" EXPORTING
*" VALUE(CONVERTED_QTY) TYPE MSEG-MENGE
*" CHANGING
*" VALUE(FROM_UOM) TYPE MARM-MEINH OPTIONAL
*" VALUE(TO_UOM) TYPE MARM-MEINH OPTIONAL
*" EXCEPTIONS
*" INVALID_MATERIAL
*" INVALID_FROM_UOM
*" INVALID_TO_UOM
*" FROM_UOM_FACTOR_IS_ZERO
*"----------------------------------------------------------------------
DATA: INPUT_VALUE TYPE MENGE_D,
OUTPUT_VALUE TYPE MENGE_D,
UNIT_NEW_IMP LIKE T006-MSEHI,
UNIT_OLD_IMP LIKE T006-MSEHI,
VALUE_MEINS_TMP TYPE F.

This is where i'm getting error.
SELECT SINGLE * FROM MARA
INTO mara
WHERE MATNR = MATERIAL.

IF SY-SUBRC 0.
RAISE INVALID_MATERIAL.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 16:09:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108345#M982420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T16:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108346#M982421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Greetson,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't want to critizise you and you are right that we shouldn't use the TABLES statement anymore in ECC, however (because of backward compatibility) it does still work and the TABLES statement specifically creates a workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore (although we definitely should declare a specific workarea variable and use the INTO statement in the select) the statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will still work in ECC and will create a workarea for table MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 16:34:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108346#M982421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T16:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108347#M982422</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; If you want to use same structure then specify TABLES statement in the beginning of your program below report as TABLES: MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or else if you want to declare an internal table then go for declaring internal table like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
    itab like standard table of MARA,    " Internal table
   wa_mara like line of itab.                 "  Work area

And in select query

SELECT * 
      INTO  TABLE ITAB
    FROM  MARA
  WHERE MATNR = MATERIAL.
      
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above procedure would be better....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this could help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2008 16:41:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-function-module/m-p/4108347#M982422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-03T16:41:12Z</dc:date>
    </item>
  </channel>
</rss>

