I want logic to calculate mateiral wise and period wise

can anyone please tell how to consider material and period for this pgm
i have coded to calcualte sum of material wise.
but i want to consider materila wise and month wise
eg:material   quantity month
    1000        200       4/2001
     1000       300       5/2001 based on the below conditions.
Select  mATNR SPMON ZZDPFC ZZMARKET
From S507
  into corresponding fields of  table  t_DATA WHERE
  VRSIO = '000' AND BEDAE = 'KSV' AND ZZDMTYP = '001'
  AND  ZZDPFC GT '0' AND ZZMARKET IN ('001','002') AND SPMON >= 200705.
   SORT T_DATA BY MATNR ZZMARKET SPMON.
write:/04 'Material',25 'Demand Plant'. "45 'Market',70 'Period'.
LOOP AT T_DATA.
WRITE:/02 t_data-MATNR ,25 t_data-ZZDPFC,45 t_data-ZZMARKET,
70 t_data-SPMON.
at end of matnr.
sum.
write : /02 t_Data-matnr,25 t_data-zzdpfc COLOR 5 .
endat.
endloop.

Hi,
<fs> type   t_data
sort t_data by matnr  month.
V_index = 0.
loop at  t_data  assigning <fs>.
V_index = sy-tabix + 1.
read  t_data assigning <fs2> with  index V_index .
if sy-subrc = 0.
--if <fs>-matnr =  <fs2>-matnr and <fs>-month = <fs2>-month.
<fs>-quantity =  <fs>-quantity =  <fs2>-quantity.
delete  t_data index V_index.
--endif.
endif.
endloop.
<b>then loop at  t_data to display .</b>
Regards,
Sooness.

Similar Messages

  • Two financial statements at product wise and location wise below comp code

    company code have number of products and they are being sold in various locations. here management wants to get financial statement  both product wise and location wise below company code. the problem is that their is no field to post for BA, profit center and segment in MIGO posting and Billing document in standard SAP
    please inform me is it possible to get financial statement both product wise and location wise below company code. if it is possible please provide answer.
    Thanks & Regards 
    Arjun

    Financial Statements can only be drawn at Company Code, Business Area, Profit Center, and Segment levels only.
    If you want to have product wise, then the same must have mapped / designed against the one otherthan companyt code.

  • In alvs how to do totals by colum wise and row wise

    hi,
    in alvs how to do totals by colum wise and row wise
    could u plz explain clearly with coding

    Hi Rajesh,
    Go through these links...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Reward Points if this helps,
    Satish

  • Stock reservation report For customer wise and Document wise

    Dear sd experts ...
    In my company  we have kept some reserved stock to some customers By using MB1B-412E M.type now Requirement is I want to see how much stock kept in reservation for Customers and Document wise also
    I Have checked in CO09 But not possible and MCTA also
    plz guide me how to find

    did you try MMBE ?
    also check MB5B, MD04, MB5T

  • Profit Center Wise and Currency Wise balances in same report?

    Experts,
    Is there any report where we can see Profit Center and Currency Wise balances in the same report?
    How can we get such report?
    - Nilesh

    Hi
    Did you try FAGLL03?? I think that should suffice
    or try FGI3
    br, Ajay M

  • Cell wise and row wise check box in oops alv

    Normally column wise check box are possible in oops alv but how to possible check box in first row only in oops alv and Cell wise check box in oops alv?

    Hi,
    Try like changing  this
    insted of
    g_layout-f2code = ' '.
    use this
    g_layout-f2code = 'DISP'. " Sets fcode for when double
    and
    g_layout-f2code = '&ETA'. " it will display POPUP screen
    Best Regards
    Ranga
    Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
    Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

  • Month wise Closing balance of Material Wise and  Batch Wise

    Hi,
    We can get period wise closing balance for Plant-Storage Location-materials in MARDH.
    But i didnt find any table which can provide Plant - S.Loc - Year - Period (or Month) - Batch wise closing Balances.
    Can any body please suggest a table on the above criteria.
    Thanks
    Pardha Saradhi Bandaru.

    Hi,
    The required batch information can be taken from the table S034
    Regards
    Merwyn

  • B.area wise and vendor wise report

    Dear seniors,
    My client has 5 b.areas,
    some vendors are common to all business areas, that's why from all business areas postings happen to some vendors.
    that's y my client wants to see business area wise ,vendor wise balances.
    please guide me how can i guide Abaper.
    with regards,
    Bhuvan

    Statement: some vendors are common to all business areas
    Question: Where do you create vendors per business area??
    You can change the field status of the posting keys relating to vendor such as 31, keep business are as mandatory.
    Some of the standard reports must suffice your reporting reaquirements.
    otherwise need to create a form and report (FKI4 and FKI1)
    Regards,
    Ravi

  • Pending tds report bills wise and date wise

    Dear ALL,
      In my client place they want Pending TDS Certificate Report Bill wise  , it is there any standard tcode for that or else for this report preparation what are the tables we have to give to ababer for creating new report. Please guide to solve this issue.
    girija

    Dear,
    You can use following tables to get detailed report on TDS...
    1. WITH_ITEM
    2. J_1IEWTCHLN
    3. J_1IEWT_CERTIF_N
    4. BSIK or BSIS.
    Regards,
    Chintan Joshi.

  • Unrestricted stock difference - Batch wise and Plant wise in MMBE

    Dear All,
    When checked in MMBE transaction - Stock quantity difference.
    For Ex.
    - at Plant level it showing Qty - 1000
    - When we count batch wise available unrestricted showing - 1400
    What is the reason?? Did any one get this type of issue earlier. Please reply.
    Regards,
    Syed Hussain.

    Thank you.
    Solved, problem not with the UOM, But with material transfers and reversals.
    Material stock transferred to Dummy cost center before batch classification and returned the same quantity with 202 - not to unrestricted, but direct to batches.
    Regards,
    Syed Hussain.

  • Stock movement report date and warehouse wise

    I need this report date wise and warehouse wise...
    please help ..
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Whse nvarchar(10)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse = '[%2]'
    Select @Whse as 'Warehouse',
    a.Itemcode,
    max(a.Dscription) as ItemName,
    sum(a.OpeningBalance) as OpeningBalance,
    sum(a.INq) as 'IN',
    sum(a.OUT) as OUT,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing
    --(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,
    (sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    Where N1.DocDate < @FromDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
    N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription
    Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0
    and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

    please advice.. - wrong out put.
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select
    a.Itemcode, a.warehouse,a.price as 'Item Cost',
    max(a.Dscription) as ItemName,
    sum(a.OpeningBalance) as OpeningBalance,((sum(a.OpeningBalance) *a.Price)) as 'Opening STock Value',
    sum(a.INq) as 'IN',
    sum(a.INq)*a.Price as 'IN Stock Value',
    sum(a.OUT) as OUT,
    sum(a.OUT)*a.Price as 'OUT Stock Value',
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*a.Price as 'Closing Stock Value'
    --(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,n1.Price,
    (sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    Where N1.DocDate < @FromDate  Group By N1.Warehouse,N1.ItemCode,n1.Price,
    N1.Dscription
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription,n1.Price, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0  Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price
    Union All
    select N1.Warehouse, N1.Itemcode,N1.Dscription,n1.Price, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode,a.warehouse,a.Price
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

  • Reg  fbl5n   sales orgnization wise & distribution channel wise balence

    hi
    we are using ECC 6.
    our SD persons required sales organization wise& distribution channel wise balence in FBL5N.
    the total list is available. sales organization wise and distribution wise not available.
    how i can solve the problem
    regards
    sambasivarao ch

    Hi
    Either you can generate based on the number range / Reconciliation Account through dynamic selection (if the account group for customer codes is defined at distribution channel level logic).
    Otherwise, you are required to use any one of the following fields in the customer master creation :-
    Industry / Search Term /Accounting Clerk etc. with a identification of the required combination.
    Hope this will meet your requirement
    Regards
    Anilkumar

  • Report on power generation from each plant and shift wise(PP report)

    Hi,
    i got one  Functional spec on pp module. this FS main object is calculate the daily smelter performance.
    Based on this FS  I will make a report on POWER GENERATION FROM EACH PLANT AND  SHIFT WISE.
    so please can  anyone of you  advice to me  , is  there any standard extractors  and standard cubes or ods are there for make this report.
    Regads,
    Suresh.

    Hi,
    here i mentioned tables,fields and logic according to Fspec.
    S.no          Report Field                                      SAP Table-field                                        Logic
       1               Shift                                              AFRU - KAPTPROG                                                                       
        2              Unit                                                MKPF-VERID                                      Pass MATNR and VERID to AFPO and fetch AUFNR for all VERID and pass AUFNR to AFRU and fetch KAPTPROG and GMNGA for that particular BUDAT
      3.            Total Generation                                    -                                         ADD all the unit GMNGA for Individual KAPTPROG
      4.           Total Auxiliary Consumption                   -                                          Pass MATNR and AUFNR to MSEG and fetch the MBLNR and MJAHR. Check MSEG - MBLNR and MSEG u2013 MJAHR = MKPF - MBLNR and MKPF u2013 MJAHR
    and fetch BUDAT for that particular date and pass it those MBLNR and MJAHR to MSEG and check for movement type 201 and fetch MENGE.
    5.            Export to GRIDCO                               -                                            Pass MATNR and AUFNR to MSEG and fetch the MBLNR and MJAHR. Check MSEG - MBLNR and MSEG u2013 MJAHR = MKPF - MBLNR and MKPF u2013 MJAHR
    and fetch BUDAT for that particular date and pass it those MBLNR and MJAHR to MSEG and check for movement type 261 and check for Field SHKZG if H fetch MENGE.
    6.          Import to GRIDCO                               -                                                Pass MATNR and AUFNR to MSEG and fetch the MBLNR and MJAHR. Check MSEG - MBLNR and MSEG u2013 MJAHR = MKPF - MBLNR and MKPF u2013 MJAHR
    and fetch BUDAT for that particular date and pass it those MBLNR and MJAHR to MSEG and check for movement type 101 and check for Field EBELN and fetch the MENGE.
    7.        Smelter Consumption                                -                                            Pass MATNR and AUFNR to MSEG and fetch the MBLNR and MJAHR. Check MSEG - MBLNR and MSEG u2013 MJAHR = MKPF - MBLNR and MKPF u2013 MJAHR
    and fetch BUDAT for that particular date and pass it those MBLNR and MJAHR to MSEG and check for movement type 201 and check for Field WERKS 1400 and display  MENGE.
    8.       Net Export / Import (MW)                                   -                                      Difference between Export to GRIDCO and Import to GRIDCO
    Based on these information ,can please anyone advice to me, is there any standard extractors ,cubes and ods for make this report.
    Thanks,
    Suresh.

  • Changing the logic to calculate score

    Hi!
    Score of the KPI(KPI1_TARDEV) is calculated based on some logic. I need to change the logic for some 100 KPIs using command instead of right click on the Variable and then selecting 'Logic' and then editing. This is very difficult beacuse there are more than 100 KPIs for which i need to change the logic.
    Is there any command like SET VARIABLE to change the logic to calculate the score?
    For example:
    Currently all the Achievement KPIs have score calculated based on the formula KPI1_ACT%KPI1_TAR.
    I want to change it to
    KPI1_TARDEV
    IF KPI1_TAR LT 0=(1-KPI1_ACT/KPI1_TAR)*100
    IF KPI1_ACT LT 0 AND KPI1_TAR GT 0=(-1+KPI1_ACT/KPI1_TAR)*100   OTHERWISE = KPI1_ACT%KPI1_TAR
    can i use command some thing like below?
    set vvariable logic KPI1_TARDEV AS
    KPI1_TARDEV
    IF KPI1_TAR LT 0=(1-KPI1_ACT/KPI1_TAR)*100
    IF KPI1_ACT LT 0 AND KPI1_TAR GT 0=(-1+KPI1_ACT/KPI1_TAR)*100   OTHERWISE = KPI1_ACT%KPI1_TAR
    Thanks
    Praveen

    Hi Praveen,
    I was faced with a similiar situation, please search the SSM forum for this thread: "Customer exit - Cube Builder SSM".
    Read the whole thread.
    Thanks,
    Tsholo.

  • I want to maintain  payment terms...material wise

    hi,
    Experts,
    here i want to maintain vendorwise and material wise payment terms....Vendorwise payment terms its ok i got it but how to maintain paymet terms for material.....is there any way to do maintain material wise payment term...
    thaks in advance.......
    Regards....
    sunil.....
    Helpful Ans will be awarded...

    Hi,
    Sorry to say but all the alternatives suggested did not work.
    Because fundamentally what you are trying to do Sunil is not logical.
    e.g. X person wants 100 qty of material, y person wants 2000 qty of material, the terms of payment are always dependent on the quantity of material, never on the material.
    also various other factors play  a role in determining payment terms:
    like credit check,
           payment history,etc
    these terms are all related to the customer only.
    thus depending upon the fact that majority of its dependant fields are invovled with customer, it can only be configured with respect to customer.
    plz clarify on the situation as to why do you need to configure it on material basis.
    regards,
    Siddharth.

Maybe you are looking for

  • APEX 4.1 - APACHE FOP PDF generation problem.

    Hi all, I'm having problem with PDF generation using APACH FOP on OC4J. When I test my print server as described here: http://marcsewtz.blogspot.com/2008/06/heres-another-posting-on-pdf-printing.html everything works without problem. But when I uploa

  • PHP 5.1.4 Installation Error

    I'm installing PHP 5.1.4 on RH 2.1 AS with below Kernel Version $ uname -a Linux auohsjohn11 2.4.9-e.49orags1enterprise #1 SMP Mon Oct 25 16:01:00 PDT 2004 i686 This is being installed as part of 10gAS Application Server 10.1.2.0.2, which I believe h

  • How to change letter in System Keyboard?

    Hi, I need to change characters in my system Keyboard. Confused? The thing I need is: When I type "comma" in my real physical keyboard I want that it appears a "point" instead. In the old Mac Os09 I did using Resedit to edit the keyboard file. Is the

  • Re: help light room 3

    I'm getting the same error, but the numbers are a little different.  Adobe chat has been no help.  In fact, they created additional problems for me.

  • I tried to download the current version of facebook and when i did it disappeared from my phone

    When I tried to download the most current version of Facebook lastnight it never downloaded all the way but it took the app completely off my phone. When I goto app store its shows downloaded but it will not let me open the app. I have tries resettin