‎2008 Sep 15 4:54 PM
Greetings!
I'm creating a Z function module and within it I will looping through an internal table and would like to add a PERFORM routine where I pass a couple of data variables from my itab and then within the PERFORM routine take that data with some other coding/validating and fill an internal table from the main function module however when I build the PERFORM routine in the fm include it doesn't recognize my internal table.
my code looks a little like this in the fm..
loop at itab...
perform validate_data using var1 var2 va3.
endloop.
Do I need to pass the itab with a CHANGING parameter of the PERFORM call?
‎2008 Sep 15 5:04 PM
Hi
U can became the parameters of fm interface as global data:
In trx SM37 go to EDIT->INTERFACE->GLOBALIZE PARAMETER
else
- or u need to use an USING parameter in your FORM in order to transfer the data from z fm to form;
- or u need to use a workarea defined as global data in order to transfer the data from z fm to form.
Max
‎2008 Sep 15 5:04 PM
Hi
U can became the parameters of fm interface as global data:
In trx SM37 go to EDIT->INTERFACE->GLOBALIZE PARAMETER
else
- or u need to use an USING parameter in your FORM in order to transfer the data from z fm to form;
- or u need to use a workarea defined as global data in order to transfer the data from z fm to form.
Max
‎2008 Sep 15 5:04 PM
You need to pass your table with the TABLES parameter.
Like:
perform validate_data TABLES ITAB.
...
FORM VALIDATE_DATA TABLES ITAB STRUCTURE <itab_struc>.
ENDFORM.
Regards,
Naimesh Patel
‎2008 Sep 15 5:11 PM
Hi,
Where is the internal table from the main function module that you are filling in your subroutine defined? The best place would be the global data section of the function group, not an individual function module, then it will be available to the function module and the subroutine (and other other subroutine you may create in this function group). Alternatively, keep the internal table defined locally in your function module and pass it to the subroutine.
Regards,
Nick
‎2008 Sep 15 6:03 PM
Using or changing global data directly from inside FORMs is usually a bad idea.
Instead you should pass the table explicitly either with USING or CHANGING (preferable), or with TABLES (deprecated).
For the former, you should have defined a global table type (either inside the function module or in the TOP function group include), for the later it's enough to define the line structure. These types could also be DDIC types.
Edited by: Alejandro Bindi on Sep 15, 2008 2:03 PM