‎2010 Jan 25 4:41 AM
Hi GURUs
We have scenario where we export the table name (say USR02) and Primary Key Value to the function module from main program.
So in this program i need to export the internal table from the funtion module to the main program...
we've declared a variable, say t_result of type any as a export variable in FM. we
MOVE <t_table> TO t_result..
here we are getting error saying "t_result is not a internal table"
pls help..
thnx in advance..
‎2010 Jan 25 5:18 AM
Hi,
Please ellaborate our Question................
But Since i understand you want to export the UR02 Structure from FM to Main Program....
There are 2 solutions for that ...
1. Create a structure and enter the fields u want in FM and export in by calling in Mai Program.
2. Use Field Symbols Concept.
Affable
Arbind
‎2010 Jan 25 5:40 AM
If i understand correctly, u r calling a FM in your main program and passing the table name, primary key as input parameters. This FM will return the mentioned table data as output right... If yes, then u can declare the table same as the function module output parameter type and use the output table directly in ur main program.
‎2010 Jan 25 5:51 AM
hi,
thank for the reply.
we tried using a field sybmols.
we are trying to take any table name and this is the following code what we tried .
FUNCTION y713301_table.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(T_NAME) TYPE C
*" VALUE(PRIMARY_ID) TYPE C
*" VALUE(PRIMARY_VALUE) TYPE C
*" EXPORTING
*" VALUE(FNAME) TYPE C
*" REFERENCE(T_RESULT) TYPE ANY
*"----
DATA:lt_dd03l TYPE STANDARD TABLE OF dd03l,
ls_dd03l TYPE dd03l.
DATA: my_table TYPE REF TO data.
FIELD-SYMBOLS: <it_tname> TYPE STANDARD TABLE.
SELECT * FROM dd03l INTO TABLE lt_dd03l
WHERE tabname EQ t_name.
CREATE DATA my_table LIKE TABLE OF lt_dd03l.
ASSIGN my_table->* TO <it_tname>.
MOVE <it_tname> TO t_result[].
ENDFUNCTION.
" MOVE <it_tname> TO t_result[]." on this line we are getting a error.
please provide the solution for this.
‎2010 Jan 25 6:20 AM
Hi,
I have worked...
Please find the solution....
DATA : it_dd03l TYPE TABLE OF dd03l.
DATA: w_tabname TYPE tabname VALUE 'DD03L',
w_dref TYPE REF TO data.
FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
SELECT *
FROM (w_tabname) UP TO 20 ROWS
INTO TABLE <t_itab>.
MOVE <t_itab> TO it_dd03l.
Please let me know for any more solutions..........
‎2010 Jan 25 6:35 AM
hi,
Arbind Prasad,
i'm trying to fetch the records from the specified table with a specific primary key value.
so only one record will be retrieved from the table.
i'm creating a field symbol of type table.
once the records r fetched assign the rows to the export variable.
‎2010 Jan 25 6:45 AM
Hi,
It's Simple my Friend
data : w_dref TYPE REF TO data,
w_tabname type tabname.
w_tabname = Import Parameter.
FIELD-SYMBOLS: <t_itab> TYPE ANY .
CREATE DATA w_dref TYPE (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
SELECT *
FROM (w_tabname)
INTO <t_itab>.
MOVE <t_itab> TO it_dd03l.
Just try to manipulate the same code.
It will work
Affable
Arbind
‎2010 Jan 27 5:25 AM
hi Arbind,
the above code u mentioned ll work when ur trying to retreive the rows of the table in the main program.
i tried the following with somes changes which works fine in the main prg.
but when i'm trying to execute code in FM with some changes, it doesn't work.
so request u to help me out to get out this black hole....
thank u.
‎2010 Jan 27 5:48 AM
Hi Srimal,
I have done the same ..
It works for me....
Since u r using Field Symbols after getting the values in FM u have to move it to a structure , so make a structure in se11 and move it.
it works.
Please try and let me know if there some probelm ......
Regards
Arbind
‎2010 Feb 02 6:03 AM
hi Arbind,
As u told to create a structure in se11, but the problem is we don't know the structure(components), the table will be know at only runtime(dynamic). so how to handle in that case..?