Customer Exit for BW Variables
Dear all,
I am a BW Consultant and have a very limited knowledge in ABAP. I have the following scenario:
My BW query has the following input variables:
0P_FYEAR Fiscal Year (Single Value Entry)
0P_PER3 Posting Period (Single Value Entry)
and the following text variables:
ZT_FYEAR (Text variable for Year)
ZT_PER3 (Text variable for Period)
ZT_CQTR (Text variable for Comparative Quarter)
Now, I need guidance to write ABAP code in CMOD that will achieve the following results:
1. Display last date of Period., e.g.:
- Return 31 to ZT_PER3, if January (Period 1) is selected from 0P_PER3.
- Return 28/29 to ZT_PER3, if February (Period 2) is selected from 0P_PER3.
2. Display as Period 12.
Display Period 13, Period 14, Period 15 & Period 16 as Period 12, e.g.:
- Return 12 to ZT_PER3, if Period 13 is selected from 0P_PER3. The same goes for Period 14, 15, & 16.
- Otherwise, return the same period to the text variable.
3. Quarter-to-date Comparison
- If Quarter 1 periods (Period 1, 2 or 3) and Year 2012 is selected from 0P_PER3 and 0P_FYEAR, return Quarter 4 to ZT_CQTR and Year 2011 to ZT_FYEAR.
- Otherwise, return previous quarter and same fiscal year to the text variables.
Would really appreciate your assistance.
Thanks!
Hi Fulham,
For point 3:
case 0P_PER3.
when '1' or '2' or '3'.
ZT_CQTR = '4'.
ZT_FYEAR = 0P_FYEAR - 1.
when '4' or '5' or '6'.
ZT_CQTR = '1'.
ZT_FYEAR = 0P_FYEAR.
when '7' or '8' or '9'.
ZT_CQTR = '2'.
ZT_FYEAR = 0P_FYEAR.
when '10' or '11' or '12'.
ZT_CQTR = '3'.
ZT_FYEAR = 0P_FYEAR.
endcase.
Hope This Helps.
Ernesto.
Similar Messages
-
How to Write a CUstomer Exit for a variable in BEx
Hi,
How to write a customer exit variable in bex Query designer
Do i need developers key for this (If so what type of key do i need so that i can ask basis tean to generate)
Info Object: ZEXP_DTE (Expiry Date)
Variable on ZEXP_DTE :
ZEDTE
Type: Customer Exit
Can any one please tell me how to write a code in CMOD from this (Step-by Step)
Expiry Date > Current Cal Day
As arun said
'l_s_range-low = SY-DATUM.
l_s_range-opt = 'I'.
l_s_range-sign = 'GT'.
APPEND l_s_range TO e_t_range.'
I want to insert the above code for the above customer exit but as i am new to BW as ABAP please explain me what are the steps involved in CMOD
ThanksHi,
To write customer exit for a variable, you require Access key.
Contact your BASIS to get that.
Access Key,BASIS?
To write Customer exit,
User Exits
User Exit for Variable
/thread/809285 [original link is broken]
Hope these helps u...
Regards,
KK. -
How to create customer exit for characteristic variables and for text vars.
hi friends,
can anybody tell me how to create customer exit for characteristic variables and for text variables in bw ides system.
thanks,
sreeHi,
Please have a look at:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
Krzys -
Customer exit for query variable to calculate amount since 1998
Hi Experts,
I am trying to fetch the expenses since 1998 till last fiscal year in Bex Query.
I have created a variable ZFYRVAR1, processing type customer exit, Interval, Mandatory. I unchecked 'Variable is ready for input' box. There is no 0CALYEAR in the infocube. We have 0FISCYEAR and 0FISCPER in the InfoCube.
We wrote following code to populate the variable. It is throwing a warning message.
Value " is too long for variable ZFYRVAR1.
The column remains empty and nothing is populated. Can somebody tell me whats wrong with the code. I also defined another variable instead of l_year. like
zyear like /bi0/pfiscyear-fiscyear. but same error.
Any help is appreciated.
data: l_s_range type rsr_s_rangesid.
data: l_year(4) type n.
case i_vnam.
l_year = sy-datum+0(4).
l_s_range-high = l_year - 1.
l_year = 1998.
l_s_range-low = l_year.
clear e_t_range.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
append l_s_range to e_t_range.
endcase.Hi Sheo,
Hope the sample code below helps you. You can debug it in RSRT to be sure.
DATA: L_S_RANGE TYPE rsr_r_rrrangesid.
DATA: l_yearh(4) type c,
l_yearl(4) type c.
IF I_STEP = '2'.
if i_vnam = 'ZFYRVAR1'.
*Please check your user profile to make sure l_year is in the format YYYYMMDD.
l_yearh = sy-datum(4).
l_yearh = l_yearh - 1.
l_yearl = '1998'.
l_s_range-high = l_yearh.
l_s_range-low = l_yearl.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
exit.
endif.
ENDIF. -
How to write customer exit for the variable
Hi Experts,
I have a requirement to create the variable, the scenaria is like this..
I need to create the variable which gives the period/year values,if yours enters the values 05.2007 then the variable should return the first monthe the year i.e.01.2007.
I hope it can be done by writing the customer exit..but iam unware how to achieve this.
Please explain me step by step and cope for customer exit to done this.
Points will be awarded
Suraj.hi Suraj,
there should variable sap exit for first month,
for customer exit, check this how to doc for steps
https://websmp210.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf
your code may look like
INCLUDE ZXRSRU01 *
DATA: L_S_RANGE TYPE RSR_S_RANGESID.
DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
CASE I_VNAM.
WHEN 'your 1st month variable'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'your user input variable'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(4)."low value, e.g.200001
L_S_RANGE-LOW+4(2) = '01'.
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. -
Migrating Customer exit for BEX variables to BADI's
Hi All,
I am new to ABAP In the context of BW.
I am using exit RSR00001 to populate variables in BEX reports.
I want to migrate this customer exit RSR00001 to BADI.
Can any one please tell me how to migrate the same and how it will fire in place of exit?
Thanks In Advance
DhananjayHi,
Please have a look at:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
Krzys -
Need help in writing code Customer Exit for reporting Variable
Hello Gurus,
I have a requirement.When a authorized user logins to view the report, he should see only customers available in the value help screen.In the value help screen it is displaying all the customers, but data is displayed perfectly fine for the authorized sales rep. By default, Value help screen displaying all the customer numbers.
How can I restrict in the value help screen?
Any help appreciated with points.
Regards,
PNKHello PNK,
You can use a variable with Process type Authorization. This enables variables to be filled with values automatically from the user authorization.
http://help.sap.com/saphelp_sem40bw/helpdata/EN/44/599b3c494d8e15e10000000a114084/content.htm
Thanks
Chandran -
Customer Exit for Formula Variable
Hi all, and thanks in advance for your help on this one.
I'm trying to run a function module to convert the value of a characteristic in my ODS to a formula variable. To do this, I've created a replacement path variable to hold the value of the characteristic, and then I'm passing this value to another module to convert it to factory date.
Here is my code ZTSTGIDT is the name of the replacement path variable that is set to equal the characteristic key value.
DATA: CONVERTDATE TYPE SYDATUM. " Date
DATA: FAC_DATE TYPE FACDATE. " Factory Date
DATA: ZE_T_RANGE TYPE RSR_T_RANGESID WITH HEADER LINE.
WHEN 'ZFACDY01'.
CLEAR: ZE_T_RANGE, E_T_RANGE.
* Get the Goods Issue date from the formula variable.
IF I_STEP = 2.
READ TABLE I_T_VAR_RANGE
WITH KEY VNAM = 'ZTSTGIDT'
INTO CONVERTDATE.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '+'
DATE = CONVERTDATE
FACTORY_CALENDAR_ID = 'ZB'
IMPORTING
FACTORYDATE = FAC_DATE
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
IF SY-SUBRC = 0.
ZE_T_RANGE-LOW = FAC_DATE.
ZE_T_RANGE-SIGN = 'I'.
ZE_T_RANGE-OPT = 'EQ'.
APPEND ZE_T_RANGE to E_T_RANGE.
ENDIF.
ENDIF.
The variable ZFACDY01 does not receive a value from this code, and it seems as if the variable CONVERTDATE never receives a value from the replacement path variable.
1.) Is it even possible to read the characteristic value in this way?
2.) Is there another way to read the characteristic value directly from my ODS at runtime for the record in question?
The much easier solution is to create new key figures for each date that we need to convert to factory days and to do the conversion in the update rules, but doing so would require extensive reloads of many years worth of data. Even though performance will be impacted, we're trying to find a workaround (queries will be batch-run at night, anyway).
Many thanks (and points!) for the person who can figure this outI tried using different I_STEP stages, but the replacement path variable still doesn't seem to be populated when it passes the value to the function module to convert to factory days.
-
How to find out query name in customer exit for variables
We use the same customer exit variable in different queries. In the customer exit we want to find out, which query has called the customer exit. With the technical query name we want to read a master data table entry.
e.g. If we come from query ZG1_TEST1 we want to use selection sel1
Query name | selection
ZG1_TEST1 | sel1
ZG1_TEST2 | sel2
How can we find out the query name in the customer exit for variables?
Thanks for your help,
EviHi Evi,
check out the structure I_S_RKB1D in your exit. It contains the query.
Siggi -
Customer Exit for Number of Days from 1 st Apr to last date of Month Enter
Hello BI Experts,
I have a requirement to count the number of days from 1 st April of current year to the last date of month entered.
For example : The use will enter say July 2010 or 003.2010 (as Fiscal Year Variant is V3 ).
Today is 14 July ...So we have to first find out the end date of the July month ie 31 st July
Then go to 1 st April 2010.
Now calculate the Number of days between 1 st April to 31 st July 2010.
I consider I have to create two Customer Exit variable
as below
1 st customer exit Bex variable say ZLY_MTH ( Last day of Month Entered)
and i_step = 1
2 nd Customer Exit BEx Formula variable say ZF_NUMDAYS ( Number of days between two dates)
i_step =1 .
Please provide me the logic for the above two.
Thanks in Advance.
Regards,
Amol KulkarniPSUDEO CODE:
1. Initially LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZMONTH'.
2. Get the Month input using VAR_MONTH2 = LOC_VAR_RANGE-LOW+4(2)
3. Now calculate Month+1: VAR_MONTH2 = VAR_MONTH2 + 1 (Refer **)
4. Now calculate the Current Year: VAR_YEAR = LOC_VAR_RANGE-LOW+0(4).
5. Get the 1st Day of the Month (VAR_MONTH2): CONCATENATE '01' '/' VAR_MONTH2 '/' VAR_YEAR INTO L_S_RANGE-LOW.
6. SUBRACT 1 (0DATE) from this DATE (This will give the logic for last day of the current month)
Insert this code also for using the date conversions
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = VAR_MONTH2
IMPORTING
OUTPUT = VAR_MONTH2.
Pls. check out this logic. Guess it would solve your need.
Thanks,
Arun Bala -
Customer Exit for Calendar Month based on the day (system Date)
Hello,
I need help in creating a customer exit for Calendar month without the user input. The logic is as follows:
For the BEx variable created with customer exit option and no user input:
If the day on the system date falls in between 1 to 14 take the calendar year/month value as previous month.
If the day on the system date falls in between 15 through 31 then take the calendar year/month as current month.
eg if report is run on March 24th2009 the calendar year/month variable should be calculated as 03/2009 (March 2009)
if the report is run on March 1st2009 the calendar year/month should be calculated as 02/2009 (Feb 2009).
The code should be effective when run in the first 15 days of Jan when the previous month would contain the previous year as well.
Thank You
SrishtiThanks Shanthi. I am trying to incorporate the logic when the query is run in beginning of Jan when the year should be the previous year.Following is the code.please let me know if it would work. Is there a way I can test it as well?
CASE I_VNAM.
WHEN 'ZCURCALMON'.
IF i_step = 2.
data: mm(2),
dd(2),
yy(4),
FM(6).
if sy-datum+4(2) EQ 1.
sy-datum(4) = sy-datum(4) - 1.
else.
sy-datum(4) = sy-datum(4).
endif.
if sy-datum+6(2) LE 15.
mm = sy-datum+4(2) - 1.
concatenate sy-datum(4) mm into FM.
else.
concatenate sy-datum(4) sy-datum+4(2) into FM.
endif.
l_s_range-low = FM.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
append l_s_range to e_t_range.
Endif.
ENDCASE.
Thanks
Srishti -
How to find the customer exits for a particular transaction
hi
how to find the customer exits for a particular transactionHi jyothsna vankadari ,
ther is a convenient way to find all BADIS called. You may know that BADIS are the newer version of EXITs.
I would suggest you to go for BADI.
Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
1) Goto se24 (Display class cl_exithandler)
2) Double click on the method GET_INSTANCE.
3) Put a break point at Line no.25 (CASE sy-subrc).
Now
4) Execute SAP standard transaction
5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
7) This way you will find all the BADIs called on click of any button in any transaction.
Regards,
Clemens -
How to select data from an aggregate in a customer exit for a query?
Hi,
I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
SELECT
F~KEY_1000041 AS K____035
F~KEY_1000271 AS K____035
F~QUANT_B AS K____051
F~VALUE_LC AS K____052
INTO (xdoc_date, xval1, xqty1)
UP TO 1 ROWS
FROM
FROM
*/BIC/E100004 AS F JOIN
/BIC/E100027 AS F JOIN
/BIC/DZMM_CGRNU AS DU
ON FKEY_ZMM_CGRNU = DUDIMID
JOIN /BI0/SUNIT AS S1
ON DUSID_0BASE_UOM = S1SID
JOIN /BI0/SCURRENCY AS S2
ON DUSID_0LOC_CURRCY = S2SID
JOIN /BI0/SMATERIAL AS S3
*ON FKEY_1000042 = S3SID
ON FKEY_1000272 = S3SID
JOIN /BI0/SMOVETYPE AS S4
*ON FKEY_1000043 = S4SID
ON FKEY_1000273 = S4SID
JOIN /BI0/SPLANT AS S5
*ON FKEY_1000044 = S5SID
ON FKEY_1000274 = S5SID
JOIN /BIC/D100004P AS DP
*ON FKEY_100004P = DPDIMID
ON FKEY_100027P = DPDIMID
WHERE
WHERE
( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630 ) ) AND ( (
( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630 ) ) AND ( (
S3~MATERIAL = <l_0material> ) ) AND ( (
s2~movetype BETWEEN '101' AND '102' OR
s4~movetype BETWEEN '921' AND '922' OR
s4~movetype BETWEEN '105' AND '106' OR
s4~movetype BETWEEN '701' AND '701' OR
s4~movetype BETWEEN '632' AND '632' ) ) AND ( (
S5~PLANT = <l_0plant> ) ) AND ( (
DP~SID_0RECORDTP = 0 ) ) ) )
GROUP BY
ORDER BY F~KEY_1000271 DESCENDING.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDSELECT.
How do I transport the code and make it work?
Whats the reason that the two key fields are different.
I had transported the aggregate from development to production. Activated it and filled the data.
What is the way out? Please help.
Regards,
Annie.Hi Sonu,
The main task is to move the contents of the one internal table to another with some condition.
First sort and delete the duplicate entries from the First Internal table like below :
sort it_tab by material ascending date_modified descending.
delete adjacent duplicates from it_tab.
Then move that Internal table contents to another internal table.
Define another internal table with the same structure as you have first internal table and then
Second Step :
it_itab1 = it_itab.
If you are using seperate Header line and Body then you can do like below :
it_itab1[] = it_itab[].
This will fix the issue.
Please let me know if you need any further explonation.
Regards,
Kittu
Edited by: Kittu on Apr 24, 2009 12:21 PM -
Customer exit for Batch management
Hi experts,
I'm using customer exit for batch management for internal number assignment.
I need the Batch number as i mentioned below
DDMMYYB01
DD-Date
MM-Month
YY-Year
B-Block
01-Number
For this i need to give logic. How to give i'm not getting. This batch number creation will come at the time of GR.
Anybody help me?
NarenHi
Please use the user exit SAPLV01Z as I mentioned in your other thread, please go to SMOD to read its documentstion.
In SMOD, select the 'Documentation' and click 'Display', this will show the overview documentation.
Select the 'Componnet', then ciick the 'Display'. select each component and click 'Documentation Ctrl+F4) this will show the detailed documentation of them.
Best Regards.
Leon. -
Custom Exit for determining previous-year time range
Dear all:
I have a problem about custom exit:
We have created a new object for combining Fiscal Year/Month and Period. So the format will be shown as " yyyymmp"
now we have one requirement which is determining the same period but previous year based on user input. For Example, if user input start and end period as
"2006041" and "2006111". There are should be 2 custom exit which are able to convert the user input to be "2005041" and "2005111". We created 2 custom exit for telling the previous-year period.
Then based on this converted time range, we should be able to extract applicable data. But after testing, we cant get supposing result. The code is following:
We will be very grateful for any input. thank you all so much
Calculate (Start)previous year/month/period by current
*year/month/period
*user-entry calendar year/month/period
WHEN 'ZFACLV19'.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = 'ZFACYMP1'.
CLEAR l_s_range.
LOC_YEAR = LOC_VAR_RANGE-LOW(4).
LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
LOC_YEAR = LOC_YEAR - 1.
L_S_RANGE-LOW(4) = LOC_YEAR.
L_S_RANGE-LOW+4(2) = LOC_MONTH.
L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
EXIT.
ENDLOOP.
Calculate (End)previous year/month/period by current
*year/month/period
*user-entry calendar year/month/period
WHEN 'ZFACLV20'.
break ab_william.
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = 'ZFACYMP2'.
CLEAR l_s_range.
LOC_YEAR = LOC_VAR_RANGE-LOW(4).
LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
LOC_YEAR = LOC_YEAR - 1.
L_S_RANGE-LOW(4) = LOC_YEAR.
L_S_RANGE-LOW+4(2) = LOC_MONTH.
L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
EXIT.
ENDLOOP.
SzuFenHi,
Try with following modifications:
ZYEAR1(4) = LOC_VAR_RANGE-LOW(4).
ZYEAR1(4) = ZYEAR1(4)- 1.
ZMONTH1(2) = LOC_VAR_RANGE-LOW+4(2).
CONCATENATE ZYEAR1(4) ZMONTH1(2) INTO LOC_VAR_RANGE-LOW(6).
With rgds,
Anil Kumar Sharma .P
Maybe you are looking for
-
How to create installer for flash app where content is distributed by chapter?
hi everyone, i wanted to create an application installer (per chapter) like the one implemented on the product on this site: http://www.thelandofme.com/ .. can someone pls guide me on this? i have no problem creating flash apps but i'm so lost on mak
-
Mail crashes if i add any kind of picture
I am having a bit of a problem. If i try to email a picture in any format, any size - mail just freezes (dreaded spinning wheel) - even a jpg of less than 100k, and it freezes. I have tried dragging directly to the mail window from the finder, and al
-
Internet connection through usb port
is ti possible to connect internet from ethernet to usb port for mac book air?if yes how,which things should i need??
-
Hi, I am working on the MIRO report. The taxes in the MIRO doc i get the total tax.If I want to get the diff tax i have to get if from PO.I want to get it from MIRO doc. could you tell me in which table of MIRO I can get the bifurcation of taxes. Th
-
Date time string from UME-SPML interface
Hi, I am using the UME-SPML interface to manage users in SAP UME and using AS ABAP user management as the user store for UME. I have noticed a problem in the date time string returned in the SPML search response when I search for a user. When you sea