DATA:l_physinv_head type bapi_physinv_create_head, lt_retmsg like table of bapiret2 with header line, lt_physinv_item like table of bapi_physinv_create_items with header line. " 盘点单头 l_physinv_head-plant = p_werks. l_physinv_head-stge_loc = p_lgort. l_physinv_head-doc_date = sy-datum. l_physinv_head-plan_date = sy-datum. " 盘点项目 loop at p_itab into wa. lt_physinv_item-material = wa-matnr. lt_physinv_item-batch = wa-charg. append lt_physinv_item. endloop. " 创建盘点凭证 call function ‘BAPI_MATPHYSINV_CREATE_MULT‘ exporting head = l_physinv_head tables items = lt_physinv_item return = lt_retmsg. READ TABLE return WITH KEY type = ‘S‘ id = ‘M7‘ number = ‘710‘. IF sy-subrc = 0. ls_physinventory = return-message_v1. ENDIF.