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

Top include in Function module

Former Member
0 Likes
1,790

Hi All,

I have written a select statment in a FM.I want to retain the values selected so that it is available even when the FM is executed next time.Is it possibe to retain values selected by declaring the internal table in the TOP include?

Thanks,

Rakesh.

6 REPLIES 6
Read only

Former Member
0 Likes
1,079

Hi,

This is not possible.

You can try out Export to memeory ID and import from memory in subsequent function calls .

Check syntax of IMPORT/ EXPORT

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,079

yah the only solution is either export/inport or sga/gpa parameters.

export/import is best in this case.

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,079

hi Rakesh,

if you declare the internal table in the TOP include, that only means it will be avaliable for each FM in the function group. The internal table will be avaliable, not the data (which is filled with the SELECT statement)!

The question is when do you execute the FM next time? It it's only a while, you can export the data into the memory, import by the next FM call and you don't need to select again. but it only works if it is still the same user, same session. can you enlight the scenario?

thanks

ec

Read only

0 Likes
1,079

My requirement is to write a FM which gets the old material no(MARA-BISMT) for a given material no.In order to avoid hitting the data base table for each materail enterd in the FM I want to check wheteher an entry for this material no is present in the internal table If an entry is not present then only fetch from MARA.

Read only

0 Likes
1,079

hi Rakesh,

the problem is here when you return from the FM, all data is forgotten. On the other hand, I am not sure that it is worth to write an Fm for a simple SELECT SINGLE.

What I would do is to create an internal table with MARA-MATNR and MARA-BISMT and fill it in one go with all lines for these two fields from table MARA. Than whenever I need this information in the program I would just READ TABLE

ec

Read only

0 Likes
1,079

yah u can do that in the same program. but if u want to retain the details of internal table for another program too, u need to import and export the internal table field values. then only u can do that.

and if u want to retain the internal table values for the next execution, u need to know that the nature of the internal table is for storage of data temporarily and for permanant we need to switch to database table only.

u can do one thing. u can create a table type in dd and use that.