2009 Jun 10 10:58 AM
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.
2009 Jun 10 11:03 AM
Hi,
Use the following addition for table.
p_iouttab TYPE ANY TABLE.
Regards,
Ankur Parab
2009 Jun 10 11:03 AM
Hi,
Use the following addition for table.
p_iouttab TYPE ANY TABLE.
Regards,
Ankur Parab
2009 Jun 10 11:18 AM
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.
2009 Jun 10 11:21 AM
Maybe the form routine (this is sap standard, isnt it?) requires still those stupid tables with header line.
2009 Jun 10 11:34 AM
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.
2009 Jun 10 11:41 AM
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.
2009 Jun 10 11:48 AM
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.
2009 Jun 10 12:09 PM
2009 Jun 10 2:06 PM
Hi,
Pass p_iouttab to some local internal table and then loop on that.
Regards,
Ankur Parab
2009 Jun 10 2:58 PM
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
2009 Jun 10 11:05 AM
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]
2009 Jun 10 5:37 PM
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
2009 Jun 10 6:24 PM
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