User Exit Variable for Bex in CMOD (ABAP Code)

Hi Experts
  My requirment is to develop a Restricted Keyfigure...
  The restriction is based on 0Calmonth (Calendar Year/Month)
The sales from beginning of calendar year up to last "closed" month in a Calendar.
Ex: in June i want to see 01.01.2009 to 31.05.2009 data.
    in October i want to see 01.01.2009 to 30.09.2009 data.
When user execute the report
    in Jan 2010 i want to see 0 as there is no closed month in that particular year.
    in Fed 2010 i want to see 01.01.2010 to 31.01.2010 data.
For that purpose i need to create a User Exit variable in CMOD...
I am struggling to get an idea on how to write a code to meet the requirment
Please help me with code that i can use in cmod
Thanks in advance

Hi,
Use the following code :
when' variable name ' .
DATA : year(4) type n,
month2(2) type n,
date_in type sy-datum,
date_op type sy-datum.
IF I_STEP = 1.
CLEAR L_S_RANGE.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
month2 = sy-datum+4(2).
if month2 = '01'.
concatenate sy-datum+0(4) '01' '01' into l_s_range-low.
l_s_range-high = sy-datum.
else.
month2 = month2 - 1.
clear : date_in, date_op.
concatenate sy-datum+0(4) month2 '01' into date_in.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
  EXPORTING
    DAY_IN                  = date_in
IMPORTING
   LAST_DAY_OF_MONTH       = date_op
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.
concatenate sy-datum+0(4) '01' '01' into l_s_range-low.
l_s_range-high = date_op.
endif.
APPEND L_S_RANGE TO E_T_RANGE.
ENDIF.
I dint know what output do you want if the current month is jan.
I have put it as 1st jan till current date.
Modify it if you need.
Regards,
Mansi

Similar Messages

  • Funtion Module for user exits  variables in BEx Queries.

    Hi,
    This is for BW Query customer exit variable (zvar2) for include ZXRSRU01 and exit :EXIT_SAPLRRS0_001.
    Can anyone please suggest the function modules that can be used to do the following.
    1)Read value of zvar1 from selection screen whatever 
      user enters at run time.
    2)How to define the zvar2 in the include. zvar2 is the 
      variable created in BEx to be populated from this
      customer exit.
    3)How to use case statment where once the value for zvar1
      is determined then,
       Case zvar1.
       when zvar1 = 0 , then zvar2 = 10
       when zvar1 = 1 , then zvar2 = 20
    3) Assign zvar2 value as computed in the case statement.
    Can anyone please help with the code to achieve this.
    Any information regarding function modules that can help write user exits for variable reading and input will be greatly helpful.
    Thanks
    Sarah.

    Hi Sarah,
    You don't need any FM for your issue.
    Please try thie sample code :
    DATA: VAR_INPIUT LIKE RRRANGEEXIT.
    CASE I_VNAM.
      WHEN 'ZVAR2'.
       CLEAR L_S_RANGE.
       IF I_STEP = 2."PROCESSED AFTER VARIABLE INPUT
    *Reading value of ZVAR1
        LOOP AT I_T_VAR_RANGE INTO VAR_INPIUT
          WHERE VNAM = 'ZVAR1'.
          CASE VAR_INPIUT-LOW.
    *FILLING ZVAR2
           WHEN 0.
              L_S_RANGE-LOW     = 10.
           WHEN 1.
              L_S_RANGE-LOW     = 20.
          ENDCASE.
          L_S_RANGE-SIGN     = 'I'.
          L_S_RANGE-OPT      = 'EQ'.
          APPEND L_S_RANGE TO E_T_RANGE.
          EXIT.
        ENDLOOP.
      ENDIF.
    ENDCASE.
    Hope this helps
    Joe

  • Creating User Exit Variable in BeX

    Hi All,
    Urgent help required.
    I need to create User Exit for a variable which reads value from other variable value which user enter during pop up.
    Ex: I need get value for the vaiable "ZACTFY" from the variable value "ZSCENARI". Value of this ZSCENARI will be like
    200684
    200693
    200757 ....
    where 2006, 2007 specify year of the forecast value and from (200684) the value 8 refers to 8 months actual & 4  refers to 4 months plan values.
    So if ZSCENARI is 200684 the value for the variable ZACTFY should be in interval. i.e Range for low value should be 001.2006 (always month is Jan and year taken from first 4 digits of ZSCENARI) and hight value should be 008.2006.
    No need to worry about plan values for scenario 200684 plan value will be there only for last 4 months.
    1. Can any one tell me how to do coding for this(pls let me know including declaration).
    2. Also if the value for ZSCENARI is Multiple single values lets say the user enters as 200684,200693,200657.. Pls tell me how we can do coding for this.
    Thank You.
    Best Regards,
    Bhuvana.

    Hi,
    CASE I_VNAM.
      WHEN 'ZACTFY'.
       IF I_STEP = 2.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
            WHERE VNAM = 'ZSCENARI'.
            CLEAR L_S_RANGE.
            L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(4).
            L_S_RANGE-LOW+4(2) = '01'.
            L_S_RANGE-high = LOC_VAR_RANGE-LOW(4).
            L_S_RANGE-high4(2) = LOC_VAR_RANGE-LOW4(1).
            L_S_RANGE-SIGN = 'I'.
            L_S_RANGE-OPT  = 'BT'.
            APPEND L_S_RANGE TO E_T_RANGE.
          ENDLOOP.
        ENDIF.
    With rgds,
    Anil Kumar Sharma .P

  • User Exit Variable for Infoprovider based on month characterstic in query

    Hi,
    I am financial reporting with reports created on a mulit-provider over a plan & Actual cube.  Along the top of the report is a structure which has amongst other restricitions a column for each month, i.e columns 1 to 12. 
    Currently we are in month 9, so the report should show data from the Actual infoprovider for months 1 to 9, but data from the plan infoproviders for 10 to 12.  My question is how should the variable be coded for the infoprovider which will return a value based on the month characteristic in each columns selection.  I understand how I can look at say the current system date, derive the month and return the plan/actual value for the correct infoprovider based on the current month.  But I need to create a variable which will look at the month value which is in each column selection in the query itself.
    Many thanks,
    Richard

    we recently had this kind of reporting requirement. only difference being week instead of month.
    you need to create 12 variables for actual month columns and 12 for budget.
    now you will write a code to address all the variables. in following format :-
    when var1.         "suppose var1 represents month 1 of actual columns
    1. derive month from date.
    2. if month <= i_vnam+3(1)                         "get the number from var and compare
                  set the  variable value as the month number of that year for e.g
                  concatenate year i_vnam+3(1)      into        l_s_range-low       
        else
                  set the variable value way back in past which will not have any data.
    above logic will cause values in following fashion
    if this month is 3 and year is 2008
    var1 = 200801
    var2 = 200802
    var3 = 200803
    var4 = 199001
    var5 = 199001
    etc.
    In the query all columns will be set with the property = hide if not values are present. so if 199001 is set in the variable then it will be collapsed.
    same way logic for variables in budget column can be written which will set all the month variables which are less than
    current month to 199001 (just in reverse fashion of above mentioned logic.)

  • User Exit Variable for Calculating number of days in a month

    I need a query to calulate the number of days in a particular month upto the current date. For example if i give 26 Feb it should reutrn 25, if i enter 30march it should return 29 for any specific year. I have gone through some posts and understood that i need to create a formula variable (under calculated KF's) and then go to CMOD, create a project, then enancement Assignment RSAP0001 then EXIT_SAPLRSAP_001 and include a code in INCLUDE ZXRSAU01. But i have any clue of coding. Could someone give me the entire code and how to connect it to the formula variable KF in created. The technical name of the key figure is ZMDAYS. If i have made any mistakes or if there is another eaier alternative please let me know. I thankyou all for the help.

    Hi Uday,
    I have a few modifications in the code
    Data: xdate type d,
          ip_year(4) type N,
          ip_month(2) type N.
    Types : Begin of ty_month_days,
           month(2) type N,
           days(2) type N,
           End of ty_month_days.
    Data : it_month_days type ty_month_days occurs 0 with header line.
    ip_year = 2006.
    ip_month = 01.
    do 12 times.
        CONCATENATE ip_year ip_month '01' INTO xdate.
        xdate = xdate + 33.       "this date is in the next month
        xdate+6(2) = '01'.        "first day of next month
        xdate = xdate - 1.        "last day of xmonth
        it_month_days-month = xdate+4(2).       "number of days of xmonth.
        it_month_days-days = xdate+6(2).
        append it_month_days.
        ip_month = ip_month + 1.
    enddo.
    This code stores Month and No. of days in the internal table it_month_days.
    You can access this internal table for your calculations
    This should help.
    Regards,
    Praveen.
    Message was edited by: praveen mathew

  • How to Broadcast Control Query based on User Exit Variable

    Hi Gurus,
    How to Broadcast dashboard based on Control Query based on User Exit
    Variable to different users via mail in BW 3.5 version. Any document or
    steps to achieve this will be very helpful.
    Regards
    Vishwanath

    Hi Surendra,
    Thanks for the reply and your suggestion. It will be great if you can help me to answer the below:
    1) What exactly we mean by Control Query - Any example will be very helpful
    2) As you mentioned, yes the user exist to be written will be for user-exit variable for dynamic period selection - An Example on how to create this will be helpful
    3) Once the above variable is created, what are the steps to include this variable in the Bex Query?
    4) Once all the queries to be used in dashboard are implemented with the exit variable, how to create a variant to be used in Broadcasting?
    5) How and where to configure the email recipients (to whom this dashboard will be sent via mail)?
    6) How to set up the BW broadcaster in BW 3.5 using the control query ?( My question is though we have to send the dashboard to the users, which has multiple queries, how a single control query with variant will help us).
    Awaiting your reply.
    Thanks and Regards
    Vishwanath

  • How to select several values from a user exit variable in a planning folder

    Hello,
    I have created a user exit variable for limiting the values only to which the user need to access.
    For a simulation part, it is then necessary for him to select several values from these values (not only one, and not all)
    But It seems in this case the user has only two possibilities :
    - keep all the values without any restriction
    - restrain the selection to only one value.
    It seems possible for the user to access to a multiple choice window, but this possibility doesn't seems to work : in all tests we did, only the first value was taken into account by BPS.
    If this method is not good do you know an other manner to permit the user to choice several values amongst a set of pre-selected  (because the original set is too important) values ?
    Thanks for your help.

    Hi Mayank,
    Thanks for your response, but I don't think it corresponds to my problem.
    I my case, I use a user exit variable to filter some data. It seems BPS offers the possibility to the user to select several values amongts the pre-selected values presented by the user exit variable, but it doesn't work. We can use a popup in which we enters the required values, but in final, only the first value is taken into account.
    I don't know if it is due to a BPS bug or if it is not a good solution in regard to BPS philosophy. In this case, the concerned caracteristic isn't in the header but in lead columns.
    I must present a solution to my client next monday, so I have not enough time to open an OSS message.
    An alternate solution should be interesting too.
    My need is to present to a user a selection of values amongst all values from an infoobject (the user exit variable seemed to be a good solution) and the user must have the possibility to select some values amongst these as filter.
    Regards

  • BI 7 Bex Query - User exit variables after variable screen re-processed

    User exit variables are not re-calculated after the variable screen is called up to re-run report with a new selection.  Is there some way to force the user exit variables to change?   I am aware of note 1064273 but this doesn't seem to help in these circumstances.
    Example:
    My Bex Query uses OI_FYPER for a static characteristic selection and  I have defined a customer exit formula variable which uses the values in OI_FYPER.
    All works fine when the query is run first time but if the user calls up the variable screen to change the selection and re-run the query, the customer exit formula variable is not re-calculated (customer exit is called but only with ISTEP = 3).
    Software version is NS2004S (BI 7.0)  SPS10, BI ABAP SP11, BI JAVA SP10, BI Front End Package 1401 rel 354.

    hi.. i just came to know about this in another thread..
    I_STEP 3 does not have I_VNAM stored. So, to access values at I_STEP3 :
    data: l_range TYPE RRS0_S_VAR_RANGE.
    if I_STEP = '3'.
    read table I_T_VAR_RANGE into L_RANGE with key VNAM = 'OI_FYPER'
    if SY-SUBRC = 0.
    ...code as required...
    endif.
    endif.
    Customer-Exit for analysis Authorizations: i_step = 3, i_vnam is empty

  • Populate user exit Variable with User Authorizations using ABAP?

    Hi, Does anyone know of a way to populate a user exit variable (with ABAP) with the Authorization Values for a user running a report?  I am turning off authorizations for our InfoProvider using RSSM and want to populate a variable instead and use the variable as a filter.

    Hi Kenneth ,
    You need dynamic authorization in your report .This can be done at query runtime by using exit variable and writing cmod code for the same .
    This code will read authorization maintained at runtime of query in i_step = 1 and will pass input var values accordingly .
    For step by step information you can access this document .
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0f9f33c-0f17-2d10-d3a2-ae52ccd00780?quicklink=index&overridelayout=true
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

  • User exit asking for access key in CMOD

    Hi Experts,
    I am trying to write source code for an user exit in CMOD by creating a project and assigning enhancement to it.
    When i click on user exit and press change it asks for access key .
    Can you please tell me if there is any other way to write source code inside it ?

    Hi Martina,
    Kindly go through this link below ,there few steps present to work on user exits:
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    Hope it helps
    Regrds
    Mansi

  • BEX User exit variables in WEBI

    Hi Experts,
    Need your help please.
    I have a report in BEX with a user exit variable wich depends on other manual input variable.
    In BEX it works properly but in WEBI it doesn't recognize the user exit variable.
    It displays the error message: Not possible to determine the value for ZPD_YEAR_DAY variable
    Error in DB.​ ​Error message is​:​ ​failure to execute the query ​M​D​X​ ​S​E​L​E​C​T​ ​ ​{​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​F​E​O​H​J​3​T​3​2​H​4​Q​D​Z​4​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​D​H​9​K​1​N​I​T​C​Z​E​4​U​Y​3​J​4​U​A​E​T​Z​4​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​D​H​9​K​1​N​I​T​D​R​2​R​6​P​F​2​K​G​C​U​8​8​W​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​E​M​Z​V​7​C​H​J​M​V​2​A​Z​P​C​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​K​0​S​7​H​N​Q​B​O​5​J​A​R​L​S​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​G​6​D​3​U​V​4​M​I​3​7​5​S​8​W​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​H​P​Q​C​I​D​R​P​D​B​C​0​K​S​G​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​C​S​1​W​7​F​A​8​I​H​E​Y​U​5​3​8​S​X​E​F​Z​2​8​]​,​ ​[​M​e​a​s​u​r​e​s​]​.​[​D​9​D​H​2​8​D​W​V​F​6​7​4​2​E​6​4​Z​O​L​8​F​X​3​4​]​ ​}​ ​ ​O​N​ ​C​O​L​U​M​N​S​ ​,​ ​N​O​N​ ​E​M​P​T​Y​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​C​R​O​S​S​J​O​I​N​(​ ​ ​{​ ​[​0​C​A​L​Y​E​A​R​]​.​[​2​0​1​0​]​ ​}​ ​,​ ​ ​{​ ​[​0​H​A​P​_​D​O​C​_​I​D​_​_​Z​A​P​_​S​U​B​S​T​]​.​[​5​0​]​,​ ​[​0​H​A​P​_​D​O​C​_​I​D​_​_​Z​A​P​_​S​U​B​S​T​]​.​[​7​0​]​ ​}​ ​ ​)​,​ ​[​0​I​N​F​O​P​R​O​V​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​[​Z​D​A​T​E​_​A​T​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​ ​{​ ​[​Z​C​P​M​]​.​[​X​]​ ​}​ ​ ​)​,​ ​[​Z​P​R​O​M​O​C​A​O​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​[​Z​R​E​S​P​_​A​V​L​_​_​Z​N​I​V​_​C​A​R​R​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​[​Z​R​E​S​P​_​A​V​L​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​[​Z​N​I​V​_​C​A​R​R​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​,​ ​[​0​E​M​P​L​O​Y​E​E​]​.​[​L​E​V​E​L​0​1​]​.​M​E​M​B​E​R​S​ ​)​ ​D​I​M​E​N​S​I​O​N​ ​P​R​O​P​E​R​T​I​E​S​ ​M​E​M​B​E​R​_​N​A​M​E​,​ ​M​E​M​B​E​R​_​C​A​P​T​I​O​N​,​ ​[​0​E​M​P​L​O​Y​E​E​]​.​[​2​0​E​M​P​L​O​Y​E​E​]​,​ ​[​0​E​M​P​L​O​Y​E​E​]​.​[​4​0​E​M​P​L​O​Y​E​E​]​,​ ​[​0​H​A​P​_​D​O​C​_​I​D​_​_​Z​A​P​_​S​U​B​S​T​]​.​[​2​0​H​A​P​_​D​O​C​_​I​D​_​_​Z​A​P​_​S​U​B​S​T​]​,​ ​[​Z​R​E​S​P​_​A​V​L​]​.​[​2​Z​R​E​S​P​_​A​V​L​]​ ​O​N​ ​R​O​W​S​ ​F​R​O​M​ ​[​Z​A​V​D​P​_​M​0​1​/​Z​P​D​_​G​P​S​_​V​A​R​I​A​V​E​L​_​0​0​2​]​ ​ ​with error:​ Not possible to determine the value for ZPD_YEAR_DAY variable​.​ ​(​W​I​S​ ​1​0​9​0​1​)
    This ZPD_YEAR_DAY variable​ is the user exit variable.
    Thanks in advance,
    José Simões

    Hi!
    I am following up to this post to see if there is something I am missing.
    We have bex query with user exit variable and webi bi4sp04.4
    In bex the user exit variable works correctly, in webi, it is ignored  (the webi results are not filtered as they are in bex web results)
    I have tried moving the variable to the char restrictions and removed ready for input - so there are now no prompts in bex query.
    I have reviewed note 1611185 as well as other info on restrictions of BICS and webi, but cannot find a clear answer if bex user exit variables are supported in BI4 clients or not.
    Lee Lewis

  • Need help with transporting User Exit Variable in CMOD ZXRSRU01

    Hello Gurus.,
                      I changed the existing user exit variable in CMOD ZXRSRU01.,before changing neither it ask for any transport request,  nor when I activated the include program .
    Well., I tried this........I went to goto-> Object Directory Entry.,
    changed the Package and person responsible for and then it asked for transport request...but this dint work...
    Now., how can I capture the changes in a transport request, so that, i can move the changes to production system?
    is there anyway to solve my problem?
    Regards,
    PNK

    Thanks for ur help VIKRAM...i solved the issue...the changes are captured in someother request, but it was not showing in the Version Management.'
    I checked the Lock Overview in the Object DIrectory Entry and found out that it was capturing in different request. I released the request and when I tried to change the code, it asked for new transport request.
    It worked..
    Thanks for your help..
    Regards,
    PNK

  • Value for user-exit variable  is invalid

    Hi Gurus,
    My Value for a Fiscal Year Prd returns a invalid value for the 12th month of each year( for Example 12/2004, returns the error "Value 200313 for User-exit variable is invalid.
    This is the code that is being used.
    *Rolling 12 months for entered month
    when 'ZCALM12'.
          clear: v_mth, v_yr.
          REFRESH E_T_RANGE.
          CLEAR L_S_RANGE.
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
                   WHERE VNAM = 'ZCALMON'.
            exit.
          endloop.
          v_yr = LOC_VAR_RANGE-LOW+0(4) - 1.
          v_mth = LOC_VAR_RANGE-LOW+4(2) + 1.
          L_S_RANGE-SIGN = 'I'.
          L_S_RANGE-OPT = 'BT'.
          concatenate v_yr v_mth into L_S_RANGE-LOW.
          L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.
          APPEND L_S_RANGE TO E_T_RANGE.
    Thanks in Advance.

    Hi Ravi,
    when 'ZCALM12'.
    clear: v_mth, v_yr.
    REFRESH E_T_RANGE.
    CLEAR L_S_RANGE.
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZCALMON'.
    exit.
    endloop.
    <b>-->> Here, you are not checking any thing.</b> <i>On which logic you are reducing year by one and increasing month by 1..?</i>
    v_yr = LOC_VAR_RANGE-LOW+0(4) - 1.
    v_mth = LOC_VAR_RANGE-LOW+4(2) + 1.
    -->><i>IF month is 200512 you will get output from above code is :</i> please check.
    v_yr = 2005 - 1 = 2004
    v_mth = 12 +1 = 13.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    concatenate v_yr v_mth into L_S_RANGE-LOW.
    L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.
    APPEND L_S_RANGE TO E_T_RANGE.
    Try to debug the code by keeping break point after When. and execute the report, you will be debugging mode.
    Hope it Helps
    Srini

  • How to create an user input variable for customer exit variable? - BW3.5

    Hi Guru,
    I have a requirement for the selection period of my reports. There are 3 possible reporting periods which should be user selectable:
    1. Month: Current reporting month
    2. Fiscal Year to Date
    3. Project Year to Date
    Here I need 2 variable to do these, 1 customer exit and 1 user input variable. I have created a variable customer exit to calculate all these requirement. But can any1 tell on how to create the user input variable for my customer exit? I need a user input variable with drop down list like below.
    01-Current month
    02- Fiscal Year to Date
    03-Project Year to Date
    I have create a new master data for this variable, but it's not working. What I need now is a standalone master data which do not need to link to any exiting records. Can any1 tell me how to create this?

    Just go to the definition of the variable for which you have created a customer exit. There you will find a check box for "Ready for Input". Just tick that checkbox and the variable will be available as a selection variable in the reports selection screen.
    Regards,
    Yogesh

  • ABAP help in user exit variables

    Hi,
    In the selection screen of a query, I have an optional variable CalenderMonth (SOMONTH). I have to calculate another user exit variable (CALMONTH) in ZXRSRU01 by using this SOMONTH. This is how. If the value SOMONTH is entered, then I need to assign SOMONTH to CALMONTH. If SOMONTH is not entered, then I need to set CLAMONTH to current calender month from system date.
    For that, I need to check if SOMONTH is entered or not in the program ZXRSRU01. This is what I am trying to do, and is not working.
    WHEN 'CALMONTH'.
        If I_step = 2.
          Loop at I_T_VAR_RANGE into LOC_VAR_RANGE
                 Where VNAM = 'SO_MONTH'.
           IF LOC_VAR_RANGE-LOW IS INITIAL.
            ELSE
           ENDIF.
    <b>PROBLEM:</b> The statement "IF LOC_VAR_RANGE-LOW IS INITIAL." is not working. When I try to debug the code, program aborts at that line. By this line of code, I mean to check if SOMONTH is initial or not.
    Any suggestions or ideas very much appreciated.
    Thanks alot
    John

    Hi
    When I have tried something similar to this (in BW v3.1), and the (optional) variable I am reading from is not populated by the user; in STEP 2 table I_T_VAR_RANGE does not contain a record for it. Hence, the logic I would use is:
    CASE I_VAM.
    WHEN 'CALMONTH'.
      IF I_STEP = 2.
        READ TABLE i_t_var_range INTO loc_var_range
        WITH KEY vnam = 'SOMONTH'.
        IF SY-SUBRC = 0.
          loc_range-low = loc_var_range-low.
        ELSE.
          loc_range-low = sy-datum+4(2).
        ENDIF.
        loc_range-sign  = 'I'.
        loc_range-opt   = 'EQ'.
        APPEND loc_range TO e_t_range.
       ENDIF.
    Hope this helps.

Maybe you are looking for

  • Data from Table to Backend

    Hi Guys I want to insert data from a Table( in a View ) to R3.. Though data is getting inserted but only one Row... I want all the Rows to be inserted.. Plz help...

  • Using an external hard drive to store music

    Hey, i am using an iMac G5 and just installed leopard. i also bought an external hard drive so i can use time machine. I also hoped to put my music files on my external HD so it would take up less HD space on the iMac. My question is, is it possible

  • Radeonhd and Audiohd on Solaris 10 (x86)

    This is getting rediculous. We have have several X86 boxes now, some almost 2 years old, that are not properly supported now by Solaris 10. What ever happened to the Sun concept of backporting important stuff from the next release to the current rele

  • How do i delete even or odd fields ?

    hi i am interested to see how my dv pal footage would look like when only even fields or odd fields are playing. couldn't find a filter and making a mask (in photoshop) of hundreds of one pixel width lines seems too much of a hassle. any ideas? thank

  • Blank rows on page after header but before body?

    I've got a "blank row" at the top of my pages using a certain page template. From the template, my header is : <html lang="&BROWSER_LANGUAGE."> <head>#HEAD#<title>#TITLE#</title> <link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_9/theme.css" ty