Sequencing of Purchase order and Good Issue acc. to Production order date

Hello ,
We are using Direct procurement scenario ,During MRP run we generate a Plan order(which have dates); which converted into Production order later.For these production order material is needed (components). And for procuring components we need to create purchase order.
Assumption :- Each component have same Procurement lead time
Our requirement is Purchase order and GI in Production order should be done sequentially, means Based on Production order date ,FIFO based Purchase orders are created and GI done in Production order. Production order with earlier production date have purchase orders earlier and we do GI in production order accordingly.
Kindly suggest

Hello Dario
Thanks for your reply. Our requirement is to put a check on system that GI for production order should be done FIFO wise
means as MRP generate 3 production order of same material each at different date , we want issance of components to be done on FIFO wise in production order
Regards
Rajeev

Similar Messages

  • Regarding Goods Reversal and Goods Issue process for Production orders

    Hi,
    I have a issue regarding <b>Goods Reversal</b> and <b>Goods Issue</b> process for <b>Production orders</b>.
    Actually I am having a Z - Function Module in that i am passing <b>production order number other details</b> to
    make the <b>Goods Reversal</b> happen.
    The code for the above is as below:
                       i_mvtit-material      = wa_mdfa-matnr.
                        i_mvtit-plant         = i_resb-werks.
                        i_mvtit-spec_stock    = 'Q'.          "New
                        i_mvtit-stge_loc      = 'ZWIP'.
                        i_mvtit-stge_type     = i_resb-lgtyp. "New
                        i_mvtit-batch         = i_resb-charg. "New
                        i_mvtit-orderid       = i_resb-aufnr.
                        i_mvtit-spec_stock    = i_resb-sobkz.
                        i_mvtit-entry_qnt     = i_resb-enmng.
                        i_mvtit-entry_uom     = i_resb-erfme.
                        i_mvtit-entry_uom_iso = i_resb-meins. "New
                        i_mvtit-wbs_elem      = v_frwbs.
                        i_mvtit-move_type     = '262'.
                        i_mvtit-xstob         = 'X'.
                        i_mvtit-gr_rcpt       = i_resb-aufnr. "New
                        i_mvtit-reserv_no     = i_resb-rsnum.
                        i_mvtit-res_item      = i_resb-rspos.
                        APPEND i_mvtit.
    * HEADER ELEMENTS
                        k_gmvt_code-gm_code    = '03'.
                        k_gmvt_head-pstng_date = sy-datum.
                        k_gmvt_head-doc_date   = sy-datum.
    * CREATE GOODS MOVEMENTS
                        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
                          EXPORTING
                            goodsmvt_header = k_gmvt_head
                            goodsmvt_code   = k_gmvt_code
                          TABLES
                            goodsmvt_item   = i_mvtit
                            return          = i_return.
    The Above code does the <b>Goods Reversal</b> but then i will update one Z Table with fields like
    Production Order Number[AUFNR], Number of Reservation[RSNUM], Item Number of Reservation [RSPOS], Material Number [MATNR], Requirement Quantity [BDMNG], WBS element[PSPNR] etc. If Above BAPI runs sucessfully.
    That is happening correctly.
    But Then actual issue is i have do <b>Goods Issue</b> for those Z-Table records.
    There i will give Production order Number's & Storage Location in Selection-Criteria.
    Then i need to do <b>Goods Issue</b> for that order.
    The code i had written as follows.
    * POPULATE VALUES FOR BAPI CALL
            i_mvtit-material      = i_zpsi7603_01-matnr.
            i_mvtit-plant         = i_resb-werks.
            i_mvtit-spec_stock    = 'Q'.                "New
            i_mvtit-stge_loc      = p_sloc.
            i_mvtit-stge_type     = i_resb-lgtyp.       "New
            i_mvtit-batch         = i_resb-charg.
            i_mvtit-orderid       = i_resb-aufnr.
            i_mvtit-spec_stock    = i_resb-sobkz.
            i_mvtit-entry_qnt     = i_resb-enmng.
            i_mvtit-entry_uom     = i_resb-erfme.
            i_mvtit-entry_uom_iso = i_resb-meins.       "New
            i_mvtit-wbs_elem      = v_frwbs.
            i_mvtit-move_type     = c_261.
            i_mvtit-mvt_ind       = 'F'.                "New
            i_mvtit-xstob         = c_x.
            i_mvtit-gr_rcpt       = i_resb-aufnr.       "New
            i_mvtit-reserv_no     = i_resb-rsnum.
            i_mvtit-res_item      = i_resb-rspos.
            APPEND i_mvtit.
    * HEADER ELEMENTS
            k_gmvt_code-gm_code    = c_03.
            k_gmvt_head-pstng_date = sy-datum.
            k_gmvt_head-doc_date   = sy-datum.
    * CREATE GOODS MOVEMENTS
            CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
              EXPORTING
                goodsmvt_header = k_gmvt_head
                goodsmvt_code   = k_gmvt_code
              TABLES
                goodsmvt_item   = i_mvtit
                return          = i_return.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = c_x.
            READ TABLE i_return INDEX 1.
            IF i_return-type EQ c_s.
              DELETE FROM zpsi7603_01 WHERE aufnr = i_resb-aufnr AND
                                            rsnum = i_resb-rsnum AND
                                            rspos = i_resb-rspos.
            ENDIF.
    If i run above code for <b>Goods Issue</b> it is giving error can anybody tell me what changes i need to do to make it work.
    The <b>Error Message</b> i am getting is as below:
    <b>Qty and / or "delivery completed" ind. or final issue ind. are missing</b>
    <b>Error Number for the above is : 264.</b>
    Can anybody solve my issue.
    Any help will be appreciated.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi,
    Thanks boss.
    It is working now correctly.
    The issue is the  i_mvtit-XSTOB should be equal space in case of Goods issue while incase of Reversal it should be equal to X.
    Thanks for ur efforts.
    I had awarded you points.
    Thanks a lot.
    Thanks & Regards,
    Rayeez.

  • Goods Issue (MB1A) for production order - no stock reduce happening in WM

    Hi,
    I try to do a Goods Issue with transaction MB1A for a production order, but no stock reduces happens within WM (HUM).
    I did the following.
    Created a Production order - CO01
    Created a TR - LB01 - (assigned production order to the TR)
    Created a HU for the materials. (HU02)
    Created a Transfer order to storage type 914 with L_TO_CREATE_MOVE_SU.
    At the end I want to do an goods Issue with MB1A. This seems not to work correctly. When I fill out the ordernumber and process the transaction a Delivery is created.The materials are already on 914, so it can be issued directly.
    What can I do to solve this.
    Thanks in advance.
    Regards,
    Alexander

    Please find out is there any accoun t assignment is there for the component in question.
    pl got production order disply screen and goto  --> material list
    check is there any value on the filed account assignment. If that is the case then you need to have special stcok for that account.
    If it is empty then check
    are you entereing the correct storage location and plant.
    if that is also fine then check whether the component is already issued, i.e. goto the component detailed screen and check wthere final issue tick is there for the component...or the componentb is deleted...
    come back after these checks.

  • Goods issue for plant maintenance order

    Goods issue with ref to plant maintenance order( Componenets of the order) is not possible in transaction code MIGO. Error message " MIGO is not possible for the refurbishment order".
    Goods issue for the same order can be posted with transaction MB!A.

    hi santhosh
    kindly check the order type .i think you are using MB1A for refurbishment process.but it is not possible.only maintenance order can be posted via MB1A
    follow the procedure for goods issue in refurbishment order.
    Choose Logistics ® Plant maintenance ® Maintenance processing ® Completion confirmation ® Goods movement ® Goods movement.
    The entry screen for a goods issue appears.
    Choose the pushbutton For order.
    Enter the relevant order number in the dialog box and choose Continue.
    An entry screen appears.
    Choose Copy.
    The Maintain Serial Numbers dialog box appears.
    Choose Reference document.
    Enter the order number in the Refurbishment order group box and choose Execute.
    A list appears with the planned serial numbers for the refurbishment order.
    Check the selections of serial numbers, for whose material you want to post a goods issue, and choose Copy.
    The serial numbers are copied into the Maintain Serial Numbers dialog box.
    Choose Exit window.
    The goods issue is posted.
    regards
    thyagarajan

  • Spare Sales order stealing stock from a Released production order

    Hi Gurus,
    This is not a new problem. I read the below link only a hundred time now.
    Sales order stealing components from Production order
    Business scenario-
    Top Assembly material - XYZ (Let's say Desktop PC), Proc type - E, Plng Strat - 40 (regular MTS scenario)
    Sub Assembly material - ABC (Let's say Monitor), Proc type - F, Plng Strat - blank. But we sell this part sometimes (Let's say - customer wants an additional monitor).
    Roy is a shop supervisor working on a $1 million Sales order for Top assembly XYZ which is already late and customer is screaming.
    He released the production order with no missing parts, printed and fretting to finish this order.
    After couple of hours of setup & machine prep - Roy went to pick up the parts and to his surprise material ABC is not available. 
    Tina is at shipping department working on a $1000 Sales order that arrive today. System said 'sure you can ship it 3 days in advance'. So created a delivery and shipped it to the customer.
    Now, Roy ran TCode: MB52 and found out that Tina just shipped his component ABC.
    SAP gave the part ABC to a $1000 sales order and business lost sales on a $1 million order.
    Please find the attachment for config screen shots TCode: OPJJ
    Sales order Checking rule
    Production order Release checking rule
    Please help me resolve this issue.
    Let me know if you need more info.
    Thanks,

    Praneeth,
    There are two separate concepts here.  "How do I ensure that production orders and Sales orders are on an equal footing" and "what is the purpose of 'check without RLT'.
    You have an ATP check relevant for Sales orders (checking rule "A" for Make To Stock).  You have an ATP check for production orders (I assume it is checking rule "PP").  If you want these two objects to have equal priority on stock and supplies, then make the two rules (OVZ9 for A and PP) identical.
    Now, to RLT.
    Prod Order Release has 'Check without RLT' active, that means - it'll let the sales orders (also that are outside the RLT) steal the stock.
    Sales orders that are outside RLT will automatically confirm.  "Stealing" stock is a result of combination of the ATP for the sales orders, plus the ATP for the sales order delivery, combined with the ATP for production orders. and any ATP you may have on Goods Issues against a production order.  I cannot possibly tell you what you should do to prevent stealing stock, since there are so many permutations of scenarios that can affect the outcome.
    I suggest instead that you give me concrete scenarios, telling me of specific problems, illustrated with screenshots of CO09, and I will help you through one or two specific scenarios.
    Best regards,
    DB49

  • How to change Purchase Order currency after Good receipt and Good issue?

    Hi,
    I've a PO created last year. The PO currency has been entered wrongly.
    My store colleague has been performed good received and consumed it.
    Now, I am not able to change PO currency to correct one, due to this message:-
    Currency can no longer be changed
    Message no. 06489
    Diagnosis
    As a basic rule, the currency cannot be changed if there has already been a goods receipt against a document.
    If the document contains external service and/or limit items, or if an invoicing plan has been assigned to an item, the currency cannot be changed following the receipt of an invoice either.
    If external service items exist, the currency also cannot be changed if services that have actually been performed have already been recorded or if the item in question has been assigned to a preventive maintenance (servicing) plan.
    Is there anyway to change PO currency after Good receipt and Good issue? Thanks !

    Diagnosis
    As a basic rule, the currency cannot be changed if there has already
    been a goods receipt against a document.
    If the document contains external service and/or limit items,
    or if an invoicing plan has been assigned to an item,
    the currency cannot be changed following the receipt of an invoice either.
    If external service items exist, the currency also cannot be changed if
    services that have actually been performed have already been recorded or
    if the item in question has been assigned to a preventive maintenance (servicing) plan.
    Answer in question itself,need to cancel all documents of wrong currency in order of LIFO,
    Create a new purchase order.

  • Last purchase order and goods receipt for material

    Hello to everyone,
    is there any standard report where I can see the last purchase order and goods receipt for a material?
    Regards

    Hi,
    Latest PO you can get from ME2M, by giving input as material and scope of list as best.
    Latest GR date can be get from MB51, by giving input as Material and movement type as 101.
    Regards,
    Prabu

  • Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are

    Vendor batch No.  : Transaction ZJPMPU322
    (Background)     
    There are "vendor batch" and "batch" fields in Goods-in-order and Goods-in-plan lists (transaction ZJPMPU322). Values for these fields are retrieved from inbound delivery document (transaction VL33N). After core 7.0 upgrade, "vendor batch" is not copied from "batch" in inbound delivery document any more so that nothing appears in the vendor batch field in the lists.
    (Change request)
    Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are retrieved from "batch" in inbound delivery document ONLY IF "vendor batch" is blank in the inbound delivery document.
    (Current design)
    Batch is retrieved from LIPS-CHARG
    Vendor batch is retrieved from LIPS-LICHN
    (If there is no record in LIPS, blank will be printed out for both fields)
    (After change)
    Batch is retrieved from LIPS-CHARG
    Vendor batch is retrieved from LIPS-LICHN only if LIPS-LICHN is not blank.
    If LIPS-LICHN is blank, vendor batch is retrieved from LIPS-CHARG.
    (If there is no record in LIPS, blank will be printed out for both fields. If both LIPS-CHARG and LIPS-LICHN are blank, blank will be printed out for both fields),
    Following is the program:
    REPORT zjpmrpu322  MESSAGE-ID  zjpm001
                  NO STANDARD PAGE HEADING
                            LINE-COUNT  50
                            LINE-SIZE  255.
    *&   Development ID: PU_DD_322_LJP                                     *
    *&   Report        : ZJPMRPU322                                        *
    *&   The Purpose of this program is to print the  Goods-in-order list  *
    *&   and the Goods in plan list for raw materials, materials purchase  *
    *&   etc at the Sasayama plant, Japan.                                 *
    *&   Change Log:                                                       *
    *&   Init    Who              Date        Text                         *
    *&   PV      P V R S Varma    07-May-2003  Initial Version             *
    *&   DU      D.Usui           2004/02/26   CR No. 1432                 *
    *&   DU      D.Usui           2004/03/08   CR No. 1447                 *
    *&   DU      D.Usui           2004/05/06   CR No. 1591                 *
                            Constants
    CONSTANTS:
    c_werks   LIKE ekpo-werks VALUE 'JP01',    "Plant code - Sasayama plant
    c_id      LIKE thead-tdid VALUE 'F02',     "Text ID for Info record
    c_object  LIKE thead-tdobject VALUE 'EKPO',"Object of text for info rec
    *c_zzjp_r1 LIKE marc-zzjp_re1 VALUE 'GMP',  "Goods in plan- Domestic
    *c_zzjp_r2 LIKE marc-zzjp_re1 VALUE 'GMPI', "Import sales order document
    c_plus    TYPE c VALUE '',                "Holding '' sign
    c_spras   LIKE makt-spras VALUE 'J',       "Language key Japan
    *c_device(7)    type c value 'PRINTER',    "Device type
    c_form(16)     TYPE c VALUE 'ZJPMPU305',  "Form name
    c_ele_gmp(4)   TYPE c VALUE 'GMP',        "GMP Text element
    c_ele_gmpi(4)  TYPE c VALUE 'GMPI',       "GMPI Text element
    add begin CR1432
    c_ele_bgmp(4)  TYPE c VALUE 'BGMP',       "BGMP
    c_ele_bgmpi(5) TYPE c VALUE 'BGMPI',      "BGMPI
    add end CR1432
    c_function(3)  TYPE c VALUE 'SET',        "Function
    c_type(4)      TYPE c VALUE 'BODY',       "Window area in main window
    c_win_head(7)  TYPE c VALUE 'HEADING',    "Heading window
    c_win_shead(7) TYPE c VALUE 'SUBHEAD',    "sub heading window
    c_win_fot1(7)  TYPE c VALUE 'FOOTER1',    "Footer 1 window
    c_win_main(4)  TYPE c VALUE 'MAIN',       "Main window
    c_comd(8)      TYPE c VALUE 'NEW-PAGE',   "New-page command
    c_zar TYPE ekko-bsart VALUE 'ZAR',
    c_x            TYPE c VALUE 'X',          "Indicator for print options
    c_f            TYPE c VALUE 'F',          "Indicator for Purchase Order
    add begin CR1591
    Deletion indicator in purchasing document
    c_loekz(1)     TYPE c VALUE 'L',
    For ranges tables
    c_sign_i(1)    TYPE c VALUE 'I',          "Sign(include)
    c_op_eq(2)     TYPE c VALUE 'EQ',         "Option(=)
    Confirmation category
    c_ebtyp_ab(2)  TYPE c VALUE 'AB',         "Order acknowledgment
    add end CR1591
    c_la(2)        TYPE c VALUE 'LA'.         "Indicator for Inbound deliver
                          Database Tables
                        Vaiables / Internal tables                       *
    Internal table to store PO information
    Not used after CR1591
    DATA: BEGIN OF t_purc OCCURS 0,
             ebeln LIKE eket-ebeln, "Purchasing Document Number
             ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
             eindt LIKE eket-eindt, "Item delivery date
             menge LIKE eket-menge, "Scheduled quantity
             charg LIKE eket-charg, "Batch number
             matnr LIKE ekpo-matnr, "Material code
             werks LIKE ekpo-werks, "Plant
             meins LIKE ekpo-meins, "Unit of measure
             lifnr LIKE ekko-lifnr, "Vendor number
          END OF t_purc.
    Internal table to store material description.
    DATA: BEGIN OF t_makt OCCURS 0,
            matnr LIKE makt-matnr,  "Material code
            maktx LIKE makt-maktx,  "Material description
          END OF t_makt.
    Internal table for storage of final EKET data
    DATA: BEGIN OF t_eket OCCURS 0,
             ebeln LIKE eket-ebeln, "Purchasing Document Number
             ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
             ebelp_ex(6) TYPE n,    "Extended ebelp with length 6
             eindt LIKE eket-eindt, "Item delivery date
             menge LIKE eket-menge, "Scheduled quantity
             dabmg LIKE ekes-dabmg, " Delivered Quantity
             charg LIKE eket-charg, "Batch number
             matnr LIKE ekpo-matnr, "Material code
             werks LIKE ekpo-werks, "Plant
             maktx LIKE makt-maktx, "Material Description-- jp check
             etens LIKE ekes-etens, "Sequence Number
             meins LIKE ekpo-meins, "Unit of measure
             lifnr LIKE ekko-lifnr, "Vendor number
             vbeln LIKE ekes-vbeln,
             vbelp LIKE ekes-vbelp,
             vpnam(40) TYPE c,      "Vendor product name
          END OF t_eket.
    Internal table for extraction of data from EKES
    Not used after CR1591
    DATA: BEGIN OF t_ekes OCCURS 0,
             ebeln LIKE ekes-ebeln, "Purchasing Document Number
             ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
             etens LIKE ekes-etens, "Sequence No
             eindt LIKE ekes-eindt, "Item delivery date
             menge LIKE ekes-menge, "Scheduled Quantity
             dabmg LIKE ekes-dabmg, " delivered quantity
             vbeln LIKE ekes-vbeln,
             vbelp LIKE ekes-vbelp,
             mark TYPE c,
          END OF t_ekes.
    Internal table for extraction of data from EKES
    Not used after CR1591
    DATA: BEGIN OF t_ekes_temp OCCURS 0,
             ebeln LIKE ekes-ebeln, "Purchasing Document Number
             ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
             etens LIKE ekes-etens, "Sequence No
             eindt LIKE ekes-eindt, "Item delivery date
             menge LIKE ekes-menge, "Scheduled Quantity
          END OF t_ekes_temp.
    Internal table for storing data from MLGN table.
    DATA: BEGIN OF t_mlgn OCCURS 0,
             matnr LIKE mlgn-matnr, "material code
             lhmg1 LIKE mlgn-lhmg1, "Standard pallet size
             lhme1 LIKE mlgn-lhme1, "Unit of measure
             lety1 LIKE mlgn-lety1, "tower
             ltkze LIKE mlgn-ltkze, "Storage location
          END OF t_mlgn.
    Internal table for storing data from MARM table.
    DATA: BEGIN OF t_marm OCCURS 0,
             matnr LIKE marm-matnr, "material code
             umrez LIKE marc-zzjp_cas_size, "Std package unit
             meins LIKE ekpo-meins, "alternate unit
          END OF t_marm.
    Internal table for storing data from MARC table.
    DATA: BEGIN OF t_marc OCCURS 0,
             matnr LIKE marc-matnr,               "Material code
             zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
             zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
             zzjp_aprn     LIKE marc-zzjp_aprn,   "Apperance
             zzjp_re1     LIKE marc-zzjp_re1,     "Heading
          END OF t_marc.
    Internal table for storing data from lfa1 table.
    DATA: BEGIN OF t_lfa1 OCCURS 0,
             lifnr LIKE lfa1-lifnr, "Vendor code
             name1 LIKE lfa1-name1, "Vendor name
          END OF t_lfa1.
    Internal table for Storing data from LIPS table.
    DATA: BEGIN OF t_lips OCCURS 0,
             vbeln LIKE lips-vbeln, "Delivery document no
             posnr LIKE lips-posnr, "Item number for Delivery document
             charg LIKE lips-charg, "Batch number
             lichn LIKE lips-lichn, "Vendor Batch number
          END OF t_lips.
    Internal table for storing the final display data.
    DATA: BEGIN OF t_display OCCURS 0,
            g_checkbox  type  c,       "check box for selection of records
             ebeln LIKE ekes-ebeln,      "Purchasing Document Number
             ebelp LIKE ekes-ebelp,      "Item Number of Purchasing Document
             etens LIKE ekes-etens,      "Sequence No
             eindt LIKE eket-eindt,      "Item delivery date
             menge LIKE eket-menge,      "Scheduled Quantity
             vpnam(40) TYPE c,          "Vendor product name
             lifnr LIKE ekko-lifnr,      "Vendor code
             name1 LIKE lfa1-name1,      "Vendor name
             meins LIKE ekpo-meins,      "Unit of measure
             matnr LIKE ekpo-matnr,      "Material Number
             maktx LIKE makt-maktx,     "Material Description-- jp check
             charg LIKE lips-charg,      "Batch number
             lichn LIKE lips-lichn,      "Vendor Batch number
             lhmg1 LIKE mlgn-lhmg1,     "standard pallet size
             lhme1 LIKE mlgn-lhme1,      "Unit of standard pallet
             lety1 LIKE mlgn-lety1,     "tower
             ltkze LIKE mlgn-ltkze,      "Storage location
             umrez LIKE marc-zzjp_cas_size,      "Std package unit
             meinh LIKE ekpo-meins,      "alternate unit
             zzjp_nyu_sop LIKE marc-zzjp_nyu_sop,      "Product Std number
             zzjp_dos_frm LIKE marc-zzjp_dos_frm,      "Dosage form
             zzjp_aprn     LIKE marc-zzjp_aprn,          "Apperance
             zzjp_re1     LIKE marc-zzjp_re1,           "Heading
             std_pac_no(13) TYPE n,            "Std receipt package no
             tot_std_pt(13) TYPE n,             "Total no of std pallets
    add begin CR1447
    Add new field 'Goods-in-order','Item' for goods in plan list
             vbeln like ekes-vbeln,     "Goods-in-order
             vbelp like ekes-vbelp,     "Item
    add end CR1447
          END OF t_display.
    Internal table for storing the final display data -Goods in order list
    DATA: BEGIN OF t_display1 OCCURS 0,
             ebeln LIKE ekes-ebeln,      "Purchasing Document Number
             ebelp LIKE ekes-ebelp,      "Item Number of Purchasing Document
             etens LIKE ekes-etens,      "Sequence No
             eindt LIKE eket-eindt,      "Item delivery date
             menge LIKE eket-menge,      "Scheduled Quantity
             vpnam(40) TYPE c,          "Vendor product name
             lifnr LIKE ekko-lifnr,      "Vendor code
             name1 LIKE lfa1-name1,      "Vendor name
             meins LIKE ekpo-meins,      "Unit of measure
             matnr LIKE ekpo-matnr,      "Material Number
             maktx LIKE makt-maktx,     "Material Description-- jp check
             charg LIKE lips-charg,      "Batch number
             lichn LIKE lips-lichn,      "Vendor Batch number
             lhmg1 LIKE mlgn-lhmg1,     "standard pallet size
             lhme1 LIKE mlgn-lhme1,      "Unit of standard pallet
             lety1 LIKE mlgn-lety1,     "tower
             ltkze LIKE mlgn-ltkze,      "Storage location
             umrez LIKE marc-zzjp_cas_size,      "Std package unit
             meinh LIKE ekpo-meins,      "alternate unit
             zzjp_nyu_sop LIKE marc-zzjp_nyu_sop,      "Product Std number
             zzjp_dos_frm LIKE marc-zzjp_dos_frm,      "Dosage form
             zzjp_aprn     LIKE marc-zzjp_aprn,          "Apperance
             zzjp_re1     LIKE marc-zzjp_re1,           "Heading
             std_pac_no(13) TYPE n,            "Std receipt package no
             tot_std_pt(13) TYPE n,             "Total no of std pallets
          END OF t_display1.
    Internal table for storing the final display data - Goods in plan list
    DATA: BEGIN OF t_display2 OCCURS 0,
             ebeln LIKE ekes-ebeln,      "Purchasing Document Number
             ebelp LIKE ekes-ebelp,      "Item Number of Purchasing Document
             etens LIKE ekes-etens,      "Sequence No
             eindt LIKE eket-eindt,      "Item delivery date
             menge LIKE eket-menge,      "Scheduled Quantity
             name1 LIKE lfa1-name1,      "Vendor name
             meins LIKE ekpo-meins,      "Unit of measure
             matnr LIKE ekpo-matnr,      "Material Number
             maktx LIKE makt-maktx,     "Material Description-- jp check
             charg LIKE lips-charg,      "Batch number
             lichn LIKE lips-lichn,      "Vendor Batch number
             lhmg1 LIKE mlgn-lhmg1,     "standard pallet size
             lety1 LIKE mlgn-lety1,     "tower
             ltkze LIKE mlgn-ltkze,      "Storage location
             tot_std_pt(13) TYPE n,             "Total no of std pallets
    add begin CR1447
    Add new field 'Goods-in-order','Item' for goods in plan list
             vbeln like ekes-vbeln,     "Goods-in-order
             vbelp like ekes-vbelp,     "Item
    add end CR1447
          END OF t_display2.
    add begin CR1591
    RANGES: r_matnr FOR mara-matnr,   "for p_matnr
            r_ebeln FOR ekpo-ebeln.   "for p_ebeln
    add end CR1591
    DATA: line TYPE i.            " line number
    DATA: g_checkbox  TYPE  c.       "check box for selection of records
    DATA: g_tab LIKE sy-index.    "variable to hold index
    DATA  g_tabix LIKE sy-tabix.  "holder for table index
    Printing Options.
    DATA: lw_pr_options LIKE itcpo.
    *lw_pr_options-tddest = 'SA03'.      " Print Device Name
    lw_pr_options-tdpreview = 'X'.      " Print Preview
    lw_pr_options-tdnewid = 'X'.        " New Request
    lw_pr_options-tdlifetime = 2.       " Retention in Spool
                            Selection Screen                             *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    SELECT-OPTIONS:
      s_date  FOR sy-datum DEFAULT sy-datum. " Search period.
    PARAMETERS:
      p_matnr LIKE mara-matnr,               " Material code
      p_ebeln LIKE ekpo-ebeln.               " Purchase Document No
    SELECTION-SCREEN END OF BLOCK blk1.
                       Selection Screen Checks                           *
    AT SELECTION-SCREEN.
      IF ( s_date-low IS INITIAL ) AND
         ( p_matnr IS INITIAL ) AND
         ( p_ebeln IS INITIAL ).
        MESSAGE e000 WITH 'Entry Must in atleast one of the Fields'(t00).
      ENDIF.
      IF ( NOT p_matnr IS INITIAL ) AND
         ( s_date IS INITIAL )      AND
         ( p_ebeln IS INITIAL ).
        MESSAGE e000 WITH 'Date should also be Entered'(t01).
      ENDIF.
    del begin CR1591
    This check is not found in original FS
    IF ( NOT p_matnr IS INITIAL ) AND
        ( s_date IS INITIAL ) AND
        ( NOT p_ebeln IS INITIAL ).
       MESSAGE e000 WITH 'Date should also be Entered'(t01).
    ENDIF.
    del end CR1591
                   Validations for Data selection                        *
    del begin CR1591
    Waste check
    IF ( NOT s_date IS INITIAL ) AND
        ( p_matnr IS INITIAL ) AND
        ( p_ebeln IS INITIAL ).
       PERFORM f_check_date_in_eket.
    ENDIF.
    IF ( NOT s_date IS INITIAL ) AND
        ( NOT p_matnr IS INITIAL ) AND
        ( p_ebeln IS INITIAL ).
       PERFORM f_check_matnr_in_plant.
       PERFORM f_check_matnr_in_ekpo.
       PERFORM f_check_date_in_eket.
       PERFORM f_check_matnr_in_plant.
       PERFORM f_check_matnr_in_ekpo.
    ENDIF.
    IF ( NOT s_date IS INITIAL ) AND
        ( NOT p_matnr IS INITIAL ) AND
        ( NOT p_ebeln IS INITIAL ).
       PERFORM f_check_matnr_in_plant.
       PERFORM f_check_matnr_in_ekpo.
       PERFORM f_check_date_in_eket.
       PERFORM f_check_ebeln_in_ekpo.
       PERFORM f_check_werks_in_ekpo.
    ENDIF.
    IF ( NOT p_ebeln IS INITIAL ) AND
        ( NOT s_date IS INITIAL ) AND
        ( p_matnr IS INITIAL ).
       PERFORM f_check_date_in_eket.
       PERFORM f_check_ebeln_in_ekpo.
       PERFORM f_check_werks_in_ekpo.
    ENDIF.
    IF ( NOT p_ebeln IS INITIAL ) AND
        ( s_date IS INITIAL ) AND
        ( p_matnr IS INITIAL ).
       PERFORM f_check_ebeln_in_ekpo.
       PERFORM f_check_werks_in_ekpo.
    ENDIF.
    del end CR1591
                         Data selection from Tables                      *
    START-OF-SELECTION.
      SET PF-STATUS 'SELECT'.
    add begin CR1591
    Set ranges tables
      PERFORM set_ranges.
    add end CR1591
    mod begin CR1591
    **Selection of PO data from EKET into internal table t_purc.
    PERFORM f_select_eket.
    **Selection of corresponding PO data for EKET from EKES into t_ekes.
    PERFORM f_select_ekes.
    **Selection of material desc from MAKT table into T_makt.
    PERFORM f_select_makt.
    **Copy the contents of t_purc and t_makt into t_eket table.
    PERFORM f_move_eket.
    **Replace the corresponding entries of t_eket with t_ekes.
    PERFORM f_update_eket.
    Selection of PO data from EKET into internal table T_EKET.
      PERFORM f_select_eket2.
    Selection of corresponding PO data from EKES appending to T_EKET.
      PERFORM f_select_ekes2.
    Selection of material desc from MAKT table into T_MAKT.
      PERFORM f_select_makt2.
    mod end CR1591
    *Selection of vendor product name.
      PERFORM f_select_vpnam.
    del begin CR1591
    No need
    **copy t_eket-ebelp into temporary variable.
    PERFORM f_copy_ebelp.
    del end CR1591
    *selection of data from MLGN table into t_mlgn internal table
      PERFORM f_select_mlgn.
    *selection of data from marm table into t_marm internal table
      PERFORM f_select_marm.
    *selection of data from marc table into t_marc internal table
      PERFORM f_select_marc.
    *selection of data from lfa1 table into t_lfa1 internal table
      PERFORM f_select_lfa1.
    *Selection of data from LIPS table into t_lips internal table
      PERFORM f_select_lips.
    del begin CR1591
    Don't display list screen when no data exists
    *END-OF-SELECTION.
    del end CR1591
    *lines = sy-linno - 1.
    *Collection of data into the final display internal table t_Display
      PERFORM f_collect_final.
    *Display the contents of t_display as a simple List
      PERFORM f_list_display.
    AT USER-COMMAND.
      PERFORM f_select_layout.
      INCLUDE zjpmipu315.
      INCLUDE zjpmipu316.
    *&      Form  f_check_MATNR_in_plant
         This Routine is to check if the the selected material code is
         available in the plant 'JP01'.
    FORM f_check_matnr_in_plant.
      DATA: l_matnr LIKE mara-matnr.
      SELECT matnr UP TO 1 ROWS FROM marc
                       INTO l_matnr
                       WHERE
                       matnr = p_matnr AND
                       werks = c_werks.
      ENDSELECT.
      IF l_matnr IS INITIAL.
        MESSAGE e000 WITH
        'The material is not available in '(t02)  c_werks 'plant'(t20).
      ENDIF.
    ENDFORM.                    " f_check_MATNR_in_plant
    *&      Form  f_check_EBELN_in_EKPO
          This Routine is to check if the Purchase order number selected
          is existing or not and if it exists, check if it is related to
          the plant 'JP01'.
    FORM f_check_ebeln_in_ekpo.
      DATA: l_ebeln LIKE ekpo-ebeln.
      SELECT ebeln UP TO 1 ROWS FROM ekpo
                    INTO l_ebeln
                    WHERE
                    ebeln = p_ebeln AND
                    werks = c_werks.
      ENDSELECT.
      IF l_ebeln IS INITIAL.
        MESSAGE e000 WITH
        'PO not available or not related to '(t03) c_werks 'plant'(t21).
      ENDIF.
    ENDFORM.                    " f_check_EBELN_in_EKPO
    *&      Form  f_check_matnr_in_ekko
          This routine is to check if any PO exist for the selected
          Material code.
    FORM f_check_matnr_in_ekpo.
      DATA: l_matnr LIKE ekpo-matnr.
      SELECT matnr UP TO 1 ROWS FROM ekpo
                       INTO l_matnr
                       WHERE
                       matnr = p_matnr.
      ENDSELECT.
      IF l_matnr IS INITIAL.
        MESSAGE e000 WITH
        'PO does not exist for the material no'(t04) p_matnr.
      ENDIF.
    ENDFORM.                    " f_check_matnr_in_ekpo
    *&      Form  f_check_date_in_eket
          This routine is to check if any purchase order exists
          with the selected
    FORM f_check_date_in_eket.
      DATA: l_eindt LIKE eket-eindt.
      SELECT eindt UP TO 1 ROWS FROM eket
                       INTO l_eindt
                       WHERE
                       eindt IN s_date.
      ENDSELECT.
      IF l_eindt IS INITIAL.
        MESSAGE e000 WITH
       'No PO exist with the selected delivery date '(t05).
      ENDIF.
    ENDFORM.                    " f_check_date_in_eket
    *&      Form  f_check_werks_in_ekpo
          This Routine is to check if the selected purchase order
          is associated with the plant JP01
    FORM f_check_werks_in_ekpo.
      DATA: l_ebeln LIKE ekpo-ebeln.
      SELECT ebeln UP TO 1 ROWS FROM ekpo
                       INTO l_ebeln
                       WHERE
                       werks = c_werks.
      ENDSELECT.
      IF l_ebeln IS INITIAL.
        MESSAGE e000 WITH
        'The selected P0 is not relevant to '(t06) c_werks 'plant'(t22).
      ENDIF.
    ENDFORM.                    " f_check_werks_in_ekpo
    *&      Form  f_select_eket
          Routine to collect data from EKET, EKPO, MAKT, EKKO tables
          using inner join and store the data into internal table
          t_PURC. The data selection is based on the selection screen's
          input.
    FORM f_select_eket.
      IF ( NOT s_date-low IS INITIAL ) AND
         ( p_matnr IS INITIAL ) AND
         ( p_ebeln IS INITIAL ).
        SELECT
                eket~ebeln
                eket~ebelp
                eket~eindt
                eket~menge
                eket~charg
                ekpo~matnr
                ekpo~werks
                ekpo~meins
                ekko~lifnr
         INTO TABLE t_purc
        FROM
                 (  ( eket  INNER JOIN  ekko  ON
                  eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                  eketebelp = ekpoebelp  AND
                  ekpoebeln = ekkoebeln )
      WHERE
                eket~eindt IN s_date AND
                ekpo~werks = c_werks AND
                ekpo~elikz NE c_x AND
                ekko~bstyp EQ c_f AND
                ekko~bsart NE c_zar.
      ELSEIF ( NOT s_date-low IS INITIAL ) AND
         ( NOT p_matnr IS INITIAL ) AND
         ( p_ebeln IS INITIAL ).
        SELECT
                eket~ebeln
                eket~ebelp
                eket~eindt
                eket~menge
                eket~charg
                ekpo~matnr
                ekpo~werks
                ekpo~meins
                ekko~lifnr
         INTO TABLE t_purc
        FROM
                 (  ( eket  INNER JOIN  ekko  ON
                  eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                  eketebelp = ekpoebelp  AND
                  ekpoebeln = ekkoebeln )
      WHERE
                eket~eindt IN s_date AND
                ekpo~matnr = p_matnr AND
                ekpo~werks = c_werks AND
                ekpo~elikz NE c_x AND
                ekko~bstyp EQ c_f AND
                ekko~bsart NE c_zar.
      ELSEIF ( NOT s_date-low IS INITIAL ) AND
         ( NOT p_matnr IS INITIAL ) AND
         ( NOT p_ebeln IS INITIAL ).
        SELECT
                eket~ebeln
                eket~ebelp
                eket~eindt
                eket~menge
                eket~charg
                ekpo~matnr
                ekpo~werks
                ekpo~meins
                ekko~lifnr
         INTO TABLE t_purc
        FROM
                 (  ( eket  INNER JOIN  ekko  ON
                  eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                  eketebelp = ekpoebelp  AND
                  ekpoebeln = ekkoebeln )
      WHERE
                eket~eindt IN s_date AND
                ekpo~matnr = p_matnr AND
                ekpo~ebeln = p_ebeln AND
                ekpo~werks = c_werks AND
                ekpo~elikz NE c_x AND
                ekko~bstyp EQ c_f AND
                ekko~bsart NE c_zar.
      ELSEIF ( s_date-low IS INITIAL ) AND
         ( p_matnr IS INITIAL ) AND
         ( NOT p_ebeln IS INITIAL ).
        SELECT
                eket~ebeln
                eket~ebelp
                eket~eindt
                eket~menge
                eket~charg
                ekpo~matnr
                ekpo~werks
                ekpo~meins
                ekko~lifnr
         INTO TABLE t_purc
        FROM
                 (  ( eket  INNER JOIN  ekko  ON
                  eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                  eketebelp = ekpoebelp  AND
                  ekpoebeln = ekkoebeln )
      WHERE
                ekpo~ebeln = p_ebeln AND
                ekpo~werks = c_werks AND
                ekpo~elikz NE c_x AND
                ekko~bstyp EQ c_f AND
                ekko~bsart NE c_zar.
      ELSEIF ( NOT s_date-low IS INITIAL ) AND
         ( p_matnr IS INITIAL ) AND
         ( NOT p_ebeln IS INITIAL ).
        SELECT
                eket~ebeln
                eket~ebelp
                eket~eindt
                eket~menge
                eket~charg
                ekpo~matnr
                ekpo~werks
                ekpo~meins
                ekko~lifnr
         INTO TABLE t_purc
        FROM
                 (  ( eket  INNER JOIN  ekko  ON
                  eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                  eketebelp = ekpoebelp  AND
                  ekpoebeln = ekkoebeln )
      WHERE
                eket~eindt IN s_date AND
                ekpo~ebeln = p_ebeln AND
                ekpo~werks = c_werks AND
                ekpo~elikz NE c_x AND
                ekko~bstyp EQ c_f AND
                ekko~bsart NE c_zar.
      ENDIF.
    IF sy-subrc <> 0.
       MESSAGE s000 WITH 'Data not found'(t07).
       LEAVE LIST-PROCESSING.
    ELSE.
      SORT t_purc.
    ENDIF.
    ENDFORM.                    " f_select_eket
    *&      Form  f_select_makt
          Routine to select the material description for all the
          materials present in T_purc table
    FORM f_select_makt.
      DATA: l_t_makt(4) TYPE c VALUE 'MAKT'.
      SELECT
          matnr
          maktx
      FROM
          makt
      INTO TABLE t_makt
          FOR ALL ENTRIES IN t_purc
      WHERE
         matnr = t_purc-matnr AND
         spras = c_spras.
      IF sy-subrc <> 0.
        MESSAGE s000 WITH
          'Relevant data not found in'(t09) l_t_makt 'table'(t23).
      ELSE.
        SORT t_makt.
      ENDIF.
    ENDFORM.                    " f_select_makt
    *&      Form  f_move_eket
          Routine to join data in T_PURC and T_MAKT tables into
          internal table T_MAKT.
    FORM f_move_eket.
      LOOP AT t_purc.
        t_eket-ebeln = t_purc-ebeln.
        t_eket-ebelp = t_purc-ebelp.
        t_eket-eindt = t_purc-eindt.
        t_eket-menge = t_purc-menge.
        t_eket-charg = t_purc-charg.
        t_eket-matnr = t_purc-matnr.
        t_eket-werks = t_purc-werks.
        t_eket-meins = t_purc-meins.
        t_eket-lifnr = t_purc-lifnr.
        READ TABLE t_makt WITH KEY matnr = t_purc-matnr
                                         BINARY SEARCH.
        IF sy-subrc = 0.
          t_eket-maktx = t_makt-maktx.
        ENDIF.
        APPEND t_eket.
        CLEAR t_eket.
      ENDLOOP.
    ENDFORM.                    " f_move_eket
    *&      Form  f_select_ekes
          Routine to select EKES data for all corresponding entries
          of T_EKET.
    FORM f_select_ekes.
      DATA: l_tabix TYPE i.
    IF NOT s_date IS INITIAL.
       SELECT
               ebeln
               ebelp
               etens
               eindt
               menge
        INTO   TABLE t_ekes
         FROM
               ekes
        WHERE
               eindt IN s_date.
    ELSE.
      DESCRIBE TABLE t_purc LINES l_tabix.
      IF l_tabix GT 0.
        SELECT
                ebeln
                ebelp
                etens
                eindt
                menge
                dabmg
                vbeln
                vbelp
         FROM
                ekes
         INTO   TABLE t_ekes
               FOR ALL ENTRIES IN t_eket
                FOR ALL ENTRIES IN t_purc
         WHERE
                ebeln = t_purc-ebeln AND
                ebelp = t_purc-ebelp AND
                eindt IN s_date.
              AND ebeln eq p_ebeln.
           and matnr in p_matnr.
      ENDIF.
      CLEAR l_tabix.
      IF NOT s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
        SELECT
                ekes~ebeln
                ekes~ebelp
                ekes~etens
                ekes~eindt
                ekes~menge
                ekes~dabmg
       APPENDING TABLE t_ekes
          FROM ekes
         WHERE
                eindt IN s_date AND
                ebeln EQ p_ebeln AND
                ebtyp EQ c_la.
      ELSEIF NOT s_date IS INITIAL AND p_ebeln IS INITIAL.
        SELECT
                    ekes~ebeln
                    ekes~ebelp
                    ekes~etens
                    ekes~eindt
                    ekes~menge
                    ekes~dabmg
           APPENDING TABLE t_ekes
              FROM ekes
             WHERE
                    eindt IN s_date AND
               ebeln EQ p_ebeln AND
                    ebtyp EQ c_la.
      ELSEIF s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
        SELECT
                    ekes~ebeln
                    ekes~ebelp
                    ekes~etens
                    ekes~eindt
                    ekes~menge
                    ekes~dabmg
           APPENDING TABLE t_ekes
              FROM ekes
             WHERE
               eindt IN s_date AND
                    ebeln EQ p_ebeln AND
                    ebtyp EQ c_la.
      ENDIF.
      IF sy-subrc = 0.
        SORT t_ekes.
      ENDIF.
      IF NOT t_ekes[] IS INITIAL.
        t_ekes_temp[] = t_ekes[].
        SORT t_ekes_temp BY ebeln ebelp.
        DELETE ADJACENT DUPLICATES FROM t_ekes_temp COMPARING ebeln ebelp.
        LOOP AT t_ekes_temp.
          READ TABLE t_purc WITH KEY ebeln = t_ekes_temp-ebeln
                                     ebelp = t_ekes_temp-ebelp.
          IF sy-subrc NE 0.
            CLEAR t_purc.
            SELECT SINGLE
                  eket~ebeln
                  eket~ebelp
                  eket~eindt
                  eket~menge
                  eket~charg
                  ekpo~matnr
                  ekpo~werks
                  ekpo~meins
                  ekko~lifnr
           INTO  CORRESPONDING FIELDS OF t_purc
          FROM
                   (  ( eket  INNER JOIN  ekko  ON
                    eketebeln = ekkoebeln )   INNER JOIN  ekpo  ON
                    eketebelp = ekpoebelp  AND
                    ekpoebeln = ekkoebeln )
        WHERE
                 eket~ebeln = t_ekes_temp-ebeln
          AND    eket~ebelp = t_ekes_temp-ebelp
          AND    ekpo~elikz NE c_x
          AND    ekko~bstyp EQ c_f
          AND    ekko~bsart NE c_zar.
            IF sy-subrc EQ 0.
              APPEND t_purc.
              CLEAR t_purc.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
      REFRESH: t_ekes_temp, t_ekes.
      CLEAR: t_ekes_temp, t_ekes.
    Once the header is filled up get the details from EKES
      SELECT ebeln ebelp  etens eindt menge dabmg vbeln vbelp
                         INTO TABLE t_ekes
                         FROM ekes
                         FOR ALL ENTRIES IN t_purc
                   WHERE ebeln EQ t_purc-ebeln.
    Mark the entries as 'X' which falls in the date range
      LOOP AT t_ekes.
        IF t_ekes-eindt IN s_date.
          t_ekes-mark = 'X'.
          MODIFY t_ekes INDEX sy-tabix TRANSPORTING mark.
        ENDIF.
      ENDLOOP.
      SORT t_ekes BY ebeln ebelp ASCENDING mark DESCENDING.
    Delete the entries from eket if no entries in EKES falls in the period
      LOOP AT t_purc.
        l_tabix = sy-tabix.
        READ TABLE t_ekes WITH KEY ebeln = t_purc-ebeln
                                   ebelp = t_purc-ebelp.
        IF sy-subrc EQ 0.
          IF t_ekes-mark NE 'X'.
            DELETE t_purc INDEX l_tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
    delete the entries from EKES which do not fall in the specified period
      DELETE t_ekes WHERE mark NE 'X'.
    ENDFORM.                    " f_select_ekes
    *&      Form  f_update_eket
          Routine to substitute relevant t_eket entries  with that of
          t_ekes entries.It does not modify the remaining entries for
          for which the corresponding values in t_ekes doesnot  exist.
    FORM f_update_eket.
      DATA: BEGIN OF lt_temp_eket OCCURS 0,
               ebeln LIKE eket-ebeln, "Purchasing Document Number
               ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
               eindt LIKE eket-eindt, "Item delivery date
               menge LIKE eket-menge, "Scheduled quantity
               dabmg LIKE ekes-dabmg,  " Delivered quantity
               matnr LIKE ekpo-matnr, "Material code
               maktx LIKE makt-maktx, "Material Description-- jp check
               etens LIKE ekes-etens, "Sequence Number
               meins LIKE ekpo-meins, "Unit of measure
               lifnr LIKE ekko-lifnr, "Vendor number
               charg LIKE eket-charg, " Batch number   Added by PD 08/08/03
               vbeln LIKE ekes-vbeln,
               vbelp LIKE ekes-vbelp,
            END OF lt_temp_eket,
            l_menge LIKE ekes-menge.
      LOOP AT t_eket.
        LOOP AT t_ekes WHERE ebeln = t_eket-ebeln
                        AND  ebelp = t_eket-ebelp.
    Added by PD 08/08/03
          MOVE t_eket-charg TO lt_temp_eket-charg.
    addition ends
          MOVE t_eket-ebeln TO lt_temp_eket-ebeln.
          MOVE t_eket-ebelp TO lt_temp_eket-ebelp.
          MOVE t_eket-meins TO lt_temp_eket-meins.
          CLEAR l_menge.
          l_menge = t_ekes-menge - t_ekes-dabmg.
          IF l_menge LE 0.
            CONTINUE.
          ELSE.
            MOVE l_menge TO lt_temp_eket-menge.
          ENDIF.
          MOVE t_ekes-eindt TO lt_temp_eket-eindt.
          MOVE t_ekes-etens TO lt_temp_eket-etens.
          MOVE t_eket-lifnr TO lt_temp_eket-lifnr.
          MOVE t_eket-maktx TO lt_temp_eket-maktx.
          MOVE t_eket-matnr TO lt_temp_eket-matnr.
          MOVE t_ekes-vbeln TO lt_temp_eket-vbeln.
          MOVE t_ekes-vbelp TO lt_temp_eket-vbelp.
          APPEND lt_temp_eket.
          CLEAR lt_temp_eket.
          CLEAR t_ekes.
        ENDLOOP.
        IF sy-subrc NE 0.
    Added by PD 08/08/03
          MOVE t_eket-charg TO lt_temp_eket-charg.
    addition ends
          MOVE t_eket-ebeln

    Dear
    Problem No 1 : we are working in a process industries with three plants each of them have three order type. we have define MRP group in "OPPR" then assign each MRP group to Orde types in "OPPE". Now the problem is whn i convert plan order in process order for any material systme automaticaly pick the order type PIi01.
    Answer :
    1.Please check the OPPR -Plant and MRP group -Select Order Type Button -Check what Order Type you have assinged here ( PI01( May be the default Process Order Type )
    2.If you are maintaing MRP group ( 0001 or 0002) , did you asisng the same in MRP1 view ?? because
    3.Did you maintain the similar Order type in OPKP -Define Production Scheduling Profile ? -This has highest priority .
    4.Did you maintain correct order type in OPJH-Maintain Order Type ??
    Refer the expert comments on the same issue : Strategy group to define production order type
    Problem No 2: 2nd Problem is system system is not creating plan order for prrevios dates. say i enter PIR for month of november from first november to 30th november and run MRP on 29th the sytem create plan order on 30th of november with exception message 30.
    Answer : You can plan the order in back dated , if you maitain Satrt date in the Past optiuon in OPU3/OPU5-Define Scheduling parameters .Goto OPU3 -Select the Order Type -Double click -Maintain 90-60 days in the Start Date in the past in Scheduling Control and Details scheduling tab .
    Hope it helps
    regards
    JH

  • Change in PO Price after goods receipts and goods issue

    Dear All,
    Happy Holidays!! Wishing you a happy and fun-filled holiday season.
    I would appreciate your input of the issue at hand. I support MM users in and Oil & Gas downstream company.
    Issue
    Purchase Orders are created using price estimates. The price of oil products fluctuates and we usually cannot get the exact price at the point of creation of the PO.
    We use Moving Average Price (MAP) for stock valuation and so the price & quantity in the PO affects the moving average price.
    We use price estimates to create the PO but when we receive the final price for the oil products from the Supplier, most times there is a significant difference between the estimated price and the final price. Usually, at this point, we have completed all goods receipts and goods issues against the PO and are unable to make changes.
    We have an issue posting the invoice because the invoice value is significantly higher than the PO value. We also have an issue with the moving average price because it is understated as a result of this.
    To reiterate, this is a summary of the issue:
    At the point if PO creation ; Quantity = 10, 000 MT Price = $650
    Later when final price is available; Quantity = 10, 000 MT Price = $715
    Any advise on how to treat this issue, please? Your assistance will be truly appreciated.
    Thanks

    Hi All
    For my client I have to map the similar requirement for material price which is subject to more than 15% fluctuation. The actual invoice price is having quite a huge difference.
    Below are my limitations within which need to give a solution.
    PO is subject to release strategy and Material is delivered over a longer duration of time. Hence there is problem to de-Release the PO everytime price is changed.
    Since differnce is so huge, the same can not be settled during the MIRO.
    Down Payments has to be posted hence PO has to be created with estimated base price.
    Please suggest me suitable alternative options which will require no changes in PO and the price change also can be accomodated during the MIRO for  Multiple goods receipts.

  • Purchase Req and Goods Receipt (ESS) question

    Hi,
    My client has ECC 6 and EP 7 in the landscape. I am implementing Employee Self Service portal. It looks like standard Purchasing Requisition and Goods Receipts iviews (ESS package) are pointing to SRM. We are not implementing SRM here. Is there any way I can use these iviews pointing to ECC (probably ME51n, MIGO?)?
    Do I have to have SRM in order to use these standard iviews? Is there any standard iviews available for ECC purchase requisition?
    If you implement Purchase Requisition using ECC instead of SRM, what is the licensing impact? Client has purchased the license for Employee Procurement Self Service.
    Another question is, Is there any standard iview for Travel & Expense approval? I don’t find it in MSS.
    Thanks,
    Umesh Garg

    HI Horny,
    Can you use the Following Tables:
    S039 - > LETZTABG - Date: last (i.e. most recent) goods issue
    EKPO -> EBELN - Purchasing Document Number.
    You can create View by using these two tables (Material Number is the Common) and uploade the data.
    Hope this will be helpful for your question.
    Thanks
    Rajesh
    Message was edited by:
            rajesh

  • Difference in GR price and goods issue price

    hi all,
    we are facing problem in difference in goodsrecipt price and goods issue price.
    material is maintained with moving average price.
    we do GR  (101) for full month and the last day we do goods issue for some quantities. (201 mvt type)
    while chekcing the material  price, goods issue price is less than the goods recipt price.( total value / total stock )
    what is the possibilities of the difference and where we can identify the changes.?
    price also not updated through MR21.
    regards,
    Vinay

    hi vinay,
    Please check the order prices for the material. Are you purchasing the material from a single vendor or multiple vendors? What is the price that you have maintained for each vendor in the info-records? If you have maintained different prices, the valuation of your material will keep changing with each GR since your material has price control V. During GR, the P.O. price is taken. During GI, the Moving Average price is taken from material master. When you do the goods issue at the end of the month, the Moving average price AT THAT POINT OF TIME  is taken for posting to the Consumption Account / Stock Account. Hence, you will have a difference in the GR / GI values. I suggest, after every GR, you go to MB03. Check the material document and the accounting document. Alongside, look at the Accounting View of the material and note the M.A. price. When you do the GI, note the M.A. price.
    Revert back if not clear.
    Regards,
    Rahul.

  • Post Goods Issue without reference to order

    Dear All
    We are using both Account and Costing Based COPA. We do post goods issue without reference to order. Now our problem is that at the time of post goods issue there is no Profit Analysis document posted in the system  and Profit Segment field is not modifiable. We have marked the field profit segment optional in movement type 601.
    Please let me know what can be the problem.
    Regards
    Farhan Qaiser

    Check the field status variant on GL (OBC4)

  • Purchase Req and Goods Receipt

    My client has ECC 6 and EP 7 in the landscape. I am implementing Employee Self Service portal. It looks like standard Purchasing Requisition and Goods Receipts iviews (ESS package) are pointing to SRM. We are not implementing SRM here. Is there any way I can use these iviews pointing to ECC (probably ME51n, MIGO?)?
    Do I have to have SRM in order to use these standard iviews? Is there any standard iviews available for ECC purchase requisition?
    If you implement Purchase Requisition using ECC instead of SRM, what is the licensing impact? Client has purchased the license for Employee Procurement Self Service.
    Another question is, Is there any standard iview for Travel & Expense approval? I don’t find it in MSS.

    ok

  • Problem with MIGO goods issue to a Service Order

    Hello All
    I have checked through out the forum as well as google and can not find the answer to my issue.  Please read the below details and advise....
    In MIGO; when trying to perform a goods issue to a service order (created in IW31) I get an error message the document does not contain any selectable items.  I can not get passed this.  When I use the transaction MB11, it works just fine.  I went to the allowed transactions in OMJJ to ensure MIGO was listed as an allowed transaction... and MIGO is listed so I know that is not my issue.  It is not related to the service order not being released as it is and plus if it was not released it would not work in MB11.  I need this to work for the transaction MIGO....Please someone guide me in the proper direction of what is missing.

    Hi Kimberly,
    When you post the goods issue as an unplanned goods movement against the order, the reservation is not even read, so it is never updated.
    The data that you enter manually in this unplanned goods issue does not even need to match with the data in the reservation: the material, the plant... evrything can be different. The order is just a CO Account Assignment in this case and the reservation is not processed in any moment. This way, it is not possible to close the reservation when posting this kind of unplanned goods issue, as the reservation is not even considered (and, therefore, never updated).
    It is only when you post the planned goods issue referencing the order directly when you really post your goods issue with reference to the reservation behind the order. Only in this case is when the data in the posting is checked against the reservation (the material, the plant, etc cannot be changed because they are taken directly from the reservation). Also, it is only in this case when the quantity in the posting is checked against the quantity in the reservation. If we issue the total reserved quantity, the reservation is closed automatically.
    In the first case for the unplanned goods issue there is never an automatic update of the reservation because the posting does not even consider the reservation. It is only when you post the goods movement with reference to the order (in MB1A using "To Order..." and in MIGO "Goods Issue + Order") when the reservation is taken into account in the goods movement and, therefore, updated.
    You can also refer to the SAP Library:
    [http://help.sap.com/saphelp_erp2005/helpdata/en/a5/6337db43a211d189410000e829fbbd/frameset.htm]
    It says:
    "This withdrawal is unplanned because there is no reservation to be referenced."
    An unplanned goods issue with the movement 261 and the order (working as CO account assignment object) is more or less the same as a 201 for a cost center. The cost center and the order are just CO Objects in this scenario.
    I hope this helps you further!
    Best regards,
    Esther.

  • BAPI or FM to get material goods issue for a prod order

    Hi
    I need a FM to get the material goods issue for a prod order. Please let me know.
    Thanks and regards
    Harish

    Hi Harish,
    use FM <b>BAPI_GOODSMVT_CREATE.</b>
    have a look at this thread ..
    FM for good issue for production order
    Regards,
    Santosh

Maybe you are looking for

  • How do I disable podcasts and genius on iPhone 4s?

    How do I disable podcasts and genius on iPhone 4s? I find them annoying?

  • Question on implementing a Berkeley DB Java Edition solution

    Hi, I am trying to assess if Berkeley DB JE is the solution to my problem. I have couple RDBMS tables that stores user security Groups and Resource relationship recursively in a tree data structure. I have an online security api for online applicatio

  • The folks at Bose and a few other Iphone 4 users helped me figure this out!

    The Iphone 4 will work with the Bose Sound Dock, if you remove the little plastic cradle in the Bose dock.  The cradle looks like it is part of the dock.  It is not black like some other docks.  Tug gently with small plyers and it lifts up.  My Iphon

  • Custom fields in PO

    Hi, i have to add custom fields in item data of PO. I have done this MM06E005. I have created the fields in CI_EKPODB. I have created the screen containing the fields and have written the logic in EXIT_SAPMM06E_016 for exporting data to subscreen and

  • ITunes Errors...Unable to Update or Sync iPad,iPod

    This user is running iTunes on HP Laptop which is about 10 years old, which is runnig a recently reinstalled Windows XP and is also running Avira anti-virus software all are up-to-date. After 2/3 hours download time trying to update iTunes IT FAILED.