Skip to Content
0
Former Member
Dec 26, 2007 at 06:06 AM

Problem facing in Function module.

49 Views

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