SAP 中執行外部 SQL 查詢的方法及問題

來源:互聯網
上載者:User

 

 目前的問題是,此處理方法,暫時還不確認如何和外部DB 進行配置?

 

 

   "Set Connection to Quotation DB   聯結外部資料庫及Server :?可能需要對應的 dll 和SAP 關聯

  " 先設定
  concatenate 'QTN_' sy-mandt into lv_qtn.
  case s_vbeln-low(1).
    when '5'.
      concatenate lv_qtn '_EIL' into lv_qtn.
    when '6'.
      concatenate lv_qtn '_CAL' into lv_qtn.
    when '3'.
      concatenate lv_qtn '_CSL' into lv_qtn.
    when '8'.
      concatenate lv_qtn '_CM' into lv_qtn.
  endcase.

 

    " 聯結

   if wa_sql_flag = 'X'.
    EXEC SQL.
      connect to :lv_qtn
    ENDEXEC.

    EXEC SQL.
      SET CONNECTION :lv_qtn
    ENDEXEC.
  endif.

 

...

 *"Disconnect Quotation DB   :最後需要斷開聯結
**************************************************
  if wa_sql_flag = 'X'.
    EXEC SQL.
      DISCONNECT :lv_qtn
    ENDEXEC.
  endif.
**************************************************

 

 

中間的執行語名樣本:

 

   EXEC SQL PERFORMING loop_fab_output.
    SELECT quotation_no, scenario_no, rec_level, major_trim_type,
           material_type, consum_per_doz, uom, total
    INTO   :wa_qtn_fab
    FROM   qn_major_fabric_dtl
    WHERE  quotation_no = :lv_qtnno
      AND  scenario_no = :lv_scrno
      AND  rec_level = :lv_reclv
  ENDEXEC.

 FORM loop_fab_output.
  clear it_qtn_fab.
  it_qtn_fab-vbeln        = it_vbak-vbeln.
  it_qtn_fab-quotation_no = wa_qtn_fab-quotation_no.
  it_qtn_fab-scenario_no  = wa_qtn_fab-scenario_no.
  it_qtn_fab-rec_level    = wa_qtn_fab-rec_level.
  it_qtn_fab-mat_type     = wa_qtn_fab-mat_type.
  it_qtn_fab-material     = wa_qtn_fab-material.
  it_qtn_fab-width        = 'N/A'.
  it_qtn_fab-consum       = wa_qtn_fab-consum.
  it_qtn_fab-uom          = wa_qtn_fab-uom.
  it_qtn_fab-total        = wa_qtn_fab-total.
  collect it_qtn_fab.
ENDFORM.                    " loop_fab_output

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.