Code to calculate Revenue

Hi Gurus,
Please write me a code for the following requirement. This is for using in a report in BI 7.0.
I have to calculate the field “Revenue in Future years” from the field “Revenue” .I.e. the source field is “Revenue” and the data source from which we take it is an Info cube.
“Revenue in Future years” will be the cumulative value of all Revenues for which Revenue effective date is greater than Current date.
I don’t have a field called Current date, we can pick it from the system.
I have to use this logic at the Query level(not at the cube level) because Revenue in Future years will vary every day when we run the Query.
Each time when we run the query, our code should pick the “Revenue effective date” for each value, compare them with the Current date and add up the Revenues for those values whose Revenue effective date is greater than Current date. The sum will be “Revenue in Future years”. 
Thank you
Sailesh.

Hi SUDHARSAN RAO
U r clearing the headers and tables. So u cannot use the values on the nested loops  as u have cleared the values. There wont be anything in the workare ur using in where clause.
Please see the below comments that I kept.
LOOP AT it_prps.
ACTUAL BILLING
LOOP AT it_final INTO wa_final
WHERE posid = it_prps-posid
AND wrttp = c_04
AND beltp = c_02
AND versn = c_0
AND ( vorga = c_coin OR vorga = c_rku2 ).
CLEAR act_billing.
IF sy-subrc IS INITIAL.
MOVE wa_final-wlp08 TO t_act_billing.
act_billing = act_billing + t_act_billing.
ENDIF.
CLEAR: it_prps, it_final.
Here IT_FINAL is cleared by u... should not be cleared
ENDLOOP.
*************PLANNED REVENUE
LOOP AT it_final INTO wa_final
WHERE posid = it_prps-posid
AND wrttp = c_01
AND beltp = c_02
AND versn = c_0
AND ( vorga = c_sdor OR vorga = c_rkp5 ).
CLEAR plan_rev.
IF sy-subrc IS INITIAL.
MOVE wa_final-wlp08 TO t_plan_rev.
plan_rev = plan_rev + t_plan_rev.
ENDIF.
Again ur clearing both tables.
CLEAR: it_prps, it_final.
ENDLOOP.
ENDCASE.
ENDLOOP.
WRITE:/10 'Actual Billing is',act_billing.
WRITE:/20 'Actual Cost is........', actu_cost.

Similar Messages

  • How to calculate  revenue vs taget in obiee11g (running every day)

    hallo masters,
    i have problem,
    i have target in 1 year (january until dec) e.g 1000
    and then there is revenue every day that calculate until reach 1 year
    how can i calculate revenue vs target current day (i only have 1 year target, not target daily or monthly)
    and how i can calculate persentage of revenue based on target
    revenue 1jan2013 until 25march2013 | target 1jan2013 until 25march2013 | %target | % revenue base on target
    and i need to know if % revenue less than target, then mark red
    and that calculate every year (runnig revenue and running target)
    please help mee
    Edited by: xavier_obieenewbie on Mar 25, 2013 2:35 AM

    whether this KPI can change every day base on target and revenue?
    because we need running target, it means that target every day increase
    target 1jan2012: target 1 year /356
    target upto 2jan2012: (target 1 year /356)*2
    target upto 3jan2012: (target 1 year /356)*3
    target upto 4jan2012: (target 1 year /356)*4
    ...etc
    revenue 1jan2012: a1
    revenue upto 2jan2012: a1+a2
    revenue upto 3jan2012: a1+a2+a3
    revenue upto 4jan2012: a1+a2+a3+a4
    ...etc
    e.g. this day is 4jan2012
    so we want to compare revenue upto 4jan2012 vs target upto 4jan2012
    whether revenue more than or less tahn target,
    its running every day

  • OKG3 Customizing RA Key to calculate Revenue recognition

    Can someone throw light  on how to configure PS RA Key to make the system calculate revenue based on POC percentage of completion. Need specifics around the valuation method and the overall scheme.
    Thanks

    Hi sridhar,
    I am putting very short you need read lot of help for more information.
    1 okg1 create  new key
    2 okg2 version 0 (will be there) turn extended control on  and technical cost elements give a single cost element for the fields cost element category 31 RA. tick the indicator transfer to financial accounting.
    3 maintain the combination Ra version and Ra key and select the 03 method cost based poc method.
    4 maintain line id for costs, revenues
    5 in okg5 assign all the cost elements to line id costs,
      revenue elements to the line id revenues
    6 in okg4 assign the cost line id to k and revenue line id to revenue category.
    update the line id to cost elements
    7 define the posting rules for cosr ans wipr rucr.
    please include the cost element in your allocation structure or else it will throw you a error at the time of settlement.
    I tried put it very simple, But it requires lot of reading the sap help to understand in detail.
    Thanking you
    Vengaiah Chowdary

  • How to calculate Revenue

    Hi Gurus,
    Please write me a code for the following requirement. This is for using in a report in BI 7.0.
    I have to calculate the field “Revenue in Future years” from the field “Revenue” .I.e. the source field is “Revenue” and the data source from which we take it is an Info cube.
    “Revenue in Future years” will be the cumulative value of all Revenues for which Revenue effective date is greater than Current date.
    I don’t have a field called Current date, we can pick it from the system.
    I have to use this logic at the Query level(not at the cube level) because Revenue in Future years will vary every day when we run the Query.
    Each time when we run the query, our code should pick the “Revenue effective date” for each value, compare them with the Current date and add up the Revenues for those values whose Revenue effective date is greater than Current date. The sum will be “Revenue in Future years”. 
    Thank you
    Sailesh.

    whether this KPI can change every day base on target and revenue?
    because we need running target, it means that target every day increase
    target 1jan2012: target 1 year /356
    target upto 2jan2012: (target 1 year /356)*2
    target upto 3jan2012: (target 1 year /356)*3
    target upto 4jan2012: (target 1 year /356)*4
    ...etc
    revenue 1jan2012: a1
    revenue upto 2jan2012: a1+a2
    revenue upto 3jan2012: a1+a2+a3
    revenue upto 4jan2012: a1+a2+a3+a4
    ...etc
    e.g. this day is 4jan2012
    so we want to compare revenue upto 4jan2012 vs target upto 4jan2012
    whether revenue more than or less tahn target,
    its running every day

  • Calculate Revenue's Percentage per Year, Month or any filter that is applied to the Dashboard in DAX using Excel PowerView.

    Hello folks,
    I am facing an odd issue here with a Dashboard Report in PowerView.
    The task is to display, in a table, a percentage of total (revenue) by any filter that the client wants. For instance, if the client selects the year (to be short) 2013, it should display for each Customer the percentage of total as Participation field.
    If the client select 2014, the data should change dinamically and the same if he selects both years.
    The issue that I am facing is that it calculates correctly (showing total of 100%) for either 2013 or 2014, but when I select both it sums up and shows 200% total, altering all other lines with the same behavior.
    So, basically what I need is to immitate a PARTITION BY analytic function, for instance, PARTITION BY YEAR and calculate the data over the total of the selected year only (if there are many years selected, the should be calculated over it, resulting in a
    100% total).
    Here is the formula that I am using in the column:
    =[Valor NF]/CALCULATE(SUM([Valor NF]);ALLEXCEPT(Faturamento;Faturamento[Ano]))
    Where [Valor NF] is the source column (invoyce total), Faturamento is my table (Revenue) and [Ano] is the year column, (I am calculating only by year to test)
    I'd appreciate any suggestion.
    Thanks in advance
    MCP

    Hi Nick,
      Thanks for your suggestion and it  worked for me   I  added the 'System message' web item and set the visibility to 'Hidden'  .Now I am not getting any message. Thank you for both.
    Thanks & Regards,
    Raja

  • Error "Enter section code" while doing revenue recog for Korea company code

    Hi
    While doing revenue recognition  for a sales document using VF44 for Korea  company code , i got an error to "enter sectio code".
    There is no WHT for the customer, only VAT is entered in the sales price.
    How to resolve this issue, Please help.
    Thanks,
    Vaishnavi

    Resolved.

  • Problem with "Tax Code" and "Calculate tax automatically" fields

    Hi again.
    I have made a program which posts account documents through the BAPI_ACC_DOCUMENT_POST function module, and, since there were some fields which weren't available for me to fill having the FM by itslef, I have implemented the AC_DOCUMENT BAdI.
    All document data is provided by means of an SAP XI interface, through a Z IDoc.
    When I create the Account Receivable (and/or Payable) structure, I fill, through the BAdI, the BKPF-XMWST (Calculate tax automatically) and BSEG-MWSKZ (Tax code) fields. However, even the resulting posted document does have the Tax Information fields completed (the ones in the BSET table), the BAPI doesn't create the tax position automatically (just like the FB01 or FB60 transactions do). Note that the amounts are sent in their gross value by the interface (that's why the debit and credit sides remain consistent and the document is posted correctly).
    How can I have that position created? Is there a function module which I can call or something?
    Thanks a lot in advance.

    Hi
    I only use the fm CALCULATE_TAX_FROM_NET_AMOUNT or CALCULATE_TAX_FROM_GROSSAMOUNT in order to get all information I need to transfer to the BAPI. Both fms return the data by table parameter T_MWDAT.
    U can read this table and get all information u need, these code is from my old program, I hope it can help you:
    - Calculate tax data:
    CALL FUNCTION 'CALCULATE_TAX_FROM_NET_AMOUNT'
            EXPORTING
              I_BUKRS           = BUK_TO
              I_MWSKZ           = T_BASE-MWSKZ_OUT
              I_WAERS           = _BKPF-WAERS
              I_WRBTR           = T_BASE-WRBTR
            TABLES
              T_MWDAT           = T_MWDAT
           EXCPTIONS.
          IF SY-SUBRC <> 0.
          ELSE.
    * Load tax item
            LOOP AT T_MWDAT.
              CLEAR W_GL_ITEM.
              W_GL_ITEM-HKONT   = T_MWDAT-HKONT.
              W_GL_ITEM-MWSKZ   = T_BASE-MWSKZ_OUT.
              IF T_BASE-KBETR = T_MWDAT-KBETR.
                W_GL_ITEM-WRBTR   = T_BASE-FWSTE.
              ELSE.
                W_GL_ITEM-WRBTR   = T_MWDAT-WMWST.
              ENDIF.
              W_GL_ITEM-IVA   = 'X'.
              W_GL_ITEM-KTOSL = T_MWDAT-KTOSL.
              W_GL_ITEM-TXJCD = T_MWDAT-TXJCD.
              W_GL_ITEM-KSCHL = T_MWDAT-KSCHL.
              W_GL_ITEM-TXJCD_DEEP = T_MWDAT-TXJCD_DEEP.
              W_GL_ITEM-TXJLV = T_MWDAT-TXJLV.
              W_GL_ITEM-BASE  = T_BASE-WRBTR.
              COLLECT W_GL_ITEM INTO GL_ITEM.
    - Append GL or Tax item for the BAPI
    LOOP AT GL_ITEM INTO W_GL_ITEM .
        ITEMNO_ACC = ITEMNO_ACC + 1.
        IF W_GL_ITEM-IVA = SPACE.
    * GL item
        ELSE.
    * Tax item
          ACCOUNTTAX-ITEMNO_ACC = ITEMNO_ACC.
          ACCOUNTTAX-TAX_CODE   = W_GL_ITEM-MWSKZ.
          ACCOUNTTAX-ACCT_KEY   = W_GL_ITEM-KOSTL.
          ACCOUNTTAX-COND_KEY   = W_GL_ITEM-KSCHL.
          ACCOUNTTAX-TAXJURCODE = W_GL_ITEM-TXJCD.
          ACCOUNTTAX-TAXJURCODE_DEEP  = W_GL_ITEM-TXJCD_DEEP.
          ACCOUNTTAX-TAXJURCODE_LEVEL = W_GL_ITEM-TXJLV.
          APPEND ACCOUNTTAX.
          PERFORM FILL_AMOUNT USING W_GL_ITEM-WRBTR W_GL_ITEM-BASE.
        ENDIF.
      ENDLOOP.
    Max
    Edited by: max bianchi on Nov 25, 2009 7:43 PM

  • Urgent ! Exit code to calculate End Date (31/12/9999) to Current system Dat

    Dear All,
    I have a scenario where i need to calculate Position time hold by an employee in an organisation.
    I have 2 date Char ( DATE FROM & DATE TO), the problem is that is , If an employee is having
    2/3 position in an organisation its current position End Date is always 31.12.999 as its End date is
    not know. For previous position End Date is maintained.
    My requirement is to calculate Position hold time including Current position.
    I have created 2 Formula Variable on Date From & Date To,
    The issue is that Date To is having both Values Previous Position Date thats ok as its not 31/12/9999
    I am geting those values in Forumla in addition its also having Date For Current position as 31/12/9999
    which should be converdet in to current system date.
    I need to write a User Exit on End Date Forumla Variable which should only convert if Date = 31/12/9999
    else leave it as it.
    For EX,
    EndDate
    1/1/2005
    1/1/2006
    31/12/9999(Only this value need to convert as current system date and leave above valuse as it)
    Can any one please provide me the code for this, this is v urgent.
    Thanks V V much.
    Regards,

    Hi Dilek,
    I now understand what you were writing.
    I played around a bit and it still doesn't work like I want to.
    The really strange thing is when I adapt an existing (SAP - standard) dynamic action (for another IT)  the 'calculation part' is performed and with my own attempt it doesn't substract the day.
    0442              BEGDA     06     10     P     T001P-MOLGA='05'
    0442              BEGDA     06     20     I     MOD,0014,1539
    0442              BEGDA     06     30     W     P0014-ENDDA=P0442-BEGDA
    0442              BEGDA     06     50     W     P0014-VTROP='-'
    0442              BEGDA     06     55     W     P0014-VTRAN='1'
    0442              BEGDA     06     60     W     P0014-VTRZH='010'
    If IT0442 is created or changed, IT0014 with subtype/wagetype 1539 should be delimited with enddate = (startdate IT0442 -/- 1 day)
    If you can have a look whether I mak e an obvious mistake, it's appreciated.
    In the meantime I'll fiddle around as well at my end.....
    Thanks,
    Wilfred.

  • Customer exit code to calculate  Average YTD.

    Hi Experts,
    I want to create new column ( AVGYTD TRGT) in Bex report for folling data .( Which is FF data).
    I have created one formula variable(zfmvavgytd) of type customer exit. and strucked at coding part.
    so that, anybody provide customer exit code for required column(avgytd trgt). and details are as follows.
    0CALMONTH  ENO  ENAME  PERDAY_ TRGT  
    04.2011             1     ABC             100                     
    04.2011             2     BCD             200
    05.2011             1     ABC             200 
    05.2011             2     BCD             200 
    06.2011             1     ABC             300 
    06.2011             2     BCD             200 
    07.2011             1     ABC             200
    07.2011             2     BCD             200 
    till  03.2012        
    Now I want to display the column for ( AVG YTD_TRGT)   based on "0calmonth " & " ENo  "   as below
    AVG YTD_TRGT
    100           
    200
    150
    200
    200
    200
    200
    200
    calculation behind this is...
    for 04 .2011   --empno(1)  ---100/1
    for 04 .2011   --empno(2)  ---200/1
    for 05 .2011   --empno(1)  ---200+100/2
    for 05 .2011   --empno(1)  ---200+200/2
    for 06 .2011   --empno(1)  ---300200100/3
    for 06 .2011   --empno(1)  ---200200200/3
    for 07 .2011   --empno(1)  ---200300200+100/4
    for 07 .2011   --empno(1)  ---200200200+200/4

    First you need to calcualte the YTD and then Average YTD.
    Year to Date (YTD) u2013 From the 1st to entered u201CKey Dateu201D for the current year.
    Average Year to Date - YTD divided by the u201CNo of Daysu201D in year till u201CKey Dateu201D for current year.
    Check the below code for getting Previous YTD....next create a Selection restrict the KF with YTD varaible
    Below is sample code for reference.
    to calculate "Previous year to date" (User input Calday u2013 key date)
    WHEN 'ZDAYPYR'.
    IF I_STEP = 2. "after the popup
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZPDATE'.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.
    L_S_RANGE-LOW(4) = L_S_RANGE-LOW(4) - 1. "low value previos year
    v_loc_date = L_S_RANGE-LOW. "take input value in another variable
    L_S_RANGE-LOW+4(4) = '0101'.
    L_S_RANGE-HIGH = v_loc_date. "high value = input, taken into another variable
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    EXIT.
    ENDLOOP.
    ENDIF.

  • How Revenue Recognition value calculate in VF45 for an item

    Hello Experts,
    I want to know how system calculates Revenue Recognition for any item in VF45. I know the configuration part of Revenue Recognition but want to know the calculation part, how calculation going to find out the vale of the Revenue recognition.
    Item net price is 3139255.45 and system calculate Revenue recognition for this item is  3139020.94.
    I want to know how calculation going for Revenue recognition.
    Can any body help me out ? any link /document related to Revenue Recognition Calculation (not configuration)  please share with me.
    Thanks,

    Hello Prasanth,
    For example :- Maintaining an annual Price  ZPRC - 1200  and Billing plan is Annual
    So, while recognising SAP takes 1200 / 365(Number of days) =  3.287 per day
    For jan - 31 days - 31*3.287 =101.91
    For feb - 28 days - 28*3.287 = 92.05
    Thank you for your time.

  • Calculation of revenue per employee

    hi gurus
    I am facing a Porbrm in designing a report int hat report I have to calculate REVENUE PER EMPLOYEE.
    the scenario is like this
    I have a Project XFPB_BW  revenue for this project is known say 5000.00 INR
    we have EMPLoyee they book TIme using timesheet and the cost rete is maintained in the time sheet.
    say
          emp no    qty   cost
         1010         10     100
         1010          8      200
          1010          7      300
    total                25      600
    now I have to calculate rev per employee like this
    rev/cost = (revenue/cost)*individual cost  = 8.33
    rev / qty= (revenue/qty)*individual qty        = 200
    <b>  project          employee    cost      qty     rev       rev/cost      rev/qty</b></b>
        XFPB_BW                          0          0       5000      0              0
                                1010           100      10      0         833                    2000 
                                1010           200      8        0        1666                   1600
                                1010           300      7        0         2499                    1400
    total                                       600       25       5000   4998                    5000

    I am writing this start routine for this
    PROGRAM trans_routine.
          CLASS routine DEFINITION
    CLASS lcl_transform DEFINITION.
      PUBLIC SECTION.
    Attributs
        DATA:
          p_check_master_data_exist
                TYPE RSODSOCHECKONLY READ-ONLY,
    *-    Instance for getting request runtime attributs;
        Available information: Refer to methods of
        interface 'if_rsbk_request_admintab_view'
          p_r_request
                TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.
      PRIVATE SECTION.
        TYPE-POOLS: rsd, rstr.
      Rule specific types
        TYPES:
          BEGIN OF tys_SC_1,
         InfoObject: 0PROJECT Project Definition.
            PROJECT           TYPE /BI0/OIPROJECT,
         InfoObject: 0EMPLOYEE Employee.
            EMPLOYEE           TYPE /BI0/OIEMPLOYEE,
         InfoObject: 0FISCPER Fiscal year / period.
            FISCPER           TYPE /BI0/OIFISCPER,
         InfoObject: 0FISCVARNT Fiscal year variant.
            FISCVARNT           TYPE /BI0/OIFISCVARNT,
         InfoObject: 0CALDAY Calendar Day.
            CALDAY           TYPE /BI0/OICALDAY,
         InfoObject: 0VTYPE Value Type for Reporting.
            VTYPE           TYPE /BI0/OIVTYPE,
         InfoObject: 0CURTYPE Currency Type.
            CURTYPE           TYPE /BI0/OICURTYPE,
         InfoObject: 0AMOUNT Amount.
            AMOUNT           TYPE /BI0/OIAMOUNT,
         InfoObject: 0RECORDMODE BW Delta Process: Update Mode.
            RECORDMODE           TYPE RODMUPDMOD,
         InfoObject: 0CURRENCY Currency Key.
            CURRENCY           TYPE /BI0/OICURRENCY,
         InfoObject: ZMATERIAL Material (Role).
            /BIC/ZMATERIAL           TYPE /BIC/OIZMATERIAL,
         InfoObject: 0PRIORITY Priority.
            PRIORITY           TYPE /BI0/OIPRIORITY,
         InfoObject: 0CO_AREA Controlling area.
            CO_AREA           TYPE /BI0/OICO_AREA,
         InfoObject: 0WBS_ELEMT Work Breakdown Structure Element (WBS Elem
    *ent).
            WBS_ELEMT           TYPE /BI0/OIWBS_ELEMT,
         InfoObject: 0UNIT Unit of Measure.
            UNIT           TYPE /BI0/OIUNIT,
         InfoObject: 0COSTELMNT Cost Element.
            COSTELMNT           TYPE /BI0/OICOSTELMNT,
         InfoObject: 0COMP_CODE Company code.
            COMP_CODE           TYPE /BI0/OICOMP_CODE,
         InfoObject: 0PROFIT_CTR Profit Center.
            PROFIT_CTR           TYPE /BI0/OIPROFIT_CTR,
         InfoObject: ZREV_CE1 revenue from cost element.
            /BIC/ZREV_CE1           TYPE /BIC/OIZREV_CE1,
         InfoObject: 0QUANTITY Quantity.
            QUANTITY           TYPE /BI0/OIQUANTITY,
         Field: RECORD.
            RECORD           TYPE RSARECORD,
          END   OF tys_SC_1.
        TYPES:
          tyt_SC_1        TYPE STANDARD TABLE OF tys_SC_1
                            WITH NON-UNIQUE DEFAULT KEY.
    $$ begin of global - insert your declaration only below this line  -
    ... "insert your code here
    TYPES: BEGIN OF tt_revfac,
              projdef     TYPE /bic/cs8zods_mpp-project,
              FISCPER     TYPE /bic/cs8zods_mpp-FISCPER,
              amt         TYPE /bic/cs8zods_mpp-amount,
              revenue     TYPE /bic/cs8zods_mpp-/BIC/ZREV_CE1,
              "Add by Jatin
    END OF tt_revfac.
    TYPES: BEGIN OF tt_qtyfac,
               projdef     TYPE /bic/cs8zods_mpp-project,
               FISCPER     TYPE /bic/cs8zods_mpp-FISCPER,
               qty         TYPE /bic/cs8zods_mpp-quantity,
               revenue     TYPE /bic/cs8zods_mpp-/BIC/ZREV_CE1,
               "Add by Jatin
      END OF tt_qtyfac.
    DATA:   ...
    *DATA: g_t_revfac  TYPE STANDARD TABLE OF tt_revfac.
    *DATA: g_t_qtyfac  TYPE STANDARD TABLE OF tt_qtyfac.
    DATA: g_t_revfac  TYPE SORTED TABLE OF tt_revfac WITH UNIQUE KEY projdef
    fiscper.
    DATA: g_t_qtyfac  TYPE SORTED TABLE OF tt_qtyfac WITH UNIQUE KEY projdef
    fiscper.
    $$ end of global - insert your declaration only before this line   -
        METHODS
          start_routine
            IMPORTING
              request                  type rsrequest
              datapackid               type rsdatapid
            EXPORTING
              monitor                  type rstr_ty_t_monitors
            CHANGING
              SOURCE_PACKAGE              type tyt_SC_1
            RAISING
              cx_rsrout_abort.
        METHODS
          inverse_start_routine
            IMPORTING
              i_th_fields_outbound         TYPE rstran_t_field_inv
              i_r_selset_outbound          TYPE REF TO cl_rsmds_set
              i_is_main_selection          TYPE rs_bool
              i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
              i_r_universe_inbound         TYPE REF TO cl_rsmds_universe
            CHANGING
              c_th_fields_inbound          TYPE rstran_t_field_inv
              c_r_selset_inbound           TYPE REF TO cl_rsmds_set
              c_exact                      TYPE rs_bool.
    ENDCLASS.                    "routine DEFINITION
    $$ begin of 2nd part global - insert your code only below this line  *
    ... "insert your code here
    $$ end of 2nd part global - insert your code only before this line   *
          CLASS routine IMPLEMENTATION
    CLASS lcl_transform IMPLEMENTATION.
          Method start_routine
          Calculation of source package via start routine
      <-> source package
      METHOD start_routine.
    *=== Segments ===
        FIELD-SYMBOLS:
          <SOURCE_FIELDS>    TYPE tys_SC_1.
        DATA:
          MONITOR_REC     TYPE rstmonitor.
    *$*$ begin of routine - insert your code only below this line        *-*
    ... "insert your code here
    DATA: lwa_datapackage  LIKE LINE OF  SOURCE_PACKAGE,
            lwa_revfac      TYPE  tt_revfac,
            lwa_qtyfac      TYPE tt_qtyfac.
      LOOP AT SOURCE_PACKAGE INTO lwa_datapackage.
         lwa_revfac-projdef = lwa_datapackage-project.
         lwa_revfac-FISCPER = lwa_datapackage-FISCPER.         "Add by Jatin
         lwa_revfac-amt     = lwa_datapackage-amount.
         lwa_revfac-revenue = lwa_datapackage-/BIC/ZREV_CE1.
         COLLECT lwa_revfac INTO g_t_revfac.
         lwa_qtyfac-projdef = lwa_datapackage-project.
          lwa_qtyfac-FISCPER = lwa_datapackage-FISCPER.      "Add by Jatin
         lwa_qtyfac-qty = lwa_datapackage-quantity.
         lwa_qtyfac-revenue = lwa_datapackage-/BIC/ZREV_CE1.
         COLLECT lwa_qtyfac INTO g_t_qtyfac.
      ENDLOOP.
    SORT g_t_revfac BY projdef.
    SORT g_t_qtyfac BY projdef.
    *--  fill table "MONITOR" with values of structure "MONITOR_REC"
    *-   to make monitor entries
    ... "to cancel the update process
       raise exception type CX_RSROUT_ABORT.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "start_routine
          Method inverse_start_routine
          This subroutine needs to be implemented only for direct access
          (for better performance) and for the Report/Report Interface
          (drill through).
          The inverse routine should transform a projection and
          a selection for the target to a projection and a selection
          for the source, respectively.
          If the implementation remains empty all fields are filled and
          all values are selected.
      METHOD inverse_start_routine.
    $$ begin of inverse routine - insert your code only below this line-
    ... "insert your code here
    $$ end of inverse routine - insert your code only before this line -
      ENDMETHOD.                    "inverse_start_routine
    ENDCLASS.                    "routine IMPLEMENTATION
    (REV by quantity)
          CLASS routine IMPLEMENTATION
    CLASS lcl_transform IMPLEMENTATION.
      METHOD compute_ZRFEV_QTY.
      IMPORTING
        request     type rsrequest
        datapackid  type rsdatapid
        SOURCE_FIELDS-PROJECT TYPE /BI0/OIPROJECT
        SOURCE_FIELDS-EMPLOYEE TYPE /BI0/OIEMPLOYEE
        SOURCE_FIELDS-FISCPER TYPE /BI0/OIFISCPER
        SOURCE_FIELDS-CURRENCY TYPE /BI0/OICURRENCY
        SOURCE_FIELDS-UNIT TYPE /BI0/OIUNIT
        SOURCE_FIELDS-QUANTITY TYPE /BI0/OIQUANTITY
       EXPORTING
         RESULT type tys_TG_1-/BIC/ZRFEV_QTY
         CURRENCY type tys_TG_1-CURRENCY
        DATA:
          MONITOR_REC    TYPE rsmonitor.
    *$*$ begin of routine - insert your code only below this line        *-*
    ... "insert your code here
    DATA: lwa_qtyfac TYPE tt_qtyfac,
            l_avg  TYPE tt_qtyfac-qty.
      READ TABLE g_t_qtyfac INTO lwa_qtyfac
                            WITH KEY projdef = SOURCE_FIELDS-PROJECT
                                     FISCPER = SOURCE_FIELDS-FISCPER
                           BINARY SEARCH.
    Collect entries for fical year
      IF sy-subrc = 0.
        IF lwa_qtyfac-qty <> 0.
          l_avg = lwa_qtyfac-revenue / lwa_qtyfac-qty.
        ELSE.
          l_avg = 0.
        ENDIF.
    ENDIF.
    *--  fill table "MONITOR" with values of structure "MONITOR_REC"
    *-   to make monitor entries
    ... "to cancel the update process
       raise exception type CX_RSROUT_ABORT.
    ... "to skip a record
       raise exception type CX_RSROUT_SKIP_RECORD.
    ... "to clear target fields
       raise exception type CX_RSROUT_SKIP_VAL.
         RESULT = l_avg * SOURCE_FIELDS-quantity .
         CURRENCY = SOURCE_FIELDS-CURRENCY .
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_ZRFEV_QTY
          Method invert_ZRFEV_QTY
          This subroutine needs to be implemented only for direct access
          (for better performance) and for the Report/Report Interface
          (drill through).
          The inverse routine should transform a projection and
          a selection for the target to a projection and a selection
          for the source, respectively.
          If the implementation remains empty all fields are filled and
          all values are selected.
      METHOD invert_ZRFEV_QTY.
    $$ begin of inverse routine - insert your code only below this line-
    ... "insert your code here
    $$ end of inverse routine - insert your code only before this line -
      ENDMETHOD.                    "invert_ZRFEV_QTY
    ENDCLASS.                    "routine IMPLEMENTATION
    the problem with this is that I can not filter at the Query levele NOw I want to know Can I write it at query level if possible how
    Please help its urgent and challenging also.

  • DAX - Querying: How to reinforce a filter in order to calculate a year to date

    Dear community,
    I am pulling my hair off due to an issue I am having with the creation of a DAX query (supposed to feed an SSRS report).
    The topic is P&L related, I need to compute the revenue based on specific cost elements, that same query must return additional columns that represent YTD, Forecast,... etc ( a couple of typical aggregations).
    First of all here is the query I currently simplified to explain my issue:
    EVALUATE
    CALCULATETABLE(
    SUMMARIZE(
    GENERATE(
    VALUES(AccountingPeriod[RealAccountingPeriod]),
    FactFInancialTransaction
    AccountingPeriod[Code],
    CostElement[Code],
    CostElement[Group],
    "Revenue", [Revenue],
    "GroupRevenue",
    CALCULATE(
    [Revenue],
    all(CostElement[Code])
    FILTER(
    VALUES(CostElement[Code]),
    CostElement[Code] = "RSFOR" ||
    CostElement[Code] = "RSTHI" ||
    CostElement[Code] = "RSOTH"
    FILTER(
    VALUES(CostElement[Group]),
    CostElement[Group] = "RGOVE"
    FILTER(
    ALL(AccountingPeriod),
    AccountingPeriod[Code] = 201402
    FILTER(
    VALUES(OperationalUnit[OperationalUnitNumber]),
    VALUES(OperationalUnit[OperationalUnitNumber]) = "052"
    The Revenue is simply a SUM of an amount column in FactFinancialTransactions.
    What I am unable to do is compute GroupRevenue where I simply would like to sum the revenues for the elements. Does anybody have an idea on the calculate statement that will help me achieve this?
     I tried doing something like:
    CALCULATE(
    [Revenue], all(FactFinancialTransactions),
    all(CostElement[Code]), Values(CostElement[Group]), Values(AccountingPeriod[code]) Values(OperationalUnit[OperationalUnitNumber]) )
    This does not work at all, it looks like the VALUES(OperationalUnit[OperationalUnitNumber]) context is not reinforced, the value I get in return is actually the one summing ALL operational units.
    PS: I have to keep the filter on OperationalUnit as is because it will actually be a pathcontains statement that can pass multiple values
    Thanks so much for any help
    Mils.

    I am not entirely sure about your requirements and your data model.
    However, I would start using ADDCOLUMNS instead of SUMMARIZE to add columns to the group you need.
    EVALUATE
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE (
                GENERATE (
                    VALUES ( AccountingPeriod[RealAccountingPeriod] ),
                    FactFInancialTransaction
                AccountingPeriod[Code],
                CostElement[Code],
                CostElement[Group]
            "Revenue", [Revenue],
            "GroupRevenue", CALCULATE ( [Revenue], ALL ( CostElement[Code] ) )
        FILTER (
            VALUES ( CostElement[Code] ),
            CostElement[Code] = "RSFOR"
                || CostElement[Code] = "RSTHI"
                || CostElement[Code] = "RSOTH"
        FILTER (
            VALUES ( CostElement[Group] ),
            CostElement[Group] = "RGOVE"
        FILTER (
            ALL ( AccountingPeriod ),
            AccountingPeriod[Code] = 201402
        FILTER (
            VALUES ( OperationalUnit[OperationalUnitNumber] ),
            VALUES ( OperationalUnit[OperationalUnitNumber] ) = "052"
    Marco Russo (Blog,
    Twitter,
    LinkedIn) - sqlbi.com:
    Articles, Videos,
    Tools, Consultancy,
    Training
    Format with DAX Formatter and design with
    DAX Patterns. Learn
    Power Pivot and SSAS Tabular.

  • Revenue recognition through RA

    Hi CO and RA Gurus
    Does any one know how to do Revenue Recognition using Result Analysis Keys.
    thanks
    KT

    Hi,
    Result Analysis:
    Overview:
    The objective for calculating Work in Process (WIP) is to determine the value of manufacturing activity in process at the end of a fiscal period, during a fiscal period and to properly reflect this value on the financial statements. WIP calculation is a facet of Results Analysis (RA). RA is a specialized tool within the controlling module that computes and analyzes the value of WIP. The terms WIP calculation and RA are generally interchangeable.
    Results analysis is used to:
    a. Calculate the inventory value of finished and unfinished products in a non-valuated project stock or non-valuated sales stock environment or
    b. You are using a valuated sales order stock or valuated project stock and want to capitalize goods that have been delivered but not yet invoiced.
    The difference between SAP and other systems is in the treatment of material consumption for manufacturing. Component issues to production orders, run schedules, WBSs, etc is immediately treated as an expense to the P&L statement. The issue is not treated as a reclassification from raw or semi-finished inventory to WIP inventory. SAP considers WIP to be a snapshot of values that can be computed on demand and passed to the general ledger as required to re-class the values to the balance sheet. This process demands a specific, methodical approach to be used for period-end and mid-period processing. Rules used to calculate the value of WIP and settle WIP to the G/L are defined in multiple RA tables depending upon the requirements of the company. RA is designed to support a variety of calculation techniques and there may and are alternate settings depending on the demands of the company. To support the configuration, scenarios and unit testing need to be thorough. RA needs to be configured towards the middle of the of the implementation with subsequent testing. This will allow for configuration of the data needed to support WIP and RA (chart of accounts, production orders, projects, cost centers, cost elements, etc.)
    Configuration Transactions:
    OKG1 u2014 Create Results Analysis Key
    OKG2 u2014 Results Analysis Version
    OKG9 u2014 Results Analysis Version
    OKGC u2013 OKGD u2014 Valuation Methods
    IMG SPRO u2014 Define Line IDs
    OKGB u2014 Define Assignment Mapping by incoming charges by cost element to line IDs
    OKG5 u2014 Define Assignment Mapping by incoming charges by cost element to line IDs
    OKG4 u2014 Define Update
    OKG6 u2014 Define Number Ranges
    If your done with RA configuration and posted actual cost,plan cost and plan revenue.
    you can calculate revenue recognistion using KKA2 T.code for projects.
    Hope this helps you.
    Thanks,
    Rau

  • Is there a way to create a recurring revenue/billing event in Projects (r12)?

    Is there any way to create a revenue/billing event in Projects that can be scheduled (billed monthly until a specified end date) other than a customization?

    I think there is no standard way to do it. However you can use billing extension to create automatic events. You may define the DFF fields on Project or Task level for having a recurring amount and End Date which will be picked during Generate Draft Revenue or Generate Draft Invoices. You can check in extension that if the event is already created for that month, extension should not create another event for same month for that project or Task because user may run the processes several times in a month. Please note that there will not be any history kept for DFF changes for amount and dates.
    You may decide on other means to keep recurring amount and End Dates to maintain History.
    Awaiting more inputs from experts.
    Also consider below statement from User Guide:
    Transaction Independent
    Once you determine the inputs to your calculations, you can determine if your billing extension calculation is solely dependent on other transactions being processed, or if your calculation can be executed without any other transactions being processed. Transactions refer to expenditure items and events.
    Transaction independent billing extensions are executed for each project with an active billing assignment, even if there are no transactions to process. This type of billing extension relies on an input other than billable transactions on a project. If this input changes, the calculated billing amount changes, which you want to record. For example, the cost-to-cost revenue accrual method, which relies on the budgeted cost and revenue amounts. If the budgeted cost or budgeted revenue changes, the revenue amount changes. You want to record this revenue amount change even if no other transactions are processed in revenue generation. This category includes the class of billing extensions that calculate revenue and invoice amounts based on values independent of the amounts included on draft revenue and invoices.
    Note: If you design a billing extension to be transaction independent, it will be executed in every run of the revenue or invoice processes.
    AB

  • RA method 15 ignoring certain Cost of Sales Cost Elements for its calculat

    Hi,
    We are using RA method 15 to calculate revenue accruals for costs posted to a WBS element, but not yet billed.
    We normally have cost of sales being posted to a GL / Primary Cost Element (type 1) 601000, with quantities, which is then picked up by RA correctly and which adjust the revenue accruals accordingly.
    We are using a further GL / primary cost element (type 1) to post manual adjustments to (602000). This also has quantities posted to it. This is included in the configuration in OKG5, with the same settings as the cost element 601000.
    For some reason, this account is not being included in the RA calculation.
    does anyone have any ideas why this might be the case?
    Many thanks in anticipation
    Jill

    Is CE 602000 included in the DIP Profile for RRB?
    Methods 14 and 15 work in concert with the DIP Profile.  Check is the CE is included in the Source Selection.

Maybe you are looking for