‎2008 Jul 03 4:13 PM
Hi,
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".
Below is the sample of wat the FM looks like.
*"----
""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
WHERE MATNR = MATERIAL.
IF SY-SUBRC <> 0.
RAISE INVALID_MATERIAL.
ENDIF.
‎2008 Jul 03 4:30 PM
In 4.6 MARA is most probably defined in the function group top include like
TABLES: MARA.
This creates a header line for MARA and when you do
SELECT SINGLE * FROM MARA
WHERE MATNR = MATERIAL.
it puts the data selected into the header line. In the 6.0 function group this statement seems to be missing.
TABLES is obsolete anyway, you should always declare a header line.
So your function should look something like this:
DATA: LS_MARA TYPE MARA.
SELECT SINGLE * FROM MARA
INTO LS_MARA
WHERE MATNR = MATERIAL.
You then have the selected data available in ls_mara.
Hope that helps,
Michael
‎2008 Jul 03 4:43 PM
I think u forgot to include statement
tables: Mara.
in top include.
Regards,
Joy.
‎2008 Jul 03 4:50 PM
Hello Ramkumar,
According to the ECC5.0 and ECC6.0 versions they won't support tables declaration with Header line .
According to your declaration :
TABLES: MARA.
This don't creates a header line for MARA .
So you have to create a work area for the table MARA
and have to use into <workarea> statement in your code.
Hope this answers your question.
Thanks,
Greetson
‎2008 Jul 03 5:34 PM
Hello Greetson,
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.
Therefore (although we definitely should declare a specific workarea variable and use the INTO statement in the select) the statement:
TABLES MARA.
will still work in ECC and will create a workarea for table MARA.
Regards,
Michael
‎2008 Jul 03 5:09 PM
Try this:
As this has been done in the top include.
tables: MARA.
*"----------------------------------------------------------------------
""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.
‎2008 Jul 03 5:41 PM
Hi,
If you want to use same structure then specify TABLES statement in the beginning of your program below report as TABLES: MARA.
or else if you want to declare an internal table then go for declaring internal table like
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.
The above procedure would be better....
Hope this could help you.
Regards
Narin Nandivada