Skip to Content
avatar image
Former Member

Export and Import Internal table

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 01, 2008 at 07:11 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 07:12 AM

    Hi,

    Check below.

    Export & Import

    regards

    jana

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 07:15 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 01, 2008 at 07:07 AM

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

    Just use F1 help on them.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    Oct 07, 2008 at 09:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded