Stock Availablity of a Material in A Plant

Hi friends,
For then entered Line items in Quotaion Display transaction(VA23),We can view the availablity of the Stock.
This can be viewed using the following the Menu path.
Select the line item go to Schdule lines->Edit->Item availablity.
Then in the screen we find like Confirmed quantity against the date,Delivery proposal with the quantity against the propsal date.
I am trying to create Quotaion in ABAP webdynpro,Client wants to have same kind of functionality in ABAP webdynpro.
When they enter the Material,and the quantity and they press enter key,then want see the availibity of the Materials and the dates.
Could you please where do I get the these information of the Quantity entered at the line item level?
Regards,
Xavier.P

Hi,
you i am able to find the Stock for a material, but VA21 transaction after entering the Material number and the quanity and press enter,if the Quanity is more than what is in the storage location,it will take you to Item availablity screen where you will see the Confirmed quantity and the date,same way delivery proposal date and the Quantity
I am trying to get the those delivery propsal dates information and the quantities.
Regards,
Xavier.P

Similar Messages

  • How to fetch the current stock of material based on Plant?

    Hi Experts,
    Could any one tell how do i need to get the current stock data of the material based on Plant.
    Thanks in advance.
    Regards,
    Abdur Rafique

    Hi ,
    MBEW stores the value of particular stock . T-code to find stock MMBE compare both wiht table and tcode.
    please let me know if you still find any issues .
    Thanks and regards,
    Rajeshwar

  • Stock transfer of Imported Material

    Dear Experts ,
    I wanted to do stock transfer of import material from one plant to another under the same company code.
    I want to transfer the cenvat credit on taken on CVD & other cess to the receiving plant .
    How should I go about it.
    Kindly guide .
    Thanks

    Hi,
    1) create PO for stock transfer.
    2) maintain material of stock transfer in j1id , with accessible value.
    3) create goods issue 351 mov type.
    4) go to J1is , refernce documnet will be goods issue number , type matd and customer id receiving plant
        after entering in to it put percentage for BED , SED , cess and also give accessible value.
    5) save j1is
    6) post excise invoice (j1iv with refernce of J1is doc), this number will automatically comes in goods issue document under excise invoice tab.
    7) take print of excise, will go with goods issue
    8)then in receiving plant do GRN , excise invoice will be post excise in goods issue plantdo, enter duties for creadit.
    do same process as of excise creadit.

  • Intial upload of Stock in Transit Material with in plant / Inter company

    Hi Friends,
    How can we do Intial upload of Stock in Transit Material with in plant / Inter company.
    In this case accounting entries has already completed while doing post goods issue (thru SD route) or in 1st step 301 mov. type.
    Now the material is in transit. While we go to new system how can do this without hit of aacounting entries.
    I tried 565, it Intial upload of stock to Blocked, so accounting entries took place.
    Regards
    Sai Krishna

    Hi,
    What I am proposing is:
    At this juncture both plants accounting has been done in legacy.
    Coming to new system whatever stock we upload that much value only updated in receiving plant. In reality there is difference between legacy & new system in this case. In legacy stock in transit value also added in receiving plant (since we did PGI). If we do stock upload with 565 mov. type .. intial entry to blocked stock i.e value of inventory is matching the legacy.
    Actual receiveal of material do transfer posting from blocked stock to unresticted stock.
    What is your opinion. 
    We won't upload the G/L inventory, it will come thru stock upload for kishore infor.
    Regards
    Sai Krishna

  • Material in two plants, I run MRP with the BOM is not found in prod plant

    Hi all,
    I have plant 1020 material 12345
    Plant 1020 is the production plant for material 12345
    The material 12345 exists in plant 1070.
    The material 12345 in plant 1070 has no MRP.
    Plant 1020 material 12345 config in MM03
    MRP1 --> MRP Type = PD
    MRP1 --> MRP Controller = G03
    MRP3 --> Planning material = PLAN_1020_GR03
    MRP3 --> Planning plant = 1020
    Plant 1070 material 12345 config in MM03
    MRP1 --> MRP Type = P3
    MRP1 --> MRP Controller = 017
    MRP3 --> Planning material = empty
    MRP3 --> Planning plant = empty
    The BOM in cs11 for plant 1020 material 12345
    has 3 components
    Comp#1
    Comp#2
    Comp#3
    The Dependency is code
    TABLE TB_1020_SUPERBOM (PP_nuance_interne = $ROOT.PP_nuance_interne,
    PP_dim_billette_bom = $ROOT.PP_dim_billette_bom,
    PP_CODE_LONG_BILL = $ROOT.PP_CODE_LONG_BILL,
    pp_component_bom =$self.pp_component_bom).
    The dependency is not found because it is looking for it in the plant 1070 and not the plant 1020.
    When the MRP runs for a Delivery type stock transfer order I get
    CONFIG_1020_BILLET <---- This is the BOM item component field in CS11 in the Basic data tab
    Comp#2
    Comp#3
    instead of
    Comp#1
    Comp#2
    Comp#3
    When I run MRP for the same material, if there's no
    "Delivery based on Stock transfert orders" the MRP associates the correct components
    Hope this explains m'I situation.
    Regards!
    Curtis

    Hi,
    If you want a reply in one line, it would be SAP R/3 does not supoort this feature.
    You will have to go for APO module.
    There are few things which can be done in R/3 side, as in maintaining a scope for MRP run in OM0E, maintaining special procurement key etc etc, but all these will not do any check of stock in another plant & can only help in a very limited way if all any for your specific need.
    But SAP R/3 provides a cross plant evaluation via MD48 to know the stock & demands at all plants, this can help only for evaluation purpose.
    Hope it clarifies.
    Regards,
    Vivek

  • Get the Stock for a given Material no

    Hi,
         I'm an ABAP consultant, new to MM.
         I have a requirement - For a given Production Order I have to find the Material and respective BOM Explosion. Once that is done I have to get the Stock for those Materials [Child Materials].
    I have used AUFK and AFPO to get the material from the Production Order and Used MAST table to get the other details and passed it to FM - 'CS_BOM_EXPL_MAT_V2' - This gives me the Child materials.
    Now I want to know how can I find the Stock for a given Material. I want to get the Overall Unrestricted stock. Which Table do I have to use. Is there any standard Function Module [FM] or BAPI to get it.
    Please help.
    Thanks & Regards,
    Ashish

    I have gone through  the MARD table. I want to confirm - for a Material no there are more than 1 plant and for each plant there are more than storage location. So I have to add the Unrestricted Stock of all those to get the Full Unrestricted Stock.
    Please refer Transaction MMBE - I have to use that output.

  • Stock transfer of different material type

    Sir,
    finish material of one plant is raw material for other plant. i've to use intercompany stock transfer. How should i cope up with material types? How accounting and excise register entries will effect?

    Dear shailesh jagtap
    Hi how r u??
    Actually The first and foremeost thing that you should remember is that Finished goods should always have Sales View and not Purchase view,Secondly Raw material should never have Sales View.
    And Semi finish can have Purchase as well as Sales view.
    So if u got stuck in the situation wherein u have to purchase the material and also sell
    in that case use material type as HALB
    Whereas in some cases if at all it is required then in that case u can set the Purchase view to finish goods or u can set sales view for ROH(Raw amterial)
    in logistic general-Material master -AMterial types just for ROH or FERT select the views u require
    REgds
    shailesh

  • Error during Goods Receipt:Check table XMCHB: Entry 'Material no.', 'Plant

    Dear All,
    I am trying to post Goods Receipt for a Stock Transport Order.
    The error message appears as " Check table XMCHB: entry 'material no.' 'plant', '____' , 'batch no.' does not exist. (message no. M7001)
    The Supplying plant stock from which Goods Issue is done,  is a Normal storage location Unrestricted stock.
    The receipt has to be taken into Vendor stock (Goods Receipt movement type 101 O )
    Inputs will be appreciated.

    technically spoken.
    table MCHB is the storage location segment of a batch record.
    System tries to create an entry in MCHB without a storage location, which does not make sense.
    Vendor stock does not go to MCHB, instead it is recorded in table MKOL.
    If you do STOs then you may transfer vendor consignment stock, but you cannote issue own stock and receive into vendor consignment stock.

  • Stock but non-valuated material with FOC flag in PO but system asking for..

    Dear all,
    We have create a new material type which is stock but non-valuated material masters which measn in the "Qty Updating" checkbox is checked, while the "value updating" checkbox is unchecked.
    Our process is when we create PO of this item, we will flag the "FOC" checkbox in the PO line item in ME21N.
    However, when I perform the above step, i hits the following error message:
    Account assignment mandatory for material 40000010 (enter acc. ***. cat.)
    Message no. ME062
    Diagnosis
    There is no provision for value-based inventory management for this material type in this plant. Account assignment is thus necessary.
    Procedure
    Please enter an account assignment category.
    Question, why system still want me to key in an account assignment category and with GL and cost center? this is suppose to be a Free of Charge item with the above setup and procedure?
    Please advise.
    Thanks.
    Tuffy

    Hello Kate,
    Our goal is the user does not need to key in any GL account and cost center as it is FREE. which is why we have a customized material type solely for material like this (see my previous writing).
    Does it means, I need to create an customized account assignment category with consumption posting using "V", and checked the Goods receipt checkbox, and checked the GR Non-Valuated checkbox ?
    thanks.

  • How to find Blocked Stock Value for a Material Division

    Hi Every Body,
    I have gone through the notes 589024,637927 to find out Blocked Stock value for a Particular Material at different plants . But I have to get Blocked Stock value at each Material Division . Kindly give some light on it to get it.
    The steps are same for finding the Consignment stock value and Transit Stock value. So kindly help me if any body has already worked on it.
    With rgds,
    Anil Kumar Sharma .P

    Hi Anil,
    well these notes work but they're prerequisites that have bothered me and unabled me to fulfill our requirement, for instance, having the material number in the drilldown and so on in order to perform the calculation during query execution.
    I believe there is not much more alternative if you still want to calculate valuations accurately at SLOC or any other stock indicator during query execution...
    I started from the basic fact that valuation of material underneath the plant/valuation area  (in my case 1 PLANT = 1 VALAREA).; precisely because all movements doens't carry all information as per the note explanation.
    So what we have done is to pull a cube with all Article/Sites MAP values; this can be done in several ways; MBEW/MBEWH are holding MAP values per fiscal periods; it has sufficient for us until now: our operations are asking to track MAP values more frequently.... So I am investigating how to work this out and have several alternatives:
    - MSEG has additional fields (available in the extract structures) like Total Stock Qty/Value PRIOR the posting. There is as well an indicator telling if the posting is relevant for the valuation (if it is going to affect the Qty/MAP or not). So it is possible to get the MAP after the posting for each material movement.
    - Create a change pointer on MBEW/MBEWH.
    - MKPF has two convenient fields (CPUDATE and CPUTIM) from which we could build our own delta extractor tracking MAP changes
    In BW the Idea  is to have a cube registering the Article/Plant valuation in time (non-cumulative) and then fulfill our queries via a multicube...
    hoping this will help you in solving your issue; I am of course following any topic in this matter so would appreciate your input....
    Olivier.

  • Transfer the material from one plant(non valuated) to another plant valuat

    Hi All,
    How to transfer the material from one plant(non valuated) to another plant valuated.
    Which Goods Movement type we required to use.
    Regards,
    Amit Shah

    Hello,
    Please refer the link below. hope it could be a help.
    stock transfer plant to plant
    split valuation
    Regards,
    Jana

  • Material transfers between plants and storage locations report

    Hello experts.
    I´m looking for some help.
    Actually i am looking for a report that show information about material transfers between plants and storage locations. Is there any report that shows the source of the material (plant, storage location) and also shows the target (plant, storage location).
    Thanks for your help.

    Hi,
    Though you may not get report for the same , but you can narrow down the check by using the table MSEG or MB51 using the moment types like 311 643 (sd delivery moments )which are for stock transfers .
    or if you want storage location stock many reports are available like MMBE, or MB53 etc.
    Regards

  • Transistion in SAP to know The Stock For List Of Material

    Dear Sir,
    Is there any transistion in SAP.
    To know the stock for list of material.
    For Ex=
    I want to know the stock for below material in one shot
    1) A
    2) B
    3) C
    4) D
    Pls solve my problem soon
    Thanks & Regards
    Ajay Pareek

    Hi Ajay,
    Following are the some of Useful T.Codes for the stock Report.
    LT51 Maintain Preallocated Stock
    LVASE Exit stock from Work Center
    LX02 Stock list
    LX23 Stock comparison IM - WM
    LX27 Stock levels by shelf life exp.date
    MB52 List of Warehouse Stocks on Hand
    MB53 Display Plant Stock Availability
    MB54 Consignment Stocks
    MB5B Stocks for Posting Date
    MB5K Stock Consistency Check
    MB5L List of Stock Values: Balances
    MB5OA Display Valuated GR Blocked Stock
    MB5T Stock in transit CC
    MB5TD Stock in Transit on Key Date
    MB5W List of Stock Values
    MBBS Display valuated special stock
    MBLB Stocks at Subcontractor
    MBSF Release Blocked Stock via Mat. Doc.
    MBW1 Special stocks via WWW
    MC.1 INVCO: Plant Anal. Selection: Stock
    MC.5 INVCO: SLoc Anal. Selection, Stock
    MC.9 INVCO: Material Anal.Selection,Stock
    MC.D INVCO: MRP Cntrllr.Anal.Sel. Stock
    MC.H INVCO: Business Area Anal.Sel. Stock
    MC.L INVCO: Mat.Group Analysis Sel. Stock
    MC.P INVCO: Division Analysis Sel. Stock
    MC.T INVCO: Mat.Type Anal.Selection Stock
    MC48 INVCO: Anal. of Current Stock Values
    MC49 INVCO: Mean Stock Values
    MC50 INVCO: Analysis of Dead Stock
    MC8M Read Opening Stocks
    MCB) INVCO: Long-Term Stock Selection
    MCC4 Set Up INVCO Info Structs.from Stock
    MCH: RIS: STRPS/Mvmts + Stock - Selection
    MCKJ Selection version tree: Stock
    MCKR User-spec. sel. vers. tree: Stock
    MCNB BW: Initialize Stock Balances
    MCSK Call Standard Analyses of Stocks
    MD04 Display Stock/Requirements Situation
    ME27 Create Stock Transport Order
    ME2O SC Stock Monitoring (Vendor)
    MF65 Stock Transfer for Reservation
    MI35 Batch Input: Post Zero Stock Balance
    MILL_ Cutting Stock Transfer
    MIQ1 Batch Input: PhInvDoc. Project Stock
    MM73 Special Stocks: Preparation
    MM74 Archive Special Stocks
    MM75 Display Archive of Special Stocks
    MMBE Stock Overview
    MMBE_ Stock Overview
    MMCL Stock Overview by Characteristic
    Or you can refer the thread [stock overview;, search there are several threads already available regarding this.
    Regards,
    Shyamal

  • Material difference at plant  in Tcode MC.5

    j1idepostock1 is a t code where we display stock value. in that column which is highlight in yellow.
    After sumation  that column shown total updated stock value where as it show total calculated value.
    So how to show total stock quantity remaining in depo through j1idepotstock1
    i attached screen shot here.
    and also...
    material difference at plant  in Tcode MC.5 & MMBE
    (depot)
    vs J1IDEPOTSTOCK1
    rgds,
    Meenakshi

    Your Question is not clear...
    What was the Stock kept at your depot finished/Any other type..
    What was The Statistics update group assigned for the Materials?(Reason for varaition MC.5 and MMBE)
    Is there any materials who don't have statistics update groups?(MMR>>>Sales:Sales Org2 view)
    Phanikumar

  • IDOC: Material master (Extend Plants)

    I used LSMW IDOC option to migrate material master data (MATMAS):
    - Basic views
    - Description
    - Costing
    - Plant Stock
    I want to extend the plant view (Plant Stock). What change do I do to original LSMW to extend plant?
    How do I specify that I am extending?
    Is it that function code at the beginning of IDOC?

    You can do this by writing a program:
    REPORT  zdmmm_mm_multiplant NO STANDARD PAGE HEADING
            MESSAGE-ID zdmmm
            LINE-SIZE 255.
                    TABLE DECLARATION                                   *
    TABLES: mara,          "General Material Data
            mard,          "Storage location data
            mdma,          "MRP data for material
            marc.          "Plant Data for Material
    include zdmmmr_dev00160_mm_multi_top.
    include zdmmmr_dev00160_mm_multi_f00.
                   AT SELECTION-SCREEN                                  *
    AT SELECTION-SCREEN.
      IF NOT s_matnr[] IS INITIAL.
    *Subroutine to perform the Material Number validation
        PERFORM sub_validate_matnr.
      ELSEIF p_ersda IS INITIAL.
        MESSAGE e003   .
      ENDIF.
      IF NOT s_werks[] IS INITIAL.
    Subroutine to perform the plant validation
        PERFORM sub_validate_plant.
      ENDIF.
                    START-OF-SELECTION
    START-OF-SELECTION.
    *To retrive all possible material numbers that have to be
    *extended.
      PERFORM sub_get_mara.
    *To retrieve all possible plants to which the material needs
    *to be extended.
      IF s_werks IS INITIAL.
        PERFORM sub_get_werks.
      ENDIF.
    *For retrieving Procurement status data from T134.
      PERFORM sub_get_pstat.
    *To determine the plants to which the Materials have
    *already been extended.
      PERFORM sub_get_marc.
    *To determine all Storage Locations for individual Plants.
      PERFORM sub_get_t001l.
    *To retrieve company code
      PERFORM sub_get_t001k.
    *To determine the storage locations and plants to which the Material
    *has already extended.
      PERFORM sub_get_mard.
    *To determine the MRP Areas to which the materials need to be extended.
      PERFORM sub_get_mdlv.
    *To determine the MRP Areas to which the materials already been extended.
      PERFORM sub_get_mdma.
    *To retrieve the MRP Area related data from customized table.
      PERFORM sub_get_zdmmm_mrp_area.
    *TO retrieve the Scalabilty info
      PERFORM sub_get_scalability.
    *For extending Material to Plant, all possible Storage Location and corresponding MRP Area .
      PERFORM sub_mat_extn.
    *For creating success and error log.
      PERFORM sub_create_log.
    *Text elements
    001 Material/Plant Selection
    002 No data found for given Selection.
    003 Reference material is not maintained
    004 Material is already extended to the plant
    006 Material extended for MRP Area
    007 Successfully extended
    008 Already extended
    009 Not a seviceable storage location,cannot be extended to MRP Area
    *Selection texts
    P_ERSDA         Date
    S_MATNR         Material Number
    S_WERKS         Extend to Plant
    *Messages
    Message class: ZDMMM
    *000   & & & &
    *001   The material no. does not exist
    *002   The plant does not exists.
    *003   Enter either material no. or Creation date
    *&  Include           ZDMMMR_MM_MULTI_TOP                     *
                              Types
    *Type declaration to hold material no.
    TYPES: BEGIN OF ty_matnr,
             matnr      TYPE matnr,                  "Material Number
             mtart      TYPE mtart,                  "Material Type
             ersda      TYPE ersda,                  "Creation date
             mbrsh      TYPE mbrsh,                  "Industry Sector
             vkorg      TYPE vkorg,                  "Sales Organization
             vtweg      TYPE vtweg,                  "Distribution Channel
             mtartz     TYPE zmtart,                 "Material Type (Customized)
            END OF ty_matnr.
    *Type declaration to hold plant.
    TYPES: BEGIN OF ty_plant,
             werks      TYPE werks_d,                 "Plant
             bwkey      TYPE bwkey,                   "Valuation area
           END OF ty_plant.
    *Type declaration to hold data from marc.
    TYPES: BEGIN OF ty_marc,
             matnr      TYPE matnr,                   "Material Number
             werks      TYPE werks_d,                 "Plant
             bwkey      TYPE bwkey,
           END OF ty_marc.
    *Type declaration to hold data from mard.
    TYPES: BEGIN OF ty_mard,
             matnr      TYPE matnr,                   "Material Number
             werks      TYPE werks_d,                 "Plant
             lgort      TYPE lgort_d,                 "Storage Location
             mtart      TYPE mtart,                   "Material Type
           END OF ty_mard.
    *Type declaration to hold data from t001l.
    TYPES: BEGIN OF ty_sloc,
              werks     TYPE werks_d,                 "Plant
              lgort     TYPE lgort_d,                 "Storage Location
           END OF ty_sloc.
    *Type declaration to hold data from mdlv.
    TYPES: BEGIN OF ty_mdlv,
              berid     TYPE berid,                   "MRP Area
              werzg     TYPE werks_d,                 "Plant
              ortzg     TYPE lgort_d,                 "Storage Location
           END OF ty_mdlv.
    *Type declaration to hold data from custom table ZDMMM_MRP_AREA.
    TYPES: BEGIN OF ty_refmdma,
               zmtart    TYPE zdmmm_mrp_area-zmtart,   "Material Type (Customized)
               zwerks    TYPE zdmmm_mrp_area-zwerks,   "Plant
               zberid    TYPE zdmmm_mrp_area-zberid,   "MRP Area
               zdismm    TYPE zdmmm_mrp_area-zdismm,   "MRP Type
               zeisbe    TYPE zdmmm_mrp_area-zeisbe,   "Safety Stock
               zdisls    TYPE zdmmm_mrp_area-zdisls,   "Lot Size
               zdispo    TYPE zdmmm_mrp_area-zdispo,   "MRP Controller
               zfxhor    TYPE zdmmm_mrp_area-zfxhor,   "Plant Delivery Time (In days)
           END OF ty_refmdma.
    *Type declaration to hold data for success log.
    TYPES: BEGIN OF ty_succ,
               mat(18)   TYPE c,                        "Material
               plant(8) TYPE c,                        "Plant
               sloc(15)  TYPE c,                        "Storage Location
               comm(150) TYPE c,                        "Comments
            END OF ty_succ.
    *Type declaration to hold data for error log.
    TYPES: BEGIN OF ty_error,
              mat(18)   TYPE c,                         "Material
              plant(8) TYPE c,                         "Plant
              sloc(15)  TYPE c,                         "Storage Location
              comm(150) TYPE c,                         "Comments
            END OF ty_error.
    *Type declaration for holding data from mvke
    TYPES: BEGIN OF ty_mvke,
             matnr      TYPE matnr,                       "Material Number
             vkorg      TYPE vkorg,                       "Sales Org
             vtweg      TYPE vtweg,                       "Distribution Channel
           END OF ty_mvke.
    *Type declaration for holding data from qmat
    TYPES: BEGIN OF ty_qmat,
                   matnr type matnr,
                   werks type werks_d,
                   art TYPE qmat-art,
                   ppl TYPE qmat-ppl,
                   spezueber TYPE qmat-spezueber,
                   conf TYPE qmat-conf,
                   tls TYPE qmat-tls,
                   app TYPE qmat-app,
                   mer TYPE qmat-mer,
                   insmk TYPE qmat-insmk,
                   ave TYPE qmat-ave,
                   stichprver TYPE qmat-stichprver,
                   dynregel TYPE qmat-dynregel,
                   sproz TYPE qmat-sproz,
                   hpz TYPE qmat-hpz,
                   dyn TYPE qmat-dyn,
                   mpb TYPE qmat-mpb,
                   mst TYPE qmat-mst,
                   ein TYPE qmat-ein,
                   mpdau TYPE qmat-mpdau,
                   chg TYPE qmat-chg,
                   qkzverf TYPE qmat-qkzverf,
                   qpmat TYPE qmat-qpmat,
                   kzprfkost TYPE qmat-kzprfkost,
                   aufnr_co TYPE qmat-aufnr_co,
                   aktiv TYPE qmat-aktiv,
                   apa TYPE qmat-apa,
                   afr TYPE qmat-afr,
                   mma TYPE qmat-mma,
                   feh TYPE qmat-feh,
                   prfrq TYPE qmat-prfrq,
                   nkmpr TYPE qmat-nkmpr,
         END OF ty_qmat.
    *Type declaration for MARA and MARC data for reference material
    TYPES: BEGIN OF ty_ref_data,
             matnr      TYPE matnr,                       "Material Number
             ladgr      TYPE ladgr,                       "Loading Group
             bklas      TYPE bklas,                       "Valuation class
             peinh      TYPE peinh,                       "Price unit
             losgr      TYPE losgr,                       "Costing Lot Size
             hkmat      TYPE hkmat,                       "Material Origin
             herkl      TYPE herkl,                       "Country Of Origin
             dismm      TYPE dismm,                       "MRP Type
             dispo      TYPE dispo,                       "MRP Controller
             fxhor      TYPE fxhor,                       "Planned delivery time (In days)
             disls      TYPE disls,                       "Lot size
             fhori      TYPE fhori,                       "Scheduling Margin Key for Floats
             magrv      TYPE magrv,
             vhart      TYPE vhart,
             ergew      TYPE ergew,
             ervol      TYPE ervol,
             fuelg      TYPE fuelg,
             stfak      TYPE stfak,
             gewto      TYPE gewto,
             volto      TYPE volto,
             prctr      TYPE prctr,
             kzgvh      TYPE kzgvh,
             stawn      TYPE stawn,
             mtver      TYPE mtver,
             casnr      TYPE casnr,
             gpnum      TYPE gpnum,
             steuc      TYPE steuc,
             herkr      TYPE herkr,
             mownr      TYPE mownr,
             mogru      TYPE mogru,
             prenc      TYPE prenc,
             preno      TYPE preno,
             prend      TYPE prend,
             itark      TYPE itark,
             bstme      TYPE bstme,
             vabme      TYPE vabme,
             nrfhg      TYPE nrfhg,
             mfrgr      TYPE mfrgr,
             ekwsl      TYPE ekwsl,
             webaz      TYPE webaz,
             insmk      TYPE insmk,
             kzkri      TYPE kzkri,
             usequ      TYPE usequ,
             kordb      TYPE kordb,
             mprof      TYPE mprof,
             ekgrp      TYPE ekgrp,
             disgr      TYPE disgr,
             maabc      TYPE maabc,
             minbe      TYPE minbe,
             lfrhy      TYPE lfrhy,
             bstmi      TYPE bstmi,
             bstma      TYPE bstma,
             bstfe      TYPE bstfe,
             mabst      TYPE mabst,
             losfx      TYPE losfx,
             lagpr      TYPE lagpr,
             ausss      TYPE ausss,
             takzt      TYPE takzt,
             rdprf      TYPE rdprf,
             bstrf      TYPE bstrf,
             megru      TYPE megru,
             sobsl      TYPE sobsl,
             kzech      TYPE kzech,
             lgpro      TYPE lgpro,
             vspvb      TYPE vspvb,
             rgekz      TYPE rgekz,
             lgfsb      TYPE lgfsb,
             fabkz      TYPE fabkz,
             eprio      TYPE eprio,
             schgt      TYPE schgt,
             plifz      TYPE plifz,
             mrppp      TYPE mrppp,
             eisbe      TYPE eisbe,
             lgrad      TYPE lgrad,
             eislo      TYPE eislo,
             rwpro      TYPE rwpro,
             shflg      TYPE shflg,
             shzet      TYPE shzet,
             shpro      TYPE shpro,
             periv      TYPE periv,
             auftl      TYPE auftl,
             strgr      TYPE strgr,
             vrmod      TYPE vrmod,
             vint2      TYPE vint2,
             umref      TYPE umref,
             prgrp      TYPE prgrp,
             vint1      TYPE vint1,
             miskz      TYPE miskz,
             prwrk      TYPE prwrk,
             mtvfp      TYPE mtvfp,
             wzeit      TYPE wzeit,
             kzpsp      TYPE kzpsp,
             stdpd      TYPE stdpd,
             perkz      TYPE perkz,
             altsl      TYPE altsl,
             kausf      TYPE kausf,
             sbdkz      TYPE sbdkz,
             kzbed      TYPE kzbed,
             ahdis      TYPE ahdis,
             kzaus      TYPE kzaus,
             ausdt      TYPE ausdt,
             nfmat      TYPE nfmat,
             sauft      TYPE sauft,
             sfepr      TYPE sfepr,
             mdach      TYPE mdach,
             dplfs      TYPE dplfs,
             dplpu      TYPE dplpu,
             dplho      TYPE dplho,
             tempb      TYPE tempb,
             raube      TYPE raube,
             behvo      TYPE behvo,
             stoff      TYPE stoff,
             abcin      TYPE abcin,
             ccfix      TYPE ccfix,
             wesch      TYPE wesch,
             etiar      TYPE etiar,
             etifo      TYPE etifo,
             xgchp      TYPE xgchp,
             maxlz      TYPE maxlz,
             lzeih      TYPE lzeih,
             mhdrz      TYPE mhdrz,
             mhdhb      TYPE mhdhb,
             iprkz      TYPE dattp,
             rdmhd      TYPE rdmhd,
             mhdlp      TYPE mhdlp,
             brgew      TYPE brgew,
             ntgew      TYPE ntgew,
             volum      TYPE volum,
             voleh      TYPE voleh,
             groes      TYPE groes,
             xmcng      TYPE xmcng,
             loggr      TYPE loggr,
             sernp      TYPE serail,
             serlv      TYPE serlv,
             fprfm      TYPE fprfm,
             ausme      TYPE ausme,
             qmata      TYPE qmatauth,
             kzdkz      TYPE kzdkz,
             prfrq      TYPE prfrq,
             rbnrm      TYPE rbnr,
             qmpur      TYPE qmpur,
             ssqss      TYPE ssqss,
             qzgtp      TYPE qzgtyp,
             qssys      TYPE qssys,
             bwtty      TYPE bwtty,
             eklas      TYPE eklas,
             qklas      TYPE qklas,
             verpr      TYPE verpr,
             stprs      TYPE stprs,
             zkprs      TYPE dzkprs,
             zkdat      TYPE dzkdat,
             bwprs      TYPE bwprs,
             bwprh      TYPE bwprh,
             bwps1      TYPE bwps1,
             bwph1      TYPE bwph1,
             vjbws      TYPE vjbws,
             vjbwh      TYPE vjbwh,
             abwkz      TYPE abwkz,
             bwpei      TYPE bwpei,
             xlifo      TYPE xlifo,
             mypol      TYPE mypool,
             ncost      TYPE ck_no_costing,
             ekalr      TYPE ck_ekalrel,
             hrkft      TYPE hrkft,
             kosgr      TYPE ck_kosgr,
             awsls      TYPE awsls,
             mmsta      TYPE mmsta,
             mmstd      TYPE mmstd,
             stlal      TYPE stlal,
             stlan      TYPE stlan,
             plnnr      TYPE plnnr,
             aplal      TYPE plnal,
             plnty      TYPE plnty,
             sobsk      TYPE ck_sobsl,
             zplpr      TYPE dzplpr,
             zplp1      TYPE dzplp1,
             zpld1      TYPE dzpld1,
             zplp2      TYPE dzplp2,
             zpld2      TYPE dzpld2,
             zplp3      TYPE dzplp3,
             zpld3      TYPE dzpld3,
             lvolg      TYPE lvolg,
             diskz      TYPE diskz,
             lsobs      TYPE lsobs,
             lminb      TYPE lminb,
             lbstf      TYPE lbstf,
             lgpbe      TYPE lgpbe,
          END OF ty_ref_data.
    *Type declaration for holding data from mdma
    TYPES: BEGIN OF ty_mdma,
            matnr       TYPE mdma-matnr,                   "Material Number
            berid       TYPE mdma-berid,                   "MRP Area
            werks       TYPE mdma-werks,                   "Plant
          END OF ty_mdma.
    *Type declaration for holding Company code data
    TYPES: BEGIN OF ty_bukrs,
            bwkey       TYPE bwkey,                         "Valuation Area
            bukrs       TYPE bukrs,                         "Company code
          END OF ty_bukrs.
    *Type declaration for holding T001w Data
    TYPES: BEGIN OF ty_t001w,
            werks       TYPE werks_d,                       "Plant
            bwkey       TYPE bwkey,                         "Valuation Area
          END OF ty_t001w.
    *Type declaration for holding T134 Data
    TYPES: BEGIN OF ty_t134,
            mtart       TYPE mtart,                         " Material type
            pstat       TYPE pstat,                         "Condensed status display
          END OF ty_t134.
    Type declaration for Holding TWLAD data
    TYPES: BEGIN OF ty_twlad,
             werks    TYPE werks_d,
             lgort    TYPE lgort_d,
             adrnr    TYPE adrnr,
            END OF ty_twlad.
    *Type declaration for holding ADRC data
    TYPES: BEGIN OF ty_adrc,
             adrnr    TYPE adrnr,   "Address number
             sort2    TYPE ad_sort2,   "Search Term
           END OF ty_adrc.
    TYPES: BEGIN OF ty_dev00160,
             pkey    TYPE zkey,    "parameter key
             item    TYPE zitem,   "Item No
             value   TYPE zvalue,
           END OF ty_dev00160.
                             Constants
    CONSTANTS: c_header(1) TYPE c  VALUE 'H',     "Header
               c_true(1)   TYPE c  VALUE 'X',     "value = x
               c_v(1)      TYPE c  VALUE 'V',     "Sales View
               c_e(1)      TYPE c  VALUE 'E',     "Purchasing View
               c_d(1)      TYPE c  VALUE 'D',     "MRP View
               c_p(1)      TYPE c  VALUE 'P',     "Forecasting View
               c_a(1)      TYPE c  VALUE 'A',     "Work Scheduling view
               c_l(1)      TYPE c  VALUE 'L',     "Storage View
               c_q(1)      TYPE c  VALUE 'Q',     "Quality View
               c_b(1)      TYPE c  VALUE 'B',     "Accounting
               c_g(1)      TYPE c  VALUE 'G',     "Costing View
               c_f(1)      TYPE c  VALUE 'F',     "PRT View
               c_k(1)      TYPE c  VALUE 'K'.     "Basic View
                              Internal tables
    *Internal table to hold material no and material type
    DATA: i_matnr  TYPE STANDARD TABLE OF ty_matnr INITIAL SIZE 0.
    *Internal table to hold plant
    DATA: i_plant   TYPE STANDARD TABLE OF ty_plant INITIAL SIZE 0.
    *Internal table to hold marc data
    DATA: i_marc   TYPE STANDARD TABLE OF ty_marc INITIAL SIZE 0.
    *Internal table to hold marc data
    DATA: i_tmarc   TYPE STANDARD TABLE OF ty_marc INITIAL SIZE 0.
    *Internal table to hold mard data
    DATA: i_mard   TYPE STANDARD TABLE OF ty_mard INITIAL SIZE 0.
    *Internal table to hold t001l data
    DATA: i_sloc TYPE STANDARD TABLE OF ty_sloc INITIAL SIZE 0.
    *Internal table to hold MRP Area
    DATA: i_mdlv  TYPE STANDARD TABLE OF ty_mdlv INITIAL SIZE 0.
    *Internal table to hold already extended MRP Area
    DATA: i_mdma  TYPE STANDARD TABLE OF ty_mdma INITIAL SIZE 0.
    *Internal table to hold MRP Area data from customized table
    DATA: i_refmdma TYPE STANDARD TABLE OF ty_refmdma INITIAL SIZE 0.
    *Internal table to hold success messages
    DATA: i_succ TYPE STANDARD TABLE OF ty_succ INITIAL SIZE 0.
    *Internal table to hold error messages
    DATA: i_error TYPE STANDARD TABLE OF ty_error INITIAL SIZE 0.
    *Internal table to hold mvke data
    DATA: i_mvke   TYPE STANDARD TABLE OF ty_mvke INITIAL SIZE 0.
    *Internal table for company code data
    DATA: i_bukrs TYPE STANDARD TABLE OF ty_bukrs INITIAL SIZE 0.
    *Internal table for T001W data
    DATA: i_t001w TYPE STANDARD TABLE OF ty_t001w INITIAL SIZE 0.
    *Internal table for T134 data
    DATA: i_t134 TYPE STANDARD TABLE OF ty_t134 INITIAL SIZE 0.
    *Internal table for TWLAD data
    DATA: i_twlad  TYPE STANDARD TABLE OF ty_twlad INITIAL SIZE 0.
    *Internal table for ADRC data
    DATA: i_adrc  TYPE STANDARD TABLE OF ty_adrc INITIAL SIZE 0.
    *Internal table for dev00160 data
    DATA: i_dev00160  TYPE STANDARD TABLE OF ty_dev00160 INITIAL SIZE 0.
    *Internal table for qmat data
    DATA: i_qmat  TYPE STANDARD TABLE OF ty_qmat INITIAL SIZE 0.
                              Work areas
    *Work Area for Internal table i_mara
    DATA: wa_matnr     TYPE ty_matnr.
    *Work Area for Internal table i_werks
    DATA: wa_plant     TYPE ty_plant.
    *Work Area for Internal table i_marc
    DATA: wa_marc      TYPE ty_marc.
    *Work Area for Internal table i_t001l
    DATA: wa_sloc      TYPE ty_sloc.
    *Work Area for Internal table i_mdlv
    DATA: wa_mdlv      TYPE ty_mdlv.
    *Work Area for Internal table i_bukrs
    DATA: wa_bukrs     TYPE ty_bukrs.
    *Work Area for Internal table i_refmdma.
    DATA: wa_refmdma   TYPE ty_refmdma.
    *Work Area for Internal table i_succ
    DATA: wa_succ      TYPE ty_succ.
    *Work Area for Internal table i_error
    DATA: wa_error     TYPE ty_error.
    *Work Area for Internal table i_selfields
    DATA: wa_selfields TYPE sdibe_massfields.
    *Work Area for Internal table i_mvke
    DATA: wa_mvke      TYPE ty_mvke.
    *Work Area for Internal table i_ref_data
    DATA: wa_ref_data  TYPE ty_ref_data.
    *Work Area for internal table I_t001w
    DATA: wa_t001w    TYPE ty_t001w.
    *Work Area for internal table I_t001w
    DATA: wa_twlad    TYPE ty_twlad.
    *Work Area for internal table I_t134
    DATA: wa_t134    TYPE ty_t134.
    WOrk Area for ADRC Table
    DATA: wa_adrc    TYPE ty_adrc.
    WOrk Area for MARD Table
    DATA: wa_mard    TYPE ty_mard.
    *Work Area for Internal table i_mvke
    DATA: wa_dev00160      TYPE ty_dev00160.
    *Work Area for Internal table i_mvke
    DATA: wa_qmat      TYPE ty_qmat.
                    SELECTION SCREEN                                    *
    SELECTION-SCREEN : BEGIN OF BLOCK b_001
                       WITH FRAME
                       TITLE text-001 .         "Start of selection-screen
    SELECT-OPTIONS:     s_matnr FOR mara-matnr.            "Material Number
    PARAMETERS :        p_ersda LIKE mara-ersda.           "Creation Data
    SELECT-OPTIONS:     s_werks FOR marc-werks NO INTERVALS.       "Plant
    SELECTION-SCREEN : END OF BLOCK b_001 .   "End of Selection-screen
    *&  Include           ZDMMMR_MM_MULTI_F00                     *
    *&      Form  sub_validate_matnr
          Subroutine for validating material number
    FORM sub_validate_matnr .
      SELECT matnr            "Material Number
             mtart            "Material Type
             ersda            "Creation date
             mbrsh            "Industry Sector
      FROM mara               "Table for General Material Data
      INTO TABLE i_matnr
      WHERE matnr IN s_matnr.
    *If no material is found an error message is given
      IF sy-subrc <> 0.
        MESSAGE e001.
      ENDIF.
    ENDFORM.                    " sub_validate_matnr
    *&      Form  sub_validate_plant
          Subroutine to validate Plant
    FORM sub_validate_plant .
      SELECT werks            "Plant
             bwkey            "Valuation area
      FROM t001w              "Table for Plants/Branches
      INTO TABLE i_plant
      WHERE werks IN s_werks.
    *If no plant is found an error message is given
      IF sy-subrc NE 0.
        MESSAGE e002.
      ENDIF.
    ENDFORM.                    " sub_validate_plant
    *&      Form  sub_get_mara
    *Determine all the materials that need to be extended to new plants,
    *storage locations and MRP areas
    FORM sub_get_mara .
      IF NOT s_matnr[] IS INITIAL.
        SORT i_matnr BY matnr.
        IF p_ersda IS NOT INITIAL.
          DELETE i_matnr WHERE ersda NE p_ersda.
        ENDIF.
      ELSE.
    *If only Creation Date is given
        SELECT    matnr              "Material No.
                  mtart              "Material Type
                  ersda              "Creation date
                  mbrsh              "Industry Sector
        FROM mara                    "Table for General Material Data
        INTO  TABLE i_matnr
        WHERE ersda EQ p_ersda.
        IF sy-subrc EQ 0.
          SORT i_matnr BY matnr.
        ELSE.
          MESSAGE i000 WITH 'No data found for given Selection.'(002).
          LEAVE LIST-PROCESSING.
        ENDIF.
      ENDIF.
    Subroutine to get data from mvke.
      PERFORM sub_get_mvke.
      LOOP AT i_matnr INTO wa_matnr.
        CLEAR wa_mvke.
        READ TABLE i_mvke INTO wa_mvke WITH KEY matnr = wa_matnr-matnr
    BINARY SEARCH.
        IF sy-subrc EQ 0.
          wa_matnr-vkorg = wa_mvke-vkorg.
          wa_matnr-vtweg = wa_mvke-vtweg.
        ENDIF.
        IF wa_matnr-mtart = 'AD01'.
          wa_matnr-mtartz = 'AD01'.
        ELSE.
          wa_matnr-mtartz = 'NAD01'.
        ENDIF.
        MODIFY i_matnr FROM wa_matnr TRANSPORTING vkorg vtweg mtartz.
      ENDLOOP.
    ENDFORM.                    " sub_get_mara
    *&      Form  sub_get_werks
    *Determine all the plants to which the Materials need to be extended
    FORM sub_get_werks .
      SELECT   werks            "Plant
               bwkey            "Valuation Area
      FROM t001w                "Check table for Plants/Branches
      INTO  TABLE i_plant.
      IF sy-subrc EQ 0.
        SORT i_plant BY werks.
      ENDIF.
    ENDFORM.                    " sub_get_werks
    *&      Form  sub_get_marc
    *Determine the status of the materials with respect to which plants
    *they have already been extended to
    FORM sub_get_marc .
      CHECK i_matnr[] IS NOT INITIAL.
      SELECT     m~matnr        "Material Number
                 m~werks        "Plant
                 t~bwkey
      INTO TABLE i_marc
      FROM marc AS m               "Table for Plant Data for Material
      INNER JOIN t001w AS t
      ON mwerks = twerks
      FOR ALL ENTRIES IN i_matnr
      WHERE matnr EQ i_matnr-matnr.
      IF sy-subrc EQ 0.
    *Append the plants that have been extended to
    to the list of plants to which they have to be extended
    only when no plants are given in the selection screen
        IF s_werks IS INITIAL.
          LOOP AT i_marc INTO wa_marc.
            wa_plant-werks = wa_marc-werks.
            wa_plant-bwkey = wa_marc-bwkey.
            APPEND wa_plant TO i_plant.
            CLEAR wa_plant.
          ENDLOOP.
          SORT i_plant BY werks bwkey.
          DELETE ADJACENT DUPLICATES FROM i_plant
          COMPARING werks bwkey.
        ENDIF.
        SORT i_marc BY matnr werks.
    *Retrieve the Valutaion Area for the plants to which the material
    *has already been extended.
        SELECT werks          "Plant
               bwkey          "Valuation area
        INTO TABLE i_t001w
        FROM t001w            "Table for Plants/Branches
        FOR ALL ENTRIES IN i_marc
        WHERE  werks = i_marc-werks.
    *If selection succeed.
        IF sy-subrc EQ 0.
    Sort by Plant
          SORT i_t001w BY werks.
        ENDIF.
      ENDIF.
    *Copy the content of MARC into a temporary internal table
      i_tmarc[] = i_marc[].
      DELETE ADJACENT DUPLICATES FROM i_tmarc
             COMPARING matnr.
    *Retrieving Inspection type - material parameters (QMAT)
    *data
      SELECT       matnr          "Material Number
                   werks          "Plant
                   art            "Inspection Type
                   ppl            "Inspection with Task List
                   spezueber      "Inspect with Material Specification
                   conf           "Inspection Specifications from
                                  " Configuration
                   tls            "Inspection Specifications from Batch
                                  " Determination
                   app            "Automatic Specification Assignment
                   mer            "nspect by Characteristics
                   insmk          "Post to Inspection Stock
                   ave            "Automatic Usage Decision Planned
                   stichprver     "Sampling Procedure
                   dynregel       "Dynamic Modification Rule
                   sproz          "Inspection Percentage
                   hpz            "100% Inspection
                   dyn            "Skips Allowed
                   mpb            "Enter the Sample Manually
                   mst            "Trigger Sample Calculation Manually
                   ein            "Serial Number Management Possible
                   mpdau          "Average Inspection Duration
                   chg            "Control of Inspection Lot Creation (Lot
                                  "Summary)
                   qkzverf        "Procedure for Calculating Quality Score
                   qpmat          "Allowed Share of Scrap (Percent) in
                                   "Inspection Lot
                   kzprfkost      "Record Appraisal Costs in Individual QM
                                  "Order
                   aufnr_co       "Order Number for Recording Appraisal
                                   "Costs
                   aktiv          "Inspection Type - Material Combination is
                                   "Active
                   apa            "Preferred Inspection Type
                   afr            "Inspection for Handling Unit
                   mma            "Field Not Used as of 3.0       Field
                                   "Reserved for SAP
                   feh            "Field Not Used as of 3.0       Field
                                  "Reserved for SAP
                   prfrq          "Field Not Used as of 3.0       Field
                                   "Reserved for SAP
                   nkmpr          "Field Not Used as of 3.0       Field
                                  "Reserved for SAP
          INTO TABLE i_qmat
          FROM qmat               "Table of "Inspection type - material
                                  "parameters"
          FOR ALL ENTRIES IN i_tmarc
          WHERE matnr = i_tmarc-matnr "Material no. of temporary internal
                                       "table
          AND   werks = i_tmarc-werks. "Plant of temporary internal table
    *If selection succeed
      IF sy-subrc EQ 0.
        SORT i_qmat BY matnr.
      ENDIF.
    ENDFORM.                    " sub_get_marc
    *&      Form  sub_get_mard
    Determine the storage locations for the Plants i_plant.
    FORM sub_get_mard .
      CHECK i_marc[] IS NOT INITIAL.
      SELECT matnr           "Material Number
             werks           "Plant
             lgort           "Storage Location
      FROM mard              "Table for Storage Location Data for Material
      INTO TABLE i_mard
      FOR ALL ENTRIES IN i_marc
      WHERE matnr EQ i_marc-matnr
      AND werks EQ i_marc-werks.
    *If selection succeed
      IF sy-subrc EQ 0.
    *Sort internal table by Material no , Plant and Storage Location
        SORT i_mard BY matnr werks lgort .
      ENDIF.
    ENDFORM.                    " sub_get_mard
    *&      Form  sub_get_t001l
    Determine the storage locations for the Plants i_plant.
    FORM sub_get_t001l .
      CHECK i_plant[] IS NOT INITIAL.
      SELECT     werks               "Plant
                 lgort               "Storage Location
      FROM t001l                     "Check table for Storage Location
      INTO TABLE i_sloc
      FOR ALL ENTRIES IN i_plant
      WHERE werks EQ i_plant-werks.
    *If selection succeed
      IF sy-subrc EQ 0.
    *Sort by Plant and Storage Location
        SORT i_sloc BY werks lgort.
       For all the storage location get the Storage Location Address
    *Number
        SELECT werks   "Plant
               lgort   "Storage Location
               adrnr   "Address Number
         FROM twlad    "Table of 'Determination of Address from Plant and
                       "Storage Location'
         INTO TABLE i_twlad
         FOR ALL ENTRIES IN i_sloc
         WHERE werks = i_sloc-werks
         AND   lgort = i_sloc-lgort.
    *If selection succeed
        IF sy-subrc EQ 0.
    *Sort by Plant, Storage Location and Address number
          SORT i_twlad BY werks lgort adrnr.
    For all address numbers retrieved get the search term
          SELECT addrnumber  "Address number
                 sort2       "Search Term 2
          INTO TABLE i_adrc
          FROM adrc          "Table of 'Addresses (Business Address
                             "Services)'
          FOR ALL ENTRIES IN i_twlad
          WHERE addrnumber = i_twlad-adrnr.
          IF sy-subrc EQ 0.
            SORT i_adrc BY adrnr.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " sub_get_t001l
    *&      Form  sub_get_mdlv
    Determine the MRP Areas to which the materials need to be extended.
    FORM sub_get_mdlv .
      CHECK i_sloc[] IS NOT INITIAL.
      SELECT     berid                "MRP Area
                 werzg                "Plant
                 ortzg                "Receiving Storage Location
      FROM mdlv                       "Table for Customizing MRP Area
      INTO TABLE i_mdlv
      FOR ALL ENTRIES IN i_sloc
      WHERE werzg EQ i_sloc-werks
      AND   ortzg EQ i_sloc-lgort.
    *If selection succeed.
      IF sy-subrc EQ 0.
    *Sort by Plant and Storage Location
        SORT i_mard BY werks lgort.
      ENDIF.
    ENDFORM.                    " sub_get_mdlv
    *&      Form  sub_get_zdmmm_mrp_area
    Determine required fields w.r.t Plant and MRP Area from customized
    *table
    FORM sub_get_zdmmm_mrp_area .
      CHECK i_mdlv[] IS NOT INITIAL.
    *Retrieving MRP data from Customized table
      SELECT    zmtart                "Material Type
                zwerks                "Plant
                zberid                "MRP Area
                zdismm                "MRP Type
                zeisbe                "Safety Stock
                zdisls                "Lot Size
                zdispo                "Mrp Controller
                zfxhor                "Planned Delivery Time (In Days)
      FROM zdmmm_mrp_area             "Customized table for MRP Area wrt
                                       "plant and mat type.
      INTO TABLE i_refmdma
      FOR ALL ENTRIES IN i_mdlv
      WHERE zberid = i_mdlv-berid
      AND zwerks = i_mdlv-werzg.
    *If selection succeed
      IF sy-subrc <> 0.
    *Sort by MRP Area and Plant
        SORT i_refmdma BY zberid zwerks.
      ENDIF.
    ENDFORM.                    " sub_get_zdmmm_mrp_area
    *&      Form  sub_mat_extn
    For extending Material to Plant, all possible Storage Location and
    corresponding MRP Area .
    FORM sub_mat_extn .
    *Local variable declaration
      DATA: l_index TYPE sytabix.       "For storing sy-tabix
      DATA: l_counter TYPE i VALUE 0.   "For formatting Error log.
      DATA: l_sloc_extend TYPE c.       "Flag for Extending the material
      DATA: wa_dpop LIKE dpop.          "For sending as a exporting
      "parameter
      DATA: wa_mdma LIKE mdma.          "For sending as a exporting
      "parameter
      DATA: l_stat  TYPE c.             "For checking the Storage Location
      "is Seviceable or not.
      DATA: wa_bapireturn1 TYPE bapiret1. "Return Work area of
      "'MD_MRP_LEVEL_CREATE_DATA'
    *No material is selected.
      CHECK i_matnr[] IS NOT INITIAL.
      SORT i_plant BY werks.
      SORT i_marc BY matnr werks.
      SORT i_mard BY matnr werks lgort.
    *For extending the material to Plant Storage Location and possible MRP
    *Area
      LOOP AT i_matnr INTO wa_matnr.
        CLEAR wa_marc.
      Checking whether Reference Material  Exists or not
        READ TABLE i_marc INTO wa_marc WITH KEY matnr = wa_matnr-matnr
       BINARY SEARCH.
      If no reference material exists..populate data for error log.
        IF sy-subrc NE 0.
          CLEAR wa_error.
          PERFORM material_convert USING wa_matnr-matnr
                                   CHANGING wa_error-mat.
          wa_error-comm = 'Reference material is not maintained'(003).
          APPEND wa_error TO i_error.
          CLEAR wa_error.
          CONTINUE.
        ENDIF.
      For retrieving the reference data
        PERFORM sub_retrieve_refdata.
        LOOP AT i_plant INTO wa_plant.
          READ TABLE i_marc INTO wa_marc WITH KEY matnr = wa_matnr-matnr
                                                  werks = wa_plant-werks
                                                  BINARY SEARCH.
          IF sy-subrc EQ 0.
        

Maybe you are looking for

  • Zen Vision M 30gB: How Do You Add DVD Movi

    Just received this player as a gift from a friend. I think he got it at DELL. It was easy adding Music and it sounds great. I have to figure out how to use the Equilizer, Smart Sound (keeps sound levels constant) and Bass Boost...to arri've at the be

  • Multiprovder objects missing in the Query Designer

    Hi, I have multiprovider based on 2 infosets ( as the reproting is based on master data) . Later on i have added couple of objects in master data and adjusted the infoset and activated it . The multiprovider also ajusted after adding the fields. I ha

  • Purchasing mini data projector for MacBook Pro. What works together?

    I want to purchase a mini data projector for my MacBook Pro. Does anyone have a recommendation of what I should look for in a projector or what would work with my MacBook? Is a MacBook a VGA display? I want a data projector that is very sharp. Any su

  • ODI 11.1.1.7.0 connect to DB with connection pool

    Hello! ODI standalone agent 11.1.1.7.0 now make a connect to DB with connection pool and set "client identifier" in the session. How to disable connection pooling? Thank you

  • Image replicator question

    I know with image replicator you can take a series of numbered JPGs for example, image001.jpg, image002.jpg, image003.jpg etc and group them into image[###].jpg so replicator can use them. My question is about replicator using a MOV file: I know that