Application Development 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: 

sharing variables

Former Member
0 Kudos

Hello!

How can I share an internal table within a package with other

reports. When excecuting report 3 variables of report 1

must be available with its values. How is that possible ?

Regards

ertas ilhan

1 ACCEPTED SOLUTION

former_member195698
Active Contributor
0 Kudos

You can try "begin of common part..." .... "end of common part." keyword for sharing the variables.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db97c435c111d1829f0000e829fbfe/content.htm

9 REPLIES 9

former_member181962
Active Contributor
0 Kudos

Hi Ilhan,

YOu must use the Export and Import to memory ids.

Check the example programs:

DEMO_DATA_EXT_CLUSTER_EXPORT

DEMO_DATA_EXT_CLUSTER_EXPORT_D

and

DEMO_DATA_EXT_CLUSTER_IMPORT Reading Data Objects from Memory

DEMO_DATA_EXT_CLUSTER_IMPORT_2 Creating a Directory of a Data Cluster

DEMO_DATA_EXT_CLUSTER_IMPORT_D Reading Data Objects from Cluster Databases

DEMO_DATA_EXT_CLUSTER_IMPORT2 Program DEMO_DATA_EXT_CLUSTER_IMPORT2

DEMO_DATA_EXT_CLUSTER_IMPORT3 Program DEMO_DATA_EXT_CLUSTER_IMPORT3

Regards,

Ravi Kanth talagana

former_member195698
Active Contributor
0 Kudos

You can try "begin of common part..." .... "end of common part." keyword for sharing the variables.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db97c435c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

Hello,

You can use a GET and SET FM. Create an FM that will set the VALUE and then get the Values via GET FM.

Reagrds

Saket Sharma

0 Kudos

..... can you pls give me an little code example ?

Regards

ertas

0 Kudos

Okies.

I will explain for one variable.

Create a FM say ZSETFM. It will have an impotring parameter as IM_FLAG. In the Top include of this FG

declare a variable IG_FLAG. Code in the ZSETFM

IG_FLAG = IM_FLAG.

Create a ZGETFM in the Same FG as ZSETFM. It will have an exporting parameter EX_FLAG.

Code

EX_FLAG = IG_FLAG.

Now call the ZSETFM and Pass the Variable and call the FM ZGETFM to get the value that you had passed.

0 Kudos

hi,

I can't set any value in may case for FM ZSETFM.

Because the internal table is populated normally

after the report1 is executed. I need a way

to run report1 in order to fill the internal table

and pass it finally to it to report 3

regards

ertas

Former Member
0 Kudos

Hi

first of all, internal tables are not contained in a package, the program is.

Now according to your problem, two solutions are possible.

1) If your report1 and report2 are going to run in the same sap session, then you can use export to memory id.

syntax: export var1 to memory id 'VARIABLE1'.

in the second report, use this to get the value:

IMPORT var1 TO var4 FROM MEMORY ID 'VARIABLE1'.

Note that if the sap session changes, the value will be lost.

2) Using this method , you can preserve data across sessions:

EXPORT tab = var1

TO DATABASE indx(xy)

CLIENT sy-mandt

ID 'VARIABLE1'.

IMPORT tab TO var1

FROM DATABASE indx(xy)

CLIENT sy-mandt

ID 'VARIABLE1'.

this will make the data available across sessions.

<REMOVED BY MODERATOR>

Cheers

Ravish

Edited by: Alvaro Tejada Galindo on Jun 12, 2008 11:07 AM

Former Member
0 Kudos

I mean

when excecuting report 3 variables of report 1

must be available with its values without

executing report 1.

Is that possible with the above mentioned methods ?

Regards

ertas

0 Kudos