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

export and importing value!!!!!!

Former Member
0 Likes
623

hi can u plss tell me how to export and import a value from one main program to another main program!!!! n tell me something abt memory in abap!!!! and is there nything in abap that is similar to pointers in C.

5 REPLIES 5
Read only

Former Member
0 Likes
586

Hi!

For example passing internal tables. You can use variants also.

Passing data from one ABAP program to another

1. You have to define an internal table ITAB in program AAA.

2. In the program AAA you export your ITAB to the memory.

EXPORT ITAB TO MEMORY ID 'TD' (ID is the name of memory, you don't need to create it ).

3. In program BBB you have to declare The same table (same table's name and same fields).

4. In BBB you can import ITAB :

IMPORT ITAB FROM MEMORY ID 'TD'

5. Now you can export it to AAA after modifications.

EXPORT ITAB TO MEMORY ID 'TD'

6. In AAA :

IMPORT ITAB FROM MEMORY ID 'TD'

Pointers like in C, are not "welcome" in ABAP. You can use FIELD-SYMBOLS, which are useful to point to another fields, work areas, etc...

Regards

Tamá

Read only

Former Member
0 Likes
586

Hi abapdone,

1. like this.

2.

*----


ZPROG1.

report abc.

data : myvar(10) type c.

myvar = 'Hello'.

export myvar to memory id 'MYVAR'.

submit zprog2.

*----


ZPROG2.

report abc.

data : myvar(10) type c.

import myvar from memory id 'MYVAR'.

write 😕 myvar.

*----


output will be

hello

regards,

amit m.

Read only

Former Member
0 Likes
586

Check the following programs:

report  z_82235_test1                           .

types: begin of tab1,
         a(1),
         b(1),
       end of tab1.

types: begin of tab2,
         c(1),
         d(1),
       end of tab2.

data: itab1 type table of tab1,
      wa1 like line of itab1,
      itab2 type table of tab2,
      wa2 like line of itab2.

wa1-a = '1'.
wa1-b = '2'.
append wa1 to itab1.
clear wa1.

wa1-a = '3'.
wa1-b = '4'.
append wa1 to itab1.
clear wa1.


export itab1 to memory id '001'.
export itab2 to memory id '002'.

submit z_82235_test2 and return exporting list to memory .


import itab1 from memory id '003'.
import itab2 from memory id '004'.

write:/ 'ITAB1'.
loop at itab1 into wa1.
write : / wa1-a, wa1-b.
clear: wa1.
endloop.

write:/ 'ITAB2'.
loop at itab2 into wa2.
write : / wa2-c, wa2-d.
clear: wa2.
endloop.



report  z_82235_test2                           .

types: begin of tab1,
         a(1),
         b(1),
       end of tab1.

types: begin of tab2,
         c(1),
         d(1),
       end of tab2.

data: itab1 type table of tab1,
      wa1 like line of itab1,
      itab2 type table of tab2,
      wa2 like line of itab2.

import itab1 from memory id '001'.
import itab2 from memory id '002'.

itab2[] = itab1[].

wa1-a = 'a'.
wa1-b = 'b'.
append wa1 to itab1.
clear wa1.




export itab1 to memory id '003'.
export itab2 to memory id '004'.

Read only

Former Member
0 Likes
586

Hi Abapdone

Your first question has already been answered. Comming to ur second question, i.e pointers, here in abap we also use. Pointer concepts come to picture when we refer to any data objects. Generally in OOPS we use this when we refer to any CLASS.

Read only

Former Member
0 Likes
586

Hi Abapers,

I have gone thru this post and got some knowledge about this concept.

But from one the code i hav added a slight code but my code is not work can anyone plz guide me how to rectify this particular issue.

REPORT ZDEMO2.

*report abc.

data : myvar(10) type c,

myvar1(20) type c.

MYVAR ='Hello'.

myvar1 ='sanjay how ru'.

export MYVAR to memory id 'MYVAR'.

export myvar1 to memory id 'myvar1'.

submit ZDEMO4.

REPORT ZDEMO4.

*report abc.

data : myvar(10) type c,

myvar1(20) type c.

import myvar from memory id 'MYVAR'.

import myvar1 from memory id 'MYVAR1'.

write 😕 myvar,

myvar1.

Regards,

sanjay