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: 

Import and export parameters.

Former Member
0 Kudos

Hi Experts,

If I am using import n export parameters for getting data from a different program into my main program, do i have to declare the variables again in the second program.

For ex:

The main report has the following piece of code:

data: int1 type I,

int 2 type I.

export: int1 to memory id 'mem1',

int2 to memory id 'mem2'.

submit report 'call_report' and return.

*******************************************************************************

The call_report has the following piece of code:

import: int1 from memory id 'mem1',

int2 from memory id 'mem2'.

So if I am not declaring int1 n int2 explicitly in this report, i get the syntax error that they r not defined.

My confusion is that when v r exporting int1 n int2 from the main report, then y is the explicit declaration required?

Is ther no other way out than decalring int1 n int2 in the call_report.

I will reward all the helpful answers.

Thanks,

Ajay.

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

Hi Ajay,

With EXPORT u r not exporting the variable and its definition but the content(data) of the variable u r exporting. So if u want to get the content in another program then u have to declare the variables of same type in the calling program also. Similarly with IMPORT u are not downloading the attributes of the field but only the content of variable u exported earlier.

Another point to remember is u have declare the variable in the second report with the same name and type as of first report.

Also check below piece of code which is similar to ur req

First report

REPORT Z75694_TEST .

DATA: i_data TYPE i VALUE '1111'.

EXPORT i_data TO MEMORY ID 'VINOD'.

CHECK sy-subrc IS INITIAL.

WRITE: 'Exported'.

SUBMIT Z75694 AND RETURN.

Second report

REPORT z75694.

DATA i_data TYPE i.

IMPORT i_data FROM MEMORY ID 'VINOD'.

WRITE:/ i_data.

It is working fine.

Hope this clarified ur doubt.

Thanks,

Vinod.

Edited by: Vinod Kumar Vemuru on Apr 11, 2008 10:35 AM

Edited by: Vinod Kumar Vemuru on Apr 11, 2008 10:44 AM

6 REPLIES 6

Former Member
0 Kudos

Hi ,

Yes you have to declare with same ID .

better you declare with same fields.

data: int1 type I,

int 2 type I.

IMPORT : int1 FROM memory id 'MEM1',

int2 FROM memory id 'MEM2'.

Pls. reward if useful .

Former Member
0 Kudos

Hi,

You need to difine it in other report also.

REWARD IF USEFUL

Former Member
0 Kudos

Hi,

declare the same variables in the second report even ...

Reagrds,

Santosh

vinod_vemuru2
Active Contributor
0 Kudos

Hi Ajay,

With EXPORT u r not exporting the variable and its definition but the content(data) of the variable u r exporting. So if u want to get the content in another program then u have to declare the variables of same type in the calling program also. Similarly with IMPORT u are not downloading the attributes of the field but only the content of variable u exported earlier.

Another point to remember is u have declare the variable in the second report with the same name and type as of first report.

Also check below piece of code which is similar to ur req

First report

REPORT Z75694_TEST .

DATA: i_data TYPE i VALUE '1111'.

EXPORT i_data TO MEMORY ID 'VINOD'.

CHECK sy-subrc IS INITIAL.

WRITE: 'Exported'.

SUBMIT Z75694 AND RETURN.

Second report

REPORT z75694.

DATA i_data TYPE i.

IMPORT i_data FROM MEMORY ID 'VINOD'.

WRITE:/ i_data.

It is working fine.

Hope this clarified ur doubt.

Thanks,

Vinod.

Edited by: Vinod Kumar Vemuru on Apr 11, 2008 10:35 AM

Edited by: Vinod Kumar Vemuru on Apr 11, 2008 10:44 AM

Former Member
0 Kudos

Hi,

You have declared export variables in your main report. But when you go to the second report using submit, the data declarations in the main report are no longer available in the second report.

So you have to define them again in the second report using DATA statements. They should be defined in the identical way in both reports. Only then your import statement will work in second report.

Former Member
0 Kudos

Hi ,

Yes, you need to declare explicitly.

Because..the control goes entirely into the other program, which has been called, until you come back to orginal program..

you could not even access these data..

Please check this..

award points if usefull

regards,

vinesh.