Attribute
MR_EXPIMP_DB Static Attribute Private Type Ref To CL_ABAP_EXPIMP_DB
METHODS:
GET_INSTANCE
1 2 3 4 5 6 7 |
METHOD get_instance. IF mr_expimp_db IS NOT BOUND. mr_expimp_db = NEW #( ). ENDIF. ENDMETHOD. |
IMPORT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
METHOD import. get_instance( ). TRY . mr_expimp_db->delete( EXPORTING tabname = 'INDX' client = sy-mandt client_specified = 'X' area = 'ZA' id = i_indx_key ). CATCH cx_sy_client. " e_error = 'X'. CATCH cx_sy_generic_key. " e_error = 'X'. CATCH cx_sy_incorrect_key. " e_error = 'X'. ENDTRY. IF it_data IS SUPPLIED. EXPORT it_data FROM it_data TO DATABASE indx(za) ID i_indx_key. IF sy-subrc <> 0. e_error = 'X'. ENDIF. ELSEIF i_data IS SUPPLIED. EXPORT i_data FROM i_data TO DATABASE indx(za) ID i_indx_key. IF sy-subrc <> 0. e_error = 'X'. ENDIF. ENDIF. ENDMETHOD. |
EXPORT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
METHOD export. get_instance( ). IF et_data IS SUPPLIED. IMPORT it_data TO et_data FROM DATABASE indx(za) ID i_indx_key. IF sy-subrc <> 0. e_error = 'X'. ENDIF. ELSEIF e_data IS SUPPLIED. IMPORT i_data TO e_data FROM DATABASE indx(za) ID i_indx_key. IF sy-subrc <> 0. e_error = 'X'. ENDIF. ENDIF. TRY . mr_expimp_db->delete( EXPORTING tabname = 'INDX' client = sy-mandt client_specified = 'X' area = 'ZA' id = i_indx_key ). CATCH cx_sy_client. " e_error = 'X'. CATCH cx_sy_generic_key. " e_error = 'X'. CATCH cx_sy_incorrect_key. " e_error = 'X'. ENDTRY. ENDMETHOD. |
Call example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
REPORT ztest_clusters. TABLES indx. DATA lt_t001w TYPE TABLE OF t001w. START-OF-SELECTION. SELECT * UP TO 5 ROWS INTO TABLE @lt_t001w FROM t001w. "write to cluster table zcl_memory_transport=>import( EXPORTING i_indx_key = |{ sy-mandt }{ sy-uname }{ sy-repid }| it_data = lt_t001w RECEIVING e_error = DATA(err_flag) ). WRITE : / 'Import: ' && err_flag. DATA lt_t001w_new TYPE TABLE OF t001w. "read from cluster table zcl_memory_transport=>export( EXPORTING i_indx_key = |{ sy-mandt }{ sy-uname }{ sy-repid }| IMPORTING et_data = lt_t001w_new * e_data = RECEIVING e_error = err_flag ). WRITE : / 'Export: ' && err_flag. |