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

Declaring Global Variables in a Function

Former Member
0 Likes
5,825

Hi,

I have a function. At the end of the function I have a subroutine ( Form ).

Instead of passing data to the form, is it possible to declare , some of my varibles in the function as Global so they are visible in the Form.

These variables, are Internal tables with header line.

If it is possible how do I declare them.

The type of internal tables I have are like the following:

data lt_itemdata TYPE TABLE OF bapi_incinv_create_item

WITH HEADER LINE.

thanks

1 ACCEPTED SOLUTION
Read only

FredericGirod
Active Contributor
0 Likes
2,604

You have to declare this variable in the main program.

When you create a function you have first to create function group. This function group have a global program with include. Create an include with global declaration.

Regards

Frédéric

5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
2,605

You have to declare this variable in the main program.

When you create a function you have first to create function group. This function group have a global program with include. Create an include with global declaration.

Regards

Frédéric

Read only

Former Member
0 Likes
2,604

Hi Sims,

you can certainly declare global data for the function module (or function group rather). There will be a <i>top include</i> for every function group which will enable you to write the data declarations. these will be global and visible across all the function modules of the function group.

From the function module code, use the menu option <i>Goto-->Global data</i>.

Regards,

Anand Mandalika.

Read only

Vinod_Chandran
Active Contributor
0 Likes
2,604

Yes. you can do this by declaring the internal table as a global field.

Read only

0 Likes
2,604

Hi,

Here I have similar type of requirement.

I declared an internal table(say ITAB1) in the top include.Appending the values through FM1(function module).

I am using the same through FM2 (Tables ITAB1).

( Function group is same for both FM1 and FM2 )

but i am not getting the values in the ITAB1.

Can anyone help me....

Thanks in advance

KB

Read only

0 Likes
2,604

Bhavani,

please open new thread

else people who help you won't get any reward

regards