Bex Formula using customer Exit

Dear Friends,
I am trying to resolve the below problem. Require your help.
In one of the bex reports, the requirement is to provide a variable on Bill date. From the given bill date, the report should display data for 7 consecutive days.
But the condition is that the from date should always be a saturday?
What i have done is : In ROWS, i selected the required key figure columns
and then, created a structure in which i created Seven New Selections and used offsets.
so, if the user enters a specific date, the report displays seven days of the data from the given date. However, how do i restrict the user's choice to only saturdays.
I suppose the solution lies in using customer Exit.. but could some one help me with the ABAP coding.
I am also available on [email protected]
Thanks for the anticipated support.

Hi,
You can get the Day from the current system date and put a case statement to substract 1 for sunday to get saturday
2 for monday
3 for tuesday
etc
Fuction Module : DATE_TO_DAY
Can check this link : FM: DATE_TO_DAY

Similar Messages

  • 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

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • 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

  • Text Variable using Customer Exit .

    Hello Friends. I have a requirement to create Text Variable using Customer Exit . So I created the Text Variable as "ZVRBMS" and assigned that with YTD &ZVRBMS& in the Structure of Query Desigener . so that Out put will YTD AUTO
    OR YTD RETAIL
    Now this Auto And Retail comes from Version that user choose via variable ZFIBMSVER IN User Promt. if ZFIBMSVER = 10
    then ZVRBMS = auto . and if ZFIBMSVER = 20
    then ZVRBMS = RETAIL
    Please correct my ABAP code in customer exit and let me know to make this work
    when 'ZVRBMS'.
        if I_STEP = 2.
          clear LOC_VAR_RANGE.
          loop at I_T_VAR_RANGE into LOC_VAR_RANGE.
            if LOC_VAR_RANGE-VNAM = 'ZFIBMSVER'.
          if SY-SUBRC = 0 OR LOC_VAR_RANGE-LOW = '10'.
            L_S_RANGE-LOW = 'AUTO'.
          elseif LOC_VAR_RANGE-LOW = '20'.
            L_S_RANGE-LOW = 'RETAIL'.
          L_S_RANGE-SIGN ='I'.
          L_S_RANGE-OPT  = 'EQ'.
          append L_S_RANGE to E_T_RANGE.
      endif.
      endif.
      exit.
          endloop.
    endif.
    Thanks
    Soniya

    The code should be:
    when 'ZVRBMS'.
    if I_STEP = 2.
    clear LOC_VAR_RANGE.
    loop at I_T_VAR_RANGE into LOC_VAR_RANGE.
    if LOC_VAR_RANGE-VNAM = 'ZFIBMSVER'.
    if LOC_VAR_RANGE-LOW = '10'.
    L_S_RANGE-LOW = 'AUTO'.
    elseif LOC_VAR_RANGE-LOW = '20'.
    L_S_RANGE-LOW = 'RETAIL'.
    endif.
    L_S_RANGE-SIGN ='I'.
    L_S_RANGE-OPT = 'EQ'.
    append L_S_RANGE to E_T_RANGE.
    endif.
    exit.
    endloop.
    endif.

  • BW reporting authorisation using customer exit

    Hi,
    We are planning to implement BW reporting authorisations using customer exit, so that authorisations can be filled at the run time, this is to avoid maintaining huge number of authorisations.
    If any one has implemented this before, Please send me  some documentation for the same. We have BW 3.50 environmnet.
    Regd,

    Hi Anil,
    What kind of authorization do you need for your BPS layout? Please explain this requirement further and I will try to help.
    Your second question is quite good, where do I find the values to fill the user exit too do authorization correctly for each user, right?
    I think this depends heavily on your source system, but a good approach (if possible) is to compare the master data available in the BW system to the logged on user in the system. If not, you will have to maintain data, i.e. in an ODS (like you suggest) in order to have something to work with in the CMOD exit.
    For instance, consider this simple scenario (we can discuss it further if you give more details on your scenario and requirements):
    User ABC belongs to plant 10. User DEF belongs to plant 20. You have an ODS with mapping between usernames and plants.
    <pseudo code>
    In CMOD:
    data: lv_user(8) type c.
    data: lv_plant(10) type i.
    lv_user = sy-uname. "this will give you user's login id
    select single plant into lv_plant from <your ODS>
    where ods_userid eq lv_user.
    L_S_RANGE-LOW = lv_plant.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    User ABC will see plant 10 and user DEF will see plant 20.
    Do you have any master data (i.e. 0username) available to map between username and an user number (such as business partner)?
    Hope this helps,
    Petter

  • What are the commonly used customer exits ?

    what are the commonly used customer exits  in realtime with regard to the modules MM, SD, PP?

    SD - MV45AFZZ

  • Can u please help in getting this report  "using customer exit."....

    Hi friends.
    can any body pls suggest how this report lay out could be formed.
    when you enter in selection as  0CALMONTH = Nov 2007.
    The report should give the values of a K.F (return rate), in the following manner .
    july     july-aug      july - sep       july - oct         july - nov.
    i.e it should always give the values of that K.F starting from july , then july -aug , then july-sep , july-oct and july -nov ..(it shld show  the cumulated values starting from july )
    The fiscal year  always starts from july and ends with june .
    say if you give  0calmonth  = FEB 2007, THEN THE TREPORT SHOULD FETCH TE VALUES
    july2006      july -aug      july-sep          july -oct         jul- nov       july- dec   jul - jan2007    july2006 - feb 2007
    can you plesae tell me in detail  how to this . if we have to use CUSTOMER EXIT ,pls give me the code how to do this. your answers will be suitably rewarded.

    Hi,
    Try using offset varaiable of calmonth.
    Regards
    siva

  • How to use customer exit variable in the report

    Dear All,
    i want to use a standard customer exit variable in the report properties.
    In the Bex Query Designer right hand bottom you will find two buttons "Properties" and "Task". Click on task you will get different option. Choose properties from there and then select "variable sequence tab".
    I need to add a standard variable there. How can i achieve it?
    Appreciate your early help.

    You need to add variable to corresponding charctertic then you can get that varaible for sorting the sequence....
    If 0CUST is the varaible then you need to assign it 0CUSTOMER then 0CUST will be available for the sequence.
    Edited by: shanthi bhaskar on Apr 2, 2009 5:41 PM

  • 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

  • Formula Variable Customer Exit

    Hi Gurus,
    I have a requirement where I have to read the one formula variable value ( Replacement path with attribute value ) into customer exit of another characteristic variable .
    For example :
    I have one characteristic formula variable called VAR1 ( which gives the value ) .This value I want to use it in customer exit of another varable  VAR2 ( is it possible to use one formula variable value into another variable ) which I want to use it in Customer exit.
    VAR1  -  Formula Variable
    VAR2  -  Simple Variable with out User Input.
    Example is as below :
    Formula Variable ( VAR1 i.e PLND_DLVRY )  based on this value I want to define another variable APO Version in the Customer
    If it is possible please guide me what is the process. Also I want to make sure which I_STEP I need to use...
    Please guide the best solution.
    Thanks
    Ganesh Reddy.

    Hi Krishnan / Arvind,
    Sorry I was thinking 0PLND_DELRY is nav attribute for 0MAT_PLANT. But 0PLND_DELRY is the quantity field so I can't make this field as a nav attribute. Right now I am populating directly in the Cube using master data. my cube  data looks like
    Fields Description
    F1 = Version
    F2= Material
    F3= Plant
    F4= 0PLND_DELRY
    F5= Calendar Yr/Month
    F6= Concensus Forecast ( Key Figure )
    Condition is Combination of Material and Plant will define 0PLND_DELRY ( Delivery Time )
    F1  |   F2 |  F3  |  F4   |F5  |   F6
    201104 | M001 |200 |  30 |  2011/07 |  5100
    201104 | M002 |200 |  60 |  2011/07 |  6200
    201104 | M001 |300 |  90 |  2011/07 |  4900
    201104 | M001 |200 |  30 |  2011/07 |  7900
    201105 | M001 |200 |  30 |  2011/07 |  5700
    201105 | M002 |200 |  60 |  2011/07 |  6900
    201105 | M001 |300 |  90 |  2011/07 |  4300
    201105 | M001 |200 |  30 |  2011/07 |  7400
    201106 | M001 |200 |  30 |  2011/07 |  5500
    201106 | M002 |200 |  60 |  2011/07 |  6700
    201106 | M001 |300 |  90 |  2011/07 |  4500
    201106 | M001 |200 |  30 |  2011/07 |  7500
    201107 | M001 |200 |  30 |  2011/07 |  5000
    201107 | M002 |200 |  60 |  2011/07 |  6500
    201107 | M001 |300 |  90 |  2011/07 |  4000
    201107 | M001 |200 |  30 |  2011/07 |  8000
    In Order to bring the variance for F6 for Material M001 and Plant 200 then my result is
    Calendar Yr / Mnth = 2011/07
    Current Value = 5000
    Lead Time = 30,  offset = -1
    Version = 201107-1 = 201106 Then
    Prior Value = 5500
    Variance = 5000-5500 = -500
    for Material M002 and Plant 200 then my result is
    Calendar Yr / Mnth = 2011/07
    Current Value = 6500
    Lead Time = 60,  offset = -2
    Version = 201107-2 = 201105 Then
    Prior Value = 6900
    Variance = 65000-6900 = -200
    for Material M001 and Plant 300 then my result is
    Calendar Yr / Mnth = 2011/07
    Current Value = 4000
    Lead Time = 90,  offset = -3
    Version = 201107-3 = 201104 Then
    Prior Value = 4500
    Variance = 4000-4900 = -900
    for Material M001 and Plant 200 then my result is
    Calendar Yr / Mnth = 2011/07
    Current Value = 4000
    Lead Time = 30,  offset = -1
    Version = 201107-1 = 201106 Then
    Prior Value = 4500
    Variance = 8000-7500 = -500
    Every month we get same data with different version and different numbers for all months. Please advise me what is the best solution we can do
    Thanks
    Ganesh Reddy.

  • BEx Formula Use of 'Logical And' and Calculation for Gross Margin

    HI Bex gurus.
    Having an odd time with what should be a simple formula to handle the display of gross margin (GM). The goal here is to display GM% properly and the requirement is as follows
    If GM <= 0 then 0.0
      Else
    If GM > 0 and Sell > 0 then ( ( sell - cost /sell ) * 100 )
      Else
    If GM >0 and Sell = 0 then 100
    I am familiar with bex formulas and have referenced the help docs on booleans here -
    Boolean Operators - SAP Business Explorer - SAP Library
    But what is odd is that if I use a calculation or a CFK in the IF, THEN with a LOGICAL AND, the formula does not report correctly
    If I put in a static value, like 77, the expected logic is followed.  I have tried making sure have extra parentheses and changing the order of the statement, to no avail!  I could use some extra brains on this puzzling matter, so you help is greatly appreciated and will award points!
    Thanks
    lee lewis
    Here are the formulas in text and below screen shots.  Wish could copy and past formulas to and from editor!
    GM%77
    ( ( ( 'Order GM' >0 ) AND ( Order Sell  >  0 ) ) == 1) * 77 + ( ( ( 'Order GM'> 0 ) AND ( Order Sell == 0 ) ) == 1) * 100 + ('Order GM' <= 0) *0.0
    GM%
    ( ( ( 'Order GM' >0 ) AND ( Order Sell  >  0 ) ) == 1) * 'REF GM%' + ( ( ( 'Order GM' > 0 ) AND ( Order Sell == 0 ) ) == 1) * 100 + ('Order GM' <= 0) *0.0
    'REF GM%
    (order  sell - order cost /order sell ) * 100 )
    GM%77
    GM%

    Shouldn't you change on of the brackets in your REF GM% ?
    'REF GM%
    (order  sell - order cost /order sell ) * 100 )
    I would put that as
    'REF GM%
    (order  sell - order cost) /order sell  * 100 )
    Not sure what you mean with those red arrows... but in both cases you would be dividing by 0 (order sell = 0).

  • Daily Outstanding Report : Formula or Customer Exit

    Hello All,
    I am working on Daily Outstanding Report which is on 0FIAR_C02 Cube. in this cube i have 4 key figures 0DEBIT, 0CREDIT, 0BALANCE, 0SALES.
    There is one standard query  0FIAR_C02_Q1001 where i enter value for 0FISCAL YEAR / PERIOD = 009.2009 then i will get Period Balance means AR balance for that period, Sales for the previous period (means for 008.2009) and DSO which is formula from the above 2 keyfigures. this report shows me data for only one month as i have to enter it in the selection screen.
    My requirement is : in the selection screen i will give interval 009.2009 to 011.2009 then it should show me that report for Each Month. now to get the data for Period Balance i took cumulative balance so it is coming perfactly but HOW TO DEAL WITH SALES FOR THE PREVIOUS PERIOD for everymonth menas for SEPTEMBER i should be able to get get AUGUST VALUE for SALES same way for OCTOBER i should be able to get the value for SEPTEMBER and so on...
    Do i require to write a Customer Exit code or with any formula it is possible ?
    Please let me know.
    Regards,
    Komik Shah

    Hi Marsanaidu,
    Thanks for your reply.
    Can you send me a customer exit code with offset value. how to do this ?
    Regards,
    Komik Shah

  • Authorisation variable using customer exit

    Hi,
    how to populate a authorisation object at runtime? is it possible to have a variable etc that can be populated a runtime?
    I have a object zsales_off which has different values for different users. i need to create separate roles just to have different values for sales office for different users. i would like to avoid this by having a single role with the zsales_off getting populated at runtime.
    please give details steps with code if possible? 
    i have created the authorisation variable and am using it in the query. if i manually assign values for sales office in the role, it is working fine.
    i want to assign values at run time. i am confused with the process as such.
    few specific doubts like:
    1> the variable should be of "authorisation" processing type or "customer exit" processing type.
    2>what to use I_step=0 or I_step =1? how to use? where to use?
    3>to write a abap code or use a func module, which one? how to use.
    4> what(value) to assign for the zsales_off object in the authorisation profile?
    thank u in advance..

    Hi torsten,
    thank you. but i am afraid it doesn't give me an idea as to how to move ahead?
    i have variable with processing type "authorisation" used in many queries.
    can i use the customer exit rsr0001 for this variable? what value should be assigned in the authorisatio profile for this object?
    please give the detail process and a abap code if possible.
    thank u

  • 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.

Maybe you are looking for

  • Unable to generate trace file

    Hi, I have written the stored procedure for starting sql trace on a given session for say n number of seconds. create or replace procedure start_trace v_sid in number, v_serial# in number, seconds in number) IS v_user varchar2 (32); duration number;

  • Serial Number for SALE ORDER

    Hi.. In this scenario , I have to create sale order for 20 qty which it should trigger production order for the same quantity as it have many sub assemblies. sub-assemblies here mean sub batch orders. and for the same qty , serial numbers got generat

  • Windows 2008 R2 - snmp 64bit counters support?

    Hi all, I wonder if Windows 2008 R2 Standard supports 64bit counters from IF-MIB (I mean the '1.3.6.1.2.1.31' OID). I can get the ifName, ifAlias, ifSpeed and several other objects, but the two most important (ifHCInOctets and ifHCOutOctets) are unac

  • Ztable update in incoming IDOC

    Hi, I am looking for a user exit or BADI which can be used to update some Ztables once an IDOC is received. That is, the SAP standard tables for IDOC's (eg. EDID4, EDIDS) together with the Ztables must be committed in one LUW.  We are in 4.6C version

  • Ipad 3 (new ipad) with external display, ipad not booting up

    i have an old ipad 3 (new ipad) witha broken digitizer (touchscreen) and in order to use it without the touchscreen i bought a "30pin male (ipad connector) to 30pin female (ipad connector)/ "vga in" as seen in the picture below, but as i connected ev