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: 

Export and Import Internal table

Former Member
0 Kudos

Hi,

I need to Export internal table from one program to the memory and import the data in a different program (Using EXPORT and IMPORT statements) . How do i do this ?

Regards

Rajvansh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

check this link

Cheers

Snehi

7 REPLIES 7

former_member188685
Active Contributor
0 Kudos

You have the answer with you(since you got the words Import and export).

Just use F1 help on them.

0 Kudos

Hi Vijay,

Yes I tried F1. Only thing is that i did't define the MEMORY ID.

Thanks All

Regards

0 Kudos

Hi,

Try using Export / Import with INDX parameter to save internal table into INDX table with unique ID & retrive it using same ID with Import.

EXPORT

TAB3 = TAB3

TO DATABASE INDX(ST) ID INDXKEY

FROM INDX_WA.

...

IMPORT DIRECTORY INTO DIRTAB FROM DATABASE INDX(ST) ID INDXKEY

TO INDX_WA.

Regards,

Karan

Former Member
0 Kudos

hi

check this link

Cheers

Snehi

Former Member
0 Kudos

Hi,

Check below.

regards

jana

Former Member
0 Kudos

Hi,

Check these two sample codes


REPORT  z_abap_memory.
DATA:
  w_carrid TYPE spfli-carrid,
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli.
DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

SELECT-OPTIONS:
  s_carrid FOR w_carrid.

START-OF-SELECTION.
  PERFORM get_spfli.
  PERFORM disp_spfli.
AT LINE-SELECTION.
  IF sy-lsind EQ 1.
    EXPORT t_spfli TO MEMORY ID 'ABC'.
    SUBMIT Z_ABAP_MEMORY1 AND RETURN.
  ENDIF.
END-OF-SELECTION.
  PERFORM disp_spfli.
*&---------------------------------------------------------------------*
*&      Form  get_spfli
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_spfli .
  SELECT carrid
         connid
         fltime
    FROM spfli
    INTO TABLE t_spfli
   WHERE carrid IN s_carrid.

ENDFORM.                    " get_spfli
*&---------------------------------------------------------------------
*
*&      Form  disp_spfli
*&---------------------------------------------------------------------
*
*       text
*----------------------------------------------------------------------
*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------
*
FORM disp_spfli .
  LOOP AT t_spfli INTO fs_spfli.
    WRITE: / fs_spfli-carrid,
             fs_spfli-connid,
             fs_spfli-fltime.
    HIDE:
      fs_spfli-carrid,
      fs_spfli-connid.
  ENDLOOP.

ENDFORM.                    " disp_spfli

PROGRAM 2


REPORT  z_abap_memory1.

DATA:
  BEGIN OF fs_spfli,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    fltime LIKE spfli-fltime,
  END OF fs_spfli,
  fs_fl LIKE fs_spfli.
DATA:
  BEGIN OF fs_flight,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
  END OF fs_flight.

DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

DATA:
  t_fl LIKE t_spfli.

DATA:
  t_flight LIKE
     TABLE OF
           fs_flight.

IMPORT t_spfli FROM MEMORY ID 'ABC'.
t_fl = t_spfli.

SELECT carrid
       connid
       fldate
  FROM sflight
  INTO TABLE t_flight
  FOR ALL ENTRIES IN t_spfli
 WHERE carrid = t_spfli-carrid
   AND connid = t_spfli-connid.


LOOP AT t_flight INTO fs_flight.
  WRITE: / fs_flight-carrid,
           fs_flight-connid,
           fs_flight-fldate.
ENDLOOP.

Regards

Abhijeet

Former Member
0 Kudos

Hi Rajvansh,

EXPORT TO DATABASE is the right option when you have target program to be started in background..

Wanna know more bout that?

Arun B

SIS