2007 Dec 26 6:06 AM
Hi friends,
Happy New year to all.
I am facing the problem while crating Function module.
As my requirement:
I need to call this Function module in SAP-BW application area. I am creating this in BW side(SE37).
The intenal table which i am passing to the function module will vary. The structure is not constant.
Data is flowing from one table(source table) to another table(Destination table) . In BW if we want to refer the data in source table in START ROUTINE while loading, we use SOURCE_PACKAGE internal table.
1) I am passing Source_package internal table as ITAB_SOURCE_PACKAGE. (this source_package strucute also not canstant, it will vary)
2) passing second internal table as ITAB1, this structure also vary. I will declare this structure before calling the function module.
In Function module Table tab i given as
PARAMETER TYPE Associated Type
ITAB1 LIKE ANY
ITAB_SOURCE_PACK LIKE ANY
In Import tab:
SOURCEINFOOBJECT pass value
In source code i written as
DATA: WA_SOURCE_PACK like line of ITAB_SOURCE_PACK.
DATA: WA_ITAB1 like line of ITAB1.
LOOP AT ITAB_SOURCE_PACK INTO WA_SOURCE_PACK.
READ TABLE ITAB1 WITH KEY SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT
INTO WA_ITAB1.
IF SY-SUBRC NE 0.
WA_ITAB1-SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT.
INSERT WA_ITAB1 INTO TABLE ITAB1.
ENDIF.
ENDLOOP.
(Note: this is piece of code)
While checking i am getting as error
Field "ANY" is unknown. It is neither in one of the specified tablesnor defined by a "DATA" statement. "DATA" statement. "DATA" statement.
For this what i need to do.
As i am not very good in ABAP, pls help me.
Thanks & Regard
MRK
2007 Dec 26 6:10 AM
instead of like use type..
ITAB1 TYPE ANY
ITAB_SOURCE_PACK type ANY
plz reward points if dis helps
2007 Dec 26 6:14 AM
Hi,
Thanks for reply.
Still i am getting same message. Even after chainging LIKE to TYPE
2007 Dec 26 6:19 AM
Hi,
u have to do like this..decalre itab1 and ITAB_SOURCE_PACK in the tables parameter...
so change like this
In Function module Table tab do like this
PARAMETER TYPE Associated Type
ITAB1
ITAB_SOURCE_PACK
In Import tab:
SOURCEINFOOBJECT pass value
In source code i written as
DATA: WA_SOURCE_PACK type ITAB_SOURCE_PACK.
DATA: WA_ITAB1 type ITAB1.
LOOP AT ITAB_SOURCE_PACK INTO WA_SOURCE_PACK.
READ TABLE ITAB1 WITH KEY SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT
INTO WA_ITAB1.
IF SY-SUBRC NE 0.
WA_ITAB1-SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT.
INSERT WA_ITAB1 INTO TABLE ITAB1.
ENDIF.
ENDLOOP.
Regards,
Nagaraj
2007 Dec 26 6:37 AM
Hi,
What should i give associated type for
ITAB1 and ITAB_SOURCE_PACK in TABLES tab of the function module.
If i left empty, it giving as ITAB_SOURCE_PACK is not defined. If i give TYPING as TYPES and associated type as ANY, it giving error as
Field "ANY" is unknown. It is neither in one of the specified tablesnor defined by a "DATA" statement. "DATA" statement. "DATA" statement.
Regards
MRK.