Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PERFORM in Z Function Module

Former Member
0 Likes
1,416

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
987

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

4 REPLIES 4
Read only

Former Member
0 Likes
988

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

Read only

naimesh_patel
Active Contributor
0 Likes
987

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

Read only

Former Member
0 Likes
987

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

Read only

alejandro_bindi
Active Contributor
0 Likes
987

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