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

Clearing Global SAP Memory

Former Member
0 Likes
3,124

Hi folks,

I have a problem with clearing global sap memory.

I have a global internal table in a function group, when the function module of this function group is called for the second or third time from the same session, the new data i am passing, is appending to the old data without clearing the same even after clearing the global table before passing my data. This doesn't happen when i change the session.

Can someone shed some light....

Many Thanks,

Pankaj

Hi folks,

I have a problem with clearing global sap memory.

I have a global internal table in a function group, when the function module of this function group is called for the second or third time from the same session, the new data i am passing, is appending to the old data without clearing the same even after clearing the global table before passing my data. This doesn't happen when i change the session.

Can someone shed some light....

Many Thanks,

Pankaj

3 REPLIES 3
Read only

Former Member
0 Likes
1,399

You can either clear the global data when you first go into the FM or you can create a separate FM in the same group which clears the global data. In this case, you would call the clearing FM and then the other one.. You would do it this way if there are situations where you want to keep the global data between sessions.

Rob

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,399

Hi,

This is not the problem. But the behaviour of SAP. When you use global internal tables, make sure that you clear all these global tables in all the FMs of the FG before using them. This should solve the issue. (I am assuming that you are talking about Z Function group).

Thanks,

Vinod.

Read only

Subhankar
Active Contributor
0 Likes
1,399

HI ,

If this is custom function module you should first clear all the variable (Internal table, wor area, variables) declared in the TOP include. If there is more than one function module in the same function group the create one more FM only to clear the global variables likes every *_INITIALIZE FM.

If you are using the standard one you can find one more FM wth more or less similar name ending with _INITIALIZE.

If youing any bapi then you should use BAPI_TRANSACTION_COMMIT or BAP_TRANSACTION _ROLLBACK to refresh the memory.

Thanks

Subhankar