Concatination of Two dates in customer exit Variable

HI Expert ,
I am writting customer Exit Variable to get Records from user entered Dates .
Eg. In Variable Screen of Bex report i have 2 Variable LYDate & TY Date both of them are As "Mutiple Single Value" & "Mendetory".
If we give LYDATE and TYDATE Date range as,
LYDate - 01/2013 - 06/2013
TYDate - 01/2014 - 12/2014
So I need ABAP Code which will get Value Range from 01/2013 from LYDATE and 12/2014 From TY DATE . So Query will Get data for 01/2013 TO 12/2014 (2 Years Data).
ZCALYEAR (Cusomer Exit)  = LYDATE (01/2013)  TO TY DATE(12/2104).
Please provide step by step ABAP Code to Achiev above issue. Points for Sure...
Thanks,
GB

Hi,
Some code like this will solve your issue:
CASE I_VNAM.
   WHEN 'NEWVARIABLE'.
   IF I_STEP = 2.
      READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE WITH KEY VNAM = 'LYDate'.
      If sy-subrc =0.
          CONCATENATE LOC_VAR_RANGE-LOW(4) INTO L_S_RANGE-LOW.
          READ TABLE I_T_VAR_RANGE INTO LOC_VAR_RANGE WITH KEY VNAM = 'TYDate'.
          If sy-subrc =0.
               CONCATENATE LOC_VAR_RANGE-HIGH(4) INTO L_S_RANGE-HIGH.
               L_S_RANGE-SIGN = 'I'.
               L_S_RANGE-OPT = 'EQ'.
          APPEND L_S_RANGE TO E_T_RANGE.
        endif.
      endif.
    endif.
endcase.
Regards
Yasemin...
Just realized that you need the year. Message was edited by: Yasemin ULUTURK

Similar Messages

  • BW Master Data for Customer Exit Variable Reference

    Good day Experts,
    I have several queries that I would like to remove the hard coding of values on to prevent yearly maintenance. In these queries there are two conditions each condition is on different key figures that is amount by year.  The query is only to report on data that for the two amounts (separated by year) is greater than the specified values. I want to change the condition so the value is no longer hard coded so the query will role automatically as the time period changes. The year amount values that the condition will need to reference are not currently stored in our BW system. I would like to create master data that is maintained directly in the BW system for the amounts that a variable for the condition in the query can then access.
    I know it can be set up as master data and then referenced through a customer exit variable but when I set up the master data if I do the Amount as a key figure I cannot maintain the key figure value for the master data manually in BW, if I set the Amount up as a numeric characteristic then I canu2019t directly use a decimal. Am I missing something in the key figure setup then referencing the key figure as an attribute of the year value or do I need to do it as a characteristic and use a conversion routine or something for data manipulation?
    Can someone please give me some guidance to what the best way to do this is?
    The data necessary master data for storage in BW is the YEAR and a single dollar value:
    For Example:     
    Year          Amount
    2009           101.50
    2008          207.80
    2007          807.40

    I figured out that I can use an amount in the master data and maintain the amount manually as long as I use the amount with a currency instead of setting the currency in the key figure.

  • RSCRM: Query date with customer exit variable

    Hi All,
    Is there any way to run the RSCRM transaction with a query with a customer exit variable for a date characteristic?
    The issue is that the query ran ok but the variable is not being updated when the RSCRM query is running with a background job or a process chain.
    Thanks in advance
    EV

    I do not think you can select Customer Exit variable, if you see the type is selected to Char Value Variables and it is not editable.
    It would be suggested to go for Customer Exit procesing type for your text variable.
    Cheers,
    Neel.

  • Need logic to find Year to Date for customer exit variable

    Hi to all,
    I am creating customer exit variable for query .
    query should display data according to current system year from jan till current system date.
    here senario is like that user never enter year and query will automatically will fetch the data according to current year starting from jan to current system date.
    example.
    current year 2010 and today is system date is sep 29 2010, so query will display data from jan 2010 to current data sep 29 2010.
    please can any one provide me logic for that.
    any code .
    regards
    pavneet rana

    Hi,
    You need to create the characteristic customer exit variable of type select-options. Restrict your keyfigure based on this variable.
    In the logic in CMOD,
    write as below
    i_step =2.
    case i_vnam.
    When 'exit variable'.
    temp = sy-datum+0(4).
    concatenate temp '0101' into temp1.
    l_s_range-low= temp1.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_range-high= sy-datum.
    append APPEND l_s_range TO e_t_range.
    endcase.
    For any further help on customer exit based variable, please refer below article.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f119d9-922d-2c10-88af-8c016638bd90?quicklink=index&overridelayout=true
    Edited by: Rahul K Rai on Sep 29, 2010 3:09 PM

  • Problem with customer exit variable on date range

    Hi All,
    I have customer exit variable on date range. In the selection screen it has to give the week range  as a default (05/21/2009 to 05/27/2009).
    Earlier its working fine and from yesterday onwards it is not working properly. yesday onwards default date range was not displaying in selection screen.
    Wht would be the problem.
    Thanks in Advance

    Hi Ashish,
    I checked every thing what u told earlier. Every thing is fine.
    And another thing is
    I have routine in infopackage level. Since day before yesterday it was working fine and yesterday onwards it was not working.
    Eg: budat will take the data based on routine for the week. But yesterday onwards it is not picking up the data.however I have the data in datasource for the week.
    Wht would be the problem. I debuged the code and its working fine.
    Sekhar

  • Customer Exit Variable to fetch the data from the cube..

    Hello Gurus,
    I am having a requirement to select the latest changed record from the cube while executing the query.  where we are having the Calday as the date with a variable .
    I suggested my client we can filter it at the DSO leve or Data loading level but my client dont want to distrurb the existing design so he want to perfrom the changes at the Query level only.
    For Example we are having below records in the cube.
    PO             Material     Calday       Qty         Price
    101            ABC          1/12           100         10
    101            ABC          2/12            100         10
    101            ABC          3/12            100         11
    I am having Calday in the selection screen as the variable.
    Now from the above example i need to show the record which has been changed on 3/12.
    For this i am planning to write the customer exit variable on the calday , when the user enter the range of Calday then i will fetch the whole records which fall in between the range and i will sort each PO with respect to the date and i will pick those which are the latest records.
    My Concerns:
    !. Kindly let me know if it is possible and what are the other things that i need to consider.
    2. Did it will impact the performance.
    Waiting for your quick replies
    Thanks & Regards
    KK

    Hi Mate,
    Sorry for late reply.
    By d way in your word.
    initially when the user enter the date range as the vairable input. suppose 1/12 to 31/12 then i will pick all those records which fall in this range.
    suppose the records are
    PO Date
    P1 01/12
    P1 02/12
    P2 02/12
    P2 03/12
    P3 03/12
    P3 04/12
    In the customer exit variable Now for each PO i will sort the date in ascending order and i will pick the last record to display it in the Report.
    The ouput will be
    PO Date
    P1 02/12
    P2 03/12
    P3 04/12
    Now hope you are aware about exit variable concept.
    so what value will pass in the calday filter.
    here after sorting on each PO , you will get 3 different dates, 02/12 for P1
    03/12 for P2
    and 04/12 for P3
    Now if you are aware about exit variable concept, then you will pass this three date to CALDAY(I_t_VAR_Range-low = ...)
    but how query will understand that for P1 calday filter value is 02/12, for P2 calday filter value is 03/12.... and so on...
    actually i have also experienced this kind of issue 1-2 years before, i have tried same thing at that time without thinking and stuck with this problem..
    By d way you can also learn from your mistake.. so just try ur logic and then you will understand what is the problem?
    By d way this will not work, parallel you can work on other solution.

  • Customer exit Variable to split single date value into a range

    Hi All,
    we have a requirment where user will enter a date(01/21/2010) value in the variable input screen, it should be single value and mandatory, and the query output should have data for the Preceding 24 months for all 6 Key figures.  (e.g. user chooses 12/15/2009, result set is 12/01/2007 - to - 11/30/2009) summarized by month,
    Our query design is as given below -
    since we only have DATE value in the cube, we have added FISCAL YEAR/PERIOD in the cube and mapped DATE with time chars. Now the cube has the data stored in monthly buckets using FISCAL YEAR/PERIOD . Now we have used the variables  FISCAL YEAR/PERIOD  to restrict Key figures and have an offset on that to get the prior 24 periods.
    Since in our requirement user wants to enter Date variable asmandatory input, we create 1 customer exit variables as a mandatory & single value variable for Date Variable, and using that exit variable we thought of passing the period of user entered date to FISCAL YEAR/PERIOD  which we are using to restrict Key figures and get offset of 24 months.
    Can someone please help us in passing this period vaule from inout Variable Date to Fiscal year/period using CMOD, any other ideas are also welcome
    Thanks in advance

    Hi sateesh,
    we are using DATE_TO_PERIOD_CONVERT ,but in this case if user enter's a date (01/21/2010) then we are getting output only for that date and not for the entire prior 24 months period
    As per our requirment when user enter's date (01/21/2010) it should get the whole range that is entered date and 24 prior months and pass the range back to same input Variable so that in the output we get the data for entire prior 24 months
    Thanks

  • Check user entry in Customer Exit Variable in i_step2

    Hi Folks,
    at the moment I'm facing a challenging problem. In an BW Query i have a Customer Exit defined as "not ready for Input" to catch the Variable in I_Step = 2 and fill by a certain algorithm. When i change the CE Variable to "Inputready", the user can enter values, but i have no chance to react on these values as i_step = 2 will not b reached during execution- And this behaviour is correct. BUT is there any chance to Check user entries in an Customer Exit variable and change this somehow in des code?
    Thanks for all replies.
    BR,
    Maik

    Hi there,
    It is possibel depending on what you wish to accomplish.
    You can create two variables for the same characteristic.
    The first is an input ready variable for the user to enter the data and the second is a not input ready variable CE where you can in step 2 process the data entered from the variable ready for input.
    You can than fill the CE variable with any data, but you will have the variable restricted by the two variables (the ready for input and the CE).
    But for validating you could throw an error message based on the variable input ready.
    Diogo.

  • How to insert a code for a function module into a Customer Exit Variable?

    I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.
    I need to get data in the column LW (Last Week) for both the key figures.
    In function module EXIT_SAPLRRS0_001 one of the functions I have is:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    I need to create a new variable to get values in the Last week column for different key figures and use function “'DATE_TO_PERIOD_CONVERT'” in that variable.
    Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.
    In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.
    Thank you.
    TR.

    Hi Wond,
    Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                EXPORTING
                  i_date         = ld_date
                  i_periv        = lc_periv
                IMPORTING
                  e_buper        = ln_poper
                  e_gjahr        = ln_bdatj
                EXCEPTIONS
                  input_false    = 1
                  t009_notfound  = 2
                  t009b_notfound = 3
                  OTHERS         = 4.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ELSE.
                lc_poper = ln_poper.
                CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.
                wa_e_t_range-sign = 'I'.
                wa_e_t_range-opt = 'EQ'.
                APPEND wa_e_t_range TO e_t_range.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.
    Thank you.
    Regards,
    TR.

  • Change customer exit variable in selections over Dropdownbox

    Hello Experts,
    we are on NW2004s, SP12.
    I have a customer exit variable (0CALYEAR) in two columns. In the first column the customer exit variable and in the second column the customer exit variable with an offset -1.
    Now I want to change the year in a dropdownbox. Under <=BW3.5 that was not possible, only over a how to paper.
    I can fill the dropdownbox in the web template but when I change the year, it jumps back to the year selected by the customer exit. How can I change the variable in the new web application designer (2004s) during the navigation? Has any one experience with such a problem?

    Hallo Frank,
    how can I change the variable values in the WAD?
    The parameters of the variable: mandatory, customer exit, reference characteristic: 0calyear, single value, not ready for input.
    My coding:
    DATA: l_s_range TYPE rsr_s_rangesid.
      DATA: i_s_var_range   TYPE  rrs0_s_var_range.
      DATA: i_calyear(4) TYPE c,
            i_duedate(4) TYPE c.
      IF i_step = 1.   " Variable nach Selektionsbild bearbeiten
        READ TABLE i_t_var_range
        WITH KEY vnam = 'CALYEAR_X01'
        INTO i_s_var_range.
        i_calyear = i_s_var_range-low.
        i_duedate = '0210'.
        IF sy-datum+4(4) GE i_duedate.
          i_calyear = sy-datum(4).
        ELSE.
          i_calyear = sy-datum(4) - 1.
        ENDIF.
    Rückgabetabelle füllen
        CLEAR l_s_range.            " Range-Tabelle füllen
        l_s_range-low  = i_calyear.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        APPEND l_s_range TO e_t_range.
      ENDIF.
    Thank you for your fast reply!
    Regards
    Jens

  • Customer exit variables

    Hello,
    I have created two customer exit variables, although I'm not an ABAP expert. Both are calculated based on two optional variables selected by the user.
    When running my query I get the message "Warning Value '' is too long for variable ZPERSTRT". I suppose that really means the value is empty while a value was expected. The type of this variable is 0DATE.
    I try checking the code to examine how the value can be empty, and that results in a few questions some of you probably can answer.
    Unfortunately, for complex reasons I have to program the customer exit variables in the development system, while testing them in the test system where I don't have access to the ABAP editor.
    QUESTION 1
    When finding the values of the other variables, I must be prepared to find them without a value. How can I know if they have a value or not? I've tried with the following code, which I suspect is not working quite as expected:
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'ZCALWINT'.
            IF loc_var_range-low <> ''.
              l_week0 = loc_var_range-low.
              l_flag = 1.
            ENDIF.
          ENDLOOP.
    I later use l_flag to check if a value was found or not.
    QUESTION 2
    How is type conversion done in a statement like
    date = string + 1
    If string has the value "20071031", will 1 be added as a string (resulting in "200710311" which is then somehow converted to a date), like a number (resulting in "20071032" which is then somehow converted to a date) or like a date (resulting in "20071101")?
    QUESTION 3
    More type conversion. Would it be ok to concatenate year, month and day into a date variable, or should I always concatenate into a string which can then be converted to a date afterwards?
    QUESTION 4
    If the variable I want to read has an interval and not only a single value, is the only way to see this by checking the -high value? If this one has a value it is an interval, if not it is a single value? Or can I be sure the -opt value will be 'BT' if it's an interval?
    Thanks and regards,
    Christoffer

    Anyone?
    I'll award 10 points to the best overall answer and 6 points to answers which are first or best on one of the four questions.
    Regards,
    Christoffer

  • Default value of BeX customer Exit variable not Displayed in WeBI??

    Hello Experts,
    We are stuck with a problem where WeBI report is created on top of BeX query and we are not able to see the default value of Bex Customer exit variable in WeBI run. Here is the complete scenario:
    1. One restricted KF is created in BeX, restricted with Customer exit variable on net Due date. And this variable is mandatory, ready for input, and Default value in calculated is user exit as current Week's Monday.
    2. So, by default KF data should be restricted to Monday of current week, if user does not change this value.
    3. Now, WeBI report is created on top of this Bex query, and all is working fine, i.e. we are getting variable as Prompt in WeBI, but Default value is not shown while Running the Webi Report.
    So, need your inputs on the same, if default values from BeX in WeBI is supported or not? If yes, why this is happening, and how to resolve it?
    Please notice, the restrcition is in KF only, it is not a separate restrcition on Net Due date in Filter area or in Defualt area of BeX
    and we are on SAP BW 7.1 and BOXI 3.1 SP4.
    Regards,
    Vipul
    Edited by: VIPUL GOYAL on Nov 23, 2011 9:44 PM

    Hi,
    See 1285993 - Support of Customer Exit Variables from BEx query into WebIntelligence via OLAP universe
    WebI will prompt when executed, but the default values calculated by the user exit  - do not appear.
    Note: If the BEx variable has property 'ready for input' set / enabled, then its WebI prompt shows ok, but no default value appears.
    Cause
    This behaviour expected 'by design' (in the context of the product's current limitations) as explained in the online guide below:
    Please refer to Chapter 7, page 44, document link here: http://help.sap.com/businessobject/product_guides/boexir3/en/xi3_sap_olap_universes_en.pdf
    Characteristic variable > processing type > Customer Exit  is "Supported, without user entry"                                                                               
    -->  This should be understood as meaning "User will not be shown a prompt"
    regards,
    H

  • Customer Exit variable and Filter routine in DTP does not works?

    Hello Experts,
    Does anyone know what might be the possible reason - A customer exit variable working fine on the OLAP side does not work in a DTP??
    I have also tried to use the Filter routine, which does not give me the right results..I am trying to fetch a Fiscalyear period maintained in an infoObject as follows in my Filter routine..
    ata: sel_period like /BIC/PZPARAM-/BIC/ZPARAMVAL.
    DATA: zperiod type /BI0/OIFISCPER.
              SELECT SINGLE /BIC/ZPARAMVAL INTO sel_period
              FROM /BIC/PZPARAM
              WHERE /BIC/ZPARAM = 'ZPCA'
              AND objvers = 'A'.
              zperiod = sel_period.
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'FISCPER'.
              l_idx = sy-tabix.
              l_t_range-iobjnm = '0FISCPER'.
              l_t_range-fieldname = 'FISCPER'.
              l_t_range-sign = 'I'.
              l_t_range-option = 'EQ'.
              l_t_range-low = zperiod.
              if l_idx <> 0.
                modify l_t_range index l_idx.
              else.
                append l_t_range.
              endif.
              p_subrc = 0.
    Please let me know if I am making any mistakes above..
    Kind Regards,
    Kadriks

    Hi
    1.  CLEAR l_t_range-high. is missing in your code befor assigning values to l_t_range.
    2. use simple append l_t_range after the l_t_range asisgnments. remove below code :
    if l_idx 0.
    modify l_t_range index l_idx.
    else.
    append l_t_range.
    endif.
    p_subrc = 0.
    3. I dont think you need to assign infoobject.
    4. Clear sel_period and zperiod is also missing
    Hence your code should be  :
    data: l_idx like sy-tabix.
    read table l_t_range with key
    fieldname = 'FISCPER'.
    CLEAR l_t_range-high.
    l_idx = sy-tabix.
    l_t_range-fieldname = 'FISCPER'.
    l_t_range-sign = 'I'.
    l_t_range-option = 'EQ'.
    l_t_range-low = zperiod.
    append l_t_range .

  • Customer exit variable - internal table in BEX

    Hi,
    i am running a report and using variables in it.
    The report runs over a info cube. There are few challenges in it.
    One of the variable is posting date, and when user enters posting date i need to negate it with current system date.
    If the negated value is greater than 28 then i need to exclude documnet type 'YG' and display the query, else i need to include the dcumnet type 'YG' and document type '  '.  The above logic can be well implemented via a customer exit variable(for posting date) using an internal table. We have internal tables like C_T_DATA which is used in data source enhancement, which help us to implement our own desired logic.
    Do we have such kind of internal tables, based on which the report output (result set) is derived?
    i know that we have l_t_range and e_t_range, but dont know their usage, some one can explain in detail about them?
    Thanks in advance.

    Hi Selva & Lakshmin,
    The code given by Selva is almost correct . If my understanding is clear , you also wanted to include  document type ' ' when the negated value is less than 28 .
    Modification in Selvas Code :
    Variable 'V_DOCTYP' must be of type Multiple Single Values.
    DATA : V_DATE LIKE SY-DATUM.
    DATA : V_DAYS TYPE I.
    if i_step = 2.
    when 'V_DOCTYP'.
    READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZV_PDATE''.
    IF SY-SUBRC = 0.
    V_DATE = loc_var_range-low.
    ENDIF.
    V_DAYS = SY-DATUM - V_DATE.
    IF V_DAYS > 28.
    l_s_range-low = 'YG'
    l_s_range-sign = 'E'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ELSE.
    l_s_range-low = 'YG'
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    clear l_s_range.
    l_s_range-low = ' '.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIF.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh

  • Customer Exit Variable not working in BO-Webi Report

    Hi All,
    I have created a universe based on Bex Query.
    Bex query consists of a customer exit variable on Calendar year/month where in it will populate current calendar year month by default while executing the query. It works fine while executing in SAP BI Bex Analyser.
    I have created a universe based on the query. For Calender year/Month i got L00, L01, LOV values in universe.
    Based on the universe I have created a Webi report. I did not specify calendar year/month as query filters. While directly executing the Webi report, I get the calendar year/month variable screen. But the value for it not populated based on customer Exit code written in BI.
    What has to be done to get the customer exit values in variable screen.
    Thanks for your understanding.
    -- Selva

    Since you have customer exit variable in your bex query, it will be like a global filter in your universe.
    Execute the webi report and check whether you are getting only current month data.
    --- Thanks

Maybe you are looking for