Changing customer functions
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. P
Hi,
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
Similar Messages
-
Cr XIR1 to create a custom function to change the timestamp of a field
Post Author: palm
CA Forum: Crystal Reports
Hi,
I am trying to create a custom function to change the timezone of a field in the report depending on the timezone selected by the user in the prompt
I wrote a SQL Expression to do this , but i ended up creating a bunch of expressions for each time zone ,
So i am thinking of custom fuction some thing like
TimeZoneConvertor:
Fuction(TimeStampField , Timezone)
Returns: Timestamp field with newtimezone as selected by user
Hope you get this and please give me some kind of ideas to acheive this
Thanks in Advance!!!!!!!!Hi
goto se37...here u need to create a function group... then u need to create a function module. inside assign import/export parameters. assign tables/exceptions. activate the same. now write ur code within the function module
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
Look at the below SAP HELP links, These links will show you the way to create a Function Module
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm -
Post Author: BerlinOlaf
CA Forum: Other
Dear all,
is there a way to change/insert a custom function by using craxddrt/.Net instead of publishing the function in the Repository?
Thanx
OlafPost Author: quafto
CA Forum: Other
You can modify report formulas by modifying the Text property of the FormulaField object in the .NET SDK. The FormulaFields collection is a member of the ReportDocument.ReportDefinition object.
For more info look at kbase c2010287 here http://support.businessobjects.com/rl/support_search/. -
Customer function / badi to CHANGE AFVC-STEUS (Production Order)
Hi Gurus,
i'm looking for a customer function/badi to change field AFVC-STEUS when postin a Production Order.
The PPCO0... customer functions seems NO good because allow only to check but not to change data.
Any hint?BBP_PD_PO_CHANGE <- that one
BBP_PD_PO_SAVE
COMMIT WORK.
The others to persist the change into the database -
Report Template driven by custom functions
Hello,
I'm a newbie, and i'm trying to design a report template driven by a vw and/or stored proc to display information on a letterhead report. Such as names that can change at any time. I have another interface linked to the vw/sp to change that information at any time. What i'm trying to get is the idea of how to create a template letterhead report that i don't have to go back into crystal to change whenever the administration name changes.
Does anybody have any ideas or examples? I'm thinking Custom Functions are the way to go but, i just don't know how to get started with using them if that's the way to go.
Thanks in advance!Please re-post if this is still an issue
-
Could not find Model while pointing to a custom Function Group
Hello ,
I am on EP7.0 ERP05 NW04s and trying to modify ESS Address application to point to a custom function group rather than the standard one . When I tried to do that by changing the mapping for the ReadInfotype I got certain compilation errors ,I fixed those and then got the following error at runtime:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Couldnt find info for class com.sap.xss.hr.per.us.address.custom_model_custom.Zhrxss_Per_Read_P0006_Us_Input in model com.sap.xss.hr.per.us.address.model.HRXSS_PER_P0006_US@10c7f0a[scope=APPLICATION_SCOPE]
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.associatedModelClassInfo(DynamicRFCModelClass.java:220)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.elementIndexForFrontendName(DynamicRFCModelClass.java:1359)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValueAsString(DynamicRFCModelClass.java:664)
at com.sap.xss.hr.per.us.address.custom_model_custom.Zhrxss_Per_Read_P0006_Us_Input.setInfty(Zhrxss_Per_Read_P0006_Us_Input.java:162)
at com.sap.xss.hr.per.us.address.fc.wdp.IPublicFcPerAddressUS$IReadInfotypeElement.setInfty(IPublicFcPerAddressUS.java:11824)
at com.sap.xss.hr.per.us.address.fc.FcPerAddressUS.readRecord(FcPerAddressUS.java:271)
at com.sap.xss.hr.per.us.address.fc.wdp.InternalFcPerAddressUS.readRecord(InternalFcPerAddressUS.java:692)
at com.sap.xss.hr.per.us.address.fc.FcPerAddressUSInterface.readRecord(FcPerAddressUSInterface.java:150)
at com.sap.xss.hr.per.us.address.fc.wdp.InternalFcPerAddressUSInterface.readRecord(InternalFcPerAddressUSInterface.java:230)
at com.sap.xss.hr.per.us.address.fc.wdp.InternalFcPerAddressUSInterface$External.readRecord(InternalFcPerAddressUSInterface.java:306)
at com.sap.xss.hr.per.us.address.overview.VcPerAddressUSOverview.onBeforeOutput(VcPerAddressUSOverview.java:267)
at com.sap.xss.hr.per.us.address.overview.wdp.InternalVcPerAddressUSOverview.onBeforeOutput(InternalVcPerAddressUSOverview.java:275)
at com.sap.xss.hr.per.us.address.overview.VcPerAddressUSOverviewInterface.onBeforeOutput(VcPerAddressUSOverviewInterface.java:158)
at com.sap.xss.hr.per.us.address.overview.wdp.InternalVcPerAddressUSOverviewInterface.onBeforeOutput(InternalVcPerAddressUSOverviewInterface.java:140)
at com.sap.xss.hr.per.us.address.overview.wdp.InternalVcPerAddressUSOverviewInterface$External.onBeforeOutput(InternalVcPerAddressUSOverviewInterface.java:224)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.callOnBeforeOutput(FPMComponent.java:602)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:568)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:437)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:195)
at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:748)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:283)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
I wonder what's the cause of this ...
Any help would be highly appreciated.Do below things.
1. Re-import your Model.
2. Restart your J2ee server
3. Re-load & Rebuild your project.
It should work now..
Raja T
Message was edited by:
Armin Reichert -
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] -
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; -
Problem in Custom function in I_TH_REF_DATA
Hi All,
I have a custom function where I have implemented interfaces IF_RSPLFA_SRVTYPE_IMP_CHECK & IF_RSPLFA_SRVTYPE_IMP_EXEC_REF. In method GET_REF_DATA_SEL I could specify the selection criteria to read reference data and system does read the reference data specified in E_T_REF_CHARSEL table. When I go to ADD_NEW_BLOCKS method I can see the reference data in I_TH_REF_DATA table but when control reaches to EXECUTE method I_TH_REF_DATA becomes empty
Can anyone suggest what did I miss here which lead me to this problem?
Regards,
DeeptiHi Deepti,
the planning function is executed in blocks. So the data and reference data is split up into blocks (and for each block the execute method is called). The blocks are defined based on the characteristic values for the fields not to be changed.
It looks like you are working on a block for which no reference data has been found. Can you check this.
Regards Matthias -
Custom Function on OO ALV Grid
I am trying to implement ALV_GRID_XT to enhance the ALV Grid toolbar by adding couple of custom funcitons.As per the SAP documentation I have created 2 methods ON_TOOLBAR - one for adding items on toolbar and the other ON_USER_COMMAND - for processing if the user clicks on the custom function.
I am unable to relate the ALV Grid instance onto the method ON_USER_COMMAND . One of the funciton is to calculate the average of column which represents percentage excluding cells with zero values. Once the user selects column(s) and clicks on the Percent button on the ALV grid my piece of code should trigger ON_USER_COMMAND and then display the average percentage on the Totals row.
Method ON_USER_COMMAND has only one parameter E_UCOMM which i am able to get in the method but I am not able to get the instance of the ALV grid so that I can play around with the data in the Grid.
I could have used a local class and then enhanced the ALV toolbar but this requirement is needed for about 20 reports and hence thought of implementing it globally.
Any ideas would be appreciated.Hi there
You need to set the handlers of course and register the events
I'm using also a Z-class using functionality from the ALV Grid
in the application program
data: z_object type ref to zcl_* "my z_class"
* Instantiate your Z class
create object z_object
exporting
z_object = z_object
cfname = 'CCONTAINER1'.
Now in your Constructor for your Z-Class have a variable
say grid1 which is defined as a type ref to cl_gui_alv_grid.
Code the methods you require --. The trick is to instantiate your OWN Z class and within YOUR CLASS instantiate the GRID1 variable as an instance of cl_gui_alv_grid - then you can use methods etc from that class in your own Z class simple via something like this
method CONSTRUCTOR.
create object grid_container1
exporting
container_name = cfname.
create object grid1
exporting
i_parent = grid_container1.
set handler z_object->on_user_command for grid1.
set handler z_object->on_toolbar for grid1.
set handler z_object->handle_data_changed for grid1.
set handler z_object->handle_data_changed_finished for grid1.
set handler z_object->on_dubbelklik for grid1.
set handler z_object->on_hotspot for grid1.
call method grid1->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
endmethod.
method display_grid .
get reference of g_outtab into g_outtab1.
get reference of g_fldcat into g_fldcat1.
struct_grid_lset-edit = i_edit. "To enable editing in ALV
struct_grid_lset-zebra = i_zebra.
struct_grid_lset-cwidth_opt = i_opt.
struct_grid_lset-grid_title = i_gridtitle.
* struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
* struct_grid_lset-stylefname = 'CELLTAB'.
struct_grid_lset-ctab_fname = style_fname.
struct_grid_lset-stylefname = style_ctab.
* export gt_outtab from gt_outtab to memory id 'gt_outtab'.
call method grid1->set_table_for_first_display
exporting
is_layout = struct_grid_lset
changing
it_outtab = gt_outtab
it_fieldcatalog = it_fldcat.
endmethod.
You need to add the buttons to the toolbar with your ON TOOLBAR method
for example
method on_toolbar .
type-pools icon.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXCEL' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move icon_xxl to ls_toolbar-icon.
move 'Excel' to ls_toolbar-quickinfo.
move 'EXCEL' to ls_toolbar-text.
append ls_toolbar to e_object->mt_toolbar.
perform toolbar in program (caller) if found
using e_object.
endmethod.
Now the functionality should work in the ON_USER_COMMAND .
Here's my ON_USER_COMMAND method within the class
method ON_USER_COMMAND.
* FOR EVENT before_user_command OF cl_gui_alv_grid
* IMPORTING
* e_ucomm
* sender
* When defined in SE24 you don't need to code the
* FOR EVENT etc as this is already defined as an event handler
case e_ucomm.
when 'EXIT'.
leave program.
when 'EXCEL'.
call method me->download_to_excel.
when 'SAVE'.
when 'PROC'.
call method me->process.
when 'REFR'.
call method me->refresh.
when 'SWITCH'.
call method me->switch.
when 'TEST'.
call method me->get_cell.
endcase.
endmethod.
Add whatever extra functionality you want to the on_user_command so long as you've defined toolbars..
Cheers
jimbo -
Help - I need to remove crop marks set in custom function 3
Hello All, I need help! I set the custom function 3 to the on position, thinking it would just give me lines to show where an 8x10 crop would be ~ I did not realize that it would actually crop all of my images. I shoot raw and I have imported them into lightroom, within lightroom I cannot remove the crop. I tried opening in Canon's software, removed the crop, then saved as a TIFF, but 17 files ended up being corrupt.
I see that there is a plug in for LR, but it indicates DNG files, not RAW ~ is there a plug in for RAW? Does anyone know a work around that might help me? Thank you.You didn't say which Camera you are using except it is a Canon but use this Plugin and see if it works. It outputs DNG files and does NOT change your original CR2 so you will have to use the DNG in Lightroom to see the full image.
Plug-ins for Adobe Photoshop Lightroom | Adobe Labs -
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. -
Custom Function in a Sequence Not Working
Hi All,
We have defined a Custom Function and it has got a class (ZCL_IP_DERIVE_XXX_XXXX).
Further, in the IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~EXECUTE method of this class, we have defined a logic of appying a new Index (Sales Curve) and the forecast values are uplifted accordingly.
This Custom functon of Applying a new Index is one od the step in a Planning Sequence.
When I try to execute only the step of applying function in the modeler, I get the output as required and I can see them accurate in the trace.
But If I execute the entire sequence either step by step or at one go, the function is not applied. In the messages, it says step1 to 7 are executed. But there is no change done to the records read.
I doubt the values written back in the function are refreshed as soon as the come out of the step. Correct me if I am wrong.
The Values are read and written abck to the table C_TH_DATA.
Are we populating the right table? Do let me know if I need to change anything in the sequence.
Regards,
HarikaThanks for your replies.
As suggested, the problem was with in the sequence as in the step before the function is applied, they are getting deleted...smll change in the code fixed the issue.
But now, when I try to run the same sequence on a button in a workbook, it doesnt work.
I checked the sequence behind the button. it is assosciated with the same one defined.
But no clue why it doesnt work.
Also, please let me know if there is any option to unhide the fields on the workbook in design mode.
Regards,
Harika
Maybe you are looking for
-
Will Not Copy After Being Idle
THIS IS A COPYING ISSUE!!! After installing the upgraded version of Comcast's latest modem/router, our HP 6550 would not print. I contacted Comcast and reported the difficulty and they informed me it was a printer problem - not their new modem. Co
-
Hi We have open PO for which we would like to list the PO that are not delivered completly yet. We are using me2l for PO`s with selection parameter open invoices. Is there a functionality or other reports (PO`s with delivery 5 days late, 10 days la
-
Just downloaded newest FireFox 16.x I am using organization specific membership database I have full access rights. I can use main menus on the screen and open a member record but FireFox no longer opens tabbed pages (screens) inside the player recor
-
Forced *^$$#% Line Returns!
I have suffered this problem for too long now. It is in just about everything I do, web design, blog editors what have you. I would guess 90% of the time I do not want a line return after I type a word or phrase. Back in my FRONTPAGE days I got aroun
-
Restrict Goods Recipient Field in MIGO "MSEG-WEMPF" to 10 Characteristics
Hi Experts, The field length of "Goods Recipient field - MSEG-WEMPF" in GR (MIGO Transaction) is 12. I need to restrict the user to enter only 10 characteristics for Goods Receipent field. If User Enters more than 10 characterisics system should thro