Material consumption report for workcenter in REM

Hi,
I am using REM. Is it possible to get report on materials consumption for a work center in Repetetive manufacturing.
If possible.Please explain me how.
thanks and regards
Murugesan

Hi,
For MF60, settings should be done in OSPP , here give ur plant & movement type as 311
1) MF60 - in MF60, Global settings icon plays a major role & check the date which ur giving
2) take ur current plan orders and input in plan order option
3) then go to Global settings remove all ticks & execute
Regards
kumar
Edited by: kumar kumar on Sep 19, 2009 1:14 PM

Similar Messages

  • Excess Material Consumption Report - For a Particular Period

    Hi,
    For a particular Time Period, say 30 days, I require excess material consumption report. This report is for the materials ( say ROH, or HALB) that are confirmed through co11n. Taking MTS into consideration with Strategy Group 40, please suggest a standard report (if there is any).
    Regards,
    Pavan

    The T code for viewing the standard report for
    Material Analysis - MCP5.
    Production Order - MCP3.
    Material Usage Analysis - MCRE.
    Please try it.
    Regards
    R.Brahmankar

  • Material consumption report for sales made artcle wise - help urgent

    Hi Folks,
    My client need a report which consist of
    The raw material consumption report
    1. Article wise (material group)
    2. QTY
    3. Value
    4. or all sales made for foreign customers
    5. Business area
    Please help me
    Thanks
    Narasim

    Hi,
    Check COOIS report.
    It will show the consumption order wise just filter Movement type 261.
    Regards,
    Shayam

  • Consumption report for nn stockable material

    hi
    i want to see the consumption report for non stockable material like A,K,

    Hi
    Check it in MB51
    Thanks
    Regards,
    Raman

  • 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.

  • 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 .

  • Consumption Report for Production order(BOM)

    Hi All
    Is there any option to see consumption reports for any particular BOM.

    Hi Richa,
    Unfortunately there is no such a report in SBO. But you can write a report to show the consumption of BOMs using the Query Generator or Wizard. (Thus no SDK work is required).

  • Plan v/s actual materail consumption report for production order - urgent

    Dear all Hi,
    Is there any report or T code from which i can get the plan v/s actual material consumption for a production order or wbs element after completion of order, please suggest / help, the requirement is very urgent.
    thanks in advance

    Hi shaiz,
    You can get that in COOIS tcode
    Select components again List
    then give the plant,Order details
    execute
    You can find 2 fields reqmn qty(nothing but planned) & qty Withdrawn(Actual consumption) in the report
    Hope this hepls
    Rgds,
    SVP

  • Raw Material Consumption Report

    Dear Forum,
    The users want to generate the report from the system that would give the item wise details of the Raw Material Cosnumption for the Period selected. How could we generate the same and also the users want to reconcile the same with the GL Account.
    Your help would be much appreciated.
    Regards

    hi
    first take out which movements ur using for consumption like 201 261 etc
    now goto mb51 here select those movements and materials u need with prorper business area,dates and execute
    now u will get the report for the consumption
    just match this with the GL accts
    u can use transaction type WA also
    regards
    kunal

  • 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.

  • Material Stock Report  for tcode MB5B

    Hello Expert
    I have a SAP report for stock posting date with T-Code as MB5B and
    the report name is RM07MLBD.
    When I enter Material no, plant code , Movement type (101) and selection
    dates for a month, The report is displaying but not break by Movement type instead it is showing all the movement type....?
    Can anyone have idea about this
    REPORT RM07MLBD NO STANDARD PAGE HEADING MESSAGE-ID M7 LINE-SIZE 95.
        REPORT RM07MLBD   (Transaktionscode MB5B)                        *
    correction June 2004 MM                                   "n747306
    wrong the assignment of the MM and FI documents for data  "n747306
    constellation : n MM doc items --> 1 FI doc item          "n747306
    ABAP-Preprocessor removed                                 "n599218 A
    - this version is for release 4.6C and higher             "n599218 A
    - process database table OBEW always                      "n599218 A
    - IS-OIL specific functions :                             "n599218 A
      - define IS-OIL workings fields                         "n599218 A
      - transport and process these fields only when          "n599218 A
        structure MSEG comprise these fields                  "n599218 A
    Improvements :                       Dec. 2003 MM         "n599218
    - print the page numbers                                  "n599218
                                                              "n599218
    - send warnings and error messages only when report is    "n599218
      launched / advoid warnings when user changes entries on "n599218
      the selection screen                                    "n599218
    - send warning M7 689 when user does not restrict the     "n599218
      database in dialog or print mode                        "n599218
    - send warning M7 393 when user deletes the initial       "n599218
      display variant                                         "n599218
                                                              "n599218
    - allow to process the fields MAT_KDAUF, MAT_KDPOS, and   "n599218
      MAT_PSPNR from release 4.5B and higher                  "n599218
                                                              "n599218
    - show the current activity and the progress              "n599218
                                                              "n599218
    - error message 'programmfehler' improved                 "n599218
                                                              "n599218
    - new categories for scope of list                        "n599218
                                                              "n599218
    - use function module for database commit for the update  "n599218
      of the parameters in table ESDUS. This allows to record "n599218
      this transaction for a batch input session using        "n599218
      transaction SHDB                                        "n599218
                                                              "n599218
    - reset the entries for plant when valuation level is     "n599218
      is company code and mode is valuated stock              "n599218
                                                              "n599218
    - enable this report to run in the webreporting mode      "n599218
    Dec. 2002 MM                                              "n571473
    the definition of the selection screen moved from include "n571473
    RM07MLBP into this report                                 "n571473
    Sept 2002 MM                                              "n555246
    log function tax auditor                                  "n555246
    note 547170 :                              August 2002 MM "n547170
    - representation of tied empties improved                 "n547170
      active this function automatically in retail systems    "n547170
    - FORM routines without preprocessor commands and without "n547170
      text elements moved to the new include reports          "n547170
      RM07MLBD_FORM_01and RM07MLBD_FORM_02                    "n547170
    - the function module FI_CHECK_DATE of note 486477 will   "n547170
      be processed when it exists                             "n547170
    - function and documentation of parameter XONUL improved  "n547170
    - display MM documents with MIGO or MB03 depending from   "n547170
      the release                                             "n547170
    - get and save the parameters per user in dialog mode     "n547170
      only in release >= 4.6                                  "n547170
    the following items were improved with note 497992        "n497992
    - wrong results when remaining BSIM entries contain       "n497992
      an other quantity unit as material master MEINS         "n497992
    - improve check FI summarization                          "n497992
    - the messages M7 390, M7 391, and M7 392                 "n497992
    - definition of field g_f_repid for all releases          "n497992
    - incomplete key for access of internal table IT134M      "n497992
      causes wrong plant selection                            "n497992
    - the function "no reversal movement" did not surpress    "n497992
      the original movements; fields "SJAHR" was moved from   "n497992
      from report RM07MLBD_CUST_FIELDS to RM07MLBD            "n497992
    - process valuated subcontractor stock from database      "n497992
      table OBEW if it exists                                 "n497992
    - if FI summarization is active process warning M7 390    "n497992
      for stock type = valuated stock                         "n497992
    - the user wants to restrict the movement type : process  "n497992
      warning M7 391                                          "n497992
    - the user wants to surpress the reversal movements :     "n497992
      process warning M7 392                                  "n497992
    - consider special gain/loss-handling of IS-OIL           "n497992
    - automatic insert of field WAERS currency key into the   "n497992
      field catalogue :                                       "n497992
      - at least one ref. field is active -> WAERS active     "n497992
      - all reference fields are hidden   -> WAERS hidden     "n497992
    - the length of sum fields for values was increased       "n497992
    - customizing for the selection of remaining BSIM entries "n497992
    - customizing for the processing of tied empties          "n497992
    separate time depending authorization for tax auditor     "n486477
    additional fields are displayed in wrong format           "n480130
    report RM07MLBD and its includes improved  Nov 2001       "n451923
    - merging FI doc number into table G_T_MSEG_LEAN improved "n451923
    - handling of the short texts improved                    "n451923
    - some types and data definitions -> include RM07MLDD     "n451923
    error for split valuation and valuated special stock      "n450764
    process 'goods receipt/issue slip' as hidden field        "n450596
    error at start date : material without stock has value    "n443935
    wrong results for docs with customer consignment "W"      "n435403
    error during data selection for plants                    "n433765
    report RM07MLBD and its includes improved  May 10th, 2001 "n400992
    !!! IMPORTANT : DO NOT CHANGE OR DELETE THE COMMENT LINES !!!        *
    - consider the material number during looking for FI documents
    - field "g_cust_color" in include report "RM07MLBD_CUST_FIELDS"
      allows the customer to activate or inactivate the colors in the
      lines with the documents.
    - error during calcuation of start stock for special stock "M"
    - valuted stocks required : no documents found ? continue and
      process empty document table
    - the length of sum fields for quantities has been increased
      to advoid decimal overflow
    - table ORGAN is replaced by G_T_ORGAN
      - it is filled by the following ways :
        - at process time at selection screen if the
          user wants the selection via cc or plant
        - otherwise after the database selection of the stock
          tables
      - it contains less data fields
      - it contains all entries twice, for binary search
        with plant or valuation area
    - selection of databases MKPF and MSEG in one SELECT
      command with an inner JOIN
    - authority checks after the database selections
    - result of database selection from the both database tables
      MSEG and MKPF in working table G_F_MSEG_LEAN instead of
      the tables IMSEG and IMKPF
    - the number of processed data fields was reduced
    - the user has the possibility to increase the number of
      the processed fields deleting the '*' in the types-command
      in include report RM07MLBD_CUST_FIELDS
    - the creation of the field catalog for the ALV considers
      only the fields of structure G_S_MSEG_LEAN
    - the new table G_T_BELEG contains the results for the ALV.
      the number of fields of table G_T_BELEG corresponds with
      the number of fields of table G_T_MSEG_LEAN.
    - the functions "define breakdown" and "choose" are inactivated
      in the menue, because they are are not carried out correctly
      in all blocks of the list
        Anzeige der Materialbestände in einem Zeitintervall              *
    Der Report gliedert sich im wesentlichen in folgende Verarbeitungs- *
    blöcke:                                                             *
    1) Definition des Einstiegsbildes und Vorbelegung einzelner         *
        Selektionsfelder, sowie Prüfung der eingegebenen Selektions-     *
        parameter und Berechtigungsprüfung                               *
    2) Lesen der aktuellen Bestandswerte                                *
    3) Lesen und Verarbeiten der Materialbelege                         *
    4) Berechnung der Bestandswerte zu den vorgegebenen Datümern        *
    5) Ausgabe der Bestände und Materialbelege                          *
    *eject
    *# APP_CALL_DECLARE TEST
    this definitions depend on the release
    TYPE-POOLS:  IMREP,                   " Typen Bestandsführungsreporting
                 SLIS.                    " Typen Listviewer
      for the selection of the reversal movements only in release >=45B
          DATA: BEGIN OF STORNO OCCURS 0,
                  MBLNR LIKE MSEG-MBLNR,
                  MJAHR LIKE MSEG-MJAHR,
                  ZEILE LIKE MSEG-ZEILE,
                  SMBLN LIKE MSEG-SMBLN,
                  SJAHR LIKE MSEG-SJAHR,
                  SMBLP LIKE MSEG-SMBLP,
                END OF STORNO.
    include:  rm07mldd,     " reportspezifische Datendefinitionen
              rm07grid.     " Gitternetz, Formatierung, Farbgebung
    INCLUDE RM07APP1.     "ABAP-PREPROCESSOR  "TEST
    "n571473
    define the selection screen here                          "n571473
    "n571473
    SELECTION-SCREEN BEGIN OF BLOCK Database-selection
              WITH FRAME TITLE TEXT-001.
    Text-001: Datenbankabgrenzungen
    SELECT-OPTIONS: MATNR FOR MARD-MATNR MEMORY ID MAT
                                         MATCHCODE OBJECT MAT1,
                    BUKRS FOR T001-BUKRS  MEMORY ID BUK,
                    WERKS FOR T001W-WERKS MEMORY ID WRK,
                    LGORT FOR T001L-LGORT,
                    CHARG FOR MCHB-CHARG,
                    BWTAR FOR MBEW-BWTAR,
                    BWART FOR MSEG-BWART.
    PARAMETERS SOBKZ LIKE MSEG-SOBKZ.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS: DATUM FOR MKPF-BUDAT NO-EXTENSION.
    Datumsintervall für Selektion
    SELECTION-SCREEN END OF BLOCK Database-selection.
    SELECTION-SCREEN BEGIN OF BLOCK BESTANDSART
    WITH FRAME TITLE TEXT-002.
    Text-002: Bestandsart
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS LGBST LIKE AM07M-LGBST RADIOBUTTON GROUP BART DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 4(50) TEXT-010 FOR FIELD LGBST.
    Text-010: Lagerort-/Chargenbestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS BWBST LIKE AM07M-BWBST RADIOBUTTON GROUP BART.
    SELECTION-SCREEN COMMENT 4(50) TEXT-011 FOR FIELD BWBST.
    Text-011: bewerteter Bestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS SBBST LIKE AM07M-SBBST RADIOBUTTON GROUP BART.
    SELECTION-SCREEN COMMENT 4(50) TEXT-012 FOR FIELD SBBST.
    Text-012: Sonderbestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK BESTANDSART.
    improved definition of parameters for scope of list       "n599218
    SELECTION-SCREEN BEGIN OF BLOCK listumfang
      with frame title text-003.  "Listumfang
    the following 3 parameters became obsolete do not use     "n599218
    anymor. They are still here to inform the user about      "n599218
    that he is using old variants or SUBMIT commands          "n599218
      PARAMETERS :                                              "n599218
        XONUL  LIKE AM07M-XONUL            no-display,          "n599218
        XVBST  LIKE AM07M-XVBST            no-display,          "n599218
        XNVBST LIKE AM07M-XNVBS            no-display.          "n599218
    7 new categories for the scope of list                    "n599218
                                                              "n599218
    cat. I docs I stock on   I    I stock on I Parameter      "n599218
         I      I start date I    I end date I                "n599218
    ---+--+--------++------+--------      "n599218
    1   I yes  I =  zero    I =  I =  zero  I pa_wdzer       "n599218
    2   I yes  I =  zero    I <> I <> zero  I pa_wdzew       "n599218
    3   I yes  I <> zero    I <> I =  zero  I pa_wdwiz       "n599218
    4   I yes  I <> zero    I <> I <> zero  I pa_wdwuw       "n599218
    5   I yes  I <> zero    I =  I <> zero  I pa_wdwew       "n599218
         I      I            I    I          I                "n599218
    6   I no   I =  zero    I =  I =  zero  I pa_ndzer       "n599218
    7   I no   I <> zero    I =  I <> zero  I pa_ndsto       "n599218
                                                              "n599218
    definition of the pushbutton : show or hide the following "n599218
    parameters for the scope of list                          "n599218
      SELECTION-SCREEN PUSHBUTTON /1(20) PB_LIU                 "n599218
                                 USER-COMMAND LIU.              "n599218
                                                                "n599218
    text line : materials with movements                      "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN COMMENT 1(55) TEXT-072                 "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    with movements / start = zero  =  end = zero              "n599218
    1   I yes  I =  zero    I =  I =  zero  I pa_wdzer       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_wdzer    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      text-083 : no opening stock ; no closing stock          "n599218
        SELECTION-SCREEN COMMENT 5(70) text-083                 "n599218
                                 FOR FIELD pa_wdzer             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    with movements / start = zero  =  end <> zero             "n599218
    2   I yes  I =  zero    I <> I <> zero  I pa_wdzew       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_wdzew    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      text-084 : no opening stock ; with closing stock        "n599218
        SELECTION-SCREEN COMMENT 5(70) text-084                 "n599218
                                 FOR FIELD pa_wdzew             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    with movements / start stock <> 0 / end stock = 0         "n599218
    3   I yes  I <> zero    I <> I =  zero  I pa_wdwiz       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_wdwiz    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      text-085 : with opening stock ; no closing stock        "n599218
        SELECTION-SCREEN COMMENT 5(70) text-085                 "n599218
                                 FOR FIELD pa_wdwiz             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    with movements / with start and end stocks / different    "n599218
    4   I yes  I <> zero    I <> I <> zero  I pa_wdwuw       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_wdwuw    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      with opening stock ; with closing stock ; changed       "n599218
        SELECTION-SCREEN COMMENT 5(70) text-086                 "n599218
                                 FOR FIELD pa_wdwuw             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    with movements / with start and end stock / equal         "n599218
    5   I yes  I <> zero    I =  I <> zero  I pa_wdwew       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_wdwew    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      with opening stock ; with closing stock ; non-changed   "n599218
        SELECTION-SCREEN COMMENT 5(70) text-087                 "n599218
                                 FOR FIELD pa_wdwew             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    text line : materials without movements                   "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN COMMENT 1(55) TEXT-073                 "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    materials without movements / stocks = zero               "n599218
    6   I no   I =  zero    I =  I =  zero  I pa_ndzer       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_ndzer    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      text-083 : no opening stock ; no closing stock          "n599218
        SELECTION-SCREEN COMMENT 5(70) text-083                 "n599218
                                 FOR FIELD pa_ndzer             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    materials without movements / with start or end stock     "n599218
    7   I no   I <> zero    I =  I <> zero  I pa_ndsto       "n599218
      SELECTION-SCREEN BEGIN OF LINE.                           "n599218
        SELECTION-SCREEN POSITION 2.                            "n599218
        PARAMETERS : pa_ndsto    LIKE AM07M-MB5B_XONUL          "n599218
                                 modif id liu.                  "n599218
      with opening stock ; with closing stock ; non-changed   "n599218
        SELECTION-SCREEN COMMENT 5(70) text-087                 "n599218
                                 FOR FIELD pa_ndsto             "n599218
                                 modif id liu.                  "n599218
      SELECTION-SCREEN END OF LINE.                             "n599218
                                                                "n599218
    SELECTION-SCREEN END OF BLOCK listumfang.
    SELECTION-SCREEN BEGIN OF BLOCK EINSTELLUNGEN
       WITH FRAME TITLE TEXT-068.  "Settings
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS XSUM LIKE AM07M-XSUM.
    SELECTION-SCREEN COMMENT 4(50) TEXT-019 FOR FIELD XSUM.
    Text-019: nur Summen
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS XCHAR LIKE AM07M-XCHRG.
    SELECTION-SCREEN COMMENT 4(50) TEXT-015 FOR FIELD XCHAR.
    Text-015: nur chargenpflichtige Materialien
    Das Kennzeichen 'xchar' bestimmt die Art der Listausgabe entweder
    auf Material- oder Chargenebene.
    SELECTION-SCREEN END OF LINE.
    the function "No reversal movements" is only         "n571473
    available from relaese 4.5B and higher               "n571473
    ( TEXT-026 : No reversal movements )                 "n571473
        SELECTION-SCREEN BEGIN OF LINE.                    "n571473
          SELECTION-SCREEN POSITION 1.                     "n571473
          PARAMETERS NOSTO LIKE AM07M-NOSTO.               "n571473
          SELECTION-SCREEN COMMENT 4(50) TEXT-026          "n571473
                                 FOR FIELD NOSTO.          "n571473
        SELECTION-SCREEN END OF LINE.                      "n571473
    SELECTION-SCREEN END OF BLOCK EINSTELLUNGEN.
    SELECTION-SCREEN BEGIN OF BLOCK LISTE WITH FRAME TITLE TEXT-040.
    PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK LISTE.
    *eject
    new data definitions
    working fields for reading structures from DDIC           "n599218 A
    and check whether IS-OIL is active                        "n599218 A
    types : stab_x031l           type standard table of x031l   "n599218 A
                                 with default key.              "n599218 A
                                                                "n599218 A
    data : g_s_x031l             type x031l,                    "n599218 A
           g_t_x031l             type stab_x031l.               "n599218 A
                                                                "n599218 A
    data : g_f_dcobjdef-name     like dcobjdef-name,            "n599218 A
           g_flag_is_oil_active(01)        type c,              "n599218 A
           g_cnt_is_oil          type i.                        "n599218 A
    contains the a structure with the max. number of fields of
    the database table MSEG, but those lines are comment lines
    with a '*'. The customer can achtivate those lines.
    The activated fields will be selected from the database table
    and are hidden in the list. With the settings in the display
    variant the can be shown.
    INCLUDE                      RM07MLBD_CUST_FIELDS.
    common types structure for working tables
    a) g_t_mseg_lean   results form database selection
    b) g_t_beleg       data table for ALV
    TYPES : BEGIN OF STYPE_MSEG_LEAN,
              MBLNR             LIKE      MKPF-MBLNR,
               MJAHR             LIKE      MKPF-MJAHR,
               VGART             LIKE      MKPF-VGART,
               BLART             LIKE      MKPF-BLART,
               BUDAT             LIKE      MKPF-BUDAT,
               CPUDT             LIKE      MKPF-CPUDT,
               CPUTM             LIKE      MKPF-CPUTM,
               USNAM             LIKE      MKPF-USNAM,
    process 'goods receipt/issue slip' as hidden field        "n450596
               XABLN             LIKE      MKPF-XABLN,          "n450596
               LBBSA             LIKE      T156M-LBBSA,
               BWAGR             LIKE      T156S-BWAGR,
               BUKRS             LIKE      T001-BUKRS,
               BELNR             LIKE      BKPF-BELNR,
               GJAHR             LIKE      BKPF-GJAHR,
               WAERS             LIKE      MSEG-WAERS,
               ZEILE             LIKE      MSEG-ZEILE,
               BWART             LIKE      MSEG-BWART,
               MATNR             LIKE      MSEG-MATNR,
               WERKS             LIKE      MSEG-WERKS,
               LGORT             LIKE      MSEG-LGORT,
               CHARG             LIKE      MSEG-CHARG,
               BWTAR             LIKE      MSEG-BWTAR,
               KZVBR             LIKE      MSEG-KZVBR,
               KZBEW             LIKE      MSEG-KZBEW,
               SOBKZ             LIKE      MSEG-SOBKZ,
               KZZUG             LIKE      MSEG-KZZUG,
               BUSTM             LIKE      MSEG-BUSTM,
               BUSTW             LIKE      MSEG-BUSTW,
               MENGU             LIKE      MSEG-MENGU,
               WERTU             LIKE      MSEG-WERTU,
               SHKZG             LIKE      MSEG-SHKZG,
               MENGE             LIKE      MSEG-MENGE,
               MEINS             LIKE      MSEG-MEINS,
               DMBTR             LIKE      MSEG-DMBTR,
               DMBUM             LIKE      MSEG-DMBUM,
               XAUTO             LIKE      MSEG-XAUTO,
               KZBWS             LIKE      MSEG-KZBWS,
             special flag for retail                          "n497992
               retail(01)        type c,                        "n497992
    define the fields for the IO-OIL specific functions       "n599218 A
             mseg-oiglcalc     CHAR          1                "n599218 A
             mseg-oiglsku      QUAN         13                "n599218 A
               oiglcalc(01)      type  c,                       "n599218 A
               oiglsku(07)       type  p  decimals 3,           "n599218 A
               insmk             like      mseg-insmk,          "n599218 A
    the following fields are used for the selection of
    the reversal movements
              SMBLN    LIKE      MSEG-SMBLN,    " No. doc
              SJAHR    LIKE      MSEG-SJAHR,    " Year          "n497992
              SMBLP    LIKE      MSEG-SMBLP.    " Item in doc
    additional fields : the user has the possibility to activate
    these fields in the following include report
              INCLUDE           TYPE      STYPE_MB5B_ADD.
    TYPES : END OF STYPE_MSEG_LEAN.
    TYPES: STAB_MSEG_LEAN        TYPE STANDARD TABLE OF STYPE_MSEG_LEAN
                                 WITH KEY MBLNR MJAHR.
    data tables with the results for the ALV
    TYPES : BEGIN OF STYPE_BELEGE.
              INCLUDE            TYPE      STYPE_MSEG_LEAN.
    TYPES :   FARBE TYPE SLIS_T_SPECIALCOL_ALV.
    TYPES : END OF STYPE_BELEGE.
    TYPES : STAB_BELEGE          TYPE STANDARD TABLE OF STYPE_BELEGE
                                 WITH KEY  BUDAT MBLNR ZEILE.
    DATA : G_T_BELEGE            TYPE   STAB_BELEGE WITH HEADER LINE,
           G_T_BELEGE1           TYPE   STAB_BELEGE WITH HEADER LINE.
    global working areas data from MSEG and MKPF
    FIELD-SYMBOLS :        TYPE STYPE_MSEG_LEAN.
    DATA : G_S_MSEG_LEAN         TYPE STYPE_MSEG_LEAN,
           G_S_MSEG_UPDATE       TYPE STYPE_MSEG_LEAN,          "n443935
           G_T_MSEG_LEAN         TYPE STAB_MSEG_LEAN.
    working table for the control break                       "n451923
    types : begin of stype_mseg_work.                           "n451923
              include            type      stype_mseg_lean.     "n451923
    types :    tabix             like      sy-tabix,            "n451923
            end of stype_mseg_work,                             "n451923
                                                                "n451923
            stab_mseg_work       type standard table of         "n451923
                                 stype_mseg_work                "n451923
                                 with default key.              "n451923
                                                                "n451923
    data : g_t_mseg_work         type  stab_mseg_work,          "n443935
           g_s_mseg_work         type  stype_mseg_work.         "n443935
    working table for the requested field name from MSEG and MKPF
    TYPES: BEGIN OF STYPE_FIELDS,
               FIELDNAME           TYPE      NAME_FELD,
           END OF STYPE_FIELDS.
    TYPES: STAB_FIELDS           TYPE STANDARD TABLE OF STYPE_FIELDS
                                 WITH KEY FIELDNAME.
    DATA: G_T_MSEG_FIELDS        TYPE      STAB_FIELDS,
          G_S_MSEG_FIELDS        TYPE      STYPE_FIELDS.
    working table for the requested numeric fields of MSEG
    types : begin of stype_color_fields,
               FIELDNAME           TYPE      NAME_FELD,
             type(01)            type c,
           end of stype_color_fields,
           stab_color_fields     type standard table of
                                 stype_color_fields
                                 with default key.
    data: g_t_color_fields       type      stab_color_fields
                                 with header line.
    DATA: BEGIN OF IMSWEG OCCURS 1000,
            MBLNR LIKE MSEG-MBLNR,
            MJAHR LIKE MSEG-MJAHR,
            ZEILE LIKE MSEG-ZEILE,
            MATNR LIKE MSEG-MATNR,
            CHARG LIKE MSEG-CHARG,
            BWTAR LIKE MSEG-BWTAR,
            WERKS LIKE MSEG-WERKS,
            LGORT LIKE MSEG-LGORT,
            SOBKZ LIKE MSEG-SOBKZ,
            BWART LIKE MSEG-BWART,
            SHKZG LIKE MSEG-SHKZG,
            XAUTO LIKE MSEG-XAUTO,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            DMBTR LIKE MSEG-DMBTR,
            DMBUM LIKE MSEG-DMBUM,
            BUSTM LIKE MSEG-BUSTM,
            BUSTW LIKE MSEG-BUSTW,                               "147374
    define the fields for the IO-OIL specific functions       "n599218 A
          mseg-oiglcalc        CHAR          1                "n599218 A
          mseg-oiglsku         QUAN         13                "n599218 A
            oiglcalc(01)         type  c,                       "n599218 A
            oiglsku(07)          type  p  decimals 3,           "n599218 A
            insmk                like      mseg-insmk,          "n599218 A
          END OF IMSWEG.
    User settings for the checkboxes                          "n547170
      DATA: oref_settings TYPE REF TO cl_mmim_userdefaults.     "n547170
    *eject
    HAUPTPROGRAMM *********************************
    F4-Hilfe für Reportvariante -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    "n599218
    INITIALIZATION                                            "n599218
    "n599218
                                                                "n599218
    pay attentions : this process time will not be processed  "n599218
    in the webreporting mode                                  "n599218
    INITIALIZATION.
    PERFORM APP_PROCESS USING 'ME'. "TEST
      PERFORM initialisierung.
    get the parameters from the last run                      "n547170
      perform                    esdus_get_parameters.          "n547170
    set flag when INITILIZATION is processed
      move  'X'        to  g_flag_initialization.
    "n599218
    AT SELECTION-SCREEN                                       "n599218
    "n599218
    Prüfung der eingegebenen Selektionsparameter, -
    Berechtigungsprüfung -
    AT SELECTION-SCREEN.
    the following 3 parameters XONUL, XVBST, and XNVBST       "n599218
    became obsolete; send error when they should be filled.   "n599218
    This could be possible if the user works with old         "n599218
    selection variants or this report is launched by a        "n599218
    SUBMIT command                                            "n599218
      if  XONUL  is initial  and                                "n599218
          XVBST  is initial  and                                "n599218
          XNVBST is initial.                                    "n599218
    ok, the old parameters are empty                         "n599218
      else.                                                     "n599218
      text-088 : note 599218 : obsolete parameter used        "n599218
        MESSAGE E895             with  text-088.                "n599218
      endif.
    did the user hit the pushbutton "Category" ?              "n599218
      case     SSCRFIELDS-UCOMM.                                "n599218
        when  'LIU '.                                           "n599218
        yes, the pushbutton "Category" was hit                "n599218
          IF  g_flag_status_liu  =  C_HIDE.                     "n599218
          show the 7 parameters on the selection srceen       "n599218
            MOVE  C_SHOW         TO  g_flag_status_liu.         "n599218
          ELSE.                                                 "n599218
          hide the 7 paramaters                               "n599218
            MOVE  C_HIDE         TO  g_flag_status_liu.         "n599218
          ENDIF.                                                "n599218
      ENDcase.                                                  "n599218
                                                                "n599218
    go on only if the user wants to launch this report        "n599218
      check : sy-ucomm = 'ONLI'  or                             "n599218
              sy-ucomm = 'PRIN'  or                             "n599218
              sy-ucomm = 'SJOB'.                                "n599218
      PERFORM eingaben_pruefen.
    check whether FI summarization is active and other        "n547170
    restrictions could deliver wrong results                  "n547170
      perform                    f0800_check_restrictions.      "n547170
    - the user wants to surpress the reversal movements :     "n497992
      process warning M7 392                                  "n497992
        IF NOT NOSTO IS INITIAL.                                "n497992
      emerge warning ?                                        "n497992
          CALL FUNCTION            'ME_CHECK_T160M'             "n497992
              EXPORTING                                         "n497992
                I_ARBGB          = 'M7'                         "n497992
                I_MSGNR          = '392'                        "n497992
              EXCEPTIONS                                    

    Please read the KBA document  2012912 - Changeablility of the field "material group" in purchasing documents
    It clearly says that material group can't be changed in case you will use material master in purchase order.
    So, it is clear that you can't use different material group for material master in purchase order.
    For stock report, system will only show you the material group which is assigned to the material master (MARA-MATKL). System will not look into the purchase order section (like EKPO).

  • Trading Partner wise material consumption report

    Dear Freinds,
    I want to know can we prepare  Trading partner wise material consumtion report  in BW . This information will help in intercompany elimination.
    we had activated Trading partner info in Vendor master.
    Pleasee some ways to get the information.

    HI
    Have you try Inventory Audit Report.
    I think that will be useful for you.
    regards
    kamlesh

  • Raw material cost report for production of finished produt.?(urgent..REWARD

    Hi,
    any one can help in this issue.
    i am not getting the raw materila cost & manfacture conversion cost for  for the bom of FG - SFG - SFG - SFG- RAW
    FG - finished goods,
    SFG - semi finished goods
    RAW - raw material.
    plz provide the solution.
    raw material  and manfacture conversion cost is calculated in PERFORM z_process_data. subroutine.
    REPORT z_co_production_cost_nsk.
    TABLES: afko, bkpf, t001w , caufv.
    TYPE-POOLS: kkblo,
                slis.
    DATA: d_datefrom LIKE sy-datum,
          d_dateto LIKE sy-datum,
          d_repid LIKE sy-repid,
          d_uname LIKE sy-uname,
          d_returncode TYPE i,
          d_tabix TYPE i,
          d_kokrs LIKE tka01-kokrs,
          d_waers LIKE tka01-waers,
          wa_fieldcatalog TYPE slis_fieldcat_main,
          wa_listevents TYPE slis_alv_event,
          wa_listlayout TYPE slis_layout_alv,
          wa_print_info TYPE slis_print_alv,
          wa_listheader TYPE slis_listheader,
          d_headerlines TYPE i.
    DATA: BEGIN OF t_caufv OCCURS 0,
            aufnr TYPE caufv-aufnr,
            werks TYPE caufv-werks,
            objnr TYPE covp-objnr,
            gamng TYPE caufv-gamng,
            plnbez TYPE caufv-plnbez,
            rsnum TYPE caufv-rsnum,
          END OF t_caufv.
    *Added by Anand Bothra on 24/11/2003
    DATA: t_ab_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
    DATA: t_temp_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_afpo OCCURS 0,
            aufnr TYPE afpo-aufnr,
            posnr TYPE afpo-posnr,
            wemng TYPE afpo-wemng,
            amein TYPE afpo-amein,
            charg TYPE afpo-charg,
          END OF t_afpo.
    DATA: BEGIN OF t_afpo1 OCCURS 0,
            aufnr TYPE afpo-aufnr,
            refaufnr TYPE afpo-aufnr,
            objnr TYPE caufv-objnr,
            rsnum TYPE afko-rsnum,
            wemng TYPE afpo-wemng,
            werks TYPE afpo-dwerk,
            charg TYPE afpo-charg,
          END OF t_afpo1.
    DATA: BEGIN OF t_makt OCCURS 0,
            matnr TYPE makt-matnr,
            maktx TYPE makt-maktx,
          END OF t_makt.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv,
          t_listevents TYPE slis_t_event,
          t_sortsequence TYPE slis_t_sortinfo_alv,
          t_listheader TYPE slis_t_listheader.
    DATA: BEGIN OF t_production_costs OCCURS 0,
            objnr TYPE covp-objnr,       " Object Number
            kstar TYPE covp-kstar,       " Cost Element
            wkgbtr TYPE covp-wkgbtr,     " Cost of Line Item in CO area curr
            mbgbtr TYPE covp-mbgbtr,     " Quantity of Line Item
            matnr TYPE covp-matnr,       " Material Number
            kokrs TYPE covp-kokrs,       " Controlling Area
            belnr TYPE covp-belnr,       " Cost Accounting Document
            buzei TYPE covp-buzei,       " Item Number in Document
          END OF t_production_costs.
    DATA: BEGIN OF t_production_costs1 OCCURS 0,
            objnr TYPE covp-objnr,       " Object Number
            kstar TYPE covp-kstar,       " Cost Element
            wkgbtr TYPE covp-wkgbtr,     " Cost of Line Item in CO area curr
            mbgbtr TYPE covp-mbgbtr,     " Quantity of Line Item
            kokrs TYPE covp-kokrs,       " Controlling Area
            belnr TYPE covp-belnr,       " Cost Accounting Document
            buzei TYPE covp-buzei,       " Item Number in Document
          END OF t_production_costs1.
    DATA t_production_costs2 LIKE t_production_costs1
         OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_suborders OCCURS 0,
            aufnr TYPE caufv-aufnr,
            prevaufnr TYPE caufv-aufnr,
            objnr TYPE covp-objnr,
            rsnum TYPE caufv-rsnum,
          END OF t_suborders.
    DATA: BEGIN OF t_outputtab OCCURS 0,
            plnbez LIKE afko-plnbez,             " Material Number
            objnr LIKE caufv-objnr,              " Object Number
            maktx LIKE makt-maktx,               " Material Description
            charg LIKE afpo-charg,               " Batch Number
            aufnr LIKE afko-aufnr,               " Production Order Number
            gamng LIKE caufv-gamng,              " Total Order Quantity
            wemng LIKE afpo-wemng,               " Goods Receipt Quantity
            amein LIKE afpo-amein,               " Unit of Measure
            yield TYPE p DECIMALS 2,             " Percentage Yield
            totalrmcost TYPE p DECIMALS 2,       " Total Raw Material Cost
            totalpmcost TYPE p DECIMALS 2,       " Total Packing Mat. Cost
            mfgconvcost TYPE p DECIMALS 2,       " Manu. Conversion Cost
            pkgconvcost TYPE p DECIMALS 2,       " Packing Conv. Cost
            rmperunit TYPE p DECIMALS 2,         " Raw Cost per unit
            pmperunit TYPE p DECIMALS 2,         " Pack Mat cost per unit
            ccperunit TYPE p DECIMALS 2,         " Conv Cost per unit
            totperunit TYPE p DECIMALS 2,        " Total Cost per unit
            waers LIKE tka01-waers,              " Currency Key for CO Area
          END OF t_outputtab.
    *Added by Anand Bothra on 24/11/2003.
    DATA: t_ab_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE,
          t_temp_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE.
    BEGIN OF INSERTION VIP110703
    DATA:wa_prev_outputtab LIKE LINE OF t_outputtab,
         wa_production_costs LIKE LINE OF t_production_costs.
    DATA:prev_totmatqty TYPE p DECIMALS 2,
         prev_tot_mfgconv_cst TYPE p DECIMALS 2,
         grand_mat_qty TYPE p DECIMALS 2 ,
         tmp_aufnr TYPE caufv-aufnr.
    DATA: BEGIN OF t_suborders_propcost OCCURS 0,
            aufnr TYPE caufv-aufnr,
            prevaufnr TYPE caufv-aufnr,
            objnr TYPE covp-objnr,
            rsnum TYPE caufv-rsnum,
            proprmcost TYPE p DECIMALS 2,
            prop_mfg_convcost TYPE p DECIMALS 2,
          END OF t_suborders_propcost.
    DATA: wa_suborders LIKE LINE OF t_suborders.
    END   OF INSERTION VIP110703
    BEGIN OF INSERTION VIP111003
    DATA: prev_aufnr TYPE caufv-aufnr,
          prev_matnr TYPE mara-matnr,
          curr_matnr TYPE mara-matnr.
    DATA: bln_suborder ,
          ratio TYPE p DECIMALS 5.
    BEGIN OF INSERTION VIP111003
    *Added by Anand Bothra on 28/11/2003
    DATA: d_flag TYPE c.
    SELECTION-SCREEN BEGIN OF BLOCK zblock1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_plnbez FOR afko-plnbez,
                    s_aufnr FOR afko-aufnr,
    "Added By Vivek on 29.11.2005
                    s_auart FOR caufv-auart obligatory.
    PARAMETERS p_werks LIKE t001w-werks OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK zblock1.
    SELECTION-SCREEN BEGIN OF BLOCK zblock2 WITH FRAME TITLE text-002.
    SELECT-OPTIONS: s_monat FOR bkpf-monat NO-EXTENSION OBLIGATORY.
    PARAMETERS p_gjahr LIKE bkpf-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK zblock2.
    SELECTION-SCREEN BEGIN OF BLOCK zblock3 WITH FRAME TITLE text-022.
    PARAMETERS: p_detsum RADIOBUTTON GROUP rad,
                p_sum RADIOBUTTON GROUP rad.
    SELECTION-SCREEN END OF BLOCK zblock3.
    INITIALIZATION.
      d_repid = sy-repid.
      d_uname = sy-uname.
    p_werks = 'G001'.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
       IF screen-name EQ 'P_WERKS'.
         screen-input = 0.
         MODIFY SCREEN.
       ENDIF.
    ENDLOOP.
    AT SELECTION-SCREEN ON s_monat.
      IF s_monat-high IS INITIAL.
        IF NOT ( s_monat-low BETWEEN 1 AND 12 ).
          MESSAGE e398(00) WITH text-023 text-024 space space.
        ENDIF.
      ELSE.
        IF ( ( s_monat-low LT 1 ) OR ( s_monat-high GT 12 ) ).
          MESSAGE e398(00) WITH text-023 text-024 text-025 space.
        ENDIF.
      ENDIF.
    START-OF-SELECTION.
      PERFORM z_get_period_dates.
      PERFORM z_select_prod_orders.
      PERFORM z_select_prod_costs.
      PERFORM z_select_addl_prod_costs.
      PERFORM z_select_mat_desc.
    END-OF-SELECTION.
      IF d_returncode EQ 0.
        PERFORM z_process_data.
    *Added by Anand Bothra on 24/11/2004.
        PERFORM z_select_to_print.
        PERFORM z_prepare_fieldcat.
        PERFORM z_get_alv_events.
        PERFORM z_define_sortsequence.
        PERFORM z_define_layout.
        PERFORM z_display_list.
    *Added by Anand Botra on 25/11/2003.
        PERFORM z_export_to_excel.
        PERFORM z_send_mail_and_download.
      ELSE.
        MESSAGE i017(p5).
      ENDIF.
    *&      Form  Z_GET_PERIOD_DATES
          text
    -->  p1        text
    <--  p2        text
    FORM z_get_period_dates.
    Determine the date range from the fiscal period range and
    fiscal year entered on the selection screen
      DATA: d_firstdate LIKE sy-datum,
            d_lastdate LIKE sy-datum,
            t_dates LIKE scscp_period_str OCCURS 0 WITH HEADER LINE.
      CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
        EXPORTING
          i_gjahr        = p_gjahr
          i_periv        = 'V3'
        IMPORTING
          e_first_day    = d_firstdate
          e_last_day     = d_lastdate
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      CALL FUNCTION 'CSCP_PARA1_GET_PERIODS'
        EXPORTING
          i_datuv    = d_firstdate
          i_datub    = d_lastdate
          i_timeunit = 'M'
        TABLES
          et_dates   = t_dates.
      SORT t_dates BY sindex.
      DELETE t_dates INDEX 1.
      LOOP AT t_dates.
        SUBTRACT: 1 FROM t_dates-sindex,
                  1 FROM t_dates-datub.
        MODIFY t_dates TRANSPORTING sindex datub.
      ENDLOOP.
      CLEAR: d_datefrom,
             t_dates.
      READ TABLE t_dates WITH KEY sindex = s_monat-low.
      d_datefrom = t_dates-datuv.
      CLEAR d_dateto.
      IF s_monat-high IS INITIAL.
        d_dateto = t_dates-datub.
      ELSE.
        CLEAR t_dates.
        READ TABLE t_dates WITH KEY sindex = s_monat-high.
        d_dateto = t_dates-datub.
      ENDIF.
    ENDFORM.                    " Z_GET_PERIOD_DATES
    *&      Form  Z_SELECT_PROD_ORDERS
          text
    -->  p1        text
    <--  p2        text
    FORM z_select_prod_orders.
    Select all production orders as per the selection criteria provided
      DATA: d_dlv_code LIKE jstat-stat,
            d_teco_code LIKE jstat-stat,
            t_status LIKE jstat OCCURS 0 WITH HEADER LINE.
      SELECT SINGLE name1 INTO t001w-name1 FROM t001w WHERE werks = p_werks.
    if s_plnbez-low eq space and s_plnbez-high eq space.
    endif.
      SELECT aufnr werks objnr gamng rsnum plnbez
      INTO CORRESPONDING FIELDS OF
      TABLE t_caufv FROM caufv
      WHERE aufnr IN s_aufnr
    AND   auart IN ('PP01', 'LL02') : BY VIVEK
      AND   auart in s_auart " Added By Vivek on 29.11.2005
      AND   werks = p_werks
      AND   plnbez IN s_plnbez
      AND   getri BETWEEN d_datefrom AND d_dateto
      ORDER BY aufnr.
      d_returncode = sy-subrc.
      IF d_returncode NE 0.
        STOP.
      ENDIF.
    Filter out only those production orders that have a status
    DLV (Delivered) or TECO (Technically Confirmed).
      CLEAR: d_dlv_code,
             d_teco_code.
      PERFORM z_get_status_code USING 'DLV' CHANGING d_dlv_code.
      PERFORM z_get_status_code USING 'TECO' CHANGING d_teco_code.
      LOOP AT t_caufv.
        REFRESH t_status.
        CALL FUNCTION 'STATUS_READ'
             EXPORTING
              CLIENT           = SY-MANDT
                  objnr            = t_caufv-objnr
                 only_active      = 'X'
         IMPORTING
              OBTYP            =
              STSMA            =
              STONR            =
            TABLES
                 status           = t_status
            EXCEPTIONS
                 object_not_found = 1
                 OTHERS           = 2
        IF sy-subrc EQ 0.
          CLEAR t_status.
          READ TABLE t_status WITH KEY stat = d_dlv_code.
          IF sy-subrc NE 0.
            CLEAR t_status.
            READ TABLE t_status WITH KEY stat = d_teco_code.
            IF sy-subrc NE 0.
              DELETE t_caufv.
            ENDIF.
          ENDIF.
        ELSE.
          DELETE t_caufv.
        ENDIF.
      ENDLOOP.
      IF t_caufv[] IS INITIAL.
        d_returncode = 4.
        STOP.
      ENDIF.
    Added by Anand Bothra on 24/11/2003**********
      t_ab_caufv[] = t_caufv[].
    Added by Anand Bothra on 28/11/2003.
      IF ( s_plnbez-low EQ space AND s_plnbez-high EQ space ).
        IF ( s_aufnr-low EQ space AND s_aufnr-high EQ space ).
          d_flag = 'N'.
        ELSE.
          d_flag = 'Y'.
        ENDIF.
      ELSE.
        d_flag = 'Y'.
      ENDIF.
      IF d_flag = 'Y'.
    Added by Anand Bothra on 21/11/2003.**********
    *Get the batch number of the entered order
        DATA: itab_afpo LIKE afpo OCCURS 100 WITH HEADER LINE.
        DATA: BEGIN OF t_ab_charg OCCURS 0,
    *Added by Anand on 27/11/2003
                aufnr LIKE afpo-aufnr,
                charg LIKE afpo-charg,
                END OF t_ab_charg.
        LOOP AT t_caufv.
          SELECT aufnr charg FROM afpo INTO t_ab_charg WHERE aufnr =
      t_caufv-aufnr.
            APPEND t_ab_charg.
            CLEAR t_ab_charg.
          ENDSELECT.
        ENDLOOP.
    IF sy-subrc = 0.
       SELECT * FROM afpo INTO TABLE itab_afpo WHERE charg = d_ab_charg.
    ENDIF.
        LOOP AT t_ab_charg.
          SELECT * FROM afpo INTO itab_afpo WHERE charg = t_ab_charg-charg.
            APPEND itab_afpo.
            CLEAR itab_afpo.
          ENDSELECT.
        ENDLOOP.
        CLEAR t_caufv.
        REFRESH t_caufv.
    *Get all the orders with the same batch number.
        LOOP AT itab_afpo.
          SELECT aufnr werks objnr gamng rsnum plnbez
          INTO CORRESPONDING FIELDS OF
          t_caufv FROM caufv WHERE aufnr = itab_afpo-aufnr.
            APPEND t_caufv.
          ENDSELECT.
        ENDLOOP.
        CLEAR t_caufv.
        SORT t_caufv BY aufnr.
    delete adjacent duplicates from t_caufv comparing all fields.
      ENDIF.
      SELECT aufnr posnr wemng amein charg INTO TABLE t_afpo
      FROM afpo FOR ALL ENTRIES IN t_caufv
      WHERE aufnr = t_caufv-aufnr.
      d_returncode = sy-subrc.
      IF d_returncode NE 0.
        STOP.
      ENDIF.
      SORT t_afpo BY aufnr.
    ENDFORM.                    " Z_SELECT_PROD_ORDERS
    *&      Form  Z_SELECT_MAT_DESC
          text
    -->  p1        text
    <--  p2        text
    FORM z_select_mat_desc.
    Get the Description of all materials
      SELECT matnr maktx INTO TABLE t_makt FROM makt
      FOR ALL ENTRIES IN t_caufv
      WHERE matnr = t_caufv-plnbez
      AND   spras = sy-langu.
    ENDFORM.                    " Z_SELECT_MAT_DESC
    *&      Form  Z_PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM z_process_data.
    Process the data from all production orders and prepare the output
    table for display appropriately
      DATA: d_mbgbtr TYPE p DECIMALS 3,
            loop_cnt TYPE i.
      REFRESH t_outputtab.
      LOOP AT t_caufv.
        CLEAR t_outputtab.
        MOVE-CORRESPONDING t_caufv TO t_outputtab.
        CLEAR t_makt.
        READ TABLE t_makt WITH KEY matnr = t_caufv-plnbez.
        IF sy-subrc EQ 0.
          MOVE t_makt-maktx TO t_outputtab-maktx.
        ENDIF.
        CLEAR t_afpo.
        READ TABLE t_afpo WITH KEY aufnr = t_caufv-aufnr.
        IF sy-subrc EQ 0.
          MOVE: t_afpo-wemng TO t_outputtab-wemng,
                t_afpo-amein TO t_outputtab-amein,
                t_afpo-charg TO t_outputtab-charg.
        ENDIF.
        IF t_outputtab-gamng NE 0.
          COMPUTE t_outputtab-yield =
          ( t_outputtab-wemng / t_outputtab-gamng ) * 100.
        ENDIF.
        APPEND t_outputtab.
      ENDLOOP.
      SORT t_production_costs BY objnr kstar.
      LOOP AT t_production_costs.
        AT NEW objnr.
          CLEAR: d_mbgbtr, d_tabix, t_outputtab.
          READ TABLE t_outputtab WITH KEY objnr = t_production_costs-objnr.
          MOVE sy-tabix TO d_tabix.
          " Add up the Raw Material and Manufacturing Conversion
          " Costs from the previous stage production order
          CLEAR loop_cnt .
          LOOP AT t_suborders WHERE aufnr = t_outputtab-aufnr.
         commented by anand bothra on 20/11/2003
            ADD 1 TO loop_cnt.
            IF loop_cnt > 1.
              EXIT.
            ENDIF.
            LOOP AT t_production_costs1 WHERE objnr = t_suborders-objnr.
              CASE t_production_costs1-kstar.
                WHEN '0005000000' OR '0005010000'.     " Raw Material Cost
    BEGIN OF deletion VIP110703
              ADD t_production_costs1-wkgbtr TO t_outputtab-totalrmcost.
    END   OF deletion VIP110703
                  ADD t_production_costs1-wkgbtr TO prev_totmatqty.
                WHEN '0000500100'.      " Manufacturing Conversion Cost
                  ADD t_production_costs1-wkgbtr TO prev_tot_mfgconv_cst.
    BEGIN OF deletion VIP110703
                ADD t_production_costs1-wkgbtr TO t_outputtab-mfgconvcost.
    END   OF deletion VIP110703
              ENDCASE.
            ENDLOOP.
    BEGIN OF INSERTION VIP110703
           READ TABLE t_production_costs INTO wa_production_costs
           WITH KEY objnr = t_production_costs-objnr
                      matnr = wa_prev_outputtab-plnbez.
           IF sy-subrc = 0.
             IF  ( wa_production_costs-mbgbtr NE
                                   wa_prev_outputtab-wemng )  .
               prev_totmatqty = ( prev_totmatqty /
                                  wa_prev_outputtab-wemng ) *
                                 wa_production_costs-mbgbtr.
               prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
                                  wa_prev_outputtab-wemng ) *
                                  wa_production_costs-mbgbtr.
             ENDIF.
           ENDIF.
           LOOP AT t_suborders_propcost
                   WHERE prevaufnr = wa_prev_outputtab-aufnr.
             t_suborders_propcost-proprmcost = prev_totmatqty.
             t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst
             MODIFY t_suborders_propcost.
           ENDLOOP.
           clear: prev_totmatqty,
                   prev_tot_mfgconv_cst.
    END   OF INSERTION VIP110703
    BEGIN OF INSERTION VIP111003
            CLEAR: wa_prev_outputtab,
                   wa_production_costs.
            READ TABLE t_outputtab INTO wa_prev_outputtab
            WITH KEY aufnr = t_suborders-prevaufnr.
            ratio = 1.
            IF sy-subrc = 0.
              READ TABLE t_production_costs INTO wa_production_costs
              WITH KEY objnr = t_outputtab-objnr
                         matnr = wa_prev_outputtab-plnbez.
              IF sy-subrc = 0.
                IF  ( wa_production_costs-mbgbtr NE
                                      wa_prev_outputtab-wemng ) .
                  ratio = wa_production_costs-mbgbtr /
                          wa_prev_outputtab-wemng.
                  prev_totmatqty = ( prev_totmatqty /
                                     wa_prev_outputtab-wemng ) *
                                    wa_production_costs-mbgbtr.
                  prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
                                     wa_prev_outputtab-wemng ) *
                                     wa_production_costs-mbgbtr.
                ENDIF.
              ENDIF.
            ENDIF.
            LOOP AT t_suborders_propcost
                    WHERE prevaufnr = wa_prev_outputtab-aufnr
                    AND aufnr = t_outputtab-aufnr.
              t_suborders_propcost-proprmcost = prev_totmatqty.
              t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst.
              MODIFY t_suborders_propcost.
            ENDLOOP.
    *Commented by Anand Bothra on 20/11/2003.
            CLEAR: prev_totmatqty,
                    prev_tot_mfgconv_cst.
    BEGIN OF INSERTION VIP111003
          ENDLOOP.
        ENDAT.
        AT END OF kstar.
          SUM.
          CASE t_production_costs-kstar.
            WHEN '0000500200'.    " Packing Conversion Costs
              t_outputtab-pkgconvcost = t_production_costs-wkgbtr.
            WHEN '0005000500'.   " Semi-Finished Cost/Quantity
              MOVE t_production_costs-mbgbtr TO d_mbgbtr.
            WHEN '0005050000' OR '0005050001' OR '0005050002'.
              " Packing Mat Costs
              ADD t_production_costs-wkgbtr TO t_outputtab-totalpmcost.
            WHEN '0005000000' OR '0005010000'.
              ADD t_production_costs-wkgbtr TO t_outputtab-totalrmcost.
            WHEN '0000500100'.      " Manufacturing Conversion Cost
              ADD t_production_costs-wkgbtr TO t_outputtab-mfgconvcost.
          ENDCASE.
        ENDAT.
        AT END OF objnr.
          MOVE d_waers TO t_outputtab-waers.
    Calculations for the Production Order
          " Determine the RM Cost/Unit and Mfg Conv Cost/Unit
          CLEAR t_afpo1.
          READ TABLE t_afpo1 WITH KEY aufnr = t_outputtab-aufnr.
          IF ( ( sy-subrc EQ 0 ) AND ( t_afpo1-wemng NE 0 ) ).
    BEGIN OF insertion VIP110703
           tmp_aufnr = t_production_costs-objnr+2(12).
           LOOP AT t_suborders_propcost
           WHERE aufnr = tmp_aufnr  .
            ADD t_suborders_propcost-proprmcost TO t_outputtab-totalrmcost
             ADD t_suborders_propcost-prop_mfg_convcost  TO
                  t_outputtab-mfgconvcost.
           ENDLOOP.
    END   OF insertion VIP110703
    BEGIN OF insertion VIP111003
            CLEAR: t_suborders_propcost , tmp_aufnr.
            READ TABLE t_suborders_propcost
            WITH KEY aufnr = t_outputtab-aufnr.
            IF sy-subrc = 0.
             t_suborders_propcost-proprmcost =
                 t_suborders_propcost-proprmcost * ratio.
              ADD t_suborders_propcost-proprmcost
                    TO t_outputtab-totalrmcost.
             t_suborders_propcost-prop_mfg_convcost =
                 t_suborders_propcost-prop_mfg_convcost * ratio.
              ADD t_suborders_propcost-prop_mfg_convcost
                   TO t_outputtab-mfgconvcost.
              tmp_aufnr = t_suborders_propcost-prevaufnr.
              bln_suborder = 'T'.
              WHILE bln_suborder = 'T'.
                CLEAR: t_suborders_propcost .
                READ TABLE t_suborders_propcost
                WITH KEY aufnr = tmp_aufnr.
                IF sy-subrc = 0.
                  t_suborders_propcost-proprmcost =
                    t_suborders_propcost-proprmcost * ratio.
                  ADD t_suborders_propcost-proprmcost
                        TO t_outputtab-totalrmcost.
                  t_suborders_propcost-prop_mfg_convcost =
                      t_suborders_propcost-prop_mfg_convcost * ratio.
                  ADD t_suborders_propcost-prop_mfg_convcost
                       TO t_outputtab-mfgconvcost.
                  tmp_aufnr = t_suborders_propcost-prevaufnr.
                ELSE.
                  bln_suborder = 'F'.
                  CLEAR tmp_aufnr.
                ENDIF.
              ENDWHILE.
            ENDIF.
    END   OF insertion VIP111003
    END   OF deletion VIP110703
           t_outputtab-mfgconvcost = ( t_outputtab-mfgconvcost /
                                       t_afpo1-wemng ) * d_mbgbtr.
           t_outputtab-totalrmcost = ( t_outputtab-totalrmcost /
                                       t_afpo1-wemng ) * d_mbgbtr.
    END   OF deletion VIP110703
          ENDIF.
          IF t_outputtab-wemng NE 0.
            t_outputtab-rmperunit = t_outputtab-totalrmcost /
                                    t_outputtab-wemng.
            " PM Cost Per Unit = Total PM Cost / Quantity Delivered
            t_outputtab-pmperunit = t_outputtab-totalpmcost
                                    / t_outputtab-wemng.
            " Conv Cost Cost Per Unit = (Manu Conv Cost + Pack Conv Cost)
            "                           / Qty Delv
            t_outputtab-ccperunit = ( t_outputtab-mfgconvcost
                                    + t_outputtab-pkgconvcost )
                                    / t_outputtab-wemng.
          ENDIF.
          " Total Cost Per Unit = (RM Cost per unit + PM Cost per Unit
          "                       + Conv Cost per unit)
          t_outputtab-totperunit = t_outputtab-rmperunit
                                   + t_outputtab-pmperunit
                                   + t_outputtab-ccperunit.
    Update the calculated values in the internal table
          CHECK d_tabix GT 0.
          MODIFY t_outputtab INDEX d_tabix
                             TRANSPORTING totalrmcost totalpmcost
                                          mfgconvcost pkgconvcost
                                          rmperunit pmperunit
                                          ccperunit totperunit waers.
    BEGIN OF DELETION VIP110703
         MOVE t_outputtab TO wa_prev_outputtab.
    END   OF DELETION VIP110703
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " Z_PROCESS_DATA
    *&      Form  Z_DISPLAY_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM z_display_list.
    Display the Report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            I_INTERFACE_CHECK        = ' '
             i_callback_program       = d_repid
            I_CALLBACK_PF_STATUS_SET = ' '
            I_CALLBACK_USER_COMMAND  = ' '
            I_STRUCTURE_NAME         =
             is_layout                = wa_listlayout
               it_fieldcat              = t_fieldcatalog
            IT_EXCLUDING             =
            IT_SPECIAL_GROUPS        =
               it_sort                  = t_sortsequence
            IT_FILTER                =
            IS_SEL_HIDE              =
            I_DEFAULT                = 'X'
            I_SAVE                   = ' '
            IS_VARIANT               = ' '
             it_events                = t_listevents
            IT_EVENT_EXIT            =
             is_print                 = wa_print_info
            IS_REPREP_ID             =
            I_SCREEN_START_COLUMN    = 0
            I_SCREEN_START_LINE      = 0
            I_SCREEN_END_COLUMN      = 0
            I_SCREEN_END_LINE        = 0
            I_BYPASSING_BUFFER       =
            I_BUFFER_ACTIVE          =
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER  =
            ES_EXIT_CAUSED_BY_USER   =
           TABLES
                t_outtab                 = t_outputtab
          EXCEPTIONS
               program_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.
      SET PF-STATUS 'Z_AB_STANDARD'.
    ENDFORM.                    " Z_DISPLAY_LIST
    *&      Form  Z_FILL_FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM z_fill_fieldcatalog USING      p_rownum LIKE sy-curow
                                        p_colnum LIKE sy-cucol
                                        p_fieldname TYPE slis_fieldname
                                        p_tabname TYPE slis_tabname
                                        p_reffield TYPE dd03p-fieldname
                                        p_reftable TYPE dd03p-tabname
                                        p_qfield TYPE slis_fieldname
                                        p_qtab TYPE slis_tabname
                                        p_sum
                                        p_stext
                                        p_mtext
                                        p_ltext
                                        p_datatype
                                        p_outputlen.
    Prepare the fields for ALV list output
      CLEAR wa_fieldcatalog.
      wa_fieldcatalog-row_pos = p_rownum.
      wa_fieldcatalog-col_pos = p_colnum.
      wa_fieldcatalog-fieldname = p_fieldname.
      wa_fieldcatalog-tabname = p_tabname.
      wa_fieldcatalog-ref_fieldname = p_reffield.
      wa_fieldcatalog-ref_tabname = p_reftable.
      wa_fieldcatalog-qfieldname = p_qfield.
      wa_fieldcatalog-qtabname = p_qtab.
      wa_fieldcatalog-do_sum = p_sum.
      wa_fieldcatalog-seltext_s = p_stext.
      wa_fieldcatalog-seltext_m = p_mtext.
      wa_fieldcatalog-seltext_l = p_ltext.
      wa_fieldcatalog-datatype = p_datatype.
      wa_fieldcatalog-outputlen = p_outputlen.
      APPEND wa_fieldcatalog TO t_fieldcatalog.
    ENDFORM.                    " Z_FILL_FIELDCATALOG
    *&      Form  Z_PREPARE_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM z_prepare_fieldcat.
    Append all the display fields into the field catalog internal table
    First Row
      PERFORM z_fill_fieldcatalog USING 1 1 'PLNBEZ' 'T_OUTPUTTAB'
                                        space 'AFKO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 1 2 'MAKTX' 'T_OUTPUTTAB'
                                        space 'MAKT' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 1 3 'CHARG' 'T_OUTPUTTAB'
                                        space 'AFPO' space space
                                        space space space space space
                                        0.
    Second Row
      PERFORM z_fill_fieldcatalog USING 2 1 'AUFNR' 'T_OUTPUTTAB'
                                        space 'AFKO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 2 'GAMNG' 'T_OUTPUTTAB'
                                        space 'CAUFV' 'AMEIN' space
                                        'X' space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 3 'WEMNG' 'T_OUTPUTTAB'
                                        space 'AFPO' 'AMEIN' space
                                        'X' space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 4 'AMEIN' 'T_OUTPUTTAB'
                                        space 'AFPO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 5 'YIELD' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-010 text-010 text-010
                                        'QUAN' 17.
    Third Row
      PERFORM z_fill_fieldcatalog USING 3 1 'TOTALRMCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-011 text-011 text-011
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 2 'TOTALPMCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-012 text-012 text-012
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 3 'MFGCONVCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-013 text-013 text-013
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 4 'PKGCONVCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-014 text-014 text-014
                                        'CURR' 21.
    Fourth Row
      PERFORM z_fill_fieldcatalog USING 4 1 'RMPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-015 text-015 text-015
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 2 'PMPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-016 text-016 text-016
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 3 'CCPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-017 text-017 text-017
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 4 'TOTPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-018 text-018 text-018
                                       'CURR' 21.
    ENDFORM.                    " Z_PREPARE_FIELDCAT
    *&      Form  Z_GET_ALV_EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM z_get_alv_events.
    Returns table of possible events for a list type
      REFRESH t_listevents.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
            I_LIST_TYPE     = 0
          IMPORTING
               et_events       = t_listevents
          EXCEPTIONS
               list_type_wrong = 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.
      ELSE.
        CLEAR: wa_listevents, d_tabix.
        READ TABLE t_listevents WITH KEY name = slis_ev_top_of_page
        INTO wa_listevents.
        d_tabix = sy-tabix.

    Hi Sai,
          You can try using MB51, use filter movement type 261. Add a filter for the posting date coverage.
    Then proceed. Click on the icon DETAIL LIST.
    Then click on the SUBTOTAL, add MATERIAL as a Criteria. The click the column AMOUNT IN LC.
    You should see the total issuances to per material.
    I hope this helps.
    Heinrick Palad

  • Material Availability Report for Sales Order

    Hi,
    Is there any report which gives me for a sale order line item which is either pending or not yet picked in delivery, but for which stock is not available. If such report is not available then what to we do for getting the same?
    Regards,
    Ajit

    Hi ajit
    In VA05 itself you can see Ordered  qty, Open order qty and confirmed quantity , Delivered qty , Delivered  date  .Even  Laxmipathi also said same thing and  i also agree with his words.
    Regards
    Srinath

Maybe you are looking for

  • Variable selection in WEB wrongly transferred to initial variable screen

    Dear all, I am currently working for a company in the Netherlands where they use a lot of reports in the web. Till one month ago, selecting a period from the list in the WEB didn't gave any problems. However, at this moment while selecting a random p

  • Codec problem with cannon XH A1

    hello Im using a cannon XH-A1 and I'm having capture problems. I filmed in HDV but the capture wont read the camera while in HDV apple codec 1080i. never had a problem before it keeps telling me can't initiate HDV deck. any help? It will initiate if

  • SDO_RELATE OR SDO_GEOM.RELATE

    hii. i want to get an information that for example districts in a specified city.i try to use sdo_relate and sdo_geom.relate but i could not get true result. SELECT * FROM DISTRICTS WHERE SDO_RELATE(DISTRICTS .OGC_GEOMETRY,(SELECT OGC_GEOMETRY FROM C

  • About SQL Developer migration objects

    Hi all, I'm using the SQL Developer Version 2.1.1.64 for Windows. I've migrated a SQL Server 2005 database to Oracle. Well, many objects was created, like triggers to emulate identity sql server, packages, MD* tables, and so on. Well, I need to use a

  • Do you have to have an internet connection to watch a rented movie from itunes?

    I rented a movie from itunes and tried to watch in on a plane.  But a message came up that itunes could not connect to the internet.  I did not realize you had to have an internet connection to watch a rented movie.  Is this correct?