Exit Variable encapsulation using ABAP OO
Hi,
As you know standard way of development of exit variables is to isert ABAP code directy in main include of the exit.
However with a big number of exits and serveral teams working in parallel, this is not a good practice. I've herad about projects using ABAP OO to encapsulate and isolate code of every exit.
Do you have an experience with usiage of ABAP OO to code exits? Could you provide structure you use (e.g. one class for all exits with different mentods, one class for every exit etc.) with some code samples?
BTW - yes, I have read the blog /people/ed.herrmann/blog/2007/01/16/simplify-your-bw-enhancements-for-global-reporting-variables and appreciate work of its author, but this is not enough for me - I cannot import in the system custom code that I do not know what is exactly doing. I preffer to undestand better whole concept. Especially when it requires download and installation of some SAPlink plugins
Thanks in advance,
Marcin
Hi Marcin,
In the internet you can find some recommendations to modularize the code using an ABAP OO class
(e.g.http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/40ef17ee-3833-2c10-fc96-cd4a421b7e95&overridelayout=true ).
Nevertheless it is more convenient to use the following code for this issue. It allows the creation of
several function groups to support splitting the variables for different applications/projects into
different function groups. This allows to group variables together in different function groups and has the benefit that not every developer is affected e.g. by a syntax error in the class or include.
<pre>
====== include ZXRSRU01 ================
Matthias Nutt
Call a function module which does the work
CONCATENATE 'Z_BWVAR_' i_vnam INTO l_funcname.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = l_funcname
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION l_funcname
EXPORTING
i_vnam = i_vnam
i_vartyp = i_vartyp
i_iobjnm = i_iobjnm
i_s_cob_pro = i_s_cob_pro
i_s_rkb1d = i_s_rkb1d
i_periv = i_periv
i_t_var_range = i_t_var_range
i_step = i_step
IMPORTING
e_t_range = e_t_range
e_meeht = e_meeht
e_mefac = e_mefac
e_waers = e_waers
e_whfac = e_whfac
CHANGING
c_s_customer = c_s_customer.
ELSE.
variable is not implemented -> error
ENDIF
========= include ZXRSRU01 ===========
</pre>
Regards Matthias
Similar Messages
-
How to identify what customer exit variables are used in which query?
Hi all,
When i happened to check the CMOD transaction code i can find a list of customer exits are used. But i want to know what are those customer exist are used in which query? can anyone let me know the procedure of identifying it.
Thanks a lot
Poojahii pooja
check the foll links
Very Urgent: Customer Exit Variable
customer exit variable
MIssing Authorisation for customer exit variable query
Authorization variable or customer exit variables
if it is helpful assign points
thanks. -
SAP Exit Variables changes using FM RREX_VARIABLE_EXIT
Hi BW Group:
I am trying to made some modifications on Dates fields and for that I created variables as SAP Exit.
In the code of the standard FM RREX_VARIABLE_EXIT appear a part to include the code for the new variables as RSVAREXIT_XXX_YYY.
Does any one in the group use a SAP Exit variable before? Do you need to code in this FM?
Thanks in advance.
NorgeHi,
Please chk this URL , hope it may help u .
http://help.sap.com/saphelp_bw21c/helpdata/en/f1/0a56a7e09411d2acb90000e829fbfe/content.htm -
Ipak variable selection using ABAP
Hi All
I am trying to set the value of a selection variable in an Ipak using ABAP using the following code
l_t_range-low = datetime.
l_t_range-sign = 'I'.
l_t_range-option = 'GT'.
I need to extract records with a timestamp greater than the value set in l_t_range-low.
However I get the error message
For sel. Field 'xxxxxxx', No selection with SIGN='I', OPTION 'GT' allowed.
I could use BETWEEN as a workaround but is there anything obviously wrong with the above code.
Thanx in advance
AsifHi Asif,
In our case we had a requirement to load the data for the transactions occuring in the last 15 days only, so we have write the routine on the last modified date feild in the infopackage.so as to select only records modified or created in the last 15 days..
attached is the sample code....
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'LAST_MODIFIED_DA'.
l_idx = sy-tabix.
data : w_cdate type d .
l_idx = sy-tabix.
w_cdate = sy-datum.
w_cdate = w_cdate - 15 .
L_t_RANGE-LOW = w_cdate .
L_t_RANGE-HIGH = sy-datum .
L_t_RANGE-SIGN = 'I'.
L_t_RANGE-OPTION = 'BT'.
append l_t_range.
modify l_t_range index l_idx.
p_subrc = 0.
Hope it helps...
-Vikram -
Abap code for sap exit variables?
Hi,
i) Where can I find the abap code for SAP exit variables
OP_KEYDT used for the net due date
OP_KEYD2 used for the posting date
OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
How do we acheive that.
Thanks.Please tell how u solved ur issue i have the same scenario to be do.
-
Current Workday SAP EXIT variable not aligned with correct work days
Hello,
I am trying to use the Current Workday variable within a report so that the data will only be refreshed when the calendar day is Monday - Friday. Users look at this report every day, but when they get the report on Monday we would like for the date to be restricted to the previous Friday, and then switch back to Monday's date when they view the report on Tuesday. In order to do this we have placed the Current Workday variable from the Calendar Date characteristic with an offset of negative 1, but it is showing Sunday's date when they look at the report on Monday.
My questions are:
-Does this variable use the factory calendar that can define the work days?
-If so, which Factory calendar does it use? I have gone to the Tcode SCAL but I can see there are many different factory calendars and I have no idea which calendar this variable pertains to. I have also transferred the global settings for the factory calendar from the source system, and I see no change within the variable.
-How can I see the program name behind this SAP Exit variable? My thinking is that I could at least look at the code to see if perhaps I can find out the factory calendar ID the variable refers to from there.
Any help on this would be greatly appreciated! Until this is fixed I have to manually adjust this report every Monday and Tuesday morning!! Not ideal.Hi Kelly,
I am not sure whether this can be done by an SAP Exit variable.
But you may try this using a Customer exit variable by using the Function module DATE_COMPUTE_DAY.
The function module "DATE_COMPUTE_DAY" will return the day by 1 to 7 when you input date.
Monday : System will return value = 1
Tuesday : System will return value = 2
Wednesday : System will return value = 3
Thursday : System will return value = 4
Friday : System will return value = 5
Saturday : System will return value = 6
Sunday : System will return value = 7
So input sy-datum to this FM and find the number of day. If it is Monday, the number will be 1.
If output is 1, then offset date by -3 to that of Friday, else offset by -1 to previous day.
Hope this helps,
Regards,
Hari -
hi Experts
i have a requirements of implementing Exit variables in my Bw report for Last 6 Months, Last 12 Months, Next 6 months and Last year.i am not Expert in writing exit variables and in ABAP, what ever i try it is giving many errors.
Can someone please help me with the code if you have for these Exit variables.
Regards
SruthiHi Sruthi reddy
In the SE38 transaction edit the following include: ZXRSRU01 (if it doesn't exist you'll have to create a new project but this is other problem)
It's probable that part of this code already exists in your system.
DATA: l_s_range TYPE rsr_s_rangesid.
DATA: f_date LIKE SY-DATUM.
DATA: t_date LIKE SY-DATUM.
CASE i_vnam.
WHEN 'ZLAST6MTH'.
IF i_STEP = 1.
t_date = SY-DATUM.
f_date = SY-DATUM - 180. "Of course this is NOT polite
l_s_range-low = f_date.
l_s_range-high = t_date.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDCASE.
Hope it helps.
Kindly regards.
Germán.-
Edited by: German Montero on Feb 27, 2008 9:46 AM -
BW customer-exit variable in WebItnelligence
Hi all.
Did anybody try to use BW customer-exit variables in WebI report. In documentstion I've found that this type of variable 'supported without user entry', what does it mean?
Thanks.Hi,
Yes, I have used BW queries in which a customer-exit variable was used and that works fine in WebI.
When you define variables in BW, there is a checkmark saying "Variable is ready for input", i.e. BW customer exit variables are only supported in BO, when this checkmark is not set (which means, that the user can not enter a value directly for the variable).
Best regards,
Jacob -
Can someone tell me what the exit below is doing. One of my confusions is what does the variable under the when (ZVAR_DIFF) clause
represent and why is it different for the Variable Name in the LOOP Where clause? Thanks
case i_VNAM.
when 'ZVAR_DIFF'.
DATA: L_S_RANGE TYPE RSR_S_RANGESID.
DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE into loc_var_range
WHERE VNAM = 'ZVAR_CUSEXIT'.
CLEAR L_S_RANGE.
If loc_var_range-high is initial.
L_S_RANGE-LOW = '1'.
Else.
L_S_RANGE-LOW = loc_var_range-high - loc_var_range-low.
endif.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.Hi,
its always restrciting the interval for the variable as 1.
So whatever is the user input...it gives the inteval where the low values is less then values eneterd by the user...So suppose user entered 2 then the variable will give 1-2 as output.
If user enters nothing then the value will be 1.
The code written in CMOD is checked everytime when a query is executed even if it uses the logic written here or not.
When you create a customer exit variable and use it in the query like 'ZVAR_DIFF'...system will look for the value of these variable when query is executed.
Thats where the when clause comes into action...the SAP program will come to this part of the code and when it matches the technical name of the exit variable then it executes the code written for it.
'ZVAR_CUSEXIT' can be a user input variable or any other kind of variable which contains some values.
Thanks
Ajeet -
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 -
Customer exit variables using the Table
Hi Experts,
I'm having the following scenario.
I have created the below table
OGVERSION Fiscal Year1 OGVERSION1 Fiscal Year2 OGVERSION2
001 0 100 -1 100
002 0 100 2 200
007 3 200 1 300
Now i need to create four customer exit varibles by using the OGversion value which is the variable by fillign with manula input. Here Fiscal year1 & Fiscalyear 2 fields having the values like 0,1,2,-1 means 0 --> Current Year, 1 --> CurrentYear +1 , 2 --> Current Yr +2, -2 --> Current Yr-2...like that.
Please let me know If anybody knows the ABAP for create these customer exit variables.
Regards,
Navin AchantaThanks for the reply. following is the code that is used in the exit.
does the code below affect the performance.
select FIELD1 from TABLE into table INT_TABLE
where TCTUSERNM = SY-UNAME.
if sy-subrc eq 0.
loop at INT_TABLE into WA_INT_TABLE.
l_s_range-LOW = WA_INT_TABLE-field1.
l_s_range-SIGN = 'I'.
l_s_range-OPT = 'EQ'.
append l_s_range to e_t_range.
endloop.
endif. -
Table look up using value from customer exit variable
I have a customer exit variable, CURRMON, which the user enters in the format MM/YYYY. From this entry, I would like to do the following to calculate and display the number of business days in the selected month:
Do the following to get Business Days in month.
Use the KF "FBA Day" (CTAFBAD) from the CTA_M01 infocube and write ABAP routine.
1. Based on user entry cal month get the last calendar day .
2. Do a master data look up (CTAFBAC is the master data object), using the last calendar day from step 1.
3. CTAFBAD is the attribute of CTAFBAC so move the value of CTAFBAD to the result, and display this result
Can anyone help me with this?Hello,
You can use i step = 1 in SMOD transaction and write the code there.
l_s_range-low = sy-uname.
append ls_range to e_t_range.
regds,
Shashank -
Code (ABAP) for the Customer Exit Variable (CMOD)
Scenario
An employee can purchase any no of policies in a day or month.each policy will have start date and expiry date.
My requirment
Count all the policies(valid) by employee on a ranges basis exception reporting
(0-10;10-20;20-30;30-40) and then able to drill down by policy start date and expiry date.
As per the requirment is to show policies that employee had with in the give date intreval which are not yet expired (active) i need to write a condition that will count only policies whose Expiry date is > Current calender day
As Policy Expiry Date is a char i am converting it to KF using fourmala variable so that i can write a condition on it using current cal day formula variable sap exit
Requirment:
Need a code for SAP exit variable which will meet the following requirment
There are the following 2 variables in the query
1) A variable (User Input)(Date Range) on Policy Start Date and
2) Authorisation Variable which is based on Authorisation Object(Analysis Authorisations)
I need a SAP Exit variable (CMOD) that will
BAsed on the user entered Policy Start date it has to pick all the policy exiry date of the policies and display all the policies whose expiry date is greate than Sy Date (Current Date) and also if Policy Expiry Date is blank or # it has to display
Arun supplied me with the below code...but i think it doesn't include blank expiry date or #...as i am new to ABAP please update me with releavent code
Policy Start Date : ZPST_DTE
Policy Expiry Date: ZPSP_DTE
Variable (Type:Customer Exit) on Expiry Date: ZEEXP_DTE
Arun's Code:
IF I_STEP = 1.
CASE V_NAME
WHEN 'X' " X is the variable u created for the exit
l_s_range-low = SY-DATUM.
l_s_range-opt = 'I'.
l_s_range-sign = 'GT'.
APPEND l_s_range TO e_t_range.
END CASE.
Please modify above code to include Blank or # values of Expiry Date
Thanks Arun
Please ask if you need further info as this is urgent
ThanksHi Arun,
Thanks for the help...will definetly assign points
(Closed the previous thread)
Please spare bit of ur time as this is my first ABAP Code
Can i include 2 restrictions..# and Variable (Customer Exit)...But how can i include Records with Blank Values
As the data from Source system the expiry date is filled up with either Date or # or Blank...my requiorment is to include all 3 and
Question:
As there are 2 other variables defined ..one on Policy Start Date (User input date intreval) and Location (Authorization Variable..Analysis Authorisations)...Do i need to change I_STEP in the code
(Req: Reports shows all the(still valid) policies emp has purchased between 2 give date (Variable on Policy Start date)
IF I_STEP = 1.
CASE V_NAME
WHEN 'X' " X is the variable u created for the exit
l_s_range-low = SY-DATUM.
l_s_range-opt = 'I'.
l_s_range-sign = 'GT'.
APPEND l_s_range TO e_t_range.
END CASE. -
Why we use customet exit variables?
hi friends,
why we use customer exit variables. can u give me some examples at what scenerio we use
default/user entry, formula, text, hierchies and hierchies. ( with processing type is customer exit)
can i get atleast 1 scenerio for 5 types variables?
Thanking u
suneel.Hi Suneel
Check info about Exits,
Replacement Path
You use the Replacement Path processing type to specify the value that automatically replaces the variable when you execute the query or Web application
check this link explains step by step
http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
Customer Exit:
If you need to use a processing type other than manual entry/default value, replacement path, SAP exit, or authorization, then a customer exit gives you the option of setting up a processing type for variables, tailor-made to your specific needs.
The customer exit is designed as an enhancement that you can configure with customer-specific logic
SAP Exit:
SAP exits are delivered content variables. Before creating any custom variable exit, its advisable to check if there are any SAP exits delivered to do the same functionality.
Check these links for SAP and Customer Exits,
To see SAP Exits -> Use Tcode SMOD
To See Customer Exits -> Use Tcode CMOD
There are projects to which Exits are assigned. Selects the relevant projects.
What is User Exit:
http://www.sap-img.com/abap/what-is-user-exits.htm
How to find then:
http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
All Exits List:
http://www.easymarketplace.de/userexit.php
Thanks,
Sudhakar. -
Using Formula Variable in Customer Exit variable
Hi,
I want to assign valuees of 2 Formula Variables to one cstomer exit variable based on some Characteristic.
Example. Formula variables are Early and Late. If Early = 3 and Late = 4 , I want to pass value to the Customer Exit variable as Low = 3 and High = 4.
The problem is in I_T_VAR_RANGE there is no value for formula variable in LOW field.
Other variables based on Characteristics have values in this field.
What can I do in this case?
Regards
SSSSSS,
You can restrict your characteristic with two variables in the value range options of restricting.
One can be used as low and the other can be high.
Hope that helps.
Thanks.
Maybe you are looking for
-
Indesign 2014 startup too slowly
Since June, Indesign 2014 has been opened too slowly at startup. I wait usually about 5 minutes and if it still isn't opened, shut it down at task manager and start again. At the second time the program usually opens faster (1-2 minutes). All this is
-
Table controlls in module pool programming
Hi all. I have an issue in module pool program. I created a table controll in the screen through table controll wizard. In that if I enter the data for 10 records(more than 1),then I(pressed)clicked on ENTER . then only first record is staying in the
-
Outlook Express address book to Entourage
Changing from a PC to a MacBook Pro - Is there any way I can export my PC Outlook Express address book to my MacBook Pro? I am using Entourage and would like to have my address book exported rather than having to type everything. Is this possible or
-
Trouble installing itunes 11.1
I have a iphone 5s and when i plug it into my imac to get music on my phone it tells me i need to update itunes to 11.1 version. Then when i got to download that or update it, then it tells i have to update my OS x from 10.5.8 to 10.6.8 or later but
-
Disco 4i Error 'This user requires Create Any Materialized View Sys Priv'
Hi, Firstly I will say we are late with moving to Disco 10g, fully understood and constantly remind people of need to upgrade. Oracle Apps 11i instance, we have upgraded the database 10g. In Disco 4i Admin, Import folder from Database, we receive Err