‎2010 May 17 12:53 PM
Hi ,
I am working in release 6.0 .
In program i have internal table and i have to pass it's content to FM. In FM I tried to declare TABLE parameter but it was not accepted because table parameter is obsolete. I declare Change parameter. like it was suggested in error message dialog.The parameter is declared after same table like internal table from program .
When I run program I saw that only one record is passed to FM parameter. Question is how to pass whole body content of IT to FM parameter .
Thanks
Source code /
- gt_cartscan & cartscan are created after the same DB table.
loop at scantbl.
gt_cartscan-zzcartag = scantbl-zzcartag.
append gt_cartscan.
endloop.
call function 'Z_WM_UPD_ZDTS_GR'
changing
cartscan = gt_cartscan.
‎2010 May 17 1:35 PM
Create a table type for your structure in se11 and use the same table type in changing parameter. May be you have declared your table in Changing parameters using a flat structure.....
‎2010 May 17 1:05 PM
Hi,
You probably defined gt_cartscan with header line, so pass that table as gt_cartscan[]. Probably you have to change the type of the changing parameter into a table type as well...
Regards, Gerd Rother
‎2010 May 17 1:21 PM
Hi
I did try to pass content of internal table by adding square brackets after internal table name , but error ( short dump ) remains same .
I am suprised because internal table is declared after the same DB table like FM parameter.
I declared changing parameter instead table parameter because TABLE parameter is obsolete and not any more accepted.
Thanks
There is error description
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE',
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "Z_WM_UPD_ZDTS_GR" is incorrect:
The function module interface allows you to specify only
fields of a particular type under "CARTSCAN".
The field "GT_CARTSCAN[]" specified here is a different
field type
.
‎2010 May 17 1:16 PM
Hi
See the below example:
types:begin of ty_employee,
pernr type pa0002-pernr,
begda type pa0002-begda,
endda type pa0002-endda,
vorna type pa0002-vorna,
nachn type pa0002-nachn,
end of ty_employee.
*// Declate a types for employee data table
types:tt_employee type standard table of ty_employee.
*//Declate a workarea to hold the Employee data
data: gf_employee type ty_employee.
*Declate a table to hold the Employee data
data: gt_employee type tt_employee.
Letz say the gt_employee has 5 records when it is populated.
Then you have all the records of gt_employee when called through below perform in the subroutine.
perform shuffle_records changing gt_employee.
&----
*& Form SHUFFLE_RECORDS
&----
text
----
<--P_GT_EMPLOYEE[] text
----
form shuffle_records changing p_gt_employee type tt_employee.
endform. " SHUFFLE_RECORDS
Regards
Raj
‎2010 May 17 1:33 PM
This is because you have the parameter typed as line of DB table not a type table . I.e
"Interface of FM
FUNCTION '....'
CHANGING
ct_spfli TYPE sflight "here you need to pass a strcutre which is like line of DB table SFLIGHT
ct2_spfli TYPE FLIGHTTAB "here the parameter is typed as a table of type SFLIGHT
So in fact all you need is to change the typing to be table type not a table line . For this you might have to create new type in DDIC (if there is no such yet defined), then use this type for this parameter. After that pass the content of internal table to this FM as mentioned by Gerd.
Regards
Marcin
I tried to declare TABLE parameter but it was not accepted because table parameter is obsolete.
I believe you will be able to use that, although not recommended. All obsolete statements are still supported by SAP in order to assure downward compatibility. Anyhow the above (about typings) still applies, not matter whether it's changing or tables parameter.
Edited by: Marcin Pciak on May 17, 2010 2:34 PM
‎2010 May 17 1:35 PM
Create a table type for your structure in se11 and use the same table type in changing parameter. May be you have declared your table in Changing parameters using a flat structure.....