‎2006 Sep 18 4:14 PM
Hi, I want to export a table from a FM.
What is the best method? Define the table under the EXPORT screen or TABLES screen?
What should the code in the FM be, if my internal table is named it_tableTOexport?
Thanks!
‎2006 Sep 18 4:15 PM
Hi Rune,
Always it's better to define tables in tables only.
-Anu
‎2006 Sep 18 4:16 PM
Hi,
If it is table then you need to export it in tables.
Hope this helps.
‎2006 Sep 18 4:17 PM
Hi,
If you have a table type created in the DDIC you can use the EXPORTING parameter.
If you have structure only then you can use the TABLES parameter..
THanks,
Naren
‎2006 Sep 18 4:20 PM
When you say EXPORT, hope you mean download to pc.
The best is to pass the table as a TABLE parameter and the code can be to use the FM Gui_download.
Call Function 'Gui_download'
exporting
filename = p_file
filetype = 'ASC'
tables
data_table = it_tabletoexport.
‎2006 Sep 18 4:21 PM
Hello,
Under TABLES only. Use the option IMPORT, CHANGING and EXPORT only for variables or strucrures.
Regs,
Venkat Ramanan N
‎2006 Sep 18 4:22 PM
Hello Rune
The only way to differentiate between semantically different TABLES parameters is by using naming convention. I use the following conventions:
(1) Importing TABLES parameter (i.e. this is only input for the function module, the itab entries are not changed) = <b>IT_<itab name></b>
(2) Exporting TABLES parameters (i.e. this is only output of the function module) = <b>ET_<itab name></b> [In addition, one of the first line of coding in the function module is: REFRESH: et_<itab name>]
(3) Changing TABLES parameters (i.e. this is input and output at the same time) = <b>XT_<itab name></b> [usually there will be no REFRESH statement using this TABLES parameter]
Note that the differentiation between importing, exporting and changing is purely <b>semantic</b> because technically all TABLES parameters are the same.
Regards
Uwe
‎2006 Sep 19 7:53 AM
Thanks for all replies.
This is in my FM:
EXPORTING
*" VALUE(T_RESULT_EXPORT) LIKE ZT_RESULT STRUCTURE
*" ZTKG_RESULT
I have the parameter name T_RESULT_EXPORT in the Export section. How can I fill the table with data? I get an compiler error saying "T_RESULT_EXPORT is not an internal table - the OCCURS n specification is missing".
All I want to do is filling my export table.
‎2006 Sep 19 12:22 PM
The exporting parameter cannot be filled like an internal table unless it points to a table type. Which is to say, the structure ZT_RESULT STRUCTURE should be a table type.
In your case, the error occurs because ZT_RESULT STRUCTURE is a structure and hence, T_RESULT_EXPORT is also a structure and not an itab.
2 solutions:
1. Create T_RESULT_EXPORT under tables instead of exporting
OR
2. Creat ZT_RESULT STRUCTURE as a table type instead of structure.
Hope this helps.
Sudha