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

Global data in Function Group

Former Member
0 Likes
2,710

Hello Consultants,

my requirement is, i have created one function group and it holds around 6 function modules. when i call my first FM in the group, i want to pass header data and store as a global data and i want to use the same data in other FM also. I don't want pass the same data all the times. how is it possible?

I tried by declaring as STATICS but no use..:-(

Thanks a lot in advance...

Rgds,

Mohan

9 REPLIES 9
Read only

Former Member
0 Likes
1,288

Hi,

Declare the internal tables in the TOP INCLUDE of the function group.

Thanks,

Naren

Read only

0 Likes
1,288

yes i declared as a global variables only. but i am loosing data when the second FM is called..

Read only

Former Member
0 Likes
1,288

declare those ITABs as global @ the top include so that they can be accessed anywhere in the program .... but it is not a good practise ... u shud pass those tables to the table parameters of each FM...

hope this will help...

bbye tac care

Ashwani

Read only

0 Likes
1,288

yes i declared as a global variables only. but i am loosing data when the second FM is called..

Read only

Former Member
0 Likes
1,288

Hi Mohan,

Declare your internal table in the <functiongroup>TOP INCLUDE.

This will be globally avialable to all the function modules defined under the function group.

Thanks,

Vinay

Read only

Former Member
0 Likes
1,288

Hell,

i am able to solve this using below,

instead of passing the header data through FM first time, i have exported data to memory in my program and in the first FM i have imported the same and now i am able to use the same in all FM with out passing header data all the time.

Please share your thoughts..

Thanks for your time..

Rgds,

Mohan

Read only

Former Member
0 Likes
1,288

Hi Mohan,

The best Idea is to use the Global Definition in TOP include at Function Group level.

You may be loosing data.. .Because U may have called this FM in Different reports...

If u call all FMs in SAME report then the Global Data will remain present all the time.. there is no second thought about that..

Please reward this if u are convinced....:)

DARSHAN

Read only

0 Likes
1,288

Hello Darshan,

Nice to see ur confidence level... but unfortunately i am loosing data even though i am calling all the FM in one smartform only. I hope i am clear, i send all my header data (say IT_VBAK) through my first FM, i have declared IT_VBAK as global variable. but when i call my second FM with out passing IT_VBAK, with in my 2nd FM IT_VBAK is blank.....

Thanks a lot for your time...

Rgds,

Mohan

Read only

0 Likes
1,288

Hello Mohan,

what about a different approach? I am not familiar with smart forms but storing a state in global varibles is generally not the best solution on the long run. Is it possible with smartforms to use object instances? In this case you can solve the problem by returning a state object or by even replacing the fubas with a class-pool.

Regards,

Klaus