2. SAP/ABAP 程序間數據傳遞和共享 MEMORY EXPORT/IMPORT

調用程序:

*&---------------------------------------------------------------------*
*& Report  YZB_TEST3
*&
*&---------------------------------------------------------------------*
*& export  *   to  memory  id  * .
*& import  *   from  memory  id  * .
*&---------------------------------------------------------------------*

report yzb_test3.

*-------------------------------------------------------------------*
*** DATA定義以下【
data: lt_sflight like table of sflight.
*** DATA定義以上】


*-------------------------------------------------------------------*
*** 邏輯處理以下【
select * into corresponding fields of table lt_sflight from sflight where carrid = 'LH'.
export  lt_sflight       to  memory  id  'SFLIGHT_ID' .

submit yzb_test4.
*** 邏輯處理以上】

 

被調程序

*&---------------------------------------------------------------------*
*& Report  YZB_TEST4
*&
*&---------------------------------------------------------------------*
*& export  *   to  memory  id  * .
*& import  *   from  memory  id  * .
*&---------------------------------------------------------------------*

report yzb_test4.

*-------------------------------------------------------------------*
*** DATA定義以下【
data: lt_sflight like table of sflight,
      lw_sflight like line of lt_sflight.
*** DATA定義以上】


*-------------------------------------------------------------------*
*** 邏輯處理以下【
import  lt_sflight   from  memory  id  'SFLIGHT_ID' .
free  memory  id  'SFLIGHT_ID' .

loop at lt_sflight into lw_sflight.
  write:/
  lw_sflight-carrid,
  lw_sflight-connid,
  lw_sflight-fldate,
  lw_sflight-price,
  lw_sflight-currency,
  lw_sflight-planetype,
  lw_sflight-seatsmax,
  lw_sflight-seatsocc,
  lw_sflight-paymentsum,
  lw_sflight-seatsmax_b,
  lw_sflight-seatsocc_b,
  lw_sflight-seatsmax_f,
  lw_sflight-seatsocc_f.

endloop.
*** 邏輯處理以上】

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章