Fleet Material Consumption Field "Vehicle Technology" Tab

I am trying to utilize the gas station function within the Fleet Management Settings of SAP.
I have made the following configuration:
Settings for Fleet Management > Consumption-Relevant Counter Reading Update > Define Tolerance Check for Usage Control
A      Short-term Tolerance     "Check"    10     10   Information
Settings for Fleet Management > Consumption-Relevant Counter Reading Update > Create Gas Station
0010  Fuel Pump  0010   9999
Settings for Fleet Management > Consumption-Relevant Counter Reading Update > Assign Auxiliary Materials and Consumables
Gas            Gas           0010    "Check"
Settings for Fleet Management > Consumption-Relevant Counter Reading Update > Define Key and Cost Object for Updating Material Documents
A     Unleaded Gas        03           261           262       "Standing Order Checked"
I have activated the PLM extension as well as the LOG_EAM_CI_3 Business Functions
When I go to the Material Consumption field and click the drop down nothing is appearing and it gives me the message
Vehicle-specific F4 help cannot be processed
     Message no. ITOB_FLEET113
Diagnosis
     An error occurred during the processing of the F4 help for a
     fleet-object-specific input field.
Procedure
     Check your entries and, if necessary, your Customizing.
Procedure for System Administration
     Normally the Enterprise Add-On (which has the functionality of
     consumption recording for fleet objects) must be available in your
     system. However, if this is not the case, then this also leads to the
    above message. If the Add-On has not been brought in, then the affected
input field should be deactivated in Customizing (using the field
selection).
Are there more business functions that I need to activate to make the material consumption for fleet work?
Thank you

Here we define the settings for calculating the cost of the material. Generally we take a standing order for the cost collecting. And what the key for material consumption we are creating here, we have to use it in the Fleet master data for cost calculation.
For calculating the cost following are the essential things:
i. Create a Normal PM01 order. Assign that material to the order with the open quantity. And release it.
ii. Assign this order in the standing order field of that fleet Object.
iii.. Run the transaction IFCU. And when the material will be putting there, the inventory will be detected and the cost will automatically be updated in the actual cost field of that standing order.
iv. One more thing the IS of Vehicle consumption data is S114 and for Order (almost all standard IS). These all IS should also be updated with same Period (May be days wise or month wise but period should remain same.)
I have followed the above steps. The only 2 I am not certain of is the following:
i. "Assign that material to the order with the open quantity."
I assumed that this means in the work order I do not put any quantity in there.
I have my material, a reqmt qty of 0.00 (because I did not fill anything in), unit of measure, storage location, and plant
iv. What do you mean by all IS shuld also be updated with same period. Where do I find this?
Thank you,

Similar Messages

  • Consumption data in vehicle information icon of vehicles-technology tab

    Dera Sir,
    I do not find any data in the 'consumption data' window which pops up when the 'vehicle information' icon is clicked which is in the 'Vehicles-Technology' tab page of Vehicle Master Data.I have created measurement documents via IFCU.
    Please guide how to see data in that window.
    Thanks and Regards,
    R N Sabat.

    Problem solved !
    Measuring position was not maintained for key figure IAMENDISTT and IAMENFLVOL in customizing:
    Plant Maintenance and Customer Service > Information Systems for Plant Maintenance and Customer Service > Configure Measurement Document Update
    Regards,
    Saif Ali Momin

  • Display Vehicle Technology tab in IE01

    Hi Experts,
    When I am creating a new Equipment using IE01 Tcode, only the following tabs are getting displayed
    General,Location,Organization and Structure.
    I want to display 3 more tabs as given below
    Structure, Vehicl ID/Measurements and Vehicle Technology tabs.
    When I use IE31 to create a fleet all the above tabs are getting displayed.
    Kindly suggest how to enable Structure, Vehicl ID/Measurements and Vehicle Technology tabs in IE01.
    Regards,
    Sam

    Hi Sam,
    You want to display the view profile for fleet equipments in IE01, for that you need to select the object type in IE01 T-Code,
    Once you select the object type similar to the vehicle type available in IE31 T-Code you will automatically get your required view profile.
    AR

  • Control Code field in Material master- Foreign Trade imports tab

    Hello Experts,
    I am trying to understand the purpose of Control Code(MARC-STEUC) field in Material master- Foreign Trade imports tab. I am also interested in knowing where does this field appear in our PO.
    Please help..
    Manish

    Normally control code specifies the norm to follow by the supply plant for a sale of exposrts. each contry will have a set of rules to get follow as a stuatory . this code specifies the rules or certificates.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/93/7443a5546011d1a7020000e829fd11/frameset.htm
    may be comes in a sale order.
    Regards

  • Report for material consumption based on movement type

    Can any one guide me in developing a report to find the material consumed during a certain period ,
    selectio screen should be based on material no , plant , location , month

    You would need to fetch the accounting number (BELNR) from BKPF based on the purchase order number (XBLNR) and then proceed accordingly with BSIK and BSAK.
    Select .......
              from bkpf
              into table <it>
              where xblnr in so_xblnr
    Something like above.
    Few other important tables in MM and FI:
    A501 Plant/Material
    EBAN Purchase Requisition
    EBKN Purchase Requisition Account Assignment
    EKAB Release Documentation
    EKBE History per Purchasing Document
    EKET Scheduling Agreement Schedule Lines
    EKKN Account Assignment in Purchasing Document
    EKKO Purchasing Document Header
    EKPO Purchasing Document Item
    IKPF Header- Physical Inventory Document
    ISEG Physical Inventory Document Items
    LFA1 Vendor Master (General section)
    LFB1 Vendor Master (Company Code)
    NRIV Number range intervals
    RESB Reservation/dependent requirements
    T161T Texts for Purchasing Document Types
    EINA Purchasing Info Record- General Data
    EINE Purchasing Info Record- Purchasing Organization Data
    MAKT Material Descriptions
    MARA General Material Data
    MARC Plant Data for Material
    MARD Storage Location Data for Material
    MAST Material to BOM Link
    MBEW Material Valuation
    MKPF Header- Material Document
    MSEG Document Segment- Material
    MVER Material Consumption
    MVKE Sales Data for materials
    RKPF Document Header- Reservation
    T023 Mat. groups
    T024 Purchasing Groups
    T156 Movement Type
    T157H Help Texts for Movement Types
    MOFF Lists what views have not been created
    AGKO Cleared Accounts
    ANAR Asset Types
    ANAT Asset type text
    ANEK Document Header Asset Posting
    ANEP Asset Line Items
    ANEV Asset downpymt settlement
    ANKT Asset classes- Description
    ANLA Asset Master Record Segment
    ANLB Depreciation terms
    ANLC Asset Value Fields
    ANLH Main asset number
    AT02T Transaction Activity Category- Description
    AT02A Transaction Code for Menu TIMN
    AT10 Transaction type
    AT10T Name of Transaction Type
    BKDF Document Header Supplement for Recurring Entry
    BKORM Accounting Correspondence Requests
    BKPF Accounting Document Header
    BLPK Document log header
    BLPP Document log item
    BLPR Document Log Index and Planned Order (Backflush)
    BNKA Bank master record
    BP000 Business Partner Master (General Data)
    BPBK Doc.Header Controlling Obj.
    BPEG Line Item Total Values Controlling Obj.
    BPEJ Line Item Annual Values Controlling Obj.
    BPEP Line Item Period Values Controlling Obj.
    BPGE Totals Record for Total Value Controlling obj.
    BPJA Totals Record for Annual Total Controlling Obj.
    BSAD Accounting- Secondary Index for Customers (Cleared Items)
    BSAK Accounting- Secondary Index for Vendors (Cleared Items)
    BSAS Accounting- Secondary Index for G/L Accounts (Cleared Items)
    BSEC One-Time Account Data Document Segment
    BSEG Accounting Document Segment
    BSID Accounting- Secondary Index for Customers
    BSIK Accounting- Secondary Index for Vendors
    BSIM Secondary Index, Documents for Material
    BSIS Accounting- Secondary Index for G/L Accounts
    CEPC Profit Center Master Data Table
    CEPCT Texts for Profit Center Master Data
    COBRA Settlement Rule for Order Settlement
    COBRB Distribution Rules Settlement Rule Order Settlement
    COKA CO Object- Control Data for Cost Elements
    COSP CO Object- Cost Totals for External Postings
    COSS CO Object- Cost Totals for Internal Postings
    CRCO Assignment of Work Center to Cost Center
    CSKA Cost Elements (Data Dependent on Chart of Accounts)
    CSKB Cost Elements (Data Dependent on Controlling Area)
    CSLA Activity master
    FEBEP Electronic Bank Statement Line Items
    FPLA Billing Plan
    FPLT Billing Plan- Dates
    GLPCT EC-PCA- Totals Table
    KNA1 General Data in Customer Master
    KOMK Pricing Communication Header
    MAHNV Management Records for the Dunning Program
    REGUT TemSe - Administration Data
    SKA1 G/L Account Master (Chart of Accounts)
    SKAT G/L Account Master Record (Chart of Accounts- Description)
    SKB1 G/L account master (company code)
    T003T Document Type Texts
    T007S Tax Code Names
    T087J Text
    TAPRFT Text tab. for investment profile
    TKA01 Controlling Areas
    TKA09 Basic Settings for Versions
    TKVS CO Versions
    TZB0T Flow types text table
    TZPAT Financial Assets Management product type texts
    VBSEGS Document Segment for G/L Accounts Document Parking
    VTBFHA Transaction
    VTBFHAPO Transaction Flow
    VTBFHAZU Transaction Activity
    VTBFINKO Transaction Condition
    VTIDERI Master Data Listed Options and Futures
    VTIFHA Underlying transaction
    VTIFHAPO Underlying transaction flows
    VTIFHAZU Underlying transaction status table
    VTIOF Options Additional Data
    VWPANLA Asset master for securities
    Also, visit the following links:
    http://www.sap-img.com/sap-download/sap-tables.zip
    http://www.erpgenie.com/abap/tables.htm
    http://goldenink.com/abap/files_in_sap.html

  • Report for Material Consumption for WBSE & Network

    Dear Experts,
    I want to see Material Consumption for
    for WBSE 281Q (Project to Project)
    for Network 221Q (Network from Project)
    I can see values in Report MB51,
    but I can not see for which WBSE it is consumed or from which WBSE it is consumed.
    The Entries are there in table MSEG field MAT_PSPNR.
    It is not shown in Report MB51, For this column blank is shown, no value is shown.
    Can you help me, how can I see material consumption for WBSE & Network with WBSE ID for/from which.
    Thanks
    SSanjay

    Dear Muralee,
    I think I am not able to explain you the thing or you are not getting what I want to say.
    In my first post I have said:
    I am trying MB51, with
    221Q Project to Project GI
    281Q Project to Network GI.
    I am getting material consumption quantities,
    Network/Activities for which consumption is done is also shown.
    But the WBSE for which / from which consumption is done, that column is blank.
    It is showing WBSE for 101 GR for Project
    I want to know for which /from which WBSE material was consumed?
    I have tried to explain problem again.
    Can you please help?
    SSanjay

  • Without EEWB Is it Possible to add field to standard tab

    Hi Experts!
    Without EEWB and enhancing Screen Is it Possible to adding field to standard tab. Any body can help out in this.
    URGENT
    Thanks
    vikram.c

    Yes it is possible, but we are talking a modification of SAP standard here. Also the effort needed will be at least 10 times higher than using EEWB as you have to reprogram all generated code / screen helps that SAP provides. Moreover these fields are then still not exchanged with the interfaces / BDocs etc which will be also some more days of work. There is no usable documentation on this - at least not by SAP and I am not aware of another one. It is much easier to create an EEWB enhancement and then move the fields from one tab to another.
    Doing this all by hand is like adding a second processor to an existing motherboard for more performance compared to exchanging the existing one with one of higher specifications.This is possible, but requires a) more work/time/material b) more experience c) you lose warranty d) in the end you do not know for sure what the outcome will be
    Regards, Kai

  • Fields under the tab Goods Receipt in process order.

    Hello Experts,
    While creation of process order, the fields under the tab 'Goods Receipt' are disabled and already checked.
    Fields are 'Goods Receipt' and 'Goods Receipt, Non-Valuated'. Fields are 'WEPOS' and 'WEUNB' accordingly.
    Whereas when we create the process order of same material but with different plant, the field 'Goods Receipt, Non-Valuated' is disabled and checked and other field 'Goods Receipt' is enabled.
    The material is finished product.
    Could you please guide us, is there any configuration in order type dependent parameters for the same.
    Many Thanks in advacne.
    Regards,
    Mayur
    Edited by: Mayur_PP on Nov 21, 2011 1:28 PM

    Hi Niki
    For Financial books, MBEW-STPRS would suffice....
    This would also generate a CO doc...
    But, if you want to anlayse variances in CO, then you need a break up of STPRS i.e. Itemization which is calculated from CK11N and stored in MBEW-LPLPR
    BR, Ajay M

  • Batch wise actual material consumption and activity cost

    hi
    my client is steel industry, client requirement is heat wise actual material and machine cost. Heat is a batch number, how i can check batch wise actual material consumption and machine cost.
    regards
    imdad

    Hi Imdad
    Whats the batch definition in your case?? have you designed One batch per Prod order or One batch per GR?
    If its one batch per Prod order - you can directly see the prod order.. however, chances are less for this as Steel company might be using PCC i.e. repetitive mfg
    If its one batch per GR - Then you will have to track using the Confirmation no because each Confirmation will trigger the Goods Issue and Activity Confirmations...
    Using Table AFRU - You can track the individual Confirmation no and also the Activity Qty confirmed....COSS / COSSD will have the Activity Cost
    If any goods mvt are posted during the Confirmation, you would see a Mat Doc No populated in the field "Mat Doc"
    Br, Ajay M

  • How to populate the data in fields if we tab out at one field

    Hi Gurus,
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?
    Thanks in Advance
    Sruthi

    Hi,
    Sruthi wrote:
    I am new to OAF Technology and I've new requirement in custom OAF page.
    We have 12 fields like ID, Fname, Lname, Age, Address, Tphone etc..
    If we enter ID in message text input field box and tab out, then it should populate all the remaining fields data by default.
    Could anyone help me regarding this requirement?---MessageTextInput filed set Action property:FirePartialAction and Event:TextInput
    ---Get the Event in co PFR
    if("TextInput".equals(pageContext.getParameter(EVENT_PARAM)))
    AM.setDafultValue();
    ---Write a method in AM
    public void setDafultValue()
    VOImpl vo=getVO1();
    if(vo!= null)
    vo.getCurrentRow().setAttribute("Number1","DefaultValue1");
    vo.getCurrentRow().setAttribute("Number2","DefaultValue2");
    ---Like this u can set default value when tab out.
    Regards
    Meher Irk

  • Material Consumption Report

    Hi Guys,
    I have to develop a custom report intended for use by our factories and is design to give them detail  information on raw materials actual usage relative to how much should have been used (standard usage) by an individual product or product group. 
    The column of the report that is probably the most challenging to determine by taking the BOM quantities for each product in the product group under consideration and multiplying them by the actual output achieved for the respective products in order obtain the standard usage. 
    I have been looking at doing the following. Substracting the fields of txn COR3(Display process order material list), from txn CORT(Process order confirmation display: goods movement). Is this the right approach.
    Any screens, transactions, tables, structures for me to do this report would be greatly appreciated.
    Thank you for the help.
    Sumit.

    Hi,
    Have you tried looking at the standard material consumption report - Transaction MCRE?
    Rgds.

  • Day wise raw material consumption report query

    Hi,
    I was wondering if there was a way to extract the day wise consumption of all the raw materials that we use at the factory. The standard report in SAP B1 only gives me the total raw material consumption within a period of time and I need to drill down a couple of levels to see the individual raw material transferred.
    I basically wanted to use this data to establish the weekly consumption of my raw materials as the goods issue team enters this on a daily basis.
    Thanks in advance.

    Sorry for not having included it earlier. The website did not let me attach an excel sheet.so I've attached a csv file for you to take a look at but basically these are the only fields I need:
    Date
    Item No.
    Item Name
    Issue Qty [Out Qty]
    01-01-2014
    CSPLPIC001
    Raw Material 1
    740
    01-01-2014
    CSPLPIC002
    Raw Material 2
    950
    01-01-2014
    CSPLPIC003
    Raw Material 3
    793
    01-01-2014
    CSPLPIC005
    Raw Material 4
    980
    01-01-2014
    CSPLPIS001
    Raw Material 5
    487
    01-01-2014
    CSPLPIS002
    Raw Material 6
    927
    07-01-2014
    CSPLPMC001
    Raw Material 7
    907
    08-01-2014
    CSPLPMC002
    Raw Material 8
    669
    09-01-2014
    CSPLPMC005
    Raw Material 9
    41
    10-01-2014
    CSPLPIC001
    Raw Material 1
    599
    10-01-2014
    CSPLPIC002
    Raw Material 2
    473
    10-01-2014
    CSPLPIC003
    Raw Material 3
    619
    10-01-2014
    CSPLPIC005
    Raw Material 4
    477
    10-01-2014
    CSPLPIS003
    Raw Material 5
    408
    Please do let me know if there is any other information that you need.

  • Facing Problem on Material No field in all the standard TCode

    Dear Gurus
    I am facing a problem which is like when ever I am trying to fint out the material no of our desire with material text with the Ffour option in Material No field on any of standard report like pending PO material wise  party wise r pending pr  the Ffour option is nt cming and instead a same material no is cming across all the tcode which is causing us problem to find out the our desire material no. Where as its wrking fine in other usr ids .
    Thnz
    Subrat

    Subrat,
    I am a bit confused by your use of abbreviations.  However, it sounds like you are having an issue whereby your USERID does not manage the Material Number in the same way that other USERIDs are doing.  Pls confirm.
    First thing to check are your USERID parameters.  SU3 > select parameters tab.  Look for any parameter that contains the material number that is plaguing you;  if you find one delete the material number from the parameter.
    If you don't see the material number, then compare your parameters with the parameters of a user whom you want to emulate.  Delete/add parameters from your profile to make yours similar to the 'good' one.
    Best Regards,
    DB49

  • Dump Error in MAterial Consumption Report

    Hi all Gurus
    [1] I need help from your side i am doing one material consumption report in that i did all thing but it is giving me dump error while i was using sort  in to ALV
    so please any one help me out this .......
    [2] I am Printing sum of quantity in Header area of smartform it is printing with using comma e.x 43,000 but in body area it is showing with decimal point
    e.x 43.000
    Following is my ALV reports code please check it it is giving me short dump while using sort ..............
    I am very much in neeed
    Thanx for your suggestion in advanc.....
    and god bless you............
    *& Report  ZCONSUM
    REPORT  ZCONSUM.
    *& Report  ZCONSUMPTION
    TYPE-POOLS : SLIS.
    TABLES:marc,
           mara,
           makt,
           mard,
           mbew,
           mseg,
           mkpf.
    TYPES:
            BEGIN OF s_mseg,
                mblnr LIKE mseg-mblnr,
                mjahr LIKE mseg-mjahr,
                zeile LIKE mseg-zeile,
                bwart LIKE mseg-bwart,
                matnr LIKE mseg-matnr,
                werks LIKE mseg-werks,
                menge LIKE mseg-menge,
                budat LIKE mkpf-budat,
                mtart LIKE mara-matnr,
                matkl LIKE mara-matkl,
            END OF s_mseg,
            BEGIN OF s_t001w,
                werks LIKE t001w-werks,
                name1 LIKE t001w-name1,
            END OF s_t001w,
            BEGIN OF s_mara,
                matnr LIKE mara-matnr,
                mtart LIKE mara-mtart,
                matkl LIKE mara-matkl,
            END OF s_mara,
            BEGIN OF s_makt,
                matnr LIKE makt-matnr,
                spras LIKE makt-spras,
                maktx LIKE makt-maktx,
            END OF s_makt,
           BEGIN OF s_calc,
                matnr       LIKE mara-matnr,
                mtart       LIKE mara-mtart,
                matkl       LIKE mara-matkl,
                maktx       LIKE makt-maktx,
               menge_t     LIKE mseg-menge,
               menge_t1    LIKE mseg-menge,
                menge_con_261   LIKE mseg-menge,
                menge_con_262   LIKE mseg-menge,
                menge_con1_261  LIKE mseg-menge,
                menge_con1_262  LIKE mseg-menge,
                menge_ret_291   LIKE mseg-menge,
                menge_ret1_291  LIKE mseg-menge,
                menge_ret_292   LIKE mseg-menge,
                menge_ret1_292  LIKE mseg-menge,
                menge_unit_301  LIKE mseg-menge,
                menge_unit1_301 LIKE mseg-menge,
                menge_unit_302  LIKE mseg-menge,
                menge_unit1_302 LIKE mseg-menge,
                menge_sub   LIKE mseg-menge,
                menge_sub1   LIKE mseg-menge,
                menge_oth   LIKE mseg-menge,
                menge_oth1  LIKE mseg-menge,
            END OF s_calc,
            BEGIN OF s_data,
                matnr       LIKE mara-matnr,
                matkl       LIKE mara-matkl,
                mtart       LIKE mara-mtart,
                maktx       LIKE makt-maktx,
                menge_t     LIKE mseg-menge,
                menge_t1    LIKE mseg-menge,
                menge_con   LIKE mseg-menge,
                menge_con1  LIKE mseg-menge,
                menge_ret   LIKE mseg-menge,
                menge_ret1  LIKE mseg-menge,
                menge_unit  LIKE mseg-menge,
                menge_unit1 LIKE mseg-menge,
                menge_sub   LIKE mseg-menge,
                menge_sub1   LIKE mseg-menge,
                menge_oth   LIKE mseg-menge,
                menge_oth1  LIKE mseg-menge,
            END OF s_data.
    DATA:   w_mseg TYPE s_mseg,
            i_mseg TYPE s_mseg OCCURS 0,
            w_t001w TYPE s_t001w,
            i_t001w TYPE s_t001w OCCURS 0,
            w_mara TYPE s_mara,
            i_mara TYPE s_mara OCCURS 0,
            w_makt TYPE s_makt,
            i_makt TYPE s_makt OCCURS 0,
            w_calc TYPE s_calc,
            i_calc TYPE s_calc OCCURS 0,
            w_data TYPE s_data,
            i_data TYPE s_data OCCURS 0.
    DATA:   line_cnt TYPE i,
            v_temp TYPE p DECIMALS 2.
    ALV DATA DECLERATION
    DATA : IT_FIELD TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELD TYPE SLIS_FIELDCAT_ALV.
    DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
    IT_LAYOUT-ZEBRA = 'X'.
    IT_LAYOUT-TOTALS_TEXT = 'Grand Total'.
    IT_LAYOUT-SUBTOTALS_TEXT = 'Sub Total'.
    IT_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    DATA: WA_COMMENTRY TYPE SLIS_LISTHEADER.
    DATA: IT_COMMENTRY TYPE SLIS_T_LISTHEADER.
    DATA: WA_COMMENTRY1 TYPE SLIS_LISTHEADER.
    DATA: IT_COMMENTRY1 TYPE SLIS_T_LISTHEADER.
    DATA: WA_EVENT TYPE SLIS_ALV_EVENT.
    DATA: IT_EVENT TYPE SLIS_T_EVENT.
    WA_EVENT-NAME = 'TOP_OF_PAGE'.
    WA_EVENT-FORM = 'TOP'.
    APPEND WA_EVENT TO IT_EVENT.
    DATA : WA_SORT TYPE slis_sortinfo_alv,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV.
    CLEAR WA_SORT.
    WA_SORT-SPOS = '1'.
    WA_SORT-FIELDNAME = 'MATKL'.
    WA_SORT-TABNAME = 'I_DATA'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    WA_SORT-SPOS = '2'.
    WA_SORT-FIELDNAME = 'MTART'.
    WA_SORT-TABNAME = 'I_DATA'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    DEFINE MAC1.
    WA_FIELD-TABNAME = 'I_DATA'.
    WA_FIELD-FIELDNAME = &1.
    WA_FIELD-COL_POS = &2.
    WA_FIELD-SELTEXT_L =&3.
    WA_FIELD-DO_SUM = &4.
    APPEND WA_FIELD TO IT_FIELD.
    END-OF-DEFINITION.
    MAC1 'MATKL'        '1'  'MATERIAL GROUP' 'X'.
    MAC1 'MTART'        '2'  'MATERIAL TYPE' 'X'.
    MAC1 'MATNR'        '3'  'MATERIAL NO'  'X'.
    MAC1 'MAKTX'        '4'  'DESCRIPTION' 'X'.
    MAC1 'MENGE_CON1'   '5'  'CONSUMPTION FOR PERIOD' 'X'.
    MAC1 'MENGE_CON'    '6'  'CONSUMPTION FOR CUMULATIVE' 'X'.
    MAC1 'MENGE_RET1'   '7'  'RETURN FROM DEPT. FOR PERIOD' 'X'.
    MAC1 'MENGE_RET'    '8'  'RETURN FROM DEPT.CUMULATIVE' 'X'.
    MAC1 'MENGE_UNIT1'  '9'  'INTER UNIT FOR PERIOD' 'X'.
    MAC1 'MENGE_UNIT'   '10'  'INTER UNIT CUMULATIVE' 'X'.
    MAC1 'MENGE_SUB1'   '11' 'SUB CONTRACTOR FOR PERIOD' 'X'.
    MAC1 'MENGE_SUB'    '12' 'SUB CONTRACTOR CUMULATIVE' 'X'.
    MAC1 'MENGE_OTH1'   '13' 'OTHERS FOR PERIOD' 'X'.
    MAC1 'MENGE_OTH'    '14' 'OTHERS CUMULATIVE' 'X'.
    MAC1 'MENGE_t1'     '15' 'TOTAL FOR PERIOD' 'X'.
    MAC1 'MENGE_t'      '16' 'TOTAL CUMULATIVE' 'X'.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
      PARAMETERS: p_werks LIKE t001w-werks DEFAULT '1023' OBLIGATORY.
      select-options: s_matkl     FOR mara-matkl,
                      s_mtart     FOR mara-mtart,
                      s_matnr     FOR mara-matnr,
                      s_budat     FOR mkpf-budat OBLIGATORY.
    PARAMETERS: year(4) DEFAULT '2007'.
      SELECTION-SCREEN:END OF BLOCK B1.
      START-OF-SELECTION.
      SELECT lk~mblnr
             lk~mjahr
             lk~budat
             lp~zeile
             lp~bwart
             lp~matnr
             lp~werks
             lp~menge
             ma~mtart
             ma~matkl
             INTO CORRESPONDING FIELDs OF TABLE i_mseg
             FROM MSEG AS lp INNER JOIN MKPF AS lk
             ON lkmblnr EQ lpmblnr
             AND lkmjahr EQ lkmjahr
             INNER JOIN mara AS ma
             ON mamatnr EQ lpmatnr
             WHERE lp~werks EQ p_werks
               AND lp~matnr IN s_matnr
               AND lk~budat LE s_budat-high.
          clear line_cnt.                         "Count line of i_table i_mseg
          DESCRIBE TABLE i_mseg LINES line_cnt.
          IF  line_cnt GT 0.                      "If i_mseg has records
              SELECT matnr                        "Collect material description
                     maktx
                     spras
                     INTO CORRESPONDING FIELDS OF TABLE i_makt
                     FROM makt
                     FOR ALL ENTRIES IN i_mseg
                     WHERE matnr EQ i_mseg-matnr
                       AND spras EQ 'E'.
                CLEAR line_cnt.
                DESCRIBE TABLE i_makt LINES line_cnt.
                IF line_cnt GT 0.
                   SORT i_makt BY MATNR ASCENDING.
                   DELETE ADJACENT DUPLICATES FROM i_makt COMPARING matnr.
                ENDIF.
              SELECT werks                        "Collect plant name
                     name1
                     INTO CORRESPONDING FIELDS OF TABLE i_t001w
                     FROM t001w
                     FOR ALL ENTRIES IN i_mseg
                     WHERE werks EQ i_mseg-werks.
                CLEAR line_cnt.
                DESCRIBE TABLE i_t001w LINES line_cnt.
                IF line_cnt GT 0.
                   SORT i_t001w BY werks ASCENDING.
                   DELETE ADJACENT DUPLICATES FROM i_t001w COMPARING werks.
                ENDIF.
               LOOP AT i_mseg INTO w_mseg.        "Move recored into data i_tab
                w_calc-matnr  = w_mseg-matnr.
                w_calc-mtart = w_mseg-mtart.
                w_calc-matkl = w_mseg-matkl.
                READ TABLE i_makt WITH KEY matnr = w_mseg-matnr INTO w_makt.
                 IF sy-subrc = 0.
                    w_calc-maktx = w_makt-maktx.
                 ENDIF.
                IF w_mseg-bwart EQ '261' .
                   w_calc-menge_con_261   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_con1_261   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '262' .
                   w_calc-menge_con_262   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_con1_262   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '291' OR w_mseg-bwart EQ '201'.
                   w_calc-menge_ret_291 = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_ret1_291   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '292' OR w_mseg-bwart EQ '202'.
                   w_calc-menge_ret_292   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_ret1_292   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '301'.
                   w_calc-menge_unit_301   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_unit1_301   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '302'.
                   w_calc-menge_unit_302   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_unit1_302   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '543'.
                   w_calc-menge_sub   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_sub1   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                    COLLECT w_calc INTO i_calc.
               ENDLOOP.                           "ENDLOOP of Move recored into data i_tab
              LOOP AT i_calc INTO w_calc.
                w_data-matnr   = w_calc-matnr.
                w_data-mtart   = w_calc-mtart.
                w_data-matkl   = w_calc-matkl.
                w_data-maktx   = w_calc-maktx.
                v_temp = w_calc-menge_con_261 - w_calc-menge_con_262.
                w_data-menge_con    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_con1_261 - w_calc-menge_con1_262.
                w_data-menge_con1   = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_ret_291 - w_calc-menge_ret_292.
                w_data-menge_ret    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_ret1_291 - w_calc-menge_ret1_292.
                w_data-menge_ret1    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_unit_301 - w_calc-menge_unit_302.
                w_data-menge_unit    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_unit1_301 - w_calc-menge_unit1_302.
                w_data-menge_unit1   = v_temp.
                CLEAR v_temp.
                w_data-menge_sub    = w_calc-menge_sub.
                w_data-menge_sub1   = w_calc-menge_sub.
                v_temp = w_data-menge_con + w_data-menge_ret + w_data-menge_unit + w_data-menge_sub.
                w_data-menge_t      = v_temp.
                CLEAR v_temp.
                v_temp = w_data-menge_con1 + w_data-menge_ret1 + w_data-menge_unit1 + w_data-menge_sub1.
                w_data-menge_t1      = v_temp.
                CLEAR v_temp.
                APPEND w_data TO i_data.
              ENDLOOP.
          ENDIF.                                  "ENDIf i_mseg has records
    Display_ALV
    END-OF-SELECTION.
      DATA : DATE(85),
             DATE_LOW(10),
             DATE_HIGH(10),
             MSK TYPE STRING,
             DATE1(10),
             date2(10).
    WA_COMMENTRY-TYP = 'H'.
    WA_COMMENTRY-INFO = 'Material Consumption Report'.
    APPEND WA_COMMENTRY TO IT_COMMENTRY.
    CLEAR WA_COMMENTRY.
    CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/' S_BUDAT-LOW+0(4) INTO DATE1.
    CONCATENATE S_BUDAT-high6(2) '/' S_BUDAT-high4(2) '/' S_BUDAT-high+0(4) INTO DATE2.
    CONCATENATE 'Material Consumption Report :' DATE1 'To' date2 INTO DATE SEPARATED BY SPACE.
    WA_COMMENTRY-TYP  = 'S'.
    WA_COMMENTRY-INFO = DATE.
    APPEND WA_COMMENTRY TO IT_COMMENTRY.
    CLEAR WA_COMMENTRY.
    *SORT I_DATA BY   MTART MATKL .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       I_BACKGROUND_ID                   = 'ALV_BACKGROUNG'
      I_GRID_TITLE                      = 'STOCK LEDGER SUMMARY'
       IS_LAYOUT                         = IT_LAYOUT
       IT_FIELDCAT                       = IT_FIELD
      IT_SORT                           = IT_SORT
      I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENT
      TABLES
        T_OUTTAB                          = I_DATA.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM TOP .
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = IT_COMMENTRY
      I_LOGO                   = 'INOXLOGO'
      I_END_OF_LIST_GRID       =
      I_ALV_FORM.
    REFRESH IT_COMMENTRY.
    ENDFORM.                    " TOP-OF-PAGE

    It is giving me error on sort statement 
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_BACKGROUND_ID = 'ALV_BACKGROUNG'
    I_GRID_TITLE = 'STOCK LEDGER SUMMARY'
    IS_LAYOUT = IT_LAYOUT
    IT_FIELDCAT = IT_FIELD
    IT_SORT = IT_SORT  <<<<<<<<<<<<<<<<<<<<<<<<<<<
    I_SAVE = 'X'
    IT_EVENTS = IT_EVENT
    TABLES
    T_OUTTAB = I_DATA.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Material Consumption Report all expert requested to check my code

    Hi all guru
    Plz
    I am creating Material Consumption Report
    so  all expert are requested to check my code
    bcz its giving me wrong value change if nessary
    *& Report  Z_MATERIAL_CONSUPTION
    *&IEDK901096
    REPORT  Z_MATERIAL_CONSUPTION
    LINE-COUNT 65(2)
      LINE-SIZE 345
    MESSAGE-ID zate_msg
      NO STANDARD PAGE HEADING.
    *T A B L E S
    TABLES:MARC,
           mara,
           makt,
           mard,
           mbew,
           mseg,
           mkpf.
    T Y P E S
    Types for MARC
    TYPES: begin of ty_marc,
            matnr LIKE marc-matnr,
            werks LIKE marc-werks,
           end of ty_marc.
    ********Types for T001W*****
    TYPES:BEGIN OF ty_t001w,
            werks LIKE t001w-werks,
            name1 LIKE t001w-name1,
          END OF ty_t001w.
    ********Types for MARA*****
    TYPES:BEGIN OF TY_MARA,
           matnr LIKE mara-matnr,
           mtart LIKE mara-mtart,
           matkl LIKE mara-mtart,
          END OF ty_mara.
    ********Types for MAKT*****
    TYPES:BEGIN OF ty_makt,
           matnr LIKE makt-matnr,
           spras LIKE makt-spras,
           maktx LIKE makt-maktx,
           END OF ty_makt.
    ********Types for MKPF*****
    TYPES:BEGIN OF ty_mkpf,
           mblnr LIKE mkpf-mblnr,
           budat LIKE mkpf-budat,
      END OF ty_mkpf.
    ********Types for MSEG*****
      TYPES:BEGIN OF ty_mseg,
            mblnr LIKE mseg-mblnr,
            mjahr LIKE mseg-mjahr,
            matnr LIKE mseg-matnr,
            werks LIKE mseg-werks,
            menge LIKE mseg-menge,
            END OF ty_mseg.
    Types for main **************
    TYPES: begin of ty_main,
            matkl LIKE mara-mtart,
            mtart LIKE mara-mtart,
            matnr LIKE mara-matnr,
            werks LIKE marc-werks,
            name1 LIKE t001w-name1,
            maktx LIKE makt-maktx,
            budat LIKE mkpf-budat,
            mblnr LIKE mseg-mblnr,
            mjahr LIKE mseg-mjahr,
            menge LIKE mseg-menge,
            menge1 LIKE mseg-menge,
            bwart LIKE mseg-bwart,
            ret_qty LIKE mseg-menge,
            ret_*** LIKE mseg-menge,
            unit_qty LIKE mseg-menge,
            unit_*** LIKE mseg-menge,
            wip_qty LIKE mseg-menge,
            wip_*** LIKE mseg-menge,
            sub_qty LIKE mseg-menge,
            sub_*** LIKE mseg-menge,
            oth_qty LIKE mseg-menge,
            oth_*** LIKE mseg-menge,
            end of ty_main.
    Types for main2 **************
    TYPES: begin of ty_main2,
            mblnr LIKE mseg-mblnr,
            werks LIKE marc-werks,
            mjahr LIKE mseg-mjahr,
            menge LIKE mseg-menge,
            bwart LIKE mseg-bwart,
            matnr LIKE mara-matnr,
            mtart LIKE mara-mtart,
            matkl LIKE mara-mtart,
            end of ty_main2.
    *I N T E R N A L    T A B L E S
    DATA:it_mara   TYPE ty_mara  OCCURS 0 WITH HEADER LINE,
         it_marc   TYPE ty_marc  OCCURS 0 WITH HEADER LINE,
         it_t001w  TYPE ty_t001w OCCURS 0 WITH HEADER LINE,
         it_makt   TYPE ty_makt  OCCURS 0 WITH HEADER LINE,
         it_main   TYPE ty_main  OCCURS 0 WITH HEADER LINE,
         it_main2   TYPE ty_main2  OCCURS 0 WITH HEADER LINE,
         it_mkpf   TYPE ty_mkpf  OCCURS 0 WITH HEADER LINE,
        it_mseg   TYPE ty_mseg  OCCURS 0 WITH HEADER LINE,
         it_mseg   TYPE ty_main  OCCURS 0 WITH HEADER LINE,
         it_dept   TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_unit   TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_WIP    TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_subcon TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_others TYPE ty_main2 OCCURS 0 WITH HEADER LINE.
    **********I N T E R N A L   T A B L E S for Cumulative Calculation**********
    DATA:it_mseg1   TYPE ty_main  OCCURS 0 WITH HEADER LINE,
         it_dept1   TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_unit1   TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_WIP1    TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_subcon1 TYPE ty_main2 OCCURS 0 WITH HEADER LINE,
         it_others1  TYPE ty_main2 OCCURS 0 WITH HEADER LINE.
    W O R K   A R E A
    DATA:wa_mara  TYPE ty_mara,
         wa_marc  TYPE ty_marc,
         wa_t001w TYPE ty_t001w,
         wa_makt  TYPE ty_makt,
         wa_main  TYPE ty_main,
         wa_main2  TYPE ty_main2,
         wa_mkpf  TYPE ty_mkpf,
         wa_mseg  TYPE ty_mseg,
         wa_mseg1 TYPE ty_mseg,
         wa_dept  TYPE ty_main2,
         wa_ret_qty TYPE ty_main2,
         wa_ret_*** TYPE ty_main2.
    V A R I A B L E S  D E C L A R A T I O N
    DATA: MYDATE TYPE SY-DATUM,
          per_qty TYPE p,
          ***_qty TYPE p ,
          final_total TYPE p DECIMALS 2.
    S E L E C T I O N  S C R E E N
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
      PARAMETERS:Plant LIKE marc-werks DEFAULT '1023'.
      select-options:Mat_Grp     FOR mara-matkl,
                     Mat_Type    FOR mara-mtart,
                     MATERIAL    FOR MARC-MATNR,
                     Period      FOR mydate.
    PARAMETERS:Year  LIKE mseg-mjahr DEFAULT '2007'.
      SELECTION-SCREEN:END OF BLOCK B1.
    I N I T I A L I Z A T I O N
    INITIALIZATION.
    MATERIAL-LOW = '100'.
    MATERIAL-HIGH = '200'.
    APPEND MATERIAL.
    *MAT_TYPE-LOW = 'ABF'.
    *MAT_TYPE-HIGH = 'FERT'.
    *APPEND MAT_TYPE.
    *MAT_GRP-LOW = '100'.
    *MAT_GRP-HIGH = '200'.
    *APPEND MAT_GRP.
    *PERIOD-LOW = '20071001'.
    *PERIOD-HIGH = '20071031'.
    *APPEND PERIOD.
    S T A R T  O F  S E L E C T I O N
    start-of-selection.
    PERFORM it_mara_data.
    PERFORM it_marc_data.
    PERFORM it_t001w_data.
    PERFORM it_makt_data.
    PERFORM it_mseg_data.
    PERFORM it_mseg1_data. "CUMULATIVE  CALCULATION
    PERFORM it_mkpf_data.
    PERFORM it_dept_data.
    PERFORM it_dept1_data. "CUMULATIVE  CALCULATION
    PERFORM it_unit_data.
    PERFORM it_unit_data1. "CUMULATIVE  CALCULATION
    PERFORM it_wip_data.
    PERFORM it_wip_data1.  "CUMULATIVE  CALCULATION
    PERFORM it_sub_contract.
    PERFORM it_sub_contract1. "CUMULATIVE  CALCULATION
    PERFORM it_main_data.
    T O P   O F   P A G E
    TOP-OF-PAGE.
    WRITE: /1 'INOX AIR PRODUCTS LTD',plant,it_t001w-name1,
           /1 'TOTAL CONSUMPTION FOR THE PERIODE:',Period-low,'To',period-high.
    skip 2.
    FORMAT COLOR 1.
    ULINE.
    WRITE: /1'|','CODE ' ,
            15 'MATERIAL' ,
            30 'DESCRIPTION',
            90'CONSUMPTION' ,
            135'RETURN FROM DEPT.' ,
            170'INTER UNIT' ,
            210'W.I.P' ,
            240'SUB-CONTRACTOR' ,
            275'OTHERS' ,
            310'TOTAL',345'|' ,
           /1'|',15 'TYPE',
            85'FOR PERIOD' ,
            100 ' CUMULATIVE' ,
            130'FOR PERIOD' ,
            145 'CUMULATIVE' ,
            165'FOR PERIOD' ,
            180 'CUMULATIVE' ,
            200'FOR PERIOD' ,
            215'CUMULATIVE' ,
            235'FOR PERIOD' ,
            250'CUMULATIVE' ,
            265'FOR PERIOD' ,
            280 'CUMULATIVE' ,
            300'FOR PERIOD' ,
            315' CUMULATIVE' ,
            345'|' .
    ULINE.
    E N D   O F  S E L E C T I O N
    end-OF-SELECTION.
    PERFORM display_data.
    FORM it_mara_data.
        SELECT matnr
               mtart
               matkl
          FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara
          WHERE matnr IN material       AND
                mtart IN mat_type  AND
                matkl IN mat_grp.
    ENDFORM.                    " it_mara_data
    FORM it_marc_data .
    select matnr
           werks
      from marc
      into CORRESPONDING FIELDS OF TABLE  it_marc
            FOR ALL ENTRIES IN it_mara
      WHERE MATNR eq it_mara-matnr AND
            werks eq plant.
    ENDFORM.                    " it_marc_data
    FORM it_makt_data .
      SELECT
            matnr
            maktx
            FROM makt INTO
            CORRESPONDING FIELDS OF TABLE it_makt
            FOR ALL ENTRIES IN it_mara
            WHERE matnr eq it_mara-matnr.
    ENDFORM.                    " it_makt_data
    FORM it_main_data .
    *BREAK-POINT.
      loop at it_mara.
        wa_main-matnr = it_mara-matnr.
        wa_main-mtart = it_mara-mtart.
        wa_main-matkl = it_mara-matkl.
        READ TABLE it_marc WITH KEY  matnr = it_mara-matnr.
        wa_main-werks = it_marc-werks.
        READ TABLE it_t001w WITH KEY   werks = it_marc-werks.
        wa_main-name1 = it_t001w-name1.
        READ TABLE it_makt WITH  KEY matnr = it_mara-matnr.
        wa_main-maktx = it_makt-maktx.
        READ TABLE it_mseg1 INDEX sy-tabix.
          wa_main-mjahr = it_mseg1-mjahr.
          wa_main-menge1 =  it_mseg1-menge.
        READ TABLE it_mseg WITH  KEY matnr = it_mara-matnr.
       READ TABLE it_mseg INDEX sy-tabix.
        wa_main-mblnr = it_mseg-mblnr.
        wa_main-menge = it_mseg-menge.
        READ TABLE it_dept WITH  KEY mblnr = it_mseg-mblnr.
        wa_main-ret_qty = it_dept-menge.
       READ TABLE it_dept1 WITH KEY werks = it_marc-werks.
        READ TABLE it_dept1 INDEX sy-tabix.
        wa_main-ret_*** = it_dept1-menge.
        READ TABLE it_mkpf WITH  KEY mblnr = it_mseg-mblnr.
        wa_main-budat = it_mkpf-budat.
       READ TABLE it_unit1 WITH KEY werks = it_marc-werks.
        READ TABLE it_unit1 INDEX sy-tabix. "BINARY SEARCH.
        wa_main-unit_*** = it_unit1-menge.
        READ TABLE it_unit WITH KEY mblnr = it_mseg-mblnr.
        wa_main-unit_qty = it_unit-menge.
        READ TABLE it_wip WITH  KEY mblnr = it_mseg-mblnr.
        wa_main-wip_qty = it_wip-menge.
       READ TABLE it_wip1 WITH  KEY werks = it_marc-werks.
        READ TABLE it_wip1 INDEX sy-tabix.
        wa_main-wip_qty = it_wip1-menge.
        READ TABLE it_subcon WITH KEY mblnr = it_mseg-mblnr.
        wa_main-sub_qty = it_subcon-menge.
       READ TABLE it_subcon1 WITH KEY werks = it_marc-werks.
        READ TABLE it_subcon1 INDEX sy-tabix.
        wa_main-sub_*** = it_subcon1-menge.
        READ TABLE it_others WITH  KEY mblnr = it_mseg-mblnr.
        wa_main-oth_qty = it_others-menge.
       READ TABLE it_others1 WITH  KEY werks = it_marc-werks.
        READ TABLE it_others1 INDEX sy-tabix.
        wa_main-oth_*** = it_others1-menge.
        APPEND wa_main to it_main.
        CLEAR : wa_main,
                it_mseg1,
                it_main.
        ENDLOOP.
       LOOP at it_mseg1.
         READ TABLE it_mseg INDEX sy-index.
         MOVE-CORRESPONDING it_mseg1 to it_main.
         append LINES OF it_mseg1 TO it_main.
          IF sy-subrc <> 0.
            exit.
            ENDIF.
         ENDLOOP.
    ENDFORM.                    " it_main_data
    FORM display_data .
      SORT it_main by matkl mtart maktx.
      LOOP AT it_main ."WHERE menge eq it_mseg1-menge.
      at NEW matkl.
        FORMAT COLOR 2 INTENSIFIED ON.
        WRITE:/5 it_main-matkl." COLOR 2.
            ENDAT.
          at NEW mtart.
            FORMAT COLOR 3 INTENSIFIED ON.
             WRITE:/15  it_main-mtart." COLOR 3.
             ENDAT.
           at NEW maktx.
             FORMAT COLOR 4 INTENSIFIED OFF.
             WRITE:/ it_main-maktx UNDER 'DESCRIPTION'.
          ENDAT.
          FORMAT COLOR 2 INTENSIFIED ON.
         WRITE:/75 it_main-menge, "it_main-maktx UNDER 'DESCRIPTION',
                95 it_main-menge1,
               125 it_main-ret_qty,
               140 it_main-ret_***,
               160 it_main-unit_qty,
               175 it_main-unit_***,
               195 it_main-wip_qty,
                     210 it_main-wip_***,
                     225 it_main-sub_qty,
                     240 it_main-sub_***,
                     255 it_main-oth_qty,
                     270 it_main-oth_***.
         FORMAT COLOR 2 INTENSIFIED OFF.
         at END OF mtart.
           sum.
           uline.
           WRITE:/30 'MAT. TYPE WISE SUB TOTAL' COLOR COL_GROUP,
                  60 IT_MAIN-MTART COLOR 2,
                  75 '*',it_main-menge,'*' COLOR 4,
                  95 it_main-menge1,
                  125 it_main-ret_qty,
                  140 it_main-ret_***,
                  160 it_main-unit_qty,
                  175 it_main-unit_***,
                  195 it_main-wip_qty,
                     210 it_main-wip_***,
                     225 it_main-sub_qty,
                     240 it_main-sub_***,
                     260 it_main-oth_qty,
                     270 it_main-oth_***.
           uline.
           ENDAT.
           at END OF matkl.
           sum.
           uline.
           WRITE:/30 'GROUPWISE SUB TOTAL ' COLOR 5,
                  60 IT_MAIN-MATKL COLOR 2,
                  75 '*',it_main-menge,'*' COLOR 4,
                  95 it_main-menge1,
                  125 it_main-ret_qty,
                  140 it_main-ret_***,
                  160 it_main-unit_qty,
                  175 it_main-unit_***,
                  195 it_main-wip_qty,
                     210 it_main-wip_***,
                     225 it_main-sub_qty,
                     240 it_main-sub_***,
                     260 it_main-oth_qty,
                     270 it_main-oth_***.
           uline.
           ENDAT.
           at LAST.
             sum.
              uline.
              WRITE:/30 'GROSS TOTAL' COLOR 6,
                     60 IT_MAIN-MATKL COLOR 2,
                     75 '*',it_main-menge,'*' COLOR 4,
                     95 it_main-menge1,
                     125 it_main-ret_qty,
                     140 it_main-ret_***,
                     160 it_main-unit_qty,
                     175 it_main-unit_***,
                     195 it_main-wip_qty,
                     210 it_main-wip_***,
                     225 it_main-sub_qty,
                     240 it_main-sub_***,
                     260 it_main-oth_qty,
                     270 it_main-oth_***.
                uline.
            ENDAT.
             per_qty = it_main-menge.
             ***_qty = it_main-menge1.
             final_total = per_qty + ***_qty.
            at last.
             WRITE:/95 sy-uline(30).
               write:/65 'Final Cumulative Qty >>>>>>>>>',final_total color 6.
               WRITE:/95 sy-uline(30).
             ENDAT.
           FORMAT INTENSIFIED off.
        ENDLOOP.
    ENDFORM.                    " display_data
                        " it_mkpf_data
    FORM it_mseg_data .
      SELECT
        mblnr
        matnr
        ZEILE
        werks
        menge
        bwart
        FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg
        FOR ALL ENTRIES IN it_mara
        WHERE  matnr eq it_mara-matnr AND
               werks eq plant AND
               bwart eq 261." AND bwart eq 262.
    CLEAR it_mseg.
    ENDFORM.                    " it_mseg_data
    FORM it_mkpf_data .
      SELECT
        mblnr
        budat
        FROM mkpf INTO CORRESPONDING FIELDS OF TABLE it_mkpf
        FOR ALL ENTRIES IN it_mseg
        WHERE mblnr eq it_mseg-mblnr."  AND
             budat BETWEEN  Period-low AND period-high.
    ENDFORM.
    FORM it_t001w_data .
        SELECT werks name1 FROM t001w INTO CORRESPONDING FIELDS OF TABLE it_t001w
          FOR ALL ENTRIES IN it_marc
          WHERE werks eq it_marc-werks.
    ENDFORM.                    " it_t001w_data
    FORM it_mseg1_data .
        SELECT
                mblnr
                mjahr
                ZEILE
                matnr
                werks
                menge
                bwart
        FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg1
        FOR ALL ENTRIES IN it_mara
        WHERE  matnr eq it_mara-matnr   AND
               werks eq plant          AND
               mjahr eq Year            AND
              bwart eq 261." AND bwart eq 262.
    CLEAR it_mseg1.
    ENDFORM.                    " it_mseg1_data
    FORM it_dept_data .
      SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_dept
         FOR ALL ENTRIES IN it_mseg
         WHERE mblnr eq it_mseg-mblnr AND
               werks eq it_mseg-WERKS AND
               bwart ge 291 AND bwart le 292.
    ENDFORM.
                        " it_dept_data
    FORM it_dept1_data .
         SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_dept1
         FOR ALL ENTRIES IN it_mara
         WHERE matnr eq it_mara-matnr AND
               werks eq plant         AND
               mjahr eq YEAR          AND
               bwart ge 291 and bwart le 292.
        ENDFORM.                    " it_dept1_data
    FORM it_unit_data .
      SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_unit
         FOR ALL ENTRIES IN it_mseg
         WHERE mblnr eq it_mseg-mblnr AND
               werks eq it_mseg-WERKS AND
               bwart ge 301 AND bwart le 302.
    ENDFORM.                    " it_unit_data
    FORM it_unit_data1 .
        SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_unit1
         FOR ALL ENTRIES IN it_mara
         WHERE matnr eq it_mara-matnr AND
               werks eq plant         AND
               mjahr eq YEAR          AND
               bwart ge 301 AND bwart le 302.
        ENDFORM.                    " it_unit_data1
    FORM it_wip_data .
      SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_wip
         FOR ALL ENTRIES IN it_mseg
         WHERE mblnr eq it_mseg-mblnr AND
               werks eq it_mseg-WERKS AND
               bwart ge 301 AND bwart le 302.
    ENDFORM.                    " it_wip_data
    FORM it_wip_data1 .
         SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_wip1
         FOR ALL ENTRIES IN it_mara
         WHERE matnr eq it_mara-matnr AND
               werks eq plant         AND
               mjahr eq YEAR          AND
               bwart ge 301 AND bwart le 302.
    ENDFORM.                    " it_wip_data1
    FORM it_sub_contract .
        SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_subcon
         FOR ALL ENTRIES IN it_mseg
         WHERE mblnr eq it_mseg-mblnr AND
               werks eq it_mseg-WERKS AND
               bwart eq 541." AND bwart eq 542.
    ENDFORM.                    " it_sub_contract
    FORM it_sub_contract1 .
          SELECT
                mblnr
                mjahr
                ZEILE
                werks
                menge
                bwart
         FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_subcon1
         FOR ALL ENTRIES IN it_mara
         WHERE matnr eq it_mara-matnr AND
               werks eq plant         AND
               mjahr eq YEAR          AND
               bwart eq 541." AND bwart eq 542.
    ENDFORM.                    " it_sub_contract1

    Hi,
    When ever you are using a read statement check sy-subrc is initial or not then only you move the data
    and clear the work area after use.
    The mistake you have done is not clearing the work areas after use and sy-subrc check after read.
    If you fail to do so the data will be clubbed and wrong data will be shown.
    Regards,
    Siva
    Pls reward points if usefull .

Maybe you are looking for

  • AD Provisioning Error

    Hi, I am trying to create an user on AD and with out Auto Save Form Option in AD User Process Definition User is getting created on AD Resource.But when I am trying with Auto Save Form Option in AD User Process Definition I am getting errors.Below is

  • Exception Handling in RFC lookup

    Hi Experts, I have a query in RFC Lookup function working with PI 7.1,  file to Idoc scenario. I am using Enhance Receiver Determination to find the dynamic recivers.Here we have used a Functional Module which gives an output according to the the inp

  • !!HELP!! Source for Technical Reference Material (ERD, API use, etc.)

    To use the OracleApps terminology, is there a TRM for the 309 Portal? (TRM is Technical Reference Manual that shows an ERD, as well as documentation about all of the tables in the application). Is there a listing somewhere of API's and documentation

  • Error when installing exchange server 2010

    hi below is a copy of the error report please can someone help its doing my head in 03/11/2010 04:01:16.0648] [2] Beginning processing. [03/11/2010 04:01:16.0742] [2] Instantiating handler with index 0 for cmdlet extension agent "Admin Audit Log Agen

  • Record Create & change

    Hi , We are mainitaining master data centrally. I can create one record in data manager or I can change existing record in data manager. After the operation I want to syndicate same data to my remote system through XI. For conversion of XML file to I