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
Srishti
Thanks 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
Similar Messages
-
Customer Exit for 15 month from current month
Hi Gurus,
I have a requirement to write customer exit for 15 months from current month based on todays day.
if current day is less than 10 then we have to get 15 months from current month other wise from next month to 15 months.
this exit I am writing on calendar year/month.
Please assist for logic.
Thanks
Ganesh Reddy.I hope this code will do the trick.
DATA: L_S_RANGE TYPE RSR_S_RANGESID,
LOC_VAR_RANGE LIKE RRRANGEEXIT,
zcalmonth(6) type c.
zcurrentmonth(6) type c.
zyear(4) type n,
znextyear(4) type n,
zyear1(4) type c,
znextyear1(4) type c,
zmonth(2) type n,
zmonth1(2) type n,
zmonth2(2) type c,
zmonth3(2) type n,
zmonth4(2) type c,
IF i_step = 2.
CASE i_vnam.
WHEN '<VARNAME>'.
zyear = sy-datum+0(4).
znextyear = zyear + 1.
zyear1 = zyear.
znextyear1 = zlastyear.
zmonth = sy-datum+4(2).
if sy-datum+6(2) LE 10.
zmonth1 = zmonth + 2.
if zmonth1 GT 12.
zmonth1 = zmonth1 - 12.
zmonth2 = zmonth1.
zcurrentmonth = sy-datum+0(6).
endif
concatenate znextyear1 zmonth2 into zcalmonth.
else.
zmonth1 = zmonth + 3.
ZMONTH3 = ZMONTH + 1.
if zmonth1 GT 12.
zmonth1 = zmonth1 - 12.
zmonth2 = zmonth1.
endif
if zmonth3 GT 12.
zmonth3 = zmonth3 - 12.
zmonth4 = zmonth3.
endif
concatenate znextyear1 zmonth2 into zcalmonth.
concatenate znextyear1 zmonth4 into zcurrentmonth.
endif.
l_s_range-low = zcurrentmonth.
l_s_range-high = zcalmonth.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
rgds, Ghuru -
Customer Exit for 13 month from current month
Hi Gurus,
I need a customer exit for 13 months from current month. Based on the requirement I have written following code
When 'VPI_13CALYRMON'.
IF i_step = 1.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
l_s_range-low = sy-datum+0(6).
l_s_range-high = sy-datum+0(6) + 13.
append l_s_range to e_t_range.
endif.
Please could you guide me the code.
Thanks
Ganesh Reddy.Hi,
I think you can do it in below way.
When 'VPI_13CALYRMON'.
IF i_step = 1.
temp1 = sy-datum+0(4).
temp1 = temp1 +1. (because adding 13 months would take year to next year)
temp2 = sy-datum+4(2).
temp2 = temp2 + 1. (after adding 13 months, the month would be one more than of previous year)
concatenate temp1 temp2 into temp3.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
l_s_range-low = sy-datum+0(6).
l_s_range-high = temp3.
append l_s_range to e_t_range.
endif.
Hope this helps. -
I have had my Iphone 5s for 2 months and all the fotos and data (fotos and data were not backed up) that I had were erased after I restored it with my old Iphone 4s backup, can I get my unsaved fotos and data back? and if I can, how?
If you never backed up your phone to iTunes and never backed it up to iCloud all of your content is gone forever.
-
Customer Exit for Calendar year/Quarter
Hi Experts,
I had a scenario as I had a Time char 0Calquarter. Based on this I need to derive the current quarter headcount and Pervious year same quarter headcount. To get the headcount I defined a counter constant '1' for each employee at cube level.
In a Query
a) Assign a system date to 0Calquarter variable in query.
b) If the variable is blank till current quarter the headcount need to display and same as previous quarter headcount.
c) If the user enters any value (say 20083) tht quarter current headcount and pervious year quarter(20073) headcount.
For the above scenarios I need to write customer exit.
Thanks,Hi Shanthi,
Thanks for u r reply.
Headcount is defined as 'constant'. when Z_COUNT Keyfigure is dran & droped in rows it'll cumulate and display the current headcount.
hope u understand the headcount.
I require the cmod logic.
Thanks -
In CIF customer exit there is no information about the logical system
Dear All,
we have a SAP R3 system (ver 4.7) connected to 2 SAP APO systems.
we need to differentiate the UE code in R3 by APO TARGET SYSTEM.
In the CIF userexit used:
EXIT_SAPLCLOC_001
EXIT_SAPLCSRS_003
EXIT_SAPLPGS1_001
EXIT_SAPLCSTK_001
EXIT_SAPLMEAP_001
there is no information about the logical system (source, destination
etc.) The control parameters are not provided to the user exit.
I found a note 1060634 where the parameter have been added to
EXIT_SAPLCSLS_002 , but not to all other exits.... do you have any clue on how we can proceed?
Thank you !!
Best Regards , BarbaraFound the answer, to bad i cannot give points to myself :-P
In the ABAP i use the E_T_RANGE output structure.
That structure has several fields (sign, opt, low, high).
In my ABAP i stored the same value in the low and high field.
This should work fine for normal (flat) characteristic values.
However, because i use a hierachy i should enter the 0HIER_NODE value in the high field.
For details see: SAP NOTE: 912473
Regards -
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 -
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. -
Calculate Avg for the given months based on the no. of days in months
Dear Experts
I have a report in which there is a characterictic claenderyr/month.The Input paramter is claenderyr/month which is restricted by a variable of type interval. i mean user will enter calenderyr/month as interval say 012010 to 06.2010. Now I have to calculate Avg sale Qty for the given months based on the no. of days for the given range of months. How I can achieve this in BW Query. Pl. advice
Dinesh SharmaHi,
Create formula for the sales qty.
maintain the exception aggregation as average based on calday
Best Regards,
M.H.REDDY -
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 -
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 -
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. -
Customer Exit for Deriving Current Fiscal Period, Period+1 and Period+2
Hi all,
I have created three customer exit variables in my query for custom info object ZFISCPER (Fiscal Year PEriod), Fiscal 1, Fiscal 2 and Fiscal 3. I want to write a customer exit to derive the current period, current 1 and current2 period's respectively for these variables based on the system date. The format of the period is YYYY0MM ( 2009004). Could someone give me the exact code i can plug in CMOD for these
Thanks a lot
Rashmi.Hi Rashmi,
I think you need only one customer exit variable. Other can be derived by setting an offset to current Fiscal Period.
Check the BI content variable for current fiscal period. Use this variable with an offset for derving the other periods (e.g. SAP Exit variables (0FPER, 0FYTCFP, 0FYTLFP). So you have to write no own code...
Other option is to check how SAP exit is working and building own variable based on this code.
Check the following link to get information how to do this:
Reg Variable 0FYTCFP
Regards
Andreas -
Problem in creating include program for customer exit for BC425_01
Hi,
I want to write a customer exit for transaction BC425_01. For identifying the include program for exit , i go to System->Status.There I double click on the program name(GUI).Then I perform a 'FIND' in main program for 'customer-function' keyword. I get 3 search results with "CALL CUSTOMER-FUNCTION '001' " , "CALL CUSTOMER-FUNCTION '002' " , "CALL CUSTOMER-FUNCTION '003' ".
Now i double click on CALL CUSTOMER-FUNCTION '001' and i am taken to the code of program where this function is called in MODULE cust_check INPUT. I double click on CALL CUSTOMER-FUNCTION '001' and then I am taken to the function module code which contains a single statement 'INCLUDE ZXBC425G01U01 .' .
Now I double click on this include program so that I can write my own code. But when i double click on it , a message displayed 'Program names ZX.. are reserved for includes of exit function groups'. Hence I am not able to creates this include program and write my coding.
Kindly Help
THANKSHi Amber,
Then you click enter button.It is asking to create object with that include name ZXBC425G01U01 in a pop-up.You should select YES option.It will ask package . Give the package name and save.Then include program is created and allowed you to write your own code.
Thanks,
Prasad GVK. -
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.
Maybe you are looking for
-
I am attempting to map a network drive and I am not having any luck. I am typing //machine name/share name into the field and I am not having any success. am I missing something. I am using a WRT350N and Seagate Free Agent 320gb ext hard drive. I had
-
Current date in BO queries with Universe built on Infocube
Hi dear experts, We are facing the following issue : - we built a universe on top of a multiprovider (with 2 infocubes) since we don't want to manage BW Queries. - we need to restrict data on WebI queries using current date or system date (to compare
-
Leave Request: Show Team Calendar
Hi Friends, In Webdynapro javaLeave Application we have the option(Link) Show Team calender.It displays only direct reporties to that org unit. But it not displays the sub org unit chiefs in that list. Do we have option to display all sub org unit ch
-
Not a comforting message to see... Here are the errors just before the above message is emitted and the install ends. Jul 26 05:33:33 localhost OSInstaller[344]: PackageKit: Extracting file://localhost/Volumes/Mac%20OS%20X%20Install%20DVD/Packages/Es
-
TS4079 Cannot see siri in my settings general. I am in iPhone 4 s and iOS 6
I want to use siri but cannot see it in my settings general. I am using iPhone 4S and iOS 6