Problem with performing calculations on COUNT-aggregated columns

Hi guys,
I have something weird - 2 columns with Aggregation set to Count, both are from the same Fact table. Indicators are in the same Fact table.
Count column A (with FILTER key_column USING Indicator1='yes')
Count column B (with FILTER key_column USING Indicator1='yes' and Indicator2='yes')
They show fine by themselves.
However, when I create a column C where:
Column B / Column A - I get nulls.
I tried both filtering logical content with Filter and also running CASE WHEN , etc.
Anyone else had it?

Well, it certainly has to do something with IFNULL. Now, when I did what you suggested, I get correct numbers, but only after i drill-down from top level. I'll try to tweak with levels and see what's up.
Success:
not only it's important to use IFNULL, but also it's important to set level aggregation for A and B (i set it to Fiscal Year). Thanks for assistance
Message was edited by:
wildmight

Similar Messages

  • Problem with a calculated member browsing cube with a specific user role

    Good evening to all of you .
    I am not a newbie about SSAS nor an expert developer.
    I use SSAS 2008 R2 Standard Edition.
    I try to simplify my problem with a calculated measure.
    I have a CUBE with :
    [Measures].[Sales Amount]
    Dimension STORES - Dimension CUSTOMERS - Dimension DATE
    I have also 2 user roles :
    Direction Role can see all members of all dimensions.
    Customize Role  has a restriction about Dimension STORES ..it can see only a STORE of all (Suppose to have 100 stores).
    User that has a Customize Role, when browse cube in Excel , want to see for a specific CUSTOMER , Sales Amount of his own STORE but also the total Sales Amount of ALL STORES for that Customer...
    Is it possibile to do that ???
    Can you give any suggestion also using Adventure Works Cube ???
    I was able to create a calculated measure like that below.
    It does not work...It give the same result of Sales Amount
    It seems that Customize Role win Always about every kind of calculate measure i need to create..
    i.e  SUM([STORES].[STORES].[ALL STORES],[Measures].[Sales Amount])
    Thanks in advance.

    Hi maretix,
    According to your description, you have a customize role which limit the user can only see data about his own STORE. Now this user wants to see the total Sales Amount for his own STORES only. Right?
    In Analysis Services, when granting custom access to dimension data, it has a option "Enable Visual Total" in Advanced dimension security. By default, the
    VisualTotals property is disabled (set to False). This default setting maximizes performance because Analysis Services can quickly calculate the total of all cell values, instead of having to spend time selecting which
    cells values to calculate. So you always get same result which is the total for all STORES.
    In this scenario, please select this option. When you enable the VisualTotals property, your custom role can only view aggregated totals for dimension members to which the role has permission.
    Reference:
    Grant custom access to dimension data (Analysis Services)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Problem with performance in flash player 11.4.402.287

    Hi,
    We found the problem in 11.4.402.287 flash player. IN Debug version, Flex application works fine but in standard version we experience  problems with performance.
    This happens only in 11.4.402 version for Firefox. In another browsers and Flash player versions everything works fine.
    For example, 11.3 for Firefox does not have this problem.
    Application has a lot of small objects that receives rollover and rollout events and depend on object highlited some of these objects

    Hi,
    Can you try 11.5 beta? http://labs.adobe.com/downloads/flashplayer11-5.html
    thanks,
    Hitomi

  • Problem with the calculator and modifications needed

    i have got a problem with the calculator on my iphone i.e i cannot find any DEL key or Backspace....the problem is when typing a long value if one number is entered wrong we should start again.
    EXAMPLE...if i need to type    114678047 * 345612
    if acidentally if i type 114678047 * 3455           ( then i should start over typing  "C"  key)
    i should start over to type the whole data..if we have a delete key we can just correct it right away and continue.....rather than starting over
    we can find this feature in all the other smart phones , i dont know why apple coudnt find that
    even every scientific calculator have a DEL key...
    Thanks
    vickyk7

    FEEDBACK
    If you want to give Apple feed back then do it here http://www.apple.com/feedback/iphone.html

  • Problem with performance in a code.

    Hi People! I have problems with the performance of this program. The tables that I use have much data and the program take two hours to finish.
    Please, some one tell me how can I make a better performance.
    Thanks!
    This is the program:
    TABLES:
            faglflext,         "Saldos mensuales por cta. 
                                contable y prf center.
            zavg_bal_table,
            skat.              "Chart of accounts
    ********************INTERNAL TABLE DEFINITION***************************
    DATA: BEGIN OF t_itab1 OCCURS 0.
    DATA: rbukrs      TYPE faglflext-rbukrs. "Company Code
    DATA: racct       TYPE faglflext-racct. "Account ID
    DATA: prctr       TYPE faglflext-prctr. "Profit Center
    DATA: kslvt       TYPE faglflext-kslvt. "Total of the period in group currency
    DATA: ksl01       TYPE faglflext-ksl01. "Total of the period in group currency
    DATA: ksl02       TYPE faglflext-ksl02. "Total of the period in group currency
    DATA: ksl03       TYPE faglflext-ksl03. "Total of the period in group currency
    DATA: ksl04       TYPE faglflext-ksl04. "Total of the period in group currency
    DATA: ksl05       TYPE faglflext-ksl05. "Total of the period in group currency
    DATA: ksl06       TYPE faglflext-ksl06. "Total of the period in group currency
    DATA: ksl07       TYPE faglflext-ksl07. "Total of the period in group currency
    DATA: ksl08       TYPE faglflext-ksl08. "Total of the period in group currency
    DATA: ksl09       TYPE faglflext-ksl09. "Total of the period in group currency
    DATA: ksl10       TYPE faglflext-ksl10. "Total of the period in group currency
    DATA: ksl11       TYPE faglflext-ksl11. "Total of the period in group currency
    DATA: ksl12       TYPE faglflext-ksl12. "Total of the period in group currency
    DATA: ksl13       TYPE faglflext-ksl13. "Total of the period in group currency
    DATA: ksl14       TYPE faglflext-ksl14. "Total of the period in group currency
    DATA: ksl15       TYPE faglflext-ksl15. "Total of the period in group currency
    DATA: ksl16       TYPE faglflext-ksl16. "Total of the period in group currency
    DATA: rldnr       TYPE faglflext-rldnr. "Ledger in GL Accounting
    DATA: rtcur       TYPE faglflext-rtcur. "Currency Key
    DATA: txt20       TYPE skat-txt20.      "Description Text
    DATA: saknr       TYPE skat-saknr.      "G/L account number
    DATA: ktopl       TYPE skat-ktopl.      "Chart of Accounts
    DATA: rpmax       TYPE faglflext-rpmax. "Period
    DATA: total_sum   LIKE faglflext-ksl01. "Amount of the first month
    DATA: ryear       LIKE faglflext-ryear. "Fiscal Year
    DATA: year        LIKE faglflext-ryear. "Past Year
    DATA: day_a       TYPE sy-datum.
    DATA: per_day     TYPE rr_umper.
    DATA: average     TYPE vtcur12.
    DATA: agregate    TYPE vtcur12.
    DATA: accumulate  TYPE vtcur12.
    DATA: average_sap TYPE rr_umper.
    DATA: END OF t_itab1.
    DATA: BEGIN OF t_itab2 OCCURS 0.
    DATA: rbukrs    TYPE faglflext-rbukrs. "Company Code
    DATA: racct     TYPE faglflext-racct. "Account ID
    DATA: prctr     TYPE faglflext-prctr. "Profit Center
    DATA: kslvt     TYPE faglflext-kslvt. "Total of the period in group currency
    DATA: ksl01     TYPE faglflext-ksl01. "Total of the period in group currency
    DATA: ksl02     TYPE faglflext-ksl02. "Total of the period in group currency
    DATA: ksl03     TYPE faglflext-ksl03. "Total of the period in group currency
    DATA: ksl04     TYPE faglflext-ksl04. "Total of the period in group currency
    DATA: ksl05     TYPE faglflext-ksl05. "Total of the period in group currency
    DATA: ksl06     TYPE faglflext-ksl06. "Total of the period in group currency
    DATA: ksl07     TYPE faglflext-ksl07. "Total of the period in group currency
    DATA: ksl08     TYPE faglflext-ksl08. "Total of the period in group currency
    DATA: ksl09     TYPE faglflext-ksl09. "Total of the period in group currency
    DATA: ksl10     TYPE faglflext-ksl10. "Total of the period in group currency
    DATA: ksl11     TYPE faglflext-ksl11. "Total of the period in group currency
    DATA: ksl12     TYPE faglflext-ksl12. "Total of the period in group currency
    DATA: ksl13     TYPE faglflext-ksl13. "Total of the period in group currency
    DATA: ksl14     TYPE faglflext-ksl14. "Total of the period in group currency
    DATA: ksl15     TYPE faglflext-ksl15. "Total of the period in group currency
    DATA: ksl16     TYPE faglflext-ksl16. "Total of the period in group currency
    DATA: rldnr     TYPE faglflext-rldnr. "Ledger in GL Accounting
    DATA: rtcur     TYPE faglflext-rtcur. "Currency Key
    DATA: txt20     TYPE skat-txt20.      "Description Text
    DATA: saknr     TYPE skat-saknr.      "G/L account number
    DATA: ktopl     TYPE skat-ktopl.      "Chart of Accounts
    DATA: rpmax     TYPE faglflext-rpmax. "Period
    DATA: total_sum LIKE faglflext-ksl01. "Amount of the first month
    DATA: ryear     LIKE faglflext-ryear. "Fiscal Year
    DATA: year      LIKE faglflext-ryear. "Past Year
    DATA: END OF t_itab2.
    DATA: BEGIN OF t_zavg OCCURS 0.
    DATA: bukrs       TYPE bukrs.
    DATA: racct       TYPE racct.
    DATA: prctr       TYPE prctr.
    DATA: day_a       TYPE sy-datum.
    DATA: per_day     TYPE rr_umper.
    DATA: average     TYPE vtcur12.
    DATA: agregate    TYPE vtcur12.
    DATA: accumulate  TYPE vtcur12.
    DATA: average_sap TYPE rr_umper.
    DATA: END OF t_zavg.
    DATA: BEGIN OF t_zavg2 OCCURS 0.
    DATA: day_a       TYPE sy-datum.
    DATA: racct       TYPE racct.
    DATA: prctr       TYPE prctr.
    DATA: per_day     TYPE rr_umper.
    DATA: average     TYPE vtcur12.
    DATA: agregate    TYPE vtcur12.
    DATA: accumulate  TYPE vtcur12.
    DATA: average_sap TYPE rr_umper.
    DATA: END OF t_zavg2.
    *                      Variable definition                             *
    DATA: balance_month_01          LIKE faglflext-ksl01.
    DATA: balance_month_02          LIKE faglflext-ksl01.
    DATA: balance_month_03          LIKE faglflext-ksl01.
    DATA: balance_month_04          LIKE faglflext-ksl01.
    DATA: balance_month_05          LIKE faglflext-ksl01.
    DATA: balance_month_06          LIKE faglflext-ksl01.
    DATA: balance_month_07          LIKE faglflext-ksl01.
    DATA: balance_month_08          LIKE faglflext-ksl01.
    DATA: balance_month_09          LIKE faglflext-ksl01.
    DATA: balance_month_10          LIKE faglflext-ksl01.
    DATA: balance_month_11          LIKE faglflext-ksl01.
    DATA: balance_month_12          LIKE faglflext-ksl01.
    DATA: balance_month_13          LIKE faglflext-ksl01.
    DATA: current_average_balance   LIKE zavg_bal_table-average.
    DATA: current_balance           LIKE faglflext-ksl01.
    DATA: current_activity_balance  LIKE faglflext-ksl01.
    DATA: current_aggregate_balance LIKE zavg_bal_table-agregate.
    DATA: average_balance_ytd       LIKE zfintbco0001-period_avg_12.
    DATA: count                     TYPE i.
    DATA: wa_itab                   LIKE LINE OF t_itab1.
    DATA: wa_low                    LIKE LINE OF t_itab1.
    DATA: wa_high                   LIKE LINE OF t_itab1.
    DATA: wa_itab2                  LIKE LINE OF t_itab2.
    DATA: wa_zavg2                  LIKE LINE OF t_zavg2.
    DATA: wa_zavg                   LIKE LINE OF t_zavg.
    DATA: t_acum                    TYPE i.
    DATA: companycode               TYPE faglflext-rbukrs.
    DATA: descripcion               TYPE skat-txt20.
    DATA: oref                      TYPE REF TO cx_root,
          emsg                      TYPE zedesc,
          param1                    TYPE zparm,
          parm1                     TYPE zparm.
    DATA: avg1                      TYPE faglflext-ksl01.  "AVG = AVERAGE
    DATA: avg2                      TYPE faglflext-ksl01.
    DATA: avg3                      TYPE faglflext-ksl01.
    DATA: avg4                      TYPE faglflext-ksl01.
    DATA: avg5                      TYPE faglflext-ksl01.
    DATA: avg6                      TYPE faglflext-ksl01.
    DATA: avg7                      TYPE faglflext-ksl01.
    DATA: avg8                      TYPE faglflext-ksl01.
    DATA: avg9                      TYPE faglflext-ksl01.
    DATA: avg10                     TYPE faglflext-ksl01.
    DATA: avg11                     TYPE faglflext-ksl01.
    DATA: avg12                     TYPE faglflext-ksl01.
    DATA: conteo                    TYPE i.
    DATA: conteo2                   TYPE i.
    DATA: numerocta                 TYPE faglflext-racct.
    DATA: profitcenter              TYPE faglflext-prctr.
    DATA: average_month_01          TYPE zavg_bal_table-average.
    DATA: aggregate_month_01        TYPE zavg_bal_table-agregate.
    DATA: average_month_02          TYPE zavg_bal_table-average.
    DATA: aggregate_month_02        TYPE zavg_bal_table-agregate.
    DATA: average_month_03          TYPE zavg_bal_table-average.
    DATA: aggregate_month_03        TYPE zavg_bal_table-agregate.
    DATA: average_month_04          TYPE zavg_bal_table-average.
    DATA: aggregate_month_04        TYPE zavg_bal_table-agregate.
    DATA: average_month_05          TYPE zavg_bal_table-average.
    DATA: aggregate_month_05        TYPE zavg_bal_table-agregate.
    DATA: average_month_06          TYPE zavg_bal_table-average.
    DATA: aggregate_month_06        TYPE zavg_bal_table-agregate.
    DATA: average_month_07          TYPE zavg_bal_table-average.
    DATA: aggregate_month_07        TYPE zavg_bal_table-agregate.
    DATA: average_month_08          TYPE zavg_bal_table-average.
    DATA: aggregate_month_08        TYPE zavg_bal_table-agregate.
    DATA: average_month_09          TYPE zavg_bal_table-average.
    DATA: aggregate_month_09        TYPE zavg_bal_table-agregate.
    DATA: average_month_10          TYPE zavg_bal_table-average.
    DATA: aggregate_month_10        TYPE zavg_bal_table-agregate.
    DATA: average_month_11          TYPE zavg_bal_table-average.
    DATA: aggregate_month_11        TYPE zavg_bal_table-agregate.
    DATA: average_month_12          TYPE zavg_bal_table-average.
    DATA: aggregate_month_12        TYPE zavg_bal_table-agregate.
    DATA: ano                       TYPE i.
    DATA: ano_pasado                TYPE i.
    DATA: ano_corriente             TYPE i.
    DATA: mesdia                    TYPE adb_pfrom.
    DATA: firstline                 TYPE i.
    DATA: kslvt                     TYPE faglflext-kslvt.
    DATA: ksl01                     TYPE faglflext-ksl01.
    DATA: ksl02                     TYPE faglflext-ksl02.
    DATA: ksl03                     TYPE faglflext-ksl03.
    DATA: ksl04                     TYPE faglflext-ksl04.
    DATA: ksl05                     TYPE faglflext-ksl05.
    DATA: ksl06                     TYPE faglflext-ksl06.
    DATA: ksl07                     TYPE faglflext-ksl07.
    DATA: ksl08                     TYPE faglflext-ksl08.
    DATA: ksl09                     TYPE faglflext-ksl09.
    DATA: ksl10                     TYPE faglflext-ksl10.
    DATA: ksl11                     TYPE faglflext-ksl11.
    DATA: ksl12                     TYPE faglflext-ksl12.
    DATA: ksl13                     TYPE faglflext-ksl13.
    DATA: ksl14                     TYPE faglflext-ksl14.
    DATA: ksl15                     TYPE faglflext-ksl15.
    DATA: ksl16                     TYPE faglflext-ksl16.
    DATA: itab_kslvt                TYPE faglflext-kslvt.
    DATA: itab_ksl01                TYPE faglflext-ksl01.
    DATA: itab_ksl02                TYPE faglflext-ksl02.
    DATA: itab_ksl03                TYPE faglflext-ksl03.
    DATA: itab_ksl04                TYPE faglflext-ksl04.
    DATA: itab_ksl05                TYPE faglflext-ksl05.
    DATA: itab_ksl06                TYPE faglflext-ksl06.
    DATA: itab_ksl07                TYPE faglflext-ksl07.
    DATA: itab_ksl08                TYPE faglflext-ksl08.
    DATA: itab_ksl09                TYPE faglflext-ksl09.
    DATA: itab_ksl10                TYPE faglflext-ksl10.
    DATA: itab_ksl11                TYPE faglflext-ksl11.
    DATA: itab_ksl12                TYPE faglflext-ksl12.
    DATA: itab_ksl13                TYPE faglflext-ksl13.
    DATA: itab_ksl14                TYPE faglflext-ksl14.
    DATA: itab_ksl15                TYPE faglflext-ksl15.
    DATA: itab_ksl16                TYPE faglflext-ksl16.
    DATA: itab_bal00                TYPE faglflext-kslvt.
    DATA: itab_bal01                TYPE faglflext-ksl01.
    DATA: itab_bal02                TYPE faglflext-ksl02.
    DATA: itab_bal03                TYPE faglflext-ksl03.
    DATA: itab_bal04                TYPE faglflext-ksl04.
    DATA: itab_bal05                TYPE faglflext-ksl05.
    DATA: itab_bal06                TYPE faglflext-ksl06.
    DATA: itab_bal07                TYPE faglflext-ksl07.
    DATA: itab_bal08                TYPE faglflext-ksl08.
    DATA: itab_bal09                TYPE faglflext-ksl09.
    DATA: itab_bal10                TYPE faglflext-ksl10.
    DATA: itab_bal11                TYPE faglflext-ksl11.
    DATA: itab_bal12                TYPE faglflext-ksl12.
    DATA: itab_bal13                TYPE faglflext-ksl13.
    DATA: itab_bal14                TYPE faglflext-ksl14.
    DATA: itab_bal15                TYPE faglflext-ksl15.
    DATA: itab_bal16                TYPE faglflext-ksl16.
    DATA: numero_de_cta             TYPE  faglflext-racct.
    DATA: company_code              TYPE  faglflext-rbukrs.
    DATA: profit_center             TYPE  faglflext-prctr.
    DATA: currency_code             TYPE  faglflext-rtcur.
    DATA: average_month             TYPE  zavg_bal_table-average.
    DATA: aggregate_month           TYPE  zavg_bal_table-agregate.
    * VARIABLES FOR INTERFACES LOG
    DATA: v_tipo                    TYPE zzfinbc85typede VALUE 1. "Tipo 1 = OUT
    DATA: v_nom_int(9)              TYPE c VALUE 'ZFINFII00'. "Nombre de la interfaz
    DATA: v_modulo(2)               TYPE c VALUE 'FI'. "Modulo
    DATA: v_comp_code(4)            TYPE c VALUE '0000'. "Compañia 0000
    DATA: v_alegacy(4)              TYPE c VALUE '0001'.
    DATA: v_fecha                   TYPE d.
    DATA: v_error2(3)               TYPE c VALUE 'E'.
    DATA: l_sys_exc                 TYPE REF TO  cx_ai_system_fault.
    DATA: last_day                  TYPE sy-datum.
    DATA: numero_mes                TYPE i.
    DATA: ryear                     TYPE faglflext-ryear.
    DATA: numero_cuenta             TYPE faglflext-racct.
    DATA: numero_profit             TYPE faglflext-prctr.
    DATA: day_a                     TYPE i.
    DATA: text(20)                  TYPE c.
    *Acknowledge
    DATA: lo_async_messaging        TYPE REF TO if_wsprotocol_async_messaging,
    lo_msg_id_protocol              TYPE REF TO if_wsprotocol_message_id,
    l_msg_id                        TYPE sxmsguid,
    l_ack_request                   TYPE prx_ack_request_details.
    DATA: fecha                     TYPE sy-datum.
    DATA: fecha_ejecutandose        TYPE sy-datum.
    DATA: fecha_corriente           TYPE i.
    DATA: jan_fin                   TYPE sy-datum.
    DATA: feb_fin                   TYPE sy-datum.
    DATA: febb_fin                  TYPE sy-datum.
    DATA: mar_fin                   TYPE sy-datum.
    DATA: apr_fin                   TYPE sy-datum.
    DATA: may_fin                   TYPE sy-datum.
    DATA: jun_fin                   TYPE sy-datum.
    DATA: jul_fin                   TYPE sy-datum.
    DATA: aug_fin                   TYPE sy-datum.
    DATA: sep_fin                   TYPE sy-datum.
    DATA: oct_fin                   TYPE sy-datum.
    DATA: nov_fin                   TYPE sy-datum.
    DATA: dec_fin                   TYPE sy-datum.
    DATA: porciento1                TYPE faglflext-ksl01.
    DATA: porciento2                TYPE faglflext-ksl01.
    DATA: porciento3                TYPE faglflext-ksl01.
    DATA: porciento4                TYPE faglflext-ksl01.
    DATA: porciento5                TYPE faglflext-ksl01.
    DATA: porciento6                TYPE faglflext-ksl01.
    DATA: porciento7                TYPE faglflext-ksl01.
    DATA: porciento8                TYPE faglflext-ksl01.
    DATA: porciento9                TYPE faglflext-ksl01.
    DATA: porciento10               TYPE faglflext-ksl01.
    DATA: porciento11               TYPE faglflext-ksl01.
    DATA: porciento12               TYPE faglflext-ksl01.
    data: mes(2)                    type c value '00'.
    data: mes_anterior              type sy-datum.
    data: ceros(2)                  type c.
    *DEFINICION DE RANGOS.
    RANGES profit FOR faglflext-prctr.
    RANGES account FOR faglflext-racct.
    RANGES end_month FOR zavg_bal_table-day_a.
    *Sele asigna el fin de mes a cada variable para que sea utilizada luego en el programa.
    jan_fin = '20060131'.
    feb_fin = '20060228'.
    febb_fin = '20060229'.
    mar_fin = '20060331'.
    apr_fin = '20060430'.
    may_fin = '20060531'.
    jun_fin = '20060630'.
    jul_fin = '20060731'.
    aug_fin = '20060831'.
    sep_fin = '20060930'.
    oct_fin = '20061031'.
    nov_fin = '20061130'.
    dec_fin = '20061231'.
    *Inicializando las variables a valor '0'.
    balance_month_01          = 0.
    balance_month_02          = 0.
    balance_month_03          = 0.
    balance_month_04          = 0.
    balance_month_05          = 0.
    balance_month_06          = 0.
    balance_month_07          = 0.
    balance_month_08          = 0.
    balance_month_09          = 0.
    balance_month_10          = 0.
    balance_month_11          = 0.
    balance_month_12          = 0.
    balance_month_13          = 0.
    current_average_balance   = 0.
    current_balance           = 0.
    current_activity_balance  = 0.
    current_aggregate_balance = 0.
    average_balance_ytd       = 0.
    count                     = 0.
    t_acum                    = 0.
    conteo                    = 1.
    conteo2                   = 1.
    ceros                     = '00'.
    *THIS IS A STRUCTURE NAMED E_SKAT. WITH THE TWO FIELDS NAMED SAKNR     *
    *AND TXT20.                                                            *
    TYPES: BEGIN OF e_skat,
             ktopl LIKE skat-ktopl,
             saknr LIKE skat-saknr,
             txt20 LIKE skat-txt20,
           END OF e_skat.
    *         SORT THE STRUCTURE IN ORDER FOR BEST PERFORMANCE             *
    DATA it_skat TYPE SORTED TABLE OF e_skat
         WITH UNIQUE KEY saknr WITH HEADER LINE.
    DATA: wa_skat                  LIKE LINE OF it_skat.
    *           CONSTANT DEFINITIONS (HAVE THE SAME VALUE EVER)            *
    CONSTANTS:
          etype                     TYPE zetype  VALUE 'INTER',       "Utilizada con la funcion de error
          innum                     TYPE zintnum VALUE 'ZFINFII00',       "Utilizada con la funcion de error
          inname                    TYPE zinname VALUE 'Sendero and Cognos Interfase', "Utilizada con la funcion de error
          c_cuenta(10)              TYPE c VALUE '0000270011',
          c_ol(2)                   TYPE c VALUE '0L',
          c_chart(4)                TYPE c VALUE 'CAPI',              "Chart Of Accounts
          c_ceros(17)               TYPE n VALUE '00000000000000.00', "ceros
          acct_cog(10)              TYPE n VALUE '0000270011',        "Numero de cta. que se busca en COGNOS.
          capi(4)                   TYPE c VALUE 'CAPI'.
    *                PARAMETROS de entrada para el usuario.                *
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    PARAMETERS:
               p_date   TYPE sy-datum DEFAULT sy-datum.       "Fecha de corrida
    IF p_date IS INITIAL.
      p_date = sy-datum.
    ENDIF.
    *     PARAMETEROS DE ENTRADA POR MEDIO DE RANGOS PARA EL USUARIO       *
    SELECT-OPTIONS:
                p_bukrs FOR faglflext-rbukrs.
    SELECTION-SCREEN END OF BLOCK bl1.
    *IF THE USER SELECT THIS CHECK BOX WITH A CHECK MARK THE PROGRAM       *
    *SUBMIT THIS INTERFACE TO.                                             *
    SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
    PARAMETERS:
              p_cognos    TYPE c AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK bl2.
    * This statement calls the subroutine specified, SENDERO or COGNOS     *
    IF p_cognos IS INITIAL.
      PERFORM sendero.
    ELSE.
      PERFORM cognos.
    ENDIF.
    EXIT.
    *                      SENEDERO INTERFACE                              *
    FORM sendero.
    *ESTE SELECT EXTRAE LA DATA DE LA TABLA FAGFLEXT Y SKAT
      DATA: msgdetails     TYPE zgl_sendero_file_dt_tab.
      DATA: wa_msgdetails  LIKE LINE OF msgdetails.
      SELECT a~ryear a~rpmax a~rtcur a~racct a~rbukrs a~prctr
             a~kslvt a~ksl01 a~ksl02 a~ksl03 a~ksl04 a~ksl05
             a~ksl06 a~ksl07 a~ksl08 a~ksl09 a~ksl10 a~ksl11
             a~ksl12 a~ksl13 a~ksl14 a~ksl15 a~ksl16 b~saknr
             b~txt20 b~ktopl
            FROM  faglflext AS a INNER JOIN skat AS b ON a~racct = b~saknr AND a~rclnt = b~mandt
            CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE t_itab1
        WHERE  a~rclnt = sy-mandt
          AND  a~rbukrs IN p_bukrs
          AND  a~rldnr  = '0L'
          AND  a~ryear  = p_date+0(4)
          AND  b~spras  EQ sy-langu
          AND  b~ktopl  EQ 'CAPI'.
    *SI NO ENCUENTRA DATA EN LA TABLA FAGLFLEXT ENVIA EL MENSAJE DE ERROR
    *A LA TABLA DE ERROR.
      IF sy-subrc <> 0.
        MOVE 'No data found in FLAGLFLEXT or ZAVG_BAL_TABLE for this process.'(e01) TO emsg.
    *    PERFORM call_error_function USING emsg.
    *    PERFORM call_log_function_send.
        MESSAGE: emsg TYPE 'E'.
      ENDIF.
    *EN ESTE SELECT SACO LA DESCRIPCION DE LA CUENTA
      SORT t_itab1 BY racct ASCENDING.
      DELETE t_itab1 WHERE racct = ''.
      SORT t_itab1 BY prctr ASCENDING.
      CLEAR t_itab1.
      READ TABLE t_itab1 INTO wa_low  INDEX 1 .
      DESCRIBE TABLE t_itab1 LINES firstline.
      READ TABLE t_itab1 INTO wa_high INDEX firstline.
      IF wa_high-prctr = 'DUMMY'.                      "SI EL ULTIMO RECORD CONTIENE ALGUN 'DUMMY' ESCOJER EL RECORD DE ARRIBA.
        firstline = firstline - 1.                     "CONTIENE EL NUMERO DEL INDICE.
        READ TABLE t_itab1 INTO wa_high INDEX firstline.
      ENDIF.
      profit-sign    = 'I'.
      profit-option  = 'BT'.
      profit-low     = wa_low-prctr.
      profit-high    = wa_high-prctr.
      APPEND profit.
    *COMPUTOS PARA CALCULAR EL ULTIMO DIA DEL MES.
      fecha       = p_date.
      numero_mes = p_date+4(2).                       "PASO NUMERO DEL MES A VARIABLE.
      p_date+4(2) = p_date+4(2) - numero_mes.         "LE RESTO EL MISMO MES A LA FECHA PARA COMENZAR EL CONTEO DESDE EL MES 1.
      DO numero_mes TIMES.                           "SE VA A EJECUTAR LAS MISMAS VECES DEL NUMERO DEL MES.
        p_date+4(2) = p_date+4(2) + 1.                  "SE INCREMENTA EL NUMERO DEL MES.
        CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'    "Obtiene el ultimo numero del mes.
          EXPORTING
            day_in            = p_date
          IMPORTING
            last_day_of_month = last_day
          EXCEPTIONS
            day_in_not_valid  = 1
            OTHERS            = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        IF fecha = p_date.
          fecha = fecha - 1.   "le resta a fecha -1 para que busque en la tabla zavg_bal_table el record del dia anterior.
          end_month-sign    = 'I'.
          end_month-option  = 'EQ'.
          end_month-low     = fecha.
          APPEND end_month.
        ELSE.
          end_month-sign    = 'I'.
          end_month-option  = 'EQ'.
          end_month-low     = last_day.
          APPEND end_month.
        ENDIF.
      ENDDO.
      SORT end_month BY low ASCENDING.
      SELECT bukrs racct prctr day_a per_day average agregate accumulate average_sap
        FROM zavg_bal_table CLIENT SPECIFIED APPENDING TABLE t_zavg
        WHERE mandt = sy-mandt
          AND bukrs IN p_bukrs
          AND  day_a <= sy-datum
          AND  prctr IN profit.
      SORT t_itab1 BY rbukrs racct prctr.
      SORT t_zavg  BY  bukrs racct prctr day_a.
    *IMPRESION Y ENVIO DE LOS DATOS REQUERIDOS
    *Estos If verifican el mes que se esta ejecutando por el usuario para cambiarselo a la variable que identifica el fin de mes.
      IF p_date+4(2) = jan_fin+4(2).
        jan_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = feb_fin+4(2).
        feb_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = mar_fin+4(2).
        mar_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = apr_fin+4(2).
        apr_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = may_fin+4(2).
        may_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = jun_fin+4(2).
        jun_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = jul_fin+4(2).
        jul_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = aug_fin+4(2).
        aug_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = sep_fin+4(2).
        sep_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = oct_fin+4(2).
        oct_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = nov_fin+4(2).
        nov_fin+6(2) = p_date+6(2).
      ENDIF.
      IF p_date+4(2) = dec_fin+4(2).
        dec_fin+6(2) = p_date+6(2).
      ENDIF.
    *Comienza primer loop en el programa a t_itab1 que es la tabla interna que contiene los datos de faglflext.
      LOOP AT t_itab1 INTO wa_itab WHERE racct  NE ''.
        AT NEW prctr.  "Limpia las variables que se muestran en el clear cada ves que comienza un nuevo profit center.
          CLEAR: itab_kslvt, itab_ksl01, itab_ksl02, itab_ksl03, itab_ksl04, itab_ksl05, itab_ksl06, itab_ksl07, itab_ksl08,
                 itab_ksl09, itab_ksl10, itab_ksl11, itab_ksl12, itab_ksl13, itab_ksl14, itab_ksl15, itab_ksl16,
                 itab_bal00, itab_bal01, itab_bal02, itab_bal03, itab_bal04, itab_bal05, itab_bal06, itab_bal07,
                 itab_bal08, itab_bal09, itab_bal10, itab_bal11, itab_bal12, itab_bal13, itab_bal14, itab_bal15,
                 itab_bal16.
        ENDAT.
    *Se le pasa a la variable itab_ksl## el valor del mes que contenga flext.
        itab_kslvt = itab_kslvt + wa_itab-kslvt. itab_ksl01 = itab_ksl01 + wa_itab-ksl01. itab_ksl02 = itab_ksl02 + wa_itab-ksl02.
        itab_ksl03 = itab_ksl03 + wa_itab-ksl03. itab_ksl04 = itab_ksl04 + wa_itab-ksl04.
        itab_ksl05 = itab_ksl05 + wa_itab-ksl05. itab_ksl06 = itab_ksl06 + wa_itab-ksl06.
        itab_ksl07 = itab_ksl07 + wa_itab-ksl07. itab_ksl08 = itab_ksl08 + wa_itab-ksl08.
        itab_ksl09 = itab_ksl09 + wa_itab-ksl09. itab_ksl10 = itab_ksl10 + wa_itab-ksl10.
        itab_ksl11 = itab_ksl11 + wa_itab-ksl11. itab_ksl12 = itab_ksl12 + wa_itab-ksl12.
        itab_ksl13 = itab_ksl13 + wa_itab-ksl13. itab_ksl14 = itab_ksl14 + wa_itab-ksl14.
        itab_ksl15 = itab_ksl15 + wa_itab-ksl15. itab_ksl16 = itab_ksl16 + wa_itab-ksl16.
    *En estas variables va acumulando el valor por mes. Osea, va sumando todo lo que tenga de ese mes por profit center. Al venir un profit
    *nuevo esta se limpia.
        itab_bal00 = itab_bal00 + wa_itab-kslvt. itab_bal01 = itab_bal01 + wa_itab-ksl01. itab_bal02 = itab_bal02 + wa_itab-ksl02.
        itab_bal03 = itab_bal03 + wa_itab-ksl03. itab_bal04 = itab_bal04 + wa_itab-ksl04.
        itab_bal05 = itab_bal05 + wa_itab-ksl05. itab_bal06 = itab_bal06 + wa_itab-ksl06.
        itab_bal07 = itab_bal07 + wa_itab-ksl07. itab_bal08 = itab_bal08 + wa_itab-ksl08.
        itab_bal09 = itab_bal09 + wa_itab-ksl09. itab_bal10 = itab_bal10 + wa_itab-ksl10.
        itab_bal11 = itab_bal11 + wa_itab-ksl11. itab_bal12 = itab_bal12 + wa_itab-ksl12.
        itab_bal13 = itab_bal13 + wa_itab-ksl13. itab_bal14 = itab_bal14 + wa_itab-ksl14.
        itab_bal15 = itab_bal15 + wa_itab-ksl15. itab_bal16 = itab_bal16 + wa_itab-ksl16.
        ryear = wa_itab-ryear.
        CLEAR t_zavg.
        sy-subrc = 0.
        numero_de_cta   = wa_itab-racct.
        company_code    = wa_itab-rbukrs.
        profit_center   = wa_itab-prctr.
        currency_code   = wa_itab-rtcur.
        descripcion     = wa_itab-txt20.
    *Segundo loop a realizarce. Este utiliza la tabla interna: t_zavg la cual contiene los datos extraidos de zavg_bal_table.
        LOOP AT t_zavg INTO wa_zavg WHERE bukrs = wa_itab-rbukrs AND racct = wa_itab-racct AND prctr = wa_itab-prctr.
          AT NEW prctr.  "Al cambiar el profit center limpia las variables que se encuentran en el clear.
            CLEAR: average_month_01, average_month_02, average_month_03, average_month_04, average_month_05,
             average_month_06, average_month_07, average_month_08, average_month_09, average_month_10, average_month_11,
             average_month_12, average_month.
          ENDAT.
    *Dependiendo del mes que contiene el record de la tabla t_zavg este va acumulando el average_month.
          IF wa_zavg-day_a+4(2) = '01'.
            average_month_01   = average_month_01 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '02'.
            average_month_02   = average_month_02 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '03'.
            average_month_03   = average_month_03 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '04'.
            average_month_04   = average_month_04 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '05'.
            average_month_05   = average_month_05 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '06'.
            average_month_06   = average_month_06 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '07'.
            average_month_07   = average_month_07 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '08'.
            average_month_08   = average_month_08 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '09'.
            average_month_09   = average_month_09 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '10'.
            average_month_10   = average_month_10 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '11'.
            average_month_11   = average_month_11 + wa_zavg-accumulate.
          ENDIF.
          IF wa_zavg-day_a+4(2) = '12'.
            average_month_12   = average_month_12 + wa_zavg-accumulate.
          ENDIF.
    *Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
          IF wa_zavg-day_a = jan_fin OR wa_zavg-day_a = feb_fin OR wa_zavg-day_a = mar_fin OR wa_zavg-day_a = apr_fin OR wa_zavg-day_a = may_fin OR wa_zavg-day_a = jun_fin OR
          wa_zavg-day_a = jul_fin OR wa_zavg-day_a = aug_fin OR wa_zavg-day_a = sep_fin OR wa_zavg-day_a = oct_fin OR
          wa_zavg-day_a = nov_fin OR wa_zavg-day_a = dec_fin.
            aggregate_month =  wa_zavg-agregate.
            day_a  = wa_zavg-day_a.
    *Calcula el aggregate_month dependiendo de la fecha del record que se esta procesando.
            IF wa_zavg-day_a+4(2) = '01'.
              aggregate_month_01 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '02'.
              aggregate_month_02 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '03'.
              aggregate_month_03 = wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '04'.
              aggregate_month_04 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '05'.
              aggregate_month_05 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '06'.
              aggregate_month_06 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '07'.
              aggregate_month_07 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '08'.
              aggregate_month_08 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '09'.
              aggregate_month_09 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '10'.
              aggregate_month_10 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '11'.
              aggregate_month_11 =  wa_zavg-agregate.
            ENDIF.
            IF wa_zavg-day_a+4(2) = '12'.
              aggregate_month_12 =  wa_zavg-agregate.
            ENDIF.
          ENDIF.
    *Este if verifica que cuando el record que se esta verificando sea con fecha de fin de mes calcule el resto del codigo que se encuentra debajo.
          IF wa_zavg-day_a+4(4) = jan_fin+4(4) OR wa_zavg-day_a+4(4) = feb_fin+4(4) OR wa_zavg-day_a+4(4) = febb_fin+4(4) OR wa_zavg-day_a+4(4) = mar_fin+4(4) OR
             wa_zavg-day_a+4(4) = apr_fin+4(4) OR wa_zavg-day_a+4(4) = may_fin+4(4) OR wa_zavg-day_a+4(4) = jun_fin+4(4) OR wa_zavg-day_a+4(4) = jul_fin+4(4) OR
             wa_zavg-day_a+4(4) = aug_fin+4(4) OR wa_zavg-day_a+4(4) = sep_fin+4(4) OR wa_zavg-day_a+4(4) = oct_fin+4(4) OR wa_zavg-day_a+4(4) = nov_fin+4(4) OR
             wa_zavg-day_a+4(4) = dec_fin+4(4).
    *Calcula la division entre la cantidad acumulada por mes y la fecha del fin de mes.
            IF average_month_01 IS NOT INITIAL.
              porciento1 = average_month_01 / jan_fin+6(2).
              average_month   = porciento1.
            ENDIF.
            IF average_month_02 IS NOT INITIAL.
              porciento2 = average_month_02 / feb_fin+6(2).
              average_month   = porciento2.
            ENDIF.
            IF average_month_03 IS NOT INITIAL.
              porciento3 = average_month_03 / mar_fin+6(2).
              average_month   = porciento3.
            ENDIF.
            IF average_month_04 IS NOT INITIAL.
              porciento4 = average_month_04 / apr_fin+6(2).
              average_month   = porciento4.
            ENDIF.
            IF average_month_05 IS NOT INITIAL.
              porciento5 = average_month_05 / may_fin+6(2).
              average_month   = porciento5.
            ENDIF.
            IF average_month_06 IS NOT INITIAL.
              porciento6 = average_month_06 / jun_fin+6(2).
              average_month   = porciento6.
            ENDIF.
            IF average_month_07 IS NOT INITIAL.
              porciento7 = average_month_07 / jul_fin+6(2).
              average_month   = porciento7.
            ENDIF.
            IF average_month_08 IS NOT INITIAL.
              porciento8 = average_month_08 / aug_fin+6(2).
              average_month   = porciento8.
            ENDIF.
            IF average_month_09 IS NOT INITIAL.
              porciento9 = average_month_09 / sep_fin+6(2).
              average_month   = porciento9.
            ENDIF.
            IF average_month_10 IS NOT INITIAL.
              porciento10 = average_month_10 / oct_fin+6(2).
              average_month   = porciento10.
            ENDIF.
            IF average_month_11 IS NOT INITIAL.
              porciento11 = average_month_11 / nov_fin+6(2).
              average_month   = porciento11.
            ENDIF.
            IF average_month_12 IS NOT INITIAL.
              porciento12 = average_month_12 / dec_fin+6(2).
              average_month   = porciento12.
            ENDIF.
    *Cuando la fecha que esta entrando el usuario es la misma a la del record que se esta procesando en ese momento ejecuta el siguiente IF.
            IF p_date+4(4) = wa_zavg-day_a+4(4).
              current_average_balance   =  average_month.
              current_aggregate_balance =  aggregate_month.
              average_balance_ytd       =  average_month.
            ENDIF.
          ENDIF.
        ENDLOOP.
        AT END OF prctr.
          IF sy-subrc = 0.
    *ESTAS VARIABLES SE ESTAN PASANDO A UNA VARIABLE NORMAL YA QUE SI SE DEJAN DENTRO DEL WORK AREA (WA) LE PONE ASTERISCOS.
    *LOS IF QUE SE DEMUESTRAN ABAJO SON PARECIDOS A LOS UTILIZADOS EN LA   *
    *PARTE POSTERIOR LO UNICO QUE LA FECHA UTILIZADA NO ES EXTRAIDA DE LA  *
    *TABLA, ES LA QUE EL USUARIO INSERTA DENTRO DEL PARAMETRO.             *
            IF p_date+4(2) >= '01'.
              COMPUTE: balance_month_01 =   itab_bal00 + itab_bal01.
            ENDIF.
            IF p_date+4(2) >= '02'.
              COMPUTE: balance_month_02 = itab_bal00 + itab_bal01 + itab_bal02.
            ENDIF.
            IF p_date+4(2) >= '03'.
              COMPUTE: balance_month_03 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03.
            ENDIF.
            IF p_date+4(2) >= '04'.
              COMPUTE: balance_month_04 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04.
            ENDIF.
            IF p_date+4(2) >= '05'.
              COMPUTE: balance_month_05 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05.
            ENDIF.
            IF p_date+4(2) >= '06'.
              COMPUTE: balance_month_06 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06.
            ENDIF.
            IF p_date+4(2) >= '07'.
              COMPUTE: balance_month_07 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07.
            ENDIF.
            IF p_date+4(2) >= '08'.
              COMPUTE: balance_month_08 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08.
            ENDIF.
            IF p_date+4(2) >= '09'.
              COMPUTE: balance_month_09 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09.
            ENDIF.
            IF p_date+4(2) >= '10'.
              COMPUTE: balance_month_10 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10.
            ENDIF.
            IF p_date+4(2) >= '11'.
              COMPUTE: balance_month_11 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11.
            ENDIF.
            IF p_date+4(2) >= '12'.
              COMPUTE: balance_month_12 =  itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12.
            ENDIF.
            IF p_date+4(2) >= '13'.
              COMPUTE: balance_month_13 = itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13.
            ENDIF.
          COMPUTE: current_balance =  + itab_bal00 + itab_bal01 + itab_bal02 + itab_bal03 + itab_bal04 + itab_bal05 + itab_bal06 + itab_bal07 + itab_bal08 + itab_bal09 + itab_bal10 + itab_bal11 + itab_bal12 + itab_bal13 + itab_bal14 + itab_bal15 + itab_bal16.
    *Computo para el activity balance.
            IF p_date+4(2) = '01'.
              current_activity_balance =   itab_ksl01.
            ENDIF.
            IF p_date+4(2) = '02'.
              current_activity_balance =   itab_ksl02.
            ENDIF.
            IF p_date+4(2) = '03'.
              current_activity_balance =   itab_ksl03.
            ENDIF.
            IF p_date+4(2) = '04'.
              current_activity_balance =   itab_ksl04.
            ENDIF.
            IF p_date+4(2) = '05'.
              current_activity_balance =   itab_ksl05.
            ENDIF.
            IF p_date+4(2) = '06'.
              current_activity_balance =   itab_ksl06.
            ENDIF.
            IF p_date+4(2) = '07'.
              current_activity_balance =   itab_ksl07.
            ENDIF.
            IF p_date+4(2) = '08'.
              current_activity_balance =   itab_ksl08.
            ENDIF.
            IF p_date+4(2) = '09'.
              current_activity_balance =   itab_ksl09.
            ENDIF.
            IF p_date+4(2) = '10'.
              current_activity_balance =   itab_ksl10.
            ENDIF.
            IF p_date+4(2) = '11'.
              current_activity_balance =   itab_ksl11.
            ENDIF.
            IF p_date+4(2) = '12'.
              current_activity_balance =   itab_ksl12.
            ENDIF.
    *LE RESTA 1 AL AÑO CORRIENTE PARA VERIFICAR LUEGO SI EXISTE INFORMACION*
    *DE AÑOS ANTERIORES.                                                   *
            ano = ryear - 1.
    *               Get the values of the past year.                    *
            ano =  p_date+0(4) - 1.
            IF ryear = ano.
              wa_msgdetails-activity_previous_year = itab_ksl12.
    *     balance_previous_year = wa_msgdetails-balance_previous_year.  *
              wa_msgdetails-average_previous_year  = average_month_12.
              wa_msgdetails-aggreg_previous_year   = aggregate_month_12.
            ELSE.
    *If the table don't have data the variables get '0000000000000'.    *
              wa_msgdetails-activity_previous_year          = '00000000000000.00'.
              wa_msgdetails-average_previous_year           = '00000000000000.00'.
              wa_msgdetails-aggreg_previous_year            = '00000000000000.00'.
              AT LAST.
                wa_msgdetails-balance_previous_year           = '00000000000000.00'.
                wa_msgdetails-balance_previous_year           = itab_kslvt +
                                                                itab_ksl01 +
                                                                itab_ksl02 +
                                                                itab_ksl03 +
                                                                itab_ksl04 +
                                                                itab_ksl05 +
                                                                itab_ksl06 +
                                                                itab_ksl07 +
                                                                itab_ksl08 +
                                                                itab_ksl09 +
                                                                itab_ksl10 +
                                                                itab_ksl11 +
                                                                itab_ksl12.
              ENDAT.
            ENDIF.
            wa_msgdetails-account             = numero_de_cta.
            wa_msgdetails-company             = company_code.
            wa_msgdetails-cost_center         = profit_center.
            wa_msgdetails-currency_code       = currency_code.
            wa_msgdetails-account_description = descripcion.
            wa_msgdetails-activity_month_01   = itab_ksl01.
            wa_msgdetails-average_month_01    = porciento1.
            wa_msgdetails-aggreg_month_01     = aggregate_month_01.
            wa_msgdetails-activity_month_02   = itab_ksl02.
            wa_msgdetails-average_month_02    = porciento2.
            wa_msgdetails-aggreg_month_02     = aggregate_month_02.
            wa_msgdetails-activity_month_03   = itab_ksl03.
            wa_msgdetails-average_month_03    = porciento3.
            wa_msgdetails-aggreg_month_03     = aggregate_month_03.
            wa_msgdetails-activity_month_04   = itab_ksl04.
            wa_msgdetails-average_month_04    = porciento4.
            wa_msgdetails-aggreg_month_04     = aggregate_month_04.
            wa_msgdetails-activity_month_05   = itab_ksl05.
            wa_msgdetails-average_month_05    = porciento5.
            wa_msgdetails-aggreg_month_05     = aggregate_month_05.
            wa_msgdetails-activity_month_06   = itab_ksl06.
            wa_msgdetails-average_month_06    = porciento6.
            wa_msgdetails-aggreg_month_06     = aggregate_month_06.
            wa_msgdetails-activity_month_07   = itab_ksl07.
            wa_msgdetails-average_month_07    = porciento7.
            wa_msgdetails-aggreg_month_07     = aggregate_month_07.
            wa_msgdetails-activity_month_08   = itab_ksl08.
            wa_msgdetails-average_month_08    = porciento8.
            wa_msgdetails-aggreg_month_08     = aggregate_month_08.
            wa_msgdetails-activity_month_09   = itab_ksl09.
            wa_msgdetails-average_month_09    = porciento9.
            wa_msgdetails-aggreg_month_09     = aggregate_month_09.
            wa_msgdetails-activity_month_10   = itab_ksl10.
            wa_msgdetails-average_month_10    = porciento10.
            wa_msgdetails-aggreg_month_10     = aggregate_month_10.
            wa_msgdetails-activity_month_11   = itab_ksl11.
            wa_msgdetails-average_month_11    = porciento11.
            wa_msgdetails-aggreg_month_11     = aggregate_month_11.
            wa_msgdetails-activity_month_12   = itab_ksl12.
            wa_msgdetails-average_month_12    = porciento12.
            wa_msgdetails-aggreg_month_12     = aggregate_month_12.
            wa_msgdetails-activity_month_13   = itab_ksl13.
            wa_msgdetails-average_month_13    = '00000000000000.00'.
            wa_msgdetails-aggreg_month_13     = '00000000000000.00'.
            wa_msgdetails-balance_month_01          = balance_month_01.
            wa_msgdetails-balance_month_02          = balance_month_02.
            wa_msgdetails-balance_month_03          = balance_month_03.
            wa_msgdetails-balance_month_04          = balance_month_04.
            wa_msgdetails-balance_month_05          = balance_month_05.
            wa_msgdetails-balance_month_06          = balance_month_06.
            wa_msgdetails-balance_month_07          = balance_month_07.
            wa_msgdetails-balance_month_08          = balance_month_08.
            wa_msgdetails-balance_month_09          = balance_month_09.
            wa_msgdetails-balance_month_10          = balance_month_10.
            wa_msgdetails-balance_month_11          = balance_month_11.
            wa_msgdetails-balance_month_12          = balance_month_12.
            wa_msgdetails-balance_month_13          = balance_month_13.
            wa_msgdetails-current_balance           = current_balance.
            wa_msgdetails-current_activity_balance  = current_activity_balance.
            CLEAR: porciento1, porciento2, porciento3, porciento4, porciento5, porciento6, porciento7, porciento8, porciento9, porciento10, porciento11,
                   porciento12, average_month.
    *se multiplican las siguientes variables que contienen cantidades por -1 cuando el primer numero de la cta. es igual a
    * 5, 6, 7, ó 8.
            IF numero_de_cta+4(1) = '5' OR numero_de_cta+4(1) = '6' OR numero_de_cta+4(1) = '7' OR numero_de_cta+4(1) = '8'.
              IF wa_msgdetails-current_balance IS NOT INITIAL.
                wa_msgdetails-current_balance = wa_msgdetails-current_balance * -1.
              ENDIF.
              IF wa_msgdetails-activity_previous_year IS NOT INITIAL.
                wa_msgdetails-activity_previous_year = wa_msgdetails-activity_previous_year * -1.
              ENDIF.
              IF wa_msgdetails-average_previous_year IS NOT INITIAL.
                wa_msgdetails-average_previous_year = wa_msgdetails-average_previous_year * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_previous_year IS NOT INITIAL.
                wa_msgdetails-aggreg_previous_year = wa_msgdetails-aggreg_previous_year * -1.
              ENDIF.
              IF wa_msgdetails-balance_previous_year IS NOT INITIAL.
                wa_msgdetails-balance_previous_year = wa_msgdetails-balance_previous_year * -1.
              ENDIF.
              IF wa_msgdetails-current_activity_balance IS NOT INITIAL.
                wa_msgdetails-current_activity_balance = wa_msgdetails-current_activity_balance * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_01 IS NOT INITIAL.
                wa_msgdetails-activity_month_01 = wa_msgdetails-activity_month_01 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_01 IS NOT INITIAL.
                wa_msgdetails-balance_month_01 = wa_msgdetails-balance_month_01 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_01 IS NOT INITIAL.
                wa_msgdetails-average_month_01 = wa_msgdetails-average_month_01 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_01 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_01 = wa_msgdetails-aggreg_month_01 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_02 IS NOT INITIAL.
                wa_msgdetails-activity_month_02 = wa_msgdetails-activity_month_02 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_02 IS NOT INITIAL.
                wa_msgdetails-balance_month_02 = wa_msgdetails-balance_month_02 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_02 IS NOT INITIAL.
                wa_msgdetails-average_month_02 = wa_msgdetails-average_month_02 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_02 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_02 = wa_msgdetails-aggreg_month_02 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_03 IS NOT INITIAL.
                wa_msgdetails-activity_month_03 = wa_msgdetails-activity_month_03 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_03 IS NOT INITIAL.
                wa_msgdetails-balance_month_03 = wa_msgdetails-balance_month_03 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_03 IS NOT INITIAL.
                wa_msgdetails-average_month_03 = wa_msgdetails-average_month_03 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_03 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_03 = wa_msgdetails-aggreg_month_03 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_04 IS NOT INITIAL.
                wa_msgdetails-activity_month_04 = wa_msgdetails-activity_month_04 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_04 IS NOT INITIAL.
                wa_msgdetails-balance_month_04 = wa_msgdetails-balance_month_04 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_04 IS NOT INITIAL.
                wa_msgdetails-average_month_04 = wa_msgdetails-average_month_04 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_04 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_04 = wa_msgdetails-aggreg_month_04 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_05 IS NOT INITIAL.
                wa_msgdetails-activity_month_05 = wa_msgdetails-activity_month_05 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_05 IS NOT INITIAL.
                wa_msgdetails-balance_month_05 = wa_msgdetails-balance_month_05 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_05 IS NOT INITIAL.
                wa_msgdetails-average_month_05 = wa_msgdetails-average_month_05 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_05 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_05 = wa_msgdetails-aggreg_month_05 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_06 IS NOT INITIAL.
                wa_msgdetails-activity_month_06 = wa_msgdetails-activity_month_06 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_06 IS NOT INITIAL.
                wa_msgdetails-balance_month_06 = wa_msgdetails-balance_month_06 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_06 IS NOT INITIAL.
                wa_msgdetails-average_month_06 = wa_msgdetails-average_month_06 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_06 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_06 = wa_msgdetails-aggreg_month_06 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_07 IS NOT INITIAL.
                wa_msgdetails-activity_month_07 = wa_msgdetails-activity_month_07 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_07 IS NOT INITIAL.
                wa_msgdetails-balance_month_07 = wa_msgdetails-balance_month_07 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_07 IS NOT INITIAL.
                wa_msgdetails-average_month_07 = wa_msgdetails-average_month_07 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_07 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_07 = wa_msgdetails-aggreg_month_07 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_08 IS NOT INITIAL.
                wa_msgdetails-activity_month_08 = wa_msgdetails-activity_month_08 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_08 IS NOT INITIAL.
                wa_msgdetails-balance_month_08 = wa_msgdetails-balance_month_08 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_08 IS NOT INITIAL.
                wa_msgdetails-average_month_08 = wa_msgdetails-average_month_08 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_08 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_08 = wa_msgdetails-aggreg_month_08 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_09 IS NOT INITIAL.
                wa_msgdetails-activity_month_09 = wa_msgdetails-activity_month_09 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_09 IS NOT INITIAL.
                wa_msgdetails-balance_month_09 = wa_msgdetails-balance_month_09 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_09 IS NOT INITIAL.
                wa_msgdetails-average_month_09 = wa_msgdetails-average_month_09 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_09 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_09 = wa_msgdetails-aggreg_month_09 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_10 IS NOT INITIAL.
                wa_msgdetails-activity_month_10 = wa_msgdetails-activity_month_10 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_10 IS NOT INITIAL.
                wa_msgdetails-balance_month_10 = wa_msgdetails-balance_month_10 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_10 IS NOT INITIAL.
                wa_msgdetails-average_month_10 = wa_msgdetails-average_month_10 * -1.
              ENDIF.
              IF wa_msgdetails-aggreg_month_10 IS NOT INITIAL.
                wa_msgdetails-aggreg_month_10 = wa_msgdetails-aggreg_month_10 * -1.
              ENDIF.
              IF wa_msgdetails-activity_month_11 IS NOT INITIAL.
                wa_msgdetails-activity_month_11 = wa_msgdetails-activity_month_11 * -1.
              ENDIF.
              IF wa_msgdetails-balance_month_11 IS NOT INITIAL.
                wa_msgdetails-balance_month_11 = wa_msgdetails-balance_month_11 * -1.
              ENDIF.
              IF wa_msgdetails-average_month_11 IS NOT INITIAL.
                wa_msgdetails-average_month_11 = wa_msgdetails-average_month_11 *

    Hi,
    Are the month-ends (jan_fin etc) stored in the system? There are many variable declarations and if statements that could probably be eliminated if that is the case.  More efficient use of storing those variables in internal tables so that the data is only used when needed.
    Warren

  • Problems with Performance in table AUSP - R/3

    Hello, I am working with the set of tables (Klah, KSSK, KSML, AUSP, CABN in SAP R3) and generate reports with Crystal Reports 2008. The problem arises when displaying the data in Table AUSP, since the characteristics (Attin) are listed as records and I must show them grouped by the field AUSP.OBJEK as columns (see how in the transaction CL30N).
    I probe with infoset, query / infoset and related tables in Crystal Reports but the performance is very bad.
    Anybody know of a function standard similar to CL30N or I have only programmed in ABAP?
    Edited by: Carolina Jerez on Oct 7, 2009 10:01 AM

    Hi Ruven,
    so you are able to log on to the portal from Windows via SSO. When you access the backend from the portal it is not working, right?
    What kind of iView are you using to access the backend? Can you try with a simple Windows-SAPGui-iView? Is it working then? If you are using some web-based application to access the backend there might be a problem with different domains so that the SAPLogon Ticket is not passed along (both the URL of the portal and the URL of the backend have to be in the same domain -- of course there are way to enable SSO to different domains, but let's start with this simple case)
    I would still recomend to use the Note mentioned above to trace what is actually sent to the backend (I don't think that the dataSourceConfiguration file you are using has anything to do with SSO not working from the portal to the backend).
    Regards,
    Holger.

  • Problem with mouse-over value on a column chart (by Series)

    Hi.
    First of all thanks for any offered tip.
    I am having a problem with a column chart.
    When I move the mouse over a column it should show a small pop-up (or tip) with the column name (series name) and the value (series value). The problem is that it displays an extra '1' just like the following:
    SeriesName
    1
    X.XXX
    How can I remove the extra '1' and only show the name and the value ?
    The data is populated by series (manually added).
    Mihai.

    Hi,
    Thanks for the tip Shanthakumar KA.
    Yes. It looks like the '1' is coming from the X Axis labels. The chart that I have built does not require any labels on the X Axis, so this was not set (X-Axis labels: Empty). I tried setting this to an empty cell, but the '1' still appears in the mouse-over tip.
    It is very weird. If I leave the X-Axis labels empty, I still get the '1' displayed which is very annoing.
    Are there any solutions for this except the re-building the tip with a label a.k.a. '[customize the mouse over values|http://xcelsiusandme.blogspot.com/2009/07/xm-sample-7-customizing-mouse-over.html].'
    Regards,
    Mihai.

  • Problem with performance of a query having order by, distinct clause

    Hi,
    I have a problem with queries having order by, distinct clause.
    While its executing its taking lot of time. With DBMS_PROFILER identified the queries taking long time.
    The table is having approximately 70 million rows.
    Problem -1
    select * from table_name order by col1;
    select distinct col1,col2 from table_name;
    Here i am having 2 solutions request to let me know whether i am right if not suggest me right solution.
    Solution1:
    Max parallel servers is 8.
    select /* + parallel(table_name,8) */ * from table_name order by col1;
    select /* + parallel(table_name,8) */ distinct col1, col2 from table_name ;
    Solution-2:
    select /* + first_rows */ * from table_name order by col1;
    select /* + first_rows */ distinct col1, col2 from table_name ;
    Problem-2
    I am having a query with where condition on columns.
    Select * from table_name where col1='value1' and col2!='value2';
    Index created on col1 and col2.
    As we no that not equal won't use index as it is a composite index it should use the lead column. but its not using the index.
    Should i forcibly use index with hint or suggest me better solution.
    Any help really appreciated.
    Thanks in advance

    unique wrote:
    The table is having approximately 70 million rows.
    select * from table_name order by col1;Do you really want 70,000,000 rows from your table without any restrictions ? And furthermore ordered output ? I honestly understand the slowness of that query.
    Here i am having 2 solutions request to let me know whether i am right if not suggest me right solution.Who knows if you choosed the right solution. I would suggest to reconsider your query and the need of 70,000,000 returned rows.
    Problem-2
    I am having a query with where condition on columns.
    Select * from table_name where col1='value1' and col2!='value2';Please, provide the explain plan, eventually the tkprof output could also help. And tables descirption AND indexes description.
    And OS and Oracle version.
    Nicolas.

  • I think I found a problem with the calculator application.

    I'm a south korean highschool student and I think I found a problem with calculator application. I use iPod touch 4th generation with iOS 5.0.1. I was playing with calculator app and I found out that 0.1!(factorial) is 0.951350769866873. This can't be right bacause factorial calculation can only be definrd whan n is natural number or 0(in n!). I want apple to correct this error.
    And if you are someone working with apple, please let me know the algorithm of factorial calculation(if possible). I would be grateful if I can have a chance to study the algorithm and find out what made 0.1! possible.
    so question.
    do anybody know how to send an email to apple? I tried but I couldn't find the address.

    Apple doesn't dialogue with users via email the way you want, but you can report such problems to them via
    http://www.apple.com/feedback/
    But in this particular case you should be aware that factorial can in fact be done for non-integers:
    http://en.wikipedia.org/wiki/Factorial#Extension_of_factorial_to_non-integer_val ues_of_argument

  • I have a problem with my calculator :(

    hi all,
    i need some help with my calculator..after i wrote the code i discovered my mistake so i made some changes on the code..the problem is that it's still applying the old code !!
    ( i didn't forgot to compile it, & i closed all the browsers b4 trying it )
    i will appreciate ANY suggestion
    P.S : my mistake was with the operations buttons ( add, sub, multip, division ) & the equal button
    if it may help, this is the code ( the new one, then the old one )
    the new code:
    import java.awt.* ; // Container, FlowLayout
    import java.awt.event.* ; // ActionEvent, ActionListener
    import javax.swing.* ; // JApplet , JButton , JLabal, JTextField
    public class Calculator2 extends JApplet implements ActionListener {
    // graphical user interface components
    JTextField field ;
    JButton zero, one, two, three, four, five, six, seven, eight, nine, fraction, clear,
    add, sub, multip , division, equal ,sin , cos, tan ,log ,sqrt ,exp ;
    // variables
    String string = " " ; // to store what is in the text field
    String operation ; // to store the operation selected
    double operate ; // to store the result of the operation selected
    double operand1 , operand2 ; // the operands of the operation
    // set up GUI components
    public void init ()
    Container container = getContentPane ();
    container.setLayout ( new FlowLayout () );
    // create a text field
    field = new JTextField ( 17 );
    container.add ( field ) ;
    // create buttons
    clear = new JButton ( "C" ) ;
    clear.addActionListener ( this ) ;
    container.add ( clear );
    zero = new JButton ( "0" ) ;
    zero.addActionListener ( this ) ;
    container.add ( zero );
    one = new JButton ( "1" ) ;
    one.addActionListener ( this ) ;
    container.add ( one );
    two = new JButton ( "2" ) ;
    two.addActionListener ( this ) ;
    container.add ( two );
    three = new JButton ( "3" ) ;
    three.addActionListener ( this ) ;
    container.add ( three );
    four = new JButton ( "4" ) ;
    four.addActionListener ( this ) ;
    container.add ( four );
    five = new JButton ( "5" ) ;
    five.addActionListener ( this ) ;
    container.add ( five );
    six = new JButton ( "6" ) ;
    six.addActionListener ( this ) ;
    container.add ( six );
    seven = new JButton ( "7" ) ;
    seven.addActionListener ( this ) ;
    container.add ( seven );
    eight = new JButton ( "8" ) ;
    eight.addActionListener ( this ) ;
    container.add ( eight );
    nine = new JButton ( "9" ) ;
    nine.addActionListener ( this ) ;
    container.add ( nine );
    fraction = new JButton ( "." ) ;
    fraction.addActionListener ( this ) ;
    container.add ( fraction );
    add = new JButton ( "+" ) ;
    add.addActionListener ( this ) ;
    container.add ( add );
    sub = new JButton ( "-" ) ;
    sub.addActionListener ( this ) ;
    container.add ( sub );
    multip = new JButton ( "*" ) ;
    multip.addActionListener ( this ) ;
    container.add ( multip );
    division = new JButton ( "�" ) ;
    division.addActionListener ( this ) ;
    container.add ( division );
    sin = new JButton ( "sin" ) ;
    sin.addActionListener ( this ) ;
    container.add ( sin );
    cos = new JButton ( "cos" ) ;
    cos.addActionListener ( this ) ;
    container.add ( cos );
    tan = new JButton ( "tan" ) ;
    tan.addActionListener ( this ) ;
    container.add ( tan );
    log = new JButton ( "log" ) ;
    log.addActionListener ( this ) ;
    container.add ( log );
    sqrt = new JButton ( "sqrt" ) ;
    sqrt.addActionListener ( this ) ;
    container.add ( sqrt );
    exp = new JButton ( "exp" ) ;
    exp.addActionListener ( this ) ;
    container.add ( exp );
    equal = new JButton ( "=" ) ;
    equal.addActionListener ( this ) ;
    container.add ( equal );
    } // end of method init
    public void actionPerformed ( ActionEvent event )
         // button zero
         if ( event.getSource()== zero )
         string = string + "0" ;
         field.setText ( string ) ;
         // button one
         else if ( event.getSource()== one )
              string = string + "1" ;
              field.setText ( string ) ;
         // button two
         else if ( event.getSource()== two )
              string = string + "2" ;
              field.setText ( string ) ;
         // button three
         else if ( event.getSource()== three )
              string = string + "3" ;
              field.setText ( string ) ;
         // button four
         else if ( event.getSource()== four )
              string = string + "4" ;
              field.setText ( string ) ;
         // button five
         else if ( event.getSource()== five )
              string = string + "5" ;
              field.setText ( string ) ;
         // button six
         else if ( event.getSource()== six )
              string = string + "6" ;
              field.setText ( string ) ;
         // button seven
         else if ( event.getSource()== seven )
              string = string + "7" ;
              field.setText ( string ) ;
         // button eight
         else if ( event.getSource()== eight )
              string = string + "8" ;
              field.setText ( string ) ;
         // button nine
         else if ( event.getSource()== nine )
              string = string + "9" ;
              field.setText ( string ) ;
         // button fraction
         else if ( event.getSource()== fraction )
              string = string + "." ;
              field.setText ( string ) ;
         // button clear
         else if ( event.getSource()== clear )
              clear ();
         // button add
         else if ( event.getSource()== add )
              operand1 = Double.parseDouble ( string );
              operation = "+" ;
              clear ();
         // button sub
         else if ( event.getSource()== sub )
              operand1 = Double.parseDouble ( string );
              operation = "-" ;
              clear ();
         // button multip
         else if ( event.getSource()== multip )
              operand1 = Double.parseDouble ( string );
              operation = "*" ;
              clear ();
         // button division
         else if ( event.getSource()== division )
              operand1 = Double.parseDouble ( string );
              operation = "/" ;
              clear ();
         // button sin
         else if ( event.getSource()== sin )
              operate = Double.parseDouble ( string ) ;
              operate = Math.sin( operate );
              field.setText ( Double.toString ( operate ) ) ;
    // button cos
         else if ( event.getSource()== cos )
              operate = Double.parseDouble ( string ) ;
              operate = Math.cos( operate );
              field.setText ( Double.toString ( operate ) ) ;
         // button tan
         else if ( event.getSource()== tan )
              operate = Double.parseDouble ( string ) ;
              operate = Math.tan( operate );
              field.setText ( Double.toString ( operate ) ) ;
         // button log
         else if ( event.getSource()== log )
              operate = Double.parseDouble ( string ) ;
              operate = Math.log( operate );
              field.setText ( Double.toString ( operate ) ) ;
         // button sqrt
         else if ( event.getSource()== sqrt )
              operate = Double.parseDouble ( string ) ;
              operate = Math.sqrt( operate );
              field.setText ( Double.toString ( operate ) ) ;
         // button exp
         else if ( event.getSource()== exp )
              operate = Double.parseDouble ( string ) ;
              operate = Math.exp( operate );
              field.setText ( Double.toString ( operate ) ) ;
         // button equal
         else // if ( event.getSource()== equal )
              operand2 = Double.parseDouble ( string );
              if ( operation == "+" )
                   operate = operand1 + operand2 ;
              else if ( operation == "-" )
                   operate = operand1 - operand2 ;
              else if ( operation == "*" )
                   operate = operand1 * operand2 ;
              else if ( operation == "/" )
                   operate = operand1 / operand2 ;
              field.setText ( Double.toString ( operate ) ) ;
    } // end of method actionPerformed
    public void clear ()
         string = " ";
         field.setText ( string ) ;
    } // end of method clear
    } // end of class
    the old code which have the problem ( which i make the changes on ) :
         // button clear
         else if ( event.getSource()== clear )
              string = "";
              field.setText ( string ) ;
         // button add
         else if ( event.getSource()== add )
              string = string + "+" ;
              field.setText ( string ) ;
         // button sub
         else if ( event.getSource()== sub )
              string = string + "-" ;
              field.setText ( string ) ;
         // button multip
         else if ( event.getSource()== multip )
              string = string + "*" ;
              field.setText ( string ) ;
         // button division
         else if ( event.getSource()== division )
              string = string + "/" ;
              field.setText ( string ) ;
         // button equal
         else // if ( event.getSource()== equal )
              operate = Double.parseDouble ( string ) ;
              field.setText ( Double.toString ( operate ) ) ;
    thanks a lot :)

    Open Java console and press "x" (Clear cache)
    Disable caching in java paremeters.

  • Problems with shipping calculations

    We have been working with BC eCommerce since the beginning of 2013.
    We have been working with UPS and the checkout shopping cart get the shipping costs from UPS.
    However we are experiencing a problem with big orders due to the fact that big orders require a second or even a third box and then UPS charges are higher than the calculation
    here is what is happening righ now:
    we can house 4 products in a box. Each product weights 10.5 pound.
    In orders of 4 or less products we dont have a problem. UPS calculates 1 box of 42 pounds.
    Let's say we have to ship 7 products, then we have a 42 pounds box and a 31.5 pounds box but the system has calculated a box of 73.5 pound which is lower than shipping the two individual orders.
    even using ground transportaion this problem represent 5 to 10 when shipping two boxes and it will grow even bigger when we have to ship 3 boxes (almost $40).
    I appreciate your ideas on how to solve this problem.
    Thanks

    I too, am having issues with inaccurate FEDEX shipping costs. 
    Our FEDEX rep has provided evidence that somewhere along the way, the measurements sent to the FEDEX server, is being provided to FEDEX in metric measurments.
    Which is very strange, as our store is setup in English System of Measurments (U.S. Customary System and the Britich Imperial System) meaning that our dimensions and weight within the BC system are in inches and pounds. (BC support has confirmed that the setup is correctly for inches and pound measurement)
    The result is that the shipping costs generated using integrated FEDEX on BC can be significantly lower than when using the same account info on the client's FEDEX web portal. This signicantly cuts into profits - and in some cases the client can loose money after making an online sale!
    Is anyone else finding this to be the case? Does anyone have any suggestions? My client is very, very frustrated - and naturally does not want to lose money on shipping. Any help appreciated. Thanks.
    TheBCMan - I know you specialize  in shipping calculators, have you come across this?
    GeckoTales - did you ever develop or come across a work-around?
    Thanks everyone. Hope someone has come across this. Am getting desparate.

  • Problem with Context - calculated Value

    I have a problem with my WebDynPro-Project.
    The Errors which is shown by the NWDS:
    "Web Dynpro Generation: Metadata constraint of Component KeyMappingComponent is violated: CalculatedAttributeProvider "//WebDynpro/Controller:de.vwfsag.keymapping.ui.KeyMappingComponent/CalculatedAttributeProvider:BusinessAttributeDataSprache", Role "Attribute": A minimum of 1 object(s) is required"
    What I've done:
    - changed valueproperties calculated from "true" to "false" and back.
    The problem is that the set und get methods remained after resetting the calculateproperty to "false".
    I've tried several time to switch the property but now I got more remained set and get methods (..._1, ..._2, ...), which I can't delete in the NWDS.
    What I also tried was to change the .wdcontroller"-file of my controller-component, but this file is generated so after a rebuild the ".wdcontroller"-file is still corrupted.
    I think the conclusion should be something to delete these methods or change the calculatedproperty in some files you can't access directly from the NWDS.
    I hope anyone could help me out with this?
    Greetz Christian
    Edited by: christian.zuehlsdorf on Dec 14, 2009 6:24 PM

    Tushar Sinha wrote:Tushar Sinha wrote:Hey Sinha,
    thank you fr your answer!
    >
    > Just try deleting the attribute for which you tried setting the calculated property as true and then false, try repairing your project, reload and build again. Hopefully this should get you rid of the getters and setters.
    That was the first thing I already tried. I deleted the whole context und then rebuild and repair and rebuild... But none of that help.
    >
    > Do, not manually try deleting the getters/setters manually for any attribute as it is autogenerated for an attribute.
    These getters/setters only have part of the configuration with no context-attribute-bind, which in fact seems to be the problem for the build-process.

  • Problem with date calculation

    I am a rookie in SAP i have a small problem with date.Do we have any function module to find out the first day in a month if we give out the system current date ?? Pls help me out.

    Hi,
    As Ganesan told,you can do.
    Here is the sample code.
    data v type sy-datum.
    data d type DTRESR-WEEKDAY.
    v+6(2) = '01'.
    v4(2) = sy-datum4(2).
    v0(4) = sy-datum0(4).
    CALL FUNCTION 'DATE_TO_DAY'
      EXPORTING
        date          = v
    IMPORTING
       WEEKDAY       = d.
    write d.

  • Performance problem with more than one COUNT(DISTINCT ...) in a query

    Hi,
    (I hope this is the good forum).
    In the following query, I have 2 Count Distinct on 2 different fields of the same table.  Execution time is okay (2 s) with one or the other COUNT(DISCTINCT ...) in the SELECT clause, but is not tolerable (12 s) with both together in the query! I have
    a similar case with 3 counts: 4 s each, 36 s when together!
    I've looked at the execution plan, and it seems that with two count distinct, SQL server sorts the table twice before joining the results.
    I do not have much experience with SQL server optimization, and I don't know what to improve and how. The SQL is generated by Business Objects, I have few possibilities to tune it. The most direct way would be to execute 2 different queries, but I'd like
    to avoid it.
    Any advice?
    SELECT
      DIM_MOIS.DATE_DEBUT_MOIS,
      DIM_MOIS.NUM_ANNEE_MOIS,
      DIM_DEMANDE_SCD.CAT_DEMANDE,
      DIM_APPLICATION.LIB_APPLICATION,
      DIM_DEMANDE_SCD.CAT_DEMANDE ,
      count(distinct FAITS_DEMANDE.NB_DEMANDE_FLUX),
      count(distinct FAITS_DEMANDE.NB_DEMANDE_RESOL_NIV1)
    FROM
      ALIM_SID.DIM_MOIS INNER JOIN ALIM_SID.DIM_JOUR ON (DIM_JOUR.SEQ_MOIS=DIM_MOIS.SEQ_MOIS)
       INNER JOIN ALIM_SID.FAITS_DEMANDE ON (FAITS_DEMANDE.SEQ_JOUR=DIM_JOUR.SEQ_JOUR)
       INNER JOIN ALIM_SID.DIM_APPLICATION ON (FAITS_DEMANDE.SEQ_APPLICATION=DIM_APPLICATION.SEQ_APPLICATION)
       INNER JOIN ALIM_SID.DIM_DEMANDE_SCD ON (FAITS_DEMANDE.SEQ_DEMANDE_SCD=DIM_DEMANDE_SCD.SEQ_DEMANDE_SCD)
    WHERE
      ( ( DIM_MOIS.NUM_ANNEE_MOIS ) >201301
    GROUP BY
      DIM_MOIS.DATE_DEBUT_MOIS,
      DIM_MOIS.NUM_ANNEE_MOIS,
      DIM_DEMANDE_SCD.CAT_DEMANDE,
      DIM_APPLICATION.LIB_APPLICATION

    Here is the script, nothing original. Hope this helps.
    -- Fact table :
    -- foreign keys begin by FK_,
    -- measures to counted (COUNT DISTINCT) begin with NB_
    CREATE TABLE [ALIM_SID].[FAITS_DEMANDE](
        [SEQ_JOUR] [int] NOT NULL,
        [SEQ_DEMANDE] [int] NOT NULL,
        [SEQ_DEMANDE_SCD] [int] NOT NULL,
        [SEQ_APPLICATION] [int] NOT NULL,
        [SEQ_INTERVENANT] [int] NOT NULL,
        [SEQ_SERVICE_RESPONSABLE] [int] NOT NULL,
        [NB_DEMANDE_FLUX] [int] NULL,
        [NB_DEMANDE_STOCK] [int] NULL,
        [NB_DEMANDE_RESOLUE] [int] NULL,
        [NB_DEMANDE_LIVREE] [int] NULL,
        [NB_DEMANDE_MEP] [int] NULL,
        [NB_DEMANDE_RESOL_NIV1] [int] NULL,
     CONSTRAINT [PK_FAITS_DEMANDE] PRIMARY KEY CLUSTERED
        [SEQ_JOUR] ASC,
        [SEQ_DEMANDE] ASC,
        [SEQ_DEMANDE_SCD] ASC,
        [SEQ_APPLICATION] ASC,
        [SEQ_INTERVENANT] ASC,
        [SEQ_SERVICE_RESPONSABLE] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
     CONSTRAINT [AK_AK_FAITS_DEMANDE_FAITS_DE] UNIQUE NONCLUSTERED
        [SEQ_JOUR] ASC,
        [SEQ_DEMANDE] ASC,
        [SEQ_DEMANDE_SCD] ASC,
        [SEQ_APPLICATION] ASC,
        [SEQ_INTERVENANT] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_APPLICATION] FOREIGN KEY([SEQ_APPLICATION])
    REFERENCES [ALIM_SID].[DIM_APPLICATION] ([SEQ_APPLICATION])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_APPLICATION]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_DEMANDE] FOREIGN KEY([SEQ_DEMANDE])
    REFERENCES [ALIM_SID].[DIM_DEMANDE] ([SEQ_DEMANDE])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_DEMANDE]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_DEMANDE_SCD] FOREIGN KEY([SEQ_DEMANDE_SCD])
    REFERENCES [ALIM_SID].[DIM_DEMANDE_SCD] ([SEQ_DEMANDE_SCD])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_DEMANDE_SCD]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_INTERVENANT] FOREIGN KEY([SEQ_INTERVENANT])
    REFERENCES [ALIM_SID].[DIM_INTERVENANT] ([SEQ_INTERVENANT])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_INTERVENANT]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_JOUR] FOREIGN KEY([SEQ_JOUR])
    REFERENCES [ALIM_SID].[DIM_JOUR] ([SEQ_JOUR])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_JOUR]
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE]  WITH CHECK ADD  CONSTRAINT [FK_FAITS_DEMANDE_DIM_SERVICE_RESPONSABLE] FOREIGN KEY([SEQ_SERVICE_RESPONSABLE])
    REFERENCES [ALIM_SID].[DIM_SERVICE] ([SEQ_SERVICE])
    GO
    ALTER TABLE [ALIM_SID].[FAITS_DEMANDE] CHECK CONSTRAINT [FK_FAITS_DEMANDE_DIM_SERVICE_RESPONSABLE]
    GO
    -- not shown : extended properties
    -- One of the dimension  tables (they all have a primary key named SEQ_)
    CREATE TABLE [ALIM_SID].[DIM_JOUR](
        [SEQ_JOUR] [int] IDENTITY(1,1) NOT NULL,
        [SEQ_ANNEE] [int] NOT NULL,
        [SEQ_MOIS] [int] NOT NULL,
        [DATE_JOUR] [date] NULL,
        [CODE_ANNEE] [varchar](25) NULL,
        [CODE_MOIS] [varchar](25) NULL,
        [CODE_SEMAINE_ISO] [varchar](25) NULL,
        [CODE_JOUR_ANNEE] [varchar](25) NULL,
        [CODE_ANNEE_JOUR] [varchar](25) NULL,
        [LIB_JOUR] [varchar](25) NULL,
        [LIB_JOUR_COURT] [varchar](25) NULL,
        [JOUR_OUVRE] [tinyint] NULL,
        [JOUR_CHOME] [tinyint] NULL,
     CONSTRAINT [PK_DIM_JOUR] PRIMARY KEY CLUSTERED
        [SEQ_JOUR] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    ALTER TABLE [ALIM_SID].[DIM_JOUR]  WITH CHECK ADD  CONSTRAINT [FK_DIM_JOUR_DIM_ANNEE] FOREIGN KEY([SEQ_ANNEE])
    REFERENCES [ALIM_SID].[DIM_ANNEE] ([SEQ_ANNEE])
    GO
    ALTER TABLE [ALIM_SID].[DIM_JOUR] CHECK CONSTRAINT [FK_DIM_JOUR_DIM_ANNEE]
    GO
    ALTER TABLE [ALIM_SID].[DIM_JOUR]  WITH CHECK ADD  CONSTRAINT [FK_DIM_JOUR_DIM_MOIS] FOREIGN KEY([SEQ_MOIS])
    REFERENCES [ALIM_SID].[DIM_MOIS] ([SEQ_MOIS])
    GO
    ALTER TABLE [ALIM_SID].[DIM_JOUR] CHECK CONSTRAINT [FK_DIM_JOUR_DIM_MOIS]
    GO

  • Problem with combo box in a Matrix column

    hi every one, i  have a user form with a matrix(uid = 37) with some columns and one column is combo box. in that combo box i have to get values  from OSTC table (Code)...i have written this code ..i dont know how to access the combo box so that i can get values to combo box when i execute the prg....
    oitem = oForm.Items.Item("37")  37 is uid of omatrix2
                oMatrix2 = oitem.Specific
                oColumns = oMatrix2.Columns
                oForm.DataSources.UserDataSources.Add("CSR1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
                oColumn = oColumns.Item("V_6")                      ''for accessing the combo box item [V_6 is col uid ]
                oCombo = oColumn.Cells.Item(omatrix2.row).Specific            ''''''''problem line
                oCombo.DataBind.SetBound(True, "", "CSR1")
                rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                query = "select Code from OSTC"
                rset.DoQuery(query)
                Dim tc As String
                rset.MoveFirst()
                For row = 0 To rset.RecordCount - 1
                    tc = rset.Fields.Item("Code").Value
                    oCombo.ValidValues.Add(tc, row)
                    rset.MoveNext()
                Next
                oMatrix2.Columns.Item("V_6").DataBind.SetBound(True, "@SALE_CHILD", "U_Tax")

    Call objMain.objUtilities.LoadComboValuesForMatrix(FormUID, "27", "SELECT Code,Name FROM OSTC Order by Code", "V_19", objMatrix.RowCount)
    Public Sub LoadComboValuesForMatrix(ByVal FormUID As String, ByVal ItemUID As String, ByVal strQuery As String, ByVal MtrxColId As String, ByVal Rowcount As Integer)
            Dim inti As Integer
            objRecSet = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                Dim objmatrix As SAPbouiCOM.Matrix
                Dim objCombo As SAPbouiCOM.ComboBox
                objForm = objMain.objApplication.Forms.Item(FormUID)
                objItem = objForm.Items.Item(ItemUID)
                objmatrix = objItem.Specific
                objCombo = objmatrix.Columns.Item(MtrxColId).Cells.Item(Rowcount).Specific
                objItem.DisplayDesc = True
                objRecSet.DoQuery(strQuery)
                If objRecSet.RecordCount > 0 Then
                    If (objCombo.ValidValues.Count > 0) Then
                        For inti = 0 To objRecSet.RecordCount - 1
                            objRecSet.MoveNext()
                        Next
                    End If
                    If (objCombo.ValidValues.Count <= 0) Then
                        objCombo.ValidValues.Add("", "")
                        For inti = 0 To objRecSet.RecordCount - 1
                            objCombo.ValidValues.Add(Convert.ToString(objRecSet.Fields.Item(0).Value), Convert.ToString(objRecSet.Fields.Item(1).Value))
                            objRecSet.MoveNext()
                        Next
                    End If
                End If
            Catch ex As Exception
                Throw ex
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecSet)
                GC.WaitForPendingFinalizers()
                GC.Collect()
            End Try
        End Sub

Maybe you are looking for