Netting the open quantity

Hi Guys,
             I have PO quantity(EKPO-MENGE)  and goods receipt quantity(MSEG-ERFMG). Here i want to calculate the open PO quantity which is  EKPO-MENGE - MSEG-ERFMG .But here if  multiple material docements r getting created for the same for one PO and partial goods receipt quantity is done thru these multiple material documents. then how to net the open quantity.
For example :
PO no   PO quantity material documents GR quantity
10            10             100                              1
                                200                              2
                                300                             -2
                                400                              3
Now i need  the open quantity as  9
                                                  7
                                                  9
                                                  6.
Even i tried with At new Ebeln.but i am not getting it.
Can anybody help me in this.

Hi,
Open PO Line Item Qty = PO Line Item Qty - ( Sum(All GR Qty for PO Line Item ) -
                                                                    Sum(All GR Return Qty for PO Line Item) ).
PO Line Item Qty = EKPO-MENGE.
GR QTY for PO Line Item = EKBE-MENGE with Movement Type = '101'.
GR Return QTY for PO Line Item = EKBE-MENGE with Movement Type = '102'.
SELECT  EKPOMENGE EKPOMEINS
FROM EKKO   INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
                       INNER JOIN EKET ON EKETEBELN = EKPOEBELN AND
                                                         EKETEBELP = EKPOEBELP
                       INNER JOIN LFA1 ON LFA1LIFNR = EKKOLIFNR
  INTO CORRESPONDING FIELDS OF TABLE I_PO
  WHERE  EKKO~BUKRS =  P_BUKRS AND
    EKPO~WERKS =  P_WERKS AND
    EKKO~LIFNR IN S_LIFNR AND
    EKPO~MEINS IN S_MEINS AND
    EKET~EINDT IN S_EINDT AND
    EKKO~BSTYP =  'F'     AND "Select PO Only"
    EKKO~LOEKZ = ' '      AND "PO should not be deleted"
    EKPO~LOEKZ = ' '  .       "Line Item Should not be DEL
Fetch the PO History Details for the Records of the Internal Table i_po.
  LOOP AT I_PO.
    SELECT   EBELN EBELP BWART MENGE WRBTR
    FROM    EKBE
    APPENDING CORRESPONDING FIELDS OF TABLE   I_EKBE
    WHERE  EBELN = I_PO-EBELN AND
              EBELP = I_PO-EBELP AND
              BEWTP IN ('E','F').
  ENDLOOP.
Edited by: AJAY TIWARI on Oct 19, 2008 5:00 PM

Similar Messages

  • How to calculate the OPEN QUANTITY in delivery Duelist Report

    Hi Everybody,
       I have a query for finding out the OPEN QUANTITY for schedulines for a delivery.
    If for example the report is run for 2nd of February, it is necessary to
    determine whether there are delivery relevant schedule lines before the
    2nd.
    If yes, we need to know whether there is an open quantity to this line
    item.
    If yes, this open quantity is a negative deviation (we delivered not
    enough).
    If there is no open quantity it is necessary to determine whether for the
    earliest future to be deleviered schedule line, the open quantity equals
    the ordered quantity (VBEP-WMENG),
    if No the the difference between both values equals the positive deviation
    (we delivered more than requested)
    If the open quantity equals the ordered quantity there is no deviation.
    The problem is to calculate the open quantity and the SAP standard there is function
    builder used in SAP standard include MV45AF0O_OFFENE_WERTE_ERMITTEL, the
    function builder is called RV_SCHEDULE_CHECK_DELIVERIES'. But how could we use in this formulae in a Custom delivery report.
    Looking for your helpful suggestions.
    Many thanks in Advance,
    Mira Saikrishna

    Krishna....have a look in the below threads where there was a similar requirement..
    error while using BAPI_OUTB_DELIVERY_CHANGE
    change outbound delivery

  • WM-production order-need change the open quantity in Transfer order

    Hi,
       I created the production order (order quantity 1000).  i did material staging and generated TR. .
       But i need to change the open quantity in transfer order . i need to create the partial Transfer order
        against TR..
       KINDLY SUGGEST ME
       WITH REGARDS
       Dinesh

    Hi Dinesh,
    TO for partial qty is possible.
    When you are doing material staging with 319 mov.type, you create a transfer order for partial quantity as follows:
    You first create a manual transfer order using transaction LT04.
    You specify the TR number in the intial screen and navigate to the detail screen, system shows the Open TR quantity and the proposed TO quantity. By default, both these quantities are equal to the TR quantity.
    However, when you create by clicing the "Create TO button" (the icon with a plus sign in the tool bar of LT04 screen), system takes you to another screen where it asks for the "Requested Qty" on the top of the screen.  Here you can modify the qty as per your requirement; then you can check and confirm the storage type and storage bin for source and destination stocks & save.
    It is important that you give the correct source storage type & storage bin that is having stock or otherwise system might give error message.
    System will create a TO line item with the entered qty and propose the balance TR qty as the 2nd TO line item. You can skip this 2nd TO item or delete it from the TO.
    Once again, if you click the Save button, system will save the TO with the partial quantity.
    The balance quantity will be available in the TR as open quantity and this can be seen in the header data of transaction LB03.
    Regards
    Prabhu

  • How to change the open quantity of PO / STO using  BAPI_PO_CHANGE

    Hi Friends,
    How can I change the open quantity in ME22 using the BAPI BAPI_PO_CHANGE...
    I am getting some errors..The values I am passing to the BAPI are:-
    *-- Purchase Order document
        lv_purchaseorder = tbl_join-ebeln.
    *-- Calculate Open quantity
        lv_quantity = ( tbl_join-menge - tbl_join-wemng ).
    *-- Fills Schedule quantity to be processed.
        tbl_poschedule-po_item      = tbl_join-ebelp.
        tbl_poschedule-sched_line   = tbl_join-etenr.
        tbl_poschedule-quantity     = lv_quantity.
        APPEND tbl_poschedule.
    *-- Marks the Schedule quantity to be processed.
        tbl_poschedulex-po_item     = tbl_join-ebelp.
        tbl_poschedulex-sched_line  = tbl_join-etenr.
        tbl_poschedulex-po_itemx    = c_true.
        tbl_poschedulex-sched_linex = c_true.
        tbl_poschedulex-quantity    = c_true.
        APPEND tbl_poschedulex.
    CALL FUNCTION 'BAPI_PO_CHANGE'
          EXPORTING
            PURCHASEORDER                = lv_purchaseorder
          POHEADER                     =
          POHEADERX                    =
          POADDRVENDOR                 =
            TESTRUN                      = 'X'
       IMPORTING
          EXPHEADER                    =
          EXPPOEXPIMPHEADER            =
         TABLES
           RETURN                       = tbl_return
           POSCHEDULE                   = tbl_poschedule
           POSCHEDULEX                  = tbl_poschedulex.
    Is there any other required fields needs to be passed to change the open quantity..
    I am checking in ME22...
    The scheduled quantity is 20.
    Delivered quantity is 15.
    Open quantity is 5   and ( this field is in non-editable display )
    Delivery date  is 10.10.2002  ( which is in past )
    Now using this BAPI ..I want to post the remaining open quantity which is " 5 "
    How can i do this ?? Please help.

    Hi Hari
    Please check after making the following changes:
    *-- Marks the Schedule quantity to be processed.
    tbl_poschedulex-po_item = tbl_join-ebelp.
    tbl_poschedulex-sched_line = tbl_join-etenr.
    <b>tbl_poschedulex-po_itemx = 'U'. "c_true.
    *tbl_poschedulex-sched_linex = c_true.</b>
    tbl_poschedulex-quantity = c_true.
    APPEND tbl_poschedulex.
    If still you do not get the desired function working add the below code:
    tbl_poitem-po_item = tbl_join-ebelp.
    tbl_poitem-quantity = lv_quantity.
    append tbl_poitem.
    tbl_poitemx-po_item = tbl_join-ebelp.
    tbl_poitemx-po_itemx = 'U'.
    tbl_poitemx-quantity = c_true.
    append tbl_poitemx.
    Hope this helps.
    Kind Regards
    Eswar

  • Delivery  quantity is greater than the open quantity  22

    Dear Experts
    I  want to close the  delivery. to close this delivery need to make  the quantity  as zero but system not allowing me to  make it as zero  iam getting the error open quantity is greater the delivery quantity .since i have checked the forum but i dont find any related  Please help me .
    Regards
    Raj

    Hi,
    What do you mean by close...iam assuming that you mean changing the Status of the delivery to completed.
    1. If certain qty has already been delivered (PGI)
    A. In this case do a reversal (VL09) and change the delivery qty to the correct quantity you want to deliver so that the system automatically sets the required status once all the qty is delivered. (PGI)
    2. If the delivery document has been created but no PGI
    A. In this case change the delivery qty in the main screen and make the relevant changes at the batch level also (if batches are applicable)
    3. If the delivery document has been created but no PGI
    A. If by close you want to delete then you can delete the delivery from the initial screen of vl02n.

  • Function module for getting the open qty

    HI experts,
                      I have a PO quantity(EKPO_MENGE).against same PO and item item(EBELN and EBELP) if Goods receipt has happened (MSEG_ERFMG) then i need to calculate the open qty.and also by netting the open quantity if multiple GRs has done against the same PO and item.
    Can you suggest any function module to get this open PO quantity.

    Hello,
    Hope this link can help you.
    [Po Open Quantity;
    Thanks
    Jayant

  • Sales order create/change line item with reference to contract - Open quantity not getting deducted for copied line item from the contract

    Hi friends,
    Please provide some valuable inputs for the following scenario:
    When a sales order line item is created(VA01) or changed(VA02) with reference to a Contract the open quantity is deducted in the contract which is a standard functionality. If the referenced line item is copied (custom enhancement to copy line item), then for the copied line item the open quantity is not getting deducted instead ATP quantity i.e. Available-to-promise is deducted.
    Any inputs on how we can fix this functionality i.e. deduct the open quantity from the contract for the copied line item?
    P.S. : Custom enhancement to copy line item is working fine, but open quantity is not getting deducted if the copied line item was referenced to a contract.
    Thanks,
    Sandeep
    Message was edited by: sandeep

    Sandeep,
    Yes, that was my original interpretation.  I was having a hard time believing that someone would ask such a question. 
    I guess, then, that you already know that you will have to add this logic to your enhancement. You should create your specifications and hand them off to a developer; ideally the one who created this enhanced solution in the first place.
    I do not provide advice in these forums about details of enhanced solutions.  Perhaps one of the other members will be more willing to do your work for you.
    Best Regards,
    DB49

  • Purchase Order Open quantity calculation.

    Hi All..
    I would like your help in finding out the logic behind calculating the open quantity for a given line item of a purchase order.
    Iam aware that i should go to the EKBE table to see purchase order history. Can someone tell me what are all the conditions i need to consider to calculate the Open quantity.
    Iam able to give a value E to field BEWTP (Purchase Order History Category) in EKBE and for all the recieved records iam adding the quantity for movement type 101 and removing the quantity for movement type 102 that finally gives my total GR qty. Then iam doing Original PO qty - GR qty to get the Open qty.
    Let me know if this logic is wrong or else is there any other conditions to consider.
    Appreciate your help and will reward.
    THanks.

    subtract the PO quantity EKPO-MENGE with the delivery quantity field EKET-GLMNG
    Thanks
    Seshu

  • Is ther a FM to get the open order qty for a particular material &salesorg?

    Hi experts,
                    I have requirement to find the open order qty for a given sales org (plant will be even better ) and material in my report. I do not want to use the standard tables as i need to fetch all records without any time restriction.So it is takin a lot of time.
    I know i can find it in va05 but i want to know if ther is  some standard function module which can serve this purpose.
    Kindly help.
    regards
    Ashwin

    Thanks for the reply,
    Can you kindly elaborate what i need to pass to the function module ?
    What do I have to pass in the tables LVBMTV and LSELTAB ?
    In which field will i get the open quantity for the material and salesorg ?
    Kindly help,
    Regards
    Ashwin

  • SO open quantity

    Hi,
    I need to get open quantity for each sales order in my Z report. Is there any field to store it or i need to calculate it. How can i do that, Thanks!

    Hi..
    check the below code to get the open quantity.
    open quantity = ordered quantity - delivered quantity
    Fetch delivery information
          SELECT vbeln posnr vgbel vgpos lfimg
                       FROM lips
                       INTO TABLE gt_lips
                       FOR ALL ENTRIES IN gt_vbap
                       WHERE vgbel = gt_vbap-vbeln AND
                             vgpos = gt_vbap-posnr.
    *Compute delivered qty
                LOOP AT gt_lips INTO st_lips WHERE vgbel = st_details-vbeln AND
                                                   vgpos = st_details-posnr.
                  gv_lfimg = gv_lfimg + st_lips-lfimg.
                  CLEAR st_lips.
                ENDLOOP.
                st_details-open_qty = st_details-ord_qty - gv_lfimg.
    i guess you know how to get the ordered quantity for the sales order item.
    Award points if found useful.
    Regards
    Divakar

  • Open quantity in Sales Order did not update after cancelling Reserve Invoice

    Client created Credit Memo with reference to Reserve Invoice but this did not update the open quantity in Sales Order. Client is using SAP B1 8.82 PL9. I tested this in SAP 9.0 and still same behavior. Is there a work around other than creating another SO?
    I checked Document Settings and "Reopening Doc by creating credit memo based on Doc" is enabled.
    Thanks in advance.

    Thanks for the reply. How will the client be able to make new reserve invoices from the SO? They are trying to make partial reserve invoices from the sales order. I already suggested to just change the quantity in the reserve invoice before adding. But I have doubt because the SO might close prematurely before they complete the quantity in the SO because open quantity is much less then the quantity in SO.
    SO Quantity: 100
    Open Quantity: 40
    Reserve Invoice 1: 60
    Reserve Invoice 2: 40
    SO closes before they can make Reserve Invoice 2

  • Open quantity in Deliveries

    Dear SAPer,
    in deliveries, every item has a delivery quantity and an open quantity. SAP explains the open quantity as "The quantity of the item that remains open for delivery. The open quantity includes the delivery quantity in the delivery that you are currently processing. The quantity is expressed in sales units."
    here's the senario,
    i created one delivery for a sales order with one item and 20 ton:
    no matter i enter 10t/20t/40t as the delivery quantity in delivery item, the open quantity remains as 20t and never change after both just saving the delivery and PGI.
    so my question is, will this open quantity in deliveries change and if so, how?

    Dear  Michael:
    Pls look at this example,you can get the answer.
    You create a sales order item for 100 pieces. During delivery processing , you create three separate deliveries that refer to this order item.
    1. Delivery #1 has a delivery quantity of 40. The open quantity is 100 pieces (the quantity still to be delivered, including the 40 pieces you already entered for this delivery item).
    2. Delivery #2 has a delivery quantity of 50. The open quantity is 60 (the original delivery quantity of 100, minus 40 from the first delivery , but including the 50 you are currently processing). In the first delivery, the system adjusts the open quantity from 100 to 50, to account for the delivery quantity in the second delivery.
    3. Delivery #3 has a delivery quantity of 10, to complete the original delivery quantity of 100. In the third delivery, the open quantity stands at 10 and the system adjusts the open quantities in the first and second deliveries to 40 and 50 respectively

  • How to  find the Open sale orders till date for  given plant and material ?

    Hi experts,
                     I have a requirement to calculate the open sale orders for a given plant and material. I have tried in VA05 wherein i can get only for the material and sales area combination. From the document nos obtained from VA05 i can then find the plant. But my question is how do i get the output of VA05 into my progra. (can i use submit for a module pool report ).
    Also if ther is some other standard table or Function module to find the open sale orders till a given date ,it will be even more helpful....in which case i can drop the VA05 route.
    Kindly help
    Thanks in advance
    Ashwin

    Hi Ashwin,
        You can use SAP Tables VBAK and VBUP to get to know if the document is complete or not.
       VBUK-GBSTK is the field that will give you the status of the Sales Order .
      VBUK is used at header level , whereas VBUP is used for Item level.
      So in your case what I would do is :
      Get the Sales Orders that satisy the plant and material criteria from VBAP table , take this Sales Document numbers and go to VBUK or VBUP table to get the Sales Order Status. 
       If I need to find the open quantity as well I will link to VBFA table based on the document number.
      Reward if helpful.
    Thanks,
    Imran

  • Remaining Open Quantity on PO

    Hi..
    I would appreciate your help on how i can derive the open quantity for a given PO at the line item level. I cannot find any field in the EKPO table.
    Also if there is batch specified for the material at the line item level on the PO , how i can retrieve the Batch number.
    I would like if someone can explain what tables are linked and how it can be extracted.
    Thanks and will reward the helpful answers.

    Look for the goods receipts and invoice receipts in table EKBE.
    Rob

  • Open Quantity of PO in GRPO PLD

    Hi All
    How do you display the open quantity (which is still not delivered) of purchase order into the PLD of Goods Receipt PO?
    Thanks
    SV Reddy

    Hi SV,
    i think, it is possible on FMS.
    (or)
    Try to Create the Query PLD for example Check the below thread,
    Detailed , POs after GRPO -Balance Qty Query
    Regards,
    Madhan.

Maybe you are looking for

  • AMD 7650M Driver Error Windows 8.1 on HP Probook 4x40s

    Yes this topic is closed ( 4x40s windows 8.1 AMD driver - UNSOLVED & IGNORED ISSUE) with Unsolved status ! It's incredible I don't need to say much about this error. You can see link above. HP staff promised will release new driver soon but still now

  • Ipod nano in disk mode (yes i already read the other one)

    my ipod is in disk mode just wondering how else to get it out or how many times i should repeat the hold menu then hold the middle button?

  • Help on Download Adobe X Pro

    I just purchased a new laptop and I need help to download the Adobe X Pro (I purchased a couple of years ago) onto my new laptop.  Please help.

  • Creative Suite download V power pc not supported

    I have an old copy of adobe creative suite premium education but my mac gives me the prompt power pc products not supported when I try to download.  Please can anyone advice is there anything I can do to get round the problem - change settings, downl

  • Masterdata

    Hi,    I want to know what r the master data avilable in MM & there Required Fields for preparing master data file?