LIFO method

Hello to everyone,
I need to solve a quite difficult problem, at least from my point of view :). I was given 3 tables (Entries, Consumptions, Entries_Consumptions) and I am supposed to update the Entries_Consumptions table and the Entries.LeftQuantity field according to the LIFO (Last Input - First Output) method from accounting using a trigger and eventually other functions or procedures used by the trigger. I have tried many ways and cannot find a solution for the above problem. Below is the script for the tables and also some input values.
drop table entries;
drop table consumptions;
drop table entries_consumptions;
create table entries (
IDEntry number(4)
constraint pk_entries primary key
constraint nn_entries not null,
DateEntry date,
MaterialCode number(4),
EntryQuantity number(4),
Price number(5),
LeftQuantity number(4)
create table consumptions (
IDConsumption number(4)
constraint pk_consumptions primary key
constraint nn_consumptions not null,
DateConsumption date,
MaterialCode number(4),
ConsumptionQuantity number(4)
create table Entries_Consumptions (
IDConsumption number(4),
MaterialCode number(4),
IDEntry number(4),
CorespondentQuantity number(5),
Price number(4),
constraint pk_Entries_Consumption primary key (IDConsumption, MaterialCode, IDEntry)
insert into entries values ('1000','01/12/2009','002','40','30','');
insert into entries values ('1001','10/12/2009','002','60','31','');
insert into entries values ('1002','15/12/2009','002','10','32','');
insert into entries values ('1003','21/12/2009','002','25','32','');
insert into entries values ('1004','27/12/2009','002','30','34','');
insert into consumptions values ('301','12/12/2009','002','50');
insert into consumptions values ('302','20/12/2009','002','30');
insert into consumptions values ('303','25/12/2009','002','10');
insert into consumptions values ('304','28/12/2009','002','35');
I'm asking for help to find a solution for this problem. Any suggestion will be highly appreciated.
Thank you,
Andrew.

http://blog.accountingcoach.com/lifo-fifo/

Similar Messages

  • Batch Management and Class and Characteristics Assignment

    Dear Team,
    Recently We Configured Batch Management in SD, and Batch is determining in Sales order, delivery and Billing. Its working fine.
    Issue-1: While posting stock (Quality server) with moment type 561, production date entered manually but system not calculating Expiry date automatically, i maintained Total shelf Time and Min. Rem. Shelf time.
    Issue-2: In sales order I want determine batch as FIFO Method, in present system it will consider LIFO method,
    I come to know to over come this Issues i need to maintain some Characteristics and Class, Please help me out in creating of characteristics and class and other process,
    Thanking you in advance,
    Sudheer.U

    Dear Team,
    Recently We Configured Batch Management in SD, and Batch is determining in Sales order, delivery and Billing. Its working fine.
    Issue-1: While posting stock (Quality server) with moment type 561, production date entered manually but system not calculating Expiry date automatically, i maintained Total shelf Time and Min. Rem. Shelf time.
    Issue-2: In sales order I want determine batch as FIFO Method, in present system it will consider LIFO method,
    I come to know to over come this Issues i need to maintain some Characteristics and Class, Please help me out in creating of characteristics and class and other process,
    Thanking you in advance,
    Sudheer.U

  • CIN issue Sales from Factory

    Hi Guys
    I have been encountering the problem while creating Excise Invoice for Factory Sales, only BED condition type is calculated and reflected in excise invoice J1IIN, whereas all the conition types releated with excise are comming in customer invoice
    those are,
    JEXP
    JEAP
    JESP
    JEXT
    JCET
    with the correct total, can anybody help in this matter, i have been trying this for quite a long time, but could not solve the same, i tryed the suggestions posted in sdn for CIN, checked everything, but still not able to process
    Kindly help

    Hi
    I am facing problem with V_V2,
    I have checked the delivery priorities of customer/order, but still system is confirming the sales order LIFO method, whereas it should confirm the order which is first in line. there is no delivery priority for sales order entered
    1st order: enter date/doc date/schd. line date= old dates
    delivery priority=blank
    2nd order:enter date/doc date/schd. line date= new dates
    delivery priority=blank
    The 2nd order is porcessed first?
    and in V_V2, following is the set up we are using are mentioned below, rest are blank/not selected
    Plant-Yes
    -Process sales doc-Yes
    -Process stock transfer docs-At schdulie line- [only radio button selected, without check box selection]
    -Document category-Prioritize sales documents-[only radio button selected, without check box selection]
    -Delivery priority-1
    -Date-Sort item by date of creation-[only radio button selected]
    rest are blank.
    In this case the 2nd order is processed first and confirmed, where as 1st order is not rescheduled at all?
    Could not understand the system behaviour/logic.
    require you help in this.
    Regards,
    Nikhil

  • Query regarding Onhand Quantity

    Hello,
    I am new to manufacturing modules and I need some help.
    I have a requirement in inventory where I need to get the list of items,
    - if the qty on hand falls below a certain qty level in a sub-inventory.
    - I also need to identify the date on which it happened.
    Ex: if item# 12345 in sub-inventory “STOCKROOM” falls below 500, then I need to identify the date on which it happened.
    Any help in resolve this issue is highly appreciated.
    TIA
    KP

    Intresting ...
    An attempt, not sure if you like it
    The mtl_onhand_quantities_detail keeps track of the qty by means of logging into this
    table all new transactions that bring in qty and any decrement to qty is updated to the records
    by updating the earlier record and moving down as needed(lifo method)
    There is a create_transaction_id and update_transaction_id(decrementing trxn), but realy the
    update_transaction_id is the most recent decrement transaction prior transaction id's are not stored.
    I think you would start as
    select inventory_item_id, sum(transaction_qty) from mtl_onhand_quantities_detail
    you can restrict this further by org/subinv etc.
    Lets say you do not want to do any special logic for items that are over 500 qty, nothing
    is needed but for anything that is below 500 you would want to invoke something that may have logic
    like below.
    Lets say I got a record 400 qty for an item, this is what I would do
    400 As of sysdate(report run date)
    You list all transactions in descending order of occurence for the item/org
    that is the most recent transaction comes in the list first(mtl_material_transactions)
    Take the current qty in a variable say v_qty
    {Trxqty} { change_vqty_by} { QOH_Before_This_Trxn(revised v_qty)}
    {-10} {+10} { 410}
    {+5} {  -5} { 405}
    {+20} { -20} { 385}
    {-200} {+200} {585}
    (You stop on this record as this is more than 500, that
    means the prior record is where your qoh got negative and provide that trx date)
    Assuming this report is run bi-weekly/monthly you may just restrict looking back past transactions only
    to that extent.
    Try it out and if there is a better way/ the way you handled it please update for reference.

  • Valuation Inventory

    Hi Everybody:
    I have a issue in a Valuation Inventory.
    My client needs to do a valuation for his inventories under LIFO method, but physically the movements of this stock are in FIFO.
    What can i do, for get this kind of valuation for the inventory?
    I'm using Variable Cost for the price control for this inventory.
    I did this query in the forum of MM, and tell me that contact an FI
    I appreciate the support.
    Omar Perea

    Hi
    Physical movement is not concerned with what valuation principles you adopt. LIFO valuation is more conservative and probably acceptable in accounting standards in cases where prices are raising rapidly. Reverse is the case in case of price falling rapidly. So the best option is to use LIFO when prices are raising and use FIFO when prices are falling in order to conform to more conservative valuation. The reason being you always value based on the value at which you procured your oldest stock.
    Jayaram

  • Costing Qustionare

    Dear All,
    Any Template questions on controlling (cost center accounting and Product costing) that needs to ask client for a implementation?
    Regards,
    Rupesh Kumar Singh

    HI Phanibr,
    This cost System calculate on FIFO or LIFO method which got assign by MM team according to client requirement.
    I will give you the scenario for Pharma with the same things.
    If i have order as you suggested, in pharma co. there is a Expiry of the RM hence its always organise with FIFO method. here system takes the values according to procurement of the material.
    System automatically take the values from the table which input details system have while procuring the material.
    Regards
    Milind Joshi

  • MM - Accounting and Costing views

    Hi
    Currently I'm working on the Accounting, Costing views on material master record. Can anyone please let me know how can these views created and updated(with prices).
    Your inputs are appreciated.
    Thanks

    Currently I'm working on the Accounting, Costing views on material master record. Can anyone please let me know how can these views created and updated(with prices).
    Your inputs are appreciated.
    Your requirement seems more generic,
    First of all  setting for Accounting view 1 & 2  and Costing 1 & 2 view comes default while creating material for a specific material type comes from OMS2 ( Transaction code) setting
    In Accounting view 1 :
    Base unit of measure will populate from Basic data view .
    Valuation Category field is applicable , if your material is Split valuation is active.
    You can get Valuation class by putting F4,  for ROH 3000, for HALB 7900, for FERT 7920.
    Based on selection Moving average(V) / Standard Price(S) will come.
    Price unit based on your requirement it will come. Based on input value for material it will show, or else  system will automatically once GR done ( either Mov. type 101 / 561)
    Diferent field also update through FIFO /LIFO method applied. or Material ledger active, Or if profit center based acconting.
    Do understand all by F1 first, it wll be bit useful.

  • LinkedList remove

    I am having problem removing data from the linked list.
    My source code is
    public class Foo{
        private LinkedList mList = new LinkedList();
         * Adds data to the list
        public void setData(FooBean foo){
               //add data to the list
         * returns data from the list(LIFO method)
        public FooBean getData(){
               //remove first data and return
        * removes message from the list
    //I am having problem in this method
         public void removeData(){
              for(int i = 0; i < mList.size(); i++){
                     FooBean foo = (FooBean)mList.get(i);
                     if(foo.getXXX()){
                             mList.remove(i);   //removes the messages and the list size is decreased by 1.
         }When i do the above method, it gives me ArrayIndexOutofBoundException because
    when the message is removed the size of the
    list is also decreased.
    I tried, setting i back to '0' after removing the message,
    but it starts again from the top.
    So i tried using i-- and so far im not getting any error
    messages. Is this a good way to achieve, what i am trying to do
    or is there any good method to do that?
    Thanx in advance

    The follwing code may help you.
    import java.util.*;
    public class LinkedListDemo {
         public static void main(String []args)
    LinkedList<Integer> list=new
    ew LinkedList<Integer>();
              list.add(20);
              list.add(7);
              list.add(11);
              list.add(54);
              list.add(89);
              list.add(98);
              list.add(77);
              list.add(32);
              list.add(67);
              list.add(26);
              list.add(3,101);
              System.out.println("Size of list: "+list.size());
              System.out.println("Contents of list: "+list);
              list.remove(5);
              list.remove(1);
              System.out.println("Size of list: "+list.size());
    System.out.println("Contents of list after
    er deletion: "+list);
              list.removeFirst();
              list.removeLast();
    System.out.println("list size after delete first
    st and last element: "+list.size());
    System.out.println("list after delete first & last
    st elements: "+list);
              Integer ival=list.get(0);
              list.set(6,ival);
              System.out.println("list after change: "+list);
    Whatever you are talking about there makes no sense to my real question.
    I know how to remove from a list and i dont even need to use the Interface List for that. LinkedList has implemented that method too.
    Removing from a list is easy, but my case is remvoing inside a loop.
    I think you didnt even try to read my question.

  • Inventory level

    hi all
    i would like to know about what is inventory level and how is it calculated and also i want to know the value of left over stock in the plant
    thanks ll

    Dear krishna
    Following are inventory calculation methods
    1)  Moving Average
    SAP Business One valuates your inventories with the moving average price on an ongoing basis. This means a valuation takes place based on the corresponding quantities and prices for each goods receipt and issue, and the moving average price is updated accordingly.
    The valuation price is calculated as the quantity multiplied by the average price. Assuming prices will increase over time, the items in stock will be overvalued. This gain is not as high as under the FIFO method, but greater than under the LIFO method.
    2)  FIFO
    Under this valuation method, the system assumes that the items that entered the warehouse first will also exit first. This means goods issues are valuated with the prices that are valid for the first goods receipts. For example, if you purchase an item at three different prices on three different occasions, the system assumes that the first items you sell are from the first delivery. This means the prices from the first purchase order are used for the sale and calculation of the corresponding gross profit, until the quantity from the first purchase document is gone. At this point, the system uses the price for the items from the second purchase order.
    Assuming prices will increase over time, the items in stock will be valuated using the higher prices from the later purchase documents.
    3)  LIFO
    Under this valuation method, the system assumes that the items that were received last will exit the warehouse first. If you purchase an item at three different prices on three different occasions, the items that were purchased last will be sold first.
    Assuming prices will increase over time for the three purchase documents, the quantity in stock will be valuated with the lower prices from the first purchase document. Therefore, the value of the inventory will be lower than under the FIFO method.
    4)  By Price List
    You can use one of the price lists defined in the system to valuate the warehouse inventories. When you choose this method, the system displays an additional field that contains a list of the price lists defined in the system. Click the dropdown icon on the right of the field and choose the entry you require from the list provided.
    The system then uses the prices defined for the items in the price list.
    5)  Last Evaluated Price
    You can also perform the valuation based on the last evaluated prices. In this case, the system uses the last calculated costs for each item. If you run a valuation under the FIFO method, for example, and then run a valuation for the last calculated costs, the system will valuate the items using the last value that was determined for an item under the FIFO method.
    To see the stock details, you can run MMBE / MB5B
    thanks
    G. Lakshmipathi

  • Storage location Data is not saving in table MARD using BAPI method.

    Hi Experts,
    TABLES: T001L, "Storage Locations
            MARA,  "General Material Data
            MAKT,  "Material Descriptions
            MBEW,  "Material Valuation
            MARC,  "Plant Data for Material
            MARD.  "Storage Location Data for Mate
    DATA: BAPI_HEAD   LIKE BAPIMATHEAD,  "MATERIAL
          BAPI_MAKT   LIKE BAPI_MAKT,    "Material Description
          BAPI_MARA1  LIKE BAPI_MARA,    "Client Data
          BAPI_MARAX  LIKE BAPI_MARAX,
          BAPI_MARC1  LIKE BAPI_MARC,    "Plant View
          BAPI_MARCX  LIKE BAPI_MARCX,
          BAPI_MBEW1  LIKE BAPI_MBEW,    "Accounting View
          BAPI_MBEWX  LIKE BAPI_MBEWX,
          BAPI_MARD1  LIKE BAPI_MARD,    "Storage location
          BAPI_MARDX  LIKE BAPI_MARDX,
          BAPI_RETURN LIKE BAPIRET2.
    DATA: BEGIN OF INT_MAKT OCCURS 100.
            INCLUDE STRUCTURE BAPI_MAKT.
    DATA: END OF INT_MAKT.
    DATA: BEGIN OF INT_MAT OCCURS 100,
             WERKS(4),     "Plant
             LGORT(4),     "Storage location
             MTART(4),     "Material type
             MATNR(18),    "Material number
             MAKTX(40),     "Material description
             MATKL(9) ,    "Material group
             MBRSH(1),     "Industry sector
             MEINS(3),     "Base unit of measure
             GEWEI(3),     "Weight Unit
             SPART(2),     "Division
             EKGRP(3),     "Purchasing group
             VPRSV(1),     "Price control indicator
             STPRS(12),    "Standard price
             PEINH(3),     "Price unit
             SPRAS(2),     "Language key
             BKLAS(4),     "VALUATION CLASS
             VERPR TYPE VERPR_BAPI,    "MOVING PRICE
             BWTTY(1),     "Valuation Catogory
             MLAST(1),     "Price determination
             MLMAA(1),     "Material Ledger
             EKLAS(4),     "Valuation Class for sales order stock
             QKLAS(4),     "Valuation Class for Project Stock
             ZKPRS TYPE DZKPRS, "Future price
             ZKDAT TYPE DZKDAT, "Valid From Date
             BWPRS TYPE BWPRS,  "Tax price 1
             BWPS1 TYPE BWPS1,  "Tax price 2
             VJBWS TYPE VJBWS,  "Tax price 3
             ABWKZ TYPE ABWKZ,  "Devaluatin indicator
             BWPRH TYPE BWPRH,  "Commercial price 1
             BWPH1 TYPE BWPH1,  "Commercial price 2
             VJBWH TYPE VJBWH,  "Commercial Price 3
             XLIFO(1),          "LIFO/FIFO revelant
             MYPOL(4),          "Pool no for LIFO
             MMSTA(2),          "Plant specific material status
             AUSME TYPE AUSME,  "Unit of issue
             QMATA(6),          "Material Authorization group
             RBNRM(9),          "Catalog Profile
             WEBAZ TYPE WEBAZ,  "Goods reciept processing time in days
             PRFRQ TYPE PRFRQ,  "Recurring Insepction
             SSQSS(8),          "QM Control key
             QZGTP(4),          "Certificate Type
             QSSYS(4),          "Required QM system for vendor
           END OF INT_MAT.
    DATA: V_MATNR TYPE MARA-MATNR.
    SELECT-OPTIONS:
                PLANT    FOR  MARC-WERKS OBLIGATORY MEMORY ID PLT,
                S_LGORT  FOR  MARD-LGORT MEMORY ID STL,
                MATERIAL FOR  MARA-MATNR MEMORY ID MAT,
                MATLTYPE FOR  MARA-MTART MEMORY ID MTY,
                DIVISION FOR  MARA-SPART MEMORY ID DIV.
    PARAMETERS:  F_FILE LIKE RLGRAP-FILENAME
                 DEFAULT 'C:\DATA\ZMATERIAL.XLS' MEMORY ID F_FILE,
    GETDATA AS CHECKBOX, "Tick to download materials data to local harddisk
             UPDDATA AS CHECKBOX. "Tick to update date to Materials Master
    IF GETDATA = 'X'.
       PERFORM DOWNLOAD_DATA.
       PERFORM DOWNLOAD_FILE.
    ENDIF.
    IF UPDDATA = 'X'.
       PERFORM UPLOAD_FILE.
       PERFORM UPDATE_MM.
    ENDIF.
    FORM DOWNLOAD_DATA.
    SELECT * FROM MARC  WHERE LVORM EQ ' '
                          AND WERKS IN PLANT
                          AND MATNR IN MATERIAL.
        CLEAR MARA.
        SELECT SINGLE * FROM MARA WHERE MATNR =  MARC-MATNR.
        CHECK MATLTYPE.
        CHECK DIVISION.
        CLEAR MBEW.
        SELECT SINGLE * FROM MBEW WHERE MATNR =  MARC-MATNR
                                    AND BWKEY =  MARC-WERKS.
        CLEAR MAKT.
        SELECT SINGLE * FROM MAKT WHERE SPRAS =  'EN'
                                    AND MATNR =  MARC-MATNR.
        CLEAR MARD.
        SELECT SINGLE * FROM MARD WHERE WERKS IN PLANT
                                  AND   LGORT IN S_LGORT.
        WRITE:/ MARC-WERKS,    "Plant
                MARD-LGORT,    "Storage location
                MARA-MTART,    "Material type
                MARA-MATNR,    "Material number
                MARA-MATKL,    "Material group
                MARA-MBRSH,    "Industry sector
                MARA-MEINS,    "Base unit of measure
                MARA-GEWEI,    "Weight Unit
                MARA-SPART,    "Division
                MARC-EKGRP,    "Purchasing group
                MBEW-VPRSV,    "Price control indicator
                MBEW-STPRS,    "Standard price
                MBEW-PEINH,    "Price unit
                MBEW-BKLAS,    "VALUE CLASS
                MAKT-SPRAS,    "Language key
                MBEW-BKLAS,    "Valuation Class
                MBEW-VERPR,    "Moving price
                MAKT-MAKTX,    "Material description
                MBEW-BWTTY,    "Valutaion Catogorey
                MBEW-MLAST,    "Price Determination
                MBEW-MLMAA,    "Material Ledger
                MBEW-EKLAS,    "Valuation class for Sales order stock
                MBEW-QKLAS,    "Valutaion Class for Project Stock
                MBEW-ZKPRS,    "Future Price
                MBEW-ZKDAT,    "Valid From Date
                MBEW-BWPRS,    "Tax price 1
                MBEW-BWPS1,    "Tax price 2
                MBEW-VJBWS,    "Tax price 3
                MBEW-ABWKZ,    "Devaluatin indicator
                MBEW-BWPRH,    "Commercial price 1
                MBEW-BWPH1,    "Commercial price 2
                MBEW-VJBWH,    "Commercial Price 3
                MBEW-XLIFO,    "LIFO/FIFO revelant
                MBEW-MYPOL,    "Pool no for LIFO
                MARC-MMSTA,    "Plant specific material status
                MARC-AUSME,    "Unit of issue
                MARC-QMATA,    "Material Authorization group
                MARA-RBNRM,    "Catalog Profile
                MARC-WEBAZ,    "Goods reciept processing time in days
                MARC-PRFRQ,    "Recurring Insepction
                MARC-SSQSS,    "QM Control key
                MARC-QZGTP,    "Certificate Type
                MARC-QSSYS.    "Required QM system for vendor
                INT_MAT-WERKS = MARC-WERKS.    "Plant
                INT_MAT-LGORT = MARD-LGORT.    "Storage Location
                INT_MAT-MTART = MARA-MTART.    "Material type
                INT_MAT-MATNR = MARA-MATNR.    "Material number
                INT_MAT-MAKTX = MAKT-MAKTX.    "Material description
                INT_MAT-MATKL = MARA-MATKL.    "Material group
                INT_MAT-MBRSH = MARA-MBRSH.    "Industry sector
                INT_MAT-MEINS = MARA-MEINS.    "Base unit of measure
                INT_MAT-GEWEI = MARA-GEWEI.    "Weight Unit
                INT_MAT-SPART = MARA-SPART.    "Division
                INT_MAT-EKGRP = MARC-EKGRP.    "Purchasing group
                INT_MAT-VPRSV = MBEW-VPRSV.    "Price control indicator
                INT_MAT-STPRS = MBEW-STPRS.    "Standard price
                INT_MAT-PEINH = MBEW-PEINH.    "Price unit
                INT_MAT-SPRAS = MAKT-SPRAS.    "Language key
                INT_MAT-BKLAS = MBEW-BKLAS.    "VALVATION CLASS
                INT_MAT-VERPR = MBEW-VERPR.    "MOVING price
                INT_MAT-BWTTY = MBEW-BWTTY.    "Valutaion Catogorey
                INT_MAT-MLAST = MBEW-MLAST.    "Price Determination
                INT_MAT-MLMAA = MBEW-MLMAA.    "Material Ledger
                INT_MAT-EKLAS = MBEW-EKLAS.    "Valuation class forS.O Stock
                INT_MAT-QKLAS = MBEW-QKLAS.    "Valutaion Class for Project
                INT_MAT-ZKPRS = MBEW-ZKPRS.    "Future Price
                INT_MAT-ZKDAT = MBEW-ZKDAT.    "Valid From Date
                INT_MAT-BWPRS = MBEW-BWPRS.    "Tax price 1
                INT_MAT-BWPS1 = MBEW-BWPS1.    "Tax price 2
                INT_MAT-VJBWS = MBEW-VJBWS.    "Tax price 3
                INT_MAT-ABWKZ = MBEW-ABWKZ.    "Devaluatin indicator
                INT_MAT-BWPRH = MBEW-BWPRH.    "Commercial price 1
                INT_MAT-BWPH1 = MBEW-BWPH1.    "Commercial price 2
                INT_MAT-VJBWH = MBEW-VJBWH.    "Commercial Price 3
                INT_MAT-XLIFO = MBEW-XLIFO.    "LIFO/FIFO revelant
                INT_MAT-MYPOL = MBEW-MYPOL.    "Pool no for LIFO
                INT_MAT-MMSTA = MARC-MMSTA.    "Plant specific material
                INT_MAT-AUSME = MARC-AUSME.    "Unit of issue
                INT_MAT-QMATA = MARC-QMATA.    "Material Authorization group
                INT_MAT-RBNRM = MARA-RBNRM.    "Catalog Profile
                INT_MAT-WEBAZ = MARC-WEBAZ.    "Goods reciept processing
                INT_MAT-PRFRQ = MARC-PRFRQ.    "Recurring Insepction
                INT_MAT-SSQSS = MARC-SSQSS.    "QM Control key
                INT_MAT-QZGTP = MARC-QZGTP.    "Certificate Type
                INT_MAT-QSSYS = MARC-QSSYS.    "Required QM system for
                APPEND INT_MAT.
                CLEAR  INT_MAT.
    ENDSELECT.
    ENDFORM.
    FORM DOWNLOAD_FILE.
    call function 'WS_DOWNLOAD'
      EXPORTING
        FILENAME                      = F_FILE
        FILETYPE                      = 'DAT'
      FILETYPE                      = 'WK1'
      tables
        data_tab                      = INT_MAT
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_WRITE_ERROR              = 2
        INVALID_FILESIZE              = 3
        INVALID_TYPE                  = 4
        NO_BATCH                      = 5
        UNKNOWN_ERROR                 = 6
        INVALID_TABLE_WIDTH           = 7
        GUI_REFUSE_FILETRANSFER       = 8
        CUSTOMER_ERROR                = 9
        OTHERS                        = 10.
    IF SY-SUBRC = 0.
       FORMAT COLOR COL_GROUP.
       WRITE:/ 'Data Download Successfully to your local harddisk'.
       SKIP.
    ENDIF.
    ENDFORM.
    FORM UPLOAD_FILE.
    call function 'WS_UPLOAD'
      EXPORTING
        FILENAME                      = F_FILE
        FILETYPE                      = 'DAT'
      FILETYPE                      = 'WK1'
      tables
        data_tab                      = INT_MAT
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_WRITE_ERROR              = 2
        INVALID_FILESIZE              = 3
        INVALID_TYPE                  = 4
        NO_BATCH                      = 5
        UNKNOWN_ERROR                 = 6
        INVALID_TABLE_WIDTH           = 7
        GUI_REFUSE_FILETRANSFER       = 8
        CUSTOMER_ERROR                = 9
        OTHERS                        = 10.
    IF SY-SUBRC = 0.
       FORMAT COLOR COL_GROUP.
       WRITE:/ 'Data Upload Successfully from your local harddisk'.
       SKIP.
    ENDIF.
    ENDFORM.
    FORM UPDATE_MM.
    LOOP AT INT_MAT.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        INPUT              = INT_MAT-MATNR
    IMPORTING
       OUTPUT             = INT_MAT-MATNR
    EXCEPTIONS
      LENGTH_ERROR       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Header
        BAPI_HEAD-MATERIAL        = INT_MAT-MATNR.
        BAPI_HEAD-IND_SECTOR      = INT_MAT-MBRSH.
        BAPI_HEAD-MATL_TYPE       = INT_MAT-MTART.
        BAPI_HEAD-BASIC_VIEW      = 'X'.
        BAPI_HEAD-PURCHASE_VIEW   = 'X'.
        BAPI_HEAD-ACCOUNT_VIEW    = 'X'.
    Material Description
        REFRESH INT_MAKT.
        INT_MAKT-LANGU           = INT_MAT-SPRAS.
        INT_MAKT-MATL_DESC       = INT_MAT-MAKTX.
        APPEND INT_MAKT.
    Client Data - Basic
        BAPI_MARA1-MATL_GROUP     = INT_MAT-MATKL.
        BAPI_MARA1-BASE_UOM       = INT_MAT-MEINS.
        BAPI_MARA1-UNIT_OF_WT     = INT_MAT-GEWEI.
        BAPI_MARA1-DIVISION       = INT_MAT-SPART.
        BAPI_MARAX-MATL_GROUP = 'X'.
        BAPI_MARAX-BASE_UOM   = 'X'.
        BAPI_MARAX-UNIT_OF_WT = 'X'.
        BAPI_MARAX-DIVISION   = 'X'.
    Plant - Purchasing
        BAPI_MARC1-PLANT      = INT_MAT-WERKS.
        BAPI_MARC1-PUR_GROUP  = INT_MAT-EKGRP.
        BAPI_MARC1-PUR_STATUS = INT_MAT-MMSTA.
        BAPI_MARC1-ISSUE_UNIT = INT_MAT-AUSME.
        BAPI_MARC1-QM_AUTHGRP = INT_MAT-QMATA.
        BAPI_MARC1-GR_PR_TIME = INT_MAT-WEBAZ.
        BAPI_MARC1-INSP_INT   = INT_MAT-PRFRQ.
        BAPI_MARC1-CTRL_KEY   = INT_MAT-SSQSS.
        BAPI_MARC1-CERT_TYPE  = INT_MAT-QZGTP.
        BAPI_MARC1-QM_RGMTS   = INT_MAT-QSSYS.
        BAPI_MARCX-PLANT      = INT_MAT-WERKS.
        BAPI_MARCX-PUR_GROUP  = 'X'.
        BAPI_MARCX-PUR_STATUS = 'X'.
        BAPI_MARCX-ISSUE_UNIT = 'X'.
        BAPI_MARCX-QM_AUTHGRP = 'X'.
        BAPI_MARCX-GR_PR_TIME = 'X'.
        BAPI_MARCX-INSP_INT   = 'X'.
        BAPI_MARCX-CTRL_KEY   = 'X'.
        BAPI_MARCX-CERT_TYPE  = 'X'.
        BAPI_MARCX-QM_RGMTS   = 'X'.
    Accounting 1
        BAPI_MBEW1-VAL_AREA      = INT_MAT-WERKS.
        BAPI_MBEW1-PRICE_CTRL    = INT_MAT-VPRSV.
        BAPI_MBEW1-STD_PRICE     = INT_MAT-STPRS.
        BAPI_MBEW1-PRICE_UNIT    = INT_MAT-PEINH.
        BAPI_MBEW1-MOVING_PR     = INT_MAT-VERPR.
        BAPI_MBEW1-VAL_CLASS     = INT_MAT-BKLAS.
        BAPI_MBEW1-VAL_CAT       = INT_MAT-BWTTY.
        BAPI_MBEW1-ML_SETTLE     = INT_MAT-MLAST.
        BAPI_MBEW1-ML_ACTIVE     = INT_MAT-MLMAA.
        BAPI_MBEW1-VM_SO_STK     = INT_MAT-EKLAS.
        BAPI_MBEW1-VM_P_STOCK    = INT_MAT-QKLAS.
        BAPI_MBEW1-FUTURE_PR     = INT_MAT-ZKPRS.
        BAPI_MBEW1-VALID_FROM    = INT_MAT-ZKDAT.
    *ACCOUNTING 2
       BAPI_MBEW1-TAXPRICE_1    = INT_MAT-BWPRS.
       BAPI_MBEW1-TAXPRICE_2    = INT_MAT-BWPS1.
       BAPI_MBEW1-TAXPRICE_3    = INT_MAT-VJBWS.
       BAPI_MBEW1-DEVAL_IND     = INT_MAT-ABWKZ.
       BAPI_MBEW1-COMMPRICE1    = INT_MAT-BWPRH.
       BAPI_MBEW1-COMMPRICE2    = INT_MAT-BWPH1.
       BAPI_MBEW1-COMMPRICE3    = INT_MAT-VJBWH.
       BAPI_MBEW1-LIFO_FIFO     = INT_MAT-XLIFO.
       BAPI_MBEW1-POOLNUMBER    = INT_MAT-MYPOL.
        BAPI_MBEWX-VAL_AREA   = INT_MAT-WERKS.
        BAPI_MBEWX-PRICE_CTRL = 'X'.
        BAPI_MBEWX-STD_PRICE  = 'X'.
        BAPI_MBEWX-PRICE_UNIT = 'X'.
        BAPI_MBEWX-MOVING_PR =  'X'.
        BAPI_MBEWX-VAL_CLASS =  'X'.
        BAPI_MBEWX-VAL_CAT       = 'x'.
        BAPI_MBEWX-ML_SETTLE     = 'X'.
        BAPI_MBEWX-ML_ACTIVE     = 'X'.
        BAPI_MBEWX-VM_SO_STK     = 'X'.
        BAPI_MBEWX-VM_P_STOCK    = 'X'.
        BAPI_MBEWX-FUTURE_PR     = 'X'.
        BAPI_MBEWX-VALID_FROM    = 'X'.
       BAPI_MBEWX-TAXPRICE_1    = 'X'.
       BAPI_MBEWX-TAXPRICE_2    = 'X'.
       BAPI_MBEWX-TAXPRICE_3    = 'X'.
       BAPI_MBEWX-DEVAL_IND     = 'X'.
       BAPI_MBEWX-COMMPRICE1    = 'X'.
       BAPI_MBEWX-COMMPRICE2    = 'X'.
       BAPI_MBEWX-COMMPRICE3    = 'X'.
       BAPI_MBEWX-LIFO_FIFO     = 'X'.
       BAPI_MBEWX-POOLNUMBER    = 'X'.
    *Storage Locations
        BAPI_MARD1-PLANT      = INT_MAT-WERKS.
        BAPI_MARD1-STGE_LOC   = INT_MAT-LGORT.
        BAPI_MARDX-PLANT      = INT_MAT-WERKS.
        BAPI_MARDX-STGE_LOC   = INT_MAT-LGORT.
       WRITE:/ BAPI_HEAD-MATERIAL, BAPI_MARC1-PLANT ,BAPI_MARD1-STGE_LOC.
        call function 'BAPI_MATERIAL_SAVEDATA'
          exporting
            HEADDATA                   = BAPI_HEAD
            CLIENTDATA                 = BAPI_MARA1
            CLIENTDATAX                = BAPI_MARAX
            PLANTDATA                  = BAPI_MARC1
            PLANTDATAX                 = BAPI_MARCX
          FORECASTPARAMETERS         =
          FORECASTPARAMETERSX        =
          PLANNINGDATA               =
          PLANNINGDATAX              =
    <b>      STORAGELOCATIONDATA        =  BAPI_MARD1
           STORAGELOCATIONDATAX       =  BAPI_MARDX</b>
            VALUATIONDATA              = BAPI_MBEW1
            VALUATIONDATAX             = BAPI_MBEWX
          WAREHOUSENUMBERDATA        =
          WAREHOUSENUMBERDATAX       =
          SALESDATA                  = BAPI_MVKE1
          SALESDATAX                 = BAPI_MVKEX
          STORAGETYPEDATA            =
          STORAGETYPEDATAX           =
          IMPORTING
            RETURN                     = BAPI_RETURN
          TABLES
            MATERIALDESCRIPTION        = INT_MAKT
          UNITSOFMEASURE             =
          UNITSOFMEASUREX            =
          INTERNATIONALARTNOS        =
          MATERIALLONGTEXT           =
          TAXCLASSIFICATIONS         =
          RETURNMESSAGES             =
          PRTDATA                    =
          PRTDATAX                   =
          EXTENSIONIN                =
          EXTENSIONINX               =
    IF BAPI_RETURN-TYPE = 'E'.
       WRITE:/ 'Error Message ', BAPI_RETURN-MESSAGE.
    ENDIF.
    ENDLOOP.
    ENDFORM.
    <b>i am using this bapi method to copy materials from one plant to another plant using storage location so here what happenig is everyting is going correct but only the storage location data is not saving in table mard so any body faced this kind of problem please tell me.... and one more dbt
    bapi_marcx-pur_status = 'x' what is 'X' here??? is that mandatory field or required field ???
    points wil be rewarded.
    reagrds,
    sunil k airam.

    In the HEADDATA structure, STORAGE_VIEW should also be set as 'X' , in order to update storage location data
    for example
    BAPI_HEAD-STORAGE_VIEW = 'X'.
    Also, PUR_STATUS corresponds to field MARA-MSTAE whose domain has value table T141, therefore values in the field are checked against T141
    Edited by: Harris Veziris on May 12, 2008 12:37 PM

  • Change of Valuation Method

    Dear All
    Is it possible to Change the valuation method from FIFO to LIFO or Moving Average Price, when the Stocks are available in factory

    Standard to MAP and vice versa are very well explained in the document provided by Ramana on page 31. Thanks Ramana!
    As far as the FIFO and LIFO valuation are concerned, the system continues to maintain in standard or MAP, as setup by the price control indicator, S or V. What the system does is, at the period end, finds what would be the value of the closing stock, if FIFO or LIFO is method is followed. It is only relevant to valuation of closing inventory. <b>It is for information purpose</b>, but still if you want to value the inventory on FIFO or LIFO basis, then <b>you can set up the update indicator</b>. If it is done so, then the value proposed by LIFO/FIFO analysis is updated, <b>as if it were a price change.</b>
    In OMWE you can <b>parallely maintain both LIFO and FIFO</b> active.

  • Lifo pool?

    hi all,
    i configured LIFO Pool in sap using this path
    SPRO>MM>VALUATION ACCOUNT ASSSIGNMENT>BALANCE SHEET VALUATION PROCEDURES>CONFIGURE LIFO/FIFO METHODS>LIFO>CONFIG LIFO LIFO POOL
    and assigned the same to
    SPRO>MM>VALUATION ACCOUNT ASSSIGNMENT>BALANCE SHEET VALUATION PROCEDURES>CONFIGURE LIFO/FIFO METHODS>LIFO>CONFIG LIFO VALUATION AREA
    . now i can see it in the db table TPOOL but, the same is not displayed when i press f4 in material master- accounting 2 tab-lifo pool.
    need suggestions guys.
    regards
    chinta

    HI guys,
    This is the error i got, when i tried to give input in LIFO Pool in material master-mm01.
    The value HP0L is not allowed for the field LIFO pool
    Message no. MG142
    Diagnosis
    When you transfer data by direct input or when you distribute data by application link enabling (ALE), the system performs the same checks as in online mode. However, the value HP0L is not allowed for the field LIFO pool.
    Procedure
    Check what values are allowed for the field in online mode.
    could any one suggest on this.
    regards
    chinta

  • How to configure FIFO, LIFO price control in MM?

    Hi all,
    In MM, I only see price control of standard and average.
    If I want to control material pricing by LIFO or FIFO method, how to do?
    Thanks
    Giang

    Hi
    LIFO and FIFO valaution methods are used for balance sheet valuation in some countries.
    <b>Balance sheet valuation</b> : The objective of balance sheet valuation is the calculation of material prices for subsequent use in external or internal balance sheets, typically for valuation of the stocks of current assets. Generally, the conditions include meeting legal requirements, complying with corporate group guidelines, and implementing internal company objectives regarding accounting policy. In this context, the company code is regarded as an independent accounting unit
    The SAP System provides the following techniques for balance sheet valuation:
    1.Lowest Value Determination
    2.LIFO Valuation
    3.FIFO Valuation
    The procedure used depends first on country-specific tax and commercial laws. Use of procedures that are legally permitted but not stipulated can be varied according to internal company experiences and preferences.
    Alongside the prices from lowest value determination, LIFO procedures, and FIFO procedures, the following prices are, in principle, possible as the maximum value for the balance sheet price.
    *Standard price
    *Moving average price
    *Period moving average price from the material ledger
    *Average Receipt Price
    Regards
    Ramakrishna

  • Depth First Search (LIFO) - stacked based

    Hi Everyone, 
    Herewith attached my workable Breadth fist search (FIFO) code - queue based. Now, I would like to change to LIFO - stacked based. 
    Anyone here can give some guideline on it?
    Many thanks.  
    Attachments:
    Version 1.zip ‏64 KB

    I've changed it to queue FIFO. but in the end, it won't show a complete path to reach the destination point. However, queue stack LIFO can show a complete path from starting point till the goal point.
    Does that means queue FIFO cannot be used in finding a complete path out? Is there any possible way for this method to find its way out? 
    Herewith attached queue FIFO. 
    Attachments:
    Queue FIFO.zip ‏64 KB

  • Push method, arrays, stacks

    public boolean push(String input)
    I have read in the input from the keyboard, using console Reader, but im not sure how to impement the push method, where it returns true if it pushed the string or false if it didnt. I have to push the input from one stack onto another stack. The stacks are built using arrays.
    Can anyone help
    Thanks

    Hi there,
    Stack is a LIFO structure which i presume u already know. I think u are developing a class called Stack .
    Let me give u the psuedocode for the same
    public class Stack
    private String[] elements;
    private int topOfStackPtr = 0;
    // to be initialized in the constructor
    private int length = 0;
    public boolean push(String input)
    try{
    if(topOfStackPtr >= length)
    return false
    elements[topOfStackPtr] = input;
    topOfStackPtr++;
    }catch(ArrayIndexOutOfBoundsException e)
    return false;
    I havent shown u the constructor psuedocode.
    Hope this helps

Maybe you are looking for