在浪潮项目中,PLM和ERP接口需要创建物料主数据,下面是写的一个RFC函数,供PLM端调用。
FUNCTION Z_IF_MAT_CREATE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" I_INTAB STRUCTURE ZDS0001 OPTIONAL
*" O_INTAB STRUCTURE ZDS0001_OUT OPTIONAL
*"----------------------------------------------------------------------
DATA:I_HEAD TYPE BAPIMATHEAD.
DATA:E_ERROR TYPE P08_SP420.
DATA:W_HEADDATA LIKE BAPIMATHEAD,
W_CLIENTDATA LIKE BAPI_MARA,
W_CLIENTDATAX LIKE BAPI_MARAX,
W_PLANTDATA LIKE BAPI_MARC,
W_PLANTDATAX LIKE BAPI_MARCX,
W_VALUATIONDATA LIKE BAPI_MBEW,
W_VALUATIONDATAX LIKE BAPI_MBEWX,
W_FORECASTPARAMETERS LIKE BAPI_MPOP,
W_FORECASTPARAMETERSX LIKE BAPI_MPOPX,
W_PLANNINGDATA LIKE BAPI_MPGD,
W_PLANNINGDATAX LIKE BAPI_MPGDX,
W_STORAGELOCATIONDATA LIKE BAPI_MARD,
W_STORAGELOCATIONDATAX LIKE BAPI_MARDX,
W_SALESDATA LIKE BAPI_MVKE,
W_SALESDATAX LIKE BAPI_MVKEX,
W_RETURN LIKE BAPIRET2.
DATA: BEGIN OF W_MATERIALDESCRIPTION OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF W_MATERIALDESCRIPTION.
DATA: BEGIN OF W_RETURNMESSAGES OCCURS 0.
INCLUDE STRUCTURE BAPI_MATRETURN2.
DATA: END OF W_RETURNMESSAGES.
DATA: BEGIN OF W_UNITSOFMEASURE OCCURS 0.
INCLUDE STRUCTURE BAPI_MARM.
DATA: END OF W_UNITSOFMEASURE.
DATA: BEGIN OF W_UNITSOFMEASUREX OCCURS 0.
INCLUDE STRUCTURE BAPI_MARMX.
DATA: END OF W_UNITSOFMEASUREX.
DATA: BEGIN OF W_TAXCLASSIFICATIONS OCCURS 0.
INCLUDE STRUCTURE BAPI_MLAN.
DATA: END OF W_TAXCLASSIFICATIONS.
DATA: BEGIN OF W_MATERIALLONGTEXT OCCURS 0.
INCLUDE STRUCTURE BAPI_MLTX.
DATA: END OF W_MATERIALLONGTEXT.
DATA: W_LANGUAGE LIKE SY-LANGU.
DATA: BEGIN OF W_MANTR OCCURS 0.
INCLUDE STRUCTURE BAPIMATINR.
DATA: END OF W_MANTR.
DATA: BEGIN OF W_EXTENSIONIN OCCURS 0.
INCLUDE STRUCTURE BAPIPAREX.
DATA: END OF W_EXTENSIONIN.
DATA: BEGIN OF W_EXTENSIONINX OCCURS 0.
INCLUDE STRUCTURE BAPIPAREXX.
DATA: END OF W_EXTENSIONINX.
DATA ZZBAPI_TE_MARA LIKE BAPI_TE_MARA.
DATA ZZBAPI_TE_MARAX LIKE BAPI_TE_MARAX.
DATA W_BUKRS TYPE T001K-BUKRS.
DATA W_MLTX TYPE BAPI_MLTX-TEXT_NAME.
DATA W_LAND1 TYPE T001-LAND1.
DATA W_MWST(4) TYPE C.
DATA W_SPRAS TYPE SY-LANGU.
DATA:IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA:G_INFO TYPE STRING.
CLEAR W_MWST.
CLEAR W_LAND1.
CLEAR W_MLTX.
CLEAR W_BUKRS.
CLEAR W_SPRAS.
FREE W_MATERIALDESCRIPTION.
FREE W_RETURNMESSAGES.
FREE W_TAXCLASSIFICATIONS.
FREE W_MATERIALLONGTEXT.
DATA:LV_MATNR TYPE MARA-MATNR.
LOOP AT I_INTAB.
MOVE-CORRESPONDING I_INTAB TO O_INTAB.
CLEAR LV_MATNR.
SELECT SINGLE
MATNR
INTO LV_MATNR
FROM MARC
WHERE WERKS = I_INTAB-WERKS
AND MATNR = I_INTAB-MATNR.
IF LV_MATNR <> ‘‘.
O_INTAB-FLAG1 = ‘S‘.
O_INTAB-MESSAGE1 = ‘物料已创建成功:物料已存在不需要创建!‘.
O_INTAB-FLAG2 = ‘S‘.
O_INTAB-MESSAGE2 = ‘物料已创建成功:物料已存在不需要创建!‘.
O_INTAB-FLAG3 = ‘S‘.
O_INTAB-MESSAGE3 = ‘物料已创建成功:物料已存在不需要创建!‘.
ELSE.
CLEAR W_HEADDATA.
CLEAR W_CLIENTDATA.
CLEAR W_CLIENTDATAX.
CLEAR W_PLANTDATA.
CLEAR W_PLANTDATAX.
CLEAR W_VALUATIONDATA.
CLEAR W_VALUATIONDATAX.
CLEAR W_FORECASTPARAMETERS.
CLEAR W_FORECASTPARAMETERSX.
CLEAR W_PLANNINGDATA.
CLEAR W_PLANNINGDATAX.
CLEAR W_STORAGELOCATIONDATA.
CLEAR W_STORAGELOCATIONDATAX.
CLEAR W_SALESDATA.
CLEAR W_SALESDATAX.
CLEAR W_RETURN.
CLEAR W_MATERIALDESCRIPTION.
REFRESH W_MATERIALDESCRIPTION.
CLEAR W_RETURNMESSAGES.
REFRESH W_RETURNMESSAGES.
CLEAR W_UNITSOFMEASURE.
REFRESH W_UNITSOFMEASURE.
CLEAR W_UNITSOFMEASUREX.
REFRESH W_UNITSOFMEASUREX.
CLEAR W_TAXCLASSIFICATIONS.
REFRESH W_TAXCLASSIFICATIONS.
CLEAR W_MATERIALLONGTEXT.
REFRESH W_MATERIALLONGTEXT.
CLEAR W_LANGUAGE.
CLEAR W_MANTR.
REFRESH W_MANTR.
CLEAR W_EXTENSIONIN.
REFRESH W_EXTENSIONIN.
CLEAR W_EXTENSIONINX.
REFRESH W_EXTENSIONINX.
CLEAR ZZBAPI_TE_MARA.
CLEAR ZZBAPI_TE_MARAX.
CLEAR W_BUKRS.
CLEAR W_MLTX.
CLEAR W_LAND1.
CLEAR W_MWST.
CLEAR W_SPRAS.
FREE W_MATERIALDESCRIPTION.
FREE W_RETURNMESSAGES.
FREE W_TAXCLASSIFICATIONS.
FREE W_MATERIALLONGTEXT.
CLEAR I_HEAD.
I_HEAD-MATERIAL = I_INTAB-MATNR.
I_HEAD-IND_SECTOR = I_INTAB-MBRSH.
I_HEAD-MATL_TYPE = I_INTAB-MTART.
* HEADDATA
* HEADDATAX
MOVE I_HEAD-MATERIAL TO W_HEADDATA-MATERIAL.
MOVE I_HEAD-IND_SECTOR TO W_HEADDATA-IND_SECTOR.
MOVE I_HEAD-MATL_TYPE TO W_HEADDATA-MATL_TYPE.
MOVE I_HEAD-BASIC_VIEW TO W_HEADDATA-BASIC_VIEW.
MOVE I_HEAD-SALES_VIEW TO W_HEADDATA-SALES_VIEW.
MOVE I_HEAD-PURCHASE_VIEW TO W_HEADDATA-PURCHASE_VIEW.
MOVE I_HEAD-MRP_VIEW TO W_HEADDATA-MRP_VIEW.
MOVE I_HEAD-FORECAST_VIEW TO W_HEADDATA-FORECAST_VIEW.
MOVE I_HEAD-WORK_SCHED_VIEW TO W_HEADDATA-WORK_SCHED_VIEW.
MOVE I_HEAD-PRT_VIEW TO W_HEADDATA-PRT_VIEW.
MOVE I_HEAD-STORAGE_VIEW TO W_HEADDATA-STORAGE_VIEW.
MOVE I_HEAD-WAREHOUSE_VIEW TO W_HEADDATA-WAREHOUSE_VIEW.
MOVE I_HEAD-QUALITY_VIEW TO W_HEADDATA-QUALITY_VIEW.
MOVE I_HEAD-ACCOUNT_VIEW TO W_HEADDATA-ACCOUNT_VIEW.
MOVE I_HEAD-COST_VIEW TO W_HEADDATA-COST_VIEW.
MOVE I_HEAD-IND_SECTOR TO W_HEADDATA-IND_SECTOR. "added by liuxy2014-12-29
MOVE I_HEAD-MATL_TYPE TO W_HEADDATA-MATL_TYPE. "added by liuxy2014-12-29
* CLIENTDATA
* CLIENTDATAX
W_LANGUAGE = SY-LANGU.
SELECT SINGLE SPRAS
INTO W_SPRAS
FROM T006A
WHERE SPRAS = SY-LANGU
AND MSEHI = I_INTAB-MEINS.
IF SY-SUBRC = 4.
IF I_INTAB-MEINS <> ‘‘.
CALL FUNCTION ‘CONVERSION_EXIT_RUNIT_INPUT‘
EXPORTING
INPUT = I_INTAB-MEINS
LANGUAGE = W_LANGUAGE
IMPORTING
OUTPUT = W_CLIENTDATA-BASE_UOM.
ENDIF.
ELSE.
MOVE I_INTAB-MEINS TO W_CLIENTDATA-BASE_UOM.
ENDIF.
SELECT SINGLE SPRAS
INTO W_SPRAS
FROM T006A
WHERE SPRAS = SY-LANGU
AND MSEHI = I_INTAB-BSTME.
IF SY-SUBRC = 4.
IF I_INTAB-BSTME <> ‘‘.
CALL FUNCTION ‘CONVERSION_EXIT_RUNIT_INPUT‘
EXPORTING
INPUT = I_INTAB-BSTME
LANGUAGE = W_LANGUAGE
IMPORTING
OUTPUT = W_CLIENTDATA-PO_UNIT.
ENDIF.
ELSE.
MOVE I_INTAB-BSTME TO W_CLIENTDATA-PO_UNIT.
ENDIF.
MOVE I_INTAB-WRKST TO W_CLIENTDATA-BASIC_MATL. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-AESZN TO W_CLIENTDATA-DOC_CHG_NO. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-XCHPF TO W_CLIENTDATA-BATCH_MGMT. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-SERLV TO W_CLIENTDATA-SERIALIZATION_LEVEL. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-MTPOS TO W_CLIENTDATA-ITEM_CAT. "ADDED BY LIUXY2015-04-20
MOVE I_INTAB-KZKFG TO W_CLIENTDATA-CM_RELEVANCE_FLAG.
MOVE I_INTAB-MATKL TO W_CLIENTDATA-MATL_GROUP.
MOVE I_INTAB-BISMT TO W_CLIENTDATA-OLD_MAT_NO.
MOVE I_INTAB-SPART TO W_CLIENTDATA-DIVISION.
MOVE I_INTAB-LABOR TO W_CLIENTDATA-DSN_OFFICE.
* MOVE I_INTAB-BSTME TO W_CLIENTDATA-PO_UNIT.
MOVE I_INTAB-FORMT TO W_CLIENTDATA-DOC_FORMAT.
MOVE I_INTAB-FERTH TO W_CLIENTDATA-PROD_MEMO.
MOVE I_INTAB-RAUBE TO W_CLIENTDATA-STOR_CONDS.
MOVE I_INTAB-TRAGR TO W_CLIENTDATA-TRANS_GRP.
MOVE I_INTAB-NORMT TO W_CLIENTDATA-STD_DESCR.
MOVE I_INTAB-PRODH TO W_CLIENTDATA-PROD_HIER. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-KOSCH TO W_CLIENTDATA-PROD_ALLOC.
MOVE I_INTAB-BRGEW TO W_CLIENTDATA-PROD_MEMO.
MOVE I_INTAB-GEWEI TO W_CLIENTDATA-UNIT_OF_WT.
MOVE I_INTAB-NTGEW TO W_CLIENTDATA-NET_WEIGHT.
* MOVE I_INTAB-VOLUM TO W_CLIENTDATA-ALLWD_VOL.
* MOVE I_INTAB-VOLEH TO W_CLIENTDATA-PACK_VO_UN.
MOVE I_INTAB-GROES TO W_CLIENTDATA-SIZE_DIM.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-BASIC_MATL
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-BASIC_MATL.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-DOC_CHG_NO
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-DOC_CHG_NO.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-BATCH_MGMT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-BATCH_MGMT.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-SERIALIZATION_LEVEL
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-SERIALIZATION_LEVEL.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2015-04-20
USING W_CLIENTDATA-ITEM_CAT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-ITEM_CAT.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-CM_RELEVANCE_FLAG
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-CM_RELEVANCE_FLAG.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-MATL_GROUP
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-MATL_GROUP.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-OLD_MAT_NO
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-OLD_MAT_NO.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-BASE_UOM
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-BASE_UOM.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-DIVISION
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-DIVISION.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-DSN_OFFICE
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-DSN_OFFICE.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-PO_UNIT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-PO_UNIT.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-DOC_FORMAT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-DOC_FORMAT.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-PROD_MEMO
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-PROD_MEMO.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-STOR_CONDS
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-STOR_CONDS.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-TRANS_GRP
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-TRANS_GRP.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-STD_DESCR
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-STD_DESCR.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_CLIENTDATA-PROD_HIER
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-PROD_HIER.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-PROD_ALLOC
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-PROD_ALLOC.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-UNIT_OF_WT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-UNIT_OF_WT.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-NET_WEIGHT
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-NET_WEIGHT.
* PERFORM FRM_SPACE_CHECK
* USING W_CLIENTDATA-ALLWD_VOL
* I_INTAB-PROC_CLS
* CHANGING W_CLIENTDATAX-ALLWD_VOL.
* PERFORM FRM_SPACE_CHECK
* USING W_CLIENTDATA-PACK_VO_UN
* I_INTAB-PROC_CLS
* CHANGING W_CLIENTDATAX-PACK_VO_UN.
PERFORM FRM_SPACE_CHECK
USING W_CLIENTDATA-SIZE_DIM
I_INTAB-PROC_CLS
CHANGING W_CLIENTDATAX-SIZE_DIM.
* PLANTDATA
* PLANTDATAX
MOVE I_INTAB-WERKS TO W_PLANTDATA-PLANT.
MOVE I_INTAB-EKGRP TO W_PLANTDATA-PUR_GROUP.
MOVE I_INTAB-DISMM TO W_PLANTDATA-MRP_TYPE.
MOVE I_INTAB-DISPO TO W_PLANTDATA-MRP_CTRLER.
MOVE I_INTAB-PLIFZ TO W_PLANTDATA-PLND_DELRY.
MOVE I_INTAB-WEBAZ TO W_PLANTDATA-GR_PR_TIME.
MOVE I_INTAB-PERKZ TO W_PLANTDATA-PERIOD_IND.
MOVE I_INTAB-SCHGT TO W_PLANTDATA-BULK_MAT. "added by liuxy2014-12-29
MOVE I_INTAB-VRMOD TO W_PLANTDATA-CONSUMMODE. "added by liuxy2014-12-29
MOVE I_INTAB-VINT1 TO W_PLANTDATA-BWD_CONS. "added by liuxy2014-12-29
MOVE I_INTAB-VINT2 TO W_PLANTDATA-FWD_CONS. "added by liuxy2014-12-29
MOVE I_INTAB-VINT2 TO W_PLANTDATA-FWD_CONS. "added by liuxy2014-12-29
MOVE I_INTAB-ATPKZ TO W_PLANTDATA-REPLACE_PT. "added by liuxy2014-12-29
MOVE I_INTAB-VBAMG TO W_PLANTDATA-BASE_QTY_PLAN. "added by liuxy2014-12-29
MOVE I_INTAB-VBEAZ TO W_PLANTDATA-SHIP_PROC_TIME. "added by liuxy2014-12-29
MOVE I_INTAB-VRVEZ TO W_PLANTDATA-SETUP_TIME. "added by liuxy2014-12-29
MOVE I_INTAB-SERNP TO W_PLANTDATA-SERNO_PROF. "added by liuxy2014-12-29
MOVE I_INTAB-DISLS TO W_PLANTDATA-LOTSIZEKEY.
MOVE I_INTAB-BESKZ TO W_PLANTDATA-PROC_TYPE.
MOVE I_INTAB-SOBSL TO W_PLANTDATA-SPPROCTYPE.
MOVE I_INTAB-EISBE TO W_PLANTDATA-SAFETY_STK.
MOVE I_INTAB-BSTMI TO W_PLANTDATA-MINLOTSIZE.
MOVE I_INTAB-BSTMA TO W_PLANTDATA-MAXLOTSIZE.
MOVE I_INTAB-BSTFE TO W_PLANTDATA-FIXED_LOT.
MOVE I_INTAB-BSTRF TO W_PLANTDATA-ROUND_VAL.
MOVE I_INTAB-SBDKZ TO W_PLANTDATA-DEP_REQ_ID.
MOVE I_INTAB-KAUSF TO W_PLANTDATA-COMP_SCRAP. "added by liuxy2014-12-29
MOVE I_INTAB-ALTSL TO W_PLANTDATA-ALT_BOM_ID.
MOVE I_INTAB-MISKZ TO W_PLANTDATA-MIXED_MRP.
MOVE I_INTAB-FHORI TO W_PLANTDATA-SM_KEY.
MOVE I_INTAB-RGEKM TO W_PLANTDATA-BACKFLUSH.
MOVE I_INTAB-FEVOR TO W_PLANTDATA-PRODUCTION_SCHEDULER.
MOVE I_INTAB-DZEIT TO W_PLANTDATA-INHSEPRODT.
MOVE I_INTAB-WZEIT TO W_PLANTDATA-REPLENTIME.
MOVE I_INTAB-INSMK TO W_PLANTDATA-IND_POST_TO_INSP_STOCK.
MOVE I_INTAB-LADGR TO W_PLANTDATA-LOADINGGRP.
MOVE I_INTAB-USEQU TO W_PLANTDATA-QUOTAUSAGE.
MOVE I_INTAB-MTVFP TO W_PLANTDATA-AVAILCHECK.
MOVE I_INTAB-PRCTR TO W_PLANTDATA-PROFIT_CTR.
MOVE I_INTAB-LOSGR TO W_PLANTDATA-LOT_SIZE.
MOVE I_INTAB-LGPRO TO W_PLANTDATA-ISS_ST_LOC.
MOVE I_INTAB-DISGR TO W_PLANTDATA-MRP_GROUP.
MOVE I_INTAB-AWSLS TO W_PLANTDATA-VARIANCE_KEY.
MOVE I_INTAB-STRGR TO W_PLANTDATA-PLAN_STRGP.
MOVE I_INTAB-LGFSB TO W_PLANTDATA-SLOC_EXPRC.
MOVE I_INTAB-EPRIO TO W_PLANTDATA-DETERM_GRP.
MOVE I_INTAB-MMSTA TO W_PLANTDATA-PUR_STATUS.
MOVE I_INTAB-SFCPF TO W_PLANTDATA-PRODPROF.
MOVE I_INTAB-NCOST TO W_PLANTDATA-NO_COSTING.
MOVE I_INTAB-KAUTB TO W_PLANTDATA-AUTO_P_ORD.
MOVE I_INTAB-KORDB TO W_PLANTDATA-SOURCELIST. "added by liuxy2014-12-29
MOVE I_INTAB-FXHOR TO W_PLANTDATA-PL_TI_FNCE.
MOVE I_INTAB-SHZET TO W_PLANTDATA-SAFETYTIME.
MOVE I_INTAB-AUSSS TO W_PLANTDATA-ASSY_SCRAP.
MOVE I_INTAB-KZKRI TO W_PLANTDATA-CRIT_PART.
MOVE I_INTAB-SHFLG TO W_PLANTDATA-SAFTY_T_ID.
MOVE I_INTAB-XMCNG TO W_PLANTDATA-NEG_STOCKS.
MOVE I_INTAB-MFRGR TO W_PLANTDATA-MATFRGTGRP.
MOVE I_INTAB-MTVER TO W_PLANTDATA-EXPIMPGRP.
MOVE I_INTAB-STAWN TO W_PLANTDATA-COMM_CODE.
MOVE I_INTAB-HERKL TO W_PLANTDATA-COUNTRYORI.
MOVE I_INTAB-HERKR TO W_PLANTDATA-REGIONORIG.
MOVE I_INTAB-WERKS TO W_PLANTDATAX-PLANT.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PUR_GROUP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PUR_GROUP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MRP_TYPE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MRP_TYPE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MRP_CTRLER
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MRP_CTRLER.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PLND_DELRY
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PLND_DELRY.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-GR_PR_TIME
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-GR_PR_TIME.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PERIOD_IND
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PERIOD_IND.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-BULK_MAT
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-BULK_MAT.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-CONSUMMODE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-CONSUMMODE.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-BWD_CONS
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-BWD_CONS.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-FWD_CONS
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-FWD_CONS.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-REPLACE_PT
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-REPLACE_PT.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-BASE_QTY_PLAN
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-BASE_QTY_PLAN.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-SHIP_PROC_TIME
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SHIP_PROC_TIME.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-SETUP_TIME
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SETUP_TIME.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-SERNO_PROF
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SERNO_PROF.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-LOTSIZEKEY
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-LOTSIZEKEY.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PROC_TYPE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PROC_TYPE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SPPROCTYPE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SPPROCTYPE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SAFETY_STK
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SAFETY_STK.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MINLOTSIZE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MINLOTSIZE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MAXLOTSIZE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MAXLOTSIZE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-FIXED_LOT
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-FIXED_LOT.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-ROUND_VAL
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-ROUND_VAL.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-DEP_REQ_ID
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-DEP_REQ_ID.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-COMP_SCRAP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-COMP_SCRAP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-ALT_BOM_ID
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-ALT_BOM_ID.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MIXED_MRP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MIXED_MRP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SM_KEY
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SM_KEY.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-BACKFLUSH
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-BACKFLUSH.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PRODUCTION_SCHEDULER
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PRODUCTION_SCHEDULER.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-INHSEPRODT
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-INHSEPRODT.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-REPLENTIME
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-REPLENTIME.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-IND_POST_TO_INSP_STOCK
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-IND_POST_TO_INSP_STOCK.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-LOADINGGRP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-LOADINGGRP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-QUOTAUSAGE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-QUOTAUSAGE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-AVAILCHECK
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-AVAILCHECK.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PROFIT_CTR
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PROFIT_CTR.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-LOT_SIZE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-LOT_SIZE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-ISS_ST_LOC
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-ISS_ST_LOC.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MRP_GROUP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MRP_GROUP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-VARIANCE_KEY
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-VARIANCE_KEY.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PLAN_STRGP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PLAN_STRGP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SLOC_EXPRC
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SLOC_EXPRC.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-DETERM_GRP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-DETERM_GRP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PUR_STATUS
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PUR_STATUS.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PRODPROF
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PRODPROF.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-NO_COSTING
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-NO_COSTING.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-AUTO_P_ORD
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-AUTO_P_ORD.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_PLANTDATA-SOURCELIST
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SOURCELIST.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-PL_TI_FNCE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-PL_TI_FNCE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SAFETYTIME
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SAFETYTIME.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-ASSY_SCRAP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-ASSY_SCRAP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-CRIT_PART
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-CRIT_PART.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-SAFTY_T_ID
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-SAFTY_T_ID.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-NEG_STOCKS
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-NEG_STOCKS.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-MATFRGTGRP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-MATFRGTGRP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-EXPIMPGRP
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-EXPIMPGRP.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-COMM_CODE
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-COMM_CODE.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-COUNTRYORI
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-COUNTRYORI.
PERFORM FRM_SPACE_CHECK
USING W_PLANTDATA-REGIONORIG
I_INTAB-PROC_CLS
CHANGING W_PLANTDATAX-REGIONORIG.
* VALUATIONDATA
* VALUATIONDATAX
MOVE I_INTAB-VPRSV TO W_VALUATIONDATA-PRICE_CTRL.
MOVE I_INTAB-PEINH TO W_VALUATIONDATA-PRICE_UNIT. "ADDED BY LIUXY2014-12-29
MOVE I_INTAB-STPRS TO W_VALUATIONDATA-STD_PRICE.
* MOVE I_INTAB-BWPEI TO W_VALUATIONDATA-PRICE_UNIT.
MOVE I_INTAB-BKLAS TO W_VALUATIONDATA-VAL_CLASS.
MOVE I_INTAB-VERPR TO W_VALUATIONDATA-MOVING_PR. "added by liuxy2014-12-29
MOVE I_INTAB-HRKFT TO W_VALUATIONDATA-ORIG_GROUP.
MOVE I_INTAB-KOSGR TO W_VALUATIONDATA-OVERHEAD_GRP.
MOVE I_INTAB-HKMAT TO W_VALUATIONDATA-ORIG_MAT.
MOVE I_INTAB-EKALR TO W_VALUATIONDATA-QTY_STRUCT.
MOVE I_INTAB-MLAST TO W_VALUATIONDATA-ML_SETTLE.
SELECT SINGLE BWKEY
INTO W_BUKRS
FROM T001W
WHERE WERKS = I_INTAB-WERKS.
MOVE W_BUKRS TO W_VALUATIONDATA-VAL_AREA.
MOVE W_BUKRS TO W_VALUATIONDATAX-VAL_AREA.
CLEAR W_BUKRS.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-ML_SETTLE
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-ML_SETTLE.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-PRICE_CTRL
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-PRICE_CTRL.
PERFORM FRM_SPACE_CHECK "ADDED BY LIUXY2014-12-29
USING W_VALUATIONDATA-PRICE_UNIT
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-PRICE_UNIT.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-STD_PRICE
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-STD_PRICE.
* PERFORM FRM_SPACE_CHECK
* USING W_VALUATIONDATA-PRICE_UNIT
* I_INTAB-PROC_CLS
* CHANGING W_VALUATIONDATAX-PRICE_UNIT.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-VAL_CLASS
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-VAL_CLASS.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_VALUATIONDATA-MOVING_PR
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-MOVING_PR.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-ORIG_GROUP
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-ORIG_GROUP.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-OVERHEAD_GRP
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-OVERHEAD_GRP.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-ORIG_MAT
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-ORIG_MAT.
PERFORM FRM_SPACE_CHECK
USING W_VALUATIONDATA-QTY_STRUCT
I_INTAB-PROC_CLS
CHANGING W_VALUATIONDATAX-QTY_STRUCT.
* SALESDATA
* SALESDATAX
MOVE I_INTAB-VERSG TO W_SALESDATA-MATL_STATS.
MOVE I_INTAB-KONDM TO W_SALESDATA-MAT_PR_GRP. "added by liuxy2014-12-29
MOVE I_INTAB-KTGRM TO W_SALESDATA-ACCT_ASSGT. "added by liuxy2014-12-29
* W_SALESDATA-ITEM_CAT = ‘NORM‘.
MOVE I_INTAB-MTPOS TO W_SALESDATA-ITEM_CAT.
MOVE I_INTAB-DWERK TO W_SALESDATA-DELYG_PLNT.
MOVE I_INTAB-VKORG TO W_SALESDATA-SALES_ORG.
MOVE I_INTAB-VTWEG TO W_SALESDATA-DISTR_CHAN.
PERFORM FRM_SPACE_CHECK
USING W_SALESDATA-MATL_STATS
I_INTAB-PROC_CLS
CHANGING W_SALESDATAX-MATL_STATS.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_SALESDATA-MAT_PR_GRP
I_INTAB-PROC_CLS
CHANGING W_SALESDATAX-MAT_PR_GRP.
PERFORM FRM_SPACE_CHECK "added by liuxy2014-12-29
USING W_SALESDATA-ACCT_ASSGT
I_INTAB-PROC_CLS
CHANGING W_SALESDATAX-ACCT_ASSGT.
PERFORM FRM_SPACE_CHECK
USING W_SALESDATA-ITEM_CAT
I_INTAB-PROC_CLS
CHANGING W_SALESDATAX-ITEM_CAT.
PERFORM FRM_SPACE_CHECK
USING W_SALESDATA-DELYG_PLNT
I_INTAB-PROC_CLS
CHANGING W_SALESDATAX-DELYG_PLNT.
W_SALESDATAX-SALES_ORG = W_SALESDATA-SALES_ORG.
W_SALESDATAX-DISTR_CHAN = W_SALESDATA-DISTR_CHAN.
* STORAGELOCATIONDATA
* STORAGELOCATIONDATAX
IF I_INTAB-LGORT <> ‘‘.
MOVE I_INTAB-WERKS TO W_STORAGELOCATIONDATA-PLANT.
MOVE I_INTAB-WERKS TO W_STORAGELOCATIONDATAX-PLANT.
MOVE I_INTAB-LGORT TO W_STORAGELOCATIONDATA-STGE_LOC.
MOVE I_INTAB-LGORT TO W_STORAGELOCATIONDATAX-STGE_LOC.
ENDIF.
* *FORECASTPARAMETERS
* *FORECASTPARAMETERSX
MOVE I_INTAB-WERKS TO W_FORECASTPARAMETERS-PLANT.
MOVE I_INTAB-WERKS TO W_FORECASTPARAMETERSX-PLANT.
* *
* *PLANNINGDATA
* *PLANNINGDATAX
MOVE I_INTAB-WERKS TO W_PLANNINGDATA-PLANT.
MOVE I_INTAB-WERKS TO W_PLANNINGDATAX-PLANT.
MOVE SY-LANGU TO W_MATERIALDESCRIPTION-LANGU.
MOVE I_INTAB-MAKTX TO W_MATERIALDESCRIPTION-MATL_DESC.
APPEND W_MATERIALDESCRIPTION.
* MATERIALLONGTEXT
* MOVE ‘MATERIAL‘ TO W_MATERIALLONGTEXT-APPLOBJECT.
* MOVE ‘GRUN‘ TO W_MATERIALLONGTEXT-TEXT_ID.
* MOVE I_HEAD-MATERIAL TO W_MATERIALLONGTEXT-TEXT_NAME.
* MOVE SY-LANGU TO W_MATERIALLONGTEXT-LANGU.
* MOVE I_INTAB-GRUNDD TO W_MATERIALLONGTEXT-TEXT_LINE.
* APPEND W_MATERIALLONGTEXT.
**** IF W_HEADDATA-SALES_VIEW = ‘X‘.
****** W_MLTX+0(18) = I_HEAD-MATERIAL.
****** W_MLTX+18(4) = I_INTAB-VKORG.
****** W_MLTX+22(2) = I_INTAB-VTWEG.
****** MOVE ‘MVKE‘ TO W_MATERIALLONGTEXT-APPLOBJECT.
****** MOVE ‘0001‘ TO W_MATERIALLONGTEXT-TEXT_ID.
****** MOVE W_MLTX TO W_MATERIALLONGTEXT-TEXT_NAME.
****** MOVE SY-LANGU TO W_MATERIALLONGTEXT-LANGU.
****** MOVE I_INTAB-VERTRIEBS TO W_MATERIALLONGTEXT-TEXT_LINE.
****** APPEND W_MATERIALLONGTEXT.
******
SELECT SINGLE BUKRS
INTO W_BUKRS
FROM T001K
WHERE BWKEY = I_INTAB-WERKS.
SELECT SINGLE LAND1
INTO W_LAND1
FROM T001
WHERE BUKRS = W_BUKRS.
IF W_LAND1 <> ‘US‘.
W_MWST = ‘MWST‘.
ELSE.
W_MWST = ‘TAXJ‘.
ENDIF.
* TAXCLASSIFICATIONS
MOVE W_LAND1 TO W_TAXCLASSIFICATIONS-DEPCOUNTRY.
MOVE W_MWST TO W_TAXCLASSIFICATIONS-TAX_TYPE_1.
MOVE I_INTAB-TAXKM TO W_TAXCLASSIFICATIONS-TAXCLASS_1.
APPEND W_TAXCLASSIFICATIONS.
***** ENDIF.
CLEAR W_UNITSOFMEASURE.
CLEAR W_UNITSOFMEASUREX.
IF I_INTAB-BSTME <> ‘‘ .
MOVE W_CLIENTDATA-PO_UNIT TO W_UNITSOFMEASURE-ALT_UNIT.
MOVE W_CLIENTDATA-PO_UNIT TO W_UNITSOFMEASUREX-ALT_UNIT.
MOVE W_CLIENTDATA-PO_UNIT TO W_UNITSOFMEASURE-ALT_UNIT_ISO.
MOVE W_CLIENTDATA-PO_UNIT TO W_UNITSOFMEASUREX-ALT_UNIT_ISO.
MOVE I_INTAB-NUMER TO W_UNITSOFMEASURE-NUMERATOR.
MOVE I_INTAB-DENOM TO W_UNITSOFMEASURE-DENOMINATR.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-NUMERATOR
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-NUMERATOR.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-DENOMINATR
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-DENOMINATR.
ELSEIF I_INTAB-BRGEW <> ‘‘
OR I_INTAB-GEWEI <> ‘‘
OR I_INTAB-VOLUM <> ‘‘
OR I_INTAB-VOLEH <> ‘‘.
MOVE W_CLIENTDATA-BASE_UOM TO W_UNITSOFMEASURE-ALT_UNIT.
MOVE W_CLIENTDATA-BASE_UOM TO W_UNITSOFMEASUREX-ALT_UNIT.
MOVE W_CLIENTDATA-BASE_UOM TO W_UNITSOFMEASURE-ALT_UNIT_ISO.
MOVE W_CLIENTDATA-BASE_UOM TO W_UNITSOFMEASUREX-ALT_UNIT_ISO.
ENDIF.
MOVE I_INTAB-BRGEW TO W_UNITSOFMEASURE-GROSS_WT.
MOVE I_INTAB-GEWEI TO W_UNITSOFMEASURE-UNIT_OF_WT.
MOVE I_INTAB-VOLUM TO W_UNITSOFMEASURE-VOLUME.
MOVE I_INTAB-VOLEH TO W_UNITSOFMEASURE-VOLUMEUNIT.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-GROSS_WT
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-GROSS_WT.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-UNIT_OF_WT
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-UNIT_OF_WT.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-VOLUME
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-VOLUME.
PERFORM FRM_SPACE_CHECK
USING W_UNITSOFMEASURE-VOLUMEUNIT
I_INTAB-PROC_CLS
CHANGING W_UNITSOFMEASUREX-VOLUMEUNIT.
IF I_INTAB-NUMER <> ‘‘
OR I_INTAB-DENOM <> ‘‘
OR I_INTAB-BRGEW <> ‘‘
OR I_INTAB-GEWEI <> ‘‘
OR I_INTAB-VOLUM <> ‘‘
OR I_INTAB-VOLEH <> ‘‘.
APPEND W_UNITSOFMEASURE.
APPEND W_UNITSOFMEASUREX.
ENDIF.
* **********************************************
ZZBAPI_TE_MARA-MATERIAL = I_HEAD-MATERIAL.
* ZZBAPI_TE_MARA-EXTWG = I_INTAB-EXTWG.
ZZBAPI_TE_MARAX-MATERIAL = I_HEAD-MATERIAL.
* PERFORM FRM_SPACE_CHECK
* USING
* * ZZBAPI_TE_MARA-EXTWG
* I_INTAB-PROC_CLS
* CHANGING ZZBAPI_TE_MARAX-EXTWG.
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.
* *******************************************************
CALL FUNCTION ‘BAPI_MATERIAL_SAVEDATA‘
EXPORTING
HEADDATA = W_HEADDATA
CLIENTDATA = W_CLIENTDATA
CLIENTDATAX = W_CLIENTDATAX
PLANTDATA = W_PLANTDATA
PLANTDATAX = W_PLANTDATAX
FORECASTPARAMETERS = W_FORECASTPARAMETERS
FORECASTPARAMETERSX = W_FORECASTPARAMETERSX
PLANNINGDATA = W_PLANNINGDATA
PLANNINGDATAX = W_PLANNINGDATAX
STORAGELOCATIONDATA = W_STORAGELOCATIONDATA
STORAGELOCATIONDATAX = W_STORAGELOCATIONDATAX
VALUATIONDATA = W_VALUATIONDATA
VALUATIONDATAX = W_VALUATIONDATAX
SALESDATA = W_SALESDATA
SALESDATAX = W_SALESDATAX
IMPORTING
RETURN = W_RETURN
TABLES
MATERIALDESCRIPTION = W_MATERIALDESCRIPTION
UNITSOFMEASURE = W_UNITSOFMEASURE
UNITSOFMEASUREX = W_UNITSOFMEASUREX
TAXCLASSIFICATIONS = W_TAXCLASSIFICATIONS
MATERIALLONGTEXT = W_MATERIALLONGTEXT
EXTENSIONIN = W_EXTENSIONIN
EXTENSIONINX = W_EXTENSIONINX
RETURNMESSAGES = W_RETURNMESSAGES.
IF W_RETURN-TYPE <> ‘S‘ AND W_RETURN-TYPE <> ‘W‘.
* MESSAGE ID W_RETURN-ID TYPE W_RETURN-TYPE NUMBER W_RETURN-NUMBER
* WITH W_RETURN-MESSAGE_V1 W_RETURN-MESSAGE_V2
* W_RETURN-MESSAGE_V3 W_RETURN-MESSAGE_V4 INTO E_ERROR.
O_INTAB-FLAG1 = ‘E‘.
CONCATENATE ‘MM01创建物料基本视图失败:‘ W_RETURN-MESSAGE W_RETURN-MESSAGE_V1 W_RETURN-MESSAGE_V2 W_RETURN-MESSAGE_V3 W_RETURN-MESSAGE_V4 INTO O_INTAB-MESSAGE1.
CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘.
ELSE.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘
EXPORTING
WAIT = ‘X‘.
O_INTAB-FLAG1 = ‘S‘.
O_INTAB-MESSAGE1 = ‘物料创建成功!‘.
ENDIF.
APPEND O_INTAB.
CLEAR O_INTAB.
ENDLOOP.
ENDFUNCTION.
*---------------------------------------------------------------------*
* FORM FRM_SPACE_CHECK *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_INPARAM *
* --> P_OUTPARAM *
*---------------------------------------------------------------------*
FORM FRM_SPACE_CHECK USING P_INPARAM
P_CLS
CHANGING P_OUTPARAM.
IF P_CLS = ‘5‘.
IF NOT P_INPARAM IS INITIAL.
MOVE ‘X‘ TO P_OUTPARAM.
ENDIF.
ELSE.
MOVE ‘X‘ TO P_OUTPARAM.
ENDIF.
ENDFORM.