Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem facing in Function module.

Former Member
0 Kudos
137

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

4 REPLIES 4

former_member188827
Active Contributor
0 Kudos
88

instead of like use type..

ITAB1 TYPE ANY

ITAB_SOURCE_PACK type ANY

plz reward points if dis helps

0 Kudos
88

Hi,

Thanks for reply.

Still i am getting same message. Even after chainging LIKE to TYPE

former_member404244
Active Contributor
0 Kudos
88

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

0 Kudos
88

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.