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: 

(internal) Tables obsolete as parameter in function modules,

morten_nielsen
Active Contributor
0 Kudos

Hi

As you probably can see by the question, my ABAP Knowledge isn't exactly overwhelming !

<i>anyway:</i>

I'm trying to create a function module in NW2004s, This functionmodule should take an internal table, based on a structure as (import) parameter.

In the earlier version, I've done this by defining it under the TAB 'Tables' in the function builder - But know its telling me that "<i>Tables Parameters are obsolete</i>", and that I should define it under "Changing" instead.

I have tried that, but I'm only allowed to pass a single line, and if I try to do a Loop, in the function module, it tells me that ity isn't created as an internal table.

So please - what is the "best practice" here ?

Regards

Morten Nielsen

1 ACCEPTED SOLUTION

alejandro_lpez
Contributor
0 Kudos

Hi Morten,

You should define a table type Standard table in transaction SE11. In transaction SE11 go to field Data Type and insert the name of table, click on button create and select Table Type in the pop up window showed, in the next screen define the Line type of the table, the lyne type can be a structure, then select Standard table in TabStrip Initialización and Access.

Put this new Table Type in the changing parameters of your function Module, and it will work like a standard table.

Regards,

Alejandro.

10 REPLIES 10

suresh_datti
Active Contributor
0 Kudos

I am still on 47.. but you can try this... create a Table TYPE with in se11 with the desired fields & define a CHANGING parameter of this TYPE in your function module..

~Suresh

Former Member
0 Kudos

Hi

U can define you CHANGING parameter as type TABLE, so you'll have a table parameter there.

In this case the problem is this parameter has any reference, so It can be hard to manage it by ABAP.

Another solution is create a type table Z<...> in dictionary and then create the CHANGING parameter in reference to this type.

In both solution you'll have a table without header line.

Max

alejandro_lpez
Contributor
0 Kudos

Hi Morten,

You should define a table type Standard table in transaction SE11. In transaction SE11 go to field Data Type and insert the name of table, click on button create and select Table Type in the pop up window showed, in the next screen define the Line type of the table, the lyne type can be a structure, then select Standard table in TabStrip Initialización and Access.

Put this new Table Type in the changing parameters of your function Module, and it will work like a standard table.

Regards,

Alejandro.

0 Kudos

Hi

Thanks guys !

I have tried to create a table type, but it gives me an internal table without a header line - how do I get the Header line as well ?

Regards

Morten Nielsen

0 Kudos

Header lines are obselete as well, you need to use a work area instead.

Regards,

Rich Heilman

0 Kudos

Thanks

How does that work ?

Regards

Morten Nielsen

0 Kudos

When accessing the internal table in your function module code, you need to use a workarea. For example when looping or reading it.

data: wa like line of itab.

loop at itab into wa.
 ....
...

Or

Read table itab into wa index 1.

Regards,

Rich Heilman

0 Kudos

1. Create a structure in SE11, this will include all the fields you want.

2. Create a Table type in SE11, referring the above structure as the row type.

3. Now, when you use this table type you would need to have a work area to process the data of the table. So, in the program declare a variable with ref to the structure created in Step 1.

Then you can use

LOOP AT T_ITAB INTO WA_ITAB.

ENDLOOP.

where T_ITAB is referring to table type and WA_ITAB is referring to structure.

Regards,

Ravi

Note - Please mark all the helpful answers

0 Kudos

Thanks

Problem solved

Regards

Morten Nielsen

0 Kudos

Hi All,

I followed Steps 1 and 2 but when I use the following select statement I get a dump with the error enclosed.

Step1. Created a structure ZDFKKCOHI which is a replica of DFKKCOHI.

Step2. Created a table type ZDFKKCOHITABLE with line type as ZDFKKCOHI.

Step3. In my function module I have a changing parameter ZDFKKCOHIPARAM of type ZDFKKCOHITABLE.

Step 4. When I use the following select clause I am getting a dump.

DATA: wa_zdfkkcohi LIKE LINE OF zdfkkcohiparam.

SELECT *

FROM dfkkcohi

INTO CORRESPONDING FIELDS OF TABLE zdfkkcohiparam

WHERE cotyp EQ zcotyp

AND gpart EQ zgpart

AND corr_status EQ zcorr_status.

LOOP AT zdfkkcohiparam INTO wa_zdfkkcohi.

*Move IT_ZDFKKCOHI to ZDFKKCOHIOUT.

*Append ZDFKKCOHIOUT.

*Clear IT_ZDFKKCOHI.

ENDLOOP.

What could be wrong?

Thanks for all your help in advance.

Regards,

Divya