Custom Functionality / New Functionality / Utilities question
Hypothetical question for everyone :
If you could change anything about HFM or FDM, what would it be and why?
If you could have any new features / utilities / tools what would they be and why?
Tony,
The 2 GB limit your are referring to is most likely the User mode virtual address space limit which is not .NET specific and affects any 32 bit process in windows
User-mode virtual address space for each 32-bit process
Limit in on X86 - 2 GB (3 GB with IMAGE_FILE_LARGE_ADDRESS_AWARE and 4 GT)
To get the 3GB, you would have to alter the executable PE header to enable the flags referenced above.
This is also referred to as 4-Gigabyte Tuning ( http://msdn.microsoft.com/en-us/library/bb613473(v=vs.85).aspx)
Limit in 64-bit Windows
2 GB with IMAGE_FILE_LARGE_ADDRESS_AWARE cleared (default)
4 GB with IMAGE_FILE_LARGE_ADDRESS_AWARE set
For a complete memory breakdown (and a brutal headache from trying to memorize all of these requirements), please see : http://msdn.microsoft.com/en-us/library/aa366778(v=vs.85).aspx#memory_limits
.NET does; however, have some memory limitations that can cause headaches for developers and users of their programs.
The .NET limitation is not a 'per thread' or even 'per program' limitation, rather it's a 'per object' limitation. A heap object cannot exceed 2GB of contiguous memory. (no longer an issue with 64 bit versions). An example of this would be if you created an array object that would hold all records from an FDM file. If you had a data load file that was > 2GB AND the software were to load all of that into one object (say array or file object), then you would have a problem.
With that said a couple comments :
- Situations where needed more than 2GB per object are VERY RARE.
* In 32 bit Windows environments, .NET would almost never be the limitation as the process is limited to 2GB and after overhead, there wouldn't even be 2GB of memory left for .NET limitation to become the issue.
* In 64 bit Windows, not an issue anymore.....
- Are you REALLY hitting the 2GB limit?
* Pointed out earlier, the limit is up to 2GB of contiguous space. Perhaps due to a lot of instantiating/releasing of objects, the address space is fragmented and the most you can allocate is much less than 2GB?
* You may also not be releasing other objects properly which would reduce the amount of available memory. It could be that the current .NET code has poor memory management and was just trusting Garbage collection to eventually clear everything up? For basic programs, this would work just fine. For something that could potential push the upper limits, this wouldn't work so fine .....
* To look at both of these scenarios, you'd probably want to make use of the CLR Profiler tool as this could answer some questions.
- There are workarounds for 2GB limit in Win 32 that are not that difficult to implement! If the FDM code base is relatively clean and this is "the" issue, I'd be curious to understand why they are not looking at work arounds? They could create a few 'memory manager' classes and plug everything into those and keep on trucking.
Anyway, I find it implausible they are going to rewrite FDM simply because of a 2 GB .NET limitation. It could be a factor (especially if the base code is ugly), though.
Similar Messages
-
Copy Function Group to New Name: Transport Question
When I did this I only see in the transport Function Group with the Function Group Name under it. I would have expected to see all of the objects but I guess not?
I suppose everything will go under thge Function Group name? ie. Includes, Function Modules, etc.?
Thank-You.When I see a thread title like this, the first question I think is "Why copy the function group".
Copying a complete function group leaves your system very open to future data corruption and other problems as patches etc change the code in the original group but do not get reflected in your copy. A repair or enhancement to the original object has the advantage that SPAU will highlight any new versions from SAP allowing you to confirm that your change is still needed.
Another option is to create a custom function that calls the standard code with customer specific pre and post processing. If both the standard and custom function are needed, then including logic based on transaction code, calling report, etc can handle this.
It is interesting to work on the upgrade of a system where there has been significant copying of SAP code - you compare the "Z" version with the original SAP code in the pre-upgrade system and nearly always find differences due to OSS notes etc that were applied without thinking of the customer copy.
Andrew -
RPTIME00 - Custom Internal Table , Custom Clsuter in Custom Function.
Hello Guru,
I have a requirement to create custom scheme with totally new custom function , rules .
my question is it is possible to declare custom internal tables like TIP, TOP and cutom cluster to store results.
if yes then how ?
Thanks in adanceMy requirement is based on a project to develop new sap product which can handle complex crew management for industries like railways and airlines,product is still in protoype phase and will basicaly cover right from dispatching crew to various sites to generating there payroll. standard sap works on basis of day and time. but crew industory work on trip. a crew for example pilot fly form point A to B get paid/claims based on on that single trip and whatever activities he has done in that trip. so purely this is based on trip and not day or hours, now we are thinking about using RPTIMEOO as a tool to calculate and create wage type beacuse at the end of the day payroll is getting generated in SAP and also all the crew employee will be setup as master data. this whole product will have its own screeen to capture activties and opereations . will be build on top of sap hcm.
so was thinking any ways sap says that you can create custom schema and rules but those standard internal tables and cluster are of no use because of the structure is based in trip, wage type will be based in miles that crew travel.
so trying to find how far this RPTIME00 is flexible .. and is possible to create custom function. becoz at end we are going to update payroll 2010 which can be mapped some how. RPTIME00 can also give clients to add there own custom functions in future if any new req comes.
if this is not possible i.e RPTIMEOO can not use custom cluster , then we might have to write abap programs ti do calculation but only problem any new features to be added will lead to code change.
thanks for your patience .. -
Hi Experts,
My predecessor has developed a customer function in CATS Time sheet. There is a customer function button, when employee clicks that button, it will call a function to calculate the employees overtime. Now, the business wants to make some over time calculation change. I do not have experience with customer function. I have following questions:
(1) How is the customer function button added into SAP standard screen(for example adding a customer button in CATS Time Sheet Screen)?
(2) How do I find the program that will be triggered when the customer button is clicked?
Regards,
JimHi Kiran,
This is a User Exit. It allows you to insert you own code to enhance the functionality of this program. This looks like a workflow user exit. What it allows you to do is pass into the user exit some approver information and allows you to modify the table of possible approvers.
If you double click on the '001' it will allow you to create your new INCLUDE program to insert your User Exit code.
Hope this makes sense. Hit me back if you need any clarification.
Cheers,
Pat. -
Hai,
I had a one time customer and Now I want to make him a Sold to party. What changes I have to make to this existing customer?
Regards,
Keyur. PHi,
This is an SD question on the MM forum and so this may explain why nobody has replied to your question yet.
But you really need to create a new master record.
You cannot use the change account group function XD07 because this would change the one-time customer record and this has been used for many customers and not just this one.
So I would recommend just treating this customer as a new customer, after all if they were a one-time customer then there really shouldn't be many orders or sales history for them? Unless you have been misusing the one-time customer function and entering many orders?
Steve B -
SSRS - Pass Field Value List To Custom Function Assembly And Display Result
I have written a SQL Server Reporting Services custom function as a C# assembly DLL and added it to my report. The purpose of the function is to search for outlier records in a collection of data. The data is represented as an array of floating point -tuplets
(float[][]). In a medical patient database, these might be things such as blood pressure, cholesterol, hight, weight, waist measurement, etc.
Several user input parameters are provided in the report, including numeric seed values for this particular algorithm. One multivalued parameter is a list of the numeric columns to be used as input to the algorithm because, importantly,
the user can choose any subset of the value columns. I have a tablix that will display columns from the dataset conditionally, based on which of those columns are chosen.
At this point, there are two issues I'm having difficulty with:
How do I, in the course of running the report, take just the numeric columns that the user has chosen (ignoring all others in the dataset) and pass them as a float[][] to my custom function? Or is there something in the
Microsoft.ReportingServices namespace that I should use to query an input dataset and convert it to an array in my C# code?
How can I present the array subset returned by my custom function in a tablix in the report?
Note: One thought that occurs to me is that outlier records tablix could be contained in a subreport, but I'm not clear on the logistics of passing dataset field results from a master report to a subreport.
I envision a final report when run to be similar to the following:
- Mark Z.Hi Mark,
Sorry for the delay.
From your description, you want to pass the dataset data to a custom code array, and return the subset of the array, right? In this case, you can use a custom function to add the data to array, and use the a custom function to sort the data base on your
requirement and then use a function to get the subset of the array. Here are some sample custom code for your reference.
Add to arryay
Dim values As System.Collections.ArrayList=New System.Collections.ArrayList()
Function SetText(ByVal value As Integer) As Integer
values.Add(value)
return value
End Function
Sort array
Function Sort()
Dim i as Integer
Dim j as Integer
Dim t as Integer
Dim n as Integer=values.Count-1
For i=n To 1 Step-1
For j=0 To i-1
if values(j)<values(j+1) Then
t=values(j)
values(j)=values(j+1)
values(j+1)=t
End if
Next j
Next i
End Function
Return value.
Function Rank(ByVal value As Integer)
return values(value)
End Function
Assume that you pass [Weight] field to array, you can use the expression below on the Weight column:
=Code.SetText(Fields!Weight.Value)
Then use the expression below to get the values.
PatientID:=Sort() & Lookup(Code.Rank(0),Fields!Weight.Value,Fields.Patient.Value,"Dataset")
Height:=Lookup(Code.Rank(0),Fields!Weight.Value,Fields.Height.Value,"Dataset")
Weight:=Code.Rank(0)
Hope this helps.
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Help on custom function...
Hi all
I'm having a problem with this custom function/report posted on TechNet while back for ConfigMgr 2007
http://social.technet.microsoft.com/wiki/contents/articles/7870.sccm-2007-create-report-of-upcoming-maintenance-windows-by-client.aspx
I've made the needed changes according to this blog post:
https://sccmfaq.wordpress.com/2013/08/22/sccm-2012-show-next-effective-maintenance-window/
..but when using maintenance windows that occurs for example 1st tuesday of every 1 months, the function returns the date week ahead. For example now (on 28th of Feb) next maintenance window should be on Tuesday March 3rd, but instead the report is showing
Tuesday March 10th.
Any help on modifying the function would be appreciated, I saw that there comments on the original post about the recurrence type 4 (monthly by weekday as noted here https://msdn.microsoft.com/en-us/library/cc143300.aspx) not working correctly in the function.
It seems that the function now returns the weekday of first full week of the month instead of the correct day.
The function is this:
CREATE FUNCTION [dbo].[SCCM_GetNextServiceWindow](@ScheduleToken AS CHAR(16), @RecurrenceType AS INT) RETURNS @NextServiceWindow TABLE (ScheduleToken CHAR(16), RecurrenceType INT, NextServiceWindow DATETIME, Duration INT, IsGMTTime BIT) AS BEGIN
--1 Occurs on 1/1/2012 12:00 AM 00011A8500080000
--2 Occurs every 3 day(s) effective 1/1/2012 8:00 PM 02811A8040100018
--3 Occurs every 3 week(s) on Saturday effective 1/1/2012 8:00 PM 02811A80401F6000
--3 Occurs every 1 week(s) on Saturday effective 1/1/2012 8:00 PM 02811A80401F2000
--5 Occurs day 2 of every 2 month(s) effective 1/1/2012 8:00 PM 02811A8040288800
--5 Occurs day 31 of every 1 month(s) effective 1/1/2012 8:00 PM 02811A80402FC400
--5 Occurs the last day of every 3 months effective 1/1/2012 8:00 PM 02811A8040280C00
--5 Occurs the last day of every 1 months effective 1/1/2012 8:00 PM 02811A8040280400
--4 Occurs the Third Monday of every 1 month(s) effective 1/1/2012 4:00 AM 00811A9E08221600
--4 Occurs the Last Wednesday of every 1 month(s) effective 1/1/2012 8:00 PM 02811A8040241000
--4 Occurs the Fourth Wednesday of every 1 month(s) effective 1/1/2012 8:00 PM 02811A8040241800
--4 Occurs the Last Monday of every 1 month(s) effective 1/1/2012 8:00 PM 02811A8040221000
--3 Occurs every 1 week(s) on Monday effective 1/1/2012 4:00 AM 00811A9E081A2000
-- http://msdn.microsoft.com/en-us/library/cc143300.aspx [This link is external to TechNet Wiki. It will open in a new window.]
DECLARE @RecurrenceType_NONE INT
, @RecurrenceType_DAILY INT
, @RecurrenceType_WEEKLY INT
, @RecurrenceType_MONTHLYBYWEEKDAY INT
, @RecurrenceType_MONTHLYBYDATE INT
SELECT @RecurrenceType_NONE = 1
, @RecurrenceType_DAILY = 2
, @RecurrenceType_WEEKLY = 3
, @RecurrenceType_MONTHLYBYWEEKDAY = 4
, @RecurrenceType_MONTHLYBYDATE = 5
-- http://msdn.microsoft.com/en-us/library/cc143505.aspx [This link is external to TechNet Wiki. It will open in a new window.]
--DECLARE @RecurrenceType INT; SET @RecurrenceType = @RecurrenceType_WEEKLY
--DECLARE @ScheduleToken CHAR(16); SET @ScheduleToken = '00811A9E081A2000'
DECLARE @ScheduleStartTime INT; SET @ScheduleStartTime = CAST(CONVERT(BINARY(4), LEFT(@ScheduleToken, 8), 2) AS INT)
DECLARE @ScheduleDuration INT; SET @ScheduleDuration = CAST(CONVERT(BINARY(4), RIGHT(@ScheduleToken, 8), 2) AS INT)
-- Duration is in minutes
DECLARE @Duration INT; SET @Duration = @ScheduleStartTime % POWER(2, 6)
-- Calculate the start time
DECLARE @StartTime DATETIME; SET @StartTime = CONVERT(DATETIME, '01/01/1970 00:00:00')
SET @StartTime = DATEADD(YEAR, (@ScheduleStartTime / POWER(2,6)) % POWER(2, 6), @StartTime)
SET @StartTime = DATEADD(MONTH, ((@ScheduleStartTime / POWER(2,12)) % POWER(2, 4)) - 1, @StartTime)
SET @StartTime = DATEADD(DAY, ((@ScheduleStartTime / POWER(2,16)) % POWER(2, 5)) - 1, @StartTime)
SET @StartTime = DATEADD(HOUR, (@ScheduleStartTime / POWER(2,21)) % POWER(2, 5), @StartTime)
SET @StartTime = DATEADD(MINUTE, (@ScheduleStartTime / POWER(2,26)) % POWER(2, 5), @StartTime)
-- Determinte UTC and Flags
DECLARE @IsGMTTime BIT; SET @IsGMTTime = CAST(@ScheduleDuration % POWER(2, 1) AS BIT)
DECLARE @Flags INT; SET @Flags = (@ScheduleDuration / POWER(2,19)) % POWER(2, 3)
-- Calculate the total duration in minutes
SET @Duration = @Duration + ((@ScheduleDuration / POWER(2,22)) % POWER(2, 5)) * 24 * 60 -- DAYS
SET @Duration = @Duration + ((@ScheduleDuration / POWER(2,27)) % POWER(2, 5)) * 60 -- HOURS
DECLARE @Now DATETIME
IF @IsGMTTime = 1 BEGIN
SET @Now = GETUTCDATE()
END ELSE BEGIN
SET @Now = GETDATE()
END
DECLARE @NextMaintenanceWindow DATETIME
IF @RecurrenceType = @RecurrenceType_NONE BEGIN
IF DATEADD(MINUTE, @Duration, @StartTime) > @Now BEGIN
SET @NextMaintenanceWindow = @StartTime
END
END ELSE IF @RecurrenceType = @RecurrenceType_DAILY BEGIN
IF DATEADD(MINUTE, @Duration, @StartTime) > @Now BEGIN
SET @NextMaintenanceWindow = @StartTime
END ELSE BEGIN
-- Calculate the daily interval in minutes
DECLARE @DailyInterval INT
SET @DailyInterval = ((@ScheduleDuration / POWER(2,3)) % POWER(2, 5)) * 24 * 60
SET @DailyInterval = @DailyInterval + ((@ScheduleDuration / POWER(2,8)) % POWER(2, 5)) * 60
SET @DailyInterval = @DailyInterval + (@ScheduleDuration / POWER(2,13)) % POWER(2, 6)
-- Calculate the total number of completed intervals
DECLARE @DailyNumberOfCompletedIntervals INT; SET @DailyNumberOfCompletedIntervals = ROUND(CAST(DATEDIFF(MINUTE, @StartTime, @Now) AS DECIMAL) / @DailyInterval, 0, 0)
-- Calculate the next interval
DECLARE @DailyNextInterval DATETIME; SET @DailyNextInterval = DATEADD(MINUTE, @DailyNumberOfCompletedIntervals * @DailyInterval, @StartTime)
-- Recalc the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @DailyNextInterval) < @Now BEGIN
SET @DailyNextInterval = DATEADD(MINUTE, (@DailyNumberOfCompletedIntervals + 1) * @DailyInterval, @StartTime)
END
SET @NextMaintenanceWindow = @DailyNextInterval
END
END ELSE IF @RecurrenceType = @RecurrenceType_WEEKLY BEGIN
DECLARE @WeeklyInterval INT; SET @WeeklyInterval = (@ScheduleDuration / POWER(2,13)) % POWER(2, 3)
DECLARE @WeeklyDoW INT; SET @WeeklyDoW = (@ScheduleDuration / POWER(2,16)) % POWER(2, 3)
-- Adjust the start time to match the next day of week that matches the interval
DECLARE @WeeklyStartTime DATETIME; SET @WeeklyStartTime = DATEADD(DAY, (7 - DATEPART(WEEKDAY, @StartTime) + @WeeklyDoW % 7), @StartTime)
IF DATEADD(MINUTE, @Duration, @WeeklyStartTime) > @Now BEGIN
SET @NextMaintenanceWindow = @WeeklyStartTime
END ELSE BEGIN
-- Calculate the total number of completed intervals
DECLARE @WeeklyNumberOfCompletedIntervals INT; SET @WeeklyNumberOfCompletedIntervals = ROUND(CAST(DATEDIFF(WEEK, @WeeklyStartTime, @Now) AS DECIMAL) / @WeeklyInterval, 0, 0)
-- Calculate the next interval
DECLARE @WeeklyNextInterval DATETIME; SET @WeeklyNextInterval = DATEADD(WEEK, @WeeklyNumberOfCompletedIntervals * @WeeklyInterval, @WeeklyStartTime)
-- Recalc the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @WeeklyNextInterval) < @Now BEGIN
SET @WeeklyNextInterval = DATEADD(WEEK, (@WeeklyNumberOfCompletedIntervals + 1) * @WeeklyInterval, @WeeklyStartTime)
END
SET @NextMaintenanceWindow = @WeeklyNextInterval
END
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYWEEKDAY BEGIN
DECLARE @MonthlyBWWeek INT; SET @MonthlyBWWeek = (@ScheduleDuration / POWER(2,9)) % POWER(2, 3)
DECLARE @MontlhyBWInterval INT; SET @MontlhyBWInterval = (@ScheduleDuration / POWER(2,12)) % POWER(2, 4)
DECLARE @MonthlyBWDoW INT; SET @MonthlyBWDoW = (@ScheduleDuration / POWER(2,16)) % POWER(2, 3)
-- Calculate the total number of completed intervals
DECLARE @MonthlyBWNumberOfCompletedIntervals INT; SET @MonthlyBWNumberOfCompletedIntervals = ROUND(CAST(DATEDIFF(MONTH, @StartTime, @Now) AS DECIMAL) / @MontlhyBWInterval, 0, 0)
IF @MonthlyBWWeek = 0 BEGIN
-- Calculate the next interval
DECLARE @MonthlyBWLDOMNextInterval DATETIME; SET @MonthlyBWLDOMNextInterval = DATEADD(MONTH, @MonthlyBWNumberOfCompletedIntervals * @MontlhyBWInterval, @StartTime)
-- Calculate last day of month
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, DATEDIFF(DAY, @MonthlyBWLDOMNextInterval, DATEADD(DAY, -1, DATEADD(M, DATEDIFF(MONTH, 0, @MonthlyBWLDOMNextInterval) + 1, 0))), @MonthlyBWLDOMNextInterval)
-- Calculate the last day of the week for the month
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, -(7 - DATEPART(WEEKDAY, @MonthlyBWLDOMNextInterval) + @MonthlyBWDoW % 7), @MonthlyBWLDOMNextInterval)
IF DATEADD(MINUTE, @Duration, @MonthlyBWLDOMNextInterval) < @Now BEGIN
-- Recalc for the next month interval
SET @MonthlyBWLDOMNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)
-- Calculate last day of month
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, DATEDIFF(DAY, @MonthlyBWLDOMNextInterval, DATEADD(DAY, -1, DATEADD(M, DATEDIFF(MONTH, 0, @MonthlyBWLDOMNextInterval) + 1, 0))), @MonthlyBWLDOMNextInterval)
-- Calculate the last day of the week for the month
SET @MonthlyBWLDOMNextInterval = DATEADD(DAY, -(7 - DATEPART(WEEKDAY, @MonthlyBWLDOMNextInterval) + @MonthlyBWDoW % 7), @MonthlyBWLDOMNextInterval)
END
SET @NextMaintenanceWindow = @MonthlyBWLDOMNextInterval
END ELSE BEGIN
-- Calculate the next interval
DECLARE @MonthlyBWNextInterval DATETIME; SET @MonthlyBWNextInterval = DATEADD(MONTH, @MonthlyBWNumberOfCompletedIntervals * @MontlhyBWInterval, @StartTime)
-- Set the date to the first day of the month
SET @MonthlyBWNextInterval = DATEADD(DAY, -(DAY(@MonthlyBWNextInterval) - 1), @MonthlyBWNextInterval)
-- Set the date to the first day of week in the month
SET @MonthlyBWNextInterval = DATEADD(DAY, (7 - DATEPART(WEEKDAY, @MonthlyBWNextInterval) + @MonthlyBWDoW) % 7, @MonthlyBWNextInterval)
-- Calculate date based on the week number to add
SET @MonthlyBWNextInterval = DATEADD(WEEK, @MonthlyBWWeek-1, @MonthlyBWNextInterval)
IF DATEADD(MINUTE, @Duration, @MonthlyBWNextInterval) < @Now BEGIN
-- Recalc for the next month interval
SET @MonthlyBWNextInterval = DATEADD(MONTH, (@MonthlyBWNumberOfCompletedIntervals + 1) * @MontlhyBWInterval, @StartTime)
-- Set the date to the first day of the month
SET @MonthlyBWNextInterval = DATEADD(DAY, -(DAY(@MonthlyBWNextInterval) - 1), @MonthlyBWNextInterval)
-- Set the date to the first day of week in the month
SET @MonthlyBWNextInterval = DATEADD(DAY, (7 - DATEPART(WEEKDAY, @MonthlyBWNextInterval) + @MonthlyBWDoW % 7), @MonthlyBWNextInterval)
-- Calculate date based on the week number to add
SET @MonthlyBWNextInterval = DATEADD(WEEK, @MonthlyBWWeek-1, @MonthlyBWNextInterval)
END
SET @NextMaintenanceWindow = @MonthlyBWNextInterval
END
END ELSE IF @RecurrenceType = @RecurrenceType_MONTHLYBYDATE BEGIN
DECLARE @MontlhyBDInterval INT; SET @MontlhyBDInterval = (@ScheduleDuration / POWER(2,10)) % POWER(2, 4)
DECLARE @MonthlyBDDoM INT; SET @MonthlyBDDoM = (@ScheduleDuration / POWER(2,14)) % POWER(2, 5)
IF @MonthlyBDDoM = 0 BEGIN
/* This is the last day of month logic */
-- Calculate the total number of completed intervals
DECLARE @MonthlyBDLDOMNumberOfCompletedIntervals INT; SET @MonthlyBDLDOMNumberOfCompletedIntervals = ROUND(CAST(DATEDIFF(MONTH, @StartTime, @Now) AS DECIMAL) / @MontlhyBDInterval, 0, 0)
-- Calculate the next interval
DECLARE @MonthlyBDLDOMNextInterval DATETIME; SET @MonthlyBDLDOMNextInterval = DATEADD(MONTH, @MonthlyBDLDOMNumberOfCompletedIntervals * @MontlhyBDInterval, @StartTime)
-- Calculate last day of month
SET @MonthlyBDLDOMNextInterval = DATEADD(DAY, DATEDIFF(DAY, @MonthlyBDLDOMNextInterval, DATEADD(DAY, -1, DATEADD(M, DATEDIFF(MONTH, 0, @MonthlyBDLDOMNextInterval) + 1, 0))), @MonthlyBDLDOMNextInterval)
-- Recalc the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @MonthlyBDLDOMNextInterval) < @Now BEGIN
SET @MonthlyBDLDOMNextInterval = DATEADD(DAY, DATEDIFF(DAY, @MonthlyBDLDOMNextInterval, DATEADD(DAY, -1, DATEADD(M, DATEDIFF(MONTH, 0, DATEADD(MONTH, (@MonthlyBDLDOMNumberOfCompletedIntervals + 1) * @MontlhyBDInterval, @StartTime)) + 1, 0))), @MonthlyBDLDOMNextInterval)
END
SET @NextMaintenanceWindow = @MonthlyBDLDOMNextInterval
END ELSE BEGIN
-- Check to make sure we won't loop forever if more than 31 days some how ends up in the token
IF @MonthlyBDDoM > 31 SET @MonthlyBDDoM = 31
-- Adjust the start time to match the next day of month that matches the interval
DECLARE @MonthlyBDStartTime DATETIME; SET @MonthlyBDStartTime = DATEADD(DAY, (31 - DATEPART(DAY, @StartTime) + @MonthlyBDDoM % 31), @StartTime)
-- This loop is used multiple times to search for the next valid date that falls on the desired day of month
WHILE(DATEPART(DAY, @MonthlyBDStartTime) <> @MonthlyBDDoM) BEGIN
SET @MonthlyBDStartTime = DATEADD(DAY, (31 - DATEPART(DAY, @MonthlyBDStartTime) + @MonthlyBDDoM) % 31, @MonthlyBDStartTime)
END
IF DATEADD(MINUTE, @Duration, @MonthlyBDStartTime) > @Now BEGIN
SET @NextMaintenanceWindow = @MonthlyBDStartTime
END ELSE BEGIN
-- Calculate the total number of completed intervals
DECLARE @MonthlyBDNumberOfCompletedIntervals INT; SET @MonthlyBDNumberOfCompletedIntervals = ROUND(CAST(DATEDIFF(MONTH, @MonthlyBDStartTime, @Now) AS DECIMAL) / @MontlhyBDInterval, 0, 0)
-- Calculate the next interval
DECLARE @MonthlyBDNextInterval DATETIME; SET @MonthlyBDNextInterval = DATEADD(MONTH, @MonthlyBDNumberOfCompletedIntervals * @MontlhyBDInterval, @MonthlyBDStartTime)
WHILE(DATEPART(DAY, @MonthlyBDNextInterval) <> @MonthlyBDDoM) BEGIN
SET @MonthlyBDNextInterval = DATEADD(DAY, (31 - DATEPART(DAY, @MonthlyBDNextInterval) + @MonthlyBDDoM % 31), @MonthlyBDNextInterval)
END
-- Recalc the next interval if the next interval plus the expected duration is in the past
IF DATEADD(MINUTE, @Duration, @MonthlyBDNextInterval) < @Now BEGIN
SET @MonthlyBDNextInterval = DATEADD(MONTH, (@MonthlyBDNumberOfCompletedIntervals + 1) * @MontlhyBDInterval, @MonthlyBDNextInterval)
WHILE(DATEPART(DAY, @MonthlyBDNextInterval) <> @MonthlyBDDoM) BEGIN
SET @MonthlyBDNextInterval = DATEADD(DAY, (31 - DATEPART(DAY, @MonthlyBDNextInterval) + @MonthlyBDDoM % 31), @MonthlyBDNextInterval)
END
END
SET @NextMaintenanceWindow = @MonthlyBDNextInterval
END
END
END
INSERT INTO @NextServiceWindow VALUES (@ScheduleToken, @RecurrenceType, @NextMaintenanceWindow, @Duration, @IsGMTTime)
RETURN
END
Thanks in advance for any suggestions!What an ungodly amount of the code for the task!
I tried
SELECT * FROM SCCM_GetNextServiceWindow('00811A9E08221600', 4)
Which is said mean "Occurs the Third Monday of every 1 month(s)" and it returned 2015-03-17. Which is a Tuesday. But it is the third Tuesday.
Turns out that I have British settings on that instance, DATEFIRST is 1. If do SET DATEFIRST 7, I get 2015-03-23. Which is a Monday, but the wrong one.
The current setting of DATEFIRST can be detected with @@DATEFIRST, and that would make the code even more complex.
My gut reaction would be to start over and do it all in C#, where at least I don't have to bother about SET DATEFIRST.
Or maybe first inspect that the ScheduleToken is correct. Maybe it is, but to me that is just an incomprehensible hex string.
Erland Sommarskog, SQL Server MVP, [email protected] -
Inconsistent Errors when processing IDocs using custom Function Module
I am encountering a most perplexing error. Here is the situation.
We have a custom function module to update data in the EH&S system. We are having a bizarre error occurring. This is the basic processing of the function module:
1. IDoc data is read and loaded into an internal table.
2. Data is run through a series of checks to determine if the data is valid for entry into the system.
3. After validation we use function module C1F2_SUBSTANCES_READ_WITH_REF to read characteristic data for the substance. This data is used to validate whether current data exists to allow for loading of the IDoc data. (This is the step where the IDoc is receiving an error even if the data is valid. This only occurs if we are processing a large amount of Idocs and one IDoc contains valid data and another invalid data for the same substance. It occurs even if the Idocs are not processed in sequence. If individually processed or reprocessed after initial failure they pass. This is what is so confusing!) If it exists, a flag is set and the data is loaded using function module BAPI_BUS1077_CHANGE to modify the data.
4. If the flag is set to allow further processing, the function module C1F2_SUBSTANCES_READ_WITH_REF is used again to select different characteristic data for the substance. A similar validation process occurs and if it passes, data is loaded using BAPI_BUS1077_CHANGE to update and BAPI_BUS1077_CREATE to create new data.
Here is the situation:
When processing one valid record for one substance, the record loads successfully. When processing multiple valid records (all are valid) for one substance, they all load successfully. The problem occurs when attempting to load valid and invalid records for the same substance. Some times the program successfully loads the valid data (as expected). Other times, it will not load any records. It is not consistent!
The order of IDoc processing does not have an impact on the success of the load. Whether the valid or invalid record processes first does not have an impact on the success of the valid substance load.
Does anyone have ANY Idea of what is going on? I am clearing all fields in the function module before processing occurs. I cannot find what is causing the error to occur.
HELP!
Jim HardyI have some further information. It seems that if data for a substance is sent in two separate Idocs, one with valid and one with invalid data, As long as the two IDocs are processed consecutively, they process correctly. If they are separated by IDocs containing other substance information, they fail.
thanks
Jim -
Error in Custom Function Module
Hi,
I am working on implementing General Ledger Business content in financial Accounting.
We had a requirement of creating a Custom Virtual cube similar to 0FIGL_V10. Hence, we had copied the standard function module RS_BCT_FIGL_DATA_GET_VC10 and created a custom function module. Before doing that, we had copied the function group RS_BCT_FIGL and created a custom function group for the custom function module.Both were activated subsequently. Then, we had created a custom virtual cube (ZFIGL_V10) using the custom function module.
The queries on the Standard virtual cube were migrated to ZFIGL_V10 using the RSZC transaction code. when the queries are executed in RSRT, we get an error message "**An exception with the type CX_SY_DYN_CALL_ILLEGAL_FUNC occurred" and the ABAP debugger is started post that error.
Has anyone faced this problem before?could any of you provide some pointers to it.
Regards,
SainathYou cannot use the standard function module which is used for standard cube for another cube.
You should not change the function module.
Instead you can make a copy of the function module you are using aand use this copy in ur virtual cube which will work in the same way the actual Fm used to work and it will make you perfrom the changes.
Follow the below steps:
1) Goto SE37 and In the top tool bar click on the copy button which is on right side of delete button.
2) in fr FM give the name of the actual FM and in to Fm give the name of the function module you want to copy.
3) Then click on copy.
4) Now open this new function in edit mode and goto the import/export parameters and check. it will have all the same parameters as the actual FM. Here you can make the changes you want.
5) Now use this FM in your virtual cube and it will be working as per your requirement
https://forums.sdn.sap.com/click.jspa?searchID=9605118&messageID=4999763
Hope it Helps
Chetan
@CP.. -
Spry validation custom functions
I see that there is a way to specify a custom function to a
spry validation widget like so:
var customFunction = new
Spry.Widget.ValidationTextField("customPasswordFunction", "custom",
{validation: passwordStrength, validateOn:["blur", "change"]});
Is there a way to pass additional parameters to the function?
I see that it passes (value,options) by default. I want to pass
additional parameters to my custom function. Is this
possible?I see that there is a way to specify a custom function to a
spry validation widget like so:
var customFunction = new
Spry.Widget.ValidationTextField("customPasswordFunction", "custom",
{validation: passwordStrength, validateOn:["blur", "change"]});
Is there a way to pass additional parameters to the function?
I see that it passes (value,options) by default. I want to pass
additional parameters to my custom function. Is this
possible? -
Using custom functions in a query
Hi, I have a query in a PLSQL procedure where some of the fields are data retreived from custom functions,
i. e.
select a, b, funcThatNeedsA(a), funcThatNeedsB(b)
from xxxx
where ...
but I also could use those functions by making a loop to a cursor
i. e.
cursor c_data is select a, b from xxxx where ...
for r_data in c_data loop
l_a = funcThatNeedsA(r_data.a);
l_b = funcThatNeedsB(r_data.b);
end loop;
So, my question is: what is more efficient, to use the functions directly in the query or in a loop of a cursor?the overhead of calling your functions will not change based on using them in a loop vs a cursor. the concern is the performance of ANY loop vs not using a loop at all. so what else are you doing in the loop? does it really need to be in a loop? for example, this
insert into a select * from b
is faster than
for rec in (select * from b) loop insert into a values(rec); end loop; -
Custom function call results in 403 Forbidden error
Hi,
I use an custom function to show images from blob columns in a report (as shown in Re: How to Display image, that is stored in database This run fine with Apex 2.2.
After a new installation on an other server - now with Apex 3.1 - everything is ok, but instead of the images only the broken image is displayed.
Clicking on "show image" calls this URL http://-bla bla- /pls/htmldb6/UNTERSCHRIFTEN.uv_blob_download?p_file=1002401114659435
and results in this error:
You don't have permission to access /pls/htmldb6/UNTERSCHRIFTEN.uv_blob_download on this server.
On the same Installation the sample application runs fine, also the images are displayed correctly. Also the "show image" call http://- bla bla -/pls/htmldb6/apex_util.get_blob_file?a=103&s=805871757194874&p=6&d=476144746179567984&i=176988523388974647&p_pk1=1&p_pk2=&p_ck=DE4CD5C7A077B26C18DDBF429D62F8D5
works correct.
I think there is something wrong with some settings.
Any ideas?
Thanks for your help,
FrankHello Vidar,
I got it: The solution is in wwv_flow_epg_include_mod_local
I had to put my function in here.
See also: http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
or in my blog: (in german) http://frankschmidt.blogspot.com/2008/07/apex-blob-direkt-im-report-anzeigen.html
Thank's for you ideas!
Regards,
Frank -
Post Author: edy80y
CA Forum: Formula
I have a report with many subreports which all contain the same formula to group teams.When a new team is added i need to update all instances of the formula so they are all up to date.I know of Custom Function so i created one out of the formula in the main report. The problem im finding is that im unable to use that custom function in the sub reports.Am i wring in thinking that a custom function created in a main report can be used in its sub reports??Am i creating the custom function incorrectly? Heres what i have done:
Our database has team names that have a prefix of the State they are in such as: Perth - Team Orange Perth - Team Apple Sydney - Team Grape Sydney - Team Pineapple
At one stage the Teams in Perth had been split into Perth1 and Perth2 resulting in the following records in the database:
Perth1 - Team Orange Perth - Team Orange
Because of this i have created a formula that groups teams into sites:
select Trimleft(mid({team.name},instr({team.name},'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
I use this formula in all reports and subreports and i link by them as well, so if a new team is created (for example Perth - Team Pear) i need toupdate all instances of the formula by adding 'Team Pear' to the Perth case.
To fix the problem i created a custom function (called 'site') out of the formula above and it created this:
Funtion (stringvar v1)select Trimleft(mid(v1,instr(v1,'-')+1))case 'Team Orange', 'Team Apple': 'Perth'case 'Team Grape', 'Team Pineapple': 'Sydney'default:''
Now within that main report i am able to go to the formula editor and when i type site() then wording becomes blue but when i go into a sub report to do the same it doesnt react.
I hope i have explained my self well enough for you to understand my predicament without boring you.
Thanks in advance for your help!Post Author: edy80y
CA Forum: Formula
Hi,
Thanks for the reply. Unfortunately it does make things easy for me. If i add the custom function in the subreport then i will have to updae that as well whenever a new team is created. I'm looking for a solution where i only have to update the custom function in the main report only and not in the 7 or 8 subreports within it.
Unless i am doing something wrong. I basically copied the contecnt of the Custom Function in the main report and then went into the sub report and created a new Custom Function and pasted the code in it.
Regards,
Eddie S -
SE80 problem in ECC with custom function groups
We are in the process of upgrading from 4.64 to ECC 6 and have encountered an unusual situation.
When we bring up a custom function group in SE80, we can no longer see the custom includes in the include section. We can see all other sections. We can still use SE38 to look at an include. The automatically-generated includes are there, such as the TOP, F01 and UXX, but see none of the ones that go with the function modules we've created. When we look at the UXX include, we can see each of the function modules with the include it belongs to. These are function groups that existed in the 4.64 system; they are not new to the ECC system.
We've tried rebuilding the object list at the function group and package levels. We receive no errors and the processes work fine.
Maybe there is a setting somewhere that needs to be updated?See the solution that Srini has suggested in this thread
OA Framework & JTT Request Parameters
you need to use jtfcrmchrome.jsp to navigate between JTF and OA pages.
Thanks
Tapash -
Debugging customized function module when Idoc is triggered via ALE
Hi,
Whenever we save the billing document, an outbound idoc is triggered via ALE. The logic for the data to be included in the idoc is written in a customized function module.
However we are making some changes and would like to include some more data in the idoc. But we find that when we put a breakpoint in the function module, on saving the billing document, the flow does not stop at the break point. We are 100% sure that the code in the function module gets executed based on the data in the idoc.
How do we get into debug mode and break the flow in the function module so that we can debug in the function module?
Any help would be greatly appreciated.
Thanks in advance,
MickHi Mick, this might be of some help 4 u.
ALE IDOC
Sending System(Outbound ALE Process)
Tcode SALE - for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 - Create Model View
Tcode BD82 - Generate partner Profiles & Create Ports
Tcode BD64 - Distribute the Model view
Message Type MATMAS
Tcode BD10 - Send Material Data
Tcode WE05 - Idoc List for watching any Errors
Receiving System(Inbound ALE )
Tcode SALE - for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 - Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 - Idoc List for inbound status codes
ALE IDOC Steps
Sending System(Outbound ALE Process)
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 - Create Model View
Tcode BD82 - Generate partner Profiles & Create Ports
Tcode BD64 - Distribute the Model view
This is Receiving system Settings
Receiving System(Inbound ALE )
Tcode SALE - for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 - Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 - Idoc List for inbound status codes
Message Type MATMAS
Tcode BD10 - Send Material Data
Tcode WE05 - Idoc List for watching any Errors
1)a Goto Tcode SALE
Click on Sending & Receiving Systems-->Select Logical Systems
Here Define Logical Systems---> Click on Execute Button
go for new entries
1) System Name : ERP000
Description : Sending System
2) System Name : ERP800
Description : Receiving System
press Enter & Save
it will ask Request
if you want new request create new Request orpress continue for transfering the objects
B) goto Tcode SALE
Select Assign Client to Logical Systems-->Execute
000--> Double click on this
Give the following Information
Client : ERP 000
City :
Logical System
Currency
Client role
Save this Data
Step 2) For RFC Creation
Goto Tcode SM59-->Select R/3 Connects
Click on Create Button
RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles
give the information for required fields
RFC Destination : ERP800
Connection type: 3
Description
Target Host : ERP000
System No:000
lan : EN
Client : 800
User : Login User Name
Password:
save this & Test it & RemortLogin
3)
Goto Tcode BD64 -- click on Change mode button
click on create moduleview
short text : xxxxxxxxxxxxxx
Technical Neme : MODEL_ALV
save this & Press ok
select your just created modelview Name :'MODEL_ALV'.
goto add message type
Model Name : MODEL_ALV
sender : ERP000
Receiver : ERP800
Message type :MATMAS
save & Press Enter
4) Goto Tcode BD82
Give Model View : MODEL_ALV
Partner system : ERP800
execute this by press F8 Button
it will gives you sending system port No :A000000015(Like)
5) Goto Tcode BD64
seelct the modelview
goto >edit>modelview-->distribute
press ok & Press enter
6)goto Tcode : BD10 for Material sending
Material : mat_001
Message Type : MATMAS
Logical System : ERP800
and Execute
7)goto Tcode : BD11 for Material Receiving
Material : mat_001
Message Type : MATMAS
and Execute --> 1 request idoc created for message type Matmas
press enter
Here Master Idoc set for Messge type MATMAS-->press Enter
1 Communication Idoc generated for Message Type
this is your IDOC
Change Pointers
I know how to change the description of a material using ALE Change Pointers.
I will give the following few steps
1) Tcode BD61---> check the change pointers activated check box
save and goback.
2) Tcode BD50---> check the MATMAS check box save and comeback.
3) Tcode BD51---> goto IDOC_INPUT_MATMAS01 select the checkbox save and comeback.
4) Tcode BD52---> give message type : matmas press ok button.
select all what ever you want and delete remaining fields.
save & come back.
5) 5) go to Tcode MM02 select one material and try to change the description and save it
it will effects the target systems material desciption will also changes
6) goto Tcode SE38 give program Name is : RBDMIDOC and Execute
give Message type : MATMAS and Executte
ALE/IDOC Status Codes/Messages
01 Error --> Idoc Added
30 Error --> Idoc ready for dispatch(ALE Service)
then goto SE38 --> Execute the Program RBDMIDOC
29 Error --> ALE Service Layer
then goto SE38 --> Execute the Program RSEOUT00
03 Error --> Data Passed to Port ok
then goto SE38 --> Execute the Program RBDMOIND
12 Error --> Dispatch ok
Inbound Status Codes
50 Error --> It will go for ALE Service Layer
56 Error --> Idoc with Errors added
51 Error --> Application Document not posted
65 Error --> Error in ALE Service Layer
for 51 or 56 Errors do the following steps
goto WE19 > give the IDOC Number and Execute>
Press on Inbound function Module
for 65 Error --> goto SE38 --> Execute the Program RBDAPP01 then your getting 51 Error
cheers,
Hema.
Maybe you are looking for
-
Note: capitals are used only to highlight important words. PLEASE, TAKE THESE COMMENTS ON TWO CRITICAL BUGS VERY SERIOUSLY BECAUSE THE BUGS DESCRIBED BELOW ARE SO CRITICAL THAT I CANNOT USE THE LATEST VERSION OF FIREFOX UNLESS THEY DO NOT APPEAR IN T
-
I am trying to download an update to my iphone, but in the middle of the download, I get an error message that reads, 'There was problem downloading the software for the iphone. The network connection timed out'. Any idea how to reslove this issue?
-
Notebook toshiba with tv tunner bullit in
What kind of notebook has a tv tunner bullit in or a hdmi slot input? Solved! Go to Solution.
-
Best way to use Sun Web Server connection pooling with Web Application?
I have a number of applications that run Oracle and MySQL queries via Sun Web Server 6.1. I use the Web Server's built-in connection pooling, which works fairly well. As an interface with the connections I receive from the Web Server, I use a class,
-
Pessimistic Locking (relating to COBOL)
Hi, Apologies for the SA I've written below - just wanted to explain the context around my problem. I'm working on an application which replaces the Micro Focus COBOL file handler & allows data in COBOL VSAM files to be migrated to Oracle in such a w