BAPI_SALESORDER_CREATEFROMDAT2 BAPI建立VA01 銷售訂單
用bapi建立銷售訂單 VA01 用的bapi如下
關於定價,可能要多做除錯,只能傳入COND_VALUE定價比率,而定價值是不可以直接修改的,
DATA: header_in TYPE bapisdhd1,
header_inx TYPE bapisdhd1x,
l_vbeln LIKE vbak-vbeln,
l_message TYPE string,
lt_return TYPE TABLE OF bapiret2 WITH HEADER LINE,
items_in TYPE TABLE OF bapisditm WITH HEADER LINE,
items_inx TYPE TABLE OF bapisditmx WITH HEADER LINE,
partners TYPE TABLE OF bapiparnr WITH HEADER LINE,
schedules_in TYPE TABLE OF bapischdl WITH HEADER LINE,
order_conditions_in TYPE bapicond OCCURS 0 WITH HEADER LINE,
order_conditions_inx TYPE bapicondx OCCURS 0 WITH HEADER LINE,
logic_switch TYPE bapisdls OCCURS 0 WITH HEADER LINE,
extensionin TYPE bapiparex OCCURS 0 WITH HEADER LINE.
CLEAR: header_in,
header_inx,
order_conditions_in,
order_conditions_inx,
l_vbeln,
items_in[],items_in,
items_inx[],items_inx,
partners[],partners,
schedules_in[],schedules_in,
g_exit.
* header
header_in-doc_type = lt_reslut-auart.
header_in-sales_org = lt_reslut-vkorg .
header_in-distr_chan = lt_reslut-vtweg.
header_in-division = lt_reslut-spart.
header_in-sales_grp = lt_reslut-vkgrp.
header_in-sales_off = lt_reslut-vkbur.
header_in-sd_doc_cat = 'C'.
header_in-doc_date = sy-datum.
header_in-purch_date = lt_reslut-audat.
header_in-price_date = sy-datum.
header_in-dlvschduse = l_abrvw. "審批狀態
header_in-ship_type = lt_reslut-vsart. "裝運型別
header_in-s_proc_ind = lt_reslut-sdabw. "特殊標識
header_in-pymt_meth = lt_reslut-zlsch. "付款方式
* item
LOOP AT it_tab100.
items_in-itm_number = it_tab100-posnr.
items_in-material = it_tab100-matnr.
items_in-plant = it_tab100-werks.
items_in-store_loc = it_tab100-lgort.
APPEND items_in.
CLEAR items_in.
items_inx-itm_number = it_tab100-posnr.
items_inx-material = 'X'.
items_inx-plant = 'X'.
items_inx-store_loc = 'X'.
APPEND items_inx.
CLEAR items_inx.
schedules_in-itm_number = it_tab100-posnr.
schedules_in-req_qty = it_tab100-kwmeng.
APPEND schedules_in.
CLEAR schedules_in.
order_conditions_in-itm_number = it_tab100-posnr. "itm_number
order_conditions_in-cond_type = 'Z11'. "定價條件
order_conditions_in-cond_value = it_tab100-kbetr.
order_conditions_in-currency = it_tab100-waerk. "
order_conditions_in-cond_unit = it_tab100-vrkme. "條件單位
APPEND order_conditions_in.
CLEAR order_conditions_inx.
order_conditions_inx-itm_number = it_tab100-posnr.
order_conditions_inx-cond_type = 'Z11'.
order_conditions_inx-cond_value = 'X'.
order_conditions_inx-currency = 'X'.
order_conditions_inx-cond_unit = 'X'.
order_conditions_inx-cond_p_unt = 'X'.
APPEND order_conditions_inx.
ENDLOOP.
* partener
partners-partn_role = 'WE'.
partners-partn_numb = lt_reslut-kunnr.
APPEND partners.
CLEAR partners.
partners-partn_role = 'RE'.
partners-partn_numb = lt_reslut-kunnr.
APPEND partners.
CLEAR partners.
logic_switch-pricing = ''.
APPEND logic_switch.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
order_header_in = header_in
order_header_inx = header_inx
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
logic_switch = logic_switch
IMPORTING
salesdocument = l_vbeln
TABLES
return = lt_return
order_items_in = items_in
order_items_inx = items_inx
order_partners = partners
order_schedules_in = schedules_in
order_conditions_in = order_conditions_in
order_conditions_inx = order_conditions_inx
extensionin = extensionin.
關於定價,可能要多做除錯,只能傳入COND_VALUE定價比率,而定價值是不可以直接修改的,
DATA: header_in TYPE bapisdhd1,
header_inx TYPE bapisdhd1x,
l_vbeln LIKE vbak-vbeln,
l_message TYPE string,
lt_return TYPE TABLE OF bapiret2 WITH HEADER LINE,
items_in TYPE TABLE OF bapisditm WITH HEADER LINE,
items_inx TYPE TABLE OF bapisditmx WITH HEADER LINE,
partners TYPE TABLE OF bapiparnr WITH HEADER LINE,
schedules_in TYPE TABLE OF bapischdl WITH HEADER LINE,
order_conditions_in TYPE bapicond OCCURS 0 WITH HEADER LINE,
order_conditions_inx TYPE bapicondx OCCURS 0 WITH HEADER LINE,
logic_switch TYPE bapisdls OCCURS 0 WITH HEADER LINE,
extensionin TYPE bapiparex OCCURS 0 WITH HEADER LINE.
CLEAR: header_in,
header_inx,
order_conditions_in,
order_conditions_inx,
l_vbeln,
items_in[],items_in,
items_inx[],items_inx,
partners[],partners,
schedules_in[],schedules_in,
g_exit.
* header
header_in-doc_type = lt_reslut-auart.
header_in-sales_org = lt_reslut-vkorg .
header_in-distr_chan = lt_reslut-vtweg.
header_in-division = lt_reslut-spart.
header_in-sales_grp = lt_reslut-vkgrp.
header_in-sales_off = lt_reslut-vkbur.
header_in-sd_doc_cat = 'C'.
header_in-doc_date = sy-datum.
header_in-purch_date = lt_reslut-audat.
header_in-price_date = sy-datum.
header_in-dlvschduse = l_abrvw. "審批狀態
header_in-ship_type = lt_reslut-vsart. "裝運型別
header_in-s_proc_ind = lt_reslut-sdabw. "特殊標識
header_in-pymt_meth = lt_reslut-zlsch. "付款方式
* item
LOOP AT it_tab100.
items_in-itm_number = it_tab100-posnr.
items_in-material = it_tab100-matnr.
items_in-plant = it_tab100-werks.
items_in-store_loc = it_tab100-lgort.
APPEND items_in.
CLEAR items_in.
items_inx-itm_number = it_tab100-posnr.
items_inx-material = 'X'.
items_inx-plant = 'X'.
items_inx-store_loc = 'X'.
APPEND items_inx.
CLEAR items_inx.
schedules_in-itm_number = it_tab100-posnr.
schedules_in-req_qty = it_tab100-kwmeng.
APPEND schedules_in.
CLEAR schedules_in.
order_conditions_in-itm_number = it_tab100-posnr. "itm_number
order_conditions_in-cond_type = 'Z11'. "定價條件
order_conditions_in-cond_value = it_tab100-kbetr.
order_conditions_in-currency = it_tab100-waerk. "
order_conditions_in-cond_unit = it_tab100-vrkme. "條件單位
APPEND order_conditions_in.
CLEAR order_conditions_inx.
order_conditions_inx-itm_number = it_tab100-posnr.
order_conditions_inx-cond_type = 'Z11'.
order_conditions_inx-cond_value = 'X'.
order_conditions_inx-currency = 'X'.
order_conditions_inx-cond_unit = 'X'.
order_conditions_inx-cond_p_unt = 'X'.
APPEND order_conditions_inx.
ENDLOOP.
* partener
partners-partn_role = 'WE'.
partners-partn_numb = lt_reslut-kunnr.
APPEND partners.
CLEAR partners.
partners-partn_role = 'RE'.
partners-partn_numb = lt_reslut-kunnr.
APPEND partners.
CLEAR partners.
logic_switch-pricing = ''.
APPEND logic_switch.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
order_header_in = header_in
order_header_inx = header_inx
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
logic_switch = logic_switch
IMPORTING
salesdocument = l_vbeln
TABLES
return = lt_return
order_items_in = items_in
order_items_inx = items_inx
order_partners = partners
order_schedules_in = schedules_in
order_conditions_in = order_conditions_in
order_conditions_inx = order_conditions_inx
extensionin = extensionin.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17204926/viewspace-698007/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- (原創)BAPI 修改銷售訂單的方法 ‘BAPI_SALESORDER_CHANGE’API
- sap 獲取計劃訂單bapi_PP 常用bapiAPI
- EBS:銷售訂單歷史記錄
- 如何用SAP Cloud for Customer的手機App建立銷售訂單CloudAPP
- CO銷售訂單成本核算詳解
- 使用簡單的Java程式碼在SAP C4C裡建立銷售訂單Java
- 使用nodejs呼叫C4C的Odata服務建立銷售訂單NodeJS
- EBS:OM Sales Order銷售訂單【Open Interface、Open API】API
- SAP SD如何將銷售訂單其它ITEM加入到一個已建立好的交貨單裡
- 銷售訂單處理期間的基本功能
- 在銷售中處理第三方訂單
- SAP Cloud for Customer銷售訂單External Note的建模細節Cloud
- 建立銷售管理資料庫資料庫
- C4C銷售訂單行專案價格維護方法
- SAP MM取消採購訂單審批--- BAPI_PO_RESET_RELEASEAPI
- 如何用程式碼的方式取出SAP C4C銷售訂單建立後所有業務夥伴的資料
- 「SAP技術」SAP SD微觀研究之根據銷售訂單查詢到該訂單發貨的批次
- 建立BAPI程式的步驟API
- SAP建立採購訂單流程
- 挖掘資料隱含的業務資訊(1)——訂單銷售交易類資料分析
- 訂單銷貨收款之報表sqlSQL
- 金蝶雲星空資料整合案例分享:銷售退貨單-銷售退貨
- 如何用程式碼填充S/4HANA銷售訂單行專案的數量欄位
- VA03銷售訂單螢幕增強,欄位顯示不完全的問題
- 銷貨後訂單還是BOOKED的處理
- SAP SD微觀研究之銷售訂單型別配置裡有關PO的幾個欄位型別
- 程式設計師轉銷售第一單程式設計師
- BAPI的簡單實現步驟API
- 建立訂單實現冪等的一點思考
- 微信支付訂單、退款訂單、轉款訂單的查詢
- BAPIAPI
- 銷貨後訂單LINE還是BOOKED的處理
- 高效整合商城訂單到銷幫幫合同介面的方法
- 【轉載】使用 BAPI_BUPA_CREATE_FROM_DATA 建立BPAPI
- 真人語音電銷機器人I銷售變得更簡單機器人
- BAPI的簡單實現步驟(轉)API
- 盤活銷售資料,助力銷售團隊管理
- 智雲通CRM:銷售小白如何領銷售任務?