Display total dmbtr according to mat type and month wise

hi all,
i want to display total dmbtr according to mat type and month wise. like
month       mat.type  total_dmbtr
jan 2008   fert           xxxxxxxxxx
jan 2008   mcfe         yyyyyyyy
feb 2008  fert  mmmmm

this is my prog..but am gettin o/p for one month irrespective of material type..
tables : mseg, mkpf, mara, S031.
********************DECLARATION******************************************
types : begin of ty_mkpf,
        budat type budat,
        mblnr type mblnr,
        end of ty_mkpf.
TYPES : BEGIN OF TY_S031,
        WERKS TYPE werks_d,
        SPMON TYPE SPMON,
        matnr TYPE matnr,
        END OF TY_S031.
types : begin of ty_mseg,
        mblnr type mblnr,
        matnr type matnr,
        werks type werks_d,
        menge type menge_d,
        dmbtr type dmbtr,
        bwart type bwart,
        end of ty_mseg.
types : begin of ty_mara,
        matnr type matnr,
        mtart type mtart,
        end of ty_mara.
data : it_mkpf type ty_mkpf occurs 0 with header line,
       it_mseg type ty_mseg occurs 0 with header line,
       it_mara type ty_mara occurs 0 with header line,
       IT_S031 TYPE TY_S031 OCCURS 0 WITH HEADER LINE.
      it_final TYPE ty_final OCCURS 0 WITH HEADER LINE.
data : flag type dmbtr,
       flag1 type dmbtr ,
       flag3 type dmbtr ,
       flag4 type dmbtr,
       flag5 type dmbtr,
       flag6 type dmbtr,
       flag7 type dmbtr,
       f1 type i VALUE 0,
       num_of_loops TYPE i VALUE 0,
       flag2 TYPE spmon.
**********************************INITIALIZATION***************************
flag  = 0.
flag1 = 0.
flag3 = 0.
flag4 = 0.
flag5 = 0.
flag6 = 0.
flag7 = 0.
******************selection screen*****************************************
selection-screen begin of block b1 with frame title txt_001.
select-options : plant for S031-werks,
                 month for S031-SPMON.
                date for mkpf-budat. "+4(2).
                MONTH FOR MONTH_NAMES_GET.
selection-screen end of block b1.
flag2 = month-low.
f1 = month-high - month-low.
if month-high is initial.
  num_of_loops = 1.
else.
  num_of_loops =  f1 + 1.
endif.
start-of-selection.
  perform getdata1.
*&      Form  get_data
      text
form getdata1.
if month-high is INITIAL.
write : / 'for month  ' COLOR COL_GROUP, flag2 COLOR COL_GROUP.
  Select WERKS SpMON matnr from S031 into corresponding fields of table it_S031
  where SpMON = flag2 AND WERKS IN PLANT.
   loop at IT_S031.
     at first.
        write : /5 'mat_num', 20 'month', 40 'QTY',58'amt',68'movement_type', 85'mat_type'. ",105 'qty remaining'.
        skip.
     endat.
  select single mblnr werks matnr menge dmbtr bwart from mseg into corresponding fields of it_mseg
    where werks = IT_S031-werks and ( bwart = '102' or bwart = '101' or bwart = '601' or bwart = '602' )
      and matnr = it_s031-matnr.
    if it_mseg-bwart = '101'.
      flag = flag + it_mseg-dmbtr.
    elseif it_mseg-bwart = '102'.
      flag1 = flag1 + it_mseg-dmbtr.
    elseif it_mseg-bwart = '601'  .
      flag4 = flag4 + it_mseg-dmbtr.
    elseif it_mseg-bwart = '602'  .
      flag5 = flag5 + it_mseg-dmbtr.
    endif.
    flag3 = flag - flag1. "101-102
    flag6 = flag4 - flag5. "601-602
    select SINGLE matnr mtart from mara into corresponding fields of  it_mara
      where matnr = it_mseg-matnr. " and mtart = 'FERT' .
   loop at it_mara.
      write : / it_mara-matnr,20  IT_S031-SPMON, it_mseg-menge, it_mseg-dmbtr, 70 it_mseg-bwart, 88 it_mara-mtart.
      skip.
    endloop.
  endloop.
  skip 1.
  write : / 'TOTAL QTY RECVD (a = 101-102)      ' , flag3.
  write : / 'TOTAL QTY CONSUMED ( b = 601-602)  ' , flag6.
  flag7 = flag3 - flag6.
  write : / 'QTY REMAINING (a-b)                ' , flag7.
skip 2.
flag  = 0.
flag3 = 0.
flag4 = 0.
flag5 = 0.
flag6 = 0.
flag7 = 0.
flag2 = flag2 + 1.
endif.
  do num_of_loops times.
  if not flag2 gt month-high.
    write : / 'for month  ' COLOR COL_GROUP, flag2 COLOR COL_GROUP.
  Select WERKS SpMON matnr from S031 into corresponding fields of table it_S031
  where SpMON = flag2 AND WERKS IN PLANT.
   loop at IT_S031.
     at first.
        write : /5 'mat_num', 20 'month', 40 'QTY',58'amt',68'movement_type', 85'mat_type'. ",105 'qty remaining'.
        skip.
     endat.
  select single mblnr werks matnr menge dmbtr bwart from mseg into corresponding fields of it_mseg
    where werks = IT_S031-werks and ( bwart = '102' or bwart = '101' or bwart = '601' or bwart = '602' )
      and matnr = it_s031-matnr.
    if it_mseg-bwart = '101'.
      flag = flag + it_mseg-dmbtr.
    elseif it_mseg-bwart = '102'.
      flag1 = flag1 + it_mseg-dmbtr.
    elseif it_mseg-bwart = '601'  .
      flag4 = flag4 + it_mseg-dmbtr.
    elseif it_mseg-bwart = '602'  .
      flag5 = flag5 + it_mseg-dmbtr.
    endif.
    flag3 = flag - flag1. "101-102
    flag6 = flag4 - flag5. "601-602
    select matnr mtart from mara into corresponding fields of table it_mara
      where matnr = it_mseg-matnr. " and mtart = 'FERT' .
    loop at it_mara.
      write : / it_mara-matnr,20  IT_S031-SPMON, it_mseg-menge, it_mseg-dmbtr, 70 it_mseg-bwart, 88 it_mara-mtart.
      skip.
    endloop.
  endloop.
  skip 1.
  write : / 'total recd qty (a = 101-102)       ' , flag3.
  write : / 'total Qty consumed ( b = 601-602)  ' , flag6.
  flag7 = flag3 - flag6.
  write : / 'Qty remaining (a-b)                ' , flag7.
skip 2.
flag  = 0. flag3 = 0. flag4 = 0. flag5 = 0. flag6 = 0. flag7 = 0.
flag2 = flag2 + 1.
endif.
enddo.
  endform.                                                    "getdata1

Similar Messages

  • Customer and month wise sales

    Dear All
        Which Table Stored Customer and month wise sales values?
    Thanks and Regards
    Suresh

    Hi
    Table VBRK Will help you.
    Assign points if you find the solution with this
    Regards

  • Field selection for combination of Mat.type and Plant

    Hi Friends,
    How to  make Valuation category (in material master) mandatory for paricular material types for specified plants
    Ex: I want to make val. category mandatory for mat. types ROH and HALB , only for Plants P1 and P2 and not for plant P3.
    Regards
    Venkat S

    HI,
    I think, valuation category is at client level...Not sure, please verify the table if it is MARA or MARC...If so, you can'tmake it mandatory for a set of plants only....Its either mandatory for all plants or just optional...
    Regards

  • WO settlement according to WO type and. WO PM Activity type ??! possible?

    Dear all,
    u2026 is there any way I can process automatically order settlement according to the order type VRS. the PM activity type ??!! (any exit?/special conf.?)
    Please advice
    Best Regards
    Paulo CH

    hi paul,
    can i know the need to automate the settlement process (just a curiosity as our FI?CO team does not allow us such thngs)
    coming to the config part M.act type should be assigned to your order types.and if you are changing it due to version control it is asking you for the revision.(not sure,but very much possible)
    As far settlement is concerned the settlement rule for the roder category must be configured in Functions and Settings for Order Types -->
    Settlement Rule: Define Time and Creation of Distribution Rule.
    and in settlement profiles for order category (not order type) in basic setting--> general order settlement.,where your allocation structures are there so kindly check these points ..hope you can find some clue from this.

  • Year and month wise results

    dear sir,
    i want to get data through find button.
    while i pass the perticuler date.
    data should come up inthe grid .
    how to use with find button and date how to get the data? pl help,
    thanks
    pullareddy

    to get the Month Value and year value in Webi
    month name
    =Month(ToDate(UserResponse("Enter End Date:");""))
    month number of the year
    =MonthNumberOfYear(ToDate(UserResponse("Enter End Date:");""))
    to get the Year Value
    =Year(ToDate(UserResponse("Enter End Date:");""))
    good luck

  • Credit card charges according to payment terms and purchase order types

    Hi All,
    Can anyone please tell me how can we charge credit card  fee for  customer (the customers who are using credit card), according purchase order type and payment terms ( like for purchase order B2B &B2Z and if customers have payment terms other than NT00)
    CONDITIONS
    Customer must use credit cards
    Purchase order type of the order is B2B &B2Z only
    For these purchase orders ( B2B &B2Z ) payment terms must be other than NT00.
    Charge must be 2.5%.
    Edited by: suresh saketh on Aug 24, 2010 3:10 AM

    Hello Suresh,
    CONDITIONS
    Customer must use credit cards
    Purchase order type of the order is B2B &B2Z only
    For these purchase orders ( B2B &B2Z ) payment terms must be other than NT00.
    Charge must be 2.5%.
    The best approach would be to define a Custom Condition type for charging processing fee in V/06. After defining this new condition type assign it to the Pricing procedure which you are currently dealing with. In the Column AltCty - Condition formula for alternative calculation type, you can create a New routine involving the following logic.
    Purchase Order type should be B2B and B2Z.
    Payment Terms other than NT00.
    Charge should be 2.5 %. 
    Kindly update your post after trying out the above suggestion
    Regards,
    Sarthak

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

  • ROUCH CUT PLANNING-capacity in terms of Material,Month and Qty wise

    Hi Gurus
    I have the following scenario
    The client will input the Rough cut planning Sales Plan for "Material A" in MC87. Then he will generate Production Plan in the same screen by create prodcution plan ->sychronise to sales
    SO Material specific and Month specific Quanitities will be inside
    His requirement is For Material Specific he is having some capacity Availability in terms of Quantity Material specific and Month wise. Say, Material A he can produce only 5000 in  a month, Material B 2500 in a month by the way
    So he will compare this with sales/production plan in MC87 and correct the MC87 data
    Is our rough cut planning will use any way for comparing and putting his available material specific capacity in terms of Qty. How to map this requirment in SAP
    I tried with MC35 rough cut planning it is giving the error stating resource..
    Might be i have not used it properly
    your suggestions are welcome to reslove this
    K.Prabakaran

    Hi,
    Pl. try the foll,
    In mc35, choose the resource as work center & enter min.
    Then in the main screen, enter the time for processing 1 Pc. (base qty). (Calculate this time for the processing of material A & then enter the time.)
    Regards,
    Senthilkumar

  • Display Totally paid items(cleared items), partial payments and residual pa

    Hi Experts,
    I am working on one requirement,
    Requirement: Display Totally paid items(cleared items), partial payments and residual payments.
    I am fetching data from BSAD table for Totally paid items, but I want to understand what are the fields to check when fetching data.
    Partial payments: Please let me know the logic to get data for partial payments from BSID table.
    Residual payments: what are the tables to check for residual payments and the logic.
    What are the fields that i have check and what are the fields that I have to check and get.?
    Please let me know what ever you know about this.
    Regards,
    Dileep,

    Hi,
    All types of Payments  either Totally paid items(cleared items) or  partial payments and residual payments the Document Number serious will b same.   Try to  extract by  Filtering Assignment Field .
    Thanks
    Goutam

  • How to display total "items" and "amount " in header.jsp in CRM ISA B2B

    Hi,
    I am modifying “header.jsp” in standard CRM ISA B2B application.  Here we have summary of total number of items and total amount but it is coming in to button and for that below code is there in “header.jsp” and it display it as button text.
    if (!ui.homActivated) { %>
    !!" alt="" border="0" height="16" width="20">
    </td>
    <td class="vertical-align-middle" name="miniBasket" value="<isa:translate key="b2b.header.minibasket.default"/>" >
            <form name="basketForm" action="javascript:show_basket();">
         <input class="green" name="miniBasket" type="button" value="<isa:translate key="b2b.header.minibasket.default"/>"/>   
        </form>
    </td>   
    <% } else { %>
    <!-- HOM scenario - minibasket displays collective order -->
    <td  class="vertical-align-middle" align="right">
    !!" alt="" border="0" height="16" width="20">
    </td>
    <td  class="vertical-align-middle" name="miniBasket" value="<isa:translate key="b2b.header.collorder.default"/>">
    <form name="basketForm" action="javascript:show_collective_order();">
        <input class="green" name="miniBasket" type="button" value="<isa:translate key="b2b.header.collorder.default"/>"/>   
    </form>
    </td>
    <% } %>
    Now I want to display total number of items and total amount separately in two different <td> element.
    How I can get total number of items and total amount in “header.jsp” I tried below code but did not get any success.
    Insert below line in “header.jsp” with respective page import statement for class or let me know which class I have to import.
    <%
         HeaderSalesDocument  hdr =
                (HeaderSalesDocument) request.getAttribute(MaintainBasketBaseAction.RK_HEADER);
        ItemList items =
                (ItemList) request.getAttribute(MaintainBasketBaseAction.RK_ITEMS);
    %>
    And then I use
    <td><%= hdr.getNetValue() %></td>
    <td><%= items.size() %></td>
    But it is not printing any thing and header page not display at all.
    Pl. tell me how to get total amount and number of items in header area. Which class or object I have to use here.
    I really appreciated any help from any one.
    Thanks and regards.
    Ashish Patel.

    Hi, I tried another logic. I took value from  Standard button, in which B2B application display total items and amount and I hide this field, to another text element.
    Now I Am breaking that value in words and stored them in array  and then trying to display that array with particular number which contains total item and amount through Java Script on Focus.
    But problem here is, It is not getting updated automatically I have to click on new text files to trigger Onfocus event. How I can achieve effect like as soon as Standard button changes it's value which is now hidden filed my new text box should update automatically.
    Thanks.
    Ashish

  • Report to display a wage type and amount

    hi friends,
           From selection screen i have to pick a wage type and for that wage type i have to display a related
    amount . how can i write a report for this?
    its urgent, thanks........
    Moderator message: please search for information and try yourself before asking, do not use terms like "urgent" when posting.
    Edited by: Thomas Zloch on Nov 9, 2011 10:24 AM

    Aarti
    Thanks for your answers,this was the report I was  looking for .
    Full points awarded to you .we can also use this transaction code directly
    PC00_M99_DKON
    regards
    krishna

  • MS Notepad unable to display the Chinese characters I type and display them as squares

    MS Notepad is unable to display the Chinese characters I type and display them as squares. But when I copy those squares on notepad to Wordpad or MS Word, they display the Chinese characters just fine. I've no idea why those Chinese characters I type can't display properly on notepad. I check the font of the notepad and it's the default. I've another Windows Vista desktop computer which has notepad of the similar setting and display Chinese characters just fine. Both are using Chinese (Simplified) - Microsoft Pinyin New Experience Input Style to input those characters. But I don't understand why my Windows 7 is facing this problem.

    Hi,
    Notepad is a very simple text editor BUT it will work if you use the SAME language in Windows. Please try:
    1. go to control panel, click "Clock, Language, and Region"
    2. click "Change location" under the "Region" section
    3. go to the "administrative" tab, then click "change system locale...", then select "Chinese".
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    Next, close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current user font cache files. After running the command, close Terminal and immediately restart your Mac.

  • Bacteria sized type and the 23" display

    I don't know how many of you have ever read Dave Barry's book 'Dave Barry Turns 50', but if you ever have you'll know that he devotes a chapter to the phenomenon of bacteria sized type which appears to readers after age 50.
    That's the one complaint I have with my new Apple 23" Cinema display. Most areas of Safari, Mail and other apps have controls where most of the type can be made larger (and readable)... but NOT ALL!
    For instance in Safari, the type on the bookmarks page cannot be increased in size. In Mail, the messages can be made larger, but not the listing of Mailbox type.
    What would be ideal would be some kind of universal type enlarging command that applies to everything. I think Windows XP actually works better in this regard.
    Are there any additional video drivers that can be downloaded to help with a resolution size that would make reading bacteria sized type easier on the Cinema Display?
    Is there any universal command to OSX 10.3.4 that can help make the type larger throughout the whole system?
    Thanks for any clues....

    Thanks... I'm still running Panther though. And since I'm a professional artist, I really don't need a handicapped voice directing my computer actions... just looking for a way to make type larger and easier to read, since the 23" display reduces so many features to a really tiny size.
    For instance the font size increase in Safari works great... but it's a pain to have to click it 3 times for every new web site one visits. Same thing with Mail. The font increase works great, but you have to do it every time you open a new email.
    It's even worse in Adobe Creative Suite, where so many of the program fonts and icon buttons are now so very very tiny.
    I'd just have thought that there'd be some more choices in the screen resolution from Apple.
    Are there any 3rd party programs that allow the Cinema display dimension with more resoution choices?
    Thanks for any input....

  • Display buttons by Transaction type and Roles

    Hi Experts,
    I have created a button in the BT115IT_SLSO/items view, using the DO_PREPARE_OUTPUT method. now I want to display this button only to a specific transaction type and business role, how can I achieve this. Tool bar related methods are not present for this view.
    Thanks,
    S Reddy

    Hi,
    This has been discussed in the forum already...
    https://forums.sdn.sap.com/click.jspa?searchID=27175485&messageID=7619188
    Re: Business Role of logged in user
    Always search first and check if there is anything already discussed, this will save a lot of your time.
    Regards,
    Masood Imrani S.

Maybe you are looking for