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: 

Importing table from memory

Former Member
0 Kudos

Hi all,

I have a requirement like, in one method of a class i have exported an internal table to memory which holds the entire details of a person. now i need to import that table in a form to display his details.

Can any one please help me regarding how to import that table from memory.

thanks in advance.

Tulasi Deepthi.

1 ACCEPTED SOLUTION

former_member187452
Contributor
0 Kudos

Hi,

use Statement

EXPORT itab TO MEMORY ID 'ID_NAME'. to export internal table,

use Statement

IMPORT itab FROM MEMORY ID 'ID_NAME'. to import internal table,

Regards,

Bharat.

3 REPLIES 3

former_member187452
Contributor
0 Kudos

Hi,

use Statement

EXPORT itab TO MEMORY ID 'ID_NAME'. to export internal table,

use Statement

IMPORT itab FROM MEMORY ID 'ID_NAME'. to import internal table,

Regards,

Bharat.

Former Member
0 Kudos

in the first program


EXPORT t_final TO MEMORY ID 'ABC'.
  CALL TRANSACTION 'MM01'

In teh second program


INITIALIZATION.
 
* IMPORT the internal table which has the selected rows
* for displaying the detail report from program 
IMPORT t_final FROM MEMORY ID 'ABC'.

Former Member
0 Kudos

here you go


DATA:
  BEGIN OF myrec,
    c1      TYPE c,
    c2      TYPE c,
    c3      TYPE c,
    c4      TYPE c,
    s1      TYPE i,
  END OF myrec.

DATA:
  mytab   LIKE myrec OCCURS 0 WITH HEADER LINE,
  mytab2  LIKE myrec OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

  PERFORM build_table.

  LOOP AT mytab INTO myrec.
    WRITE:/ myrec-c1, myrec-c2, myrec-c3, myrec-c4, myrec-s1.
  ENDLOOP.

  EXPORT itab from mytab TO MEMORY ID 'PTC'.  "<== itab is the obj name as stored in memory

  CLEAR: mytab, mytab[].   "<== emptied to verify that EXPORT is working

  ULINE.

  IMPORT itab to mytab2 FROM MEMORY ID 'PTC'. "<== itab is the obj name as stored in memory

  LOOP AT mytab2 INTO myrec.
    WRITE:/ myrec-c1, myrec-c2, myrec-c3, myrec-c4, myrec-s1.
  ENDLOOP.
*&---------------------------------------------------------------------
*&      Form  build_table
*&---------------------------------------------------------------------
FORM build_table.
  myrec-c1 = 'x'. myrec-c2 = 's'. myrec-c3 = 'd'. myrec-c4 = 'f'.
  myrec-s1 = 1.  APPEND myrec TO mytab.
  myrec-c1 = 'x'. myrec-c2 = 'f'. myrec-c3 = 'q'. myrec-c4 = 'e'.
  myrec-s1 = 1.  APPEND myrec TO mytab.
  myrec-c1 = 'y'. myrec-c2 = 'p'. myrec-c3 = 'o'. myrec-c4 = 'u'.
  myrec-s1 = 1.  APPEND myrec TO mytab.
  myrec-c1 = 'y'. myrec-c2 = 'l'. myrec-c3 = 'k'. myrec-c4 = 'h'.
  myrec-s1 = 1.  APPEND myrec TO mytab.
  myrec-c1 = 'z'. myrec-c2 = 'm'. myrec-c3 = 'h'. myrec-c4 = 'g'.
  myrec-s1 = 1.  APPEND myrec TO mytab.

ENDFORM.                    " build_table