Customer exit to calculate previous quarter based on user entry in 0PCALMON
Hi,
I have written a CMOD code to calculate previous quarter based on user entry in 0PCALMON (0CALMONTH). That is if 09.2008 is entered for 0PCALMON, it should fetch the months 04.2008, 05.2008,06.2008.
But unfortunately I am getting all years and all months.
Could you please help me debug this code.
Global Declaration :
z_vcalmonth(2) TYPE n ,
z_vcalyear(4) TYPE n.
When 'YQV_LQ'.
if i_step = 2.
READ TABLE i_t_var_range WITH KEY
vnam = '0PCALMON'
iobjnm = '0CALMONTH'
INTO l_s_var_range.
if sy-subrc = 0.
z_vcalmonth = l_s_var_range-low+4(2).
z_vcalyear = l_s_var_range-low(4).
IF ( z_vcalmonth >= 1 AND z_vcalmonth <= 3 ).
z_vcalyear = z_vcalyear - 1.
CONCATENATE z_vcalyear '10' INTO l_s_range-low.
CONCATENATE z_vcalyear '12' INTO l_s_range-high.
ENDIF.
IF ( z_vcalmonth >= 4 AND z_vcalmonth <= 6 ).
CONCATENATE z_vcalyear '01' INTO l_s_range-low.
CONCATENATE z_vcalyear '03' INTO l_s_range-high.
ENDIF.
IF ( z_vcalmonth >= 7 AND z_vcalmonth <= 9 ).
CONCATENATE z_vcalyear '04' INTO l_s_range-low.
CONCATENATE z_vcalyear '06' INTO l_s_range-high.
ENDIF.
IF ( z_vcalmonth >= 10 AND z_vcalmonth <= 12 ).
CONCATENATE z_vcalyear '07' INTO l_s_range-low.
CONCATENATE z_vcalyear '09' INTO l_s_range-high.
ENDIF.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
endif.
endif.
Hi,
U can use the FM SLIM_GET_QUARTERLY_PERIODS
Pass the variable first date of 0PCALMON ( 09.2009 => '01.09.2009') to get the table of all the 4 period ranges in PERIODS table in result
and read the Last entry to get the Previous Quarter period
PERIODS table
S OP LOW HIGH
I BT 01.07.2008 30.09.2008
I BT 01.10.2008 31.12.2008
I BT 01.01.2009 31.03.2009
I BT 01.04.2009 30.06.2009
Then pass this values in l_s_range-low l_s_range-high
Hope this helps
Sonal...
Similar Messages
-
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 -
How to create a customer-exit to calculate a week from a date
Hi my Guru's,
I actually try to implement an Exit variable to calculate a week number from a characteristic date (0FINISHDATE) in my BEX report. Does anyone has an example of customer-exit which calculate a week number after giving a date in the popup.
What I really need is how to initialize the OFINISHDATE value in my Exit.
Any help will be appreciate,
Cheers,
MK2Hi,
I donot know this following workaround works properly are not. we have to wait for Our BW gurus' suggestions.
1) Create a formula variable with 'Replacement path' as processing type on Characterstic 0FINISHDATE.
2) Create one more Formula variable with 'customer exit' as processing type .
3) In Cmod
DATA: l_s_range type rsr_s_rangesid.
DATA: datein like sy-datum. "la caractéristique date
DATA: date2 like SCAL-WEEK. " déclaration de Résultat
DATA : NUMB1(2) TYPE N.
CASE i_vnam.
when 'FORMULA_VARIABLE2'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'FORMULA_VARIABLE1'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW(8) = LOC_VAR_RANGE-LOW(8)
datein(8) = L_S_RANGE-LOW(8).
here we are finding the Week no user entered date.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = datein
IMPORTING
WEEK = date2.
numb1 = date2+4(2)
CLEAR L_S_RANGE.
L_S_RANGE-LOW = numb1.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDCASE.
With rgds,
Anil Kumar Sharma .P
Message was edited by: Anil Kumar Sharma -
Customer exit Variable for Previous 12months Rolling based on 0calday
Hi Experts,
I am creating a Customer exit variable to derive Rolling 12 months based on calday,
Could you please any body correct the below code,
Or if you any body have pseudo code based on calday, could you please pass to me
WHEN 'zcalday'.
* Rolling 12 months to period
IF i_step = 2.
CLEAR: l_s_range, loc_var_range,
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = 'RYEAR'.
MOVE sy-datum TO: lv_date_from,
lv_date_to.
zmonth = lv_date_from+4(2)
l_s_range-high = zmonth = loc_var_range-low.
v_fiscper = v_fiscper - 12.
l_s_range-low = v_fiscper.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
ENDIF.
Thanks and regards
SreeHi Yasemin,
Thanks for your help,
I have small clarification, I have following data in base cube,After restricting the customer exit variable
on revenue I suppose I will get one Amount, i.e 7800, But If I want month wise, Do I need to create offset? or without creation of offset is there any way that will split based customer exit variable.....
Thanks a lot
regards
Sree
Execution date
24/06/2014
Comp Code
Date
Revenue
C100
01/07/2013
100
C100
01/08/2013
200
C100
01/09/2013
300
C100
01/10/2013
400
C100
01/11/2013
500
C100
01/12/2013
600
C100
01/01/2014
700
C100
01/02/2014
800
C100
01/03/2014
900
C100
01/04/2014
1000
C100
01/05/2014
1100
C100
01/06/2014
1200
Total
7800 -
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 -
Customer exit code for fiscalyear period based on system date
Hi Experts,
Please provide customer exit code for fiscalyear period derive based sy-datum. Fiscal year period derivie current to previous 12 periods and current to fast 12 periods.
Thanks,
SubbarajuHi Subbaraju,
Please use below customer exit code for your solution. Please define declarations as per requirement.
When 'ZFPERIOD'.
IF I_STEP = 2.
ztoday = sy-datum.
zfast = sy-datum + 365.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = ztoday
i_periv = 'K4'
IMPORTING
E_BUPER = PERIOD2
E_GJAHR = YEAR2.
CONCATENATE YEAR2 PERIOD2 INTO FISCPERLOW.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = zfast
i_periv = 'K4'
IMPORTING
E_BUPER = PERIOD2
E_GJAHR = YEAR2.
CONCATENATE YEAR2 PERIOD2 INTO FISCPERHI.
L_S_RANGE-LOW = FISCPERLOW.
L_S_RANGE-HIGH = FISCPERHI.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDIF.
Similar code user for your previous periods also.
Thanks,
Chandra -
Regarding Customer exit to calculate fiscal week
Hello All,
I have a requirement to calculate the fiscal week from fiscal period. Here i used the FM 'UMC_FISCPER_TO_CALWEEK' to calculate the fiscal week. But the problem here is i created variable on fiscal year /week so when i pass the fiscal period i should get fiscal week, here i am getting calweek which make no sence. Is there any function module to calculate the Fiscal week if we pass fiscal period.
Thanx in Advance
AnilWe cant calculate fiscal week from just fiscal period. we need date or this.
You can try this function ZFI_GET_FISCAL_WEEK_QUARTER or some other similar function. However, the input should be a date.
Looks like there is no funciton to calculate fiscal week. we may need to write our own code for this based on other FMs.
Re: Get Week number in a particular Fiscal year
~ Arun KK
Edited by: arun kk on May 8, 2008 10:22 AM -
How to calculate elapsed time based on user input
I'm not sure what to do next in this program. Basically, I'm not sure exactly how to get the time to output accurately, as in what forumla I should be using.
This is the question:
What comes 13 hours after 4 o'clock? Create an ElaspedTimeCalculator application that prompts the user for a starting hour, whether it is am or pm, and the number of elapsed hours. The application then displays the time after that many hours have passed. Application output should look similar to:
Enter the starting hour: 7
Enter am or pm: pm
Enter the number of elapsed hours: 10
The time is: 5:00 amHere's the code I have so far:
import java.util.Scanner;
public class ElapsedTimeCalculator
public static void main(String[] args)
int starting_hour;
int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
String am_or_pm;
int elapsed_hours;
int elasped_minutes;
int time_hours;
int time_minutes;
System.out.println("Welcome. This application will give you the time based on your input.");
System.out.println(" ");
Scanner input = new Scanner(System.in);
System.out.print("Enter the starting hour: ");
starting_hour = input.nextDouble();
System.out.print("Enter the starting minutes: ");
starting_minutes = input.nextDouble();
System.out.print("Enter either 'am' or pm': ");
am_or_pm = input.nextString();
System.out.print("Enter the number of elapsed hours: ");
elapsed_hours = input.nextDouble();
input.close();
time_hours =
time_minutes =
if(am_or_pm = "am" || am_or_pm = "a.m." || am_or_pm = "AM" || am_or_pm = "A.M.")
System.out.println("The time is " + time_hours + ":" + time_minutes + "am");
if(am_or_pm = "pm" || am_or_pm = "p.m." || am_or_pm = "PM" || am_or_pm = "P.M.")
System.out.println("The time is " + time_hours + ":" + time_minutes + "pm");
}To calculate time_hours should I just calculate this by adding the elapsed hour to the starting hour? I doubt it will be accurate for all situations.
Same for the time_minutes For example, if the starting minutes and the elapsed minutes were 50, it would be greater than 60. Also, not sure if it makes sense to separate hours and minutes like this, it's not required to in the question. I initally thought it would be easier to approach like this instead of allowing the user to input a double for the starting hour. ex. 5.7
I get the feeling that this is extremely simple, but nonetheless, I'm stuck, so any help would be appreciated.Well thanks to both of you. I did a little reading up on the modulus operator and coupled it with some logic (although, truthfully, I'm not really using to there actually being an application for the remainder of a division operation, since it's never really used very much in any of my Math courses) and the hours portion works perfectly now:
import java.util.Scanner;
public class ElapsedTimeCalculator
public static void main(String[] args)
int starting_hour;
//int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
String am_or_pm;
int elapsed_hours;
//int elasped_minutes;
System.out.println("Welcome. This application will give you the time based on your input.");
System.out.println(" ");
Scanner input = new Scanner(System.in);
System.out.print("Enter the starting hour: ");
starting_hour = input.nextInt();
//System.out.print("Enter the starting minutes: ");
//starting_minutes = input.nextInt();
System.out.print("Enter either 'am' or pm': ");
am_or_pm = input.next();
System.out.print("Enter the number of elapsed hours: ");
elapsed_hours = input.nextInt();
input.close();
int time_hours = 0;
//int time_minutes;
String meridien;
if(am_or_pm.equals("am"))
time_hours = (starting_hour + elapsed_hours) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("am"))
time_hours = (starting_hour + elapsed_hours) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("AM"))
time_hours = (starting_hour + elapsed_hours) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("A.M."))
time_hours = (starting_hour + elapsed_hours) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("pm"))
time_hours = (starting_hour + elapsed_hours + 12) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("p.m."))
time_hours = (starting_hour + elapsed_hours + 12) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("PM"))
time_hours = (starting_hour + elapsed_hours + 12) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
else if(am_or_pm.equals("P.M."))
time_hours = (starting_hour + elapsed_hours + 12) % 24;
//time_minutes = (starting_minutes + elapsed_minutes) % 60;
if(time_hours < 12)
meridien = "A.M.";
System.out.println("The time is: " + time_hours + ":00 " + meridien);
else if(time_hours > 12)
meridien = "P.M.";
System.out.println("The time is: " + time_hours + ":00 " + meridien);
}Now the only thing is the minutes. My teacher did say she wants the user to have the option to input minutes also if he/she desires, so I do need it. However, the only problem is that if say the user inputs a "starting minute" of 14 for example, and 66 minutes elapsing, then (14 + 66) int/ 60 = 1r20 but using the modulus operator would only give me 20. So how will I be able to add any extra hours if it is necessary? -
Determine the Struture columns Based on User Entry in Bex Report
Hello Experts,
I have requirement as below.
Requirement: Create a Bex report to Display Credits and Sales based on Fiscal Period in Rows and Profit centers in Columns ( PC1, PC2, PC3....PCN where N is Number of Profit centers a user entered in Selection screen).
I want to take Fiscal Period, Sales and Credits in Rows and Each profit center in Seperate Columns. The Tricky part is, I cannot define a structure with fixed number of Columns since User can Enter any number of Profit Centers in the selection Screen.
To put it simple terms, I have to Pass the Profit Center Variable Values to the Structure and Determine the Number of Columns in the Structure Dymanically at runtime..
Can this be done. If so Please let me know the Solution.
Thank and Regards,
PrashanthHi Pasha,
Thanks for responding back.
Actually there are 2 other Columns that I did not mention above. First Column is to Display values for all Profit Centers and the other Column is to Display the difference of Total - 'Values of all the Profit Centers that the user has selected'. Im not sure how it will work if I put the PC Char outside the Structure.
Please let me know If you have some more thought.
Thanks,
Prashanth -
Which data source of many to use, based on user entry of month
Looking for hints relating to BEx queries inside the Web Application Designer's web templates.
Currently a query is using 1 very, very large data source, such as payroll records.
If data is divided into smaller portions, such as monthly data sources....
How can we:
- establish a link between the variable entry screen where the user selects 1 specific month and
- force the query to return results from that 1 month's data source?
In other words, we are looking for a way to build intelligence into the query for it to make a decision about which data source to use, based upon the parameters that end user enters.... with the hopes that the process will return the results faster, because it has less data to weed thru to get to the results.
Thanks.Hi Sharon,
As U said the datasource is a huge one. Now let's say these datasource is feeding its data to only 1 cube IC1. After the data to the cube is loaded, there will be huge junk of data from the source, so, inorder to improve the reporting performance with respect to this cube you got different options of creating Indexes, Aggregates etc., on to this cube. Again coming the BEx, there also U have other options to improve your query performance.
As per your requirement, U want to display data with respect to a month which the end user enters. For this I guess U can have a variable entry for the time characteristic Calendar Month/Year. By this way, U can get the desired results for the query. I suggest, U can even improve the performance by having range values (or) single value restrictions on the time characteristic Calendar Month/Year, if U are sure for which calendar months (or) years the data is to be queried upon.
Hope this should serve your purpose.
Regards,
Syed. -
Hello,
I created a customer exit variable which has to show the range between the first and last day of the previous month. The query will be executed every first of the month.
Variable is declared as: Customer exit, based on 0CALDAY, Interval, Mandatory and NOT input.
When i debug the query, it is making the calculation but its not populating my variable; when I execute the query from RSRT, the output test shows a message:
ENo value could be determined for variable ZRANGE_PREVMONTH. BRAIN 632ZRANGE_PREVMONTH
Below the code i'm using (SAP 7.4)
***Customer Exit to calculate previous month.
IF i_step = 2.
CASE i_vnam.
WHEN 'ZRANGE_PREVMONTH'.
DATA: LS_RA_SID TYPE RSR_S_RANGESID.
DATA: yyyy(4) TYPE n.
DATA: mm(2) TYPE n.
DATA: dd(2) TYPE n.
DATA: fst_date LIKE sy-datum.
DATA: fst_date2 LIKE sy-datum.
LOOP AT i_t_var_range_c INTO loc_var_range
WHERE vnam = '0DAT'.
dd = sy-datum+6(2).
mm = sy-datum+4(2).
yyyy = sy-datum+0(4).
fst_date2 = sy-datum.
IF dd = '01' AND mm = '01'.
mm = '12'.
yyyy = yyyy - 1.
ELSEIF dd = '01' AND mm <> '01'.
mm = mm - 1.
ELSEIF dd <> '01'.
mm = mm - 1.
ENDIF.
CLEAR: fst_date.
CONCATENATE yyyy mm '01' INTO fst_date.
fst_date2 = fst_date2 - 1.
CLEAR: ls_ra_sid.
ls_ra_sid-sign = 'I'.
ls_ra_sid-opt = 'BT'.
ls_ra_sid-high = fst_date2.
ls_ra_sid-low = fst_date.
APPEND ls_ra_sid TO e_t_range.
ENDLOOP.
ENDCASE.
ENDIF.Hi Fernanda,
Try this:
DATA: LS_RA_SID TYPE RSR_S_RANGESID.
DATA: fst_date LIKE sy-datum.
CASE i_vnam.
WHEN 'ZRANGE_PREVMONTH'.
fst_date = sy-datum - 1.
concatenate fst_date(6) '01' into ls_ra_sid-low.
ls_ra_sid-sign = 'I'.
ls_ra_sid-opt = 'BT'.
ls_ra_sid-high = fst_date.
APPEND ls_ra_sid TO e_t_range.
ENDLOOP.
ENDCASE.
ENDIF.
Just post here for any queries..
Regards,
Loed -
Customer Exit Variblae with Offset
Hello Everyone,
Can any one tell me whether we can use offset on Customer Exit Variable or no?
I have
Variable 1. Calmonth_01 in first Column which is also input varialble.
Variable 2. Calmonth_02 is second Columnt which is Exit Variable on which offset is not applied.
From third Column i m using second variable with offset.
According to me it has to work. but i m report it is not working.
Plz help.Hi,
If you have any Input Variable on 0CALMONTH and based on the input month if you want to display the reports either + or 1 Months then you can use Off Sets it will work, no need to go for Customer Exit Variables.
1. Create a User Entry Variable on 0CALMONTH eg name of variable = ZMNTH
2. Restrict the Keyfigure with ZMNTH in column one.
3. Restrict the Keyfigure with ZMNTH-1 in column two, it will display Previous month data based on Input month
4. Restrict the Keyfigure with ZMNTH+1 in column three, it will display next month data based on Input month
Steps 3 & 4 are using Off Sets only.
For any Customet Exit variables see
https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
Thanks
Reddy -
Help me writing a Customer Exit!!
Hi Guys
Help me how to write a customer for calculating the next quarter forecast based on the user enter the input..
to write a code from the fiscal period they enter....
*********START OF FIRST PROG
WHEN 'ZVAR_**** type as interval or selection*
CLEAR l_s_range.
IF i_step = 2. "after the popup
LOOP AT i_t_var_range INTO loc_var_range
WHERE vnam = ZPxxXXXX.
ENDLOOP.
IF loc_var_range-low = '001'
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
l_s_range-low = "01"
l_s_range-low = "03"
ENDIF.
IF loc_var_range-low = '004'
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = "04"
l_s_range-low = "06"
ENDIF.
IF loc_var_range-low = '007'
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = "07"
l_s_range-low = "09"
ENDIF.
IF loc_var_range-low = '010'
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = "10"
l_s_range-low = "12"
ENDIF.
*****Until here I calculated the Quarterly months...if I am wrong correct me...
******then from here I need to caculate Next Quarter as mentioned below. which is requirement logic...
if they enter period
01 --- Quarter1
02---Q1
03--- Q2
04--Q2
05---Q2
06---Q3
07---Q3
08---Q3
09---Q4
10---Q4
11-Q4
12-Q4
This is how i need
Is it again I need to enter for each period as they enter????
pls help me with next part of coding???
APPEND l_s_range TO e_t_range.
Thanks a lot...
BI LearnerHi,
Here I'm giving simple code this will give First Day of the Fy Period and Last Day of the Fy Period entered by the user, so you can change as per your requirement, please ask ABAPer in your project to chenge the code, because I don't know what exactly you want to.
it will give first date of the FY Period based on user entry on ZFYP variable
ZFDAY_FI is Customer Exit Variable on 0CALDAY and ZFYP is User Entry Variable on Fiscal year/Perod
WHEN 'ZFDAY_FI'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
zbdatj = loc_var_range-low+0(4).
zbuper = loc_var_range-low+4(3).
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = zbdatj
i_periv = 'V3'
i_poper = zbuper
IMPORTING
e_date = zzdate.
CLEAR: l_s_range.
l_s_range-low = zzdate.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
it will give last date of the FY Period based on user entry on ZFYP variable
ZLDAY_FI is Customer Exit Variable on 0CALDAY and ZFYP is User Entry Variable on Fiscal year/Perod
WHEN 'ZLDAY_FI'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
zbdatj = loc_var_range-low+0(4).
zbuper = loc_var_range-low+4(3).
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = zbdatj
i_periv = 'V3'
i_poper = zbuper
IMPORTING
e_date = zzdate.
CLEAR: l_s_range.
l_s_range-low = zzdate.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
In Report Create new Selection and drag the Keyfigure and 0CALDAY and restrict the 0CALDAY with *Intervales i.e. with ZFDAY_FI ; ZLDAY_FI *
Thanks
Reddy -
Changes to Variable in Customer exit
Hi Experts,
We have two variables in the ready for input query.
First Variable : Customer exit variable which gets populated based on user login details.
Second Variable: Input ready variable. The values will be populated depending on the first variable.
Suppose the user belongs to Sales Org India, the first variable will be populated in the back ground with value IND.
So the second variable(input ready) on sales hierarchy shows the available values only for INDIA in the format Region->State->city etc .
Now the problem is, even the user selects city in the second variable, the result set is being locked at the INDIA level . As a result the other users are not allowed to lock the data even if they select any other city.
Is it possible to delete value of the First variable in the customer exit after the user input the value for the second variable ?
I mean the Sales org should be set to empty after the user input to the second variable, so that the lock will apply at the region /city level .
Please let me know If I can provide any more information.
Thanks and regards,
Babu vHello,
Pl see if you can use first variable as authorisation variable
and second variable as i_step =2 as follows
INCLUDE ZXRSRU01 *
Enhancement: MultiProvider using InfoProvider Variable
include YBW_INFOPROVIDER_VARIABLE.
*& Include YBW_INFOPROVIDER_VARIABLE *
DATA:
ls_var TYPE rrs0_s_var_range,
ls_range TYPE rsr_s_rangesid,
l_contained TYPE c,
ls_mapping TYPE ybw_mapping,
lt_mapping TYPE TABLE OF ybw_mapping.
Called after variable popup
IF i_step = 2 AND i_vnam = 'INFOPROV'.
- 13 -
Read mapping table
REFRESH lt_mapping.
SELECT * FROM ybw_mapping INTO TABLE lt_mapping.
Process all selection for country variable
REFRESH e_t_range.
LOOP AT i_t_var_range INTO ls_var WHERE vnam = 'S_COUNT'.
Process all mapping rules
LOOP AT lt_mapping INTO ls_mapping.
Always fill LOW and HIGH, Otherwise logic below will not work
IF ls_mapping-high IS INITIAL.
ls_mapping-high = ls_mapping-low.
ENDIF.
Check if selection is contained in the defined InfoProvider
CLEAR l_contained.
CASE ls_var-opt.
WHEN 'EQ'.
IF ls_var-low BETWEEN ls_mapping-low AND ls_mapping-high.
l_contained = 'X'.
ENDIF.
WHEN 'BT'.
IF ls_var-low <= ls_mapping-high AND
ls_var-high => ls_mapping-low.
l_contained = 'X'.
ENDIF.
ENDCASE.
Add InfoProvider to return table
Note: Use COLLECT to avoid duplicates
IF l_contained = 'X'.
CLEAR ls_range.
ls_range-sign = 'I'.
ls_range-opt = 'EQ'.
ls_range-low = ls_mapping-infoprov.
COLLECT ls_range INTO e_t_range.
ENDIF.
ENDLOOP. " lt_mapping
ENDLOOP. " i_t_var_range
EXIT.
ENDIF.
Thanks and regards -
Customer exit code to calculate Average YTD.
Hi Experts,
I want to create new column ( AVGYTD TRGT) in Bex report for folling data .( Which is FF data).
I have created one formula variable(zfmvavgytd) of type customer exit. and strucked at coding part.
so that, anybody provide customer exit code for required column(avgytd trgt). and details are as follows.
0CALMONTH ENO ENAME PERDAY_ TRGT
04.2011 1 ABC 100
04.2011 2 BCD 200
05.2011 1 ABC 200
05.2011 2 BCD 200
06.2011 1 ABC 300
06.2011 2 BCD 200
07.2011 1 ABC 200
07.2011 2 BCD 200
till 03.2012
Now I want to display the column for ( AVG YTD_TRGT) based on "0calmonth " & " ENo " as below
AVG YTD_TRGT
100
200
150
200
200
200
200
200
calculation behind this is...
for 04 .2011 --empno(1) ---100/1
for 04 .2011 --empno(2) ---200/1
for 05 .2011 --empno(1) ---200+100/2
for 05 .2011 --empno(1) ---200+200/2
for 06 .2011 --empno(1) ---300200100/3
for 06 .2011 --empno(1) ---200200200/3
for 07 .2011 --empno(1) ---200300200+100/4
for 07 .2011 --empno(1) ---200200200+200/4First you need to calcualte the YTD and then Average YTD.
Year to Date (YTD) u2013 From the 1st to entered u201CKey Dateu201D for the current year.
Average Year to Date - YTD divided by the u201CNo of Daysu201D in year till u201CKey Dateu201D for current year.
Check the below code for getting Previous YTD....next create a Selection restrict the KF with YTD varaible
Below is sample code for reference.
to calculate "Previous year to date" (User input Calday u2013 key date)
WHEN 'ZDAYPYR'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZPDATE'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.
L_S_RANGE-LOW(4) = L_S_RANGE-LOW(4) - 1. "low value previos year
v_loc_date = L_S_RANGE-LOW. "take input value in another variable
L_S_RANGE-LOW+4(4) = '0101'.
L_S_RANGE-HIGH = v_loc_date. "high value = input, taken into another variable
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
Maybe you are looking for
-
Cannot print to Canon LBP 3360 since upgrading to Mavericks
I cannot print to my Canon LBP 3360 since upgrading to Mavericks. Would anyone know of a work around for this. Canon is not making any promises about upgrading the driver.
-
Create Columns in Template using Smartforms
Hi Guyz, Im using Template in smartforms and create 2 or more columns..but the columns must be in horizontal order like this : COMPANY DEPT BASIC but the column appeared vertical like this : COMPANY DEPT BASIC Another question is what is the purp
-
Bluetooth keyboard stops working when i plug in my iphone 5
Hi All... Heres a question from the twilight zone where strange things happen. My Hardware/Software used: - iMac OSX 10.9.2 - Mac wireless Keyboard - Logitech mouse performance MX - iTunes 11.1.5 (5) - iPhone 5 v7.1 (11D167) I plug in my iPhone via U
-
Does Siebel support Macintosh OS? We can add diffrent browsers to the siebel application. But Where is it mentioned(in application)about different Operating system Siebel application will be supporting to?? can anyone please tell me about this??
-
Change of default profit center
Hi experts, At the time of FG stock upload from legacy system by movement type 561 the stock go into unrestricted stock. Then when i move the good (Mov type 413) to sales order stock i give a profit center as specified in sales order. Here the system