Import / Export from Database
TYPES:
BEGIN OF tab_type,
col1 TYPE i,
col2 TYPE i,
END OF tab_type.
DATA:
wa_indx TYPE demo_indx_table,
wa_itab TYPE tab_type,
itab TYPE STANDARD TABLE OF tab_type.
WHILE sy-index < 100.
wa_itab-col1 = sy-index.
wa_itab-col2 = sy-index ** 2.
APPEND wa_itab TO itab.
ENDWHILE.
wa_indx-timestamp = sy-datum && sy-uzeit.
wa_indx-userid = sy-uname.
EXPORT tab = itab
TO DATABASE demo_indx_table(SQ)
FROM wa_indx
ID 'TABLE'.
TYPES:
BEGIN OF tab,
col1 TYPE i,
col2 TYPE i,
END OF tab.
DATA:
wa_indx TYPE demo_indx_table,
wa_itab TYPE tab,
itab TYPE STANDARD TABLE OF tab.
IMPORT tab = itab
FROM DATABASE demo_indx_table(SQ)
TO wa_indx
ID 'TABLE'.
WRITE: wa_indx-timestamp, wa_indx-userid.
ULINE.
LOOP AT itab INTO wa_itab.
WRITE: / wa_itab-col1, wa_itab-col2.
ENDLOOP.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Import / Export from Shared Buffer
TABLES INDX.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
BEGIN OF ITAB3 OCCURS 2,
CONT(4),
END OF ITAB3.
* Before export, fill the data fields
* before CLUSTR.
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
* Export data.
EXPORT F1 F2 ITAB3 TO
SHARED BUFFER INDX(ST) ID INDXKEY.
TABLES INDX.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
BEGIN OF ITAB3 OCCURS 2,
CONT(4),
END OF ITAB3.
* Import data.
IMPORT F1 F2 ITAB3 FROM
SHARED BUFFER INDX(ST) ID INDXKEY.
TYPES:
BEGIN OF tab_type,
col1 TYPE i,
col2 TYPE i,
END OF tab_type.
DATA:
wa_indx TYPE demo_indx_table,
wa_itab TYPE tab_type,
itab TYPE STANDARD TABLE OF tab_type.
WHILE sy-index < 100.
wa_itab-col1 = sy-index.
wa_itab-col2 = sy-index ** 2.
APPEND wa_itab TO itab.
ENDWHILE.
wa_indx-timestamp = sy-datum && sy-uzeit.
wa_indx-userid = sy-uname.
EXPORT tab = itab
TO DATABASE demo_indx_table(SQ)
FROM wa_indx
ID 'TABLE'.
TYPES:
BEGIN OF tab,
col1 TYPE i,
col2 TYPE i,
END OF tab.
DATA:
wa_indx TYPE demo_indx_table,
wa_itab TYPE tab,
itab TYPE STANDARD TABLE OF tab.
IMPORT tab = itab
FROM DATABASE demo_indx_table(SQ)
TO wa_indx
ID 'TABLE'.
WRITE: wa_indx-timestamp, wa_indx-userid.
ULINE.
LOOP AT itab INTO wa_itab.
WRITE: / wa_itab-col1, wa_itab-col2.
ENDLOOP.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Import / Export from Shared Buffer
TABLES INDX.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
BEGIN OF ITAB3 OCCURS 2,
CONT(4),
END OF ITAB3.
* Before export, fill the data fields
* before CLUSTR.
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
* Export data.
EXPORT F1 F2 ITAB3 TO
SHARED BUFFER INDX(ST) ID INDXKEY.
TABLES INDX.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
BEGIN OF ITAB3 OCCURS 2,
CONT(4),
END OF ITAB3.
* Import data.
IMPORT F1 F2 ITAB3 FROM
SHARED BUFFER INDX(ST) ID INDXKEY.
No comments:
Post a Comment