当前位置: 首页 > news >正文

SAP-PLM创建物料主数据接口

FUNCTION zplm_d_0001_mm01.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  EXPORTING
*"     VALUE(EX_TOTAL) TYPE  CHAR4
*"     VALUE(EX_SUCCESSFUL) TYPE  CHAR4
*"     VALUE(EX_FAIL) TYPE  CHAR4
*"  TABLES
*"      IT_DATA STRUCTURE  ZSTRU_PLM_D_0001_INPUT OPTIONAL
*"      ET_DATA STRUCTURE  ZSTRU_PLM_D_0001_OUTPUT OPTIONAL
*"----------------------------------------------------------------------
*  1  检查传入工厂+物料是否已存在SAP,如果已存在就更新,不存在就创建
*  2  需要设置默认值的字段,如果传入空白,自动给默认值(无论是创建还是修改,比如利润中心)
*  3  调用BAPI - BAPI_MATERIAL_SAVEDATA 创建&修改物料主数据
*  4  返回成功/失败的消息和条目数DATA: gs_input  LIKE zstru_plm_d_0001_input,gs_output LIKE zstru_plm_d_0001_output.DATA: gt_marc LIKE TABLE OF marc,gs_marc LIKE marc.*-- rfc log - first phaseINCLUDE zgen_bc_x_fmlog_first_phase.IF it_data[] IS INITIAL.gs_output-retype = 'E'.gs_output-remessage = '没有传入任何数据'.APPEND gs_output TO et_data.CLEAR gs_output.
*-- rfc log - last phaseINCLUDE zgen_bc_x_fmlog_last_phase.RETURN.ENDIF.LOOP AT it_data INTO gs_input.
**1  检查传入值*检查传入工厂IF gs_input-plant IS INITIAL.gs_output-werks = gs_input-plant.gs_output-matnr = gs_input-material.gs_output-retype = 'E'.gs_output-remessage = '没有传入工厂'.APPEND gs_output TO et_data.CLEAR gs_output.ADD 1 TO ex_total.ADD 1 TO ex_fail.CONTINUE.ELSE.SELECT COUNT( * ) FROM t001w WHERE werks = gs_input-plant.IF sy-subrc <> 0.gs_output-werks = gs_input-plant.gs_output-matnr = gs_input-material.gs_output-retype = 'E'.
*        gs_output-remessage = '工厂编码不存在SAP,请检查'.MESSAGE s011(zplm01) WITH gs_input-plant INTO gs_output-remessage.APPEND gs_output TO et_data.CLEAR gs_output.ADD 1 TO ex_total.ADD 1 TO ex_fail.CONTINUE.ENDIF.ENDIF.*物料号补0CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'EXPORTINGinput        = gs_input-materialIMPORTINGoutput       = gs_input-materialEXCEPTIONSlength_error = 1OTHERS       = 2.IF sy-subrc <> 0.
* Implement suitable error handling hereENDIF.*传入单位转内部DATA: l_out_meins TYPE meins.CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'EXPORTINGinput          = gs_input-base_uom
*       LANGUAGE       = SY-LANGUIMPORTINGoutput         = l_out_meinsEXCEPTIONSunit_not_found = 1OTHERS         = 2.IF sy-subrc <> 0.
* Implement suitable error handling hereELSE.gs_input-base_uom =  l_out_meins.ENDIF.*2  设置默认值PERFORM frm_0001_init_data CHANGING gs_input.*3  调用BAPI - BAPI_MATERIAL_SAVEDATA 创建物料主数据PERFORM frm_0001_bapi_mm01 TABLES et_dataUSING gs_input.*3  返回成功/失败的消息和条目数ADD 1 TO ex_total.IF gs_output-retype = 'S'.ADD 1 TO ex_successful.ELSE.ADD 1 TO ex_fail.ENDIF.ENDLOOP.*-- rfc log - last phaseINCLUDE zgen_bc_x_fmlog_last_phase.ENDFUNCTION.FORM frm_0001_init_data CHANGING gs_input LIKE zstru_plm_d_0001_input.DATA: lv_matnr LIKE gs_input-material.DATA: ls_mara LIKE mara,ls_marc LIKE marc.SELECT SINGLE * FROM mara INTO CORRESPONDING FIELDS OF ls_mara WHERE matnr = gs_input-material.SELECT SINGLE * FROM marc INTO CORRESPONDING FIELDS OF ls_marc WHERE werks = gs_input-plant AND matnr = gs_input-material."行业领域IF gs_input-ind_sector IS INITIAL.gs_input-ind_sector = 'M'.ENDIF."普通项目类别组IF gs_input-item_cat IS INITIAL.gs_input-item_cat = 'NORM'.ENDIF."货架寿命到期日的期间标识IF gs_input-period_ind_expiration_date IS INITIAL.gs_input-period_ind_expiration_date = 'D'.ENDIF.""修改物料时,关键字段如果传入空值,自动填充SAP原值IF ls_mara IS NOT INITIAL.IF gs_input-matl_type IS INITIAL."物料类型gs_input-matl_type = ls_mara-mtart.ENDIF.IF gs_input-base_uom IS INITIAL."单位gs_input-base_uom = ls_mara-meins.ENDIF.IF gs_input-matl_group IS INITIAL."物料组gs_input-matl_group = ls_mara-matkl.ENDIF.ENDIF."利润中心IF ls_marc-prctr IS INITIAL."增加利润中心判断逻辑IF gs_input-matl_type = 'ROH'.IF gs_input-plant = '1301'.gs_input-profit_ctr = '1300KL'.ELSEIF gs_input-plant = '1101'.gs_input-profit_ctr = '1100HT'.ENDIF.ELSEIF gs_input-matl_type = 'HALB'.IF gs_input-plant = '1301'.gs_input-profit_ctr = '1300KL'.ELSEIF gs_input-plant = '1101'.gs_input-profit_ctr = '1100HT'.ENDIF.ELSEIF gs_input-matl_type = 'FERT'.IF gs_input-plant = '1301'.gs_input-profit_ctr = '1300KL'.ELSEIF gs_input-plant = '1101'.gs_input-profit_ctr = '1100HT'.ENDIF.ELSEIF gs_input-matl_type = 'Z001'.IF gs_input-plant = '1301'.gs_input-profit_ctr = '1300KL'.ELSEIF gs_input-plant = '1101'.gs_input-profit_ctr = '1100HT'.ENDIF.*          gs_input-STOR_CONDS = '02'.ENDIF.ELSE.IF gs_input-profit_ctr IS INITIAL.gs_input-profit_ctr = ls_marc-prctr.ENDIF.ENDIF.""物料描述IF gs_input-matl_desc IS INITIAL.SELECT SINGLE maktxFROM maktINTO gs_input-matl_descWHERE matnr = gs_input-materialAND spras = sy-langu.ENDIF.""存储条件IF gs_input-stor_conds IS INITIAL.IF gs_input-matl_type = 'FERT'.CLEAR lv_matnr.lv_matnr = gs_input-material."物料编码以31/33开头的存储条件为01,32/34/35开头的存储条件为04CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput  = lv_matnrIMPORTINGoutput = lv_matnr.IF lv_matnr+0(2) = '31' OR lv_matnr+0(2) = '33' OR lv_matnr+0(2) = '36' ."增加36到01gs_input-stor_conds = '01'.ELSEIF lv_matnr+0(2) = '32' OR lv_matnr+0(2) = '34' OR lv_matnr+0(2) = '35'.gs_input-stor_conds = '04'.ENDIF.ELSE."原材料,半成品,营销配件的存储条件全部默认03。gs_input-stor_conds = '03'.ENDIF.ENDIF.ENDFORM.FORM frm_0001_bapi_mm01 TABLES et_data STRUCTURE zstru_plm_d_0001_outputUSING gs_input LIKE zstru_plm_d_0001_input.DATA: gs_output LIKE zstru_plm_d_0001_output.DATA: lt_export LIKE TABLE OF zst_ims_d_0001 WITH HEADER LINE ."下发返回消息DATA: ls_marc LIKE marc.SELECT SINGLE * FROM marcINTO CORRESPONDING FIELDS OF ls_marcWHERE werks = gs_input-plantAND matnr = gs_input-material.DATA:ls_headdata            TYPE          bapimathead,ls_clientdata          TYPE          bapi_mara,ls_clientdatax         TYPE          bapi_marax,ls_plantdata           TYPE          bapi_marc,ls_plantdatax          TYPE          bapi_marcx,ls_mard                LIKE  bapi_mard,ls_mardx               LIKE  bapi_mardx,lt_materialdescription LIKE TABLE OF bapi_makt WITH HEADER LINE. "物料描述
*    LT_materiallongtext    LIKE TABLE OF bapi_mltx WITH HEADER LINE. "物料描述DATA: lt_unitsofmeasure  TYPE TABLE OF bapi_marm WITH HEADER LINE, "单位                  "维护  毛重和体积单位lt_unitsofmeasurex TYPE TABLE OF bapi_marmx WITH HEADER LINE."add D20210324DATA zzbapi_te_mara  LIKE bapi_te_mara. "客户定义字段:客户级别的物料数据DATA zzbapi_te_marax LIKE bapi_te_marax. "客户定义字段:客户级别的物料数据DATA w_extensionin TYPE TABLE OF   bapiparex WITH HEADER LINE.DATA w_extensioninx TYPE TABLE OF bapiparexx WITH HEADER LINE.CLEAR gs_output.CLEAR: ls_headdata,ls_clientdata, "基本数据ls_clientdatax,ls_plantdata, "工厂数据 MRP视图ls_plantdatax,ls_mard,ls_mardx.REFRESH: lt_materialdescription[],lt_unitsofmeasure,lt_unitsofmeasurex.ls_headdata-material        = gs_input-material. "物料碼ls_headdata-ind_sector      = gs_input-ind_sector."產業別ls_headdata-matl_type       = gs_input-matl_type. "物料類型""基本数据1&2IF ls_headdata IS NOT INITIAL.ls_headdata-basic_view = 'X'.MOVE-CORRESPONDING gs_input TO ls_clientdata.
*    ls_clientdata-sled_bbd = 'B'.ls_clientdatax-matl_group = 'X'.ls_clientdatax-base_uom = 'X'.ls_clientdatax-item_cat = 'X'.
*    ls_clientdatax-period_ind_expiration_date = 'X'.ls_clientdatax-pack_vo_un = 'X'.ls_clientdatax-size_dim = 'X'.ls_clientdatax-stor_conds = 'X'.
*    ls_clientdatax-sled_bbd = 'X'.ls_clientdatax-document = 'X'."增加单位D2022.03.03IF  ls_clientdata-std_descr IS NOT INITIAL.ls_clientdatax-std_descr = 'X'.ENDIF."增加单位D20210317
*    IF  ls_clientdata-net_weight IS NOT INITIAL.
*      ls_clientdatax-net_weight = 'X'.
*    ENDIF.IF  ls_clientdata-unit_of_wt IS NOT INITIAL.ls_clientdatax-unit_of_wt = 'X'.ENDIF.ENDIF.""工厂数据 MRP视图IF gs_input-plant IS NOT INITIAL.ls_headdata-storage_view  = 'X'."存储视图MOVE-CORRESPONDING gs_input TO ls_plantdata.
*    ls_plantdata-period_ind = 'M'.ls_plantdatax-plant = gs_input-plant.ls_plantdatax-profit_ctr = 'X'.ls_plantdatax-pur_status = 'X'.
*    ls_plantdatax-period_ind = 'X'.ENDIF."物料描述lt_materialdescription-langu     = '1'.lt_materialdescription-langu_iso = 'ZH'.lt_materialdescription-matl_desc = gs_input-matl_desc.APPEND lt_materialdescription.CLEAR lt_materialdescription.IF gs_input-volum IS NOT INITIAL."单位CLEAR lt_unitsofmeasure[].lt_unitsofmeasure-alt_unit = gs_input-base_uom.lt_unitsofmeasure-volume = gs_input-volum.lt_unitsofmeasure-volumeunit = gs_input-voleh.IF gs_input-unit_of_wt IS NOT INITIAL.lt_unitsofmeasure-unit_of_wt = gs_input-unit_of_wt.ENDIF.APPEND lt_unitsofmeasure.CLEAR lt_unitsofmeasurex[].lt_unitsofmeasurex-alt_unit = gs_input-base_uom.lt_unitsofmeasurex-volume = 'X'.lt_unitsofmeasurex-volumeunit = 'X'.IF gs_input-unit_of_wt IS NOT INITIAL.lt_unitsofmeasurex-unit_of_wt = 'X'.ENDIF.APPEND lt_unitsofmeasurex.ENDIF."增加毛重字段D20210324zzbapi_te_mara-material = ls_headdata-material.zzbapi_te_mara-brgew = gs_input-gross_wt. "毛重zzbapi_te_marax-material = ls_headdata-material.zzbapi_te_marax-brgew = 'X'.w_extensionin-structure = 'BAPI_TE_MARA'.w_extensionin-valuepart1 = zzbapi_te_mara.APPEND w_extensionin.w_extensioninx-structure = 'BAPI_TE_MARAX'.w_extensioninx-valuepart1 = zzbapi_te_marax.APPEND w_extensioninx."""当物料已存在SAP时,不再更新以下三个字段"""【因为接口设置的默认值,但SAP此时的值已被修改,不能再还原为默认值】IF ls_marc IS NOT INITIAL.CLEAR: ls_clientdatax-item_cat,"普通项目类别组ls_plantdatax-profit_ctr,"利润中心ls_clientdatax-stor_conds."存储条件ENDIF.DATA: msgreturn LIKE bapi_matreturn2 OCCURS 0 WITH HEADER LINE.DATA: BEGIN OF wa_errmsg.INCLUDE STRUCTURE bapiret2.DATA:END OF wa_errmsg.DATA it_return TYPE /eacc/t_bapiret2 .REFRESH msgreturn.CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'EXPORTINGheaddata            = ls_headdataclientdata          = ls_clientdata "基本数据clientdatax         = ls_clientdataxplantdata           = ls_plantdata "工厂数据 MRP视图plantdatax          = ls_plantdatax
*     storagelocationdata = ls_mard
*     storagelocationdatax = ls_mardxTABLESmaterialdescription = lt_materialdescription "物料描述unitsofmeasure      = lt_unitsofmeasureunitsofmeasurex     = lt_unitsofmeasurexextensionin         = w_extensioninextensioninx        = w_extensioninxreturnmessages      = msgreturn.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.LOOP AT msgreturn WHERE type = 'E' ."OR ( TYPE = 'S' AND ID = 'M3' AND ( NUMBER = 800 OR NUMBER = 810 ) ).MOVE-CORRESPONDING msgreturn TO wa_errmsg.APPEND wa_errmsg TO it_return.ENDLOOP.LOOP AT it_return INTO wa_errmsg.gs_output-werks = gs_input-plant.gs_output-matnr = gs_input-material.gs_output-retype = wa_errmsg-type.MESSAGE ID wa_errmsg-idTYPE wa_errmsg-typeNUMBER wa_errmsg-numberWITH wa_errmsg-message_v1wa_errmsg-message_v2wa_errmsg-message_v3wa_errmsg-message_v4INTO gs_output-remessage.APPEND gs_output TO et_data.CLEAR gs_output.ENDLOOP.IF sy-subrc <> 0.gs_output-werks = gs_input-plant.gs_output-matnr = gs_input-material.gs_output-retype = 'S'.IF ls_marc IS INITIAL.MESSAGE s800(m3) WITH  gs_input-material INTO gs_output-remessage.ELSE.MESSAGE s801(m3) WITH  gs_input-material INTO gs_output-remessage.ENDIF.APPEND gs_output TO et_data.CLEAR gs_output.
*---当物料创建或者修改成功执行下发CALL FUNCTION 'ZIMS_D_0001_MATNR_SYNC'TABLESit_data   = et_dataet_export = lt_export.IF sy-subrc = 0.LOOP AT lt_export.gs_output-retype = lt_export-retype.CONCATENATE '物料'  gs_input-material lt_export-remessage INTO gs_output-remessage.
*        gs_output-remessage = ls_export-remessage.APPEND gs_output TO et_data.CLEAR: gs_output,lt_export.ENDLOOP.ENDIF."添加更改日志PERFORM frm_0001_update_log USING gs_input.UPDATE mara SET texture = gs_input-texturezz_spec = gs_input-zz_speczz_model = gs_input-zz_modelzz_fcode = gs_input-zz_fcodezz_func = gs_input-zz_funczz_ibin = gs_input-zz_ibin"增加是否激活D20220422zz_pjcode = gs_input-zz_pjcode"增加是否激活D20220422zz_mode = gs_input-zz_mode"增加激活方式D20231024WHERE matnr = gs_input-material.COMMIT WORK AND WAIT.ENDIF.ENDFORM.FORM frm_0001_update_log USING gs_input LIKE zstru_plm_d_0001_input.DATA: zz_spec_chang   TYPE mara-zz_spec, ""规格texture_chang   TYPE mara-texture, ""材质zz_model_chang  TYPE mara-zz_model, ""型号zz_fcode_chang  TYPE mara-zz_fcode, ""功能码zz_func_chang   TYPE mara-zz_func,  "功能配置zz_ibin_chang   TYPE mara-zz_ibin, "是否激活D20220422zz_pjcode_chang TYPE mara-zz_pjcode, "配件码D20220522zz_mode_chang   TYPE mara-zz_mode. "激活方式D20231024DATA: it_zmm02ul TYPE TABLE OF  zmm02ul  WITH HEADER LINE .DATA wk_number TYPE c LENGTH 10.REFRESH it_zmm02ul[].CLEAR it_zmm02ul."规格SELECT SINGLE zz_spec FROM mara INTO zz_spec_chang WHERE matnr =  gs_input-material.IF zz_spec_chang IS INITIAL.IF gs_input-zz_spec IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_SPEC'.it_zmm02ul-zfield1n = '规格'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_spec_chang.it_zmm02ul-znewvl   = gs_input-zz_spec.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_spec IS  INITIAL.it_zmm02ul-matnr    = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_SPEC'.it_zmm02ul-zfield1n = '规格'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_spec_chang.it_zmm02ul-znewvl   = gs_input-zz_spec.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_spec <> zz_spec_chang.it_zmm02ul-matnr    = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_SPEC'.it_zmm02ul-zfield1n = '规格'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_spec_chang.it_zmm02ul-znewvl   = gs_input-zz_spec.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul."材质SELECT SINGLE texture FROM mara INTO texture_chang WHERE matnr =  gs_input-material.IF texture_chang IS INITIAL.IF gs_input-texture IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'TEXTURE'.it_zmm02ul-zfield1n = '材质'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = texture_chang.it_zmm02ul-znewvl   = gs_input-texture.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-texture IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'TEXTURE'.it_zmm02ul-zfield1n = '材质'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = texture_chang.it_zmm02ul-znewvl   = gs_input-texture.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-texture <> texture_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'TEXTURE'.it_zmm02ul-zfield1n = '材质'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = texture_chang.it_zmm02ul-znewvl   = gs_input-texture.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul."型号SELECT SINGLE zz_model FROM mara INTO zz_model_chang WHERE matnr =  gs_input-material.IF zz_model_chang IS INITIAL.IF gs_input-zz_model IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODEL'.it_zmm02ul-zfield1n = '型号'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_model_chang.it_zmm02ul-znewvl   = gs_input-zz_model.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_model IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODEL'.it_zmm02ul-zfield1n = '型号'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_model_chang.it_zmm02ul-znewvl   = gs_input-zz_model.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_model <> zz_model_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODEL'.it_zmm02ul-zfield1n = '型号'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_model_chang.it_zmm02ul-znewvl   = gs_input-zz_model.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul."功能码SELECT SINGLE zz_fcode FROM mara INTO zz_fcode_chang WHERE matnr =  gs_input-material.IF zz_fcode_chang IS INITIAL.IF gs_input-zz_fcode IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FCODE'.it_zmm02ul-zfield1n = '功能码'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_fcode_chang.it_zmm02ul-znewvl   = gs_input-zz_fcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_fcode IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FCODE'.it_zmm02ul-zfield1n = '功能码'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_fcode_chang.it_zmm02ul-znewvl   = gs_input-zz_fcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_fcode <> zz_fcode_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FCODE'.it_zmm02ul-zfield1n = '功能码'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_fcode_chang.it_zmm02ul-znewvl   = gs_input-zz_fcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul."功能配置SELECT SINGLE zz_func FROM mara INTO zz_func_chang WHERE matnr =  gs_input-material.IF zz_func_chang IS INITIAL.IF gs_input-zz_func IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FUNC'.it_zmm02ul-zfield1n = '功能配置'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_func_chang.it_zmm02ul-znewvl   = gs_input-zz_func.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_func IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FUNC'.it_zmm02ul-zfield1n = '功能配置'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_func_chang.it_zmm02ul-znewvl   = gs_input-zz_func.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_func <> zz_func_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_FUNC'.it_zmm02ul-zfield1n = '功能配置'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_func_chang.it_zmm02ul-znewvl   = gs_input-zz_func.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul."是否激活字段addD20220422SELECT SINGLE zz_ibin FROM mara INTO zz_ibin_chang WHERE matnr =  gs_input-material.IF zz_ibin_chang IS INITIAL.IF gs_input-zz_func IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_IBIN'.it_zmm02ul-zfield1n = '是否激活'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_ibin_chang.it_zmm02ul-znewvl   = gs_input-zz_ibin.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_ibin IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_IBIN'.it_zmm02ul-zfield1n = '是否激活'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_ibin_chang.it_zmm02ul-znewvl   = gs_input-zz_ibin.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_ibin <> zz_ibin_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_IBIN'.it_zmm02ul-zfield1n = '是否激活'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_ibin_chang.it_zmm02ul-znewvl   = gs_input-zz_ibin.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF."配件码addD20220522SELECT SINGLE zz_pjcode FROM mara INTO zz_pjcode_chang WHERE matnr =  gs_input-material.IF zz_pjcode_chang IS INITIAL.IF gs_input-zz_pjcode IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_PJCODE'.it_zmm02ul-zfield1n = '配件码'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_pjcode_chang.it_zmm02ul-znewvl   = gs_input-zz_pjcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_pjcode IS  INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_PJCODE'.it_zmm02ul-zfield1n = '配件码'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_pjcode_chang.it_zmm02ul-znewvl   = gs_input-zz_pjcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_pjcode <> zz_pjcode_chang.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_PJCODE'.it_zmm02ul-zfield1n = '配件码'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_pjcode_chang.it_zmm02ul-znewvl   = gs_input-zz_pjcode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.REFRESH it_zmm02ul[].CLEAR it_zmm02ul."激活方式addD20231024SELECT SINGLE zz_mode FROM mara INTO zz_mode_chang  WHERE matnr =  gs_input-material.IF zz_mode_chang  IS INITIAL.IF gs_input-zz_spec IS NOT INITIAL.it_zmm02ul-matnr   = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODE'.it_zmm02ul-zfield1n = '激活方式'.it_zmm02ul-zu_type  =  '插入'.it_zmm02ul-zoldvl   = zz_mode_chang .it_zmm02ul-znewvl   = gs_input-zz_mode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ELSE.IF gs_input-zz_spec IS  INITIAL.it_zmm02ul-matnr    = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODE'.it_zmm02ul-zfield1n = '激活方式'.it_zmm02ul-zu_type  =  '删除'.it_zmm02ul-zoldvl   = zz_mode_chang .it_zmm02ul-znewvl   = gs_input-zz_mode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ELSE.IF  gs_input-zz_spec <> zz_spec_chang.it_zmm02ul-matnr    = gs_input-material.it_zmm02ul-zfield1  = 'ZZ_MODE'.it_zmm02ul-zfield1n = '激活方式'.it_zmm02ul-zu_type  =  '变更'.it_zmm02ul-zoldvl   = zz_mode_chang.it_zmm02ul-znewvl   = gs_input-zz_mode.it_zmm02ul-zdata    = sy-datum.it_zmm02ul-ztime    = sy-uzeit.it_zmm02ul-bname    = sy-uname.ENDIF.ENDIF.ENDIF.IF it_zmm02ul IS NOT INITIAL.APPEND it_zmm02ul.ENDIF.CLEAR it_zmm02ul.IF it_zmm02ul[] IS NOT INITIAL.CLEAR wk_number.CALL FUNCTION 'NUMBER_RANGE_ENQUEUE 'EXPORTINGobject           = 'ZMMRP002'EXCEPTIONSforeign_lock     = 1object_not_found = 2system_failure   = 3OTHERS           = 4.IF sy-subrc = 0.CALL FUNCTION 'NUMBER_GET_NEXT'EXPORTINGnr_range_nr             = '00'object                  = 'ZMMRP002'IMPORTINGnumber                  = wk_numberEXCEPTIONSinterval_not_found      = 1number_range_not_intern = 2object_not_found        = 3quantity_is_0           = 4quantity_is_not_1       = 5interval_overflow       = 6buffer_overflow         = 7OTHERS                  = 8.CALL FUNCTION 'NUMBER_RANGE_DEQUEUE 'EXPORTINGobject           = 'ZMMRP002'EXCEPTIONSobject_not_found = 1OTHERS           = 2.ELSE .RAISE num_range_error .ENDIF .LOOP AT it_zmm02ul.it_zmm02ul-zul_no = wk_number.MODIFY it_zmm02ul TRANSPORTING zul_no.CLEAR it_zmm02ul.ENDLOOP.MODIFY zmm02ul FROM TABLE it_zmm02ul[].ENDIF.
ENDFORM.

返回的结果表在这里插入图片描述
数据的传入表
在这里插入图片描述在这里插入图片描述
在这里插入图片描述数据的传出表
在这里插入图片描述

相关文章:

SAP-PLM创建物料主数据接口

FUNCTION zplm_d_0001_mm01. *"---------------------------------------------------------------------- *"*"本地接口&#xff1a; *" EXPORTING *" VALUE(EX_TOTAL) TYPE CHAR4 *" VALUE(EX_SUCCESSFUL) TYPE CHAR4 *" …...

超声波眼镜清洗机哪个品牌好?四款高性能超声波清洗机测评剖析

对于追求高生活质量的用户来说&#xff0c;眼镜的清洁绝对不能马虎。如果不定期清洁眼镜&#xff0c;时间久了&#xff0c;镜片的缝隙中会积累大量的灰尘和细菌&#xff0c;眼镜靠近眼部&#xff0c;对眼部健康有很大影响。在这种情况下&#xff0c;超声波清洗机显得尤为重要。…...

卸载Windows软件的正确姿势,你做对了吗?

前言 今天有小伙伴突然问我&#xff1a;她把软件都卸载了&#xff0c;但是怎么软件都还在运行&#xff1f; 这个问题估计很多小伙伴都是遇到过的&#xff0c;对于电脑小白来说&#xff0c;卸载Windows软件真的真的真的是一件很难的事情。所以&#xff0c;今天咱们就来讲讲&am…...

WEB前端14-Element UI(学生查询表案例/模糊查询/分页查询)

Vue2-Element UI 1.可重用组件的开发 可重用组件 我们一般将可重复使用的组件放在components目录之下&#xff0c;以便父组件的灵活调用 <!--可重用组件一般与css密切相关&#xff0c;使用可重用组件的目的是&#xff0c;将相似的组件放在一起&#xff0c;方便使用-->…...

使用swiftui自定义圆形进度条实现loading

实现的代码如下&#xff1a; // // LoadingView.swift // SwiftBook // // Created by Song on 2024/8/2. //import SwiftUIstruct LoadingView: View {State var process 0.5var body: some View {VStack(spacing: 20) {ZStack {Circle().stroke(.gray.opacity(0.3), lin…...

C# 设计模式之抽象工厂模式

总目录 前言 工厂方法模式是为了克服简单工厂模式的缺点而设计出来的&#xff0c;简单工厂模式的工厂类随着产品类的增加需要增加额外的代码&#xff0c;而工厂方法模式每个具体工厂类只完成单个实例的创建&#xff0c;所以它具有很好的可扩展性。但是在现实生活中&#xff0c…...

Javascript前端面试基础(八)

window.onload和$(document).ready区别 window.onload()方法是必须等到页面内包括图片的所有元素加载完毕后才能执行$(document).ready()是DOM结构绘制完毕后就执行&#xff0c;不必等到加载完毕 window.onload 触发时机&#xff1a;window.onload 事件会在整个页面&#xf…...

R 语言学习教程,从入门到精通,R的安装与环境的配置(2)

1、R的安装与环境的配置 R语言是一款完全免费且开源的软件&#xff0c;它的开源许可证是GNU通用公共许可证&#xff08;GPL&#xff09;&#xff0c;这意味着任何人都可以自由地使用、复制、修改和发布R语言的源代码&#xff0c;甚至可以将其用于商业用途。 和python等其他语言…...

Python批量下载音乐功能

Python批量下载音乐功能 Python批量下载音乐,调用API接口,同时下载歌曲和歌词 先安排一下要用的模块&#xff0c;导入进来。 import re import json import requests目录结构 下载音乐 Awking_Class.pymusic.txt 文件文件写的是音乐名字,使用换行分割 new_music 注意这个 ne…...

用 Bytebase 实现批量、多环境、多租户数据库的丝滑变更

Bytebase 提供了多种功能来简化批量变更管理&#xff0c;适用于多环境或多租户情况。本教程将指导您如何使用 部署配置 和 数据库组 在不同场景下进行数据库批量变更。 默认流水线 vs 部署配置 图片数据库 vs 数据库组 1. 准备 请确保已安装 Docker&#xff0c;如果本地没有重…...

java之方法引用 —— ::

目录 一、简介 二、引用静态方法 1.格式 2.示例 ​编辑 3.条件解析 三、引用成员方法 1.格式 2.示例 四、引用构造方法 1.格式 2.示例 五、类名引用成员方法 1.格式 2.略微不同的方法引用规则 3.示例 六、引用数组的构造方法 1.格式 2.示例 一、简介 方…...

「测试线排查的一些经验-上篇」 后端工程师

文章目录 端口占用脚本失灵线上部署项目结构模版配置文件生效 一般产品研发过程所使用的环境可分为&#xff1a; 研发环境-dev测试环境-test生产环境-prod 软件开发中&#xff0c;完整测试环境包括&#xff1a;UT、IT、ST、UAT UT Unit Test 单元测试 IT System Integration …...

AOSP12_BatteryStats统计电池数据信息

前言 BatteryStats模块主要用于设备在电池供电是系统对各个模块电量使用的统计,Android提供的Battery Historain工具就是对此模块统计的数据进行解析和展示。 一 BatteryStats模块类图 模块主要类图如下:见根目录的模块类图 BatteryStats:抽象类,本模块的核心类,主要定…...

【Android Studio】UI 布局

文章目录 view布局LinearLayout view 在Android开发中&#xff0c;View是一个非常重要的概念&#xff0c;它是所有用户界面组件的基类。View类及其子类构成了Android应用中的用户界面。每个View都占用屏幕上的一个矩形区域&#xff0c;并可以响应用户输入&#xff08;如触摸、按…...

虚拟机Windows server忘记密码解决方法

原理 utilman.exe是Windows辅助工具管理器程序&#xff0c;‌虽然它本身不是一个关键的系统进程&#xff0c;‌但通过修改这个文件&#xff0c;‌用户可以访问一些有用的UI设置。‌在某些情况下&#xff0c;‌比如忘记密码需要重置时&#xff0c;‌通过修改utilman.exe文件为c…...

【香橙派系列教程】(六)嵌入式SQLite数据库

【六】嵌入式SQLite数据库 文章目录 【六】嵌入式SQLite数据库1.简介2.SQLite数据库安装3.SQLite命令用法1.创建数据库2.创建和查看表格3.插入查看数据&#xff08;记录&#xff09;4.删除更改数据&#xff08;记录&#xff09; 4.SQLite编程操作1.打开/创建数据库的C接口2.创建…...

深入探讨PHP8的新特性与性能优化

本文由 ChatMoney团队出品 随着互联网技术的飞速发展&#xff0c;PHP作为后端开发领域的热门语言也在不断演进。近期&#xff0c;PHP8的发布引起了广泛关注。本文将为您详细介绍PHP8的新特性以及性能优化&#xff0c;并通过具体示例帮助您更好地理解和应用这些新特性。 一、PH…...

2024年06月 Scratch 图形化(四级)真题解析#中国电子学会#全国青少年软件编程等级考试

Scratch图形化等级考试(1~4级)全部真题・点这里 一、单选题(共10题,共30分) 第1题 运行下列程序,输入单词“PLAY”,最后角色说?( ) A:LY4AP B:AP4LY C:YA4PL D:PL4AY 答案:B 根据程序分析可知,首先获取单词字符数,然后奇数位的字母放在字符数左侧,偶数位…...

书生大模型全链路开源体系

书生大模型全链路开源体系 数据 预训练 微调 评测 部署 应用...

极简聊天室-websocket版(双向通信)

我们知道WebSocket是可以双向通信的&#xff0c;把极简聊天室代码又改了一下&#xff0c;前端发信息到后端也使用websocket&#xff0c;其实代码量更少了。。。 const express require(express); const app express(); var wsServer require(express-ws)(app)var msgs[];ap…...

从小白到架构师 | 缓存预热

缓存预热指的是在系统启动或上线前&#xff0c;提前将经常访问的数据加载到缓存中&#xff0c;以避免在系统刚启动时&#xff0c;用户大量请求直接访问数据库&#xff0c;导致数据库压力过大或系统性能下降。通过缓存预热&#xff0c;可以确保系统一上线就能提供快速的响应时间…...

Modbus -- TCP协议

MODBUS TCP协议是一种基于TCP/IP协议的Modbus变种&#xff0c;它允许Modbus协议在以太网网络上运行&#xff0c;使得设备之间可以通过IP网络交换数据。 一:协议概述 modbus_TCP协议:走的是网口&#xff0c;所以需要创建TCPclient对象进行通信,和modubus-RTU协议最大的区别是&a…...

python四舍五入取整数

在Python中&#xff0c;如果你想要对一个浮点数进行四舍五入并取整&#xff08;即只保留整数部分&#xff09;&#xff0c;你可以使用内置的round()函数&#xff0c;但不指定第二个参数&#xff08;即小数位数&#xff09;&#xff0c;或者明确指定为0。这样&#xff0c;Python…...

洛谷 P1868 饥饿的奶牛

原题 题目描述 有一条奶牛冲出了围栏&#xff0c;来到了一处圣地&#xff08;对于奶牛来说&#xff09;&#xff0c;上面用牛语写着一段文字。 现用汉语翻译为&#xff1a; 有 N 个区间&#xff0c;每个区间x,y 表示提供的x∼y 共y−x1 堆优质牧草。你可以选择任意区间但不…...

Arco Design 之Table表格

此篇文章为table表格示例&#xff0c;包含列、data数据、展开、选中、自定义等相关属性 基础表格 <a-table :columns"columns1" :data"tableData1" />const columns1 [{ title: "编号", dataIndex: "no"},{ title: "名称…...

Python机器学习 模型

Python机器学习模型、回归预测模型、数据清洗、数据处理、数据挖掘、数据分析代做。 模型不仅限于线性回归、逻辑回归、决策树、SVM、随机森林、贝叶斯、XGBoost、LightGBM、CatBoost&#xff0c;聚类&#xff1a;K-Means、DBSCAN&#xff0c;机器学习都可。 时间序列分析&…...

基于 STM32 的 NAS私有云盘搭建:集成LwIP 协议、HTTP/HTTPS、WEB前端技术栈(代码示例)

项目概述 在本项目中&#xff0c;我们将搭建一个基于 STM32 的 NAS&#xff08;网络附加存储&#xff09;私盘&#xff0c;通过网络访问存储在外部 SATA 硬盘上的文件。该项目将使用 STM32 开发板、外接 SATA 硬盘、LwIP 协议栈以及 FATFS 文件系统来实现文件的上传、下载和管…...

蓝屏?死机?爆CPU?多开卡顿?你有关心过你的硬盘吗?

上来先叠甲 蓝屏、死机、爆cpu、多开卡顿&#xff0c;不一定是硬盘的问题&#xff0c;只是硬盘有问题都可能会引起这些现象&#xff0c;所以不要遇到这些问题就一定认为是硬盘的问题然后说我说的&#xff0c;只是给你一个排除问题的思路。本文会采用比较通俗所以不太专业的角度…...

Flutter开发报错error: unable to unlink old ‘pubspec.yaml‘: Invalid argument

背景&#xff1a;主分支master&#xff0c;然后每人1个分支&#xff0c;每次push到自己分支后&#xff0c;再提mr到master。 于是每次提交前要先git merge origin/master。 有时候会报这个错误&#xff0c;无法merge 原因&#xff1a;很简单&#xff0c;就是pubspec.yaml这个文…...

零基础进程最详解:进程状态、僵尸进程、孤儿进程、阻塞态、挂起态、进程切换、进程常用命令、进程创建、队列优先级

目录 强烈建议全文阅读&#xff01;&#xff01;&#xff01; 强烈建议全文阅读&#xff01;&#xff01;&#xff01; 强烈建议全文阅读&#xff01;&#xff01;&#xff01; 一、进程状态 二、僵尸和孤儿进程 1、僵尸进程 Z&#xff08;zombie&#xff09; 2、孤儿进…...