Last conditon type is not active in the pricing procedure

Hi gurus,
In the standard system, when there are multiple Condition types exists in the pricing procedure for the same condition class ( Example : Price) then the value of the last condition type should be active and rest all should be inactive. Where as in my case i have 4 pricing condition types , instead of last condition type 3rd condition type is being active. Can any one suggest what would be the reason for this and how to make sure that last condition type is set as active?

I found that as the condition value is less than the condition base value , even though conditon type was last in the list it was not set as active. This can be seen by selecting the condtion type in the pricing details and then click on the details icon ( Lens ) .

Similar Messages

  • Resource com.sap.aii.af.svc with type service, not active on the server

    Hi Forum,
    in my X1 server, in rwb, it gave error:
    HTTP request failed. Error code: "503". Error message: "Service Unavailable [http://xyz:50000/AdapterFramework/rtc,
    on further analysis we find that:
    <b>  Application cannot be started.
      Details:   com.sap.engine.services.deploy.container.ExceptionInfo: Application sap.com/com.sap.xi.mdt cannot be started. Reason: it has hard reference to resource com.sap.aii.af.svc with type service, which is not active on the server.</b>
    and the service/component com.sap.aii.af.svc is not present as the error says,
    In visual admin, in the services list i couldnt find this particular resource,
    pls instruct me how to deploy/start this service com.sap.aii.af.svc ,

    Hi,
    Please check out the user authorization and role and also check that you are maintaining the passwords in all places where required.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • Condition Type  not displaying on the pricing procedure

    Hello We are copying a sales order contract with reference to a sales order but we want a condition on the contract pricing procedure to be determined. Now I know I could redetermine pricing by selecting these option but we can't do that as there could be  a year difference so we need the old pricing. B    Carry out new pricing C    Copy manual pricing elements and redetermine the others e.g. Sales Order  Pricing Procedure XXXX                         Conditions ZPR0                          Conditions ZHD1 Create Contract with reference to sales order    Contract  Pricing Procedure yyyyy                         Conditions ZPR0                          Conditions ZHD1                         Conditions ZNEW In the analysis the condition ZNEW has the "Condition without condition record (not relevant)" As I mention in new pricing it appears   

    Hi Roy,
    Trust you are doing good,
    I have gone through the question which you have asked but its not clear what do you want to exactly do.
    Pricing Procedure XXXX                         Conditions ZPR0                          Conditions ZHD1 Create Contract with reference to sales order    Contract  Pricing Procedure yyyyy                         Conditions
    Here you talking about two different pricing procedures..or you talking in terms of pricing values.
    Please highlight.
    Thank you,
    Regards
    SRT

  • Varient condition is not picked in the pricing procedure.

    Dear Friends,
                        I am creating a sales order where, I am getting a message that VA00 condition is not determined. I analyze the pricing,and find out that the condition record is not determined by the system. Message number is 106. I already maintained the condition record for VA00. 
    Thanks,
    Abhishek Kumar

    Hi,
    Only if you have created the variant and assigned the same in VK11 then the system will fetch that during pricing
    otherwise for VA00 manual entries has a priority so you can add the condtion type manually and give the value to it manually.

  • Step number in the pricing procedure

    Hi experts,
    Pls advise the reasons. How to solve them without changing the step number?
    Q1: As long as HM00 is the first step number in the pricing procedure, the value of HM00 cannot be distributed among items.
    Example:
    Pricing procedure:
    step no.         conditon type
    10                      HM00 (statistical)
    30                      NETW (ERL)
    Sales order (HM00 = $100):
    item 1     NETW = 0
    item 2     NETW = $100
    Q2: When putting a conditon type between PR00 & subtotal in the pricing procedure, such as VPRS, the value of subtotal cannot be the same as PR00.
    Example of sales order:
    PR00 (unit price) = $19.95 per 10kg
    VPRS (internal price) = $10 per 1kg
    subtotal = $2 per 1kg
    Request: PR00 = subtotal = $19.95 per 10kg

    hello, cathy.
    i do not have access to my references now, but please allow me to advance a general concept.
    in SAP standard, HM00 is a group condition, and fixed value.  the distribution of this value is controlled by certain logic.  as in other header condition types, distribution of this amount can be based on either the value or quantity contribution of the different sales order items. 
    what serves as the basis for distribution of HM00, i do not recall but i will get back to you on this... or perhaps another consultant can give it sooner.
    as to your second issue, i will try to understand your situation better.  but generally VPRS is statitical and not meant to come between PR00 and the sub-total.  VPRS has a different logic compared to the other condition types, and is intended to return a statistical presentation of profit margin in the condition tabs.  if fact, in pricing procedure RVAA01 you will notice that VPRS is grouped with the other statistical condition types just before the profit margin.
    regards.

  • Explain the Pricing Procedure

    Hi Friends
    Explain how the pricing is determined for an item, starting from the sales order
    Discuss the full cycle also make a mention  on  the Condition type controls, and Maintain pricing procedure controls.
    Kindly explain it with an example.
    Thanks

    Pricing Procedure is indeed an heart of SD module, reason being if everything else is working fine, but price is not being calculated correctly, the purpose of billing fails.
    An Overview of Determination & Configuration of Pricing Procedure is as follows:
    In SD, Pricing Procedure is determined based on Sales Area (Sales Organization + Distribution Centre + Division) + Customer Pricing Procedure + Document Pricing Procedure. Sales Area is determined in Sales Order Header Level. Customer Pricing Procedure is determined from Customer Master. Document Pricing Procedure is determined from Sales Document Type / Billing Type (if configured). Once the pricing procedure is determined, Condition records are fetched. If appropriate condition records are found, the price is determined. If Mandatory pricing condition is missing, system will through an error message.
    In SD, the steps to configure Pricing procedure are as under:
    Step 1:
    Condition table: If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in spro as follows: IMG -> Sales & Distribution -> Basic Function -> Pricing Control -> Condition Table (select the required fields combination, which will store condition record).
    Step 2:
    Access Sequence: If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in spro as follows: IMG -> Sales & Distribution -> Basic Function -> Pricing Control -> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
    Step 3:
    Condition Type: If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in spro as follows: IMG -> Sales & Distribution -> Basic Function -> Pricing Control -> Condition Type. It is always recommended to copy an existing similar condition type & make the neccessary changes. Here we assign Access sequence to Condition type.
    Step 4:
    a. Pricing Procedure: It is recommended to copy a similar pricing procedure & make the neccesary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in spro as follows: IMG -> Sales & Distribution -> Basic Function -> Pricing Control -> Pricing Procedure --> Maintain Pricing Procedure.
    b. Pricing Procedure: After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG -> Sales & Distribution -> Basic Function -> Pricing Control -> Pricing Procedure --> Determine Pricing Procedure.
    Step 5: Condition record: Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc.

  • BACKUP LOG suddenly failed with Msg 35250, Level 16, State 11 The connection to the primary replica is not active. The command cannot be processed.

    I have AlwaysOn SQL 2012 Enterprise set-up using Windows Failover Clustering Services (not FCI), and have 1 Primary node (P), 1 Synchronous Commit Auto Failover (SC), and 1 Asynchronous Commit Manual Failover (AC) node.  It is set up to prefer secondary,
    with the highest priority given to AC node.
    I am using Ola Hollengren's scripts for Database Maintenance jobs, including a native BACKUP LOG job for the transaction logs of all user databases on a 1 minute schedule.  His scripts already consider AlwaysOn, and although the job is set-up on all
    3 nodes, only ever runs on AC node.
    The job has been running successfully since initial set-up almost 1 year ago, but suddenly yesterday morning started to fail with the following error, only on 1 of the 13 databases in my availability group:
    Date and time: 2014-06-08 09:36:11
    Command: BACKUP LOG [my_db] TO DISK = N'E:\MSSQL\\Transaction Dumps\my_db\MySQLCL$MySQLAG_my_db_20140608_093610_U_LOG.trn' WITH CHECKSUM, COMPRESSION
    Msg 35250, Level 16, State 11, Server AC, Line 1
    The connection to the primary replica is not active.  The command cannot be processed.
    Msg 3013, Level 16, State 1, Server AC, Line 1
    BACKUP LOG is terminating abnormally.
    Outcome: Failed
    Duration: 00:01:00
    The other 12 databases continued to backup successfully.
    Checking the Availability Group dashboard, windows event logs, and SQL Server error logs, including Failover Cluster events showed no issues.
    However, monitoring software (Idera SQLdm) showed blocked sessions on P node.  When I ran sp_who2, it showed that a background process was being blocked by another background process with an HADR BACKUP LOCK.
    Since both processes were background processes, I was unable to kill either process.  I temporarily disabled the transaction log backup job, but the blocked process was still active.
    I ran DBCC CHECKDB (my_db) WITH all_errormsgs, no_infomsgs, data_purity on both P and AC nodes, with no errors.  However, on AC node, it also showed 1 transaction rolled forward and 0 transactions rolled back.  This also had the effect of releasing
    the blocked background process, but another background process was now blocking with the same HADR BACKUP LOCK.
    I tried to restart SQL Server Agent on AC node, which did not immediately seem to work.  However, after a few minutes, I noticed that the block had disappeared.  I re-enabled the transaction log backup job on AC and it started working normally
    again.  The error has not occurred again, but I am at a loss as to what happened, and how to prevent it from happening again.
    Any help would be greatly appreciated.
    Diane

    And here is part 2 of the stored procedure:
    --// Execute backup commands //--
    WHILE EXISTS (SELECT * FROM @tmpDatabases WHERE Selected = 1 AND Completed = 0)
    BEGIN
    SELECT TOP 1 @CurrentDBID = ID,
    @CurrentDatabaseName = DatabaseName,
    @CurrentDatabaseNameFS = DatabaseNameFS,
    @CurrentDatabaseType = DatabaseType
    FROM @tmpDatabases
    WHERE Selected = 1
    AND Completed = 0
    ORDER BY ID ASC
    SET @CurrentDatabaseID = DB_ID(@CurrentDatabaseName)
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    IF EXISTS (SELECT * FROM sys.database_recovery_status WHERE database_id = @CurrentDatabaseID AND database_guid IS NOT NULL)
    BEGIN
    SET @CurrentIsDatabaseAccessible = 1
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    END
    ELSE
    BEGIN
    SET @CurrentIsDatabaseAccessible = 0
    END
    SELECT @CurrentDifferentialBaseLSN = differential_base_lsn
    FROM sys.master_files
    WHERE database_id = @CurrentDatabaseID
    AND [type] = 0
    AND [file_id] = 1
    -- Workaround for a bug in SQL Server 2005
    IF @Version >= 9 AND @Version < 10
    AND EXISTS(SELECT * FROM sys.master_files WHERE database_id = @CurrentDatabaseID AND [type] = 0 AND [file_id] = 1 AND differential_base_lsn IS NOT NULL AND differential_base_guid IS NOT NULL AND differential_base_time IS NULL)
    BEGIN
    SET @CurrentDifferentialBaseLSN = NULL
    END
    SELECT @CurrentDifferentialBaseIsSnapshot = is_snapshot
    FROM msdb.dbo.backupset
    WHERE database_name = @CurrentDatabaseName
    AND [type] = 'D'
    AND checkpoint_lsn = @CurrentDifferentialBaseLSN
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    BEGIN
    SELECT @CurrentLogLSN = last_log_backup_lsn
    FROM sys.database_recovery_status
    WHERE database_id = @CurrentDatabaseID
    END
    SET @CurrentBackupType = @BackupType
    IF @ChangeBackupType = 'Y'
    BEGIN
    IF @CurrentBackupType = 'LOG' AND DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') <> 'SIMPLE' AND @CurrentLogLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'DIFF'
    END
    IF @CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL AND @CurrentDatabaseName <> 'master'
    BEGIN
    SET @CurrentBackupType = 'FULL'
    END
    END
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SELECT @CurrentLatestBackup = MAX(backup_finish_date)
    FROM msdb.dbo.backupset
    WHERE [type] IN('D','I')
    AND is_damaged = 0
    AND database_name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL
    BEGIN
    SELECT @CurrentAvailabilityGroup = availability_groups.name,
    @CurrentAvailabilityGroupRole = dm_hadr_availability_replica_states.role_desc
    FROM sys.databases databases
    INNER JOIN sys.availability_databases_cluster availability_databases_cluster ON databases.group_database_id = availability_databases_cluster.group_database_id
    INNER JOIN sys.availability_groups availability_groups ON availability_databases_cluster.group_id = availability_groups.group_id
    INNER JOIN sys.dm_hadr_availability_replica_states dm_hadr_availability_replica_states ON availability_groups.group_id = dm_hadr_availability_replica_states.group_id AND databases.replica_id = dm_hadr_availability_replica_states.replica_id
    WHERE databases.name = @CurrentDatabaseName
    END
    IF @Version >= 11 AND @Cluster IS NOT NULL AND @CurrentAvailabilityGroup IS NOT NULL
    BEGIN
    SELECT @CurrentIsPreferredBackupReplica = sys.fn_hadr_backup_is_preferred_replica(@CurrentDatabaseName)
    END
    SELECT @CurrentDatabaseMirroringRole = UPPER(mirroring_role_desc)
    FROM sys.database_mirroring
    WHERE database_id = @CurrentDatabaseID
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_primary_databases WHERE primary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'PRIMARY'
    END
    ELSE
    IF EXISTS (SELECT * FROM msdb.dbo.log_shipping_secondary_databases WHERE secondary_database = @CurrentDatabaseName)
    BEGIN
    SET @CurrentLogShippingRole = 'SECONDARY'
    END
    -- Set database message
    SET @DatabaseMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Database: ' + QUOTENAME(@CurrentDatabaseName) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Status: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Standby: ' + CASE WHEN DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Updateability: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Updateability') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'User access: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') AS nvarchar) + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Is accessible: ' + CASE WHEN @CurrentIsDatabaseAccessible = 1 THEN 'Yes' ELSE 'No' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Recovery model: ' + CAST(DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') AS nvarchar) + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group: ' + @CurrentAvailabilityGroup + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Availability group role: ' + @CurrentAvailabilityGroupRole + CHAR(13) + CHAR(10)
    IF @CurrentAvailabilityGroup IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Is preferred backup replica: ' + CASE WHEN @CurrentIsPreferredBackupReplica = 1 THEN 'Yes' WHEN @CurrentIsPreferredBackupReplica = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    IF @CurrentDatabaseMirroringRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Database mirroring role: ' + @CurrentDatabaseMirroringRole + CHAR(13) + CHAR(10)
    IF @CurrentLogShippingRole IS NOT NULL SET @DatabaseMessage = @DatabaseMessage + 'Log shipping role: ' + @CurrentLogShippingRole + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base LSN: ' + ISNULL(CAST(@CurrentDifferentialBaseLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Differential base is snapshot: ' + CASE WHEN @CurrentDifferentialBaseIsSnapshot = 1 THEN 'Yes' WHEN @CurrentDifferentialBaseIsSnapshot = 0 THEN 'No' ELSE 'N/A' END + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = @DatabaseMessage + 'Last log backup LSN: ' + ISNULL(CAST(@CurrentLogLSN AS nvarchar),'N/A') + CHAR(13) + CHAR(10)
    SET @DatabaseMessage = REPLACE(@DatabaseMessage,'%','%%') + ' '
    RAISERROR(@DatabaseMessage,10,1) WITH NOWAIT
    IF DATABASEPROPERTYEX(@CurrentDatabaseName,'Status') = 'ONLINE'
    AND NOT (DATABASEPROPERTYEX(@CurrentDatabaseName,'UserAccess') = 'SINGLE_USER' AND @CurrentIsDatabaseAccessible = 0)
    AND DATABASEPROPERTYEX(@CurrentDatabaseName,'IsInStandBy') = 0
    AND NOT (@CurrentBackupType = 'LOG' AND (DATABASEPROPERTYEX(@CurrentDatabaseName,'Recovery') = 'SIMPLE' OR @CurrentLogLSN IS NULL))
    AND NOT (@CurrentBackupType = 'DIFF' AND @CurrentDifferentialBaseLSN IS NULL)
    AND NOT (@CurrentBackupType IN('DIFF','LOG') AND @CurrentDatabaseName = 'master')
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'N' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'FULL' AND @CopyOnly = 'Y' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'DIFF' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'N' AND (@CurrentIsPreferredBackupReplica <> 1 OR @CurrentIsPreferredBackupReplica IS NULL))
    AND NOT (@CurrentAvailabilityGroup IS NOT NULL AND @CurrentBackupType = 'LOG' AND @CopyOnly = 'Y' AND (@CurrentAvailabilityGroupRole <> 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL))
    AND NOT ((@CurrentLogShippingRole = 'PRIMARY' AND @CurrentLogShippingRole IS NOT NULL) AND @CurrentBackupType = 'LOG')
    BEGIN
    -- Set variables
    SET @CurrentDate = GETDATE()
    IF @CleanupTime IS NULL OR (@CurrentBackupType = 'LOG' AND @CurrentLatestBackup IS NULL) OR @CurrentBackupType <> @BackupType
    BEGIN
    SET @CurrentCleanupDate = NULL
    END
    ELSE
    IF @CurrentBackupType = 'LOG'
    BEGIN
    SET @CurrentCleanupDate = (SELECT MIN([Date]) FROM(SELECT DATEADD(hh,-(@CleanupTime),@CurrentDate) AS [Date] UNION SELECT @CurrentLatestBackup AS [Date]) Dates)
    END
    ELSE
    BEGIN
    SET @CurrentCleanupDate = DATEADD(hh,-(@CleanupTime),@CurrentDate)
    END
    SELECT @CurrentFileExtension = CASE
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware IS NULL AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'FULL' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'DIFF' THEN 'bak'
    WHEN @BackupSoftware = 'LITESPEED' AND @CurrentBackupType = 'LOG' THEN 'trn'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'FULL' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'DIFF' THEN 'sqb'
    WHEN @BackupSoftware = 'SQLBACKUP' AND @CurrentBackupType = 'LOG' THEN 'sqb'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'N' THEN 'hbc'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'FULL' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'DIFF' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'HYPERBAC' AND @CurrentBackupType = 'LOG' AND @Encrypt = 'Y' THEN 'hbe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'FULL' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'DIFF' THEN 'safe'
    WHEN @BackupSoftware = 'SQLSAFE' AND @CurrentBackupType = 'LOG' THEN 'safe'
    END
    INSERT INTO @CurrentDirectories (ID, DirectoryPath, CreateCompleted, CleanupCompleted)
    SELECT ROW_NUMBER() OVER (ORDER BY ID), DirectoryPath + CASE WHEN RIGHT(DirectoryPath,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END, 0, 0
    FROM @Directories
    ORDER BY ID ASC
    SET @CurrentFileNumber = 0
    SET @CurrentMirrorFilePath = NULL
    WHILE @CurrentFileNumber < @NumberOfFiles
    BEGIN
    SET @CurrentFileNumber = @CurrentFileNumber + 1
    SELECT @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE @CurrentFileNumber >= (ID - 1) * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories) + 1
    AND @CurrentFileNumber <= ID * (SELECT @NumberOfFiles / COUNT(*) FROM @CurrentDirectories)
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentFilePath = @CurrentDirectoryPath + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    IF @CurrentFileNumber = 1 AND LEN(@MirrorDirectory) > 0
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + @CurrentDatabaseNameFS + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    IF LEN(@CurrentFilePath) > 257
    BEGIN
    SET @CurrentMirrorFilePath = @MirrorDirectory + CASE WHEN RIGHT(@MirrorDirectory,1) = '\' THEN '' ELSE '\' END + CASE WHEN @CurrentBackupType = 'LOG' THEN '\Transaction Dumps\' + @CurrentDatabaseNameFS ELSE '' END + '\' + CASE WHEN @CurrentAvailabilityGroup IS NOT NULL THEN @Cluster + '$' + @CurrentAvailabilityGroup ELSE REPLACE(CAST(SERVERPROPERTY('servername') AS nvarchar),'\','$') END + '_' + LEFT(@CurrentDatabaseNameFS,CASE WHEN (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) < 20 THEN 20 ELSE (LEN(@CurrentDatabaseNameFS) + 257 - LEN(@CurrentFilePath) - 3) END) + '...' + '_' + REPLACE(REPLACE(REPLACE((CONVERT(nvarchar,@CurrentDate,120)),'-',''),' ','_'),':','') + CASE WHEN @NumberOfFiles > 1 AND @NumberOfFiles <= 9 THEN '_' + CAST(@CurrentFileNumber AS nvarchar) WHEN @NumberOfFiles >= 10 THEN '_' + RIGHT('0' + CAST(@CurrentFileNumber AS nvarchar),2) ELSE '' END + '_' + @CurrentDatabaseType + '_' + UPPER(@CurrentBackupType) + CASE WHEN @ReadWriteFileGroups = 'Y' THEN '_PARTIAL' ELSE '' END + CASE WHEN @CopyOnly = 'Y' THEN '_COPY_ONLY' ELSE '' END + '.' + @CurrentFileExtension
    END
    END
    INSERT INTO @CurrentFiles (CurrentFilePath)
    SELECT @CurrentFilePath
    SET @CurrentDirectoryPath = NULL
    SET @CurrentFilePath = NULL
    END
    -- Create directory
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CreateCompleted = 0
    ORDER BY ID ASC
    SET @CurrentCommandType01 = 'xp_create_subdir'
    SET @CurrentCommand01 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_create_subdir N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''' IF @ReturnCode <> 0 RAISERROR(''Error creating directory.'', 16, 1)'
    EXECUTE @CurrentCommandOutput01 = [dbo].[CommandExecute] @Command = @CurrentCommand01, @CommandType = @CurrentCommandType01, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput01 = @Error
    IF @CurrentCommandOutput01 <> 0 SET @ReturnCode = @CurrentCommandOutput01
    UPDATE @CurrentDirectories
    SET CreateCompleted = 1,
    CreateOutput = @CurrentCommandOutput01
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand01 = NULL
    SET @CurrentCommandOutput01 = NULL
    SET @CurrentCommandType01 = NULL
    END
    -- Perform a backup
    IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE CreateOutput <> 0 OR CreateOutput IS NULL)
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP_DATABASE'
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP_LOG'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @Compress = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION'
    IF @Compress = 'N' AND @Version >= 10 SET @CurrentCommand02 = @CurrentCommand02 + ', NO_COMPRESSION'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SELECT @CurrentCommandType02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'xp_backup_database'
    WHEN @CurrentBackupType = 'LOG' THEN 'xp_backup_log'
    END
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_database @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    WHEN @CurrentBackupType = 'LOG' THEN 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_backup_log @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    END
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    SET @CurrentCommand02 = @CurrentCommand02 + ''''
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @read_write_filegroups = 1'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CAST(@CompressionLevel AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @buffercount = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @maxtransfersize = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Throttle IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @throttle = ' + CAST(@Throttle AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @cryptlevel = ' + CASE
    WHEN @EncryptionType = 'RC2-40' THEN '0'
    WHEN @EncryptionType = 'RC2-56' THEN '1'
    WHEN @EncryptionType = 'RC2-112' THEN '2'
    WHEN @EncryptionType = 'RC2-128' THEN '3'
    WHEN @EncryptionType = '3DES-168' THEN '4'
    WHEN @EncryptionType = 'RC4-128' THEN '5'
    WHEN @EncryptionType = 'AES-128' THEN '6'
    WHEN @EncryptionType = 'AES-192' THEN '7'
    WHEN @EncryptionType = 'AES-256' THEN '8'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType02 = 'sqlbackup'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', COMPRESSION = ' + CAST(@CompressionLevel AS nvarchar)
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', THREADCOUNT = ' + CAST(@Threads AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', KEYSIZE = ' + CASE
    WHEN @EncryptionType = 'AES-128' THEN '128'
    WHEN @EncryptionType = 'AES-256' THEN '256'
    END
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand02,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType02 = 'BACKUP_DATABASE'
    SELECT @CurrentCommand02 = CASE
    WHEN @CurrentBackupType IN('DIFF','FULL') THEN 'BACKUP DATABASE ' + QUOTENAME(@CurrentDatabaseName)
    WHEN @CurrentBackupType = 'LOG' THEN 'BACKUP LOG ' + QUOTENAME(@CurrentDatabaseName)
    END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ' READ_WRITE_FILEGROUPS'
    SET @CurrentCommand02 = @CurrentCommand02 + ' TO'
    SELECT @CurrentCommand02 = @CurrentCommand02 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand02 = @CurrentCommand02 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand02 = @CurrentCommand02 + 'NO_CHECKSUM'
    IF @CurrentBackupType = 'DIFF' SET @CurrentCommand02 = @CurrentCommand02 + ', DIFFERENTIAL'
    IF @CopyOnly = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', COPY_ONLY'
    IF @BlockSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BLOCKSIZE = ' + CAST(@BlockSize AS nvarchar)
    IF @BufferCount IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar)
    IF @MaxTransferSize IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', MAXTRANSFERSIZE = ' + CAST(@MaxTransferSize AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + ''''
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType02 = 'xp_ss_backup'
    SET @CurrentCommand02 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_backup @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand02 = @CurrentCommand02 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    IF @CurrentMirrorFilePath IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @mirrorfile = N''' + @CurrentMirrorFilePath + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ', @backuptype = ' + CASE WHEN @CurrentBackupType = 'FULL' THEN '''Full''' WHEN @CurrentBackupType = 'DIFF' THEN '''Differential''' WHEN @CurrentBackupType = 'LOG' THEN '''Log''' END
    IF @ReadWriteFileGroups = 'Y' SET @CurrentCommand02 = @CurrentCommand02 + ', @readwritefilegroups = 1'
    SET @CurrentCommand02 = @CurrentCommand02 + ', @checksum = ' + CASE WHEN @CheckSum = 'Y' THEN '1' WHEN @CheckSum = 'N' THEN '0' END
    SET @CurrentCommand02 = @CurrentCommand02 + ', @copyonly = ' + CASE WHEN @CopyOnly = 'Y' THEN '1' WHEN @CopyOnly = 'N' THEN '0' END
    IF @CompressionLevel IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @compressionlevel = ' + CASE WHEN @CompressionLevel = 5 THEN N'ispeed' WHEN @CompressionLevel = 6 THEN N'isize' ELSE CAST(@CompressionLevel AS nvarchar) END
    IF @RetryWrites IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @retrywrites = N''' + @RetryWrites + ''''
    IF @Threads IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @threads = ' + CAST(@Threads AS nvarchar)
    IF @Description IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @desc = N''' + REPLACE(@Description,'''','''''') + ''''
    IF @EncryptionType IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptiontype = N''' + CASE
    WHEN @EncryptionType = 'AES-128' THEN 'AES128'
    WHEN @EncryptionType = 'AES-256' THEN 'AES256'
    END + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand02 = @CurrentCommand02 + ', @encryptedbackuppassword = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand02 = @CurrentCommand02 + ' IF @ReturnCode <> 0 RAISERROR(''Error performing SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput02 = [dbo].[CommandExecute] @Command = @CurrentCommand02, @CommandType = @CurrentCommandType02, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput02 = @Error
    IF @CurrentCommandOutput02 <> 0 SET @ReturnCode = @CurrentCommandOutput02
    END
    -- Verify the backup
    IF @CurrentCommandOutput02 = 0 AND @Verify = 'Y'
    BEGIN
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType03 = 'xp_restore_verifyonly'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_restore_verifyonly'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' @filename = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ', @with = '''
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    SET @CurrentCommand03 = @CurrentCommand03 + ''''
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', @encryptionkey = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying LiteSpeed backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType03 = 'sqlbackup'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    IF @EncryptionKey IS NOT NULL SET @CurrentCommand03 = @CurrentCommand03 + ', PASSWORD = N''' + REPLACE(@EncryptionKey,'''','''''') + ''''
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqlbackup N''-SQL "' + REPLACE(@CurrentCommand03,'''','''''') + '"''' + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLBackup backup.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType03 = 'RESTORE_VERIFYONLY'
    SET @CurrentCommand03 = 'RESTORE VERIFYONLY FROM'
    SELECT @CurrentCommand03 = @CurrentCommand03 + ' DISK = N''' + REPLACE(CurrentFilePath,'''','''''') + '''' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) <> @NumberOfFiles THEN ',' ELSE '' END
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' WITH '
    IF @CheckSum = 'Y' SET @CurrentCommand03 = @CurrentCommand03 + 'CHECKSUM'
    IF @CheckSum = 'N' SET @CurrentCommand03 = @CurrentCommand03 + 'NO_CHECKSUM'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType03 = 'xp_ss_verify'
    SET @CurrentCommand03 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_verify @database = N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''''
    SELECT @CurrentCommand03 = @CurrentCommand03 + ', ' + CASE WHEN ROW_NUMBER() OVER (ORDER BY CurrentFilePath ASC) = 1 THEN '@filename' ELSE '@backupfile' END + ' = N''' + REPLACE(CurrentFilePath,'''','''''') + ''''
    FROM @CurrentFiles
    ORDER BY CurrentFilePath ASC
    SET @CurrentCommand03 = @CurrentCommand03 + ' IF @ReturnCode <> 0 RAISERROR(''Error verifying SQLsafe backup.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput03 = [dbo].[CommandExecute] @Command = @CurrentCommand03, @CommandType = @CurrentCommandType03, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput03 = @Error
    IF @CurrentCommandOutput03 <> 0 SET @ReturnCode = @CurrentCommandOutput03
    END
    -- Delete old backup files
    IF (@CurrentCommandOutput02 = 0 AND @Verify = 'N' AND @CurrentCleanupDate IS NOT NULL)
    OR (@CurrentCommandOutput02 = 0 AND @Verify = 'Y' AND @CurrentCommandOutput03 = 0 AND @CurrentCleanupDate IS NOT NULL)
    BEGIN
    WHILE EXISTS (SELECT * FROM @CurrentDirectories WHERE CleanupCompleted = 0)
    BEGIN
    SELECT TOP 1 @CurrentDirectoryID = ID,
    @CurrentDirectoryPath = DirectoryPath
    FROM @CurrentDirectories
    WHERE CleanupCompleted = 0
    ORDER BY ID ASC
    IF @BackupSoftware IS NULL
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'LITESPEED'
    BEGIN
    SET @CurrentCommandType04 = 'xp_slssqlmaint'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_slssqlmaint N''-MAINTDEL -DELFOLDER "' + REPLACE(@CurrentDirectoryPath,'''','''''') + '" -DELEXTENSION "' + @CurrentFileExtension + '" -DELUNIT "' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + '" -DELUNITTYPE "minutes" -DELUSEAGE'' IF @ReturnCode <> 0 RAISERROR(''Error deleting LiteSpeed backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLBACKUP'
    BEGIN
    SET @CurrentCommandType04 = 'sqbutility'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.sqbutility 1032, N''' + REPLACE(@CurrentDatabaseName,'''','''''') + ''', N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + CASE WHEN @CurrentBackupType = 'FULL' THEN 'D' WHEN @CurrentBackupType = 'DIFF' THEN 'I' WHEN @CurrentBackupType = 'LOG' THEN 'L' END + ''', ''' + CAST(DATEDIFF(hh,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'h'', ' + ISNULL('''' + REPLACE(@EncryptionKey,'''','''''') + '''','NULL') + ' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLBackup backup files.'', 16, 1)'
    END
    IF @BackupSoftware = 'HYPERBAC'
    BEGIN
    SET @CurrentCommandType04 = 'xp_delete_file'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_delete_file 0, N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + ''', ''' + @CurrentFileExtension + ''', ''' + CONVERT(nvarchar(19),@CurrentCleanupDate,126) + ''' IF @ReturnCode <> 0 RAISERROR(''Error deleting files.'', 16, 1)'
    END
    IF @BackupSoftware = 'SQLSAFE'
    BEGIN
    SET @CurrentCommandType04 = 'xp_ss_delete'
    SET @CurrentCommand04 = 'DECLARE @ReturnCode int EXECUTE @ReturnCode = [master].dbo.xp_ss_delete @filename = N''' + REPLACE(@CurrentDirectoryPath,'''','''''') + '\*.' + @CurrentFileExtension + ''', @age = ''' + CAST(DATEDIFF(mi,@CurrentCleanupDate,GETDATE()) + 1 AS nvarchar) + 'Minutes'' IF @ReturnCode <> 0 RAISERROR(''Error deleting SQLsafe backup files.'', 16, 1)'
    END
    EXECUTE @CurrentCommandOutput04 = [dbo].[CommandExecute] @Command = @CurrentCommand04, @CommandType = @CurrentCommandType04, @Mode = 1, @DatabaseName = @CurrentDatabaseName, @LogToTable = @LogToTable, @Execute = @Execute
    SET @Error = @@ERROR
    IF @Error <> 0 SET @CurrentCommandOutput04 = @Error
    IF @CurrentCommandOutput04 <> 0 SET @ReturnCode = @CurrentCommandOutput04
    UPDATE @CurrentDirectories
    SET CleanupCompleted = 1,
    CleanupOutput = @CurrentCommandOutput04
    WHERE ID = @CurrentDirectoryID
    SET @CurrentDirectoryID = NULL
    SET @CurrentDirectoryPath = NULL
    SET @CurrentCommand04 = NULL
    SET @CurrentCommandOutput04 = NULL
    SET @CurrentCommandType04 = NULL
    END
    END
    END
    -- Update that the database is completed
    UPDATE @tmpDatabases
    SET Completed = 1
    WHERE Selected = 1
    AND Completed = 0
    AND ID = @CurrentDBID
    -- Clear variables
    SET @CurrentDBID = NULL
    SET @CurrentDatabaseID = NULL
    SET @CurrentDatabaseName = NULL
    SET @CurrentBackupType = NULL
    SET @CurrentFileExtension = NULL
    SET @CurrentFileNumber = NULL
    SET @CurrentDifferentialBaseLSN = NULL
    SET @CurrentDifferentialBaseIsSnapshot = NULL
    SET @CurrentLogLSN = NULL
    SET @CurrentLatestBackup = NULL
    SET @CurrentDatabaseNameFS = NULL
    SET @CurrentDatabaseType = NULL
    SET @CurrentDate = NULL
    SET @CurrentCleanupDate = NULL
    SET @CurrentIsDatabaseAccessible = NULL
    SET @CurrentAvailabilityGroup = NULL
    SET @CurrentAvailabilityGroupRole = NULL
    SET @CurrentIsPreferredBackupReplica = NULL
    SET @CurrentDatabaseMirroringRole = NULL
    SET @CurrentLogShippingRole = NULL
    SET @CurrentCommand02 = NULL
    SET @CurrentCommand03 = NULL
    SET @CurrentCommandOutput02 = NULL
    SET @CurrentCommandOutput03 = NULL
    SET @CurrentCommandType02 = NULL
    SET @CurrentCommandType03 = NULL
    DELETE FROM @CurrentDirectories
    DELETE FROM @CurrentFiles
    END
    --// Log completing information //--
    Logging:
    SET @EndMessage = 'Date and time: ' + CONVERT(nvarchar,GETDATE(),120)
    SET @EndMessage = REPLACE(@EndMessage,'%','%%')
    RAISERROR(@EndMessage,10,1) WITH NOWAIT
    IF @ReturnCode <> 0
    BEGIN
    RETURN @ReturnCode
    END
    END
    GO
    ALTER AUTHORIZATION ON [dbo].[DatabaseBackup] TO SCHEMA OWNER
    GO
    Diane

  • I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which als

    I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which also appears in the place of each clip in the video.  I tried uninstalling and reinstalling premiere elements 10, but that did not have any effect on the video.  Do you have any suggestions?  I researched codec, but do not understand them at all.

    gloucester
    In case you did not find it, the following is a copy/paste of the Announcement on Premiere Elements 19/NVIDIA GeForce
    that appears at the top of this forum.
    Premiere Elements 10 NVIDIA Video Card Driver Roll Back
    If you are a Premiere Elements 10 user whose Windows computer uses a NVIDIA GeForce video card and you are experiencing
    Premiere Elements 10 display and/or unexplained program behavior, then your first line of troubleshooting needs to be rolling
    back the video card driver version instead of assuring that it is up to date.
    Since October 2013 to the present, there have been a growing number of reports about display and unexplained workflow
    glitches specific to the Premiere Elements 10 user whose Windows computer has a NVIDIA GeForce video card. If this applies
    to you, then the “user to user” remedy is to roll back the NVIDIA GeForce video card driver as far as is necessary to get rid of
    the problems. The typical driver roll back has gone back as far as March – July 2013 in order to get a working Premiere
    Elements 10. Neither NVIDIA nor Adobe has taken any corrective action in this regard to date, and none is expected moving forward.
    Since October 2013, the following thread has tried to keep up with the Premiere Elements 10 NVIDIA reports
    http://forums.adobe.com/thread/1317675
    Older NVIDIA GeForce drivers can be found
    http://www.nvidia.com/Download/Find.aspx?lang=en-us
    A February 2014 overview of the situation as well as how to use the older NVIDIA GeForce drivers for the driver roll back can be found
    http://atr935.blogspot.com/2014/02/pe10-nvidia-video-card-roll-back.html
    ATR

  • I updated my iphone 3gs to ios 5.0.1 from ios 4 , now its saying that sim is not activated but the sim is still inside

    i updated my iphone 3gs to ios 5.0.1 from ios 4 , now its saying that sim is not activated but the sim is still inside
    PLSS HELP ME OUT !!!!

    Sounds like your phone was hacked to work with any network. Doing the update re-locked it to the original carrier. All you can do now is contact the carrier it is locked to to see if they have an unlocking policy. Note that if it's AT&T they do not offer unlocking. otherwise find an un-activated sim for the original carrier and you can use it as an iPod.

  • Some pages of my website are not active from the home page

    Built my website with iweb.  When I go to the site the tabs to all the pages show, but several of them are not active from the home page.  If I go to one of the active pages I can then click on the other pages.  Is there a way to fix this?  I've tried reloading the entire site, but several of the tabs remain inactive from the home page.  Any help would be greatly appreciate - Thanks,  Jodi

    Thanks Roddy - I tried moving it down and it didn't work - That line is in the Template I used to build the site and is on every page.  I did finally get the command A to work, but there's nothing covering those bottom three tabs.
    However, when I put my mouse in the area of the box where it has my name (the image you sent me above) it shows a link desktop/site/booker_files and I noticed I have one of the rss feed blue arrows, but I can't seem to delete it.  I wonder if that has something to do with it.  It does the same thing on the website if you hover with your mouse. 
    Truly appreciate your help.
    Jodi

  • CreativeCloud.exe doesn't work anymore. It seens to be not activated in the system tray.

    Hello and sorry for my english. My name is Jean-Pierre BRETHES and I have a problem with the creativecloud.exe program which doesn't want anymore to start. (since a while now) The icon in the system tray doesn't appear and it still to be gray (not red). When I clic to lunch the program nothing happen. When I try to reinstall it the download end by a windows "error 50" and everything is stopped.
    AT the beginning I wanted to download In design  program to try the PAO functionalities. Thank to help me. My email adress is <removed email - kglad>. Have a nice day. JP

    Hello and sorry for the delay. Thank you for your answer. I did what you wrote and everything is fine now. Really thank you for that. I fully understood regarding my email address in my message. I will not anymore do this error.
    Have a nice day.
    Sincerely, Jean-Pierre BRETHES
    De : kglad 
    Envoyé : dimanche 6 juillet 2014 23:33
    À : Jean Pierre BRETHES
    Objet :  CreativeCloud.exe doesn't work anymore. It seens to be not activated in the system tray.
    CreativeCloud.exe doesn't work anymore. It seens to be not activated in the system tray.
    created by kglad <https://forums.adobe.com/people/kglad>  in Downloading, Installing, Setting Up - View the full discussion <https://forums.adobe.com/message/6527054#6527054>

  • Problems Shared Services:Registered application is not active at the moment

    Hi!
    I have a problem with Hyperion Shared Services (HSS) and Hyperion Performance Socrecard (HPS), my projecto from HPS appears like if not it was registered in HSS.
    The error is: Registered application is not active at the moment. Please consult your system administrator.
    The information was migrated from other server, now already run configuration utility and configurate my proyect, but not appears in HSS.
    Optional: This is necessary for assign sercurity roles by Domain?
    Thank you very much.

    Did you get this resolved .
    Vinod

  • SSO logon not possible; logon tickets not activated on the server

    When I am on RWB
    1)  click "component monitoring" ->"display all"
    2) click "CCMS"
    I get a popup says:
    "SSO logon not possible; logon tickets not activated on the server"
    I find some threads about this on SDN but they are about
    EP. My case is PI7.0SP08.
    Please advise how to overcome this issue?
    Thanks w/ points.
    Message was edited by:
            jennifer lee

    hI,
    do you have the follwoing in our SXMB_ADM if not add them.
    SXMB_ADM->IntegrationEngine configuratin-> edit the speicifc configuratin then add the follwoing
    Category:RUNTIME Parameters: logging Value:1
    If its done. check this alos...whether your browser settings will accept the cookies or not. for SSO logon ticket method you need to have cookies accepted by our browser so check it. in internet page slect TOOLS ->internet options then ckeck for cookies settings.
    How to Enable Single-Sign-On for XI 3.0 at:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/69d95112-0d01-0010-8297-fa31feea26e0
    /people/alexander.bundschuh/blog/2007/01/16/principal-propagation-in-sap-xi
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5c/b7d53ae8ab9248e10000000a114084/content.htm
    regards
    manoj kumar

  • Registered application is not active at the moment.

    Two symtoms
    This happens with the Native Admin or any MSAD Shared Services admin.
    When in Shared Services - Right Click on Hyperion System 9 BI+ - the option to Assign Preference is not available
    Also when selecting the same project the following message -
    Registered application is not active at the moment. Please consult your system administrator.
    This is not of a case of it breaking. This was the symptom since the original installation.
    System 9.3.1 -
    Note - Regestering BI with Shared Services does an interesting thing - The menu appears to Assign Preference - but a page cannot be displayed also appears.
    When recycling services the menu option disappears again.
    Any thoughts?

    Hi,
    I have exactly the same error with a different external directory wich is Open LDAP.
    Did you get any answers or tips around this error ?
    Thanks,
    Gaël.

  • Registered application is not active at the moment. Please consult your sys

    Registered application is not active at the moment. Please consult your system administrator. This is what I often (and now) see when opening the default created application "Hyperion System 9 BI+:#####.intranet.######.nl:6800::1 BI+ 9.3.1 " under default created project "Hyperion System 9 BI+" in Shared Services. Even after restaring all the relevant services in the right sequence with the right delay I still got the message. Anyone an idea?

    Hi,
    I'm also interested in the answer, if you got it.
    Thanks,

Maybe you are looking for