Query row structure to restrict on multiple ranges of Calendar Year /Month using Custom exit

Hi All,
I have written 2 queries in Bex 7.x which have similar requirement. One uses 0CALMONTH and other 0FISCPER. I will describe scenario with Calendar Year month query.
Query to have user entry screen for 0CALMONTH. Added 0CALMONTH in Filters section and restricted on mandatory user entry variable.
Key figures restricted in four ways by creating a row structure with four selections
Current Month User entered value on selection screen (Restricted on User entry variable)
Previous Month / Period (Above value offset -1)
YTD value Range from Previous July / 07.YYYY to current user entered month value (Custom exit)
LYTD value - Above value for previous year (Above value offset -12)
For YTD value wrote a custom exit code which uses the user entry variable on 0CALMONTH to retrieve the current month value and then give output range value for YTD.
The custom exit code when debugged seems to calculate the correct range. However the query output is not working and gives out the same data for Current month and YTD range. Also LYTD value and Previous month value don't show up with any data at all.
Any tips on where we are going wrong would be helpful.
Thanks!
Custom Exit code:
WHEN 'ZGB_FP_AYTD_PTNR'.
     IF i_step EQ '2'.
       READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFP_AYTD_PRTNR'
                                                            iobjnm = '0CALMONTH'.
       IF sy-subrc EQ 0.
         CLEAR: l_month_curr, l_month_low, l_year_curr, l_year_low,
                l_calmonth_low, l_calmonth_high.
         l_month_curr = loc_var_range-low+4(3).
         l_year_curr = loc_var_range-low+0(4).
         l_month_low = 001.
         l_year_low  = l_year_curr.
         CONCATENATE l_year_low l_month_low INTO l_calmonth_low.
         CONCATENATE l_year_curr l_month_curr INTO l_calmonth_high.
         l_s_range-low = l_calmonth_low.
         l_s_range-high = l_calmonth_high.
         l_s_range-sign = 'I'.
         l_s_range-opt = 'BT'.
         APPEND l_s_range TO e_t_range.
       ENDIF.
     ENDIF.

Hi
try this code
WHEN '0CALMONTH'.
CLEAR: l_month_curr, l_month_low, l_year_curr, l_year_low,
                l_calmonth_low, l_calmonth_high.
     IF i_step EQ '2'.
  loop at i_t_var_range INTO loc_var_range where vnam = 'ZFP_AYTD_PRTNR'.
         l_month_curr = loc_var_range-low+4(2).
         l_year_curr = loc_var_range-low+0(4).
         concatinate '0' l_month_curr into l_month_low.
         CONCATENATE l_year_low '001' INTO l_calmonth_low.
         CONCATENATE l_year_curr l_month_low INTO l_calmonth_high.
         l_s_range-low = l_calmonth_low.
         l_s_range-high = l_calmonth_high.
         l_s_range-sign = 'I'.
         l_s_range-opt = 'BT'.
         APPEND l_s_range TO e_t_range.
       endloop.
     ENDIF.
This code used for calculate fiscal period interval from your input month.
For Ex
user input is 05.2014
customer exit result as 001.2014 - 005.2014.
Note: Fiscal year period is Jan - Dec otherwise need to convert the input month details.
Regards
Sureshkumar

Similar Messages

  • Extracting 0CALYEAR from Calendar Year/Month From-To in a query

    Hi all,
    I have a high granularity query which is used in a large number of workbooks. This query has a key Calendar Year/Month input everytime it's launched. The thing is I'd like to support it with an aggregate containing the data from the year 2010. As there is no way to specify a value range for 0CALMONTH in the aggregate, the only way to specify the time range is through setting 0CALYEAR to a fixed vaule 2010. But then the aggregate is not picked up when the query is launched with the key 0CALMONTH = from 01.2010 to 01.2010. What should I do to force the aggregate to be used?
    I know that one way is to add the 0CALYEAR as a key year to the query but I wouldn't want to force everyone to fill it everytime they run the report.
    Is there any way to make the 0CALYEAR characteristic in the query definition get the year value automatically after the user has input the Calendar Yer/Month and to remain relatively transparent at the same time? I suppose I could make it using some user exit or so but can it be made more easily?
    I'm using BI7.0 with BEx 3.x (for a couple of reasons)
    Many thanks for any suggestions
    Krzysztof

    A user exit variable, hidden and derived from the input for 0CALMONTH,  is your only option to fill the 0CALYEAR and use the aggregate.  However, you should be able to do this automatically in your data model.
    My data models usually consist of a mutliprovider that contains multiple infocubes each segregated by year, (with a Constant value for year assigned), and each one cube compressed by 0CALMONTH.  When you query by 0CALMONTH, this model causes the query to look at only the specifc year infoprovider, and the specific partition for 0CALMONTH.  I believe this is the behavior you are trying to achieve with the aggregate.  It is automatic with my model.
    Bryan

  • How to use Multiple Single Option for selection in the Customer Exit

    Hi,
    How can we handle the multiple single values in the customer exit variable.
    I have a requirement which is as follows -
    Table A fiields -> Field Coach, Partner 2, Relation between PArtner 1 & Partner 2, Valid from, valid to date.
    Table B ->  Service Month, Start Date, End Date.
    Table C -> Billing Date, Execution Partner,cal month /year.
    For the Field coach in TABLE A, multiple Partner 2 are present.
    Report has to be built on Table C.
    User inputs the Service month and Field Coach . User can enter multiple field coach values.
    For the All the Field Coach values entered, corresponding Partner2's have to be found from Table A and to be passed to the Execution Partner in Table C.
    Now if we want to use customer exit variable on the field Execution Partner, how can we handle the Multiple Single selections in the customer exit.
    Thanks,
    Shubham

    Hi,
    While creating the variable you must have to specify multiple value.
    In customer exit
    write code multiple times and append the values.
    For example:
    when 'variable'.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 1.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 2.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 3.
    APPEND L_S_RANGE TO E_T_RANGE.
    Regards,
    Ranganath.

  • Unable to view the Calendar Year/Month in the Query

    Hi All,
    We are having a standard query on Customer InfoCube 0sd_c01_q0003.
    I was able to get the data. But I am unable to view the Calendar Year/month. In that place I am getting '#'.
    I am able to view the details in the InfoCube. There aren't any errors while executing the error.
    Regards
    YJ

    hi,
    U r Problem is not clear...if u r getting # for characteristic values means..u don't have data in Infoprovider...try to view data in InfoProvider with the same selections that u r executing the Query with.
    thnaks

  • Count the number of days in the selected range using Customer exit

    Hi Experts,
    we have requirment where user is asking to add a column to report, which will have 'count of days for which key figure is having values' for each of the months and the Header would be 'Day Count'
    Please let me know if its possible using Customer exit?

    Hi,
    In our report we have two characteristics site no. and product and we have 6 key figures of type quantity and Input for the report is Fiscal year/period
    So in the report Key figures are populated with values for respective site no. and product combination
    Now the user wants new column in report which will have header u2018Day countu2019 and it should Simply count the number of days in the selected range that have a volume different than 0 for key figure
    Please let me know if more details are required

  • Crystal Reports with BEx Query using Custom Exit Variable

    Hi,
    We have BW BEx Query using Customer User Exit variable to derive  the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
    VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
    When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem".  (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
    Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
    Crystal Reports with BEx Query using Custom Exit Variable
    Thanks,
    Andy

    Hi Vibhav,
    We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
    We tried that "mandatory" option and did not work either.
    Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
    23.08.2011 - 08:20:49 CET - Info for Customer by SAP  
    I have raised this issue on the Idea#s Place as an enhancement request
    on the below link:
    https://cw.sdn.sap.com/cw/ideas/5586
    This ER contains the information of including the customer exit
    variables in the report without checking the #input for ready# option.
    This ER can be considered for being implemented in the future
    versions. You can refer to SAP Note: 1515837 - How To: Enhancement
    Request Process - "Idea Place" for more information regarding the Idea
    Place.
    Cheers,
    Andy

  • Restricting Charecterstic using customer Exit variable

    Hi Experts,
    Please adivise how can I restrict values of a charectersitc  Infoobject using a customer exit variable.
    I have a InfoProvider which has a authorisation values from which I have to retrieve the authorisation values.
    Regards,
    Koka.

    Thanks for the reply Bhawani, I have a function module to fill the Customer exit variable with the values retrieved from DSO.
    Can you please explain me the second step mentioned or can I direclty call my FM in the Include ZXRSRU01..
    WHEN 'XXXX '. ( customer Exit varaiable)
          CALL FUNCTION 'ZBI_LOAD_AUTH'
            EXPORTING
              I_AUTHVALTYPE = 'auth value'
            TABLES
              E_T_RANGE     = E_T_RANGE.
    Regards,
    Koka.

  • Query to select values that match multiple ranges

    Hi,
    Oracle 10g.
    I have a table POINTS(ID INTEGER, CLASS VARCHAR2(15), CUMUL NUMBER(2,1), ...).
    In my application (APEX application), I show a list of point classes, order by cumul.
    SELECT CLASS FROM POINTS ORDER BY CUMUL;Then user can choose some range of point classes (CUMUL is not shown in the application, it is just for the example) :
    CUMUL     CLASS
    12.2     31458     <- 
    13.4     5S84     <-     range 1 
    13.6     78PPH     <- 
    15.0     3R594     <- 
    15.1     ZB452 
    15.5     54IO 
    17.6     21GFD 
    19.2     A54VV     <- 
    19.9     IC112     <-     range 2 
    20.8     158RC9     <- 
    21.3     G4G5 
    23.0     V22     <-     range 3For each range, I store only first and last classes selected by a user, in a table USER_SELECTION(ID, ID_USER, FROM_CLASS, TO_CLASS), so using the example above it would give :
    ID     ID_USER          FROM_CLASS     TO_CLASS 
    1     12          31458          3R594 
    2     12          A54VV          158RC9 
    3     12          V22          V22
    ...     ...          ...          ...The problem is that in a query, I need to return all points selected by a user, and I really don't know how to achieve that without too much work... :
    SELECT *
    FROM POINTS
    WHERE USER_ID=12
    AND CLASS IN ( *???* );
    Any help would be much appreciated.
    Yann.

    It's not exactly clear what data is in what tables etc. but perhaps something like this...
    select user_selection.id, points.*
    from points, user_selection
    where user_selection.user_id = 12
    and   points.cumul between
          (select cumul from points where class = user_selection.class1)
          and
          (select cumul from points where class = user_selection.class2)
    order by user_select.id, points.cumul

  • Using Calendar Year Month in query designer to populate a Month Structure

    Hi
    Is it possible to create a query that has a standard structure of Month Columns (Jan-Dec) with each month column populated by the correct 0CALMONTH (similar infoobject) value?  I would also like to be able to filter this by the correct year selected since this will be a filter value.
    Thanks for any help on this.

    Hi,
    I would also like to be able to filter this by the correct year selected since this will be a filter value.
    Yes. With the structure it is possible. But user input 0fiscalyear variable should be there to get the correct year data.
    Hope it helps

  • Subject: Why Restricting Calendar Year/Month Does not show some process cha

    I am struggling to figure to how to debug BEX queries. I am on BI 7.0.
    I am developing a query on 0TC_C21.
    1.     I want output like:
    Process Chain Id:   Average Duration
    When I run this query for an interval on 0CALMONTH (01.2009 u2013 12.2009), I get all the
    Process chains executed and their average duration.
    2.     Now I want to see Average Duration for each month. I simply put 0CALMONTH on top of the key figure Avg Duration. I now do see 
    Process Chain Id:   Avg Duration 01/2009 Avg Duration 02/2009 u2026. Avg Durtaion 08.2009
    But problem is only some process chains are shown. Why?  In the output, I do see for some process chains there is no Avg Duration, e.g. in 01/2009  because process chain was never run.
    So, I do not understand why some process chains are not being shown. 
    I know for sure that process chains not being shown were run in 08.2009.
    Appreciate any feedbacks, in particular how to debug this problem.

    Thanks for the assistance!
    The feed is here: http://gats.podomatic.com/rss2.xml
    The store URL is: https://itunes.apple.com/us/podcast/gaming-and-then-some/id744125948 (the same you got in Google)
    And that what is confusing me. As far as I know, the URL should not have changed from the one I received when the podcast was approved last year. The feed seems fine. It's still updating when I load up episodes to Soundcloud. I'm stumped. Any ideas?

  • BEx Query Help   How to restrict  Organisation Unit  Like 'D%'    in Bex

    Hi all ,
    In a cube i have a columb   ORGUNIT     which is having Values from
    A_152,
    A8373 ,
    D_983,
    B_0293,
    C09 ,
    D6653 .
    In bex Query Designer I want to restric that infoobject  & organisation unit which is starting with 'D' .
    means  output will be   :  D_983 ,
                                            D6653
    ABAP statement    for this             ORGUNIT  LIKE 'D%' .
    how we do same in BI restriction .
    Thanks Regards
    Sanjeev Kumar
    Edited by: skarya2003 on Dec 6, 2009 9:01 AM

    Hi,
       Try using customer exit .
      chk out this doc which helps u,  http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90f8b363-882d-2c10-ea91-9f08ce4c658a&overridelayout=true
    Regards,
    Priya.

  • Customer Exit in Query Designer

    Hi,
    I have to build a query in QD 7.0 which schould cotain the Countries (Hierarchy) in the Rowes and Revenue % in the Columns.
    I have to show the revenue% in three catagory: >30%, 10-30% and <10% with sum for each catagory, somehow like this:
    Greater than 30%
    usa 40%
    can 31%
    sum
    Between 10-30%
    IT 20%
    CA 21%
    sum
    Less than 10%
    DE 9%
    FR 8%
    sum
    Total sum
    I know that can be done with Customer Exit, but can any one tell me how to do it und how should the Customer Exit look like. I have not too much experience ABAP, or may be some one has another idea.
    Thanks for any help in advance

    Hi Martin,
    Why you want to go for customer exit ??
    I hope that revenue %ge is a calculated key figure. And you have to place Revenue depending on its value under proper column. Is this what u are luking for ?
    If so then u can create busckets for the 3 categories and place the revenuce of particular country under proper category without using customer exit.
    Create 3 different calculated key figure namely >30%, 10-30% and <10%.
    write below formula; for e.g in <10 %
    (revenue < 10) * revenue
    (Im taking into consideration that revenue is a calulated key figyure)
    Will help u in more better way once u clear your requriement.
    Thanks
    Dipika

  • Customer exits (0calday) for a query to populate dates dynamically

    Hi,
    Our user has this requirement for running a reporting in background for every previous week and month which has 34 variants.
    Please tell if the way i choose is correct and also any suggestion for the below!...
    1. wanted to use reporting agent for running the report in the background with reporting agent+ webtemplates.
    2. and also wanted to get the dates populated dynamically in the report...so thought of using CUSTOMER EXITs.
    please help me with the code to write in CMOD. for populating the dates for every previous week and month dynmically.
    - jj
    Edited by: Jpjuvvan on Jun 1, 2009 8:36 PM
    Edited by: Jpjuvvan on Jun 1, 2009 8:39 PM

    Arun,
    The report has 34 variants for which the date ( 0calday)  RANGE has to be populated dynamically when I am running the report in the background using Reporting agent( using 'Precaculating of Web templates...as reporting agent setting).
    My concern is ..
    1.  How can I dynamically populate the dates(0calday) for running the report weekly and monthly for all 34 varinats in the report in the backgrond?( since dont want to manually enter the date range for all 34 variants of the report)
    2. Since I am using precalculating web templates as reporting agent setting should I have to create webtemplate on the query  ( if so ..will it automatically run the 34 variants) or should I create web template for 34 variants using  query views  ( even then the dates has to be populated automatically/dynamically)?
    For eg.    If I am running the report on 1s t June....for Monthly the date range should be 5/1/2009 to 5/31/2009 and for weekly I run the report on sunday of every week..so if i run the report on 6/14/2009 then the date range should be 6/5/2009 to 6/13/2009.
    The date range should be populated DYNAMICALLY , since I don't want to manulally give the date range for all 34 varinats every time I run the report.
    Please suggest.
    JJP

  • Customer Exit Variable in formula to get values for multiple keyfigures

    Hi to all,
    I have query as defined in following scenario:
    CHAR_X     C_KF1 (based on KF1)     C_KF2 (based on KF2)     u2026     C_KFn (based on KFn)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    C_KF = calculated key figure
    I need to create a customer exit variable that will search through selection e.g. CHAR_X/KF1 and give some result. I need this variable for every keyfigure (KF1-KFn). Using customer exit variable is the only solution.
    My question is: do I have to create formula variable (customer exit) representing every keyfigure separately (VAR1 u2013 VARn, like in below example)?
    CHAR_X     C_KF1 (using VAR1)     C_KF2 (using VAR2)     u2026     C_KFn (using VARn)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    Or is it possible to create one general formula variable since the way to retrieve the value in variable is always the same (like in below example)? In this case, how do I pass the value of the respective keyfigure to this variable?
    CHAR_X     C_KF1 (using VAR_X)     C_KF2 (using VAR_X)     u2026     C_KFn (using VAR_X)
    Value1                    
    Value2                    
    u2026                    
    Valuem                    
    Thanks for your replies, points will be awarded!
    Cheers

    That is my concern, the value of variable is not the same.
    What variable should do is:
    take KF1 id, go through values for CHAR_X, get back one value
    This value would always be different, and also "KF" part in code of variable should be different, based on the column where the variable is being used (so, in column C_KF1 ,variable should "pick up" id of KF1, etc.).
    I hope it makes it more clear. For now, I do not have the code for variable yet, I am just interested in concept whether it is possible to pass the ID of keyfigure dynamically so I can make decision how to model this request.
    Thanks

  • Custom Exit for determining previous-year time range

    Dear all:
    I have a problem about custom exit:
    We have created a new object for combining Fiscal Year/Month and Period. So the format will be shown as " yyyymmp"
    now we have one requirement which is determining the same period but previous year based on user input. For Example, if user input start and end period as
    "2006041" and "2006111". There are should be 2 custom exit which are able to convert the user input to be "2005041" and "2005111". We created 2 custom exit for telling the previous-year period.
    Then based on this converted time range, we should be able to extract applicable data. But after testing, we cant get supposing result. The code is following:
    We will be very grateful for any input. thank you all so much
    Calculate (Start)previous year/month/period by current
    *year/month/period
    *user-entry calendar year/month/period
    WHEN 'ZFACLV19'.
          LOOP AT i_t_var_range INTO loc_var_range
          WHERE vnam = 'ZFACYMP1'.
            CLEAR l_s_range.
            LOC_YEAR = LOC_VAR_RANGE-LOW(4).
            LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
              LOC_YEAR = LOC_YEAR - 1.
            L_S_RANGE-LOW(4) = LOC_YEAR.
            L_S_RANGE-LOW+4(2) = LOC_MONTH.
            L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
    Calculate (End)previous year/month/period by current
    *year/month/period
    *user-entry calendar year/month/period
    WHEN 'ZFACLV20'.
    break ab_william.
          LOOP AT i_t_var_range INTO loc_var_range
          WHERE vnam = 'ZFACYMP2'.
            CLEAR l_s_range.
            LOC_YEAR = LOC_VAR_RANGE-LOW(4).
            LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
              LOC_YEAR = LOC_YEAR - 1.
            L_S_RANGE-LOW(4) = LOC_YEAR.
            L_S_RANGE-LOW+4(2) = LOC_MONTH.
            L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
    SzuFen

    Hi,
    Try with following modifications:
    ZYEAR1(4) = LOC_VAR_RANGE-LOW(4).
    ZYEAR1(4) = ZYEAR1(4)- 1.
    ZMONTH1(2) = LOC_VAR_RANGE-LOW+4(2).
    CONCATENATE ZYEAR1(4) ZMONTH1(2) INTO LOC_VAR_RANGE-LOW(6).
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for

  • How do I make firefox 4 look more like firefox 3?

    I am considering updating the household computers to firefox 4, however, the older members of the household dont do changes with their computers very well, to that end, I wish to know how to make firefox 4 look like firefox 3.

  • Help with Flash AS 2.0 Buttons

    Hi, I really need some help with this file, I m fairly inexperience in action script and have great difficulty getting this to work. what happens is when you click on the Performance button on the left, the Learn more buttons below the gloves on the 

  • Javascript to adjust form field font size by number of entered characters?

    I have a form field that asks for 'full name' (first, middle, last). It's posted large at the top of the form. Some people's names are short, some long. Is there a javascript way to adjust the font size used within a form field based on the number of

  • Cleaning up my iTunes library

    A lot of my library is duplicated and the duplicates are none existant, so they have the little exclamation mark next to them. How do you remove them all quickly? Thanks

  • Want to upload iPhoto but it keeps quitting

    I installed iPhoto 11, I want to upoad the photos to use it , and it keeps quitting!!