How to calculate "same store sales"

Hi,
What's the best way to do "same store sales" type calculations in OBIEE? The star schema I'm working from has a "sales" fact that just includes sales per product per store per day. And our "store" dimension includes a "store open date".
I'm just not sure of the best / fastest / easiest way to do same store sales in OBIEE. Any ideas would be greatly appreciated!
Thx,
Scott

I assume you have a sales date in your fact ... you could alias your fact table to have Fact-Sales and Fact-Sales(YAGO) and then you could have Sales and Sales YAGO columns ... then in your Request select Store and Sales where Sales YAGO > 0 ... I work for a Grocer and our same store sales is a little more complicated where the actual definition of the same store can be overriden so we have a store/week/flag dimension table in addition to the Store dimension and Sales fact tables. We then select Store, Sales, Week where flag =Y ... this gets us the stores designated as same stores and not just stores with sales for the corresponding week(s) last year. We also put the current year and ly sales in columns on one row in the sales fact table so we can do a few different things such as the stores with sales last year (though that isn't the norm).

Similar Messages

  • How to calculate the store count in OBIEE?

    Hi Experts,
    In some case, I should write some measures for MDX language , but I do not know how to calculate it in logic layer in OBIEE 11.1.1.6.0.
    Note: The muti-datasource is ESSBASE and version is 11.1.1.2
    My requirement is as below:
    There are many dimensions in ESSBASE. Store is Location member. If one store has sales in one day, I should count it. So I want to count all stores for sales.
    If I write MDX in ESSBASE or logical layer in OBIEE directly, it will generate sum value in OBIEE for several day, not MAX value.
    For example:
    2012/11/29, it has 1500 stores.
    2012/11/30, it has 1510 stores.
    If users select two day, it will sum these value and be 3010 stores. The expect result is 1510.
    This is my MDX language in Logic Layer:
    EVALUATE_AGGR('MAX( Operation.currentmember.Siblings,%1)', "Sales Cube"."Sales".""."Sales"."Is_Close" )
    Thanks.

    Hi,
    Assuming that the report which you are trying to build is for BI/Dashboard purpose and if you take a case that you need the counts on Monthly basis then you can build your logic in following ways:
    Parameter - Month - Year (Apr 2013)
    Start Count = No of active employees present as of the last working day of the last Month (in this case as of 31st March 2013)
    No of New hires = No of employees who have DOJ between 01-APr-2013 and 30-APR-2013
    No of Left employees = No of employees who have Actual termination date between 01-APr-2013 and 30-APR-2013
    Transfer Out and In = Based on the business definition of transfer you can see the movements between 01-APr-2013 and 30-APR-2013 and build your logic
    Similarly you can build your logic for Quarter, Half yearly and yearly counts too.
    Hope it helps. Let me know if you need further details.
    Thanks,
    Sanjay

  • How can calculate tatal price (sales price + Tax)?

    Hi,
    I set the pricing procedure and result of this can be appear in the net value as follow:
    Net Value = Sales Price - Discount.
    But I defined tax condition type that system calculated but it did not show in the sales order screen.
    I know , I can not see tax in the net value , but I want to know:
    1- How can I  see the result of all Tax condition in the sales order?
    2- Is it tax filed in the sales order?(I can not find it yet)
    3- How I can have total price in the sales order, because I want to create invoice in VF01?
    4- Can I have total price (Sales price - Discount + Tax)  in the VF01?
    Thanks a lot.

    Maintain Tax Condition Type as statistical in the Pricing Procedure.You will get Tax value in the Tax Tab at Item Level.
    Also maintain Total Price at a new step after all the Condition Types so that you will get the Total Value at Sales Order Level.While creating Invoice ,you will get Total Price through Copy Control.
    Best Regards,
    Ankur

  • Getting Same Store functionality to work across prior periods, not just current

    I have a basic Sales table, with a Store Key, Date Key, and dollar amount.  I also have a SameStore table, which for every combination of StoreKey and DateKey, says whether or not that store should be considered "Same Store" (was operational
    last year for the same time period) on a month to date, qtr to date, and YTD basis.  The MTD Y/N, QTD Y/N and YTD Y/N are available via the same store dimension.  Via my date dimension, I have all the usual date calcs, such as prior month, prior
    year, QTD, etc...
    It is very easy to query the totals for all of my stores as of Sept 2014 and get the current sales amout, as well as get the prior month, prior year, and so on.  Now, if I only want to see the totals for stores that should be considered "same store"
    as of Sept 2014, I can throw the MTD=Y up into my filter and then the current month's total will adjust to only show stores where their same store flag for Sept 2014 is set to a YES.  All of the NO's for Sept 2014 get removed... however, if one of those
    NO's was considered Same Store in August, their $$$ number is still being incldued in the Prior Month date calc.  I don't want it there, becuase as of September (the focus of my report) they are not considered same store anymore.  
    I am getting this:
    As of September 2014, Same Store=Yes
    Store Current$
    Last Month$ Last QTR$
    1 (closed 8/15) $0.00
    $100.00 $125.00
    2 $50.00
    $75.00 $60.00
    3 $60.00
    $65.00 $85.00
    But I really want this:
    As of September 2014, Same Store=Yes
    Store Current$
    Last Month$ Last QTR$
    1 (closed 8/15) $0.00
    $0.00 $0.00
    (or this whole row can just be gone completely)
    2 $50.00
    $75.00 $60.00
    3 $60.00
    $65.00 $85.00
    Just because Store 1 was considered to be a "Same Store" in August doesn't matter since I am running my report as of September.  It is not "Same Store" as of September, so it should vanish from all my calculations.
    Currently, dimStore, dimDates, and dimSameStoreStatus all hang off of the main Sales fact table.  I know this is part of the problem.  We are going to try and connect the dimSameStore to the dimStore and dimDates tables rather than the fact table,
    but I not sure if my overall design is right for this or not in general.
    Has anybody had to do something similar?  If I get a solution from somebody (or a great hint that helps me solve it), I'll send you a Starbucks gift card. 
    Thanks in advance!
    Mgr, Data Warehouse Svcs

    Hi D,
    The way I typically deal with this is to use a table, like you have, to mark whether the store was comparable for that Period.  Then, when you run a query, you are comparing two or more periods.  So, your query should restrict the scope to only
    include stores that were marked as comparable in all periods.  
    For example, if you are comparing this month with same month last year, you should only include stores that were comparable this month and same month last year.  If you have a query that is showing month on month growth for all the months this FY, you
    should only include stores that were comparable for all months so far this year.  This is more common for a rolling n period report.
    I find it quite interesting that most retailers use some variant of "Same Store Sales" with the express purpose of being able to compare performance with other retailers.  However every retailer has their own definition of what a comparable
    store is.
    Hope that helps,
    Richard

  • How to calculate current sale price like VA01

    Hi,
    I am developing one report, in which I am showing open sales order.
    Now, I wanted to calculate the current sales price from pricing procedures and conditions. Means I need the current sales price of the Item, like I am creating the new sales order today,
    Client wanted the difference between the sales order price and the current price.
    How can I get the current sales price, any Function Module for that?? Or I have to manually take all prices from condition tables and KONP, and calculate?
    I need a Function Module instead to code like..........
    Standard SAP pricing is try to get the price from top to down pricing hierarchy, if 1st level not find, then base on the combination of next level, try to get it,
    if no found, just keep going until reach the last pricing Level ( if found on any level then it will skip & pick up that price )
    For example
    ZPR0 has 3 Level
    Sales Org/DC/Currency/Customer/Material/Stor.Location
    Sales Org/DC/Currency/Customer/Material
    Sales Org/DC/Currency/Material
    If the combination of 1st level no price there, there it will go to the 2nd level until it reach the end.
    Thanks,
    Chetan Shah

    Hi,
    The Procedure for calculating MAP is :-
    Case 1 :- PO at different price
    If in Material Master your MAP is 0.8GBP & closing stock of 30Nos, value is 24GBP
    In PO if the price is 0.9GBP & qty is 10nos, then after Goods Receipt Total Value of the GR i.e. Qty * Price + any other delivery cost will be added to the material stock value.  Qty is also updated.  New Total Value / New Stock Qty will be MAP.
    In this case Qty received 10 & price is 0.9 that means value would be 9GBP.
    Total Value becomes 24GBP (Present Stock) + 9GBP (Goods Receipt) = 33GBP
    Total Qty becomes 30Nos + 10Nos (Goods Receipt) = 40Nos
    MAP becomes = 33GBP / 44Nos = 0.75
    Case 2 : Invoice Posting (MIRO) at different price than PO
    While doing MIRO is we post at different price system will check whether sufficient stock posted in GR is available.  In the above case it is 10Nos,
    If it is there, then the above logic as in case 1 will take place
    If not available, to the extent of stock availability system will post the different value & adjust MAP & remaining is posted to Price Difference Account.
    In your case it would be like this :
    1. MAP 0.8 for 30Nos (Value would be 24GBP)
    2. Invoice Posting 1.74GBP for 1No.  That means value would be 24GBP + 1.74GBP = 25.74GBP
         Qty would be 30+1 = 40
         MAP = 25.74 / 40   = 0.64GBP
    Hope this clarifies your doubt
    regards,
    JP

  • How to calculate cost(COGS) in Sales from project

    Dear all,
    I have a situation like this:
    My customer do not emplement PS(project system) and when managing sales from project, i don't know how to calculate cost of good sold for the service line.
    Each project (contruction site; building, ....), I use 1 material master as service item to manage. while project excecution, we issue material; collect labor cost; cost of external service, so on.... total up to COGS. but i don't know how to get this one in Sales order. Could you give me some suggestions?
    thanks!

    Dear,
    You need to create all these activities ( LABOUR CCOST/ COST OSFG EXTERNAL SERVICES)as Service Material and then put it into S.O. as Service Item and Bill the same.
    Regards
    AJIT K SINGH
    HAPPY TO HELP U

  • HOW TO CALCULATE NET SALES AND CONTRACT PRICE?

    Dear experts,
    I have the requirement of sales price report
    the report layout should be
    Prod descr    material Number   Contract type  contrcat name     rebate  net sales  contract price  units
    we have the master data information is reside already in multiprovider and transaction information how to calculate in frond end ?
    for sales  pricing report how to manipulate teh net sales and contract  price
    value?
    any standard formulaes is there?
    plz suggest  me
    regards

    Hi,
    For quick and best response unless someone answer's in this forum, post your question in SAP Community Network Forums » SAP Solutions » ERP - Sales and Distribution (SD) General   or something related to your question.
    Check this link if it helps -
    http://help.sap.com/saphelp_46c/helpdata/en/93/74353e546011d1a7020000e829fd11/frameset.htm
    Thanks,
    Shambhu.

  • In Sales enquiary stage how system calculate EK02 condition value as cacula

    Hi
    In Sales enquiary stage how system calculate EK02 condition value as caculated cost
    Is there any cofig to get the value of EK02 condition for calculated cost at Enquairy stage only for forcasting
    Regards
    Santosh

    Hi,
    In our company we get the calculated cost into our sales document with the following configuration:
    IMG: Plant maintenance and customer service / Maintenance and service processing / Basic settings / Quotation creation and billing / ODP4 - Assign conditions to sales document types
    With this configuration, we assign the calculated cost condition (EK02) to the corresponding sales document. The system sends the calculated costs from the order to the corresponding sales order created.
    Regards,
    Óscar
    http://blogdesap.blogspot.com

  • How to download apps store on my i phone 4s as the same has been deleted by mistake

    How to download apps store on my mobile i phone 4s as the same has been deleted by mistake

    If you mean you mistakenly deleted an app and want to redownload - open the app store, tap Purchases and you should see the app...just download again from there.

  • How to calculate the difference of two totals which are of the same group?

    Post Author: mingli
    CA Forum: Formula
    Hello,
    I have an existing report which has a group defined. The group generates two set of data, at the footer of each set of data, the total is calcuated. Now I need to calculate the difference between the totals. For example:
                             value
    set 1
          item 1         100
          item 2         200
          item 3        300
    set 1 total         600
    set 2
         item 1         200
         item 2          20
         item 3        300
         item 4         40
    set 2 total       560
    difference       40
    My question is: how can I do this? I'm thinking about create a formula. But the problem is, these two totals have the same field name. Could someone help me out?
    Thanks.

    Post Author: deejayw
    CA Forum: Formula
    Hi,I have a similar type of query...my Sets only ever contain two entries but there is an unknown number of sets.                        value
    set 1
          item 1         100
          item 2         200
    difference (item2 - item1) =   100
    set 2
         item 1         200
         item 2          20difference (item2 - item1) =    -180
    Set 3, Set 4, etc, etc I need to figure out how to calculate the "difference (item2 - item1)" total above. I am really confused by this and need assistance. Many thanks. 

  • SSRS - How to calculate porcent on the same fields

    Hi,
    I have a problem with my Report 
    I have a table like this:
    Description | Mounth
    [Description] | Sum(Valeur
    Pourcent | WHAT I NEED
    When i execute this on my web portal, i have this result:
    Description | January | February | March ...
    Desc 1        | 400       |   500       |   700 ...
    Desc 2        | 325      |   452        | 658
    Porcent       |              |                |
    I don't now how to calculate %. 
    For January i want to do 474/413, for february 1534/1457.
    But i dont know what i need to do in my tablix, in the cell "[WHAT I NEED]" to do this...
    Can you help me.
    SOrry for my bad english.
    Thanks for your help.
    Flo

    Hi sbenett,
    According to your description, you have  two rows in your matrix. Now you want the value in the second row divide the value in the first row. Right?
    In this scenario, since you only have tow rows in your matrix, we just need use the last value divide the previous values in the column group. So we can insert a row outside of group (row group), try the following expression in the cell: =last(Fields!column.Value)/first(Fields!column.Value)
    We have test this scenario in our local environment. Here are screenshots for your reference:
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • No help from support or the store sales agent lied

    Finally got a hold of the manager/ or someone who was able to fix my account. Well see in a few days when the chargers are changed. So I was paying $55 a month for just internet, had a really good deal. A sales agent comes to my house and offers me faster internet, with cable. After being for specific about what my bill would be on going with taxes. He quoted me a price of $70 So I was like yeah that's awesome $15 more a month for faster internet and cable. He said he would drop of the equipment in 3 days, and that a signal would go to my router with my new speeds.Over a week later I still had not received the equipment (its been 2 and half weeks now) and my internet speed never changes but boy did my bill... my bill was at $108I got on with support chat via comcasts website. I asked for my plan to be reverted back to what I had because the sales agent lied, and failed to deliver. I was told escalation would call me within 24-72 hours. Nothing happened. Days later my internet speed was cut in half. I get on with support again. He cant find my old ticket(how does your system lose a Ticket and a chat log????? I do Tier 4 support, that is complete bulls) or the chat. I give him the chat id and ticket # and the pdf of the conversation. I saved all my support transcripts. This agent ends up giving me the same story of exaltation will have to get in touch with me but he fixed my speed. (real quick side note in California my download speeds are doubled/increased)Again after receiving nothing from exaltation withing the time period quoted I when to chat with support again... This time they said that they cannot remove cable from my account I needed to go into a store to do that.Im just like well I guess I should go into a store...The agent at the store tells me that he can remove the cable, extra fees (how the  you going to charge people $15 to "install" there own cable box really? really?)BUThe says my new bill will be $5 more then what I was paying before all this bull because he does not have the ability to give me the same service sale I had before. I would need to contact the manager for the sales agent who came to my house. He will not call my back and refuses to answer my calls. Nobody at xfinity store will help me. What the  can I do?? This is insane.To top all of this off my account has the equipment listed but I never received the equipment, the agent at the store was able to note that on my account. He said it looks like the agent picked the equipment up from the store as it was not shipped. So now I have to return equipment I never received.I would cancel my account in a heartbeat but this is the fastest ISP in my area. Is there a better way to get support? Is there a way for me to file a complaint on this dbag sales agent? I just want the service I had before, with my billing amount back at $55.87 a month and  be resolved.... I was honestly super happy with comcast/Xfinity's service until this happened. 

    So now after dealing with support here. I once again cannot have my service reverted back to what it was before the sales agent lied and messed up my plan. SO it took me over 3 weeks to get any resolution from support, the store and the forums. In the end I will now be paying more each month then I did before all of this. That is absolutely terrible. 
    "We removed the Xfinity TV service off your account on 7/15. I also went ahead and removed the equipment off your account. At this time you only have Internet service only. The promotion you had before is no longer available. We have put you into the best promotion we have available for Blast Internet only for $49.99."  Let's make something really really clear. You Comcast/Xfinity made a mistake, now becuase of your mistake, I the customer am penalized from it. 

  • How to retrieve the ARCHIVED Sales order data

    Hi All,
    When issuing the output for the delivery, it is giving an error saying 'Sales Order XXXX does not exist' due to which the prices in the output were displayed as '0'. Reason for this can be that 'the order might have been archived'.
    My requirement is,
    1. If Sales Order doesnu2019t exist in data base then need to check if Sales order exists in archive data base.
    2. If  yes, take needed data from archive data base tables to calculate price. The logic of price calculation should be the same as for not archived Sales Orders.
    Can anyone help me on this..?
    Please tell me how to check whether the Sales order exists in the Archived database. Please share the table names(sample logic if possible) sothat I can use them in the report logic.
    Please tell me how to pull the data from the archive database tables to calculate the price.
    Thank you in advance.
    Thanks & Regards,
    Paddu.
    Edited by: Paddu K on Feb 23, 2009 3:42 PM

    *&      Form  get_archive_data
    *       Fetch Archive Data
    FORM get_archive_data .
      CLEAR:    g_read_handle, g_commit_cnt,
                g_read_cnt, g_reload_cnt,it_rel_tab,it_bseg_a,it_bkpf_a,
                it_bset_a, gt_result.
      REFRESH: it_rel_tab[],it_bseg_a[],it_bkpf_a[],
               it_bset_a[], gt_result[].
    *Populating selection screen fields to field-symbols
      PERFORM build_fs_select_options.
    *Call FM as_api_read  FI Data
      CALL FUNCTION 'AS_API_READ'
        EXPORTING
          i_fieldcat                      = 'SAP_FI_DOC_002'
          i_selections                    = ft_selections[]
    *   I_OBLIGATORY_FIELDS             =
    *   I_MAXROWS                       =
       IMPORTING
         e_result                        = gt_result[]
    EXCEPTIONS
       parameters_invalid              = 1
       no_infostruc_found              = 2
       field_missing_in_fieldcat       = 3
       OTHERS                          = 4
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT gt_result[] IS INITIAL.
    *Sorting by KEY and Offset
        SORT gt_result BY archivekey archiveofs.
    *To delete duplicates
        DELETE ADJACENT DUPLICATES FROM gt_result COMPARING archivekey
        archiveofs.
    *looping the internal table
        LOOP AT gt_result.
    *Get read handle for  object
          CALL FUNCTION 'ARCHIVE_READ_OBJECT'
            EXPORTING
              object         = 'FI_DOCUMNT'
              archivkey      = gt_result-archivekey
              offset         = gt_result-archiveofs
            IMPORTING
              archive_handle = g_read_handle
            EXCEPTIONS
              OTHERS         = 1.
          IF NOT sy-subrc IS INITIAL.
            MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            EXIT.
          ENDIF.
          IF sy-subrc = 0.
    *Get Acoounting Document details
            PERFORM object_read_opened
                      TABLES it_rel_tab
                             it_bseg_a
                             it_bkpf_a
    *                         it_bset_a
    *                         it_bsik_a
    *                         it_bsak_a
                             it_bsid_a
                             it_bsad_a
    *                         it_bsec_a
                      USING g_read_handle
                            l_archobj
                            g_commit_cnt
                            g_read_cnt
                            g_reload_cnt
          ENDIF.
    *close the file.
          CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
            EXPORTING
              archive_handle          = g_read_handle
            EXCEPTIONS
              internal_error          = 1
              wrong_access_to_archive = 2
              OTHERS                  = 3.
          IF sy-subrc <> 0.
            MESSAGE i004." 'Unable to close archive session'.
            EXIT.
          ENDIF.
        ENDLOOP.
      ELSE.
        MESSAGE i000 WITH 'No data found for Archived data'(095).
        EXIT.
      ENDIF.
    *Start of Changes by GTHATIKONDA on 10/17/2008 #ECDK902204
      IF NOT it_bkpf_a[] IS INITIAL.
        SORT it_bkpf_a BY belnr.
        DELETE ADJACENT DUPLICATES FROM it_bkpf_a COMPARING belnr.
        DELETE it_bkpf_a WHERE budat GT p_budat. "#ECDK902206
      ENDIF.
    *Start of Changes by GTHATIKONDA on 10/17/2008 #ECDK902206
      IF it_bkpf_a[] IS INITIAL.
        MESSAGE i000 WITH 'No data found for Archived data'(095).
      ENDIF.
    *End of Changes by GTHATIKONDA on 10/17/2008 #ECDK902206
      IF NOT it_bseg_a[] IS INITIAL.
        SORT it_bseg_a BY belnr gjahr buzei.
        DELETE ADJACENT DUPLICATES FROM it_bseg_a COMPARING
                                              belnr gjahr buzei.
      ENDIF.
    *End of Changes by GTHATIKONDA on 10/17/2008 #ECDK902204
    ENDFORM.                    " get_archive_data
    *&      Form  build_fs_select_options
    FORM build_fs_select_options .
      REFRESH:  ft_selections.
    *Comapny code
      APPEND INITIAL LINE TO ft_selections ASSIGNING <fw_selections>.
      <fw_selections>-fieldname  = 'BUKRS'.
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_bukrs  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    *Customer
      APPEND INITIAL LINE TO ft_selections ASSIGNING <fw_selections>.
      <fw_selections>-fieldname  = 'KUNNR'.
      LOOP AT s_kunnr.
        APPEND INITIAL LINE TO <fw_selections>-selopt_t
               ASSIGNING <lw_selopt>.
        MOVE-CORRESPONDING  s_kunnr TO <lw_selopt>.
      ENDLOOP.
    *Start of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    **Customer Group
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname  = 'KTOKD'.
    *  loop at s_ktokd.
    *    append initial line to <fw_selections>-selopt_t
    *           assigning <lw_selopt>.
    *    move-corresponding  s_ktokd to <lw_selopt>.
    *  endloop.
    *End of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    *Profit Center
      APPEND INITIAL LINE TO ft_selections ASSIGNING <fw_selections>.
      <fw_selections>-fieldname  = 'PRCTR'.
      LOOP AT s_prctr.
        APPEND INITIAL LINE TO <fw_selections>-selopt_t
               ASSIGNING <lw_selopt>.
        MOVE-CORRESPONDING  s_prctr TO <lw_selopt>.
      ENDLOOP.
    *Commented #ECDK902210
    **Key Date
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname  = 'BUDAT'.
    *  append initial line to <fw_selections>-selopt_t assigning <lw_selopt>
    *  move p_budat  to <lw_selopt>-low.
    *  move  'I' to <lw_selopt>-sign.
    *  move  'EQ' to <lw_selopt>-option.
    *Aging Period1
      APPEND INITIAL LINE TO ft_selections ASSIGNING <fw_selections>.
      <fw_selections>-fieldname  = 'ANZTA'.
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_ag1  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    *Aging Period2
    *Start of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname  = 'ANZTA'.
    *End of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_ag2  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    *Aging Period3
    *Start of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname  = 'ANZTA'.
    *End of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_ag3  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    *Aging Period4
    *Start of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname  = 'ANZTA'.
    *End of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_ag4  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    *Aging Period5
    *Start of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
    *  append initial line to ft_selections assigning <fw_selections>.
    *  <fw_selections>-fieldname = 'ANZTA'.
    *End of changes by GTHATIKONDA on 16/10/2008 #ECDK902192
      APPEND INITIAL LINE TO <fw_selections>-selopt_t ASSIGNING <lw_selopt>.
      MOVE p_ag5  TO <lw_selopt>-low.
      MOVE  'I' TO <lw_selopt>-sign.
      MOVE  'EQ' TO <lw_selopt>-option.
    ENDFORM.                    " build_fs_select_options
    *&      Form  object_read_opened
    *       To Fetch Arichive Data
    FORM object_read_opened TABLES   it_rel_tab
                                      it_bseg_a
                                      it_bkpf_a
    *                                  it_bset_a
    *                                  it_bsik_a
    *                                  it_bsak_a
                                      it_bsid_a
                                      it_bsad_a
    *                                 it_bsec_a
                             USING value(g_read_handle) LIKE sy-tabix
                                   value(l_archobj) LIKE arch_def-object
                             value(g_commit_cnt) LIKE arch_usr-arch_comit
                               g_read_cnt TYPE i
                               g_reload_cnt TYPE i.
      DATA: BEGIN OF table_wa ,
               table LIKE arch_stat-tabname,
            END  OF table_wa.
      DATA: lit_data(2048) TYPE c OCCURS 1 WITH HEADER LINE.
      DATA:  l_structure LIKE arch_stat-tabname,
             l_lin TYPE i.
      CLEAR: it_table_org1,lit_struc,it_table_org2,table_wa,it_rel_tab.
      REFRESH: it_table_org1[],lit_struc[],it_table_org2[],it_rel_tab[].
      CLEAR: g_duprec,g_read_cnt,g_reload_cnt,g_object_cnt.
    *Read  data from the infostructure
      DO.
        ADD 1 TO g_object_cnt.
        CLEAR l_structure.
        CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
          EXPORTING
            archive_handle                = g_read_handle
         IMPORTING
           record                        = lit_data
    *   RECORD_CURSOR                 =
    *   RECORD_FLAGS                  =
           record_structure              = l_structure
    *   RECORD_LENGTH                 =
    *   RECORD_REF                    =
         EXCEPTIONS
           end_of_object                 = 1
           internal_error                = 2
           wrong_access_to_archive       = 3
           OTHERS                        = 4
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          EXIT.
        ENDIF.
        IF NOT l_structure IS INITIAL.
          table_wa-table = l_structure.
          APPEND table_wa TO it_rel_tab.
        ENDIF.
        APPEND lit_data.
        CLEAR l_lin.
        FIELD-SYMBOLS: <fs_struc> TYPE c.
        CASE l_structure.
    *BKPF data
          WHEN 'BKPF'.
            ASSIGN it_bkpf_a TO <fs_struc> CASTING.
            <fs_struc> = lit_data.
            APPEND it_bkpf_a.
    *BSID data
          WHEN  'BSID'.
            ASSIGN it_bsid_a TO <fs_struc> CASTING.
            <fs_struc> = lit_data.
            APPEND it_bsid_a.
    *BSAD data
          WHEN  'BSAD'.
            ASSIGN it_bsad_a TO <fs_struc> CASTING.
            <fs_struc> = lit_data.
            APPEND it_bsad_a.
    *BSEG data
          WHEN 'BSEG'.
            ASSIGN it_bseg_a TO <fs_struc> CASTING.
            <fs_struc> = lit_data.
            APPEND it_bseg_a.
        ENDCASE.
        REFRESH lit_data.
        CLEAR g_object_cnt.
      ENDDO.
    ENDFORM.                    " object_read_opened
    *&      Form  get_bsid_bsad_archive_data
    *If Exclude Spl. GL Trnasaction is initial get BSID BSAD Archive data  *
    FORM get_bsid_bsad_archive_data .
    *Work Area
      DATA: wa_bsid TYPE type_bsid.
    *Reading BSAD Archive internal table
    *      loop at it_bsad_a   where bukrs eq p_bukrs
    *Start of changes by GTHATIKONDA on 10/14/2008 #ECDK902180
    *Commented by GTHATIKONDA on 10/17/2008 #ECDK902204
      LOOP AT it_bkpf_a  WHERE  bukrs = p_bukrs AND
                                budat LE p_budat. "#ECDK902206
    *End of changes by GTHATIKONDA on 10/14/2008 #ECDK902180
        LOOP AT it_bseg_a   WHERE bukrs EQ p_bukrs AND
                                  belnr EQ it_bkpf_a-belnr AND
                                  gjahr EQ it_bkpf_a-gjahr AND
                                  augdt GT p_budat AND
    *                            koart eq 'D'     and
                                  kunnr IN s_kunnr AND
                                  prctr IN s_prctr.
    *Changes by GTHATIKONDA on 10/17/2008 #ECDK902204
    *    loop at it_bkpf_a  where budat le p_budat."#ECDK902206
    *Move corresponding fiels
          MOVE-CORRESPONDING it_bseg_a TO wa_bsid.
          wa_bsid-blart = it_bkpf_a-blart.
          wa_bsid-budat = it_bkpf_a-budat.
          wa_bsid-bldat = it_bkpf_a-bldat.
          APPEND wa_bsid TO i_bsad.
          CLEAR wa_bsid.
        ENDLOOP.
      ENDLOOP.
      IF NOT i_bsad[] IS INITIAL.
        APPEND LINES OF i_bsad TO i_bsid.
      ENDIF.
    *Start of Changes by GTHATIKONDA on 10/17/2008 #ECDK902206
      IF NOT i_bsid[] IS INITIAL.
        SORT i_bsid BY belnr.
    *Commenting this logic by GTATIKONDA on 10/31/2008 #ECDK902245
    *  delete adjacent duplicates from i_bsid comparing belnr.
      ENDIF.
    *End of Changes by GTHATIKONDA on 10/17/2008 #ECDK902206
    ENDFORM.                    " get_bsid_bsad_archive_data
    *Reading BSAD Archive internal table
    *      loop at it_bsad_a  where bukrs eq p_bukrs
    *Start of changes by GTHATIKONDA on 10/14/2008 #ECDK902180
    *Commented by GTHATIKONDA on 10/17/2008 #ECDK902204
      LOOP AT it_bkpf_a  WHERE bukrs = p_bukrs AND  "#ECDK902206
                               budat LE p_budat.
    *End of changes by GTHATIKONDA on 10/14/2008 #ECDK902180
        LOOP AT it_bseg_a  WHERE bukrs EQ p_bukrs AND
                                 belnr EQ it_bkpf_a-belnr AND
                                 gjahr EQ it_bkpf_a-gjahr AND
                                 kunnr IN s_kunnr AND
                                 umskz EQ space AND
                                 augdt GT p_budat AND
                                 prctr IN s_prctr.
    *Changes by GTHATIKONDA on 10/17/2008 #ECDK902204
    *    loop at it_bkpf_a  where budat le p_budat. "#ECDK902206
    *Move corresponding fiels
          MOVE-CORRESPONDING it_bseg_a TO wa_bsid.
          wa_bsid-blart = it_bkpf_a-blart.
          wa_bsid-budat = it_bkpf_a-budat.
          wa_bsid-bldat = it_bkpf_a-bldat.
          APPEND wa_bsid TO i_bsad.
          CLEAR wa_bsid.
        ENDLOOP.
      ENDLOOP.
      IF NOT i_bsad[] IS INITIAL.
        APPEND LINES OF i_bsad TO i_bsid.
      ENDIF.

  • How to Calculate Opening balance

    Hi BW Gurus,
    How to calculate Opening balance for previous period using variables in Reports using debit and credit.
    Example:
    Opening balance is the balance for an account for the previous period. In other words, if the user is running a report for Period 1, 2006, the opening balance is actually the ending balance from Period 12, 2005 (December 31st, 2005).
    Thanks in advance
    DJ

    Hi Friend,
    If Your Prob is solve then tell me how to find perticular month balance amount.
    i m create cash book report for perticuler GL Account , i use BKPF + BSEG for this
    i found all entries,
    But at last i want to Opening Balance for perticuler date.
    like     01/05/2007 opening balance = 10000 as per tcode FS10N
    and in 26/05/2007 ??????
    how to find exact date opening balance is there any function for same
    or any procedure..
    Thanks
    From
    Gaurav

  • How to calculate Opening balance for a customer?

    Hi Experts,
    How to calculate Opening balance for a customer? I am trying to develop a report where in i have to get opening AR balance,current sales,adjustments etc of a customer. Please let me know how can i do this. I have some tables with me KNC1, BSAD, BSID.
    Thanks in Advance.
    Sharat Chandra.

    Say for example ..
    Get the opening bal for Customer 'K' in CCode 'C1' in 2008 ..
    First get all items from BSEG ..
    Select * from BSEG where KUNNR eq 'K'
                                     and BUKRS eq 'C1'
                                     and GJAHR eq '2008' .
    Sum all the DMBTR values (This is the total value).
    Second get the cleared items form BSAD for the above entries;
    Select * from BSAD for all entries in BSEG where KUNNR and BUKRS and XBLNR eq BSEG-XBLNR.
    Sum all DMBTR values ( this is cleared value).
    Third substract the cleared value from total to get Open value.
    This is a overview .. you should go to the tables and look for fields and etc.. and then define the logic meeeting your requirements .... this is a genric undersatnding ....
    Thanks,
    Aditya. V

Maybe you are looking for