1、前台创建
事务代码:ME11
采购信息记录一般数据
采购组织数据
条件
2、BAPI创建
调用BAPI:ME_INFORECORD_MAINTAIN
"--------------------@斌将军-------------------- DATA: lv_flag TYPE char1, ls_eina TYPE mewieina, ls_eine TYPE mewieine, ls_einax TYPE mewieinax, ls_einex TYPE mewieinex, lt_txt TYPE mewipirtext_t, ls_txt TYPE mewipirtext, lt_validity TYPE TABLE OF mewivalidity, ls_validity TYPE mewivalidity, lt_condition TYPE TABLE OF mewicondition, ls_condition TYPE mewicondition, lt_value TYPE TABLE OF mewiscaleval, ls_value TYPE mewiscaleval, lt_quan TYPE TABLE OF mewiscalequan, ls_quan TYPE mewiscalequan, ls_eina1 LIKE mewieina, ls_eine1 LIKE mewieine, ls_return TYPE bapireturn, lt_return TYPE mewi_t_return. DATA: lv_infnr TYPE infnr, lv_check TYPE char1, lv_message TYPE char255. CLEAR: lv_flag,ls_eina,ls_einax,ls_eine,ls_einex, lt_txt,ls_txt,lt_validity,ls_validity,lt_condition,ls_condition, lt_value,ls_value,lt_quan,ls_quan, ls_eina1,ls_eine1,ls_return,lt_return. "查询采购信息记录是否存在 SELECT SINGLE eina~infnr INTO lv_infnr FROM eina JOIN eine ON eina~infnr = eine~infnr WHERE eina~lifnr = '0010000792' AND eina~matnr = '000000001010008955' AND eine~ekorg = '3060' AND eine~esokz = '0' AND eine~werks = '3060'. IF sy-subrc <> 0. lv_flag = 'I'. "查看是否有信息记录基础数据 SELECT SINGLE infnr FROM eina INTO lv_infnr WHERE lifnr = '0010000792' AND matnr = '000000001010008955'. IF sy-subrc = 0. ls_eina-info_rec = lv_infnr. ENDIF. ELSE. lv_flag = 'U'. ls_eina-info_rec = lv_infnr. ls_eine-info_rec = lv_infnr. ls_einex-info_rec = 'X'. ENDIF. *采购信息记录 - 一般数据 ls_eina-vendor = '0010000792'."gt_tab-lifnr. "供应商 ls_eina-material = '000000001010008955'."gt_tab-matnr. "物料 ls_eina-po_unit = 'BOT'."gt_tab-meins. "订单计量单位 *ls_eina-conv_num1 = ''."gt_tab-umrez. "单位转换的分子 *ls_eina-conv_den1 = ''."gt_tab-umren. "单位转换的分母 ls_einax-vendor = 'X'. ls_einax-material = 'X'. ls_einax-po_unit = 'X'. *ls_einax-conv_num1 = 'X'. *ls_einax-conv_den1 = 'X'. *采购信息记录 - 采购组织数据 ls_eine-info_type = '0'."gt_tab-esokz. "信息记录类别 ls_eine-purch_org = '3060'."gt_tab-ekorg. "采购组织 ls_eine-plant = '3060'."gt_tab-werks. "工厂 ls_eine-pur_group = '100'."gt_tab-ekgrp. "采购组 ls_eine-gr_basediv = 'X'."gt_tab-webre. "标识:基于收货的发票验证 ls_eine-nrm_po_qty = '1'."gt_tab-norbm. "标准采购订单数量 ls_eine-min_po_qty = ''."gt_tab-minbm. "最小订单数量 ls_eine-max_po_qty = ''."gt_tab-bstma. "最大订单数量 ls_eine-net_price = '10'."gt_tab-netpr. "净价 ls_eine-currency = 'CNY'."gt_tab-waers. "币别 ls_eine-price_unit = '1'."gt_tab-peinh. "价格单位 ls_eine-orderpr_un = 'BOT'."gt_tab-meins. "订单计量单位 ls_eine-conv_num1 = '1'."1. "gt_tab-umrez. "单位转换的分子 ls_eine-conv_den1 = '1'."1. "gt_tab-umren. "单位转换的分母 ls_eine-tax_code = ''."gt_tab-mwskz. "税码 ls_eine-overdeltol = ''."gt_tab-uebto. "过量交货容差 ls_eine-under_tol = ''."gt_tab-untto. "交货不足容差 ls_eine-conf_ctrl = ''."gt_tab-bstae. "确认控制代码 ls_eine-ackn_reqd = ''."gt_tab-kzabs. "供应商需要确认订单 ls_einex-info_type = 'X'. ls_einex-purch_org = 'X'. ls_einex-plant = 'X'. ls_einex-pur_group = 'X'. ls_einex-gr_basediv = 'X'. ls_einex-nrm_po_qty = 'X'. ls_einex-min_po_qty = 'X'. ls_einex-max_po_qty = 'X'. *ls_einex-net_price = 'X'."此处不能打X ls_einex-currency = 'X'. ls_einex-price_unit = 'X'. ls_einex-orderpr_un = 'X'. ls_einex-conv_num1 = 'X'. ls_einex-conv_den1 = 'X'. ls_einex-tax_code = 'X'. ls_einex-overdeltol = 'X'. ls_einex-under_tol = 'X'. ls_einex-conf_ctrl = 'X'. ls_einex-ackn_reqd = 'X'. lt_validity = VALUE #( ( plant = '3060'"gt_tab-werks valid_from = '20240620'"gt_tab-datab valid_to = '99991231'"gt_tab-datbi ) ). lt_condition = VALUE #( ( cond_count = 1 cond_type = 'PB00'"gt_tab-kschl cond_value = '10'"gt_tab-netpr currency = 'CNY'"gt_tab-waers cond_p_unt = '1'"gt_tab-peinh cond_unit = 'BOT'"gt_tab-meins calctypcon = 'C' "计算类型 vendor_no = '0010000792'"gt_tab-lifnr change_id = lv_flag ) ). "阶梯价 * IF gt_tab-kstb1 IS NOT INITIAL. * CLEAR: lt_condition. * lt_condition = VALUE #( ( cond_count = 1 * cond_type = gt_tab-kschl * scale_type = 'A' "等级类型 * scale_base_ty = 'C' "等级基础类型 * scale_unit = gt_tab-meins "条件等级计量单位 * calctypcon = 'C' "计算类型 * cond_value = gt_tab-netpr * currency = gt_tab-waers * cond_p_unt = gt_tab-peinh * cond_unit = gt_tab-meins * vendor_no = gt_tab-lifnr * change_id = lv_flag ) ). * * ls_quan-cond_count = 1. * ls_quan-line_no = 1. * ls_quan-scale_base_qty = '1'."gt_tab-kstb1. * ls_quan-cond_value = '10'."gt_tab-kbet1. * APPEND ls_quan TO lt_quan. * CLEAR ls_quan. * ENDIF. * * IF gt_tab-kstb2 IS NOT INITIAL. * ls_quan-cond_count = 1. * ls_quan-line_no = 2. * ls_quan-scale_base_qty = gt_tab-kstb2. * ls_quan-cond_value = gt_tab-kbet2. * APPEND ls_quan TO lt_quan. * CLEAR ls_quan. * ENDIF. "BAPI CALL FUNCTION 'ME_INFORECORD_MAINTAIN' EXPORTING i_eina = ls_eina i_einax = ls_einax i_eine = ls_eine i_einex = ls_einex IMPORTING e_eina = ls_eina1 e_eine = ls_eine1 TABLES txt_lines = lt_txt cond_validity = lt_validity condition = lt_condition * cond_scale_value = lt_value * cond_scale_quan = lt_quan return = lt_return. CLEAR:lv_message. LOOP AT lt_return INTO ls_return WHERE type CA 'EXA'. lv_message = lv_message && '&' && ls_return-message. ENDLOOP. IF sy-subrc = 0 OR ls_eina1-info_rec IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. lv_message = '采购信息记录' && ls_eina1-info_rec && '创建成功'. WRITE:lv_message. ENDIF. "--------------------@斌将军--------------------
定期更文,欢迎关注
TRANSLATE with x English TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back 此页面的语言为加泰罗尼亚语 翻译为中文(简体) 标签:einex,gt,记录,信息,lt,ls,tab,采购,eine From: https://www.cnblogs.com/BinGeneral/p/18293936