‎2006 Jan 30 4:40 PM
Hello,
i try to create a function module, which has one internal table as a result table. The structure is unknown during design time, because the table has the structure like a range table, therefor the fieldtype of the 'low and high' values, depends on the declaration of the calling programm, and is not knowing in the function module during design time.
The function module load the results of a DDIC-Customizingtable and shell fill the sign, option, low and high field of the result table.
Is there anybody with an idea how to solve this.
Thanks in advance
Michael
‎2006 Jan 30 4:45 PM
‎2006 Jan 30 4:45 PM
‎2006 Jan 30 4:51 PM
Thanks,
but this don't work, because you can't fill the fields of the internal table without knowing his fieldname. If i define the table as 'any table', no assignment ist possible, because the table has no structure and therefor no field you can assign to.
‎2006 Jan 30 4:52 PM
For example..... here is a program which calls the function module. Notice that ITAB in the TABLES section is not defined.
Program Code.
report zrich_0002.
ranges: r_datum for sy-datum.
call function 'Z_TEST'
tables
itab = r_datum.
check sy-subrc = 0.
Function Module Code.
function z_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" ITAB
*"----------------------------------------------------------------------
* Fill with data
itab = 'IBT2006010399991231'.
append itab.
endfunction.
Regards,
Rich HEilman
‎2006 Jan 30 4:54 PM
Hi Michael,
Please try Table type "STANDARD TABLE". This will take the dynamic table structure.
May be this will work for you.
Lanka
‎2006 Jan 30 4:59 PM
Also, if you know that it will always be a range table, you can access the fields like this in the function module.
function z_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" ITAB
*"----------------------------------------------------------------------
field-symbols: <fs>.
assign component 1 of structure itab to <fs>.
<fs> = 'I'.
assign component 2 of structure itab to <fs>.
<fs> = 'BT'.
assign component 3 of structure itab to <fs>.
<fs> = '20060103'.
assign component 4 of structure itab to <fs>.
<fs> = '99991231'.
append itab.
endfunction.
Regards,
Rich HEilman
‎2006 Jan 30 5:00 PM
Thank you very much.
I thought to complicated.
I tried abap class cl_abap_typedescr and field_symbols
Yes thats it !! very easy and working.
Michael
‎2006 Jan 30 5:09 PM
‎2006 Jan 30 5:09 PM