STO Requirement

Dear Friends
Request an expert , who has worked on CIN for guidance.
An STO (PO) would be created at a depot. Based on that, the plant will would do outbound delivery of goods.
The requirement is
As we are aware that, depot does normal sales transactions to its customers. EITHER the HIGHEST QTY & RATE OR HIGHEST RATE billed to its customer based on the LATEST DATE OF TRANSACTION.
Now,
The basic price (pb00 ) in STO MUST be Triggered from this price ( copy of this price). { from the above mentioned condition)
Eg.
Assume an STO is made today afternoon by the depot. Suppose, the depot made an SO/Invoice to its customer yesterday evening for a particular material for HIGHEST QTY & HIGHEST RATE, then this value should be triggered as the basic price in the STO raised by that depot to the plant.
According to RULE # 7, Central Board of Excise & customs, Ministry of Finance, Government of India.
Rgds
Sumanth.Gururaj

EITHER the HIGHEST QTY & RATE OR HIGHEST RATE billed
   to its customer based on the LATEST DATE OF TRANSACTION.
I dont think, this is a method that should be followed.  From my experience, Depot can generate a billing document to end customers at any rate over and above their basic cost.  Only thing you need to take care is ED part.  At whatever duty parent plant is sending the goods to Depot, the same should be passed on to end customer.
thanks
G. Lakshmipathi

Similar Messages

  • Committed Date Calculation in an STO

    Hello,
    Can anyone detail how exactly the committed date is calculated during an availability check for an STO?.
    Thanks.

    STO Delivery Date is receipt date at destination location. This minus Transportation Lead time is STO requirement date at source.
    When you conduct ATP check for this PO/STO, your committed date is updated at source and delivery date will be updated as committed date plus TL lead time. Also check SAP help at http://help.sap.com/saphelp_45b/helpdata/en/41/191fce45fd11d188ff0000e8322f96/frameset.htm

  • Committed quantity and committed date in STO

    Hello friends,
    How and on what basis the committed quantity, committed dates updates in STO delivery schedule tab while doing the STO.
    Regards,
    Cherryk

    Cherry,
    During configuration of STO's, an availability check is assigned (IMG > MM > Purchasing > Purchase order  > Set up Stock transport order > Assign delivery type and checking rule).
    Because of this, during the creation of a STO, the system will perform an availability check for the material in the source plant.  The results of this ATP are the two fields that you have mentioned.  Zero in committed quantity means that the  ATP check found no material available, according to the ATP check you have assigned, on the date you have proposed.  A quantity less the entire quantity of the STO indicates that only a portion of the STO requirements was found to be available on the proposed date in the supplying plant.  
    Any time the committed quantity is less than the entire quantity of the STO, it means there is no assurance that there will be product available when the day comes to actually create the delivery note and PGI the STO.
    Any time a requirement is not committed during an ATP check, the possibility also then exists that other requirements in the supplying plant (such as new sales orders, or new production order dependent requirements) may take stock that you intended for use in your STO.  It is always wise (but not mandatory)  to manipulate your STOs so that committed qty  = delivery qty.
    Rgds,
    DB49

  • STO PO Process

    Hi All,
    I have 2 plants like 1100 and 1200.
    I have to do stock transfer from 1100 to 1200.
    Could you tell me the process in SAP.. 1100 what I have to do?(create PO and make GR) and 1200 what i have to do?
    Thanks & Best Regards,
    Priya.

    Dear,
    Within SAP Inventory Management, there are two methods how stocks are moved between plants using a 2-step process:
    Stock Transport Orders (UB)
    Transfer Posting
    What does 2-step mean?
    Example: Letu2019s assume stock is moving from Plant A (Storage Location 0001) to Plant B (storage location 0002).
    Two step means that two transactions will be used to move the stock. After the first transaction, stock has left plant A but it is not yet available at Plant B. Only after the second transaction is it available for use in Plant B.
    Some reasons for using 2-step movements (and not 1 step):
    Long time span between leaving Plant A and arriving at Plant B
    Need to control when goods leave plant A but not received at plant B
    Using Stock Transport Orders (STO)
    Steps:
    Create a Stock Transport Order (ME21N, Purchase Order doc type UB)
    Process Goods Issue against STO (MIGO > Goods Issue > PO) u2013 movement type 351
    Process Goods Receipt against STO (MIGO > Goods Receipt > PO) u2013 movement type 101
    The use of Planned Orders and Purchase Requisitions are optional.
    Using Transfer Postings (TP)
    Steps:
    Process a Transfer Posting (MIGO > Transfer Posting) u2013 movement type 303
    Process a Transfer Posting (MIGO > Transfer Posting) u2013 movement type 305
    The Transfer Posting can be done with reference to a Reservation. Although this is not used a lot.
    Similarities between Stock Transport Orders (STO) and Transfer Postings (TP)
    Both use transaction MIGO for both steps
    After first step, goods are already reflected in receiving plant and not available
    Differences between Stock Transport Orders (STO) and Transfer Postings (TP)
    Movement types are different
    351 & 101 for STO
    303 & 305 for TP
    Stock types at receiving plants are different
    - In Transfer (MARC-UMLMC) for TP
    - Stock in Transit (MARC-TRAME)for STO
    For STO, 351 and 101 is group together where for TP there is no link between 303 and 305
    STO requires more transactions than TP
    STO must be configured for the sending plant / receiving plant where no plant specific configuration exists for TP
    STO is based on Stock Transport Order (type of Purchase Order). Where no purchasing document is used for TP
    STO can be initiated with a Planned Order or Purchase Requisition
    Planning (MRP) can be used to initiate movements, but only STOu2019s
    Configuration required to use STO
    Config: MM > Purchasing > Purchase Order > Set up Stock Transport Order > Assign Document Type, One-Step Procedure, Underdelivery Tolerance
    Here the source plant, destination plant and allowed STO document type is specified.
    Regards,
    Syed Hussain.

  • STO Commited Qty Issue

    Dear All,
    We are facing issue in STO
    System is Showing 2 Schedlule Lines in the Delivery Tab of PO.
    Below is the snap shot of the Delivery Tab
    Delivery        Schedule
    Date              Qty                Time               Stat Del       Comm Dt        Comm Qty
    31.07.2011                                31.07.2011     23.07.2011     1
    31.07.2011     1     12:00:00     31.07.2011     23.07.2011     1
    Pleaee help me with the Commited Qty

    Hi,
    During configuration of STO's, an availability check is assigned (IMG > MM > Purchasing > Purchase order > Set up Stock transport order > Assign delivery type and checking rule).
    Because of this, during the creation of a STO, the system will perform an availability check for the material in the source plant. The results of this ATP are the two fields that you have mentioned. Zero in committed quantity means that the ATP check found no material available, according to the ATP check you have assigned, on the date you have proposed. A quantity less the entire quantity of the STO indicates that only a portion of the STO requirements was found to be available on the proposed date in the supplying plant.
    Any time the committed quantity is less than the entire quantity of the STO, it means there is no assurance that there will be product available when the day comes to actually create the delivery note and PGI the STO.
    Any time a requirement is not committed during an ATP check, the possibility also then exists that other requirements in the supplying plant (such as new sales orders, or new production order dependent requirements) may take stock that you intended for use in your STO. It is always wise (but not mandatory) to manipulate your STOs so that committed qty = delivery qty.
    Kuber

  • Planning strategy 50 consume the STO forecast

    Hi All,
    I have a scenerio of stock transfer demand from regional plant to production plant.
    The palnning strategy is s et to 50 in the production plant.The requirement is the STO of the regional plant should consume the forecast in the production plant.How can this to be done.
    Thanks
    Chindam

    Hi,
    For consumption of PIR by STO requirements you will have to activate the BADi MD_PIR_FLEX_CONS.
    When you create a PIR via MD61 in the Items tab specify the CI (Consumption indicator) as 4.
    If you want to get this by default then you will have to make changes in OMP6 for requirement class 103. But would suggest making a copy of 103 & then using the modified custom requirement class in a copy of standard strategy group 50.
    Regards,
    Vivek

  • Sto 2 step process

    Hi
    experts,
    i know about sto 1 step process.
    kindly give me the configuration steps for 2 step process.
    pls don't say in 2 step process updation takes place manually. i didn't get it.
    so give me complete steps.
    i searched in the forum but i didnt get it. may be i dont now proper search.
    so pls provide me configuration steps

    Hi,
    Within SAP Inventory Management, there are two methods how stocks are moved between plants using a 2-step process:
    Stock Transport Orders (UB)
    Transfer Posting
    What does 2-step mean?
    Example: Letu2019s assume stock is moving from Plant A (Storage Location 0001) to Plant B (storage location 0002).
    Two step means that two transactions will be used to move the stock. After the first transaction, stock has left plant A but it is not yet available at Plant B. Only after the second transaction is it available for use in Plant B.
    Some reasons for using 2-step movements (and not 1 step):
    Long time span between leaving Plant A and arriving at Plant B
    Need to control when goods leave plant A but not received at plant B
    Using Stock Transport Orders (STO)
    Steps:
    Create a Stock Transport Order (ME21N, Purchase Order doc type UB)
    Process Goods Issue against STO (MIGO > Goods Issue > PO) u2013 movement type 351
    Process Goods Receipt against STO (MIGO > Goods Receipt > PO) u2013 movement type 101
    The use of Planned Orders and Purchase Requisitions are optional.
    Using Transfer Postings (TP)
    Steps:
    Process a Transfer Posting (MIGO > Transfer Posting) u2013 movement type 303
    Process a Transfer Posting (MIGO > Transfer Posting) u2013 movement type 305
    The Transfer Posting can be done with reference to a Reservation. Although this is not used a lot.
    Similarities between Stock Transport Orders (STO) and Transfer Postings (TP)
    Both use transaction MIGO for both steps
    After first step, goods are already reflected in receiving plant and not available
    Differences between Stock Transport Orders (STO) and Transfer Postings (TP)
    Movement types are different
    351 & 101 for STO
    303 & 305 for TP
    Stock types at receiving plants are different
    - In Transfer (MARC-UMLMC) for TP
    - Stock in Transit (MARC-TRAME)for STO
    For STO, 351 and 101 is group together where for TP there is no link between 303 and 305
    STO requires more transactions than TP
    STO must be configured for the sending plant / receiving plant where no plant specific configuration exists for TP
    STO is based on Stock Transport Order (type of Purchase Order). Where no purchasing document is used for TP
    STO can be initiated with a Planned Order or Purchase Requisition
    Planning (MRP) can be used to initiate movements, but only STOu2019s
    Configuration required to use STO
    Config: MM > Purchasing > Purchase Order > Set up Stock Transport Order > Assign Document Type, One-Step Procedure, Underdelivery Tolerance
    Here untick the one step procedure for document type ub and nl. It will perform the 2 step process in STO.
    Here the source plant, destination plant and allowed STO document type is specified.
    Thanks
    Prashant
    Edited by: p.x.sharma on Dec 4, 2011 5:33 PM

  • Automatic creation of intercompany PO when creating a Sales Order

    Hi Experts
    Is there a standard way of triggering an intercompany PO when creating a sales order to the final customer (or the other way around, triggering a sales order to the end customer upon creation of an intercompany PO)? Scenario: business has setup a logistics company (company code X), which its purpose is to deliver goods to the final customer (home customers). However, sales orders are created from seperate chain of stores which belong to another company code (company code Y). This chain of stores have one sales organisation (since there is over 1000 stores under a chain). I need a way to represent that a sale originated from a store/plant belonging to company Y to end customer A. Also, I need a billing document (intercompany) from company code X to store/plant beloning to company Y.
    Issues: in the intercompany config (assign intern customer numbers to sales org) - is there a way to assign a customer number at site/plant level so that when creating an intercompany billing it can be picked instead of the one assigned to the sales org and where can this be specified in the sales order (remember: in my scenario there are multiple stores/plants that belong to one sales organisation and it is not possible to use one customer number linked to the sales organisation.)
    Desired results:
    Sales order from store/plant YY belonging to company code Y to end customer A
    Intercompany billing from plant XX belonging to company code X to store/plant YY
    End customer billing from store/plant YY to end customer A
    Thank you in advance for your help.

    Hello Tsmash  
    I think you can acheive this with Regular Sales order + Inter Company STO combination.
    Maintain customer numbers for each of the Plants from Company Y for the sales area belonging to Company X.
    Then do the config for STO in MM using this menu path:
    SPRO/Materials Management/Purchasing/Purchase Order/Set up Stock Transport Order
    Here, in the activity 'Define Shipping Data for Plants',  enter each of the plant-customers and the Sales area belonging to Comany code Y. Carry out other activities in this area appropriately.
    Similarly set up Custom ( say Z1) Special Procurement type for Plant YY for stock transfer from XX using this menu path:
    SPRO/Production/Material Requirements Planning/Master Data/Define Special Procurement Type:
    Here maintain procurement type as F, Special procurement as U and plant as XX. You may need to repeat this config for each of the receiving plants (over 1000 stores under a chain)  from co code Y.
    In the material master MRP 2 for Plant YY,  maintain procurement type as F and Special Procurement as Z1.
    Sales order will be received under Co Code Y and sales area belonging to Y form customer A,
    Because of the MRP config, a PO (STO) requirement will be raised on Co code X and plant XX. XX will send the goods to YY via a STO delivery using the Shipping data from 'Set up STO' config,
    Plant YY will send the goods to A and bill that customer. Co Code X will raise an inter-comany bill on Co code Y.
    That's how it should work. Try it and revert with any issues.

  • Stock transport order requiremnet date does not match in tranRRP3) &MD04

    STO delivery date does not match in transaction MD04 (ECC 6.0) and RRP3 (SCM5.1). This situation occurs when delivery date in STO is past due.  During Shipment Scheduling & avaibilty check, materail staging/availability date(EKET-MBDAT) get updated with current date. This EKET -MBDAT date is reflecting in the stock requirement list as a requirement date which is correct. Still APO product view screen dispalys the past due date as a requiremnet date instead of date in MBDAT.
    Please let me know in case of any more clarification on this.

    Dear Sanjay,
    STO Delivery Date is receipt date at destination location. This minus Transportation Lead time is STO requirement date at source.
    When you conduct ATP check for this PO/STO, your committed date is updated at source and delivery date will be updated as committed date plus TL lead time.
    Do check your GR/GI times in Product Master as primary date mismatch issue.
    If you are using any Customized program for updating EKET-MBDAT, it wont automatically trigger the change date in APO.
    In such cases you need to run CCR in APO and reconcile.
    The better way is to periodically schedule IM initialization (RIMODINI). This maps all R3/ECC data in your IM for PO/STOs and you would see the consistency in APO and ECC.
    Regards,
    Bipin

  • I need urgent help for the logic

    hi all,
    Initially, the requirement was to create PO regardless the Purchase Requisition based on the formula
    If (Open Qty + Current Stock) < Safety Stock ==>> THEN A PO NEEDS TO BE CREATED
    This is absolutely fine, this created the PO as per the above condition.
    OUR REQUIREMENT
    Modify the same program to create PO's only if there is any PR for that material . Meaning, turn all the PR's into PO. Also, when creating PO, the delivery date should be = (Current date - 7 days) when creating a PO for an PR(I think the table name is VETVG.)  Nothing else. We need to change the  IF condition in the following code .
    so can any one let me that what modification i need to do ie what logic i should use to get the requirement fullfilled.
    *Report  Z_STO_SAFETY_STOCK                                            *
    Program Name : Z_STO_SAFETY_STOCK                                    *
    Date         : 09.03.2007                                            *
    Programmer   : Rajdeep Kumar
    Last Change  : Van Tran                22/03/2007                    *
    Specification:                                                       *
    Program Type : Report                                                *
    Description  : Create STO requirement for Plant
    Transaction  : None                                                  *
    Input Files  : None                                                  *
    Output Files : None                                                  *
    Scheduling Issues :                                                  *
    Run Frequency :                                                      *
    Mod#    Date          By            Description                      *
    New   09.03.2007   Rajdeep Kumar     Created                         *
                       DEVK905890                                        *
    M01   20.03.2007   Rajdeep Kumar     Material Group Added to         *
                       DEVK905892        Selection Screen                *
    *Update 05.04.2007   DEVK906082        Added two new selection         *
                                         fields beskz and sobsl          *
                                         and is select statement         *
    REPORT  z_sto_safety_stock NO STANDARD PAGE HEADING.
    *&                       TABLES
    TABLES:
            t001w,
          marc.                                               " M01
            marc,                                               " M01
            mara.                                               " M01
    *&                     DATA DECLARATION
    DATA: BEGIN OF it_marc OCCURS 0,
            matnr LIKE marc-matnr,
            werks LIKE marc-werks,
            eisbe LIKE marc-eisbe,
          bstmi LIKE marc-bstmi,
            bstrf LIKE marc-bstrf,
            beskz LIKE marc-beskz,
            sobsl LIKE marc-sobsl,
          END OF it_marc.
    DATA: BEGIN OF it_mard OCCURS 0,
            matnr LIKE mard-matnr,
            werks LIKE mard-werks,
            labst LIKE mard-labst,
          END OF it_mard.
    DATA: BEGIN OF it_po OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po.
    DATA: BEGIN OF it_po_2 OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            ebeln LIKE ekko-ebeln,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po_2.
    DATA: BEGIN OF it_po_pend OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            pendi LIKE eket-menge,
          END OF it_po_pend.
    DATA: BEGIN OF wa_join OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF wa_join.
    DATA : BEGIN OF itab_marc_mard OCCURS 0,
             werks  LIKE marc-werks,
             matnr  LIKE marc-matnr,
             eisbe  LIKE marc-eisbe,
           bstmi  LIKE marc-bstmi,
             bstrf  LIKE marc-bstrf,
             beskz  LIKE marc-beskz,
             sobsl  LIKE marc-sobsl,
             labst  LIKE mard-labst,
             menge  LIKE ekpo-menge,
             ordqty LIKE ekpo-menge,
           END OF itab_marc_mard.
    DATA: BEGIN OF it_sto OCCURS 0,
          werks LIKE mard-werks,
          matnr LIKE mard-matnr,
          orqty LIKE ekpo-menge,
          eisbe LIKE marc-eisbe,
        bstmi LIKE marc-bstmi,
          bstrf LIKE marc-bstrf,
          beskz LIKE marc-beskz,
          sobsl LIKE marc-sobsl,
          labst LIKE mard-labst,
          pendi LIKE eket-menge,
          END OF it_sto.
    DATA: ws_poheader            LIKE   bapimepoheader.
    DATA: ws_poheaderx           LIKE   bapimepoheaderx .
    DATA: ws_ebeln               TYPE   mepoheader-ebeln.
    DATA: ws_posnr               LIKE   ekpo-ebelp.
    DATA: ws_etenr               LIKE   eket-etenr VALUE '0001'.
    DATA: ws_purchaseorder       LIKE   ekko-ebeln.
    DATA: ws_flg1                TYPE   c. " VALUE 'X'.
    DATA: ws_flg2                TYPE   c.
    DATA: ws_flg3                TYPE   c.
    *-- For Handling Error Messages in BAPI
    DATA: tbl_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *-- For Item Details
    DATA: tbl_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: tbl_posched LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poschedx LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
    *&                       CONSTANTS
    CONSTANTS:   ws_flg            TYPE   c   VALUE 'X'.
    CONSTANTS:   c_unistruct(2)    TYPE   c   VALUE 'Z3'. "For UNISTRUCT STO
    *&                      SELECTION-SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR t001w-werks,
                  s_matnr FOR marc-matnr.                     " M01
                    s_matnr FOR marc-matnr,                     " M01
                    s_matkl FOR mara-matkl,                     " M01
                    s_beskz FOR marc-beskz,
                    s_sobsl FOR marc-sobsl.
    PARAMETERS:     p_test  TYPE check.
    SELECTION-SCREEN : END OF BLOCK b1.
    *&                      START OF SELECTION EVENT
    START-OF-SELECTION.
    Get the Safety Stock & Minimum Lot Size for the materials
      PERFORM get_plant_data.
    Get the Quantities in stock
      PERFORM get_stock_data.
    Determine the open quantities for the materials concerned
    [EKKO, EKET, EKPO]
      PERFORM get_open_quantities.
    PERFORM open_quantities.
    Determine overall the quantities required for each material
      PERFORM determine_mat_qty_required.
    Print the details
      PERFORM print_details.
      IF p_test EQ space.
      PO is created for each plant.
      Create the PO required.
        PERFORM create_po.
      Create the PO's for each plant with the materials required
       PERFORM create_header_item.
      Bapi call to create a Purchase order
       PERFORM create_purhase_order.
      ENDIF.
    END-OF-SELECTION.
    TOP-OF-PAGE.
      PERFORM print_header.
    *&      Form  get_plant_data
          To get the Safety Stock
    -->  p1        text
    <--  p2        text
    FORM get_plant_data .
    start                                                     " M01
    SELECT      matnr werks eisbe bstmi
    INTO TABLE  it_marc
    FROM        marc
    WHERE       matnr IN s_matnr AND
                werks IN s_werks AND
                eisbe GT 0.
    end                                                       " M01
    start                                                     " M01
      SELECT      marc~matnr werks eisbe bstrf beskz sobsl
                                                              " bstmi
      INTO TABLE  it_marc
      FROM        marc AS marc
      INNER JOIN  mara AS mara
      ON          maramatnr EQ marcmatnr
      WHERE       marc~matnr IN s_matnr AND
                  werks      IN s_werks AND
                  matkl      IN s_matkl AND
                  beskz      IN s_beskz AND
                  sobsl      IN s_sobsl AND
                  eisbe      GT 0.
    end                                                       " M01
    ENDFORM.                    " get_plant_data
    *&      Form  get_stock_data
         To get the Current Stock
    -->  p1        text
    <--  p2        text
    FORM get_stock_data .
      DATA: BEGIN OF lt_mard OCCURS 0,
              matnr LIKE mard-matnr,
              werks LIKE mard-werks,
              lgort LIKE mard-lgort,
              labst LIKE mard-labst,
            END OF lt_mard.
      CHECK NOT it_marc[] IS INITIAL.
      SELECT      matnr werks lgort labst
      INTO TABLE  lt_mard
      FROM        mard
      FOR         ALL ENTRIES IN it_marc
      WHERE       matnr EQ it_marc-matnr AND
                  werks EQ it_marc-werks.
      SORT lt_mard BY matnr werks.
      LOOP AT lt_mard.
        AT NEW werks.
          it_mard-matnr = lt_mard-matnr.
          it_mard-werks = lt_mard-werks.
        ENDAT.
        it_mard-labst = it_mard-labst + lt_mard-labst.
        AT END OF werks.
          APPEND it_mard.
          CLEAR  it_mard.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_stock_data
    *&      Form  open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM open_quantities .
    Storing MARC and MARD data in an internal table to find the open
    quantities
      LOOP AT it_marc.
        itab_marc_mard-matnr = it_marc-matnr.
        itab_marc_mard-werks = it_marc-werks.
        itab_marc_mard-eisbe = it_marc-eisbe.
      itab_marc_mard-bstmi = it_marc-bstmi.
        itab_marc_mard-bstrf = it_marc-bstrf.
        itab_marc_mard-beskz = it_marc-beskz.
        itab_marc_mard-sobsl = it_marc-sobsl.
        READ TABLE it_mard WITH KEY matnr = it_marc-matnr.
        IF sy-subrc EQ 0.
          itab_marc_mard-labst = it_mard-labst.
        ENDIF.
        APPEND itab_marc_mard.
        CLEAR itab_marc_mard.
      ENDLOOP.
      CHECK NOT itab_marc_mard[] IS INITIAL.
    Join EKKO EKPO
      SELECT a~ebeln
             b~ebelp
             b~werks
             b~matnr
             b~menge
             c~etenr
             c~wamng
             INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM ekpo AS b
      INNER JOIN ekko AS a
      ON aebeln = bebeln
      INNER JOIN eket AS c
      ON bebeln = cebeln AND bebelp = cebelp
      FOR ALL ENTRIES IN itab_marc_mard
      WHERE b~matnr = itab_marc_mard-matnr AND
            b~werks IN s_werks .
      DATA : t_menge TYPE ekpo-menge . "local variable
    *Store the contents of it_po to the work area to get the minimum order
    *quantity
      wa_join[] = it_po[].
      LOOP AT it_po.
    delete the entries where MENGE = WAMNG
        DELETE it_po WHERE menge = it_po-wemng.
        LOOP AT wa_join WHERE matnr = it_po-matnr
                               AND werks = it_po-werks.
          t_menge = t_menge + wa_join-menge.
        ENDLOOP.
        it_po-menge = t_menge.
        MODIFY TABLE it_po TRANSPORTING menge.
        CLEAR  :t_menge.
      ENDLOOP.
    Once you get the quantities delete the repeating materials for the
    plant.
      DELETE ADJACENT DUPLICATES FROM it_po COMPARING werks matnr.
      SORT it_po BY matnr.
      LOOP AT itab_marc_mard.
        READ TABLE it_po WITH KEY matnr = itab_marc_mard-matnr
            APPEND it_sto.
        ELSE.
          WRITE:/ 'There are no open quantities to create Purchase order'.
        ENDIF.
        CLEAR it_sto.
      ENDLOOP.                         werks = itab_marc_mard-werks BINARY
    SEARCH.
        itab_marc_mard-ordqty = itab_marc_mard-labst + it_po-menge .
         If Open quantiy + Current Stock < Safety Stock
        IF itab_marc_mard-ordqty LE itab_marc_mard-eisbe.
         Minimum order qty = Safety Stock - (Open qty + current stock)
          itab_marc_mard-ordqty = itab_marc_mard-eisbe - ( it_po-menge +
    itab_marc_mard-labst )  .
           Move all the contents to the internal table it_sto ie Plant,
    Material and the Min Order Qty
           so that we can create PO based on this internal table
          it_sto-matnr = itab_marc_mard-matnr.
          it_sto-werks = itab_marc_mard-werks.
          it_sto-orqty = itab_marc_mard-ordqty.
    ENDFORM.                    " open_quantities
    *&      Form  CREATE_HEADER_ITEM
          text
    FORM create_header_item.
      LOOP AT it_sto.
    *--- Document date with flag
        ws_poheader-doc_date             = sy-datum.
        ws_poheaderx-doc_date            = ws_flg.
    *--- Document type with flag
        ws_poheader-doc_type             = 'Z3'(c01).
        ws_poheaderx-doc_type            = ws_flg.
    *--- Purchasing group with Flag
        ws_poheader-pur_group            = '005'.   " hardcoded
        ws_poheaderx-pur_group           =  ws_flg.
    *--- Purchasing Organization with flag
        ws_poheader-purch_org            = '2000'.
        ws_poheaderx-purch_org           = ws_flg.
    *--- Supply plant with flag
        ws_poheader-suppl_plnt           = '2000'.
        ws_poheaderx-suppl_plnt          = ws_flg.
    *--- Company Code with flag
        ws_poheader-comp_code            = '2000'.
        ws_poheaderx-comp_code           = ws_flg.
    *<--- assinging new item No.
        ws_posnr = ws_posnr + 10.
    *POPULATE ITEM DATA.
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
    *POPULATE ITEM FLAG TABLE
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      ENDLOOP.
    ENDFORM.                    "CREATE_PO
    *&      Form
          text
    -->  p1        text
    <--  p2        text
    FORM create_purhase_order .
      CLEAR:  tbl_poitem,
              tbl_poitemx,
              ws_poheader,
              ws_poheaderx.
      REFRESH:  tbl_poitem,
                tbl_poitemx.
      CLEAR  : tbl_return.
      REFRESH: tbl_return.
    *<--- Bapi to create Purchase order
      IF NOT tbl_poitem[] IS INITIAL.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            poheader         = ws_poheader
            poheaderx        = ws_poheaderx
          IMPORTING
            exppurchaseorder = ws_purchaseorder
          TABLES
            return           = tbl_return
            poitem           = tbl_poitem
            poitemx          = tbl_poitemx.
        READ TABLE tbl_return WITH KEY type = 'E'.
    *<--- Bapi to commit the changes
        IF sy-subrc <> 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
        ENDIF.
      ENDIF.
      LOOP AT tbl_return.
    *<--- Ignore the warning messages
        IF tbl_return-type = 'W'.
          CONTINUE.
        ENDIF.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        IF tbl_return-type = 'S'.
          FORMAT COLOR COL_POSITIVE ON.
        ELSEIF tbl_return-type = 'W'.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
        ELSEIF tbl_return-type = 'E'.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
        ENDIF.
        WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)  tbl_return-message
               86(10) tbl_return-field,95(20) tbl_return-system.
        FORMAT COLOR OFF.
      ENDLOOP.
    ENDFORM.                    " create_purhase_order
    *&      Form  get_open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM get_open_quantities .
      CHECK NOT it_mard[] IS INITIAL.
      SELECT      ekkoebeln ekpoebelp ekpowerks ekpomatnr
                  ekpomenge eketetenr eket~wemng
                  INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM        ekko AS ekko
      INNER JOIN  ekpo AS ekpo
      ON          ekpoebeln EQ ekkoebeln
      INNER JOIN  eket AS eket
      ON          eketebeln EQ ekpoebeln AND
                  eketebelp EQ ekpoebelp
      FOR         ALL ENTRIES IN it_mard
      WHERE       ekko~bstyp EQ 'F'             AND
                  ekko~bsart EQ 'Z3'            AND
                  ekko~bsakz EQ 'T'             AND
                  ekko~loekz EQ space           AND
                  ekpo~matnr EQ it_mard-matnr   AND
                  ekpo~werks EQ it_mard-werks   AND
                  ekpo~loekz EQ space           AND
                  ekpo~elikz EQ space.
      SORT it_po BY ebeln ebelp etenr.
    delete entries where the schedule is complete, else copy to new table
      LOOP AT it_po.
        IF it_po-wemng GE it_po-menge.
          DELETE it_po.
        ELSE.
          MOVE-CORRESPONDING it_po TO it_po_2.
          APPEND it_po_2.
          CLEAR  it_po_2.
        ENDIF.
      ENDLOOP.
      SORT it_po_2 BY matnr werks.
    To determine the pending quantities of the materials at plant level
      LOOP AT it_po_2.
        AT NEW werks.
          it_po_pend-matnr = it_po_2-matnr.
          it_po_pend-werks = it_po_2-werks.
        ENDAT.
        it_po_pend-pendi = it_po_pend-pendi + it_po_2-menge - it_po_2-wemng.
        AT END OF werks.
          APPEND it_po_pend.
          CLEAR  it_po_pend.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_open_quantities
    *&      Form  determine_mat_qty_required
          text
    -->  p1        text
    <--  p2        text
    FORM determine_mat_qty_required .
      DATA: lv_eisbe LIKE marc-eisbe,
            lv_labst LIKE mard-labst,
            lv_menge LIKE eket-menge,
          lv_bstmi_old LIKE marc-bstmi,
            lv_bstrf_old LIKE marc-bstrf,
            lv_beskz_old LIKE marc-beskz,
            lv_sobsl_old LIKE marc-sobsl,
            lv_pendi LIKE eket-menge,
            lv_total_conf     LIKE ekpo-menge,
          lv_bstmi          LIKE marc-bstmi,
          lv_min_qty        LIKE marc-bstmi,
            lv_bstrf          LIKE marc-bstrf,
            lv_min_qty        LIKE marc-bstrf,
            lv_qty_req        LIKE mard-labst,
            lv_remainder      TYPE i.
      LOOP AT it_marc.
      safety stock
        lv_eisbe = it_marc-eisbe.
       lv_bstmi_old = it_marc-bstmi.
         lv_bstrf_old = it_marc-bstrf.
         lv_beskz_old = it_marc-beskz.
         lv_sobsl_old = it_marc-beskz.
        READ TABLE it_mard
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        qty onhand
          lv_labst = it_mard-labst.
        ELSE.
          CLEAR lv_labst.
        ENDIF.
        READ TABLE it_po_pend
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        PO pending qty
          lv_pendi = it_po_pend-pendi.
        ELSE.
          CLEAR lv_pendi.
        ENDIF.
      Total qty on hand & PO qty pending
        lv_total_conf = lv_labst + lv_pendi.
      Now determine if a PO is required for the material concerned.
        IF lv_total_conf < lv_eisbe.
          it_sto-matnr = it_marc-matnr.
          it_sto-werks = it_marc-werks.
          it_sto-eisbe = lv_eisbe.
        it_sto-bstmi = lv_bstmi_old.
          it_sto-bstrf = lv_bstrf_old.
          it_sto-beskz = lv_beskz_old.
          it_sto-sobsl = lv_sobsl_old.
          it_sto-labst = lv_labst.
          it_sto-pendi = lv_pendi.
        Actual Qty Required
          lv_qty_req = lv_eisbe - lv_total_conf.
         IF it_marc-bstmi IS INITIAL.
           IF it_marc-bstrf IS INITIAL.
            it_sto-orqty = lv_qty_req.
          ELSE.
           lv_bstmi = it_marc-bstmi.
           lv_min_qty = it_marc-bstmi.
             lv_bstrf = it_marc-bstrf.
             lv_min_qty = it_marc-bstrf.
            DO.
              IF lv_qty_req <= lv_min_qty.
                lv_qty_req = lv_min_qty.
                it_sto-orqty = lv_qty_req.
                EXIT.
              ELSE.
               lv_min_qty = lv_min_qty + lv_bstmi.
                 lv_min_qty = lv_min_qty + lv_bstrf.
              ENDIF.
            ENDDO.
          ENDIF.
          APPEND it_sto.
          CLEAR  it_sto.
        ENDIF.
      ENDLOOP.
      SORT it_sto BY werks matnr.
    ENDFORM.                    " determine_mat_qty_required
    *&      Form  print_details
          text
    -->  p1        text
    <--  p2        text
    FORM print_details .
      LOOP AT it_sto.
        WRITE:/ it_sto-werks UNDER text-h01,
                it_sto-matnr UNDER text-h02,
                it_sto-orqty UNDER text-h03,
                it_sto-eisbe UNDER text-h04,
              it_sto-bstmi UNDER text-h05,
                it_sto-bstrf UNDER text-h05,
                it_sto-labst UNDER text-h06,
                it_sto-pendi UNDER text-h07.
      ENDLOOP.
    ENDFORM.                    " print_details
    *&      Form  print_header
          text
    -->  p1        text
    <--  p2        text
    FORM print_header .
      WRITE:  AT 001 text-h01,
                 015 text-h02,
               030 text-h03,
               050 text-h04,
               070 text-h05,
               090 text-h06,
               110 text-h07.
                 030 text-h03 RIGHT-JUSTIFIED,
                 050 text-h04 RIGHT-JUSTIFIED,
                 070 text-h05 RIGHT-JUSTIFIED,
                 090 text-h06 RIGHT-JUSTIFIED,
                 110 text-h07 RIGHT-JUSTIFIED.
      NEW-LINE.
    ENDFORM.                    " print_header
    *&      Form  create_po
          text
    -->  p1        text
    <--  p2        text
    FORM create_po .
    *-Document date with flag
      ws_poheader-doc_date             = sy-datum.
      ws_poheaderx-doc_date            = ws_flg.
    *-Document type with flag
      ws_poheader-doc_type             = 'Z3'(c01).
      ws_poheaderx-doc_type            = ws_flg.
    *-Purchasing group with Flag
      ws_poheader-pur_group            = '005'.   " hardcoded
      ws_poheaderx-pur_group           =  ws_flg.
    *-Purchasing Organization with flag
      ws_poheader-purch_org            = '2000'.
      ws_poheaderx-purch_org           = ws_flg.
    *-Supply plant with flag
      ws_poheader-suppl_plnt           = '2000'.
      ws_poheaderx-suppl_plnt          = ws_flg.
    *-Company Code with flag
      ws_poheader-comp_code            = '2000'.
      ws_poheaderx-comp_code           = ws_flg.
      LOOP AT it_sto.
        AT NEW werks.
          CLEAR  tbl_poitem.
          CLEAR  tbl_poitemx.
          CLEAR  tbl_return.
          CLEAR  tbl_posched.
          CLEAR  tbl_poschedx.
          REFRESH tbl_poitem.
          REFRESH tbl_poitemx.
          REFRESH tbl_return.
          REFRESH tbl_posched.
          REFRESH tbl_poschedx.
          CLEAR ws_posnr.
        ENDAT.
        ws_posnr = ws_posnr + 10.
      Item Data
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
      Item X Data
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      Schedule Data
        tbl_posched-po_item = ws_posnr.
        tbl_posched-sched_line = '0001'.
        tbl_posched-delivery_date = sy-datum.
        tbl_posched-quantity = it_sto-orqty.
        APPEND tbl_posched.
        CLEAR  tbl_posched.
      Schedule Data X
        tbl_poschedx-po_item = ws_posnr.
        tbl_poschedx-po_itemx = ws_flg.
        tbl_poschedx-sched_line = '0001'.
        tbl_poschedx-sched_linex = ws_flg.
        tbl_poschedx-delivery_date = ws_flg.
        tbl_poschedx-quantity = ws_flg.
        APPEND tbl_poschedx.
        CLEAR  tbl_poschedx.
        AT END OF werks.
        Create the PO
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader         = ws_poheader
              poheaderx        = ws_poheaderx
            IMPORTING
              exppurchaseorder = ws_purchaseorder
            TABLES
              return           = tbl_return
              poitem           = tbl_poitem
              poitemx          = tbl_poitemx
              poschedule       = tbl_posched
              poschedulex      = tbl_poschedx.
          LOOP AT tbl_return WHERE type EQ 'E' OR type EQ 'A'.
            EXIT.
          ENDLOOP.
        If Loop is false - then no error occurred
          IF sy-subrc NE 0.
          No Errors - Commit
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = 'X'.
          ENDIF.
          SKIP.
          LOOP AT tbl_return.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
            IF tbl_return-type = 'E' OR tbl_return-type = 'A'.
              FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
            ELSEIF tbl_return-type = 'W'.
              FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
            ELSE.
              FORMAT COLOR COL_POSITIVE ON.
            ENDIF.
            WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)
    tbl_return-message,
                   86(10) tbl_return-field,95(20) tbl_return-system.
            FORMAT COLOR OFF.
          ENDLOOP.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " create_po

    Hi,
    first you can store these 2 dates into some internal table sat it_sobid  and it_ObjectID.Now
    sort  it_sobid ascending.
    loop at  it_ObjectID.
    Read date from  it_sobid  binary search index sy-index.
    it_ObjectID-date =  it_sobid-date.
    flag = 'y'.
    endloop.
    you can write some logic like this. Its just a rough idea you can modify according to ur need.
    Regards,
    Ravi

  • Collective purchase order linke with auto replenishment process

    Hi!
    This is with reference to linking  collective putchase order with auto replenishment process.
    For eg: an article defined with replenishment parameter(the reorder point and target stock). while running collective purchase order using transaction wf10...will system consider the reorder point and target stock and raise the PO.

    Hi Jyotsna,
    The collective purchase order should be used in DC level. That means, based on Stores STO, system automatically converts STO requirements into CPO.
    If you want consider Reorder point and target stock, then this is putaway process. That means, DC will maintain and replenish stock based on your inventory norms fixed by you.
    Hope this information will be useful.
    Bye,
    Muralidhara

  • Standard business content Data source

    Hi Experts,
    Could you please let me know, which standard business content Data source will be suitable for the below business attributes?
    Stock Transfer Order (STO) Number
    STO Creation Date
    Delivery Creation Date
    STO required Date
    Thanks,
    Gana

    Hi All,
        Please let me know the business content extractor for the BFOK_A Table.
    Thanks
    Srinivas.

  • Delivery type relevant to MRP

    Hi Friends
    When we create Stock transfer order, in MD04  the PO and MRP elements appearing for  both the plants.(supplying and Receiving plant)
    After creating  Outbound delivery against PO from Supplying plant the PO (Ord.Ds) is not appearing in the MD04
    My issue is the PO has to appear in MD04 untill PGI.
    What MRP settings I have to check/Change to solve this.
    Regards,
    Srihari.M

    Srihari,
    I am curious as to your reason for wanting to see the STO requirement, when in fact the delivery is the object that is creating the requirement.
    I suppose one solution would be not use a delivery at all.
    Stock Transport Order Without Delivery - Managing Special Stocks (MM-IM) - SAP Library
    When you elect to use STOs with deliveries, in the standard process the delivery requirement replaces the STO requirement in the supplying plant.  I am not aware of any standard configuration that would bypass this behavior.
    Best Regards,
    DB49

  • Stock Transfer between the Plants Abroad

    Dear Experts,
    I need any one of your guidence in step by step configuration of stock transfer order between the plants situated in two different countries under one company code in EOU.This STO requires billing document to be posted to A/C with Zero Value for INTRASTAT purpose.Any guidence will be appreciated.
    Thanks in advance.
    Regards
    kumar

    Dear Kumar
    Please check the links
    [Plants Abroad|http://help.sap.com/saphelp_46c/helpdata/en/e5/077f984acd11d182b90000e829fbfe/frameset.htm]
    [Plants abroad: Sales-specific settings |http://help.sap.com/saphelp_46c/helpdata/en/34/60b19dae724effe10000009b38f91f/frameset.htm]
    thanks
    G. Lakshmipathi

  • After PR convert to PO, MRP does not consider PO as the supply

    Hi gurus,
    The problem is like the following:
    Material A, Plant : CN01 Procurement type: F ( External procurement)
    Avability check group-- 002( standard one )
    MRP type -- PD( standard one)
    Requirement-- 100 PC.
    What I did is :
    1) Run MD02 ( MRP) to generate a PR with qty 100
    2) Convert this PR to PO with qty 100.
    3) Re-run MRP for this material, system generate another PR with qty 100 on the same date.
    Which will lead to duplicate stock.
    Please help on this question.
    Thanks a lot.

    Hi Guys,
    I am sorry, I am not quite understand it.
    In my understanding, if I tick " stock transfer order" in OPPQ, system will take the incoming STO as the supply, not the requirement.
    MD04 is showing:   Plant CN01
                                                    Rec/reqd                    Avaible qty       Delivery plant
    Stock                                                                         0
    POitem                                     1000                          1000
    PR                                            1000                          2000
    PRqRel                                      -1000                        1000                 CN02
    So what I am saying is the requirement---- PRqRel is a STO requirement.
    After i tick the box as you mentioned, MRP still does not delete the PR using parameter 13132.
    Please correct me if you have any concern.

Maybe you are looking for

  • Having a problem with ilife 08 and leopard screen saver

    Hi, Not sure if this is an osx leopard issue or a ilife 08 issue but before I did the upgrade I was able to use my entire iphoto library as random photos in the screensaver. Not it only let's me choose specific events or last import. it does not let

  • In address book, how do I make a group?

    How do I make a group in address book?

  • Can we rename the existing z-program in SAP-abap

    Can we rename the existing z-program in SAP-abap. If yes, than how it can be done. But actually we don't want to copy the code from the existing z-program to the new one which will be created. We just want to make rename the existing z-program in SAP

  • Set  database  charcter set as us7ascii in oracle 11gr1

    Dear Friends, I want to set my character set as us7ascii in oracle 11gr1. But i heared that this charcterset is old charcter set and it is not used in oracle 11gr1. But client need this charcter set alone. They dont need any other equalent charcter s

  • E71 does not strip leading 0 from numbers in conta...

    Hi Having synced contacts from Outlook, I find that the E71 doesn't know what to do with leading zeros in the numbers when the country code is present. If my contact has either of these formats: +44 (0) 1234 567890 +44 (01234) 567809 then the number