Application Development and Automation 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: 
Read only

Problems with LOOPing internal table defined as type ANY (incoming param.)

Former Member
0 Likes
1,518

Hello friends,

I am having hell of a time trying to LOOP trough an apparently internal table (type h). This is part of the ALV list stuff and is therefore standard code.

Here is declaration part of the code:

FORM start_control USING value(p_grid_number) TYPE i

CHANGING p_grid_def TYPE ty_griddef

p_iouttab TYPE any.

Now, the debugger indicates that this is an STANDARD table. So I should be able to LOOP through the darn thing. Right?

But when I want to activate the my enhancements to the program , I get the message:

"P_IOUTTAB" is neither specified under "TABLES" nor defined as an internal table."

Any idea as to how to get round this problem?

Thanks for your input and help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,473

Hi,

Use the following addition for table.

p_iouttab TYPE ANY TABLE.

Regards,

Ankur Parab

12 REPLIES 12
Read only

Former Member
0 Likes
1,474

Hi,

Use the following addition for table.

p_iouttab TYPE ANY TABLE.

Regards,

Ankur Parab

Read only

0 Likes
1,473

Hi,

Thanks for your reply. My problem is that I cannot change the TYPE declaration as it is part of the SAP standard code. So ANY TABLE declaration is kinda out. So what's the next option if any?

Thanks.

Read only

0 Likes
1,473

Maybe the form routine (this is sap standard, isnt it?) requires still those stupid tables with header line.

Read only

0 Likes
1,473

Hi Rainer,

I am not sure if I understand well. Do you mean adding / declaring some kinda table with header, somewhere within my Enhancements? I've tried that. That is to say declared an internal table with header line. But when I want to LOOP thru the incoming table (via parameter) I get incompatible type message and all sorts of other wierd messages. This is nuts.

And yes it is part of the SAP standard code. The enhancement is supposed to modify the contents of this incoming internal table defined as type ANY.

Read only

0 Likes
1,473

I'm not really beware of exactly your situatiuon.

You want to call a form routine from an include or in another report which is sap standard from your own report?

So just tell a little bit more, the name of the form, the sap standard report and the declaration of your calling code and the declaration of your data.

Read only

0 Likes
1,473

O.k. So here is the deal:

Main program: SAPLEADS2

my enhancements are going into: INCLUDE LEADS2F04.

After FORM start_control USING.... (starting at line 117) I am introducing some ehancements via the ENHANCEMENT and MODIFICATIONS, which should read the incoming internal table, modify some stuff and then let the rest of the program take care of it.

Read only

0 Likes
1,473

And how does your loop look like?

Read only

0 Likes
1,473

Hi,

Pass p_iouttab to some local internal table and then loop on that.

Regards,

Ankur Parab

Read only

0 Likes
1,473

This is ALV control logic and as such that 'table' parameter is specified as ANY because it could be exactly that. If it was specified as a table it would require a structure and that cannot be statically declared. The routine is called for various table structures, not just one.

In order to access that table and its fields you need to create a local data reference to the external parameter.

Look at the ABAP Help for CREATE DATA dref, or any posting on dynamic table access.

Edited by: Ron Sargeant on Jun 10, 2009 6:55 PM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,473

check this

PERFORM DEMO USING ITAB.

FORM DEMO USING P TYPE ANY TABLE.

...

READ TABLE P WITH TABLE KEY (KEY) = 'X' INTO WA.

...

ENDFORM.

Link:[example|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm]

Read only

former_member219399
Active Participant
0 Likes
1,473

Hi,

Here you can call another subroutine in a Zinclude program as follows.

Form Start_Control changing XYZ type any

Exporting ABC....

.............

..........

..........

Perform modify_xyz(ZINCLUDE) changing XYZ if found.

........

Endform.

In the Zinclude

Form Modify_XYZ chaning XYZ type any table.

Here you can write your logic.

Endform.

With regards,

Vamsi

Read only

Former Member
0 Likes
1,473

Hi,

try something like this:

FORM start_control
  USING value(p_grid_number) TYPE i
  CHANGING p_grid_def TYPE ty_griddef
           p_iouttab TYPE any.

  FIELD-SYMBOLS: <fs_outtab>  TYPE table,
                 <fs_outline> TYPE ANY,
                 <fs_field>   TYPE ANY.

  ASSIGN p_iouttab TO <fs_outtab>.
  CHECK sy-subrc EQ 0.

  LOOP AT <fs_outtab> ASSIGNING <fs_outline>.

    ASSIGN COMPONENT 'column_name' OF STRUCTURE <fs_outline> TO <fs_field>.
    CHECK sy-subrc EQ 0.

    IF <fs_field> EQ ...

  ENDLOOP.

ENDFORM.

p_iouttab must be a table, otherwise you will get a short dump

if you know the line type of the table, you can use it as the type for <fs_outline>.

Regards,

Darley