1. 程式人生 > >利用BAPI建立物料主資料 BAPI_MATERIAL_SAVEDATA

利用BAPI建立物料主資料 BAPI_MATERIAL_SAVEDATA

在LC專案中,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(4TYPE 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.