Creating MDM repository for Material Master Data

Hello MDM Gurus,
I am new to SAP MDM. I want to create MDM repository for Material Master. What I unddertand is, I can create repository using Bussiness Content shiped with MDM software. I will copy *.a2a file to archive folder of MDM server and unarchive repository. I have following question for you.
1. HOw do I use export maps and import maps which I found in Busines contenst\Material folder?
2. How do I use MDM Lookup Tables which is xml document in Busines contenst\Material folder?
3. Why is the use of MDMGX_55520_Material.txt file which I found in Busines contenst\Material folder?
4. What is the use of *.xsd files and how can I use them?
Thanks,
Bhupesh

Hi Bhupesh
1. HOw do I use export maps and import maps which I found in Busines contenst\Material folder?
save all the map files on your loacl machine. open import manager and select file-> Import, browse to the .map file and save the map with a meaningful name. now next time connect to the source file you want to import and OPEN the map saved.
2. How do I use MDM Lookup Tables which is xml document in Busines contenst\Material folder?
Businees content contains the standard  ECC refernce tables like countries, regions etc which can be refreshed from ECC. for this you have to configure MDMGX, defining all the ports in MDM and in ECC the tables from which data has to be refreshed. refer to below threads for details.
Extract Data usnig MDMGX
How to Export Materials from ERP to MDM 7.1 via MDMGX?
3. Why is the use of MDMGX_55520_Material.txt file which I found in Busines contenst\Material folder?
This helps us in configuring the table extraction from ECC, refer to thread-> Extract Data usnig MDMGX
4. What is the use of *.xsd files and how can I use them?
Schema files are used for syndicating the records from MDM to source system. Say we want to syndicate material master from MDM to ECC and in ECC they will be posted via MATMAS05 IDoc. these schemas are the structure of IDoc which will contain the values which will be syndicated from MDM.
Let me know if you know some more details.
regards
Ravi

Similar Messages

  • What is procedure for creating new vendor and material master data in ABAP

    What is procedure for creating new vendor and material master data in ABAP .

    see below code which is used for creation of vendor master as well as extension...
    *& Report  ZFC_VENDOR_CREATE                                           *
    REPORT  ZFC_VENDOR_CREATE  LINE-SIZE 100
                               NO STANDARD PAGE HEADING
                               MESSAGE-ID ZZ.
                         TABLES
    TABLES : SSCRFIELDS.   " Fields on selection screens
                         CONSTANTS
    DATA : C_SPLIT TYPE C VALUE '#'.  " Used for Has Separator in GUI_UPLAOD
                         TYPES
    Int'table to hold Vendor Master Data
    TYPES : BEGIN OF TY_VENDOR_MASTER,
              FLAG  TYPE C,               " Update Flag
              LIFNR TYPE LIFNR,           " Vendor Number
              BUKRS TYPE BUKRS,           " Company Code
              KTOKK TYPE KTOKK,           " Account Group
              ANRED TYPE ANRED,           " Title
              NAME1 TYPE NAME1_GP,        " Name1
              NAME2 TYPE NAME2_GP,        " Name2
              SORTL TYPE SORTL,           " Search Term 1
              SORT2 TYPE AD_SORT2UL,      " Search Term 2
              STRAS TYPE STRAS_GP,        " Street
              PSTLZ TYPE PSTLZ,           " Postal Code
              ORT01 TYPE ORT01_GP,        " City
              REGIO TYPE REGIO,           " Region
              LAND1 TYPE LAND1_GP,        " Country
              SPRAS TYPE SPRAS,           " Language
              VBUND TYPE RASSC,           " Trading Partner
              BANKS TYPE BANKS,           " Country
              BANKL TYPE BANKK,           " Bank Key
              BANKN TYPE BANKN,           " Bank Account
              BKONT TYPE BKONT,           " Bank Control Key
              BANKA TYPE BANKA,           " Name of Bank
              AKONT TYPE AKONT,           " Reconciliation Account
              FDGRV TYPE FDGRV,           " Cash Management Group
              ZTERM TYPE DZTERM,          " Payment Terms
              REPRF TYPE REPRF,           " Check Double Invoice
              ZWELS TYPE DZWELS,          " Payment Methods
              XPORE TYPE XPORE,           " Pay all items separately
            END   OF TY_VENDOR_MASTER,
    Int'table to hold Vendor Extend Data
            BEGIN OF TY_VENDOR_EXTEND,
              FLAG  TYPE C,               " Update Flag
              LIFNR     TYPE LIFNR,           " Vendor Number
              BUKRS     TYPE BUKRS,           " Company Code
              KTOKK     TYPE KTOKK,           " Account Group
              REF_LIFNR TYPE LIFNR,           " Reference Vendor Number
              REF_BUKRS TYPE BUKRS,           " Reference Company Code
              AKONT     TYPE AKONT,           " Reconciliation Account
              FDGRV     TYPE FDGRV,           " Cash Management Group
              ZTERM     TYPE DZTERM,          " Payment Terms
              REPRF     TYPE REPRF,           " Check Double Invoice
              ZWELS     TYPE DZWELS,          " Payment Methods
              XPORE TYPE XPORE,           " Pay all items separately
            END   OF TY_VENDOR_EXTEND,
    Int'table to hold Error Records Data
            BEGIN OF TY_ERROR,
              MSG(200) TYPE C,                " To hold Message
              LIFNR    TYPE LIFNR,            " Vendor Number
              BUKRS    TYPE BUKRS,            " Company Code
            END   OF TY_ERROR.
                         DATA (Simple Fields)
    DATA : W_COUNT TYPE I,               " Variable to hold count of Records
           W_SUCC_REC TYPE I,            " No. of Success Records
           W_SUCC_REC1 TYPE I,           " No. of Updated Records
           W_ERR_REC TYPE I,             " No. of Error Records
           w_noupdate_rec type i.        " No. of Records not Changed
                         INTERNAL TABLES
    Int'table to hold uploaded data from File
    DATA : IT_VENDOR_MASTER    TYPE STANDARD TABLE OF TY_VENDOR_MASTER,
           WA_IT_VENDOR_MASTER TYPE TY_VENDOR_MASTER,
           IT_VENDOR_EXTEND    TYPE STANDARD TABLE OF TY_VENDOR_EXTEND,
           WA_IT_VENDOR_EXTEND TYPE TY_VENDOR_EXTEND,
           WA_IT_BDCDATA       TYPE BDCDATA,
           IT_BDCDATA          TYPE STANDARD TABLE OF BDCDATA,
           WA_IT_MESSTAB       TYPE BDCMSGCOLL,
           IT_MESSTAB          TYPE STANDARD TABLE OF BDCMSGCOLL,
           IT_ERROR            TYPE STANDARD TABLE OF TY_ERROR,
           WA_IT_ERROR         TYPE TY_ERROR,
           it_error_fk01       type standard table of ty_error,
           wa_it_error_fk01    type ty_error,
           it_error_fk02       type standard table of ty_error,
           wa_it_error_fk02    type ty_error,
           it_succ_rec1        type standard table of ty_error,
           wa_it_succ_rec1     type ty_error,
           it_noupdate         type standard table of ty_error,
           wa_it_noupdate      type ty_error.
                         FLAGS
    DATA : FL_FLAG1 TYPE C,          " Flag to check error upload file
           FL_FLAG2 TYPE C,          " Flag to hold value
           FL_FLAG3 TYPE C,          " Flag to hold value
           FL_FLAG4 TYPE C.          " Flag to hold value
                         SELECTION-SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-001,
                POSITION POS_LOW.
    PARAMETERS :       P_FILE(128) DEFAULT 'C:\UPLOAD.TXT' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-002,
                POSITION POS_LOW.
    PARAMETERS :       P_VENMAS RADIOBUTTON GROUP R1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-003,
                POSITION POS_LOW.
    PARAMETERS :       P_VENEXT RADIOBUTTON GROUP R1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN SKIP 2.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-004,
                POSITION POS_LOW.
    PARAMETERS :       P_MODE(1) DEFAULT 'N'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-005,
                POSITION POS_LOW.
    PARAMETERS :       P_GROUP(12) DEFAULT 'ZFC_VENDOR_C' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE,
                COMMENT 1(30) TEXT-016,
                POSITION POS_LOW.
    PARAMETERS :       P_GROUP1(12) DEFAULT 'ZFC_VENDOR_U' OBLIGATORY.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
                         AT SELECTION-SCREEN ON
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    Form to get file path for upload of data
      PERFORM GET_FILE_PATH.
    AT SELECTION-SCREEN ON BLOCK B1.
    Form to Validate data specified on Selection Screen
      CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.
      PERFORM VALIDATE_DATA.
                         START - OF - SELECTION
    START-OF-SELECTION.
      IF P_VENMAS = 'X'.
    Form to upload data from Presentation Server for Vendor Master
        PERFORM UPLOAD_DATA TABLES IT_VENDOR_MASTER.
        IF FL_FLAG1 NE 'X'.
          SORT IT_VENDOR_MASTER BY LIFNR BUKRS KTOKK.
          DELETE IT_VENDOR_MASTER WHERE LIFNR = ' '
                                  AND   BUKRS = ' '
                                  AND   KTOKK = ' '.
    Form to process data for Vendor Master
          PERFORM INSERT_VENDOR_MASTER_DATA.
        ENDIF.
      ELSEIF P_VENEXT = 'X'.
    Form to upload data from Presentation Server for Vendor Extend
        PERFORM UPLOAD_DATA TABLES IT_VENDOR_EXTEND.
        IF FL_FLAG1 NE 'X'.
          SORT IT_VENDOR_EXTEND BY LIFNR BUKRS KTOKK.
          DELETE IT_VENDOR_EXTEND WHERE LIFNR = ' '
                                  AND   BUKRS = ' '
                                  AND   KTOKK = ' '.
    Form to process data for Vendor Master
          PERFORM CHK_AND_INS_VENDOR_EXTEND_DATA.
        ENDIF.
      ENDIF.
                         END - OF - SELECTION
    END-OF-SELECTION.
      IF FL_FLAG1 NE 'X'.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O01.           " Total Number of records read :
        FORMAT COLOR OFF.
        WRITE:40 W_COUNT.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O02.           " Total Number of Success records :
        FORMAT COLOR OFF.
        WRITE:40 W_SUCC_REC.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O07.           " Total Number of Updated records :
        FORMAT COLOR OFF.
        WRITE:40 W_SUCC_REC1.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O08.           " Total Number of Unchanged records :
        FORMAT COLOR OFF.
        WRITE:40 W_noupdate_REC.
        FORMAT COLOR 7.
        WRITE:/2 TEXT-O03.           " Total Number of Error records :
        FORMAT COLOR OFF.
        WRITE:40 W_ERR_REC.
        if not it_succ_rec1 is initial.
          skip 1.
          perform display_changed_report.
        endif.
        if not it_noupdate is initial.
          skip 1.
          perform display_nochange_report.
        endif.
        IF NOT IT_ERROR IS INITIAL.
          SKIP 3.
    Form to display error data
          PERFORM DISPLAY_ERROR_REPORT.
        ENDIF.
        IF FL_FLAG2 = 'X'.
          SKIP 2.
          FORMAT COLOR 4.
          WRITE:/2 TEXT-O04.        " BDC Session Name for Creation (FK01) :
          FORMAT COLOR OFF.
          WRITE:40 P_GROUP.
          perform display_error_report_fk01.
        ENDIF.
        IF FL_FLAG3 = 'X'.
          SKIP 2.
          FORMAT COLOR 4.
          WRITE:/2 TEXT-O09.        " BDC Session Name for Updation (FK02) :
          FORMAT COLOR OFF.
          WRITE:40 P_GROUP1.
          perform display_error_report_fk02.
        ENDIF.
      ENDIF.
    *&      Form  GET_FILE_PATH
    This form is used to get the specified path for uploading of data from
    flat file with the help of F4 function key
    FORM GET_FILE_PATH .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = ' '
        IMPORTING
          FILE_NAME     = P_FILE.
    ENDFORM.                    " GET_FILE_PATH
    *&      Form  VALIDATE_DATA
    This form is used to validate the data given by user on the Selection
    Screen and the appropriate message is been displayed when an wrong
    entry is inputted
    FORM VALIDATE_DATA .
      IF SY-BATCH EQ 'X'.
        CLEAR SSCRFIELDS-UCOMM.
        MESSAGE E001(ZZ) WITH TEXT-011.
        " Excel file not to be used in Batch Mode
      ENDIF.
      IF P_MODE NE 'A' AND P_MODE NE 'N' AND P_MODE NE 'E'.
        MESSAGE E001(ZZ) WITH TEXT-012.
        " Session Mode should be either A or N or E
      ENDIF.
    ENDFORM.                    " VALIDATE_DATA
    *&      Form  UPLOAD_DATA
    This form is used to upload data from Presentation Server for either
    Vendor Master or Vendor Extend
    FORM UPLOAD_DATA TABLES P_IT_VENDOR.
      DATA : L_FILENAME TYPE STRING,
             L_FILETYPE TYPE CHAR10 VALUE 'ASC',
             L_HEADER_LENGTH TYPE I VALUE 0,
             L_READ_BY_LINE TYPE CHAR01 VALUE 'X'.
      MOVE P_FILE TO L_FILENAME.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = L_FILENAME
          FILETYPE                = L_FILETYPE
          HEADER_LENGTH           = L_HEADER_LENGTH
          READ_BY_LINE            = L_READ_BY_LINE
          HAS_FIELD_SEPARATOR     = C_SPLIT
        TABLES
          DATA_TAB                = P_IT_VENDOR
        EXCEPTIONS
          FILE_OPEN_ERROR         = 1
          FILE_READ_ERROR         = 2
          NO_BATCH                = 3
          GUI_REFUSE_FILETRANSFER = 4
          INVALID_TYPE            = 5
          NO_AUTHORITY            = 6
          UNKNOWN_ERROR           = 7
          BAD_DATA_FORMAT         = 8
          HEADER_NOT_ALLOWED      = 9
          SEPARATOR_NOT_ALLOWED   = 10
          HEADER_TOO_LONG         = 11
          UNKNOWN_DP_ERROR        = 12
          ACCESS_DENIED           = 13
          DP_OUT_OF_MEMORY        = 14
          DISK_FULL               = 15
          DP_TIMEOUT              = 16
          OTHERS                  = 17.
      IF SY-SUBRC <> 0.
       MESSAGE I001(ZZ) WITH TEXT-006 L_FILENAME.
    MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        FL_FLAG1 = 'X'.
      ELSEIF P_IT_VENDOR[] IS INITIAL.
        MESSAGE I001(ZZ) WITH TEXT-014.   " Uploaded File contains no data
        FL_FLAG1 = 'X'.
      ENDIF.
    ENDFORM.                    " UPLOAD_DATA
    *&      Form  INSERT_VENDOR_MASTER_DATA
    This form is used to process BDC data for Vendor Master
    FORM INSERT_VENDOR_MASTER_DATA .
      DATA : L_LIFNR TYPE LIFNR.
      CLEAR : L_LIFNR.
      sort it_vendor_master by flag.
      LOOP AT IT_VENDOR_MASTER INTO WA_IT_VENDOR_MASTER.
        W_COUNT = W_COUNT + 1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_IT_VENDOR_MASTER-LIFNR
          IMPORTING
            OUTPUT = WA_IT_VENDOR_MASTER-LIFNR.
        if wa_it_vendor_master-flag = 'A'.
        SELECT SINGLE LIFNR
               FROM LFB1
               INTO L_LIFNR
               WHERE LIFNR = WA_IT_VENDOR_MASTER-LIFNR
               AND   BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        IF SY-SUBRC EQ 0.
          WA_IT_ERROR-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
          WA_IT_ERROR-MSG   = TEXT-015.
          APPEND WA_IT_ERROR TO IT_ERROR.
          W_ERR_REC = W_ERR_REC + 1.
          CLEAR : WA_IT_ERROR, L_LIFNR.
        ELSE.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_MASTER.
          PERFORM CALL_TRANSACTION.
        ENDIF.
        CLEAR : WA_IT_VENDOR_MASTER.
        elseif wa_it_vendor_master-flag = 'C'.
          IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.
            PERFORM CLOSE_BDC_SESSION.
            fl_flag4 = 'X'.
          ENDIF.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_MASTER.
          PERFORM CALL_TRANSACTION_FK02.
          CLEAR : WA_IT_VENDOR_MASTER.
        elseif wa_it_vendor_master-flag = 'N'.
          WA_IT_noupdate-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_noupdate-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
          WA_IT_noupdate-MSG   = TEXT-018.
          APPEND WA_IT_noupdate TO IT_noupdate.
          W_noupdate_REC = W_noupdate_REC + 1.
          CLEAR : WA_IT_noupdate, WA_IT_VENDOR_MASTER.
        endif.
      ENDLOOP.
      IF FL_FLAG3 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
    ENDFORM.                    " INSERT_VENDOR_MASTER_DATA
    *&      Form  POPULATE_BDC_DATA_VEN_MASTER
    This form is used to populate BDC data of Vendor Master
    FORM POPULATE_BDC_DATA_VEN_MASTER .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = WA_IT_VENDOR_MASTER-ZTERM
        IMPORTING
          OUTPUT = WA_IT_VENDOR_MASTER-ZTERM.
      IF WA_IT_VENDOR_MASTER-REPRF = 'Y'.
        WA_IT_VENDOR_MASTER-REPRF = 'X'.
      ENDIF.
      IF WA_IT_VENDOR_MASTER-XPORE = 'Y'.
        WA_IT_VENDOR_MASTER-XPORE = 'X'.
      ENDIF.
      if wa_it_vendor_master-flag = 'A'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,
               BDC_FIELD  USING 'RF02K-KTOKK' WA_IT_VENDOR_MASTER-KTOKK,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      elseif wa_it_vendor_master-flag = 'C'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_MASTER-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_MASTER-BUKRS,
               BDC_FIELD  USING 'BDC_OKCODE'  '=MALL',
               BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-D0110' 'X',
               BDC_FIELD  USING 'RF02K-D0120' 'X',
               BDC_FIELD  USING 'RF02K-D0130' 'X',
               BDC_FIELD  USING 'RF02K-D0210' 'X',
               BDC_FIELD  USING 'RF02K-D0215' 'X',
               BDC_FIELD  USING 'RF02K-D0220' 'X',
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      endif.
      perform :BDC_DYNPRO USING 'SAPMF02K' '0110',
               BDC_FIELD  USING 'LFA1-ANRED'  WA_IT_VENDOR_MASTER-ANRED,
               BDC_FIELD  USING 'LFA1-NAME1'  WA_IT_VENDOR_MASTER-NAME1,
               BDC_FIELD  USING 'LFA1-NAME2'  WA_IT_VENDOR_MASTER-NAME2,
               BDC_FIELD  USING 'LFA1-SORTL'  WA_IT_VENDOR_MASTER-SORTL,
               BDC_FIELD  USING 'LFA1-STRAS'  WA_IT_VENDOR_MASTER-STRAS,
               BDC_FIELD  USING 'LFA1-ORT01'  WA_IT_VENDOR_MASTER-ORT01,
               BDC_FIELD  USING 'LFA1-PSTLZ'  WA_IT_VENDOR_MASTER-PSTLZ,
               BDC_FIELD  USING 'LFA1-LAND1'  WA_IT_VENDOR_MASTER-LAND1,
               BDC_FIELD  USING 'LFA1-REGIO'  WA_IT_VENDOR_MASTER-REGIO,
               BDC_FIELD  USING 'LFA1-SPRAS'  WA_IT_VENDOR_MASTER-SPRAS,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00',
               BDC_DYNPRO USING 'SAPMF02K' '0120',
               BDC_FIELD  USING 'LFA1-VBUND'  WA_IT_VENDOR_MASTER-VBUND,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00',
               BDC_DYNPRO USING 'SAPMF02K' '0130',
               BDC_FIELD  USING 'LFBK-BANKS(01)'  WA_IT_VENDOR_MASTER-BANKS,
               BDC_FIELD  USING 'LFBK-BANKL(01)'  WA_IT_VENDOR_MASTER-BANKL,
               BDC_FIELD  USING 'LFBK-BANKN(01)'  WA_IT_VENDOR_MASTER-BANKN,
               BDC_FIELD  USING 'BDC_OKCODE'  '=BANK',
               BDC_DYNPRO USING 'SAPLBANK' '0100',
               BDC_FIELD  USING 'BNKA-BANKA'  WA_IT_VENDOR_MASTER-BANKA,
               BDC_FIELD  USING 'BDC_OKCODE'  '=ENTR',
               BDC_DYNPRO USING 'SAPMF02K' '0130',
               BDC_FIELD  USING 'BDC_OKCODE'  '=ENTR',
               BDC_DYNPRO USING 'SAPMF02K' '0210',
               BDC_FIELD  USING 'LFB1-AKONT'  WA_IT_VENDOR_MASTER-AKONT,
               BDC_FIELD  USING 'LFB1-FDGRV'  WA_IT_VENDOR_MASTER-FDGRV,
               BDC_FIELD  USING 'BDC_OKCODE'  '=/00',
               BDC_DYNPRO USING 'SAPMF02K' '0215',
               BDC_FIELD  USING 'LFB1-ZTERM'  WA_IT_VENDOR_MASTER-ZTERM,
               BDC_FIELD  USING 'LFB1-REPRF'  WA_IT_VENDOR_MASTER-REPRF,
               BDC_FIELD  USING 'LFB1-ZWELS'  WA_IT_VENDOR_MASTER-ZWELS,
               BDC_FIELD  USING 'LFB1-XPORE'  WA_IT_VENDOR_MASTER-XPORE,
               BDC_FIELD  USING 'BDC_OKCODE'  '=UPDA'.
    ENDFORM.                    " POPULATE_BDC_DATA_VEN_MASTER
    *&      Form  BDC_DYNPRO
    This form is used to move data to BDCDATA int'table
    FORM BDC_DYNPRO  USING PROGRAM TYPE BDC_PROG
                           DYNPRO  TYPE BDC_DYNR.
      CLEAR WA_IT_BDCDATA.
      WA_IT_BDCDATA-PROGRAM  = PROGRAM.
      WA_IT_BDCDATA-DYNPRO   = DYNPRO.
      WA_IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND WA_IT_BDCDATA TO IT_BDCDATA.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
    This form is used to move data to BDCDATA int'table
    FORM BDC_FIELD  USING FNAM TYPE ANY
                          FVAL TYPE ANY.
      CLEAR WA_IT_BDCDATA.
      WA_IT_BDCDATA-FNAM = FNAM.
      WA_IT_BDCDATA-FVAL = FVAL.
      APPEND WA_IT_BDCDATA TO IT_BDCDATA.
    ENDFORM.                    " BDC_FIELD
    *&      Form  CALL_TRANSACTION
    This form is used to Call FK01 for processing of data either for
    Vendor Master or Vendor Extend. The error records are inserted to
    Session which can be processed using SM35
    FORM CALL_TRANSACTION .
      DATA : L_OPTION TYPE CTU_PARAMS,
             L_SUBRC TYPE SYSUBRC.
      REFRESH IT_MESSTAB.
      CLEAR IT_MESSTAB.
      L_OPTION-DEFSIZE = 'X'.
      L_OPTION-DISMODE = P_MODE.
      L_OPTION-UPDMODE = 'S'.
      CALL TRANSACTION 'FK01'
           USING IT_BDCDATA
           MESSAGES INTO IT_MESSTAB
           OPTIONS FROM L_OPTION.
      L_SUBRC = SY-SUBRC.
      IF L_SUBRC = 0.
        W_SUCC_REC = W_SUCC_REC + 1.
      ELSE.
        IF FL_FLAG2 NE 'X'.
          PERFORM OPEN_BDC_SESSION.
          FL_FLAG2 = 'X'.
        ENDIF.
        PERFORM BDC_INSERT.
        W_ERR_REC = W_ERR_REC + 1.
        PERFORM ERROR_RECORD_DATA.
      ENDIF.
    ENDFORM.                    " CALL_TRANSACTION
    *&      Form  OPEN_BDC_SESSION
    Form used to open session for Error out Records
    FORM OPEN_BDC_SESSION .
      DATA : L_USERID TYPE APQ_MAPN,      " Variable to hold user-id
             L_GROUP TYPE APQ_GRPN.       " Variable to hold value
      MOVE P_GROUP TO L_GROUP.
      MOVE SY-UNAME TO L_USERID.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT              = SY-MANDT
          GROUP               = L_GROUP
          KEEP                = SPACE
          USER                = L_USERID
        EXCEPTIONS
          CLIENT_INVALID      = 1
          DESTINATION_INVALID = 2
          GROUP_INVALID       = 3
          GROUP_IS_LOCKED     = 4
          HOLDDATE_INVALID    = 5
          INTERNAL_ERROR      = 6
          QUEUE_ERROR         = 7
          RUNNING             = 8
          SYSTEM_LOCK_ERROR   = 9
          USER_INVALID        = 10
          OTHERS              = 11.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-008.              " Unable to open BDC Session
      ENDIF.
    ENDFORM.                    " OPEN_BDC_SESSION
    *&      Form  BDC_INSERT
    This form is used to insert error records to a Session method
    FORM BDC_INSERT .
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE            = 'FK01'
        TABLES
          DYNPROTAB        = IT_BDCDATA
        EXCEPTIONS
          INTERNAL_ERROR   = 1
          NOT_OPEN         = 2
          QUEUE_ERROR      = 3
          TCODE_INVALID    = 4
          PRINTING_INVALID = 5
          POSTING_INVALID  = 6
          OTHERS           = 7.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-009.             " Unable to Insert Data to BDC Session
      ENDIF.
    ENDFORM.                    " BDC_INSERT
    *&      Form  ERROR_RECORD_DATA
    This form is used to process the messages for the error records which
    will be displayed on the output report
    FORM ERROR_RECORD_DATA .
      DATA : L_LINES TYPE I,
             L_MSG(200) TYPE C.
      DESCRIBE TABLE IT_MESSTAB LINES L_LINES.
      READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.
      IF SY-SUBRC = 0.
        CLEAR L_MSG.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = WA_IT_MESSTAB-MSGID
            LANG      = SY-LANGU
            NO        = WA_IT_MESSTAB-MSGNR
            V1        = WA_IT_MESSTAB-MSGV1
            V2        = WA_IT_MESSTAB-MSGV2
            V3        = WA_IT_MESSTAB-MSGV3
            V4        = WA_IT_MESSTAB-MSGV4
          IMPORTING
            MSG       = L_MSG
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC = 0.
          WA_IT_ERROR_fk01-MSG = L_MSG.
        ENDIF.
        IF P_VENMAS = 'X'.
          WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_ERROR_fk01-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_ERROR_fk01-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_ERROR_fk01 TO IT_ERROR_fk01.
        CLEAR WA_IT_ERROR_fk01.
      ENDIF.
    ENDFORM.                    " ERROR_RECORD_DATA
    *&      Form  CLOSE_BDC_SESSION
    Form used to close session of the Error Records
    FORM CLOSE_BDC_SESSION .
      CALL FUNCTION 'BDC_CLOSE_GROUP'
        EXCEPTIONS
          NOT_OPEN    = 1
          QUEUE_ERROR = 2
          OTHERS      = 3.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-010.             " Unable to Close BDC Session
      ENDIF.
    ENDFORM.                    " CLOSE_BDC_SESSION
    *&      Form  CHK_AND_INS_VENDOR_EXTEND_DATA
    This form is used to process BDC data for Vendor Extend
    FORM CHK_AND_INS_VENDOR_EXTEND_DATA .
      DATA : L_LIFNR TYPE LIFNR.
      CLEAR : L_LIFNR, fl_flag4.
      sort it_vendor_extend by flag.
      LOOP AT IT_VENDOR_EXTEND INTO WA_IT_VENDOR_EXTEND.
        W_COUNT = W_COUNT + 1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            INPUT  = WA_IT_VENDOR_EXTEND-REF_LIFNR
          IMPORTING
            OUTPUT = WA_IT_VENDOR_EXTEND-REF_LIFNR.
        if wa_it_vendor_extend-flag = 'A'.
        SELECT SINGLE LIFNR
               FROM LFB1
               INTO L_LIFNR
               WHERE LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR
               AND   BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.
        IF SY-SUBRC NE 0.
          WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-REF_LIFNR.
          WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-REF_BUKRS.
          WA_IT_ERROR-MSG   = TEXT-007.
          APPEND WA_IT_ERROR TO IT_ERROR.
          W_ERR_REC = W_ERR_REC + 1.
          CLEAR : WA_IT_ERROR, L_LIFNR.
        ELSE.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              INPUT  = WA_IT_VENDOR_EXTEND-LIFNR
            IMPORTING
              OUTPUT = WA_IT_VENDOR_EXTEND-LIFNR.
          SELECT SINGLE LIFNR
                 FROM LFB1
                 INTO L_LIFNR
                 WHERE LIFNR = WA_IT_VENDOR_EXTEND-LIFNR
                 AND   BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
          IF SY-SUBRC EQ 0.
            WA_IT_ERROR-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
            WA_IT_ERROR-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
            WA_IT_ERROR-MSG   = TEXT-015.
            APPEND WA_IT_ERROR TO IT_ERROR.
            W_ERR_REC = W_ERR_REC + 1.
            CLEAR : WA_IT_ERROR, L_LIFNR.
          ELSE.
            REFRESH IT_BDCDATA.
            CLEAR IT_BDCDATA.
            PERFORM POPULATE_BDC_DATA_VEN_EXTEND.
            PERFORM CALL_TRANSACTION.
          ENDIF.
        ENDIF.
        CLEAR : WA_IT_VENDOR_EXTEND.
        elseif wa_it_vendor_extend-flag = 'C'.
          IF FL_FLAG2 = 'X' and fl_flag4 ne 'X'.
            PERFORM CLOSE_BDC_SESSION.
            fl_flag4 = 'X'.
          ENDIF.
          REFRESH IT_BDCDATA.
          CLEAR IT_BDCDATA.
          PERFORM POPULATE_BDC_DATA_VEN_extend.
          PERFORM CALL_TRANSACTION_FK02.
           CLEAR : WA_IT_VENDOR_EXTEND.
        elseif wa_it_vendor_extend-flag = 'N'.
          WA_IT_noupdate-LIFNR = WA_IT_VENDOR_extend-LIFNR.
          WA_IT_noupdate-BUKRS = WA_IT_VENDOR_extend-BUKRS.
          WA_IT_noupdate-MSG   = TEXT-019.
          APPEND WA_IT_noupdate TO IT_noupdate.
          W_noupdate_REC = W_noupdate_REC + 1.
          CLEAR : WA_IT_noupdate, WA_IT_VENDOR_EXTEND.
        endif.
      ENDLOOP.
      IF FL_FLAG2 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
      if fl_flag3 = 'X'.
        PERFORM CLOSE_BDC_SESSION.
      ENDIF.
    ENDFORM.                    " CHK_AND_INS_VENDOR_EXTEND_DATA
    *&      Form  POPULATE_BDC_DATA_VEN_EXTEND
    This form is used to populate BDC data of Vendor Extend
    FORM POPULATE_BDC_DATA_VEN_EXTEND .
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = WA_IT_VENDOR_EXTEND-ZTERM
        IMPORTING
          OUTPUT = WA_IT_VENDOR_EXTEND-ZTERM.
      IF WA_IT_VENDOR_EXTEND-REPRF = 'Y'.
        WA_IT_VENDOR_EXTEND-REPRF = 'X'.
      ENDIF.
      IF WA_IT_VENDOR_extend-XPORE = 'Y'.
        WA_IT_VENDOR_extend-XPORE = 'X'.
      ENDIF.
      if wa_it_vendor_extend-flag = 'A'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0105',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_EXTEND-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_EXTEND-BUKRS,
               BDC_FIELD  USING 'RF02K-KTOKK' WA_IT_VENDOR_EXTEND-KTOKK,
               BDC_FIELD  USING 'RF02K-REF_LIFNR'
                                          WA_IT_VENDOR_EXTEND-REF_LIFNR,
               BDC_FIELD  USING 'RF02K-REF_BUKRS'
                                          WA_IT_VENDOR_EXTEND-REF_BUKRS,
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      elseif wa_it_vendor_extend-flag = 'C'.
      PERFORM :BDC_DYNPRO USING 'SAPMF02K' '0106',
               BDC_FIELD  USING 'RF02K-LIFNR' WA_IT_VENDOR_extend-LIFNR,
               BDC_FIELD  USING 'RF02K-BUKRS' WA_IT_VENDOR_extend-BUKRS,
               BDC_FIELD  USING 'RF02K-D0210' 'X',
               BDC_FIELD  USING 'RF02K-D0215' 'X',
               BDC_FIELD  USING 'BDC_OKCODE'  '/00'.
      endif.
      perform :BDC_DYNPRO USING 'SAPMF02K' '0210',
               BDC_FIELD  USING 'LFB1-AKONT'  WA_IT_VENDOR_EXTEND-AKONT,
               BDC_FIELD  USING 'LFB1-FDGRV'  WA_IT_VENDOR_EXTEND-FDGRV,
               BDC_FIELD  USING 'BDC_OKCODE'  '=/00',
               BDC_DYNPRO USING 'SAPMF02K' '0215',
               BDC_FIELD  USING 'LFB1-ZTERM'  WA_IT_VENDOR_EXTEND-ZTERM,
               BDC_FIELD  USING 'LFB1-REPRF'  WA_IT_VENDOR_EXTEND-REPRF,
               BDC_FIELD  USING 'LFB1-ZWELS'  WA_IT_VENDOR_EXTEND-ZWELS,
               BDC_FIELD  USING 'LFB1-XPORE'  WA_IT_VENDOR_extend-XPORE,
               BDC_FIELD  USING 'BDC_OKCODE'  '=UPDA'.
    ENDFORM.                    " POPULATE_BDC_DATA_VEN_EXTEND
    *&      Form  DISPLAY_ERROR_REPORT
    This form is used to display the error records on the output screen
    FORM DISPLAY_ERROR_REPORT .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O05.            " Error List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O06.            " Error List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H03,              " Error Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_ERROR INTO WA_IT_ERROR.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_ERROR-LIFNR,
               17  SY-VLINE,
               18  WA_IT_ERROR-BUKRS,
               31  SY-VLINE,
               32  WA_IT_ERROR-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_ERROR.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    ENDFORM.                    " DISPLAY_ERROR_REPORT
    *&      Form  CALL_TRANSACTION_FK02
    Form used to Call Transaction FK02
    form CALL_TRANSACTION_FK02 .
      DATA : L_OPTION TYPE CTU_PARAMS,
             L_SUBRC TYPE SYSUBRC.
      REFRESH IT_MESSTAB.
      CLEAR IT_MESSTAB.
      L_OPTION-DEFSIZE = 'X'.
      L_OPTION-DISMODE = P_MODE.
      L_OPTION-UPDMODE = 'S'.
      CALL TRANSACTION 'FK02'
           USING IT_BDCDATA
           MESSAGES INTO IT_MESSTAB
           OPTIONS FROM L_OPTION.
      L_SUBRC = SY-SUBRC.
      IF L_SUBRC = 0.
        W_SUCC_REC1 = W_SUCC_REC1 + 1.
        WA_IT_succ_rec1-MSG = Text-017.
        IF P_VENMAS = 'X'.
          WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_succ_rec1-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_succ_rec1-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_succ_rec1 TO IT_succ_rec1.
      ELSE.
        IF FL_FLAG3 NE 'X'.
          PERFORM OPEN_BDC_SESSION_fk02.
          FL_FLAG3 = 'X'.
        ENDIF.
        PERFORM BDC_INSERT_fk02.
        W_ERR_REC = W_ERR_REC + 1.
        PERFORM ERROR_RECORD_DATA1.
      ENDIF.
    endform.                    " CALL_TRANSACTION_FK02
    *&      Form  OPEN_BDC_SESSION_fk02
    Form used to Open session for FK02
    form OPEN_BDC_SESSION_fk02 .
      DATA : L_USERID TYPE APQ_MAPN,      " Variable to hold user-id
             L_GROUP TYPE APQ_GRPN.       " Variable to hold value
      MOVE P_GROUP1 TO L_GROUP.
      MOVE SY-UNAME TO L_USERID.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT              = SY-MANDT
          GROUP               = L_GROUP
          KEEP                = SPACE
          USER                = L_USERID
        EXCEPTIONS
          CLIENT_INVALID      = 1
          DESTINATION_INVALID = 2
          GROUP_INVALID       = 3
          GROUP_IS_LOCKED     = 4
          HOLDDATE_INVALID    = 5
          INTERNAL_ERROR      = 6
          QUEUE_ERROR         = 7
          RUNNING             = 8
          SYSTEM_LOCK_ERROR   = 9
          USER_INVALID        = 10
          OTHERS              = 11.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-008.              " Unable to open BDC Session
      ENDIF.
    endform.                    " OPEN_BDC_SESSION_fk02
    *&      Form  BDC_INSERT_fk02
    Form used to insert data into BDC session using FK02
    form BDC_INSERT_fk02 .
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          TCODE            = 'FK02'
        TABLES
          DYNPROTAB        = IT_BDCDATA
        EXCEPTIONS
          INTERNAL_ERROR   = 1
          NOT_OPEN         = 2
          QUEUE_ERROR      = 3
          TCODE_INVALID    = 4
          PRINTING_INVALID = 5
          POSTING_INVALID  = 6
          OTHERS           = 7.
      IF SY-SUBRC <> 0.
        WRITE:/ TEXT-009.             " Unable to Insert Data to BDC Session
      ENDIF.
    endform.                    " BDC_INSERT_fk02
    *&      Form  display_changed_report
    Form to display Updated Vendor data
    form display_changed_report .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O10.          " Updated List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O11.          " Updated List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_succ_rec1 INTO WA_IT_succ_rec1.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_succ_rec1-LIFNR,
               17  SY-VLINE,
               18  WA_IT_succ_rec1-BUKRS,
               31  SY-VLINE,
               32  WA_IT_succ_rec1-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_succ_rec1.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_changed_report
    *&      Form  display_nochange_report
    Form to display No Changed data for Vendors
    form display_nochange_report .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O12.       " No Changes List for Vendor Master
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O13.       " No Changes List for Vendor Master Extended
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_noupdate INTO WA_IT_noupdate.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_noupdate-LIFNR,
               17  SY-VLINE,
               18  WA_IT_noupdate-BUKRS,
               31  SY-VLINE,
               32  WA_IT_noupdate-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_noupdate.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_nochange_report
    *&      Form  ERROR_RECORD_DATA1
    Form to get Error Message for Changed Vendors
    form ERROR_RECORD_DATA1 .
      DATA : L_LINES TYPE I,
             L_MSG(200) TYPE C.
      DESCRIBE TABLE IT_MESSTAB LINES L_LINES.
      READ TABLE IT_MESSTAB INTO WA_IT_MESSTAB INDEX L_LINES.
      IF SY-SUBRC = 0.
        CLEAR L_MSG.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID        = WA_IT_MESSTAB-MSGID
            LANG      = SY-LANGU
            NO        = WA_IT_MESSTAB-MSGNR
            V1        = WA_IT_MESSTAB-MSGV1
            V2        = WA_IT_MESSTAB-MSGV2
            V3        = WA_IT_MESSTAB-MSGV3
            V4        = WA_IT_MESSTAB-MSGV4
          IMPORTING
            MSG       = L_MSG
          EXCEPTIONS
            NOT_FOUND = 1
            OTHERS    = 2.
        IF SY-SUBRC = 0.
          WA_IT_ERROR_fk02-MSG = L_MSG.
        ENDIF.
        IF P_VENMAS = 'X'.
          WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_MASTER-LIFNR.
          WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_MASTER-BUKRS.
        ELSEIF P_VENEXT = 'X'.
          WA_IT_ERROR_fk02-LIFNR = WA_IT_VENDOR_EXTEND-LIFNR.
          WA_IT_ERROR_fk02-BUKRS = WA_IT_VENDOR_EXTEND-BUKRS.
        ENDIF.
        APPEND WA_IT_ERROR_fk02 TO IT_ERROR_fk02.
        CLEAR WA_IT_ERROR_fk02.
      ENDIF.
    endform.                    " ERROR_RECORD_DATA1
    *&      Form  display_error_report_fk01
    Form to display Error Report for Master Vendors (FK01)
    form display_error_report_fk01 .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O05.     " Error List for Vendor Master (FK01)
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O06.     " Error List for Vendor Master Extended (FK01)
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number
             17  SY-VLINE,
             18  TEXT-H02,              " Company Code
             31  SY-VLINE,
             32  TEXT-H04,              " Message
             100 SY-VLINE.
      FORMAT COLOR OFF.
      WRITE:/ SY-ULINE(100).
      LOOP AT IT_ERROR_fk01 INTO WA_IT_ERROR_fk01.
        FORMAT COLOR 2.
        WRITE:/1   SY-VLINE,
               2   WA_IT_ERROR_fk01-LIFNR,
               17  SY-VLINE,
               18  WA_IT_ERROR_fk01-BUKRS,
               31  SY-VLINE,
               32  WA_IT_ERROR_fk01-MSG,
               100 SY-VLINE.
        CLEAR : WA_IT_ERROR_fk01.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE:/ SY-ULINE(100).
    endform.                    " display_error_report_fk01
    *&      Form  display_error_report_fk02
    Form to display Error Report for changed Vendors (FK02)
    form display_error_report_fk02 .
      IF P_VENMAS = 'X'.
        WRITE:/ TEXT-O14.     " Error List for Vendor Master (FK02)
      ELSEIF P_VENEXT = 'X'.
        WRITE:/ TEXT-O15.     " Error List for Vendor Master Extended (FK02)
      ENDIF.
      WRITE:/ SY-ULINE(100).
      FORMAT COLOR 1.
      WRITE:/1   SY-VLINE,
             2   TEXT-H01,              " Vendor Number

  • Repository for material master

    Hai expertise,
          How can i download the readymade repository for material master. If we want to create customized repository, how to design the repository for master data like material, vendor etc.,
          Are there any standard documents available for the above??
    Regards,
    Govada.

    Can anybody send the material master pre-configured repository. (I think i dont have sufficient authorization to download them) i have tried the following path:
    <b>"SAP delivers out of the box content for these repositories in SAP Market place.
    http://service.sap.com/swdc
    Entry by Application Group ->Entry by Application Group->
    Support Packages and Patches->SAP NetWeaver->SAP MDM" SAP MDM 5.5-> Master Data Server->MDM BUSINESS CONTENT 5.5->#OS independent->MDMBC55004P_3-10003437.ZIP"</b>
    But i am unable to see the SAP MDM itself with my marketplace id.
    <b>If anybody having the preconfigured material master repository zip file please send it to below mentioned mail id
    [email protected]</b>
    Regards,
    Chand.

  • Message Type for Material Master Data Changes

    Hi all
    I'm managing Message Types for Material Master Data extraction from R\3 system to BW system, in order to load on BW only the changes done to some fields of MARA table that are delta relevant.
    Now from R/3 BD50 Transaction I can see that there is a message type that refer to changes done on MARA fields: RS0044.
    I would like to replace this message type with another one (RS0020) in order to align different systems.
    Now changes to material master data in R/3 system are recorder with both message types but only those with RS0044 message type are processed and loaded into BW system.
    So I would like to know:
    1. How is the message type related to the DataSource 0material?
    2. is it possible to replace a message type for BW?
    3. if yes, how can I do it?
    Thanks in advance.
    Elisa
    mail: [email protected]

    Hi Oscar!
    At the moment I'm using Delta queue of 0MATERIAL. I know that in the queue there are all the new and changed records.
    But I would like to be able not to load all the changed records, but only those that refer to some fields of MARA table.
    E.g. if the gross weight of a material is modified I don't want to load this change on BW with Delta loading .
    I've seen that from R/3 Transaction BD52 you can set only delta relevant fields referred to a specific message type and to delete the other fields.
    As I'm able to do this directly in the Development system and Test System, I haven't got the authorization of doing it in the Production system.
    That's why I need to include this setting in a CR and then ask to transport it from Test to Production system.
    But message types referred to MARA field changes are different between the two systems.
    And it seems they are automatically created.
    Is it true?
    Thanks
    Elisa

  • LSMW for Material master data

    Hi,
    Anybody can help me, how to make LSMW for Material master data.
    Thanks in Advance
    Arjun

    pls follow the thread:
    http://help.sap.com/saphelp_46c/helpdata/en/f6/ca0766a7a911d1950500a0c930e0da/frameset.htm
    regards,
    indranil

  • Need notes on MDM and on material master data

    HI Gurus
    Can some one help me In understnding MDM tool and if can provide notes and second need notes on material master data
    thanks everybody

    Hi,
    Please refer below links for the MDM and material master. Thanking you.
    http://wiki.sdn.sap.com/wiki/display/SAPMDM/SAPNetWeaverMDM+Tools
    http://www.sap-img.com/materials/classification-view-of-material-master.htm
    http://www.magnatraining.com/how-to-create-material-master-in-sap-mm/

  • User Exist for Material master data changes like standard cost, master pric

    Hello,
    Could anyone please provide the user exit name for the following requirement. 
    The trigger to transfer data from SAP to Unix directory should be whenever one of the SAP field values change (standard cost, master price, Type Of Sales) or whenever a new item is added to SAP.  The data will be interfaced out of SAP NIGHTLY using the certain data format.
    thanks
    kumar

    Hi Lakshminarayanan
      thanks for your information.
    i have tested by changing the Type of Sales in material master(MM02) but the FM - EXIT_SAPLMGMU_001(MGA00001) did NOT get trigger. i did not write any code in side the INCLUDE program.i just tried wether the User Exit is getting trigger or not while changing the material master.
    Please advise me how to test it.
    Thanks
    Kumar

  • How to create web servise for Material Master catalog

    Hi Experts
    We would like to have a web servise foe the material master catalog.
    Please advise hoe we can implement this.
    Thanks,
    moshe

    hi stein,
    once you check below link it's helpful for your requirement :
    <IRRELEVANT LINKS>
    thanks,
    Edited by: Prateek Raj Srivastava on Dec 12, 2011 9:34 PM

  • Problems with new fields added for tc MASS for material master data.

    Hello to all.
    We created new fields in MARA table and added to the process of the tc MASS. We made the following steps and it almost works correctly:
    1-Add new fields to the object ZBUS1001, copy of bus BUS1001.
    2-Add new fields to table T130F
    3-Add new field to structure E1MARAM.
    4-Add new fields to structure CL_MMH1.
    5-Add new fields to structure MARA_TMP.
    6-Created a function module to control that the new fields not filled in MASS have a "/" value.
    If we run the mass for our objetct ZBUS1001 and put a new value or modify the value of new fields, the tc MASS works correctly.If we want to delete a value leaving the value empty,click to the carry out a mass change button and save the change, the system don´t delete the value and keep the first value.
    Do you know what the problem is , and what step we didn´t make it.
    Thanks in advance.
    Edited by: tonnetti pablo on Feb 6, 2008 7:45 PM

    Hi,
    Check ZTERMDT is checked under Attribute list as below.
    Hope it helps..
    regards,
    Raju

  • Mass change for material master data

    Dear all,
    Previously my company had marked some storage location for MRP indicator to exclude the storage location stock from MRP run.
    Now I need to reactive back those storage location, where should I go?
    I know a way which can active back material by material (tcode: MM02), but that is too slow for me, because I need to active back around hundrreds of materials.
    Anyone know where can I modify the storage location indicator and active back it? I had test MM17, MASS, LSMW.. but it seems like not supported for SAP version 4.0B.
    Hope will get reply soon, this issue was quite urgent.
    Thanks!
    Best Regards,
    PC

    Dear Peai,
    check with this steps SPRO - SAP Reference IMG - Production - Material
    Requirement Planning - Planning - Define Storage location MRP per plant - Enter
    the plant - Check for which Storage locations has got the indicator 1 - Storage
    Location stock excluded from MRP - Now remove that or choose the values.
    Check with & revert.
    Regards
    Mangal

  • Create a specific user profile to Material master data

    Dear colleagues.
    We need create on R/3 4.6 a specific user profile for material master data, to create or modify (MM01/MM02) only the following views: 'Sales org. data 1', 'Sales org. data 2' and 'Sales:General/Plant data'. The problem is that when I use the SAP gui functions, I can create the profile, but also with the views 'Foreign trade: Export data' and 'Sales text'. Someone know how create this profile without this last two views? Thanks.

    See:
    http://technet.microsoft.com/en-us/library/cc262327(v=office.15).aspx#create
    And a more complex, in-depth example leveraging MMS:
    http://www.sharepointsteve.com/2010/10/making-custom-user-profile-properties-searchable-in-sharepoint-2010/
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Error while creating sales order for material with another DIVISION

    Hello Friends,
    I have a problem with my sales order creation.
    I have defined a new sales area 0010 / 10 / 01. I have the sales order type assigned to this sales area. (in VOV8 for the sales order type, in the 'General Control' the 'item division' is flagged.
    Now, I have created the sold to party XYZ with all the partner functions defaulted same as the sold to party for the sales area 0010 / 10 / 01.
    NOW, I have the material ABC with the DIVISION 10 in the basic data. I have extended the material to my sales org & dist. channel & plant.
    Now, while creating the sales order for my sales area 0010 / 10 / 01 , I enter the sold to party XYZ - it is OK. But when I enter the material ABC, I get the error - "SHIP TO PARTY IS NOT DEFINED FOR SALES AREA 0010 / 10 / 10"
    Please help to resolve the issue.
    Edited by: Vivek on Aug 13, 2009 9:04 AM

    Hi
    Common division for Material Master data will not work
    Because in the material master Division is a field not an organizational unit
    Means when you create MMR you will give sales org, DC, Plant  as organizational units and then enter but not division
    Division is a field maintained in basic data and sales org data 1
    This is the reason in t code you will find in t code VOR2 Common division only customer and conditions but not materials
    But in t code VOR1 Common DC ,customer  conditions and materials all there are available (you can check these t codes)
    Coming to your issue Item div is clecked in your order type
    This means the division in MMR has the priority or control for that order type
    Your header division is 01 ( taken from customers sales area) and item division is 10 (taken from MMR as per your post)
    So it differs
    To process this order with Item div is clecked in your order type you need to extend your Sold to party ABC to the sales area 0010/10/10 (the sales area where the division of the material falls)
    or alternatively
    There should be a  customer say DEF created in sales area 0010/10/10 who will be a ship to party ( your error is also the same)
    for your ABC  that is sold to party in sales area 0010/10/01 where the order is registered
    Hope yopu are getting it
    ABC in sales area 0010/10/01 will have  or should have ship to paty DEF  in sales area 0010/10/10 
    or
    ABC should operate in in sales area 0010/10/10  too
    If item division is not ticked then these are not necessary as the header division 01 will be valid for all items and syatem will not look MMR at all for division
    Regards
    Raja

  • About material master data batch input

    hello
        i wrote a batch input for material master data. but it can't work ,i can't use it to create material.hope someone help me!thanks.code is below.
    report z_mat_batchinput no standard page heading
          line-size 255 message-id YB.
           mat batch input
    include bdcrecx1.
    include .
    tables: mara,marm,MARC,MARD,T134,NRIV,T006A,T023,T001W,T001L,
            TVKO,TVTW,T025,TTGR,TLGR,TVKWZ,T006.
    data: DIMID like t006-DIMID.
    data: flag, K, tmp.
    DATA: X TYPE I.
    ************ÉÏÔØÎļþÄÚ±í************************
    data: begin of record occurs 0,
            MATNR(018),        " ÎïÁϺÅ
            MTART(004),        " ÎïÁÏÀàÐÍ
    **generaldata1**
            MAKTX(040),        " ÎïÁÏÃèÊö
           EAKTX(040),        " Ó¢ÎÄÃèÊö
            MEINS(003),        " »ù±¾¼ÆÁ¿µ¥Î»
            MATKL(009),        " ÎïÁÏ×é
            BISMT(018),        " ¾ÉÎïÁϺÅ
           EXTWG(018),        " ÍⲿÎïÁÏ×é
           SPART(002),        " ²¿ÃÅ
            MTPOS_MARA(004),   " ÆÕͨÏîÄ¿Àà±ð×é
            BRGEW(017),        " ëÖØ
            GEWEI(003),        " ÖØÁ¿µ¥Î»
            NTGEW(017),        " ¾»ÖØ
            VOLUM(017),        " Ìå»ý
            VOLEH(003),        " Ìå»ýµ¥Î»
            GROES(032),        " Á¿¸Ù
            MAGRV(004),        " ÎïÁÏ×éµÄ°ü×°Îï
    **generaldata2**
            NORMT(018),        " ¹¤Òµ±ê×¼ÃèÊö
            FERTH(018),        " ÀàÐÍ
            WRKST(048),        " ¹æ¸ñ
    **generaldata1**
           EAN11(018),        " ²úÆ·±íʶÂë
    **generaldata2**
           ZEIAR(003),        " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
            WERKS(004),        " ¹¤³§
            VKORG(004),        " ÏúÊÛ×éÖ¯
            VTWEG(002),        " ·ÖÏúÇþµÀ
    **salesorg 1**
           VRKME(003),        " ÏúÊÛµ¥Î»
           VMREN(006),        " ÏúÊÛµ¥Î»×ª»»Òò×Ó
           VMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
            SPART(002),        " ²úÆ·×é
            DWERK(004),        " ½»»õ¹¤³§
            TAXKM(001),        " ÎïÁÏË°·ÖÀà
    **salesorg 2**
            KONDM(002),        " ÎïÁ϶¨¼Û×é
            KTGRM(002),        " ¿ÆÄ¿ÉèÖÃ×é
           MVGR1(003),                                         " ÎïÁÏ×é 1
           MVGR2(003),                                         " ÎïÁÏ×é 2
            MTPOS(004),        " ÏîÄ¿Àà±ð×é
           VERSG(001),        " ÎïÁÏͳ¼Æ×é
    **ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
            MTVFP(002),        " ¿ÉÓÃÐÔ¼ì²é
            XCHPF(001),        " Åú´Î¹ÜÀí
           YCHPF(001),        " ÅúÁ¿¹ÜÀí
            TRAGR(004),        " ÔËÊä×é
            ladgr(004),        " ×°ÔØ×é
    **pur**
           BSTME(003),        " ¶©µ¥µ¥Î»
           UMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           UMREN(006),        " ¶©µ¥µ¥Î»×ª»»Òò×Ó
           WEBAZ(003),        " ÊÕ»õ´¦Àíʱ¼ä
            EKGRP(003),        " ²É¹º×é
          LGORT(004),        " ¿â´æµØ
    **Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
           AUSME(003),        " ·¢»õµ¥Î»
           UMREJ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           UMREF(006),        " ·¢»õµ¥Î»×ª»»Òò×Ó
           XCHPF(001),        " ÅúÁ¿¹ÜÀí
    **MRP 1**
           DISGR(004),        " MRP×é
            DISMM(002),        " MRPÀàÐÍ
           FXHOR(003),        " ¼Æ»®µÄʱ½ì
            DISPO(003),        " MRP¿ØÖÆÕß
            DISLS(002),        " ÅúÁ¿
            MAABC(001),        " ABC±êʶ
           BSTFE(018),        " ¹Ì¶¨ÅúÁ¿´óС
    **MRP 2**
           RESKZ(001),        " »ñÈ¡ÀàÐÍ
            BESKZ(001),        " ²É¹ºÀàÐÍ
           SOBSL(002),        " ÌØÊâ²É¹ºÀà
           LGPRO(004),        " ·¢»õ²Ö´¢µØµã
           RGEKZ(001),        " ·´³å
            PLIFZ(003),        " ¼Æ»®½»»õʱ¼ä
           VEBAZ(003),        " ÊÕ»õ´¦Àíʱ¼ä
            DZEIT(008),        "×ÔÖÆÉú²ú
            FHORI(003),        " ¼Æ»®±ß¼ÊÂë
           EISBE(018),        " °²È«¿â´æ
    **MRP 3**
            PERKZ(001),        " ÆÚ¼ä±êʶ
            STRGR(002),        " ²ßÂÔ×é
           VRMOD(001),        " ÏûºÄģʽ
           VINT1(003),        " ÄæÏòÏûºÄÆÚ¼ä
           VINT2(003),        " ÏòÇ°ÏûºÄÆÚ¼ä
            NTVFP(002),        " ¿ÉÓÃÐÔ¼ì²é
    **MRP 4**
           SAUFT(001),        " Öظ´ÖÆÔì±êÖ¾
           SFEPR(004),        " Öظ´Éú²ú²ÎÊýÎļþ
    **¹¤×÷¼Æ»®**
           FEVOR(003),        " Éú²úµ÷¶ÈÔ±
           FRTME(003),        " Éú²úµ¥Î»
           SMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           SMREN(006),        " Éú²úµ¥Î»×ª»»Òò×Ó
           UEETK(001),        " ÎÞÏÞÖƹýÁ¿½»»õ
    **»á¼Æ 1**
            BKLAS(004),        " ÆÀ¹ÀÀà
           BWTTY(001),        " ¹À¼Û·ÖÀà
            VPRSV(001),        " ¼Û¸ñ¿ØÖÆ
            PEINH(006),        " ¼Û¸ñµ¥Î»
            VERPR(015),        " Òƶ¯Æ½¾ù¼Û
            STPRS(015),        " ±ê×¼¼Û
    **»á¼Æ 2**
           BWPRH(014),        " ÉÌÒµ¼Û¸ñ 1
    **³É±¾ 1**
           LOSGR(018),        " ÅúÁ¿³É±¾ºËËã
    **³É±¾ 2**
           ZPLP1(014),        " ¼Æ»®¼Û¸ñ 1
           ZPLD1(010),        " ¼Æ»®ÈÕÆÚ 1
    **qm**
            ART1(8),            "¼ìÑéÀàÐÍ1
            AKTIV1(1),          "ÒѼ¤»î
            QMPUR(1),             "¼¤»î²É¹ºÖÐµÄ QM
            SSQSS(8),          "QM ¿ØÖÆÂë¡¢
           QMATV(8),          "QM¼ìÑéÉèÖÃ
           ART2(8),            "¼ìÑéÀàÐÍ2
           AKTIV2(6),          "ÒѼ¤»î
           ART3(8),            "¼ìÑéÀàÐÍ3
           AKTIV3(6),          "ÒѼ¤»î
          end of record.
    ************ÏÂÔظñʽ/´íÎóÎļþÄÚ±í**************
    data: begin of record1 occurs 0,
            MATNR(018),        " ÎïÁϺÅ
            MTART(008),        " ÎïÁÏÀàÐÍ
    **»ù±¾Êý¾Ý1**
            MAKTX(040),        " ÎïÁÏÃèÊö
           EAKTX(040),        " Ó¢ÎÄÃèÊö
            MEINS(013),        " »ù±¾¼ÆÁ¿µ¥Î»
            MATKL(009),        " ÎïÁÏ×é
            BISMT(018),        " ¾ÉÎïÁϺÅ
           EXTWG(018),        " ÍⲿÎïÁÏ×é
           SPART(002),        " ²¿ÃÅ
            MTPOS_MARA(004),   " ÆÕͨÏîÄ¿Àà±ð×é
            BRGEW(017),        " ëÖØ
            GEWEI(008),        " ÖØÁ¿µ¥Î»
            NTGEW(017),        " ¾»ÖØ
            VOLUM(017),        " Ìå»ý
            VOLEH(008),        " Ìå»ýµ¥Î»
            GROES(032),        " Á¿¸Ù
            MAGRV(014),        " ÎïÁÏ×éµÄ°ü×°Îï
    **»ù±¾Êý¾Ý2**
            NORMT(018),        " ¹¤Òµ±ê×¼ÃèÊö
            FERTH(018),        " ÀàÐÍ
            WRKST(048),        " ¹æ¸ñ
    **»ù±¾Êý¾Ý1**
           EAN11(018),        " ²úÆ·±íʶÂë
    **»ù±¾Êý¾Ý2**
           ZEIAR(003),        " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
            WERKS(004),        " ¹¤³§
            VKORG(008),        " ÏúÊÛ×éÖ¯
            VTWEG(008),        " ·ÖÏúÇþµÀ
    **ÏúÊÛ×éÖ¯ 1**
           VRKME(003),        " ÏúÊÛµ¥Î»
           VMREN(006),        " ÏúÊÛµ¥Î»×ª»»Òò×Ó
           VMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
            SPART(006),        " ²úÆ·×é
            DWERK(008),        " ½»»õ¹¤³§
            TAXKM(010),        " ÎïÁÏË°·ÖÀà
    **ÏúÊÛ×éÖ¯ 2**
            KONDM(010),        " ÎïÁ϶¨¼Û×é
            KTGRM(010),        " ¿ÆÄ¿ÉèÖÃ×é
           MVGR1(003),                                         " ÎïÁÏ×é 1
           MVGR2(003),                                         " ÎïÁÏ×é 2
            MTPOS(010),        " ÏîÄ¿Àà±ð×é
           VERSG(001),        " ÎïÁÏͳ¼Æ×é
    **ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
            MTVFP(010),        " ¿ÉÓÃÐÔ¼ì²é
            XCHPF(008),        " Åú´Î¹ÜÀí
           YCHPF(001),        " ÅúÁ¿¹ÜÀí
            TRAGR(006),        " ÔËÊä×é
            ladgr(006),        " ×°ÔØ×é
    **²É¹º**
           BSTME(003),        " ¶©µ¥µ¥Î»
           UMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           UMREN(006),        " ¶©µ¥µ¥Î»×ª»»Òò×Ó
           WEBAZ(003),        " ÊÕ»õ´¦Àíʱ¼ä
            EKGRP(006),        " ²É¹º×é
          LGORT(004),        " ¿â´æµØ
    **Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
           AUSME(003),        " ·¢»õµ¥Î»
           UMREJ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           UMREF(006),        " ·¢»õµ¥Î»×ª»»Òò×Ó
           XCHPF(001),        " ÅúÁ¿¹ÜÀí
    **MRP 1**
           DISGR(004),        " MRP×é
            DISMM(009),        " MRPÀàÐÍ
           FXHOR(003),        " ¼Æ»®µÄʱ½ì
            DISPO(011),        " MRP¿ØÖÆÕß
            DISLS(004),        " ÅúÁ¿
            MAABC(007),        " ABC±êʶ
           BSTFE(018),        " ¹Ì¶¨ÅúÁ¿´óС
    **MRP 2**
           RESKZ(001),        " »ñÈ¡ÀàÐÍ
            BESKZ(008),        " ²É¹ºÀàÐÍ
           SOBSL(002),        " ÌØÊâ²É¹ºÀà
           LGPRO(004),        " ·¢»õ²Ö´¢µØµã
           RGEKZ(001),        " ·´³å
            PLIFZ(012),        " ¼Æ»®½»»õʱ¼ä
           VEBAZ(003),        " ÊÕ»õ´¦Àíʱ¼ä
            DZEIT(008),        "×ÔÖÆÉú²ú
            FHORI(010),        " ¼Æ»®±ß¼ÊÂë
           EISBE(018),        " °²È«¿â´æ
    **MRP 3**
            PERKZ(008),        " ÆÚ¼ä±êʶ
            STRGR(006),        " ²ßÂÔ×é
           VRMOD(001),        " ÏûºÄģʽ
           VINT1(003),        " ÄæÏòÏûºÄÆÚ¼ä
           VINT2(003),        " ÏòÇ°ÏûºÄÆÚ¼ä
            NTVFP(010),        " ¿ÉÓÃÐÔ¼ì²é
    **MRP 4**
           SAUFT(001),        " Öظ´ÖÆÔì±êÖ¾
           SFEPR(004),        " Öظ´Éú²ú²ÎÊýÎļþ
    **¹¤×÷¼Æ»®**
           FEVOR(003),        " Éú²úµ÷¶ÈÔ±
           FRTME(003),        " Éú²úµ¥Î»
           SMREZ(006),        " »ù±¾µ¥Î»×ª»»Òò×Ó
           SMREN(006),        " Éú²úµ¥Î»×ª»»Òò×Ó
           UEETK(001),        " ÎÞÏÞÖƹýÁ¿½»»õ
    **»á¼Æ 1**
            BKLAS(006),        " ÆÀ¹ÀÀà
           BWTTY(001),        " ¹À¼Û·ÖÀà
            VPRSV(008),        " ¼Û¸ñ¿ØÖÆ
            PEINH(008),        " ¼Û¸ñµ¥Î»
            VERPR(015),        " Òƶ¯Æ½¾ù¼Û
            STPRS(015),        " ±ê×¼¼Û
    **»á¼Æ 2**
           BWPRH(014),        " ÉÌÒµ¼Û¸ñ 1
    **³É±¾ 1**
           LOSGR(018),        " ÅúÁ¿³É±¾ºËËã
    **³É±¾ 2**
           ZPLP1(014),        " ¼Æ»®¼Û¸ñ 1
           ZPLD1(010),        " ¼Æ»®ÈÕÆÚ 1
    **ÖÊÁ¿¹ÜÀí**
            ART1(8),            "¼ìÑéÀàÐÍ1
            AKTIV1(6),          "ÒѼ¤»î
            QMPUR(010),             "¼¤»î²É¹ºÖÐµÄ QM
            SSQSS(8),          "QM ¿ØÖÆÂë¡¢
           QMATV(8),          "QM¼ìÑéÉèÖÃ
           ART2(8),            "¼ìÑéÀàÐÍ2
           AKTIV2(6),          "ÒѼ¤»î
           ART3(8),            "¼ìÑéÀàÐÍ3
           AKTIV3(6),          "ÒѼ¤»î
          end of record1.
    selection-screen begin of block 0 with frame title text-001.
    selection-screen begin of line .
    selection-screen position 1.
    parameters: test like rkec1-test .
    selection-screen
      comment 3(4) text-004 for field test.
    selection-screen position 26.
    parameters: oldfile like rlgrap-filename.
    selection-screen
      comment 9(17) text-003 for field oldfile.
    selection-screen: end of line.
    selection-screen begin of line.
    selection-screen position 1.
    parameters: dnldflag like rkec1-test default 'X'.
    selection-screen
      comment 3(4) text-005 for field dnldflag.
    selection-screen position 26.
    parameters: outfile like rlgrap-filename .
    selection-screen
      comment 9(17) text-006 for field outfile.
    selection-screen: end of line.
    selection-screen end of block 0 .
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-002.
    selection-screen begin of line.
    selection-screen position 1.
    PARAMETERS: GEN1 LIKE RKEC1-TEST.
    selection-screen
      comment 3(9) text-007 for field GEN1.
    selection-screen position 26.
    PARAMETERS: GEN2 LIKE RKEC1-TEST.
    selection-screen
      comment 28(9) text-008 for field GEN2.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen position 1.
    PARAMETERS: SALORG1 LIKE RKEC1-TEST.
    selection-screen
      comment 3(21) text-009 for field SALORG1.
    selection-screen position 26.
    PARAMETERS: SALORG2 LIKE RKEC1-TEST.
    selection-screen
      comment 28(21) text-010 for field SALORG2.
    selection-screen position 51.
    PARAMETERS: SALPLANT LIKE RKEC1-TEST.
    selection-screen
      comment 53(19) text-011 for field SALPLANT.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen position 1.
    PARAMETERS: PURCHASE LIKE RKEC1-TEST.
    selection-screen
      comment 3(21) text-012 for field PURCHASE.
    selection-screen position 26.
    PARAMETERS: PLTSTRG1 LIKE RKEC1-TEST.
    selection-screen
      comment 28(21) text-018 for field PLTSTRG1.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen position 1.
    PARAMETERS: MRP1 LIKE RKEC1-TEST.
    selection-screen
      comment 3(4) text-013 for field MRP1.
    selection-screen position 13.
    PARAMETERS: MRP2 LIKE RKEC1-TEST.
    selection-screen
      comment 15(4) text-014 for field MRP2.
    selection-screen position 26.
    PARAMETERS: MRP3 LIKE RKEC1-TEST.
    selection-screen
      comment 28(4) text-015 for field MRP3.
    selection-screen position 37.
    PARAMETERS: MRP4 LIKE RKEC1-TEST.
    selection-screen
      comment 39(4) text-016 for field MRP4.
    selection-screen position 51.
    PARAMETERS: PLANTSTR LIKE RKEC1-TEST.
    selection-screen
      comment 53(8) text-017 for field PLANTSTR.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen position 1.
    PARAMETERS: QAU LIKE RKEC1-TEST.
    selection-screen
      comment 3(8) text-023 for field QAU.
    selection-screen position 13.
    PARAMETERS: ACC1 LIKE RKEC1-TEST.
    selection-screen
      comment 15(5) text-019 for field ACC1.
    selection-screen position 26.
    PARAMETERS: ACC2 LIKE RKEC1-TEST.
    selection-screen
      comment 28(5) text-020 for field ACC2.
    selection-screen position 37.
    PARAMETERS: COR1 LIKE RKEC1-TEST.
    selection-screen
      comment 39(5) text-021 for field COR1.
    selection-screen position 51.
    PARAMETERS: COR2 LIKE RKEC1-TEST.
    selection-screen
      comment 53(5) text-022 for field COR2.
    selection-screen end of line.
    SELECTION-SCREEN END OF BLOCK 1.
    at selection-screen on value-request for oldfile.
      call function 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = ',Îı¾Îļþ(ÖƱí·û·Ö¸ô),*.txt'
                static    = 'X'
           CHANGING
                file_name = oldfile.
    at selection-screen on value-request for outfile.
      call function 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = ',Microsoft Excel¹¤×÷²¾,*.xls'
                static    = 'X'
           CHANGING
                file_name = outfile.
    initialization.
    ******µÃµ½ÎļþĿ¼*******
      call function 'WS_QUERY'
           EXPORTING
                query  = 'CD'
           IMPORTING
                return = outfile.
      if sy-subrc <> 0.
        message e005 with outfile.
      endif.
      oldfile = outfile.
      concatenate outfile 'mat_fat' into outfile.
    *ÅúÊäÈëĬÈÏÃû³Æ
      group = 'MATBATCHIN'.
    start-of-selection.
      if dnldflag eq 'X' and not ( outfile is initial ).
        perform download_data.
        stop.
      endif.
      perform upload_data.
      if test = ' '.
    *ÊÓͼ²ÎÊý¼ì²é
        IF ( GEN1 NE 'X' AND GEN2 NE 'X' AND SALORG1 NE 'X'
           AND SALORG2 NE 'X' AND SALPLANT NE 'X'
           AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
           AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
               AND MRP4 NE 'X' AND PLANTSTR NE 'X'
           AND ACC1 NE 'X' AND ACC2 NE 'X'
           AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
          MESSAGE E000 WITH 'ÇëÑ¡ÔñÐèά»¤ÊÓͼ'.
        ENDIF.
        perform open_group.
        SORT RECORD BY WERKS MATNR.
        loop at record.
          perform bdc_fill.
          perform bdc_transaction using 'MM01'.
          clear: bdcdata.
          refresh: bdcdata.
        endloop.
        perform close_group.
      else.
        perform file_check.
      endif.
    end-of-selection.
    *&      Form  UPLOAD_DATA
          ÉÏÔØÅúÊäÈëÊý¾Ý
    -->  p1        text
    <--  p2        text
    form upload_data.
      call function 'WS_UPLOAD'
           EXPORTING
                filename                = oldfile
                filetype                = 'DAT'
           TABLES
                data_tab                = record
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_table_width     = 4
                invalid_type            = 5
                no_batch                = 6
                unknown_error           = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                others                  = 10.
      if sy-subrc <> 0.
        message E000 with 'ÇëÊäÈëÉÏÔØÎļþ'.
      endif.
      read table record with key MATNR = '**'.
      if sy-tabix lt 1.
        message E000 with 'ÉÏÔØÎļþÎļþÍ·ÓëÊý¾ÝÖ®¼äÎÞ**'.
      endif.
      delete record from 1 to sy-tabix.
    endform.                               " UPLOAD_DATA
    *&      Form  BDC_FILL
          ÅúÊäÈë
    -->  p1        text
    <--  p2        text
    form bdc_fill.
      data: N type I,
            M type I,
            S_MATNR(018),
            test(1) type N.
      PERFORM BDC_FILL_INITALSCR.    "³õʼÆÁÄ»
      tmp = '0'.
      condense record-matnr no-gaps.
      test =  record-matnr(1).
      if test <> ''.
        M = STRLEN( RECORD-MATNR ).
        M = 18 - M.
        DO M TIMES.
          CONCATENATE '0' RECORD-MATNR INTO S_MATNR.
          RECORD-MATNR = S_MATNR.
        ENDDO.
      endif.
    **ÅжÏÎïÁÏ»ù±¾ÊÓͼÊÇ·ñÒѾ±»Î¬»¤¹ý**
      SELECT SINGLE * FROM MARA WHERE MATNR = RECORD-MATNR.
      IF SY-SUBRC NE 0.
        K = '0'.
      Else.
        condense MARA-PSTAT no-gaps.
        N = strlen( mara-pstat ).
        M = 0.
        record-meins = mara-meins.
        do N times.
          K = MARA-PSTAT+M.
          IF K = 'K'.
            EXIT.
          ENDIF.
          M = M + 1.
        enddo.
      ENDIF.
      IF ( ( GEN1 EQ 'X' OR GEN2 EQ 'X' ) AND SALORG1 NE 'X'
         AND SALORG2 NE 'X' AND SALPLANT NE 'X'
         AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
         AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
             AND MRP4 NE 'X' AND PLANTSTR NE 'X'
         AND ACC1 NE 'X' AND ACC2 NE 'X'
         AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
        IF K EQ 'K'.
          perform bdc_dynpro      using 'SAPLMGMM' '0070'.
          perform bdc_field       using 'BDC_CURSOR'
                                        'MSICHTAUSW-DYTXT(15)'.
          perform bdc_field       using 'BDC_OKCODE'
                                        '/N'.
        ELSE.
          PERFORM BDC_FILL_CHOICEVIEW.   "Ñ¡ÔñÊÓͼ
        ENDIF.
      ELSE.
        PERFORM BDC_FILL_CHOICEVIEW.   "Ñ¡ÔñÊÓͼ
        PERFORM BDC_FILL_ORGVIEW.      "×éÖ¯¼¶±ð
      ENDIF.
      TRANSLATE record-MEINS TO UPPER CASE.
    TRANSLATE record-BSTME TO UPPER CASE.
    TRANSLATE record-VRKME TO UPPER CASE.
    TRANSLATE record-FRTME TO UPPER CASE.
    TRANSLATE record-AUSME TO UPPER CASE.
      if gen1 eq 'X'.
        IF K NE 'K'.
          PERFORM GENERALDATA1.
        ENDIF.
      endif.
      if gen2 eq 'X'.
        IF K NE 'K'.
          perform generaldata2.
        ENDIF.
      endif.
      if salorg1 eq 'X'.
        perform salorg1.
      endif.
      if salorg2 eq 'X'.
        perform salorg2.
      endif.
      if salplant eq 'X'.
        perform salplant.
      endif.
      if purchase eq 'X'.
        perform purchasedata.
      endif.
      if mrp1 eq 'X'.
        perform MRP1.
      endif.
      if mrp2 eq 'X'.
        perform MRP2.
      endif.
      if mrp3 eq 'X'.
        perform MRP3.
      endif.
      if mrp4 eq 'X'.
        perform MRP4.
      endif.
      if PLANTSTR eq 'X'.
        perform PLANTSTR.
      endif.
      if PLTSTRG1 eq 'X'.
        perform PLTSTRG1.
      endif.
      if qau eq 'X'.
        perform qualitydata.
      endif.
      if ACC1 eq 'X'.
        perform ACC1DATA.
      endif.
      if ACC2 eq 'X'.
        perform ACC2DATA.
      endif.
      if COR1 eq 'X'.
        perform COR1DATA.
      endif.
      if COR2 eq 'X'.
        perform COR2DATA.
      endif.
      perform BDC_SAVE.
    endform.                               " BDC_FILL
    *&      Form  GENERALDATA1
          Ò»°ãÊý¾Ý 1
    -->  p1        text
    <--  p2        text
    form generaldata1.
      perform bdc_dynpro      using 'SAPLMGMM' '4004'.
      perform bdc_field       using 'BDC_OKCODE'
                                    "'=ZU01'.
                                    '/00'.
      perform bdc_field       using 'MAKT-MAKTX'
                                    record-MAKTX.       " ÎïÁÏÃèÊö
      perform bdc_field       using 'MARA-MEINS'
                                    record-MEINS.       " »ù±¾¼ÆÁ¿µ¥Î»
      perform bdc_field       using 'MARA-MATKL'
                                    record-MATKL.       " ÎïÁÏ×é
      perform bdc_field       using 'MARA-BISMT'
                                    record-BISMT.
    perform bdc_field       using 'MARA-EXTWG'
                                   record-EXTWG.
    perform bdc_field       using 'MARA-SPART'
                                   record-SPART.
      perform bdc_field       using 'MARA-MTPOS_MARA'
                                    record-MTPOS_MARA.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MARA-GROES'.
      perform bdc_field       using 'MARA-BRGEW'
                                    record-BRGEW.
      if record-gewei = '' and ( salorg1 = 'X' or salorg2 = 'X'
                           or salplant = 'X' ).
        perform bdc_field       using 'MARA-GEWEI'
                                      'KG'.              " ÖØÁ¿µ¥Î»
      else.
        perform bdc_field       using 'MARA-GEWEI'
                                      record-GEWEI.      " ÖØÁ¿µ¥Î»
      endif.
      perform bdc_field       using 'MARA-NTGEW'
                                    record-NTGEW.
      perform bdc_field       using 'MARA-VOLUM'
                                    record-VOLUM.
      perform bdc_field       using 'MARA-VOLEH'
                                    record-VOLEH.
      perform bdc_field       using 'MARA-GROES'
                                    record-GROES.
    condense record-EAN11 no-gaps.
    if record-EAN11 <> ''.
       perform bdc_field       using 'MARA-EAN11'
                                     record-EAN11.
       perform bdc_field       using 'MARA-NUMTP'
                                     'HT'.
    endif.
      perform bdc_field       using 'MARA-MAGRV'
                                    record-MAGRV.
    perform bdc_dynpro      using 'SAPLMGMM' '4300'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=ZU02'.
    condense record-EAKTX no-gaps.
    if record-EAKTX <> ''.
       perform bdc_field       using 'SKTEXT-SPRAS(2)'
                                     'EN'.
       perform bdc_field       using 'SKTEXT-MAKTX(2)'
                                     record-EAKTX.
    endif.
    perform bdc_dynpro      using 'SAPLMGMM' '4300'.
    perform bdc_field       using 'BDC_OKCODE'
                                   '=MAIN'.
    if record-meins <> 'PAK'.
       perform bdc_field       using 'SMEINH-UMREN(05)'
                                     '1'.
       perform bdc_field       using 'SMEINH-MEINH(05)'
                                     'PAK'.
       perform bdc_field       using 'SMEINH-UMREZ(05)'
                                     '1'.
    endif.
      perform bdc_dynpro      using 'SAPLMGMM' '4004'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
    endform.                               " GENERALDATA
    *&      Form  generaldata2
          Ò»°ãÊý¾Ý 2
    -->  p1        text
    <--  p2        text
    FORM generaldata2.
      perform bdc_dynpro      using 'SAPLMGMM' '4004'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'MAKT-MAKTX'
                                    record-MAKTX.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MARA-NORMT'.
      condense record-ferth no-gaps.
      if record-ferth <> ''.
        perform bdc_field       using 'MARA-FERTH'
                                      record-FERTH.
      endif.
      perform bdc_field       using 'MARA-NORMT'
                                    record-NORMT.
      perform bdc_field       using 'MARA-WRKST'
                                    record-WRKST.
    perform bdc_field       using 'MARA-ZEIAR'
                                   record-ZEIAR.
    ENDFORM.                    " generaldata2
    *&      Form  salorg1
          ÏúÊÛ×éÖ¯ 1
    -->  p1        text
    <--  p2        text
    FORM salorg1.
      condense RECORD-SPART no-gaps.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'MAKT-MAKTX'
                                    RECORD-MAKTX.     " ÎïÁÏÃèÊö
      IF K NE 'K'.
        perform bdc_field       using 'MARA-MEINS'
                                      record-MEINS.   " »ù±¾¼ÆÁ¿µ¥Î»
      ENDIF.
      perform bdc_field       using 'MARA-SPART'
                                    record-SPART.     " ²úÆ·×é
      perform bdc_field       using 'MVKE-DWERK'
                                    record-DWERK.     " ½»»õ¹¤³§
      PERFORM BDC_FIELD       USING 'MG03STEUER-TAXKM(01)'
                                    RECORD-TAXKM.     " ÎïÁÏË°·ÖÀà
    condense RECORD-VRKME no-gaps.
    IF RECORD-MEINS <> RECORD-VRKME and RECORD-VRKME <> ''.
       perform bdc_field       using 'MVKE-VRKME'
                                     record-VRKME.     " ÏúÊÛµ¥Î»
       select single * from MARM where matnr = record-matnr
                     and meinh = record-vrkme.
       if SY-SUBRC NE 0.
         tmp = 'W'.
         select single * from t006 where MSEHI = record-meins.
         if t006-DIMID = 'AAAADL'.
           DIMID = ''.
         else.
           DIMID = t006-DIMID.
         endif.
         select single * from t006 where MSEHI = record-vrkme.
         if dimid <> t006-DIMID.
           PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0510'.
           PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '=ENTR'.
           perform bdc_field       using 'RMMZU-UMREN'
                                         record-VMREN.  "ÏúÊÛµ¥Î»×ª»»Òò×Ó
           perform bdc_field       using 'RMMZU-UMREZ'
                                         record-VMREZ.  "»ù±¾µ¥Î»×ª»»Òò×Ó
           PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
           PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '/00'.
         endif.
       endif.
    ENDIF.
      perform bdc_dynpro      using 'SAPLMGMM' '4200'.
      perform bdc_field       using 'BDC_OKCODE'      " µ÷ÓÃË°Àà×ÓÆÁÄ»
                                    '/00'.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'      " ·µ»ØÏúÊÛ×éÖ¯ 1ÆÁÄ»
                                    '/00'.
    ENDFORM.                                                    " salorg1
    *&      Form  salorg2
          ÏúÊÛ×éÖ¯ 2
    -->  p1        text
    <--  p2        text
    FORM salorg2.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'MVKE-KTGRM'.
    PERFORM BDC_FIELD       USING 'MVKE-VERSG'
                                   RECORD-VERSG.     " ÎïÁÏͳ¼Æ×é
      PERFORM BDC_FIELD       USING 'MVKE-KTGRM'
                                    RECORD-KTGRM.     " ¿ÆÄ¿ÉèÖÃ×é
      PERFORM BDC_FIELD       USING 'MVKE-KONDM'
                                    RECORD-KONDM.     " ÎïÁ϶¨¼Û×é
      perform bdc_field       using 'MVKE-MTPOS'
                                    RECORD-MTPOS.     " ÏîÄ¿Àà±ð×é
    PERFORM BDC_FIELD       USING 'MVKE-MVGR1'
                                   RECORD-MVGR1.               " ÎïÁÏ×é 1
    PERFORM BDC_FIELD       USING 'MVKE-MVGR2'
                                   RECORD-MVGR2.               " ÎïÁÏ×é 2
    ENDFORM.                                                    " salorg2
    *&      Form  salplant
          ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý
    -->  p1        text
    <--  p2        text
    FORM salplant.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      select single * from marc where matnr = record-matnr
                                  and werks = record-werks.
      if SY-SUBRC NE 0  OR  MARC-MTVFP = ''.
        PERFORM BDC_FIELD       USING 'MARC-MTVFP'
                                      RECORD-MTVFP.     " ¿ÉÓÃÐÔ¼ì²é
      endif.
      PERFORM BDC_FIELD       USING 'MARA-TRAGR'
                                      RECORD-TRAGR.   " ÔËÊä×é
      PERFORM BDC_FIELD       USING 'MARC-LADGR'
                                    RECORD-LADGR.     " ×°ÔØ×é
      perform bdc_field       using 'MARC-XCHPF'
                                    record-XCHPF.     " ÅúÁ¿¹ÜÀí
    ENDFORM.                    " salplant
    *&      Form  PURCHASEDATA
          ²É¹ºÊý¾Ý
    -->  p1        text
    <--  p2        text
    form purchasedata.
      perform bdc_dynpro      using 'SAPLMGMM' '4000'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MARC-WEBAZ'.
      perform bdc_field       using 'MAKT-MAKTX'
                                    record-MAKTX.
      IF K NE 'K'.
        perform bdc_field       using 'MARA-MEINS'
                                      record-MEINS.     " »ù±¾¼ÆÁ¿µ¥Î»
        perform bdc_field       using 'MARA-MATKL'
                                      record-MATKL.     " ÎïÁÏ×é
      ENDIF.
    condense RECORD-BSTME no-gaps.
    IF RECORD-MEINS <> RECORD-BSTME and RECORD-BSTME <> ''.
       perform bdc_field       using 'MARA-BSTME'
                                     record-BSTME.     " ¶©µ¥µ¥Î»
       select single * from MARM where matnr = record-matnr
                     and meinh = record-bstme.
       if SY-SUBRC NE 0 and
             ( record-vrkme <> record-bstme or tmp <> 'W' ).
         tmp = 'W'.
         select single * from t006 where MSEHI = record-meins.
         if t006-DIMID = 'AAAADL'.
           DIMID = ''.
         else.
           DIMID = t006-DIMID.
         endif.
         select single * from t006 where MSEHI = record-bstme.
         if dimid <> t006-DIMID.
           PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0510'.
           PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '=ENTR'.
           perform bdc_field       using 'RMMZU-UMREN'
                                         record-UMREN.  "¶©µ¥µ¥Î»×ª»»Òò×Ó
           perform bdc_field       using 'RMMZU-UMREZ'
                                         record-UMREZ.  "»ù±¾µ¥Î»×ª»»Òò×Ó
           PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4000'.
           PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '/00'.
         endif.
       endif.
    ENDIF.
      perform bdc_field       using 'MARC-EKGRP'
                                    record-EKGRP.       " ²É¹º×é
    perform bdc_field       using 'MARC-WEBAZ'
                                   record-WEBAZ.       " ÊÕ»õ´¦Àíʱ¼ä
    endform.                               " PURCHASEDATA
    *&      Form  MRP1
          text
    -->  p1        text
    <--  p2        text
    FORM MRP1.
      perform bdc_dynpro      using 'SAPLMGMM' '4000'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   record-MAKTX.       " ÎïÁÏÃèÊö
    IF K NE 'K'.
       perform bdc_field       using 'MARA-MEINS'
                                     record-MEINS.     " »ù±¾µ¥Î»
    ENDIF.
    perform bdc_field       using 'MARC-DISGR'
                                   record-DISGR.       " MRP×é
      perform bdc_field       using 'MARC-MAABC'
                                    record-MAABC.       " ABC±êʶ
      perform bdc_field       using 'MARC-DISMM'
                                    record-DISMM.       " MRPÀàÐÍ
    perform bdc_field       using 'MARC-FXHOR'
                                   record-FXHOR.       " ¼Æ»®µÄʱ½ì
      perform bdc_field       using 'MARC-DISPO'
                                    record-DISPO.       " MRP¿ØÖÆÕß
      perform bdc_field       using 'MARC-DISLS'
                                    record-DISLS.       " ÅúÁ¿
    perform bdc_field       using 'MARC-BSTFE'
                   

    Here is a sample program which creates a material with the bare minmal fields,  this will get you started.
    report zrich_0003 .
    data: headdata type bapimathead.
    data: clientdata type bapi_mara.
    data: clientdatax type bapi_marax.
    data: descdata type table of BAPI_MAKT with header line.
    data: return type  bapiret2 .
    data: returnm type table of bapi_matreturn2 with header line.
    data: xmara type mara.
    parameters: p_matnr type mara-matnr.
    headdata-material        = p_matnr.
    headdata-ind_sector      = 'M'.
    headdata-matl_type       = 'FERT'.
    headdata-basic_view = 'X'.
    clientdata-BASE_UOM   = 'EA'.
    clientdatax-BASE_UOM   = 'X'.
    clientdata-old_mat_no = 'Old Material'.
    clientdatax-old_mat_no = 'X'.
    clientdata-division = '00'.
    clientdatax-division = 'X'.
    descdata-LANGU = sy-langu.
    descdata-MATL_DESC = 'This is the description'.
    append descdata.
    call function 'BAPI_MATERIAL_SAVEDATA'
      exporting
        headdata                   = headdata
        clientdata                 = clientdata
        clientdatax                = clientdatax
    *   PLANTDATA                  =
    *   PLANTDATAX                 =
    *   FORECASTPARAMETERS         =
    *   FORECASTPARAMETERSX        =
    *   PLANNINGDATA               =
    *   PLANNINGDATAX              =
    *   STORAGELOCATIONDATA        =
    *   STORAGELOCATIONDATAX       =
    *   VALUATIONDATA              =
    *   VALUATIONDATAX             =
    *   WAREHOUSENUMBERDATA        =
    *   WAREHOUSENUMBERDATAX       =
    *   SALESDATA                  =
    *   SALESDATAX                 =
    *   STORAGETYPEDATA            =
    *   STORAGETYPEDATAX           =
    importing
       return                     = return
      tables
        MATERIALDESCRIPTION        = descdata
    *   UNITSOFMEASURE             =
    *   UNITSOFMEASUREX            =
    *   INTERNATIONALARTNOS        =
    *   MATERIALLONGTEXT           =
    *   TAXCLASSIFICATIONS         =
        returnmessages             = returnm
    *   PRTDATA                    =
    *   PRTDATAX                   =
    *   EXTENSIONIN                =
    *   EXTENSIONINX               =
    check sy-subrc  = 0.
    Regards,
    Rich Heilman

  • Uploading Material Master data from legacy system

    Hi all,
    do we have any sap defined bdc for material master data ,if no ho to do that can anybody explain me step by step procedure how to do that
    Thanks in advance
    Santosh R

    Santosh,
    Use BAPI as we already have pre-defined BAPI for material upload given by SAP.
    <b>BAPI_MATERIAL_SAVEDATA</b>
    Also check this BAPI in MM01 uploading for the complete code I have written.
    Regards
    Aneesh.

  • Which table could i find 'Authorization Group'  used for Material master?

    Hi experts,
    Is there any table available could i find all 'Authorization Group' list as used by material master data.
    OR in SPRO, anywhere could i find 'Define authorization group' for material master data specific??
    Thanks.

    Hi
    Authorization group in the material master are maintained at the material type level.
    SPRO->IMG-> Logistics - General-> Material Master-> Basic Settings-> Material Types-> Define Attributes of Material Types
    List of authorization roups can be found in table T134-Material Types
    this filed is a free defined 4 charcter field.
    Thanks & Regards
    Kishore

Maybe you are looking for