Material master data upload in wms

Dear all ,
Kindly explain me how to upload the material master data in WMS.
Thanx in advance.
Regards,
velu

Hi Velu
You have to load this in a normal way you do it with LSMW.
Additionally you have to update the warehouse view fields too.
Select the batch input recording in LSMW and go to the MM01 transaction enter all the required fields including WM views.
If you handle material with fixed bin strategy & Replenishment scenario, you have to create a material by selecting the respective storage type in "selection view tab"
Regards
edwin

Similar Messages

  • Material Master Data upload approach

    Hi,
    I have a requirement to upload material master data into D.B
    1. Which is the best option to use - BDC/LSMW/BAPI(Program)/Direct upload program!
    2. Based on Material types fields to be uploaded will change as per sample sheet,
       Can we make use of single sheet With all fields in it(By removing common fields for all Mat.Types)!
    Will BAPI - BAPI_MATERIAL_SAVEDATA useful for both MM01/MM02!
    What is the better approach for the same!
    Thanks,
    Deep.

    Hi,
    I have 2 queations in addition to above.
    1. If i write a program using above BAPI for material master data. Then will it be better approach than LSMW with BAPI?
    In this case user will trigger Z tcode & he will select input file from desktop & execute & report log will be shown in the output with successful & unsuccessful materials.
    2. I have to upload material master data. Now i have got sample files for Basic, Plant & Sales organization specific.
    If i have single excel file (All fields in one single sheet/line) which covers all unique fields of material master related to diff Basic, Plant & Sales organization specific data & also for all diffrent material types will that be fine (or) it usually required seperate excel sheets for diffrent kinds of data!
    Please clarify about above 2 issues!
    Thanks in advance.
    Thanks,
    Deep.
    Edited by: Deep on May 12, 2009 6:56 AM

  • MATERIAL MASTER DATA UPLOADING BY LSMW

    Hi.
    I am new to lsmw.
    we have a requirement to upload the material master data through LSMW,.
    the data is on Excel sheet on the Desktop of the system.
    Can any body help me to upload the Material Master data, procedure in step wise.
    Thanks in advance,
    regards,
    Eswar.M

    http://www.sap-img.com/sap-data-migration.htm
    http://www.sapgenie.com/saptech/lsmw.htm
    http://sapabap.iespana.es/sapabap/manuales/pdf/lsmw.pdf
    http://www.sap.info/public/INT/int/glossary/int/glossaryletter/Word-17643ed1d6d658821_glossary/L#Word-17643ed1d6d658821_glossary

  • MATERIAL MASTER DATA UPLOADING THROUGH  LSMW

    Hi.
    I am new to lsmw.
    we have a requirement to upload the material master data through LSMW,.
    the data is on Excel sheet on the Desktop of the system.
    Can any body help me to upload the Material Master data, procedure in step wise.
    Thanks in advance,
    regards,
    Eswar.M

    Hi Venkat,
    Go through the following Steps
    Using Tcode MM01 -- Maintain the source fields are
    1) mara-amtnr  char(18)
    2) mara-mbrsh  char(1)
    3) mara-mtart  char(4)
    4) makt-maktx  char(40)
    5) mara-meins  char(3)
    the flate file format is like this as follows
    MAT991,C,COUP,Srinivas material01,Kg
    MAT992,C,COUP,Srinivas material02,Kg
    AMT993,C,COUP,Srinivas material03,Kg
    MAT994,C,COUP,Srinivas material04,Kg
    MAT995,C,COUP,Srinivas material05,Kg
    goto Tcode LSMW
    give Project Name
         Subproject Name
         object Name
    Press Enter -
    Press Execute Button
    It gives 13 radio-Button Options
    do the following 13 steps as follows
    1) select radio-Button 1 and execute
       Maintain Object Attributes
    select Standard Batch/Direct Input
       give Object -- 0020
           Method -- 0000
       save & Come Back
    2) select radio-Button 2 and execute
       Maintain Source Structures
       select the source structure and got to click on create button
       give source structure name & Description
       save & Come Back
    3) select radio-Button 3 and execute
       Maintain Source Fields
       select the source structure and click on create button
       give
       first field
            field name    matnr
            Field Label   material Number
            Field Length  18
            Field Type    C
       Second field
            field name    mbrsh
            Field Label   Industrial Sector
            Field Length  1
            Field Type    C
       Third field
            field name    mtart
            Field Label   material type
            Field Length  4
            Field Type    C
       fourth field
            field name    maktx
            Field Label   material description
            Field Length  40
            Field Type    C
       fifth field
            field name    meins
            Field Label   base unit of measurement
            Field Length  3
            Field Type    C
      save & come back
    4) select radio-Button 4 and execute
       Maintain Structure Relations
       go to blue lines 
          select first blue line and click on create relationship button
          select Second blue line and click on create relationship button
          select Third blue line and click on create relationship button
      save & come back
    5) select radio-Button 5 and execute
       Maintain Field Mapping and Conversion Rules
       Select the Tcode and click on Rule button there you will select constant
       and press continue button
       give Transaction Code : MM01 and press Enter
       after that
       1) select MATNR field click on Source filed(this is the field mapping) select MATNR and press Enter
       2) select MBRSH field click on Source filed(this is the field mapping) select MBRSH and press Enter
       3) select MTART field click on Source filed(this is the field mapping) select MTART and press Enter
       4) select MAKTX field click on Source filed(this is the field mapping) select MAKTX and press Enter
       5) select MEINS field click on Source filed(this is the field mapping) select MEINS and press Enter
      finally     
      save & come back
    6) select radio-Button 6 and execute
       Maintain Fixed Values, Translations, User-Defined Routines
       Create FIXED VALUE Name & Description as MM01
       Create Translations Name & Description as MM01
       Create User-Defined Routines Name & Description as MM01
       after that delete  all the above three just created in the 6th step
       FIXED VALUE --MM01
       Translations --MM01
       User-Defined Routines --MM01
       come back
    7) select radio-Button 7 and execute
       Specify Files
       select On the PC (Frontend) -- and click on Create button(f5)
                                      give the path of the file like "c:\material_data.xls"
                                      description : -
                                      separators as select tab radiao- button
       and press enter   save & come back
    8) select radio-Button 8 and execute
       Assign Files
       Save & come back
    9) select radio-Button 9 and execute
       Read Files
       Execute
       come back
       come back
    10) select radio-Button 10 and execute
        Display Imported Data
        Execute and press enter
        come back
        Come back
    11) select radio-Button 11 and execute
        Convert Data
        Execute
        come back
        Come back
    12) select radio-Button 12 and execute
        Display Converted Data
        Execute & come back
    13) select radio-Button 13 and execute
        Start Direct Input Program
       select the Program
       select continue button
    go with via physical file
    give the lock mode as 'E'
    and execute
    Regards
    Sreeni

  • Problem with Material Master Data Upload using MM01?

    Dear Abapers,
    I done recording for uploading Material Master using MM01. I selected respective views at the time of recording. Then at the time of uploading it is not selecting the Quality view and Account1 view. Even I used 'P+' function code. it is working but not selecting the 2 views. Manually, if I select those 2 views uploading successfully.
    Could you please let me clear on this issue?
    Regards,
    Sekhar

    Hi Chandrasekar,
      Scrolling in the view-selecting screen wont be recorded during SHBD ( Recording ).So you need to first select Basic data1 rather than Accounting 1 or Quality management.Once you are in the basic data screen, fill the required description( if its unavailable ) and then choose the accounting 1 or quality tab.Do a fresh recording with the above approach, your issue should be solved.
    Regards,
    Kiran
    Edited by: Kiran NN on Feb 29, 2008 11:02 AM

  • 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.

  • Upload material master data

    Hi friends,
    can u provide prog for upload material master data by using bapi bapi_material_savedata.
    i need to pass the following fields .
                    MARA-MATNR
               MARA-MBRSH
                  MARA-MTART
                MARA-MATKL
                 MARA-MEINS
              MAKT-SPRAS
                MAKT-MAKTX
                MVKE-VKORG
              MVKE-VTWEG
                    MVKE-MTPOS
                 MARA-TRAGR
                          MARC-WERKS
               MARC-EKGRP
                   MBEW-BWKEY   and also using dynamic internal table.

    Hi siddu,
    As a developer you should ask for the code.
    Try u r self writing the code.If u struck any where just post the question.
    There wil be many threads regrading material master data.
    Give ur bapi BAPI_MATERIAL_SAVEDATA and search in the forum then u will get so many threads.
    serach from there and write accrding to ur req.
    Thanks,

  • Error in uploading the material master data

    HI friends,
    I have trasferred the material master data through idocs from one server to another server(with in SAP only).
    Outbound side the status of idoc is 3 which is OK.But inbound side ,the status is 51 and the error is 'Function module not allowed  IDOC_INPUT_MATMAS01'.I debugged the function module in which the control records , data records are getting transferred correctly and also the segments data is also fine.But , i am not able to rectify  the error.
    Can anybody give the solut

    Hi mahesh,
    check the proces code may be having the FM module 'IDOC_INPUT_MATMAS01'. change with some other FM for processing the IDOC. you need check with different ways what is the problem. better dont stick on one thought.
    ~linganna

  • Uploading picture to the material master data

    Hi friends,
    I searched the forum about this subject, however there are mostly answers related to retail sector.
    I'd like to learn if ECC 6.0 could only itself is able to this. I mean is ECC 6.0 enough to add pictures to material master data or is there any configuration or customization requirement for that?
    Thanks in advance.
    Best regards,
    Yusuf Gezer

    yes, it is possible to store images to the materials. here you have at least 2 options, DMS and GOS.
    DMS is document manament system, here it is even possible to classify the images for a better search. GOS is generic object services which is available in the maintenace transactions for material master and several other objects. Pretty easy to use, but....you cannot search for the images, you always have to go into the material and fom there you have to open the GOS to see whether an image exists or not.
    further you should think about the place where you store these images and other attachments, I mean in SAP table system or in an optical disc system linked to SAP, which is much cheaper diskspace than the SAP tablespace.
    A migration from DMS to DMS is relatively easy and can be accomplished with IDOCs via LSWM or ALE scenario.
    Migration of GOS attachements is challenging. Nothing ready for use exists in SAP to do it.

  • Guidance for getting material master data from database table

    Hi,
    I need guidance to fetch following Material master data from the system data base.Please guide me for the same.
    BASIC DATA1
    BASIC DATA2
    MRP1,2,3,4
    WORK SCHEDULING
    QUALITY MANAGEMENT
    ACCOUNTING1
    ACCOUNTING2
    COSTING1,2
    PURCHASING
    PURCHASE ORDER TEXTSALES ORG1,2
    SALES GENERAL/PLANT
    PLANT DATA/STOR.1,2
    WAREHOUSE MGMNT1,2
    Also please tell me in general what is the reason for error while uploading the data into system using BAPi(AM talking about return message error).
    Thank you.
    Edited by: sanu debu on Feb 24, 2009 12:41 PM
    Edited by: sanu debu on Feb 24, 2009 12:42 PM

    Use BAPI's 
    BAPI_MATERIAL_GET_DETAIL
    BAPI_MATERIAL_GETALL
    BAPI_MATERIAL_GET_ALL

  • Master data upload into SAP system

    Hello,
    I want to know if there is any standard method to upload material master, customer master, vendor master and finance master data into SAP system.
    I am not referring to LSMW's, BDC's and using BAPI's. I am aware of standard programs like RMDATIND for material master upload, RFBIDE00 for customer master upload and RFBIKR00 for vendor master upload. But these are using direct input method and SAP recommends this only for testing purpose. I am not sure if this could be really used in actual live scenarios.
    From some other posts in the forum, I came to know about some transactions like BDLR, SXDB and BMVO. Can some one tell me how to use these T.Codes?
    If some one has any detailed documentation on these T.codes or in general standard master data upload techniques please send it to [email protected]
    Thanks in advance,
    CMV

    Hi,
    Define the following attributes, using the F4 input help and F1 field help:
    Report
    Name of a registered program for this program type
    Variant
    You can only specify a variant with programs that are started directly.
    With direct input, data from the data transfer file undergoes the same checks as with the online transaction and is then transferred directly into the SAP System. The database is updated directly with the transferred data.
    For the documentation of other transactions please refer the correponding program documentation..which is more helpful,
    <b>Reward points if helpful,</b>
    Regards,
    jinesh

  • Material Master Photo Upload

    Hi SAP Gurus:
    Is there any way to upload JPEG picture in material master data. I know we can upload acad (autocad drawing ) in BAsic data 2 of MM master data.
    With Regards,
    Abhijit

    Hi Abhijeet,
    You can attach the Documents to Material Master Using Services for Object Option which is available in the Material master top left corner. Just Select and click on Create attachment button.
    If you dont have Services for Object option in mm screen then go to Menu bar System and Select Services for Object and click on create attachment.
    Reg,
    Ashok

  • Requirement in conversion of material master data

    i have a requirement in conversion of material master data, what do i need to do in this, do i need to use the LSMW or BDC for this scenario can any one help me in this issue.

    Hi Rocky,
    You can go for either of these two methods.Conversion in the sense you are going to create one upload program for MM01 and will upload the data using the program
    But I suggest go for BDC.Because in LSMW you can not capture all the views for material master.
    I am writing steps(BDC recording) for this.Just follow if helpful:
    1.Go to SHDB t-code.
    2.Press NEW RECORDING
    3.enter recording name,Transaction code(MM01) and then press Start recording.
    This will take you to the transaction MM01,please enter the test data given by your functional consultant.Also select the views that required by client.
    4.After recording save it.
    5.After saving press program button from the menu.
    6.This will take you SE38 with the recording code.
    7.Then you do as per normal BDC program,declare internal table and map with the uploaded fields.
    Shout me for further clarification.
    Reward if helpful.
    Thank you.

  • Material Master Data load failed

    Hi All,
    I am loading material master data. I have around 8055 records in R/3. The load has failed with an error "Non-updated Idocs found in Business Information Warehouse" and asking me to process the IDocs manually. I have checked in WE05 for the IDocs and found 3 Idocs with status 64(IDoc ready to be transferred to application).
    But when I checked in the manage screen of the 0MATERIAL I could find the Transfered and Updated records as 8055. I have even checked the data in 0MATERIAL and found that all the data(8055 records) has already been uploaded.
    Why is it still showing an error(load failed) even when all the data has been uploaded? What should I do now?
    Best Regards,
    Nene.

    hi Nene/Sankar,
    for material text no language please check Note 546346 - Material texts: no selection on languages
    and for why idocs problem, check e.g Note 561880 - Requests hang because IDocs are not processed, Note 555229 - IDocs hang in status 64 for tRFC with immediate processing.
    hope this helps.
    Note 546346 - Material texts: no selection on languages
    Summary
    Symptom
    When loading material texts from R/3 into the Business Information Warehouse, you cannot select languages.
    Other terms
    DataSource, 0MATERIAL_TEXT, InfoSource, InfoObject, 0MATERIAL, SPRAS, LANGU, 0LANGU, MAT_BW, extraction, selection field, delta extraction, ALE, delta, change pointer
    Reason and Prerequisites
    As of PI/PI-A 2001_2 Support Package 6, the selection option for the 'SPRAS' field in the OLTP system was undone in the 0MATERIAL_TEXT DataSource. (Refer here to note 505952).
    Solution
    As of PI/PI-A 2002_1 Support Package 4, the 'SPRAS' field is provided for selection again with the 0MATERIAL_TEXT DataSource in the OLTP system. When loading the material texts from BW, the language is still not provided for selection in the scheduler, instead all languages of the language vector in BW are implicitly requested from the source system. However, during the delta update in the source system, the change pointers for all languages in the source system are now set to processed, regardless of whether the language was requested by BW or not.
    Import
    Support Package 4 for PI/PI-A 2002_1_31I - PI/PI-A 2002_1_45B
    Support Package 4 for PI 2002_1_46B - PI 2002_1_46C
    Support Package 3 for PI 2002_1_470
    In transaction RSA5, copy the D version of the 0MATERIAL_TEXT DataSource to the A version.
    Then replicate the DataSources for 0MATERIAL in the BW system. The 'SPRAS' field is then flagged again as a selection field in the transfer structure of the 0MATERIAL InfoSource. The transfer rules remain unchanged. Activate the transfer rules and perform a delta initialization again.
    Note 561880 - Requests hang because IDocs are not processed
    Symptom
    Data extraction in a BW or SEM BW system from an external OLTP System (such as R/3) or an internal (via DataMart) OLTP System hangs with the 'Yellow' status in the load monitor.
    After a timeout, the request status finally switches to 'Red'.
    Information IDocs with the status '64' are displayed in the 'Detail' tab.
    Other terms
    IDoc, tRFC, ALE, status 64
    Reason and Prerequisites
    Status information on load requests is transferred in the form of IDocs.
    IDocs are processed in the BW ALE model using tRFC in online work processes (DIA).
    IDoc types for BW (RSINFO, RSRQST, RSSEND) are processed immediately.
    If no free online work process is available, the IDocs remain and must then be restarted to transfer the request information.With the conversion to asynchronous processing, it can often happen that no DIA is available for tRFC for a short period of time (see note 535172).
    The IDoc status 64 can be caused by other factors such as a rollback in the application updating the IDocs. See the relevant notes.
    Furthermore, you can also display these IDocs after the solution mentioned below, however, this is only intended as information.
    You must therefore analyze the status text.
    Solution
    We recommend asynchronous processing for Business Warehouse.
    To do this, you need the corrections from note 535172 as well as note 555229 or the relevant Support Packages.
    The "BATCHJOB" entry in the TEDEF table mentioned in note 555229 is generated automatically in the BW system when you import Support Package 08 for BW 3.0B (Support Package 2 for 3.1 Content).For other releases and Support Package levels, you must manually implement the entry via transaction SE16.
    Depending on the Basis Support Package imported, you may also have to implement the source code corrections from note 555229.
    The following basic recommendations apply in avoiding bottlenecks in the dialog processing and checking of IDocs for BW:
    1. Make sure there is always sufficient DIA, that is, at least 1 DIA more than all other work processes altogether, for example, 8 DIA for a total of 15 work processes (see also note 74141).
       TIP: 2 UPD process are sufficient in BW, BW does not need any UP2.
    2. Unprocessed Info IDocs should be processed manually within the request in BW;in the 'Detail' tab, you can start each IDoc again by selecting 'Update manually' (right mouse button).
    3. Use BD87 to check the system daily (or whenever a problem arises) for IDocs that have not yet been processed and reactivate if necessary.
    However, make sure beforehand that these IDocs can actually be assigned to the current status of requests.
       TIP: Also check transaction SM58 for problematic tRFC entries.
    IMPORTANT: Notes 535172, 555229 and the above recommendations are relevant (unless otherwise specified) both for BW and for SAP source systems.

  • 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

Maybe you are looking for

  • BAPI in BPM

    hi, i am working on a scenario where i need to use BAPI_ACC_DOCUMENT_POST to post accounting documents. process has to be created where 2 text files are read 1. Header lines(s) 2. Line Items(s). In the process i need to send the data to the BAPI with

  • 802.1x EAP PEAP MSCHAPv2 on Windows 7 Client.

    I have problems autenticate a w7 client at our Enterprice WiFi network. XP, Apple clients and all SmartPhones works fine...  We use Radius assigned Vlans based on username and ream routed on our Meru Network to Navis radius as centralied point of aut

  • Custom Connector Deployment : java.lang.NoClassDefFoundError

    Hi, We have a Custom Connector for connecting to the Google System. I moved the Objects from an existing OIM System to the new one. Now, I have the following error thrown when the "Create User" Task is getting executed. Is there a way to print which

  • Partner Profile - WE20 Changes

    Hi all Can we identify the person who made the changes to the partner profile, We are having this as a major problem, someone is always changing the parameters of the partners which is impacting our bacth jobs,, so can any one help me how to identify

  • Can this be done? XML playlist

    What I want is to create a player that can handle SWFs and FLVs or just FLVs, that load from a XML playlist. Now I have seen the tutorial (Creating a Dynamic Playlist for Progressive Flash Video) url: http://www.adobe.com/devnet/flash/articles/prog_d