MMSC物料库位扩充
-
输入事务码MMSC:
-
回车后添加新的库位即可:
-
代码实现,使用BDC
*&------------------------------------------------* *&BDC的定义 *&------------------------------------------------* DATA gt_bdcdata TYPE TABLE OF bdcdata WITH HEADER LINE. "bdc执行内表 DATA gt_msgtab TYPE TABLE OF bdcmsgcoll WITH HEADER LINE. "bdc返回信息表 DATA p_mode TYPE c VALUE 'N'."bdc运行模式 *调用FROM例程 PERFORM locat_dbc USING gw_mseg-matnr gw_mseg-werks gw_mseg-lgort."库位扩充 *FROM FORM bdc_field1 USING fnam fval. CLEAR gt_bdcdata. gt_bdcdata-fnam = fnam. gt_bdcdata-fval = fval. APPEND gt_bdcdata. ENDFORM. "BDC_FIELD FORM bdc_dynpro1 USING program dynpro. CLEAR gt_bdcdata. gt_bdcdata-program = program. gt_bdcdata-dynpro = dynpro. gt_bdcdata-dynbegin = 'X'. APPEND gt_bdcdata. ENDFORM. "BDC_ FORM locat_dbc USING p_material p_plant p_stloc. "CHANGING p_retu STRUCTURE bapireturn. REFRESH:gt_bdcdata,gt_msgtab. PERFORM bdc_dynpro1 USING 'SAPMM03M' '0105'. PERFORM bdc_field1 USING 'BDC_CURSOR' 'RM03M-WERKS'. PERFORM bdc_field1 USING 'BDC_OKCODE' '/00'. PERFORM bdc_field1 USING 'RM03M-MATNR' p_material. PERFORM bdc_field1 USING 'RM03M-WERKS' p_plant. PERFORM bdc_field1 USING 'RM03M-LFLAG' 'X'. PERFORM bdc_dynpro1 USING 'SAPMM03M' '0195'. PERFORM bdc_field1 USING 'BDC_CURSOR' 'RM03M-LGORT(10)'. PERFORM bdc_field1 USING 'BDC_OKCODE' '/00'. PERFORM bdc_field1 USING 'RM03M-LGORT(10)' p_stloc. PERFORM bdc_dynpro1 USING 'SAPMM03M' '0195'. PERFORM bdc_field1 USING 'BDC_CURSOR' 'RM03M-LGORT(05)'. PERFORM bdc_field1 USING 'BDC_OKCODE' '=BU'. CALL TRANSACTION 'MMSC' USING gt_bdcdata MODE p_mode MESSAGES INTO gt_msgtab UPDATE 'S'. "批导更新模式(A = '异步',S = '同步') READ TABLE gt_msgtab INTO DATA(gs_msgtab) WITH KEY msgtyp = 'E'. IF sy-subrc = 0. p_flag = 'X'. ENDIF. ENDFORM. " LOCAT_DBC