用ABAP写一个生成销售订单SO的报表,需要使用BAPI产生销售订单号
时间: 2023-02-13 19:42:50 浏览: 226
好的。
下面是一个使用 ABAP 编写的生成销售订单报表的示例,其中使用了 BAPI 产生销售订单号:
```
REPORT zsales_order_report.
DATA:
lv_doc_type TYPE vbak-auart,
lv_sales_org TYPE vbak-vkorg,
lv_dist_chann TYPE vbak-vtweg,
lv_division TYPE vbak-spart,
lv_sales_doc TYPE vbak-vbeln,
lv_customer TYPE vbak-kunnr,
lv_sales_area TYPE vbap-vkorg,
lv_plant TYPE vbap-werks,
lv_material TYPE vbap-matnr,
lv_quantity TYPE vbap-kwmeng,
lv_uom TYPE vbap-vrkme,
lv_price TYPE vbap-netpr,
lv_currency TYPE vbap-waerk,
lv_item_cat TYPE vbap-vprio,
lv_item_text TYPE vbap-arktx,
ls_header_in TYPE bapi_salesorder_createfromdat2_input,
ls_header_out TYPE bapi_salesorder_createfromdat2_output,
ls_item_in TYPE bapi_salesorder_item_create,
ls_return TYPE bapiret2.
START-OF-SELECTION.
" Set values for header data
lv_doc_type = 'ZOR'.
lv_sales_org = '1000'.
lv_dist_chann = '10'.
lv_division = '00'.
lv_customer = '00001'.
lv_sales_area = '1000'.
" Set values for item data
lv_plant = '1000'.
lv_material = 'MATERIAL1'.
lv_quantity = '10'.
lv_uom = 'EA'.
lv_price = '100'.
lv_currency = 'USD'.
lv_item_cat = 'B'.
lv_item_text = 'Item text'.
" Fill the input structure for the BAPI
ls_header_in-doctype = lv_doc_type.
ls_header_in-salesorg = lv_sales_org.
ls_header_in-disch = lv_dist_chann.
ls_header_in-div = lv_division.
ls_header_in-custno = lv_customer.
ls_header_in-salesarea = lv_sales_area.
ls_item_in-plant = lv_plant.
ls_item_in-material = lv_material.
ls_item_in
阅读全文