Variables in CMOD??
I have a situation where I need to execute the query without including company code and variable defined on it. I have to filter the value in the CMOD globally and pass that value to the query so that it displays the data only for that company code. This is related to authorization and below is the code implemented but somehow I am unable to get the desired result.
How to execute a bex report without providing the input variable. Variable should fill dynamically in CMOD. How to fill a variable at runtime in CMOD for Bex report. Here in my below case i want to display a data only relavant to XYZ company and xyz input fill at run time...
Please go through the code and suggest any changes needed.
data : LV_COMP1(255) TYPE c.
LV_COMP1 = 'XYZ'.
IF i_step = 1.
CLEAR: lwa_var_rng,
lwa_range.
lwa_range-low = LV_COMP1.
lwa_range-sign = 'I'.
lwa_range-opt = 'BT'.
APPEND lwa_range TO e_t_range.
CLEAR lwa_range.
ENDIF.
CASE i_vnam.
Hi,
you need not display the company code in the report output. just include it in the filter section of the query , then create a variable and make it "not available for manual input" and use istep=2 for coding in CMOD for that variable.
ELSE.
you can create a report program and use FM to run the query. this will give you output in an internal table . filter the internal table for the company code and provide the output in a .txt file and store it on application server.
i don't think SAP has provided any user-exit after the report output has been determined.So, changing a report output is not a possibility here other than using variables.
Also, one more suggestion. do not hard code the company code value in the CMOD code or wherever. either get the authorised company code using a FM to get authorised company code using the user name OR create a custom transparent table to store the comany codes against relvant user ids and select the company code from the table .
Regards,
Neeraj.
Similar Messages
-
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,
PNKThanks 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 -
Hi SDN,
I asked this question last week but did not get a straight answer, so I am trying again. Please do not refer me to PDF's on 'How to create Customer Exit variable', that is not the issue. Following is the problem.
User enters a value in a User Entry type variable. We use that value to create a new set of restrictions using CMOD/Customer Exit. However, we then want the value in the first variable to go away or become ineffective.
Or does anyone know the actual run time structure where OLAP keeps the variable values after step 2 so we could changes there?
Thanks.
SMSurely, you can just delete the value of the 1st variable, or remove it from teh variable table.
You could do this in i_step = 2, once you have computed the value of your new variable
Inside CMOD, the variables are all stored within i_t_var_range. I don't see why you can't just loop at that table until you find your 1st variable, then delete it from that table.
If you can't delete, then loop through the table, and check each line. If the variable in question is not your 1st one, then add it to a temp table. Continue till all records have been evaluated, then refresh i_t_var_range and move the contents of the temp table into i_t_var_range.
Cheers,
Andrew -
How to read variable in CMOD code !
Experts,
in my one of the query, there is a variable, which takes 2 dates. so the variable is type "interval"
so, when you run the report, user needs to enter value something like this.."mm/dd/yyyy - mm/dd/yyyy"
Now, i have writtn a code in CMOD, by reading this variable.
But i dont know how to read 2nd date from the variable.
READ TABLE i_t_var_range
WITH KEY vnam = 'VARIABLE'
INTO l_var_range.
First Date = l_var_range-low.
Second Date = l_var_range-high.
Does this low and high thing is correct?
if i do debug, i could see the low values. but i coud see the same low values in High too.
whats the problem ?
please helpHi ,
There are some scenarios for using CMOD, for variables in report.
And as per I understand for you issue, please find my comments
Scenario : You want to use the values enter by user in some other variable in the same report.
Please make sure that properties of both the variables are same.
Use below code:
DATA: l_s_range TYPE rsr_s_rangesid.
DATA: loc_var_range LIKE rrrangeexit.
WHEN 'New Variale'.
IF i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = 'Varaible in which user has entered value'.
CLEAR l_s_range.
l_s_range-low = loc_var_range-low .
l_s_range-high = loc_var_range-high .
APPEND l_s_range TO e_t_range.
ENDLOOP.
ENDIF.
Thanks
Mayank
Edited by: Mayank Chauhan on Feb 8, 2011 11:45 AM
Edited by: Mayank Chauhan on Feb 8, 2011 11:46 AM
Edited by: Mayank Chauhan on Feb 8, 2011 11:47 AM -
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 advanceHi,
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 -
Sequence of variables triggered while running a query
Hi All,
Can anyone please let me know the sequence with which the (Customer exit) variables in CMOD are executed.
I mean in the Processing step 2 where we have a statement
Case Varnam what is the varaible sequence which enters into this statement.
Regards
GaneshMy actual issue is :
We have 2 queries
1. First query speaks about sales Actual vs Planned
and in this query we have the KF retricted by time period(Customer exit var) & 0INFOPROV(Customer exit var).
2.Second speaks about Profits for Actuals Vs Planned
and in this query also we have the KF retricted by time period(Customer exit var) & 0INFOPROV(Customer exit var).
when we execute query 1(In Debug mode in CMOD under the Processing step 2 I can find that the CASE I_VARNAM catches first the Time period and then for 0INFOPROV but when I run query 2 exactly the vice versa happens i.e the varname first catches for 0INFOPROV n then for Time period. So I just want to know how is the sequence of this customer exit variables defined/cached in CMOD under Processing step 2 maintained.
Please can any one let me know the solution at the earliest -
About variables in query designer
what is the difference between replacement path and cmod in query designer?
illustrate with an example?
Regards,
Bhavya KHi,
Replacement path:
When you create a variable ,if you want the variable to be replaced with the value from an info object/another variable /Query/Hierarchy then we select Replacement path
CMOD:
If the values for the variable are to be collected based on the ABAP logic written for the variable in CMOD then we go for CMOD selection.
Refer the links for examples:
http://www.sapks.com/2010/04/replacement-path-in-variable-reporting.html
http://help.sap.com/saphelp_nw04/helpdata/en/2c/78a03c1178ad2ce10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/03/6ba03cc24efd1de10000000a114084/content.htm
Refer to this link for scenarios on Cmod from Mr.Surendar reddy
http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
@ Sri
Edited by: Sri kamesh on Mar 2, 2012 7:30 PM -
Dynamic variable in Bex Broadcaster
We have a mandatory variable as 'Date' in the report. While creating the variant in Bex Broadcaster for sending mails daily - the date gets saved & remains constant. We need the date to be changed dynamically everyday when the mail is sent.
I would like to know how should I achieve this. Thanks. Helpful ans will be appreciated.Hi,
You would need to create the Date variable as Customer Exit.
Populate the Date variable in CMOD by sy-datum or other logic, if u need. This will fix ur issue.
Steps: 1. Make the Mandatory (existing variable) to Customer Exit
2. Choose "Variable can be Input-Ready"
3. Write your code in CMOD for I_STEP = 1 to populate the sy-datum
If you do this, your existing variable will still be Mandatory, except the default value which will be shown in that is Current Date (Sy-datum). This should resolve your probs.
Regards,
Chathia.
Edited by: Chathia_P on Feb 18, 2010 12:05 PM -
Variable Selection- urgent please
Hey Guys
I am really stuck here; please help me out.
I have 5 cost objects like cost center, wbs element, internal order etc. and in the report each on them I made a variable because user should be able to pick any values for any one of them. But at the same time the user should select at least one. So how do i do that because I can't make all mandatory or even one mandatory and that's why they are all optional but then the user can miss all of them and the report will run for all of them(which would be forever). Is there a way to enforce at least one of them.
I will assign full points right away.
ThanksHi Mark,
In user exit for variables (TC CMOD) you can trigger a return
to variable input at event I_Step = 3.
This is processed once per query, raises a message and returns to variable screen. You just have to check values
of variables for at least one entry.
Hope this jelps
Joe -
Dear Friends,
I have a performance related question.
We need to develop a report in which Sum of top 5 materials based on delivery quantity has to be displayed monthwise.
Eg: If in January Materials M1 M2 M5 M6 M7 are top 5 in delivery quantity, then the sum of their delivery quantity.
If in Feb Materials M2 M3 M5 M8 M9 are top 5 in delivery quantity, then the sum of their delivery quantity.
and so on till December.
I thought of using condition TOP N on delivery quantity in Bex query. (Pls correct me if i am wrong)
Problem: Top N will work only for one month in a single query. It cant work for different month (different top 5 materials)
Solution Proposed:
1. Make 12 different queries, one for each month (using Top N) and put each result in a workbook.
2. 12 different CMOD variables and cmod code picksup top 5 materials for each month and put in each variables of respective months. Restrict using these cmod variables for respective columns.
So I wanted your valuable suggestions which of the above method will be of good performance (considering maintenance, etc factors) and the reason also.
Approximate number of records 1 lakh per year.
Kindly give ur suggestions.
Thanks,
GuruHi
I think I hv answered this in some other thread. Pl close this thread.
Cheers
Umesh -
Retrieve values of other exit variable
hi gurus
i have to build an input ready query where on rows u have:
funds center cost center profit center account
and on columns:
0fiscper3
0amount
the user enter on the variable screen this:
0comp_code
0fiscyear
funds center
currency
0account
So just using the funds center I have to show cost center (matched with funds center on a Z Characteristic that I ve created) and the profit center for every costcenter (consulting 0costcenter on 0profit_ctr attribute).... I m using 2 exit variables on cmod ( one for getting costcenter and other for getting profit center), but when i have to feed profit center variables I have to retrieve the values for costcenter that were got for this variable... but how can I do this? Can I retrieve the values of other exit variable when filling profit center variable?
By the way I can use relation characteristic over this infocube because there already is an abap program that makes some logic over this infocube.
some suggest? point will be assigned
regardshi Ashish Tewari :
That s the way I was doing...
in ur example, are u considering 'ZCOST_CTR' as other exit variable? Because it s an exit variable that I fill through funds center variable whis user input...
If its not, what do u suggest?
here s my code, it works but it match every costcenter with all profit centers , which is wrong, every costcenter hast just 1 profit center...
** VARIABLE FOR 0costcenter
WHEN 'ZECCVAR045'.
IF i_step = '2'.
READ TABLE i_t_var_range INTO l_s_var_range WITH KEY vnam = 'ZECCGE001'.*this variables contains funds center
centro_gestor = l_s_var_range-low.
SELECT * INTO TABLE it_cenges_ceco
FROM /BIC/MZECFM012
WHERE objvers = 'A'
AND funds_ctr = centro_gestor.
LOOP AT it_cenges_ceco INTO ls_cenges_ceco.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = ls_cenges_ceco-/BIC/ZECFM012.
APPEND l_s_range TO e_t_range.
ENDLOOP.
ENDIF.
** VARIABLE for profit center for each cost center
WHEN 'ZECCBE010'.
IF i_step = '2'.
BREAK-POINT.
CLEAR it_cenges_ceco.
CLEAR ls_cenges_ceco.
CLEAR centro_gestor.
READ TABLE i_t_var_range INTO l_s_var_range WITH KEY vnam = 'ZECCGE001'.
centro_gestor = l_s_var_range-low.
SELECT * INTO TABLE it_cenges_ceco
FROM /BIC/MZECFM012
WHERE objvers = 'A'
AND funds_ctr = centro_gestor.
LOOP AT it_cenges_ceco INTO ls_cenges_ceco.
CLEAR ls_ceco.
ceco = ls_cenges_ceco-/BIC/ZECFM012.
SELECT SINGLE * INTO ls_ceco
FROM /BI0/MCOSTCENTER
WHERE objvers = 'A'
AND costcenter = ceco
AND dateto = '99991231'.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = ls_ceco-PROFIT_CTR.
APPEND l_s_range TO e_t_range.
ENDLOOP.
* BREAK-POINT.
ENDIF.
ENDCASE. -
To Supress variable screen in WAD - variable used in customer exit
Hi All,
We have a requirement to supress variable screen with WAD 7.0, but the report on which we have built the WAD contains a variable which is used to calculate quaterly utilization in customer exit and ready for input.
So as there is a variable in CMOD and used in report level, eventhough we supress variable screen in WAD, not getting supressed.
Can you provide some pointers.
Thanks,
Sri Arun PrianHi Arun.
Can you please tell me, is the variable entry mandatory? If yes please make the variable entry is optional.
Regards,
Lokanatha. -
Customer exit - code for variable
Hi Friends,
I have created a variable "CUST_EXIT_YEST" and defined the processing type as customer exit. Now would like to add code in CMOD.
Requirement: The variable should allow take yesterday's date. Please help me with the code.
Already there are some codes defined for other customer exit variables in CMOD. Can I add my code below that. If so please explain.
Regards,
SurjitIf i'm not wrong you want to show previous day in the variable.
At the bottom of the existing code before EndCase, u can write the below code
Data: loc_var_range LIKE rrrangeexit, (must be there this kind of declaration in ur existing code)
WHEN 'CUST_EXIT_YEST'.
IF I_STEP = '1'.
Read Table I_T_VAR_RANGE into LOC_VAR_RANGE WITH KEY VNAM = 'CUST_EXIT_YEST'.
myrange-SIGN = 'I'.
myrange-OPT = 'EQ'.
myrange-LOW = sy-datum - 1.
APPEND myrange TO e_t_range.
ENDIF. -
Hi Experts,
I have written the below customer exit (variable) in CMOD that show all the entries < Sys Date......
But i need to enhance it to include entried < Sys Date and Entries with no date date value (not assigned ,#)
Please update me how to proceed further
WHEN 'ZV_XXX'. "
IF i_step = 2.
CLEAR l_s_range.
l_s_range-low = sy-datum.
l_s_range-sign = 'I'.
l_s_range-opt = 'LT'.
APPEND l_s_range TO e_t_range.
ENDIF.Resolved myself
-
When writing the code for user exit variables in CMOD, does the order in which they are calculated matter? Here is what I am doing. i use a exit to get previous calendar month from system date, and from that variable i use another exit to get the year. So is it necessary that the code for previous month comes before the code for year?
Hi Uday,
That does not matter...the execution will search for the name of the variable and then execute the code.
Hope this helps...
Maybe you are looking for
-
SQL to show a given users rights in the various hyperion modules
Hi All, We need to create a Business Objects security report to outline the User access in HFM ,Essbase and Planning . We can't use the Hyperion Security report , since we use the BO report to mointor user access across all applications we have. I ne
-
Printing to PostScript - Clean7Bit or Binary
When we "print" an .indd document to PostScript using InDesign CS3 (desktop version), the resulting file's DataDefinition is always set to Clean7Bit. However, when we call the Java InDesign Server API (using InDesign Server CS3) to print to PostScrip
-
Abstract classes and constructors - cannot call abs. methods in CONSTRUCTOR
Let me explain the scenario: I'm building a program in which I need to read a file (among other things) and I intend to use object orientation to it's fullest in doing so. I thought of creating an abstract FILE class which has the commonalities, and
-
Dear Experts, I want to change the time portion of a date in forms6i through pl/sql, but its not changing correctly. I have tried many options but failed existing value = 18-FEB-2011 09:32:30. I want to fix it as 18-FEB-2011 08:00:00 through a trigge
-
Integrating mutiple forms into one form using tab canvas
Hi everyone, I'm relatively new to Forms 6.0 and also to this discussion. Could somebody please explain the pros/cons while integrating 8 maintenance forms into one form(Each page in the tab canvas representing one form)? Any help will be greatly app