Quantity on Hand

How do I get the quantity on hand for a particular material in a specified storage location in MM using .net connector? What is the call that returns this information?
Thanks.

Hi Darsh,
Please have a look at the following note and see if it helps:
R12-Quantity On Hand Fails To Satisfy Reservation On Transact Move Order Form (Doc ID 1142815.1)
When Creating a Sales Order using OE_ORDER_PUB.PROCESS_ORDER Receive Error - Quantity On Hand Fails To Satisfy Reservation (Doc ID 307259.1)
Transact Move Order fails with Quantity on hand fails to satisfy reservation Error (Doc ID 1383910.1)
Best Regards,

Similar Messages

  • SAP report to display mat number, quantity on hand, price, material group.

    Hi,
    I wish to have report to display info during month end:
    mat number, quantity on hand, price, material group.
    Please suggest me list of report to retrieve these information. Thanks

    Hi,
    Develop report using tables:
    Material, Material group - MARA
    Price                              - MBEW
    quantity                         - MARC
    sapmmlearner

  • Finding 'Quantity-On-Hand' for an item group by month

    Hi,
    How can I find ITEM (QOH) "Quantity-On-Hand" at the end of each month using sql? Grouping mtl_material_transactions or mtl_onhand_quantities_detail by MONTH does not give the desired results.
    Thanks.
    - Vijay

    Hi Experts
    Kindly help to generate the statement for a given period with details of QOH as on the First Day of the given period, Transactions IN and OUT during the given period and Closing QOH.
    Warm Regards
    Srinivasan K

  • ONHAND QUANTITY SETUP을 확인하는 방법

    제품: Applications
    작성날짜 : 2006-05-30
    ONHAND QUANTITY SETUP을 확인하는 방법
    ==============================
    PURPOSE
    Onhand quantity setup을 확인하는 방법
    Explanation
    script을 통해, 여러 setup사항들 및 onhand수량을 check할 수 있다.
    1. Check Organization controls
    2. Check Subinventory controls
    3. Check item attributes and controls for lot, locator, serial and
    revision.
    4. Check onhand quantity stock records a) non lot control
    b) lot controlled
    5. Check that stock records agree with attribute settings including
    the following:
    - Check that stock has a lot number if under lot control.
    - Check expiration date, lots which have expired still show in
    transaction screen
    - LPN containerized items
    6. Show reservations for the item
    7. Show overall quantities (from an internal routine called qtytree)
    8. Check that cost groups are correct.
    9. Check that quantities agree.
    아래의 script을 onhand.sql로 생성하여 수행하시기 바랍니다.
    $Header: onhand.sql 115.9 2005/05/25 $
    FILE
    onhand.sql
    DESCRIPTION
    Gives information regarding quantity values for an item within an organization,
    subinventory, revision and lot to determine why the system does not find
    available stock.
    Quantity on hand
    Reservable quantity on hand
    Quantity reserved
    Quantity suggested
    Quantity available to transact
    Quantity available to reserve
    The retrieved information will be written to an O/S file called: onhand.lst
    This script should be used for Release 11.5 only.
    BASE
    Bug 3089073, 4349223
    ARGUMENTS
    Organization_id
    Inventory_item_id
    lot_number => return over this if item is not lot controlled
    revision => return over this if item is not revision controlled
    subinventory_code
    /*WHENEVER SQLERROR EXIT FAILURE;*/
    spool onhand.lst
    set linesize 125;
    set pagesize 200;
    set verify off;
    set serveroutput on
    PROMPT 1/ To check Organization controls
    SELECT organization_id ORG_ID,
    primary_cost_method CST_TYP,
    cost_organization_id CST_ORG,
    master_organization_id MAST_ORG,
    default_cost_group_id DEF_CST_GRP,
    project_reference_enabled PROJ_FLG,
    wms_enabled_flag WMS
    FROM mtl_parameters
    WHERE organization_id = &&org_id;
    PROMPT 2/ To check Subinventory controls
    SELECT secondary_inventory_name, organization_id org_id, default_cost_group_id DEF_CST_GRP,
    locator_type LOC, asset_inventory ASSET_INV
    FROM mtl_secondary_inventories
    where organization_id = &&org_id;
    PROMPT 3/ To check item attributes
    select LOT_CONTROL_CODE LOT, REVISION_QTY_CONTROL_CODE REV, LOCATION_CONTROL_CODE LOC,
    SERIAL_NUMBER_CONTROL_CODE SER
    from mtl_system_items_b
    where organization_id= &&org_id
    and inventory_item_id = &&item_id;
    prompt control = 2 for on
    prompt serial_number_control 1-No serial number, 2-Predefined serial number, 5-Dynamic entry at inventory receipt
    prompt 6-Dynamic entry at sales order issue
    PROMPT 4/ To check onhand quantity stock records a) non lot control b) lot controlled
    select moqd.inventory_item_id ITEM_ID, moqd.organization_id ORG_ID,
    moqd.primary_transaction_quantity PRIM_QTY, moqd.subinventory_code, moqd.revision REV,
    moqd.locator_id, moqd.lot_number,
    moqd.cost_group_id CST_GRP_ID, moqd.project_id, moqd.task_id, moqd.lpn_id,
    moqd.CONTAINERIZED_FLAG CONT_FLG
    from mtl_onhand_quantities_detail moqd
    where moqd.organization_id = &&org_id
    and moqd.inventory_item_id = &&item_id;
    select moqd.inventory_item_id ITEM_ID, moqd.organization_id ORG_ID,
    moqd.primary_transaction_quantity PRIM_QTY, moqd.subinventory_code,moqd.revision REV,
    moqd.locator_id, moqd.lot_number, mln.expiration_date EXPIRE_DATE,
    moqd.cost_group_id CST_GRP_ID, moqd.project_id, moqd.task_id, moqd.lpn_id,
    moqd.CONTAINERIZED_FLAG CONT_FLG
    from mtl_onhand_quantities_detail moqd, mtl_lot_numbers mln
    where moqd.organization_id = &&org_id
    and moqd.inventory_item_id = &&item_id
    and moqd.inventory_item_id = mln.inventory_item_id
    and moqd.organization_id = mln.organization_id
    and moqd.lot_number = mln.lot_number;
    PROMPT Check that stock records agree with attribute settings ie. stock has a lot
    PROMPT number if under lot control. Also check expiration date, lots which have expired
    PROMPT still show in transaction screen but cannot be reserved (bug 3818166) and for
    PROMPT negative balances, if found apply patch 3747966.
    PROMPT Also check for LPN containerised items will not show as available on forms need
    PROMPT unpack the material and then try to issue out from desktop or Perform the Misc
    PROMPT issue of the LPN from the Mobile (bug 4349223).
    PROMPT
    PROMPT 5/ Show reservations for item
    select organization_id, inventory_item_id, demand_source_name, demand_source_header_id,
    demand_source_line_id, primary_reservation_quantity, revision, subinventory_code,
    locator_id, lot_number
    from mtl_reservations
    where organization_id = &&org_id
    and inventory_item_id = &&item_id;
    PROMPT 6/ Show overall quantities from qtytree
    SELECT
    x.organization_id organization_id
    , x.inventory_item_id inventory_item_id
    , x.revision revision
    , x.lot_number lot_number
    , To_date(NULL) lot_expiration_date
    , x.subinventory_code subinventory_code
    , sub.reservable_type reservable_type
    , x.locator_id locator_id
    , x.primary_quantity primary_quantity
    , x.date_received date_received
    , x.quantity_type quantity_type
    , x.cost_group_id cost_group_id
    , x.containerized containerized
    FROM (
    SELECT
    x.organization_id organization_id
    , x.inventory_item_id inventory_item_id
    , NULL revision
    , NULL lot_number
    , x.subinventory_code subinventory_code
    , x.locator_id locator_id
    , SUM(x.primary_quantity) primary_quantity
    , MIN(x.date_received) date_received
    , x.quantity_type quantity_type
    , x.cost_group_id cost_group_id
    , x.containerized containerized
    FROM (
    -- reservations
    SELECT
    mr.organization_id organization_id
    , mr.inventory_item_id inventory_item_id
    , mr.revision revision
    , mr.lot_number lot_number
    , mr.subinventory_code subinventory_code
    , mr.locator_id locator_id
    , mr.primary_reservation_quantity
    - Nvl(mr.detailed_quantity,0) primary_quantity
    , To_date(NULL) date_received
    , 3 quantity_type
    , to_number(NULL) cost_group_id
    , 0 containerized
    FROM mtl_reservations mr
    WHERE
    Nvl(mr.supply_source_type_id, 13) = 13
    AND mr.primary_reservation_quantity > Nvl(mr.detailed_quantity,0)
    UNION ALL
    -- onhand quantities
    SELECT
    moq.organization_id organization_id
    , moq.inventory_item_id inventory_item_id
    , moq.revision revision
    , moq.lot_number lot_number
    , moq.subinventory_code subinventory_code
    , moq.locator_id locator_id
    , decode(NULL, NULL, moq.transaction_quantity, nvl(pjm_ueff_onhand.onhand_quantity
    (NULL,moq.inventory_item_id,moq.organization_id
    ,moq.revision,moq.subinventory_code,moq.locator_id,moq.lot_number)
    ,moq.transaction_quantity))
    , nvl(moq.orig_date_received,
    moq.date_received) date_received
    , 1 quantity_type
    , moq.cost_group_id cost_group_id
    , decode(moq.containerized_flag,
    1, 1, 0) containerized
    FROM
    mtl_onhand_quantities_detail moq
    UNION ALL
    -- pending transactions in mmtt
    --changed by jcearley on 12/8/99
    --added 1 to decode statement so that we make sure the
    --issue qtys in mmtt are seen as negative.
    --This problem arose because create_suggestions stores
    --the suggested transactions in mmtt as a positive number.
    -- added 5/23/00
    -- if quantity is in an lpn, then it is containerized
    SELECT
    mmtt.organization_id organization_id
    , mmtt.inventory_item_id inventory_item_id
    , mmtt.revision revision
    , NULL lot_number
    , mmtt.subinventory_code subinventory_code
    , mmtt.locator_id locator_id
    , Decode(mmtt.transaction_status, 2, 1
    , Decode(mmtt.transaction_action_id
    , 1, -1, 2, -1, 28, -1, 3, -1, Sign(mmtt.primary_quantity))
    * Abs( decode(NULL, NULL, mmtt.primary_quantity, Nvl(apps.pjm_ueff_onhand.txn_quantity(NULL,mmtt.transaction_temp_id,mmtt.lot_number,
    'N',mmtt.inventory_item_id, mmtt.organization_id, mmtt.transaction_source_type_id,
    mmtt.transaction_source_id, mmtt.rcv_transaction_id,
    sign(mmtt.primary_quantity)
    ),mmtt.primary_quantity)) )
    , Decode(mmtt.transaction_action_id
    , 1, To_date(NULL)
    , 2, To_date(NULL)
    , 28, To_date(NULL)
    , 3, To_date(NULL)
    , Decode(Sign(mmtt.primary_quantity)
    , -1, To_date(NULL)
    , mmtt.transaction_date)) date_received
    , Decode(mmtt.transaction_status, 2, 5, 1) quantity_type
    , mmtt.cost_group_id cost_group_id
    , decode(mmtt.lpn_id, NULL, 0, 1) containerized
    FROM
    mtl_material_transactions_temp mmtt
    WHERE
    mmtt.posting_flag = 'Y'
    AND mmtt.subinventory_code IS NOT NULL
    AND (Nvl(mmtt.transaction_status,0) <> 2 OR -- pending txns
    -- only picking side of the suggested transactions are used
    Nvl(mmtt.transaction_status,0) = 2 AND
    mmtt.transaction_action_id IN (1,2,28,3,21,29,32,34)
    -- dont look at scrap and costing txns
    AND mmtt.transaction_action_id NOT IN (24,30)
    UNION ALL
    -- receiving side of transfers
    -- added 5/23/00
    -- if quantity is in an lpn, then it is containerized
    SELECT
    Decode(mmtt.transaction_action_id
    , 3, mmtt.transfer_organization
    , mmtt.organization_id) organization_id
    , mmtt.inventory_item_id inventory_item_id
    , mmtt.revision revision
    , NULL lot_number
    , mmtt.transfer_subinventory subinventory_code
    , mmtt.transfer_to_location locator_id
    , Abs( decode(NULL, NULL, mmtt.primary_quantity, Nvl(apps.pjm_ueff_onhand.txn_quantity(NULL,mmtt.transaction_temp_id,mmtt.lot_number,
    'N',mmtt.inventory_item_id, mmtt.organization_id, mmtt.transaction_source_type_id,
    mmtt.transaction_source_id, mmtt.rcv_transaction_id,
    sign(mmtt.primary_quantity)
    ),mmtt.primary_quantity)) )
    , mmtt.transaction_date date_received
    , 1 quantity_type
    , mmtt.transfer_cost_group_id cost_group_id
    , decode(mmtt.transfer_lpn_id, NULL, 0, 1) containerized
    FROM
    mtl_material_transactions_temp mmtt
    WHERE
    mmtt.posting_flag = 'Y'
    AND Nvl(mmtt.transaction_status,0) <> 2 -- pending txns only
    AND mmtt.transaction_action_id IN (2,28,3)
    ) x
    WHERE x.organization_id = &&org_id
    AND x.inventory_item_id = &&item_id
    GROUP BY
    x.organization_id, x.inventory_item_id, x.revision
    , x.subinventory_code, x.locator_id
    , x.quantity_type, x.cost_group_id, x.containerized
    ) x
    , mtl_secondary_inventories sub
    WHERE
    x.organization_id = sub.organization_id (+)
    --AND Nvl(sub.availability_type, 1) = 1
    AND x.subinventory_code = sub.secondary_inventory_name (+) ;
    PROMPT Check that cost groups are correct see Bug 4222079
    PROMPT 7/ To find stock values from system nb.<cr> over lot and revision if item
    PROMPT is not under lot or revision control, <cr> over subinventory for all subinvs
    DECLARE
    L_api_return_status VARCHAR2(1);
    l_qty_oh NUMBER;
    l_qty_res_oh NUMBER;
    l_qty_res NUMBER;
    l_qty_sug NUMBER;
    l_qty_att NUMBER;
    l_qty_atr NUMBER;
    l_msg_count NUMBER;
    l_msg_data VARCHAR2(1000);
    l_rev varchar2(100):=NULL;
    l_lot VARCHAR2(100):=NULL;
    l_loc VARCHAR2(100):=NULL;
    l_lot_control BOOLEAN :=false;
    l_revision_control BOOLEAN :=false;
    l_lot_control_code NUMBER;
    l_revision_qty_control_code NUMBER;
    l_location_control_code NUMBER;
    l_org_id NUMBER;
    l_item_id NUMBER;
    l_subinv VARCHAR2(10);
    BEGIN
    select LOT_CONTROL_CODE ,REVISION_QTY_CONTROL_CODE, LOCATION_CONTROL_CODE
    into l_lot_control_code, l_revision_qty_control_code, l_location_control_code
    from mtl_system_items_b
    where organization_id= &&org_id
    and inventory_item_id = &&item_id;
    if l_lot_control_code = 2 then
    l_lot_control :=true;
    l_lot:='&lotnumber';
    end if;
    if l_revision_qty_control_code =2 then
    l_revision_control:=true;
    l_rev:='&revision';
    end if;
    inv_quantity_tree_grp.clear_quantity_cache;
    dbms_output.put_line('Transaction Mode');
    apps.INV_Quantity_Tree_PUB.Query_Quantities (
    p_api_version_number => 1.0
    , p_init_msg_lst => apps.fnd_api.g_false
    , x_return_status => L_api_return_status
    , x_msg_count => l_msg_count
    , x_msg_data => l_msg_data
    , p_organization_id => &&org_id
    , p_inventory_item_id => &&item_id
    , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode
    , p_onhand_source => NULL
    , p_is_revision_control=> l_revision_control
    , p_is_lot_control => l_lot_control
    , p_is_serial_control => NULL
    , p_revision => l_rev
    , p_lot_number => l_lot
    , p_subinventory_code => '&&subinv_code'
    , p_locator_id => NULL
    , x_qoh => l_qty_oh
    , x_rqoh => l_qty_res_oh
    , x_qr => l_qty_res
    , x_qs => l_qty_sug
    , x_att => l_qty_att
    , x_atr => l_qty_atr );
    dbms_output.put_line('Quantity on hand --> '||to_char(l_qty_oh));
    dbms_output.put_line('Reservable quantity on hand --> '||to_char(l_qty_res_oh));
    dbms_output.put_line('Quantity reserved --> '||to_char(l_qty_res));
    dbms_output.put_line('Quantity suggested --> '||to_char(l_qty_sug));
    dbms_output.put_line('Quantity available to transact --> '||to_char(l_qty_att));
    dbms_output.put_line('Quantity available to reserve --> '||to_char(l_qty_atr));
    end;
    PROMPT Check that quantities agree with script 4 and 5.
    Spool off;
    PROMPT *** Print file onhand.lst created ***
    exit
    Reference Documents
    Bug 4529874

  • Net inventory on hand after some transports.

    Hi!
    Suppose I have a sales order such as S0001 that has an item - number 10 - for product MAT1 for 10 items. All of them are produced and placed in warehouse but some of them are delivered , say 3 of them in 2 batches ie. 1 in the first transport , 2 in the second transport.
    Now the question : Is there a single function or a table record that show the quantity on hand in warehouse for the given  sales order that is net from the transports?
    Sincerely.
    Erk.

    Hi
    From SD Point of view
    the different between the Order Qty and the Delivery Qty will give the net qty yet to be delivered i.e
    ( VBAP-KWMENG  -  LIPS-LFIMG  ) will give the qty yet to be delivered.
    From MM point of view, have to check the qty's from MARD,MSEG tables
    and you can see the Std reports of Stock like MB52, MB53,MMBE, MD04 and MB5B etc.
    Reward points if useful
    Regards
    Anji

  • Quantity at storage location

    It must be simple, but we just can't find the BAPI call to get the current quantity on hand for a particular material in a specified storage location in MM. Does someone know the call?
    Thanks.

    Oh...never used .net connector.....just jCo.  I'm assuming that they are pretty much the same, so my suggestion, if .net can not handle it, is to create your own RFC enabled function module with your import parameters, MATNR WERKS LGORT and exporting only the fields that you need.  In the function module source, just hit table MARD with your parameters.  Then just call this Function module in your .net program.
    Good luck,
    Rich Heilman

  • Summing up QTY on Hand

    I am developing a report where I have qty on hand.  I am putting it into a report that reports sales and need to show qty on hand for all locations.  Example.  I have stores numbered 1,2,3,4,5 but only stores 1 and 2 have sales and the report shows that they sold 3 each for a total of six size 9 shoes sold.  However, the qty on hand field needs to show the qty on hand in all stores.  So, if each store has 5 size 9 shoes left, this field should 25 size 9 shoes left. 
    I am sure I need to write a formula to pull all stores inventory into some sort of variable, then total it and put it on the report, but I can't get my brain around it.  Any help would be appreciated.

    Hi Edison,
    I'm going to make some huge assumptions here because I don't know how your report is laid out. 
    Assuming your report is grouped like:
    Group1 - Location
    Group2 - SalesDate
    Your report is laid out like:
                        QTY On Hand          Sold
      Location 1
        June 1              2                  0
        June 2              1                  1
        June 3              0                  1
      Total                 0                  2
                        QTY On Hand          Sold
      Location 2
        June 1              5                  0
        June 2              5                  0
        June 3              5                  0
      Total                 5                  0
                        QTY On Hand          Sold
      Grand Total           5                  2
    To get the total for QTY on Hand try this formula:
    Assuming you have the totals in GroupFooter1, drop the {table.QTYONHAND} field onto the GroupFooter1 section.  This will show the quantity on hand from the last record. 
    To get the grand total for the QTY on hand, create a formula like, 
    WhilePrintingRecords;
    NumberVar QTYonHand;
    QTYonHand := QTYonHand + {table.QTYONHAND};
    Drop this formula onto the GroupFooter1 section also.  This formula has a variable called QTYonHand and will accumulate each time the formula is called in GroupFooter1. 
    Now create one last formula like:
    WhilePrintingRecords;
    NumberVar QTYonHand;
    Drop this into the Report Footer where the Grand Total should be.  This will be be the total for the QTYonHand. 
    Good luck,
    Brian

  • Move Order & Available to Reserve Quantity

    Hi Everybody,
    Is there any relation between Move Order transaction and Available to Reserve Quantity in oracle Inventory Management R12.0.6?
    I have create a Move Order for an item with 50 as quantity; on-hand quantities before Move Order transaction:
    - available quantity: 980
    - available to reserve: 980
    - available to transact: 980
    after Move Order created on-hand quantities are:
    - available quantity: 980
    - available to reserve: 980
    - available to transact: 980
    My question here is why is available to reserve quantity not reduced to be 930 as available to reserve quantity???
    after Allocating and Transacting Move Order on-hand quantities are
    on-hand quantity before Move Order transaction:
    - available quantity: 930
    - available to reserve: 930
    - available to transact: 930

    Hi Ahmed,
    As far as my knowledge Available to Reserve will not change with just the creation of Move Order.
    It will change only when you allocate the quantity.
    Hence you are not seeing the reduction of 50.
    When you allocate a record will be created in MTL_MATERIAL_TRANSACTIONS_TEMP.
    This quantity is treated as pending and hence it will be removed from ATR.
    But when you just create MO you will not have record in MTL_MATERIAL_TRANSACTIONS_TEMP.
    Hence you cannot see the reduction.
    Regards,
    Sabari

  • POS and inventory management suggestions?

    I own and operate a gift shop and wanted to use my iPad, iPhone, and MacBook Pro to ease the burden of inventory management.  Any suggestions for a POS system that would help manage what comes in and out of the shop?

    Check out NCR Silver.  App based POS with back office that tracks inventory levels in real-time.  Have visibility to quantity on hand, know how many days of supply are remaining based on past sales history. 
    I may receive some form of compensation, financial or otherwise, from my recommendation or link. 
    <Edited by Host>

  • BOM business requirement for sales order and PGI

    Hi Experts,
    Current setting
    The BOM structure is A = A1+A2
    1) Material A created in MM master item category group = ERLA
    2) Sub component material A1 and material A2, MM master item category group = NORM for both component.
    3) Maintained in CS01 BOM header is A and items are A1 and A2.
    4) Item category in IMG was created and assign item category also created.
        4.1) OR-ERLA-TAQ-TAE
    new business requirement as listed below.
    5) The material A is alway zero quantity on hand, no goods receipt required with no physical with such material or package at all. (it is dummy material number in SAP).
    6) while SO created.
        6.1) Fro material A sales price captured at BOM header level only, NO QTY and COSTshow in the sales order.
         6.2) Material A1 and A2 are actual physical inventory item in the ware house.
         6.3) The sub component of material A1 and A2 is required to captured QTY and COST. NO SALES PRICES NEEDED.
    CONCLUSION
    HOW to setup/configure such a business scenario?
    - Is it logic to configure as OR-ERLA-TAE-TAN that's what i think of?
      My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
    MATERIAL                                          QTY                             COST                                  SALES NET VALUE
           A                                                      0                                   0                                              1,500.00
           A1                                                    1                                  100.00                                           0
           A2                                                    1                                    50.00                                           0
    Thanks & Regards,
    Yong Kok Wah
    Edited by: Yong Kok Wah on Jan 27, 2010 11:16 AM

    As per your post,
    -  You are creating Main item which is a dummy material without any physical inventory maintained, but the pricing/billing should be done @ main item level.
    - here you are not dispatching main item, but billing should be carried at this level. in such case, I suggest you to go with the new sch.line cat w/o maintaining any mov type to it. & use Zitem category for this main item in VOV7, mark "Order qtty=1" so that min order qtty for this main item should be 1, so that you can calculate price.
    -  You want to capture Cost of sub items , summation of sub items cost is total cost of main item & Profit will be calculated accordingly.
    Sub items, sch.line category should have mov type, item cat should be not relevant for pricing & billing , but relevant for sch.lines. In Copy control from delivery - Billing @ item level, for the main item ,- item category, choose "Cumulate cost", so that cost of the sub items will be cumulated to main item.
    eg:
    MATERIAL QTY COST SALES NET VALUE
    A 0 0 1,500.00
    A1 1 100.00 0
    A2 1 50.00 0
    My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
    To avoid this, mark order qtty=1, in item category for main item, but for the same item, sch.line category should not have mov type. so that there will nt be any PGI document. But PGI should be done for sub items to capture inventory & cost.
    Test & revert, if any issues.

  • Report for Pegging for  forecast and sales order consumption(pegging)

    Hi ,
    Plaese help to create a report for the below
    Requirement is there to have a showing Forecast (Number) and Sales order (Number) pegging Report
    Means like to which forecast number the sales order number is consumed
    Regards
    Kiran

    I have tested this on ASCP and I am agree with you. I am pasting one para from document...
    "Oracle Master Scheduling/MRP and Supply Chain Planning calculates the ATP quantity of an item for each day of planned production by adding planned production during the period (planned orders and scheduled receipts) to the quantity on hand, and then subtracting all committed demand for the period (sales orders, component demand from planned orders, discrete jobs, and repetitive schedules).
    Note: Committed demand does not include forecasted demand or manually entered master demand schedule entries. Also, the amount available during each period is not cumulative. Oracle Master Scheduling/MRP and Supply Chain Planning does not consider ATP quantities from prior periods as supply in future periods. "
    Thanks and Regards,
    Dipak

  • XL Report for stock status

    I am trying to create a stock status report that shows all items grouped by item group, their quantity on hand, item cost, and total value.  We need to have a subtotal by item group.  I thought that XL Reporter would do this easily, but I am having difficulty.
    In the Report Composer, I can create the listing of items with descriptions, quantities, and item costs, grouped by item group.  Of course, I cannot perform the calculation to get the value of each item (quantity * cost).  When I generate the report into the Report Designer, there are no errors and the design appears to be created OK.  But when I run the report, the spreadsheet comes up completely blank except for column headers.
    Can anyone tell me what the problem is?

    XL reporter is based on the concepts of Dimensions, Light Dimensions and Measures.
    >> partial extract from XL Reporter FAQ.
    28. When I create a query within the Report Composer that uses the dimension called GL Accounts and add the attribute Account Name then refresh the query it produces data as expected. However when the query is executed in Excel it does not produce any data. What am I doing wrong?
    The query only contains dimensions and not measures. It is not possible to generate data with a query that does not contain a measure field type within Excel. Excel and the composer pick up data in different ways, therefore it is possible you will see data in the composer, however in excel you will not. Until a measure is added no data is produced.
    Do check the URL for complete XL reporter FAQ: Check FAQ No.28
    https://websmp107.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_HIER_KEY=701100035871000371280&_OBJECT=011000358700001325372005E&_SCENARIO=01100035870000000183&
    For further information, check the following URL:
    https://websmp107.sap-ag.de/~sapidb/011000358700003984512006E.pdf
    You can check the following URL to understand : Creating a Profit & Loss Report Using XL Reporter
    https://websmp107.sap-ag.de/~sapidb/011000358700001160462006E.pdf
    Hope this information helps in providing solution to your actual requirement.
    Regards
    Satish

  • Hi ALL i have a BDC code  it is not working properly

    this BDC code is not working properly , when ever the file is transfering BDC is aborting in the case of   invalid material/batch comes into teh picture... so please could you ''Check for invalid material/batch combinations so they are not processed by the BDC in the program and correctly output in an exception report''
    *****************************CODE HERE*****************************
    S E L E C T I O N S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file LIKE rlgrap-filename,
    p_arch LIKE rlgrap-filename. "RM080107
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
    SELECTION-SCREEN END OF BLOCK b1.
    I N C L U D E S
    INCLUDE zwm_np_stock_recon_top.
    INCLUDE zwm_np_stock_recon_f01.
    I N I T I A L I Z A T I O N
    INITIALIZATION.
    PERFORM get_interface_filename USING c_interface_file p_file.
    PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
    S T A R T O F S E L E C T I O N
    START-OF-SELECTION.
    PERFORM read_file USING p_file.
    PERFORM pre_processing.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    PERFORM process_checks.
    IF w_no_change = 'X'.
    WRITE: / text-b03.
    WRITE: / sy-uline(34).
    ELSE.
    PERFORM bdc_mi09.
    PERFORM file_check_report.
    PERFORM bdc_report.
    ENDIF.
    PERFORM post_process_checks.
    *-- Move the processed file to archive directory
    PERFORM move_file.
    ...*************.........first include...................************
    INCLUDE ZWM_NP_STOCK_RECON_TOP *
    Data declaration ----------------------------------------------
    TYPES: st_rawdata(2000) TYPE c.
    TYPES: BEGIN OF st_stck_cnt,
    werks TYPE iseg-werks, "plant
    lgort TYPE iseg-lgort, "storage location
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    vfdat TYPE mch1-vfdat, "Sell by date
    lwedt TYPE mch1-lwedt, "Manufacture date
    quarn(8) TYPE n, "qaunrantine quantity
    menge(8) TYPE n, "quantity on hand
    message(1), "Message Type (E/W/I)
    msg_txt TYPE t100-text, "Message Text
    zerostck(1), "Zero stock identifier "RM220307
    END OF st_stck_cnt.
    TYPES: BEGIN OF st_batch_errors,
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    clabs TYPE mchb-clabs, "Stock Balance
    END OF st_batch_errors.
    DATA:
    t_rawdata TYPE TABLE OF st_rawdata,
    w_rawdata TYPE st_rawdata,
    t_stck_cnt TYPE TABLE OF st_stck_cnt,
    d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
    w_stck_cnt TYPE st_stck_cnt,
    t_batch_errors TYPE TABLE OF st_batch_errors,
    w_batch_errors TYPE st_batch_errors,
    t_messtab LIKE bdcmsgcoll OCCURS 0,
    w_messtab LIKE LINE OF t_messtab,
    w_no_change.
    CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
    c_archive_file(26) TYPE c
    VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
    .*************................second include..........************
    ***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
    *& Form read_file
    reads NextPharma file sent through via webmethods
    -->P_FILENAME
    FORM read_file USING p_filename.
    CLEAR: t_rawdata,
    w_rawdata.
    REFRESH: t_rawdata.
    OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
    IF sy-subrc <> 0.
    MESSAGE e720(01).
    ENDIF.
    DO.
    READ DATASET p_filename INTO w_rawdata.
    IF sy-subrc <> 0.
    EXIT.
    ELSE.
    APPEND w_rawdata TO t_rawdata.
    ENDIF.
    ENDDO.
    CLOSE DATASET p_filename.
    ENDFORM. " read_file
    *& Form pre_processing
    Read file values into internal table
    FORM pre_processing.
    DATA: lw_matnr TYPE iseg-matnr.
    LOOP AT t_rawdata INTO w_rawdata.
    lw_matnr = w_rawdata+21(20). "RM031006
    lw_matnr = w_rawdata+22(18). "RM031006
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
    input = lw_matnr
    IMPORTING
    output = lw_matnr
    EXCEPTIONS
    length_error = 1
    OTHERS = 2.
    MOVE: lw_matnr TO w_stck_cnt-matnr.
    w_stck_cnt-werks = w_rawdata+14(4).
    w_stck_cnt-lgort = w_rawdata+18(4).
    w_stck_cnt-charg = w_rawdata+84(25).
    w_stck_cnt-vfdat = w_rawdata+109(8).
    w_stck_cnt-lwedt = w_rawdata+117(8).
    w_stck_cnt-quarn = w_rawdata+141(8).
    w_stck_cnt-menge = w_rawdata+125(8).
    APPEND w_stck_cnt TO t_stck_cnt.
    CLEAR w_stck_cnt.
    ENDLOOP.
    SORT t_stck_cnt BY werks
    lgort
    matnr
    charg.
    DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
    ENDFORM. " pre_processing
    *& Form bdc_mi09
    Run file data via BDC TCODE: MI09
    FORM bdc_mi09.
    DATA: t_bdcdata TYPE TABLE OF bdcdata,
    w_bdcdata TYPE bdcdata,
    lw_datum(10) TYPE c,
    lw_count(2) TYPE n.
    WRITE sy-datum TO lw_datum DD/MM/YYYY.
    Front Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0700'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Enter
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '/00'.
    APPEND w_bdcdata TO t_bdcdata.
    Count Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-ZLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Document Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-BLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Plant
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-WERKS'.
    w_bdcdata-fval = w_stck_cnt-werks.
    APPEND w_bdcdata TO t_bdcdata.
    Storage Location
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-LGORT'.
    w_bdcdata-fval = w_stck_cnt-lgort.
    APPEND w_bdcdata TO t_bdcdata.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    Do not submit items with Errors against them
    CHECK w_stck_cnt-message NE 'E' AND
    w_stck_cnt-zerostck NE 'X'.
    "RM220307
    lw_count = lw_count + 1.
    Input Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Page Down
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=P+'.
    APPEND w_bdcdata TO t_bdcdata.
    Material
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-MATNR(01)'.
    w_bdcdata-fval = w_stck_cnt-matnr.
    APPEND w_bdcdata TO t_bdcdata.
    Batch
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-CHARG(01)'.
    w_bdcdata-fval = w_stck_cnt-charg.
    APPEND w_bdcdata TO t_bdcdata.
    IF w_stck_cnt-menge NE 0.
    Quantity
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
    w_bdcdata-fval = w_stck_cnt-menge.
    APPEND w_bdcdata TO t_bdcdata.
    *-- Begin RM220307 - We need to create an item when the quantity is zero
    *-- in file and is non-zero in SAP
    ELSE.
    Zero Stock indicator
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-XNULL(01)'.
    w_bdcdata-fval = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    *-- End RM220307
    ENDIF.
    ENDLOOP.
    CHECK lw_count NE 0.
    After all line items have been input
    Final Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Save Document
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=BU'.
    APPEND w_bdcdata TO t_bdcdata.
    CALL TRANSACTION 'MI09' USING t_bdcdata
    MODE p_mode
    MESSAGES INTO t_messtab.
    ENDFORM. " bdc_mi09
    *& Form bdc_report
    Write BDC Messages.
    FORM bdc_report.
    DATA: lw_text TYPE t100-text.
    SKIP.
    WRITE: / text-b01.
    WRITE: / sy-uline(21).
    SKIP.
    Write BDC Messages
    LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
    MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
    NUMBER w_messtab-msgnr
    WITH w_messtab-msgv1
    w_messtab-msgv2
    w_messtab-msgv3
    w_messtab-msgv4
    INTO lw_text.
    WRITE: / lw_text.
    ENDLOOP.
    ENDFORM. " bdc_report
    *& Form process_checks
    Perform process check before creating BDC Session
    FORM process_checks.
    DATA: lw_clabs LIKE mchb-clabs,
    lw_menge LIKE mchb-clabs,
    lw_matnr LIKE mara-matnr,
    lw_charg LIKE mch1-charg,
    lw_fail,
    lw_vfdat TYPE mch1-vfdat,
    lv_sell TYPE c, "RM191006
    lv_qty(8) TYPE c. "RM191006
    CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
    Check if any of the stock figures differ from current stock figures
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    lw_menge = w_stck_cnt-menge.
    SELECT SINGLE clabs INTO lw_clabs
    FROM mchb
    WHERE matnr = w_stck_cnt-matnr
    AND werks = w_stck_cnt-werks
    AND lgort = w_stck_cnt-lgort
    AND charg = w_stck_cnt-charg.
    IF sy-subrc = 0.
    IF lw_clabs NE lw_menge.
    lw_fail = 'X'.
    *-- Begin RM220307 - Do not create PI item if the stock is zero in the
    *-- file and is zero in SAP
    EXIT.
    ELSEIF lw_clabs = 0 AND lw_menge = 0.
    w_stck_cnt-zerostck = 'X'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM220307
    ELSE.
    lw_fail = 'X'.
    ERROR
    ENDIF.
    ENDLOOP.
    If no differences are found set NO CHANGE Flag
    IF lw_fail NE 'X'.
    w_no_change = 'X'.
    EXIT.
    ENDIF.
    Check for Errors in file data
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    CLEAR lv_sell. "RM191006
    SELECT SINGLE matnr INTO lw_matnr
    FROM mara
    WHERE matnr = w_stck_cnt-matnr.
    IF sy-subrc NE 0.
    Invalid Material (E)
    w_stck_cnt-message = 'E'.
    w_stck_cnt-msg_txt = 'Invalid Material'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ENDIF.
    SELECT SINGLE charg vfdat
    INTO (lw_charg, lw_vfdat)
    FROM mch1 "KOB01 - changed from MCHA
    WHERE matnr = w_stck_cnt-matnr
    AND charg = w_stck_cnt-charg.
    AND werks = w_stck_cnt-werks.
    IF sy-subrc NE 0.
    Invalid Material Batch (E)
    w_stck_cnt-message = 'E'.
    CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ELSE.
    IF w_stck_cnt-vfdat <> lw_vfdat.
    Sell by dates do not match (W)
    w_stck_cnt-message = 'W'.
    w_stck_cnt-msg_txt =
    'Sell by Date does not match Shelf life Expiry Date'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    lv_sell = 'X'. "RM191006
    CONTINUE. "RM191006
    ENDIF.
    ENDIF.
    IF w_stck_cnt-quarn > 0.
    Quarantine balance not Zero (W)
    w_stck_cnt-message = 'W'.
    *-- Begin RM191006
    *-- We do want all warning messages on the report
    lv_qty = w_stck_cnt-quarn.
    CONDENSE lv_qty NO-GAPS.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = lv_qty
    IMPORTING
    output = lv_qty.
    w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
    CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    IF lv_sell = 'X'.
    APPEND w_stck_cnt TO d_stck_cnt.
    CLEAR lv_sell.
    ELSE.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM191006
    ENDIF.
    ENDLOOP.
    *-- Begin RM191006
    *-- Finally get all the records into dummy table to report
    APPEND LINES OF t_stck_cnt TO d_stck_cnt.
    SORT d_stck_cnt.
    DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
    *-- End RM191006
    ENDFORM. " process_checks
    *& Form file_check_report
    Write warning and Error messages from File checks
    FORM file_check_report.
    WRITE: /2 'Material',
    22 'Batch',
    32 'Sell By',
    45 'Message Text'.
    WRITE: /2 sy-uline(115).
    SKIP.
    LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
    LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
    CHECK w_stck_cnt-message NE ' '.
    WRITE: /2 w_stck_cnt-matnr,
    22 w_stck_cnt-charg,
    32 w_stck_cnt-vfdat,
    43 w_stck_cnt-message,
    45 w_stck_cnt-msg_txt.
    ENDLOOP.
    ENDFORM. " file_check_report
    *& Form post_process_checks
    Check Material Batches in SAP against NP File
    FORM post_process_checks.
    RANGES: r_matnr FOR mchb-matnr,
    r_lgort FOR mchb-lgort,
    r_werks FOR mchb-werks.
    SORT t_stck_cnt.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    AT END OF matnr.
    r_lgort-sign = 'I'.
    r_lgort-option = 'EQ'.
    r_lgort-low = w_stck_cnt-lgort.
    APPEND r_lgort.
    r_werks-sign = 'I'.
    r_werks-option = 'EQ'.
    r_werks-low = w_stck_cnt-werks.
    APPEND r_werks.
    r_matnr-sign = 'I'.
    r_matnr-option = 'EQ'.
    r_matnr-low = w_stck_cnt-matnr.
    APPEND r_matnr.
    ENDAT.
    ENDLOOP.
    Select all material batches for NP Materials
    SELECT matnr charg clabs
    INTO TABLE t_batch_errors
    FROM mchb
    WHERE werks IN r_werks
    AND lgort IN r_lgort.
    IF sy-subrc EQ 0.
    Check if the Material Batches are in the NP file
    LOOP AT t_batch_errors INTO w_batch_errors.
    Disregard Batches without positive unrestricted stock
    IF w_batch_errors-clabs LE 0.
    DELETE t_batch_errors.
    CONTINUE.
    ENDIF.
    READ TABLE t_stck_cnt INTO w_stck_cnt
    WITH KEY matnr = w_batch_errors-matnr
    charg = w_batch_errors-charg.
    IF sy-subrc = 0.
    DELETE t_batch_errors.
    ENDIF.
    ENDLOOP.
    ENDIF.
    CHECK NOT t_batch_errors[] IS INITIAL.
    Write Batch chak results to report
    SKIP.
    WRITE: / text-b02.
    WRITE: / sy-uline(74).
    WRITE: /2 'Material',
    22 'Batch'.
    WRITE: /2 sy-uline(32).
    SKIP.
    LOOP AT t_batch_errors INTO w_batch_errors.
    WRITE: /2 w_batch_errors-matnr,
    22 w_batch_errors-charg.
    ENDLOOP.
    ENDFORM. " post_process_checks
    G E T _ I N T E R F A C E _ F I L E N A M E
    FORM get_interface_filename USING filename lw_path.
    DATA: i_file TYPE filename-fileintern,
    out_filename LIKE v_path-pathextern.
    CLEAR: out_filename.
    i_file = filename.
    get the interface filename to be used when creating file
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    logical_filename = i_file
    IMPORTING
    file_name = out_filename
    EXCEPTIONS
    file_not_found = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    MOVE out_filename TO lw_path.
    IF filename NE c_archive_file. "RM080107
    CONCATENATE lw_path 'NP_StockBalance.dat'
    INTO lw_path.
    *-- Begin RM080107 - Add timestamp to the archived file
    ELSE.
    CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
    INTO lw_path.
    ENDIF.
    *-- End RM080107
    ELSE.
    ENDIF.
    ENDFORM. "get_interface_filename
    *& Form move_file RM080107
    Move the processed file to archive directory
    FORM move_file.
    *-- At last move the file to archive directory
    OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
    IF sy-subrc = 0.
    LOOP AT t_rawdata INTO w_rawdata.
    TRANSFER w_rawdata TO p_arch.
    ENDLOOP.
    ENDIF.
    CLOSE DATASET p_arch.
    DELETE DATASET p_file.
    ENDFORM. " move_file

    Hi,
    S E L E C T I O N S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file LIKE rlgrap-filename,
    p_arch LIKE rlgrap-filename. "RM080107
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
    SELECTION-SCREEN END OF BLOCK b1.
    I N C L U D E S
    INCLUDE zwm_np_stock_recon_top.
    INCLUDE zwm_np_stock_recon_f01.
    I N I T I A L I Z A T I O N
    INITIALIZATION.
    PERFORM get_interface_filename USING c_interface_file p_file.
    PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
    S T A R T O F S E L E C T I O N
    START-OF-SELECTION.
    PERFORM read_file USING p_file.
    PERFORM pre_processing.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    PERFORM process_checks.
    IF w_no_change = 'X'.
    WRITE: / text-b03.
    WRITE: / sy-uline(34).
    ELSE.
    PERFORM bdc_mi09.
    PERFORM file_check_report.
    PERFORM bdc_report.
    ENDIF.
    PERFORM post_process_checks.
    *-- Move the processed file to archive directory
    PERFORM move_file.
    ...*************.........first include...................************
    INCLUDE ZWM_NP_STOCK_RECON_TOP *
    Data declaration ----------------------------------------------
    TYPES: st_rawdata(2000) TYPE c.
    TYPES: BEGIN OF st_stck_cnt,
    werks TYPE iseg-werks, "plant
    lgort TYPE iseg-lgort, "storage location
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    vfdat TYPE mch1-vfdat, "Sell by date
    lwedt TYPE mch1-lwedt, "Manufacture date
    quarn(8) TYPE n, "qaunrantine quantity
    menge(8) TYPE n, "quantity on hand
    message(1), "Message Type (E/W/I)
    msg_txt TYPE t100-text, "Message Text
    zerostck(1), "Zero stock identifier "RM220307
    END OF st_stck_cnt.
    TYPES: BEGIN OF st_batch_errors,
    matnr TYPE iseg-matnr, "material number
    charg TYPE iseg-charg, "batch
    clabs TYPE mchb-clabs, "Stock Balance
    END OF st_batch_errors.
    DATA:
    t_rawdata TYPE TABLE OF st_rawdata,
    w_rawdata TYPE st_rawdata,
    t_stck_cnt TYPE TABLE OF st_stck_cnt,
    d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
    w_stck_cnt TYPE st_stck_cnt,
    t_batch_errors TYPE TABLE OF st_batch_errors,
    w_batch_errors TYPE st_batch_errors,
    t_messtab LIKE bdcmsgcoll OCCURS 0,
    w_messtab LIKE LINE OF t_messtab,
    w_no_change.
    CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
    c_archive_file(26) TYPE c
    VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
    .*************................second include..........************
    ***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
    *& Form read_file
    reads NextPharma file sent through via webmethods
    -->P_FILENAME
    FORM read_file USING p_filename.
    CLEAR: t_rawdata,
    w_rawdata.
    REFRESH: t_rawdata.
    OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
    IF sy-subrc <> 0.
    MESSAGE e720(01).
    ENDIF.
    DO.
    READ DATASET p_filename INTO w_rawdata.
    IF sy-subrc <> 0.
    EXIT.
    ELSE.
    APPEND w_rawdata TO t_rawdata.
    ENDIF.
    ENDDO.
    CLOSE DATASET p_filename.
    ENDFORM. " read_file
    *& Form pre_processing
    Read file values into internal table
    FORM pre_processing.
    DATA: lw_matnr TYPE iseg-matnr.
    LOOP AT t_rawdata INTO w_rawdata.
    lw_matnr = w_rawdata+21(20). "RM031006
    lw_matnr = w_rawdata+22(18). "RM031006
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
    input = lw_matnr
    IMPORTING
    output = lw_matnr
    EXCEPTIONS
    length_error = 1
    OTHERS = 2.
    MOVE: lw_matnr TO w_stck_cnt-matnr.
    w_stck_cnt-werks = w_rawdata+14(4).
    w_stck_cnt-lgort = w_rawdata+18(4).
    w_stck_cnt-charg = w_rawdata+84(25).
    w_stck_cnt-vfdat = w_rawdata+109(8).
    w_stck_cnt-lwedt = w_rawdata+117(8).
    w_stck_cnt-quarn = w_rawdata+141(8).
    w_stck_cnt-menge = w_rawdata+125(8).
    APPEND w_stck_cnt TO t_stck_cnt.
    CLEAR w_stck_cnt.
    ENDLOOP.
    SORT t_stck_cnt BY werks
    lgort
    matnr
    charg.
    DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
    ENDFORM. " pre_processing
    *& Form bdc_mi09
    Run file data via BDC TCODE: MI09
    FORM bdc_mi09.
    DATA: t_bdcdata TYPE TABLE OF bdcdata,
    w_bdcdata TYPE bdcdata,
    lw_datum(10) TYPE c,
    lw_count(2) TYPE n.
    WRITE sy-datum TO lw_datum DD/MM/YYYY.
    <b>select single MATNR
                       WERKS
                       CHARG
               from MCHA
               into (l_matnr, l_werks, l_charg)
               where matnr = w_stck_cnt-matnr
                  and werks = w_stck_cnt-werks.
                  and charg =  w_stck_cnt-charg.
    if sy-subrc ne 0.
    continue.
    endif.</b>
    Front Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0700'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Enter
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '/00'.
    APPEND w_bdcdata TO t_bdcdata.
    Count Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-ZLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Document Date
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'RM07I-BLDAT'.
    w_bdcdata-fval = lw_datum.
    APPEND w_bdcdata TO t_bdcdata.
    Plant
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-WERKS'.
    w_bdcdata-fval = w_stck_cnt-werks.
    APPEND w_bdcdata TO t_bdcdata.
    Storage Location
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'IKPF-LGORT'.
    w_bdcdata-fval = w_stck_cnt-lgort.
    APPEND w_bdcdata TO t_bdcdata.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    Do not submit items with Errors against them
    CHECK w_stck_cnt-message NE 'E' AND
    w_stck_cnt-zerostck NE 'X'.
    "RM220307
    lw_count = lw_count + 1.
    Input Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Page Down
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=P+'.
    APPEND w_bdcdata TO t_bdcdata.
    Material
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-MATNR(01)'.
    w_bdcdata-fval = w_stck_cnt-matnr.
    APPEND w_bdcdata TO t_bdcdata.
    Batch
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-CHARG(01)'.
    w_bdcdata-fval = w_stck_cnt-charg.
    APPEND w_bdcdata TO t_bdcdata.
    IF w_stck_cnt-menge NE 0.
    Quantity
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
    w_bdcdata-fval = w_stck_cnt-menge.
    APPEND w_bdcdata TO t_bdcdata.
    *-- Begin RM220307 - We need to create an item when the quantity is zero
    *-- in file and is non-zero in SAP
    ELSE.
    Zero Stock indicator
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'ISEG-XNULL(01)'.
    w_bdcdata-fval = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    *-- End RM220307
    ENDIF.
    ENDLOOP.
    CHECK lw_count NE 0.
    After all line items have been input
    Final Screen
    CLEAR w_bdcdata.
    w_bdcdata-program = 'SAPMM07I'.
    w_bdcdata-dynpro = '0731'.
    w_bdcdata-dynbegin = 'X'.
    APPEND w_bdcdata TO t_bdcdata.
    Save Document
    CLEAR w_bdcdata.
    w_bdcdata-fnam = 'BDC_OKCODE'.
    w_bdcdata-fval = '=BU'.
    APPEND w_bdcdata TO t_bdcdata.
    CALL TRANSACTION 'MI09' USING t_bdcdata
    MODE p_mode
    MESSAGES INTO t_messtab.
    ENDFORM. " bdc_mi09
    *& Form bdc_report
    Write BDC Messages.
    FORM bdc_report.
    DATA: lw_text TYPE t100-text.
    SKIP.
    WRITE: / text-b01.
    WRITE: / sy-uline(21).
    SKIP.
    Write BDC Messages
    LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
    MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
    NUMBER w_messtab-msgnr
    WITH w_messtab-msgv1
    w_messtab-msgv2
    w_messtab-msgv3
    w_messtab-msgv4
    INTO lw_text.
    WRITE: / lw_text.
    ENDLOOP.
    ENDFORM. " bdc_report
    *& Form process_checks
    Perform process check before creating BDC Session
    FORM process_checks.
    DATA: lw_clabs LIKE mchb-clabs,
    lw_menge LIKE mchb-clabs,
    lw_matnr LIKE mara-matnr,
    lw_charg LIKE mch1-charg,
    lw_fail,
    lw_vfdat TYPE mch1-vfdat,
    lv_sell TYPE c, "RM191006
    lv_qty(8) TYPE c. "RM191006
    CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
    Check if any of the stock figures differ from current stock figures
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    lw_menge = w_stck_cnt-menge.
    SELECT SINGLE clabs INTO lw_clabs
    FROM mchb
    WHERE matnr = w_stck_cnt-matnr
    AND werks = w_stck_cnt-werks
    AND lgort = w_stck_cnt-lgort
    AND charg = w_stck_cnt-charg.
    IF sy-subrc = 0.
    IF lw_clabs NE lw_menge.
    lw_fail = 'X'.
    *-- Begin RM220307 - Do not create PI item if the stock is zero in the
    *-- file and is zero in SAP
    EXIT.
    ELSEIF lw_clabs = 0 AND lw_menge = 0.
    w_stck_cnt-zerostck = 'X'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM220307
    ELSE.
    lw_fail = 'X'.
    ERROR
    ENDIF.
    ENDLOOP.
    If no differences are found set NO CHANGE Flag
    IF lw_fail NE 'X'.
    w_no_change = 'X'.
    EXIT.
    ENDIF.
    Check for Errors in file data
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    CLEAR lv_sell. "RM191006
    SELECT SINGLE matnr INTO lw_matnr
    FROM mara
    WHERE matnr = w_stck_cnt-matnr.
    IF sy-subrc NE 0.
    Invalid Material (E)
    w_stck_cnt-message = 'E'.
    w_stck_cnt-msg_txt = 'Invalid Material'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ENDIF.
    SELECT SINGLE charg vfdat
    INTO (lw_charg, lw_vfdat)
    FROM mch1 "KOB01 - changed from MCHA
    WHERE matnr = w_stck_cnt-matnr
    AND charg = w_stck_cnt-charg.
    AND werks = w_stck_cnt-werks.
    IF sy-subrc NE 0.
    Invalid Material Batch (E)
    w_stck_cnt-message = 'E'.
    CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    ELSE.
    IF w_stck_cnt-vfdat <> lw_vfdat.
    Sell by dates do not match (W)
    w_stck_cnt-message = 'W'.
    w_stck_cnt-msg_txt =
    'Sell by Date does not match Shelf life Expiry Date'.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    lv_sell = 'X'. "RM191006
    CONTINUE. "RM191006
    ENDIF.
    ENDIF.
    IF w_stck_cnt-quarn > 0.
    Quarantine balance not Zero (W)
    w_stck_cnt-message = 'W'.
    *-- Begin RM191006
    *-- We do want all warning messages on the report
    lv_qty = w_stck_cnt-quarn.
    CONDENSE lv_qty NO-GAPS.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
    input = lv_qty
    IMPORTING
    output = lv_qty.
    w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
    CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
    INTO w_stck_cnt-msg_txt SEPARATED BY space.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    CONTINUE.
    IF lv_sell = 'X'.
    APPEND w_stck_cnt TO d_stck_cnt.
    CLEAR lv_sell.
    ELSE.
    MODIFY t_stck_cnt FROM w_stck_cnt.
    ENDIF.
    *-- End RM191006
    ENDIF.
    ENDLOOP.
    *-- Begin RM191006
    *-- Finally get all the records into dummy table to report
    APPEND LINES OF t_stck_cnt TO d_stck_cnt.
    SORT d_stck_cnt.
    DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
    *-- End RM191006
    ENDFORM. " process_checks
    *& Form file_check_report
    Write warning and Error messages from File checks
    FORM file_check_report.
    WRITE: /2 'Material',
    22 'Batch',
    32 'Sell By',
    45 'Message Text'.
    WRITE: /2 sy-uline(115).
    SKIP.
    LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
    LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
    CHECK w_stck_cnt-message NE ' '.
    WRITE: /2 w_stck_cnt-matnr,
    22 w_stck_cnt-charg,
    32 w_stck_cnt-vfdat,
    43 w_stck_cnt-message,
    45 w_stck_cnt-msg_txt.
    ENDLOOP.
    ENDFORM. " file_check_report
    *& Form post_process_checks
    Check Material Batches in SAP against NP File
    FORM post_process_checks.
    RANGES: r_matnr FOR mchb-matnr,
    r_lgort FOR mchb-lgort,
    r_werks FOR mchb-werks.
    SORT t_stck_cnt.
    LOOP AT t_stck_cnt INTO w_stck_cnt.
    AT END OF matnr.
    r_lgort-sign = 'I'.
    r_lgort-option = 'EQ'.
    r_lgort-low = w_stck_cnt-lgort.
    APPEND r_lgort.
    r_werks-sign = 'I'.
    r_werks-option = 'EQ'.
    r_werks-low = w_stck_cnt-werks.
    APPEND r_werks.
    r_matnr-sign = 'I'.
    r_matnr-option = 'EQ'.
    r_matnr-low = w_stck_cnt-matnr.
    APPEND r_matnr.
    ENDAT.
    ENDLOOP.
    Select all material batches for NP Materials
    SELECT matnr charg clabs
    INTO TABLE t_batch_errors
    FROM mchb
    WHERE werks IN r_werks
    AND lgort IN r_lgort.
    IF sy-subrc EQ 0.
    Check if the Material Batches are in the NP file
    LOOP AT t_batch_errors INTO w_batch_errors.
    Disregard Batches without positive unrestricted stock
    IF w_batch_errors-clabs LE 0.
    DELETE t_batch_errors.
    CONTINUE.
    ENDIF.
    READ TABLE t_stck_cnt INTO w_stck_cnt
    WITH KEY matnr = w_batch_errors-matnr
    charg = w_batch_errors-charg.
    IF sy-subrc = 0.
    DELETE t_batch_errors.
    ENDIF.
    ENDLOOP.
    ENDIF.
    CHECK NOT t_batch_errors[] IS INITIAL.
    Write Batch chak results to report
    SKIP.
    WRITE: / text-b02.
    WRITE: / sy-uline(74).
    WRITE: /2 'Material',
    22 'Batch'.
    WRITE: /2 sy-uline(32).
    SKIP.
    LOOP AT t_batch_errors INTO w_batch_errors.
    WRITE: /2 w_batch_errors-matnr,
    22 w_batch_errors-charg.
    ENDLOOP.
    ENDFORM. " post_process_checks
    G E T _ I N T E R F A C E _ F I L E N A M E
    FORM get_interface_filename USING filename lw_path.
    DATA: i_file TYPE filename-fileintern,
    out_filename LIKE v_path-pathextern.
    CLEAR: out_filename.
    i_file = filename.
    get the interface filename to be used when creating file
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    logical_filename = i_file
    IMPORTING
    file_name = out_filename
    EXCEPTIONS
    file_not_found = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    MOVE out_filename TO lw_path.
    IF filename NE c_archive_file. "RM080107
    CONCATENATE lw_path 'NP_StockBalance.dat'
    INTO lw_path.
    *-- Begin RM080107 - Add timestamp to the archived file
    ELSE.
    CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
    INTO lw_path.
    ENDIF.
    *-- End RM080107
    ELSE.
    ENDIF.
    ENDFORM. "get_interface_filename
    *& Form move_file RM080107
    Move the processed file to archive directory
    FORM move_file.
    *-- At last move the file to archive directory
    OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
    IF sy-subrc = 0.
    LOOP AT t_rawdata INTO w_rawdata.
    TRANSFER w_rawdata TO p_arch.
    ENDLOOP.
    ENDIF.
    CLOSE DATASET p_arch.
    DELETE DATASET p_file.
    ENDFORM. " move_file
    Best regards,
    Prashant

  • Specific Identification Cost for batch managed items (Follow-Up from P2P)

    Specific Identification Cost method is used for serial and batch managed item. Using this method, the outbound cost of such items would be the original cost of specific goods, which can be determined according to the serial or batch number of that item.
    Business One allows the user to receive batch managed items with a batch number that already exists in the DB. It’s possible that the received quantity is added to on-hand quantity in the warehouse. In such case, the quantity on-hand of that batch and the received quantity may have different costs.
    What should be the system behavior in such case:
    1. Block receipts to the same batch with different costs.
    2. Write the difference to a price difference account, as done in Standard Cost method.
    3. Manage the batch cost with Moving Average method.
    This thread is continuation from 'Specific Identification Cost for batch managed Items' <a href="http://p2p.sap.com/businessoneforum?type=join&login=1&uid=41FB661A76CED536C825C4E2B6FF4397&cid=91&go=z37225">discussion</a> in P2P SAP Business One Forum (Product Development Collaboration).
    Previous discussion on P2P is summarized in the attached file.

    Hi Peter,
    This is a very important functionality that you are describing here. For example, in the Steel industry, it could be extremely useful to cost by batch or serial number.
    If you receive a batch that already exists in the system and if the costing method for the product is moving average, then teh cost of the batch should be calculated based on the moving average as well.
    If the costing method is standard, then the cost should go in a variance account.
    If the costing method is FIFO, then it is a getting trickier...
    Regards,
    Vincent

  • Questions on OBIEE reporting against transactional Database

    Hello guys
    I have a situation where I have to bring in 5 tables from transactional database to do reporting on.. I looked at the tables, there are not typically dimension or fact tables. Each table contains information very specifically, at the same time all tables have numeric values that needed to be aggregated at the lowest level of that table..
    I can join all these 5 tables together knowing the key columns. However, this is basically joining 5 tables with fact measures... Since this is transactional database which we don't own, so I can't create views nor changing the table structures..
    I wonder how would I be able to configure such model in OBIEE?
    Any thoughts?

    Thank you for the reply..
    The specific situation I have here is:
    I have 4 tables that I am polling directly from the4 store's cash register (Oh yea, real real time), they are customer, receipt line, receipt header, inventory,
    The physical join is: they are customer-----> receipt line<-----receipt header <------------inventory...
    In the BMM layer, each of these 4 tables have columns that should be measures, such as customer.customer credit limit, receipt line. quantity, receipt header. reciept tendered, inventory.quantity on hand... They are more measure columns from each table, but I am just listing one from each..
    In this case if i set the aggregation rule on each column, then the BMM model won't a star schema anymore because every table can be fact..
    I thought about adding all the measure columns into 1 logical fact table, which then the logical fact will have 4 LTS: customer, Re Line, Re Header, Inv.. This will be fine if I am only dealing with 1 store... However, in reality there will be 50 stores with the same exact tables/structures but on different servesr. Therefore, the logical fact will end up with 4*50 = 200 LTS each has fragmentation defined "store number = NYC or something else"..
    Just wondering if combining all the measures in one logical table is the only way to model this design or not? What would be the best thing to do if in this situation I have to report against multiple data source of the same tables in 1 subject area?
    Please let me know your thoughts..
    Thank you

Maybe you are looking for

  • Account dimension logic

    Hi, I've hit an issue with the length of my calculation exceeding 255.  I'd like to add functions to the mdx logic library, but can't seem to figure out the best way to edit the file.  I can see that there are logic files in the adminapp folder for e

  • Problem while assigning smartform in NACE

    Hi all, I am getting the following error while trying to assign a Z-smartform in NACE transaction. Rewards assured <b>Diagnosis</b> For output type NEU and transmission medium 8 an entry has been maintained in the table of processing programs, but in

  • Ipod nano wont restore~error 1433, ipod nano wont restore~error 1433, ipod nano wont restore~error 1433

    my ipod nano wont restore ~ error 1433 what to do

  • Running

    Over the past few months, (possibly since installing Mavericks) my MacBook Pro has been running more and more slowly. Mail, iCal, Chrome, Word, Dropbox and others continually are not responding and require a force quit and reopen. Can anyone suggest

  • Issue regarding dispaly of Vanilla Dashboards in OBIA 7.9.6.1

    Hi All, I need a favor from you guys. I had installed OBIA7.9.6.1 in my system successfully. When i tried to login to the Presentation services as Administrator, i'm unable to find the default Vanilla Dashboards/ Pre built dashboards unlike in PAINT