Hard coding OIM attributes

Hi Experts
we have a requirement, Users is created in OIM through trusted Recon. For all the users created through recon, certain attributes need to be hard coded (these attributes are not present in Trusted source) and LDAP sync is also enabled in our environment. so these attributes should be updated with user creation only.
I want to know various options of achieving this requirement
Any help appreciated.
Regards
A Abhinay

Thanks for reply
We need to pass this values to OID through LDAP sync for recon users only.
We tried with post process event handler
[2012-03-30T12:02:24.058+02:00] [wls_oim1] [ERROR] [IAM-3010003] [oracle.iam.ldapsync.impl.eventhandlers.user] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 15dcd4762ac88ff7:-76b53ee5:1365f45a05d:-8000-0000000000000002,0] [APP: oim#11.1.1.3.0] Failed to execute the handler.[[
oracle.iam.platform.kernel.EventFailedException: Modification failed because user TESTUSER125 is not synchronized to the LDAP directory.
     at oracle.iam.ldapsync.impl.eventhandlers.user.UserModifyLDAPPreProcessHandler.modifyUser(UserModifyLDAPPreProcessHandler.java:162)
     at oracle.iam.ldapsync.impl.eventhandlers.user.UserModifyLDAPHandler.execute(UserModifyLDAPHandler.java:119)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runPreProcessEvents(OrchProcessData.java:898)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:634)
     at oracle.iam.platform.kernel.impl.OrchProcessData.executeEvents(OrchProcessData.java:227)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:665)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.process(OrchestrationEngineImpl.java:435)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:381)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:334)
     at oracle.iam.identity.usermgmt.impl.UserManagerImpl.modify(UserManagerImpl.java:896)
     at oracle.iam.identity.usermgmt.api.UserManagerEJB.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
     at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
     at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
     at $Proxy358.modifyx(Unknown Source)
     at oracle.iam.identity.usermgmt.api.UserManager_nimav7_UserManagerRemoteImpl.__WL_invoke(Unknown Source)
     at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
     at oracle.iam.identity.usermgmt.api.UserManager_nimav7_UserManagerRemoteImpl.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
     at $Proxy199.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
     at $Proxy323.modifyx(Unknown Source)
     at oracle.iam.identity.usermgmt.api.UserManagerDelegate.modify(Unknown Source)
     at com.doha.customeventhandler.DohaEDWAttributePostProcessEventHandler.execute(DohaEDWAttributePostProcessEventHandler.java:133)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runPostProcessEvents(OrchProcessData.java:1166)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:710)
     at oracle.iam.platform.kernel.impl.OrchProcessData.executeEvents(OrchProcessData.java:227)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:675)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:705)
     at oracle.iam.platform.kernel.impl.OrhestrationAsyncTask.execute(OrhestrationAsyncTask.java:108)
     at oracle.iam.platform.async.impl.TaskExecutor.executeUnmanagedTask(TaskExecutor.java:100)
     at oracle.iam.platform.async.impl.TaskExecutor.execute(TaskExecutor.java:70)
     at oracle.iam.platform.async.messaging.MessageReceiver.onMessage(MessageReceiver.java:68)
     at sun.reflect.GeneratedMethodAccessor3380.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
     at $Proxy347.onMessage(Unknown Source)
     at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:574)
     at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
     at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:380)
     at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
     at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
     at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3822)
     at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
     at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
     at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
[2012-03-30T12:02:24.059+02:00] [wls_oim1] [NOTIFICATION] [IAM-0080006] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 15dcd4762ac88ff7:-76b53ee5:1365f45a05d:-8000-0000000000000002,0] [APP: oim#11.1.1.3.0] Orchestration process moved to failed stage, and the corresponding error is - {0}[[
oracle.iam.platform.kernel.EventFailedException: Modification failed because user TESTUSER125 is not synchronized to the LDAP directory.
     at oracle.iam.ldapsync.impl.eventhandlers.user.UserModifyLDAPHandler.execute(UserModifyLDAPHandler.java:140)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runPreProcessEvents(OrchProcessData.java:898)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:634)
     at oracle.iam.platform.kernel.impl.OrchProcessData.executeEvents(OrchProcessData.java:227)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:665)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.process(OrchestrationEngineImpl.java:435)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:381)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.orchestrate(OrchestrationEngineImpl.java:334)
     at oracle.iam.identity.usermgmt.impl.UserManagerImpl.modify(UserManagerImpl.java:896)
     at oracle.iam.identity.usermgmt.api.UserManagerEJB.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
     at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
     at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
     at $Proxy358.modifyx(Unknown Source)
     at oracle.iam.identity.usermgmt.api.UserManager_nimav7_UserManagerRemoteImpl.__WL_invoke(Unknown Source)
     at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
     at oracle.iam.identity.usermgmt.api.UserManager_nimav7_UserManagerRemoteImpl.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
     at $Proxy199.modifyx(Unknown Source)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
     at $Proxy323.modifyx(Unknown Source)
     at oracle.iam.identity.usermgmt.api.UserManagerDelegate.modify(Unknown Source)
     at com.doha.customeventhandler.DohaEDWAttributePostProcessEventHandler.execute(DohaEDWAttributePostProcessEventHandler.java:133)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runPostProcessEvents(OrchProcessData.java:1166)
     at oracle.iam.platform.kernel.impl.OrchProcessData.runEvents(OrchProcessData.java:710)
     at oracle.iam.platform.kernel.impl.OrchProcessData.executeEvents(OrchProcessData.java:227)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:675)
     at oracle.iam.platform.kernel.impl.OrchestrationEngineImpl.resumeProcess(OrchestrationEngineImpl.java:705)
     at oracle.iam.platform.kernel.impl.OrhestrationAsyncTask.execute(OrhestrationAsyncTask.java:108)
     at oracle.iam.platform.async.impl.TaskExecutor.executeUnmanagedTask(TaskExecutor.java:100)
     at oracle.iam.platform.async.impl.TaskExecutor.execute(TaskExecutor.java:70)
     at oracle.iam.platform.async.messaging.MessageReceiver.onMessage(MessageReceiver.java:68)
     at sun.reflect.GeneratedMethodAccessor3380.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
     at $Proxy347.onMessage(Unknown Source)
     at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:574)
     at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
     at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:380)
     at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
     at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
     at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3822)
     at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
     at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
     at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.iam.platform.kernel.EventFailedException: Modification failed because user TESTUSER125 is not synchronized to the LDAP directory.
     at oracle.iam.ldapsync.impl.eventhandlers.user.UserModifyLDAPPreProcessHandler.modifyUser(UserModifyLDAPPreProcessHandler.java:162)
     at oracle.iam.ldapsync.impl.eventhandlers.user.UserModifyLDAPHandler.execute(UserModifyLDAPHandler.java:119)
     ... 81 more
Regards
A Abhinay

Similar Messages

  • Where do you store Hard coding values?

    Hi All,
    We have a requirement to call a 3rd party web service from SAP for which there are 12 - 13 attributes which are constant values and are not going to change. These can be hard coded inside the implementation methods but I do not want to do it. Say after 3 months there is a additional attribute that need to be added then in that case I need not touch the code back.
    We can store it Z tables which is one option. I would like to get ideas from experts here in the forum what would you do in this type of a scenario instead of hard coding?
    Please post in your feedback from the maintenance perspective across landscapes.
    Thanks,
    Nagarajan.

    Hello Nagarajan,
    you can create the constants in the Assistance class or create a separate interface for storing the constant values.
    If there is any change in the constant value, then you have to change the class/interface. this can't be avoided.
    BR, Saravanan

  • How could i use resource bundle in managed bean instead of harding coding?

    component is created in managed bean programmatically, so how to set attributes(e.g. text, value) using resource bundling instead of hard coding, as like coding on the page directlly?
    Thanks for your help!
    Kevin.

    component is created in managed bean programmatically, so how to set attributes(e.g. text, value) using resource bundling instead of hard coding, as like coding on the page directlly?
    Thanks for your help!
    Kevin.

  • Hard Coded Strings

    Hi All
    I want to eliminate the need for hard coded values in my code . for example when I set an attribute as
    setAttribute ("A", "This a good day")
    I want to eliminate "This a good day" from the code and replace it with something else more sophisticated to reduce the code maintenance in the future . Do you have any solution for that ?
    Thanks

    Hi,
    You can create your own messages in Application Developer Responsibility and then you can access those messages in OAF.
    suppose message name is XX_TEST
    so in the code use it like
    String msg = pageContext.getMessage("<application short name of message>","XX_TEST",null);
    then this variable you can use anywhere you want in the code.
    setAttribute("A",msg);
    Thanks,
    Gaurav

  • How to get the table name in the trigger definition without hard coding.

    CREATE  TRIGGER db.mytablename
    AFTER UPDATE,INSERT
    AS
        INSERT INTO table1(col1)
        SELECT InsRec.col1   
        FROM
        INSERTED Ins
       --Below i am calling one sp for which i have to pass the table name
       EXEC myspname 'tablename'
      In the above trigger,presently i am hard coding the tablename
      but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name

    I really liked your audit table concept.  You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields.  Wanted to share my end result.
    USE [YourDB]
    GO
    /****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
    ON [dbo].[YourTable]
    AFTER INSERT,DELETE,UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    Declare @v_AuditID bigint
    IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
    CREATE TABLE [dbo].[AutoAudit]
    ( [AuditID] bigint identity,
    [AuditDate] DateTime,
    [AuditUserName] varchar(128),
    [TableName] varchar(128) NULL,
    [OldContent] XML NULL,
    [NewContent] XML NULL
    ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
    PK_AutoAudit PRIMARY KEY CLUSTERED
    [AuditID]
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
    ( [TableName] ASC,
    [AuditDate] ASC
    )WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    END
    Select * Into #AuditDeleted from deleted
    Select * Into #AuditInserted from inserted
    While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
    Begin
    INSERT INTO [dbo].[AutoAudit]
    ( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
    SELECT
    GETDATE(),
    SUSER_NAME(),
    [TableName]=object_name([parent_obj]),
    [OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
    [NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
    FROM sysobjects
    WHERE
    [xtype] = 'tr'
    and [name] = OBJECT_NAME(@@PROCID)
    Set @v_AuditID = SCOPE_IDENTITY()
    Delete from AutoAudit
    Where AuditID = @v_AuditID
    AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
    Delete top(1) from #AuditDeleted
    Delete top(1) from #AuditInserted
    End
    END

  • How to use model clause without hard coding the values in it?

    Query
    select acct_no,
           gl_code,
           CASE
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             ELSE
              'Deferred Revenue Credit'
           END AS entry_type_label,
           CASE
             WHEN entry_type_label IN ('Opening Balance') THEN
              'Opening Balance'
             WHEN entry_type_label IN ('Deferred Revenue Credit') THEN
              'Invoice Amount'
             WHEN entry_type_label IN ('Earned Revenue') THEN
              'Earned Revenue'
             WHEN entry_type_label IN ('Closing Balance') THEN
              'Closing Balance'
             ELSE
              'Deferred Revenue Credit'
           END AS label,
           entry_type_no,
           orig_chg_start_date,
           period_no,
           -amt as amt
      from revrec_test
    WHERE acct_no = 1788562
       AND entry_type_no IN (2, 4) model dimension by(acct_no,
              gl_code,
              entry_type_label,
              entry_type_no,
              orig_chg_start_date,
              period_no) measures(amt) rules upsert
    all(amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190 = amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               190 - amt 1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               190,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               191 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 191 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 191) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               191,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               192 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 192 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 192) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Opening Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               192,
               amt 1788562,
               'UNEARNED-10011561',
               'Deferred Revenue Credit',
               2,
               '02-OCT-17 08.30.00 AM',
               193 = 0,
               amt 1788562,
               'UNEARNED-10011561',
               'Closing Balance',
               2,
               '02-OCT-17 08.30.00 AM',
               193 =
               (amt 1788562, 'UNEARNED-10011561', 'Opening Balance', 2,
                '02-OCT-17 08.30.00 AM', 193 + amt 1788562, 'UNEARNED-10011561',
                'Deferred Revenue Credit', 2, '02-OCT-17 08.30.00 AM', 193) - amt
               1788562,
               'EARNED-10011561',
               'Earned Revenue',
               4,
               '02-OCT-17 08.30.00 AM',
               193)
    ORDER BY period_no, entry_type_no;
    The above query works fine. But i have hard coded the values. I want to do the same operation for different account number which is going to have different periodic no. How can I achieve it?
    Thanks in advance.

    Create Statement
    CREATE TABLE table_one(
    ACCT_NO             NUMBER(38),                                               
    GL_CODE             VARCHAR2(300),
    ENTRY_TYPE_LABEL    CHAR(50),                                                  
    ENTRY_TYPE_NO       NUMBER,                                                    
    ORIG_CHG_START_DATE TIMESTAMP(0) WITH LOCAL TIME ZONE,
    ORIG_CHG_END_DATE   TIMESTAMP(0) WITH LOCAL TIME ZONE,
    PERIOD_NO           NUMBER(38),
    AMT                 NUMBER(38,10)
    Insert Statement
    INSERT ALL
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,-14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,-14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-13.87)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',102,14.83)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Debit',3,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',101,14.35)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'E-11561','Earned Revenue',4,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',103,-0.95)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1001,'U-11561','Deferred Revenue Credit',2,'02-OCT-17 08.30.00 AM','01-JAN-18 01.30.00 PM',100,-44)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-6.86)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,7.82)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,23.47)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,13.69)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,-35.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-3.93)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,44.91)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,9.13)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Earned Revenue',4,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',106,-11.75)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,-19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Credit',2,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',104,-60)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,38.48)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Accounts Receivable',1,'20-DEC-13 09.30.00 AM','16-FEB-14 09.30.00 AM',105,19.24)
    INTO table_one(acct_no, gl_code, entry_type_label, entry_type_no, orig_chg_start_date, orig_chg_end_date, period_no, amt) VALUES(1002,'Recurring Flat Fees COA Code','Deferred Revenue Debit',3,'17-NOV-13 09.30.00 AM','16-FEB-14 09.30.00 AM',107,35.91)
    SELECT * FROM dual;
    Expected Result
    S.NO
    ACCT_NO
    GL_CODE
    ENTRY_TYPE_LABEL
    ENTRY_TYPE_NO
    ORIG_CHG_START_DATE
    PERIOD_NO
    AMT
    DESCRIPTION
    1
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    0
    Opening Account
    2
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    44
    Invoice
    3
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    100
    13.87
    Invoice Paid
    4
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    100
    30.13
    Closing Account
    5
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    30.13
    Opening Account
    6
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    0
    Invoice
    7
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    101
    14.35
    Invoice Paid
    8
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    101
    15.78
    Closing Account
    9
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    15.78
    Opening Account
    10
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0
    Invoice
    11
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    102
    14.83
    Invoice Paid
    12
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    102
    0.95
    Closing Account
    13
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0.95
    Opening Account
    14
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Invoice
    15
    1001
    E-11561
    Earned Revenue
    4
    02-OCT-17 08.30.00 AM
    103
    0.95
    Invoice Paid
    16
    1001
    U-11561
    Deferred Revenue Credit
    2
    02-OCT-17 08.30.00 AM
    103
    0
    Closing Account
    Description
    We must start opening account as zero and end with closing account as zero by doing manipulation with invoice and invoice paid.
    Process
    Initial Stage
    Subsequent stage
    Opening Account
    0
    (=closing Account)
    Invoice
    max value of account no which has entry type no 2
    0
    Invoice Paid
    taken from the  field amount which has entry type no 4
    taken from the  field amount which has entry type no 4
    Closing Account
    (=[opening account + invoice] - invoice paid)
    (=[opening account + invoice] - invoice paid)
    Note
    1) Each account may have different periodic no.
    2) Some account may have more than 4 distinct period no and less than 4 distinct periodic no.
    3) Description column from expected result is not an part of table. It is been added for easier understanding.

  • How do I read a properties file in WEB-INF without hard-coding a path?

    Hello,
    How do I read a properties file in WEB-INF without hard-coding a path?
    I tried:
    Properties properties = new Properties();
    properties.load(new FileInputStream("db.properties"));
    driver = properties.getProperty("driver");
    but it cannot find the db.properties file.
    Thanks for the help.
    Frank

    Don't use a File to read those properties.
    Better to use the servlet context and
    getResourceAsStream() method to get the InputStream.
    It'll look for any file in the CLASSPATH. If you put
    that properties file in the WEB-INF/classes directory
    you'll have no problems, even if you deploy with a
    WAR file.Completely agree with this approach. Just have to mention the following for completeness
    according to the API,
    "This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
    So using this method, the resource can be anywhere under your web context, not just in the classpath.
    Cheers,
    evnafets

  • Output type for the managed codes cut letter is hard coded

    Hello,
    Very Good afternoon!
    I have a requirement to create new Output Types for a Smart Form.
    The already existing Output types are hard coded as shown Below :
    CONSTANTS : c_kschl_order LIKE nast-kschl
                             VALUE 'ZUS0',
                c_kschl_order1 LIKE nast-kschl
                             VALUE 'ZUS1',
    Now they do not want to use ZUS1. Insted they wnat to use New Output Types.
    u2022 Remove ZUS1 as we no longer use this one.
    u2022     Add ZAU0
    u2022     Add ZNZ0
    u2022     Add ZJP0
    u2022     Add ZCN0
    u2022     Add ZKR0
    How to add these Output types without Hardcoding as shown ABove.
    Any Suggestions will be appreciated.....
    For reference..I will paste the code of the Program here.
    Here is the code  :
                     PROGRAM DECLARATION
    PROGRAM ID           Z_RVADOR01_SALES_CUT_LETTER
    TABLES: vbak,    "Sales Document: Header Data
           vbap,    "Sales Document: Item Data
           vbpa,    "Sales Document: Partner
           vbep,    "Sales Document: Schedule Line Data
           kna1,    "General Data in Customer Master
           MARA,    "Material Master
            KOMK,                          "Communicationarea for conditions
            KOMP,                          "Communicationarea for conditions
            KOMVD,                         "Communicationarea for conditions
            VBCO3,                         "Communicationarea for view
            VBDKA,                         "Headerview
            VBDPA,                         "Itemview
            VBDPAU,                        "Subitemnumbers
            CONF_OUT,                      "Configuration data
            SADR,                          "Addresses
            TVAG,                          "Reason for rejection
            VEDKA,                         "Servicecontract head data
            VEDPA,                         "Servicecontract position data
            VEDKN,                         "Servicecontract head notice data
            VEDPN,                         "Servicecontract pos. notice data
            RISERLS,                       "Serialnumbers
            KOMSER,                        "Serialnumbers for print
            TVBUR,                         "Sales office
            TVKO,                          "Sales organisation
            ADRS,                          "Communicationarea for Address
            FPLTDR,                        "billing schedules
            WTAD_ADDIS_IN_SO_PRINT,        "additional
            WTAD_BUYING_PRINT_EXTRA_TEXT,  "texts belonging to additional
            adrc,
            adr6,
            t247.
    INCLUDE RVADTABL.
    INCLUDE RVDIREKT.
    INCLUDE VEDADATA.
    data for access to central address maintenance
    INCLUDE SDZAVDAT.
    TYPE-POOLS: ADDI.
    DATA PRICE_PRINT_MODE(1) TYPE C.       "Print-mode
    DATA: RETCODE   LIKE SY-SUBRC.         "Returncode
    DATA: REPEAT(1) TYPE C.
    DATA: XSCREEN(1) TYPE C.               "Output on printer or screen
    DATA: BEGIN OF STEU,                   "Controldata for output
            VDKEX(1) TYPE C,
            VDPEX(1) TYPE C,
            KBKEX(1) TYPE C,
            KBPEX(1) TYPE C,
          END OF STEU.
    DATA: BEGIN OF TVBDPA OCCURS 0.        "Internal table for items
            INCLUDE STRUCTURE VBDPA.
    DATA: END OF TVBDPA.
    DATA: BEGIN OF TKOMV OCCURS 50.
            INCLUDE STRUCTURE KOMV.
    DATA: END OF TKOMV.
    DATA: BEGIN OF TKOMVD OCCURS 50.
            INCLUDE STRUCTURE KOMVD.
    DATA: END OF TKOMVD.
    DATA: BEGIN OF TVBDPAU OCCURS 5.
            INCLUDE STRUCTURE VBDPAU.
    DATA: END   OF TVBDPAU.
    DATA: BEGIN OF TKOMCON OCCURS 50.
            INCLUDE STRUCTURE CONF_OUT.
    DATA: END   OF TKOMCON.
    DATA: BEGIN OF TKOMSERVH OCCURS 1.
            INCLUDE STRUCTURE VEDKA.
    DATA: END   OF TKOMSERVH.
    DATA: BEGIN OF TKOMSERVP OCCURS 5.
            INCLUDE STRUCTURE VEDPA.
    DATA: END   OF TKOMSERVP.
    DATA: BEGIN OF TKOMSERVHN OCCURS 5.
            INCLUDE STRUCTURE VEDKN.
    DATA: END   OF TKOMSERVHN.
    DATA: BEGIN OF TKOMSERVPN OCCURS 5.
            INCLUDE STRUCTURE VEDPN.
    DATA: END   OF TKOMSERVPN.
    DATA: BEGIN OF TKOMSER OCCURS 5.
            INCLUDE STRUCTURE RISERLS.
    DATA: END   OF TKOMSER.
    DATA: BEGIN OF TKOMSER_PRINT OCCURS 5.
            INCLUDE STRUCTURE KOMSER.
    DATA: END   OF TKOMSER_PRINT.
    DATA: BEGIN OF TFPLTDR OCCURS 5.
            INCLUDE STRUCTURE FPLTDR.
    DATA: END   OF TFPLTDR.
    DATA: TADDI_PRINT TYPE ADDI_SO_PRINT_ITAB WITH HEADER LINE.
    TYPES:BEGIN OF ty_orders ,
         xblnr    LIKE  mkpf-xblnr,       "delivery number
         erfmg    LIKE  mseg-erfmg,       "goods issue quantity
         custname LIKE  kna1-name1,       "customer name
         bstnk    LIKE  vbak-bstnk,       "purchase order number
         ean11    LIKE  vbap-ean11,       "upc
         kdmat    LIKE  vbap-kdmat,       "customer material code
         arktx    LIKE  vbap-arktx,       "description
         csrno    LIKE  kna1-kunnr,       "customer service rep number
         spras    LIKE  kna1-spras,       "customer language key
         csrname  LIKE  kna1-name1,       "customer service rep name
         csremail LIKE  adr6-smtp_addr,   "csr email
         csrphone LIKE  kna1-telf1,       "csr telephone
         csrext   LIKE  adrc-tel_extens,  "csr extension
         csrfax   LIKE  kna1-telfx,       "csr fax
         total    LIKE  lips-lfimg,       "cut quantity
         ldate(18)    TYPE c,
       END OF ty_orders.
    CONSTANTS: c_kschl_order LIKE nast-kschl
                             VALUE 'ZUS0',
                c_kschl_order1 LIKE nast-kschl
                             VALUE 'ZUS1',            c_parvw_shipto LIKE vbpa-parvw
                             VALUE 'WE',
                c_parvw_csr    LIKE vbpa-parvw
                             VALUE 'ZS',
                 c_eng(1)       TYPE c VALUE 'E',
                 c_sep(1)       TYPE c VALUE '/',
                 c_sale(25) type c VALUE 'Sales Order'.
    DATA: WA_VBAK TYPE VBAK,
          tbl_ord TYPE ty_orders OCCURS 0 WITH HEADER LINE,
          w_csrname(30)  TYPE c,
         w_csrno(30)    TYPE c,
         w_email    LIKE adr6-smtp_addr,
         f_shipto_found     TYPE c,
         w_custname(30) TYPE c,
         w_month(2),
         w_ldate(18),
         w_total LIKE lips-lfimg,
         w_lines        TYPE i VALUE 0,
         f_mail(1)  TYPE c,
         cnt_1          TYPE i VALUE 0,
         cnt_2          TYPE i VALUE 0,
         tbl_otf     LIKE itcoo OCCURS 0 WITH HEADER LINE,
         w_type(25)     TYPE c,
         st_doc_data   LIKE sodocchgi1,
         tbl_objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_line      LIKE tline OCCURS 0 WITH HEADER LINE,
         tbl_attach    LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_objhead   LIKE solisti1 OCCURS 10 WITH HEADER LINE,
         tbl_proc_para LIKE soparai1 OCCURS 10 WITH HEADER LINE,
         tbl_maillist  LIKE somlreci1 OCCURS 10 WITH HEADER LINE,
         tbl_pack_list LIKE sopcklsti1 OCCURS 10 WITH HEADER LINE,
         tbl_cpo      LIKE itcpo OCCURS 0 WITH HEADER LINE,"SAPscript output
                                                                " interface
         tbl_cpp LIKE itcpp OCCURS 0 WITH HEADER LINE,"SAPscript output
                                                       " parameters
         tbl_smtp  TYPE szadr_adsmtp_line OCCURS 0 WITH HEADER LINE,
         tbl_cdhdpos LIKE cdshw OCCURS 0 WITH HEADER LINE,
         tbl_cdpos LIKE cdshw OCCURS 0 WITH HEADER LINE,
         wrk_lines LIKE sy-tabix,
         hltlines   TYPE i,
         off1       TYPE p,
         fle1(2)    TYPE p,
         fle2(2)    TYPE p,
         htabix     LIKE sy-tabix,
         hfeld(500) TYPE c.
    FORM ENTRY USING RETURN_CODE US_SCREEN.
    if sy-tcode = 'VA01'.
      IF nast-kschl = c_kschl_order.
      SELECT SINGLE * FROM VBAK INTO WA_VBAK WHERE vbeln = nast-objky.
      IF SY-SUBRC = 0.
      CLEAR RETCODE.
      XSCREEN = US_SCREEN.
      PERFORM PROCESSING USING us_screen.
      IF RETCODE NE 0.
        RETURN_CODE = 1.
      ELSE.
        RETURN_CODE = 0.
      ENDIF.
       ELSE.
          retcode = sy-subrc.
          syst-msgid = 'ZVERROR'.
          syst-msgno = '000'.
          syst-msgty = 'E'.
          syst-msgv1 = NAST-KSCHL.
         syst-msgv1 = 'Sales Order cut letter
                       for this order already issued'.
         syst-msgv2 = ' '.
          PERFORM protocol_update.
        ENDIF.
    ELSE.
        CLEAR retcode.
        xscreen = us_screen.
        PERFORM processing USING us_screen.
        IF retcode NE 0.
          return_code = 1.
        ELSE.
          return_code = 0.
        ENDIF.
      ENDIF.
    endif.
    ENDFORM.
          FORM PROCESSING                                               *
    FORM PROCESSING USING proc_screen.
    CASE nast-kschl.
        WHEN c_kschl_order.
          PERFORM get_orders.
          CHECK retcode = 0.
          PERFORM openform USING proc_screen vbak-landtx.
          CHECK retcode = 0.
          PERFORM layout.
          CHECK retcode = 0.
          CHECK proc_screen NE 'X'.
          w_type = c_sale.
          PERFORM send_email USING proc_screen.
      WHEN c_kschl_order1.
         PERFORM get_orders.
         CHECK retcode = 0.
         CHECK proc_screen NE 'X'.
         w_type = c_sale.
         PERFORM send_email USING proc_screen.
       WHEN OTHERS.
          retcode = 1.
          syst-msgid = 'E0'.
          syst-msgno = '430'.
          syst-msgty = 'E'.
          PERFORM protocol_update.
      ENDCASE.
      IF retcode EQ 0.
        syst-msgid = '69'.
        syst-msgno = '254'.
        syst-msgty = 'S'.
        syst-msgv1 = nast-kschl.
        PERFORM protocol_update.
      ELSE.
        syst-msgid = 'CKCC'.
        syst-msgno = '036'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.
          FORM PROTOCOL_UPDATE                                          *
          The messages are collected for the processing protocol.       *
    FORM PROTOCOL_UPDATE.
      IF xscreen EQ space.
        CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
           EXPORTING
                MSG_ARBGB = SYST-MSGID
                MSG_NR    = SYST-MSGNO
                MSG_TY    = SYST-MSGTY
                MSG_V1    = SYST-MSGV1
                MSG_V2    = SYST-MSGV2
                MSG_V3    = SYST-MSGV3
                MSG_V4    = SYST-MSGV4
           EXCEPTIONS
                OTHERS    = 1.
       ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    ENDFORM.
    *&      Form  get_orders
          text
    -->  p1        text
    <--  p2        text
    FORM get_orders.
    DATA : f_csr_found        TYPE c.
    SELECT SINGLE vbeln vkorg vdatu bstnk kunnr
        FROM   vbak
        INTO  (vbak-vbeln,vbak-vkorg,vbak-vdatu,vbak-bstnk,vbak-kunnr)
        WHERE vbeln EQ nast-objky.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'VN'.
        syst-msgno = '203'.
        syst-msgty = 'E'.
        syst-msgv1 = 'VBAK'.
        syst-msgv2 = sy-subrc.
        PERFORM protocol_update.
      ENDIF.
      SELECT vbeln posnr matnr pmatn arktx abgru kdmat werks
      FROM vbap
      INTO (vbap-vbeln,vbap-posnr,vbap-matnr,vbap-pmatn,
    vbap-arktx,vbap-abgru,vbap-kdmat,vbap-werks)
      WHERE vbeln = vbak-vbeln
      AND abgru NE space "select items havng Rejection Reason
      and PSTYV NE 'ZHDR'.
    to check whether the reason for rejection was picked from the
    managed codes tables
    data: war_abgru type abgru,
          w_exist type c.
    clear : war_abgru, w_exist.
      select single abgru  from ZMAT_REJ002
                    into war_abgru
                    where vkorg = vbak-vkorg
                    and kunnr <> vbak-kunnr
                    and MATNR = vbap-matnr
                    and datef <= vbak-vdatu
                    and datet >= vbak-vdatu.
       if sy-subrc <> 0.
             select single abgru from ZMAT_REJ003
                              into war_abgru
                              where vkorg = vbak-vkorg
                              and kunnr <> vbak-kunnr
                              and MATNR = vbap-matnr
                              and datef <= vbak-vdatu
                              and datet >= vbak-vdatu.
             if sy-subrc <> 0.
                    select single abgru from ZMAT_REJ001
                              into war_abgru
                              where vkorg = vbak-vkorg
                              and werks <> vbap-werks
                              and matnr = vbap-matnr
                              and datef <= vbak-vdatu
                              and datet >= vbak-vdatu.
                    if sy-subrc <> 0.
                         select single abgru from ZMAT_REJ004
                                             into war_abgru
                                             where vkorg = vbak-vkorg
                                             and matnr = vbap-matnr
                                             and datef >= vbak-vdatu
                                             and datet <= vbak-vdatu.
                         if sy-subrc <> 0.
                         else.
                         w_exist = 'X'.
                         endif.
                   else.
                   w_exist = 'X'.
                   endif.
             else.
             w_exist = 'X'.
             endif.
       else.
       w_exist = 'X'.
       endif.
    if w_exist = 'X'.
    end for check from managed codes table
    *to find the quantity fields
        SELECT SINGLE wmeng bmeng
        FROM vbep
        INTO (vbep-wmeng,vbep-bmeng)
        WHERE vbeln EQ vbap-vbeln
        AND   posnr EQ vbap-posnr.
    *to get info about the customer
        SELECT SINGLE kunnr
        FROM vbpa
        INTO vbpa-kunnr
        WHERE  vbeln EQ vbak-vbeln
        AND    parvw EQ c_parvw_shipto.
         IF sy-subrc EQ 0.
          f_shipto_found = 'X'.
          SELECT SINGLE name1 spras
            FROM kna1
            INTO (kna1-name1,kna1-spras)
            WHERE kunnr EQ vbpa-kunnr.
          IF sy-subrc EQ 0.
            w_custname = kna1-name1.
            CLEAR kna1-name1.
          ENDIF.
         ENDIF.
         SELECT SINGLE kunnr
        FROM vbpa
        INTO vbpa-kunnr
        WHERE vbeln EQ vbak-vbeln
        AND   parvw EQ c_parvw_csr.
        IF SY-SUBRC EQ 0.
         f_csr_found = 'X'.
          SELECT SINGLE kunnr name1 name2 adrnr
           FROM kna1
           INTO (kna1-kunnr,kna1-name1,kna1-name2,
                 kna1-adrnr)
           WHERE  kunnr EQ vbpa-kunnr.
          IF sy-subrc EQ 0.
            w_csrno = kna1-kunnr.
            w_csrname = kna1-name1.
            CLEAR kna1-name1.
               SELECT SINGLE tel_number tel_extens fax_number
                 FROM adrc
                 INTO (adrc-tel_number,adrc-tel_extens,
       adrc-fax_number)
                 WHERE addrnumber EQ kna1-adrnr.
            CLEAR: adr6, w_email.
            SELECT SINGLE * FROM adr6 WHERE addrnumber = kna1-adrnr.
            IF sy-subrc = 0.
              w_email = adr6-smtp_addr.
            ENDIF.
          ENDIF.
        ENDIF.
    *to get the date format in french
        IF kna1-spras NE c_eng.
          w_month = sy-datum+4(2).
          SELECT SINGLE ltx
            FROM t247
            INTO t247-ltx
            WHERE spras EQ kna1-spras
            AND mnr EQ w_month.
          CONCATENATE sy-datum+6(2)
                      t247-ltx
                      sy-datum+0(4)
                      INTO w_ldate
                      SEPARATED BY space.
          ELSE.
          CONCATENATE sy-datum+4(2)
                      sy-datum+6(2)
                      sy-datum+0(4)
                      INTO w_ldate
                      SEPARATED BY c_sep.
        ENDIF.
        w_total = vbep-wmeng - vbep-bmeng.
         IF w_total GT 0.
         PERFORM fill_orders.
        ELSE.
          IF vbap-abgru NE space.
            w_total = vbep-wmeng.
            PERFORM fill_orders.
          ENDIF.
        ENDIF.
        CLEAR vbap.
        endif.           " check for w_exist for Managed Codes entry
    ENDSELECT.
    IF tbl_ord[] IS INITIAL.
        retcode = 1.
        syst-msgid = 'FZ'.
        syst-msgno = '027'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
      IF f_csr_found IS INITIAL.
        syst-msgid = '8B'.
        syst-msgno = '127'.
        syst-msgty = 'W'.
        syst-msgv1 = c_parvw_csr.
        PERFORM protocol_update.
      ENDIF.
      IF f_shipto_found IS INITIAL.
        syst-msgid = '8B'.
        syst-msgno = '127'.
        syst-msgty = 'W'.
        syst-msgv1 = c_parvw_shipto.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " get_orders
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout.
    SORT tbl_ord BY bstnk kdmat.
      LOOP AT tbl_ord.
        AT FIRST.
          PERFORM writeform_text.
        ENDAT.
        PERFORM writeform.
        AT LAST.
          PERFORM writeform_footer.
        ENDAT.
      ENDLOOP.
      CLEAR : cnt_1,cnt_2.
      PERFORM closeform.
    ENDFORM.                    " layout
    *&      Form  openform
          text
    FORM openform USING us_screen us_country.
    DESCRIBE TABLE tbl_ord LINES w_lines.
      IF w_lines EQ 0.
        retcode    = '1'.
        syst-msgid = 'FE'.
        syst-msgno = '078'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
      CHECK retcode EQ 0.
    INCLUDE zrvadopfo.
    ENDFORM.                    " openform
    *&      Form  send_email
          text
         -->P_PROC_SCREEN  text
    FORM send_email USING    PROC_SCREEN.
    f_mail = 'X'.
      PERFORM openform USING proc_screen vbak-landtx.
      LOOP AT tbl_ord.
        AT FIRST.
          PERFORM writeform_text.
        ENDAT.
        PERFORM writeform.
        AT LAST.
          PERFORM writeform_footer.
        ENDAT.
      ENDLOOP.
      CLEAR cnt_2.
      PERFORM closeform.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'  "'ASCII'
           IMPORTING
                bin_filesize          = st_doc_data-doc_size
           TABLES
                otf                   = tbl_otf
                lines                 = tbl_line
           EXCEPTIONS                                           "DEVK912166
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                OTHERS                = 4.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'OA'.                                      "DEVK912166
        syst-msgno = '186'.                                     "DEVK912166
        syst-msgty = 'E'.                                       "DEVK912166
        PERFORM protocol_update.
      ENDIF.
      REFRESH tbl_objtxt.
      CLEAR tbl_objtxt.
      CLEAR tbl_proc_para.
      REFRESH tbl_proc_para.
      CLEAR tbl_maillist.
      REFRESH tbl_maillist.
      CLEAR tbl_pack_list.
      REFRESH tbl_pack_list.
      st_doc_data-obj_name   = 'Sales Order Cut Letter'.
      st_doc_data-obj_langu   = 'E'.                            "DEVK905849
      st_doc_data-sensitivty  = 'F'.                            "DEVK905849
      st_doc_data-obj_prio    =  1.                             "DEVK905849
      CONCATENATE w_type 'Cut Letter' INTO          "#EC NOTEXT
                                  st_doc_data-obj_descr  SEPARATED BY space.
      DATA w_line(3) TYPE c.
      PERFORM format_pdf.                                       "DEVK905849
      concatenate VBAK-VBELN '.PDF' into tbl_objhead.
    tbl_objhead = 'Sales Order Cut Letter.PDF'.
      APPEND tbl_objhead.
           "DEVK905849
      CLEAR wrk_lines.
      DESCRIBE TABLE tbl_attach LINES wrk_lines.
    fields needed for email
      tbl_maillist-com_type = 'INT'.
      tbl_maillist-receiver =  w_email.
      tbl_maillist-rec_type = 'U'.
      APPEND tbl_maillist.
    send email
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
                                      STARTING NEW TASK 'MAIL'
           EXPORTING
                document_data              = st_doc_data
                document_type              = 'PDF'
                COMMIT_WORK                = 'X'    " added after ECC6.0 upgrade
           TABLES
                object_header              = tbl_objhead
                object_content             = tbl_objtxt
                receivers                  = tbl_maillist
           EXCEPTIONS                                           "DEVK912166
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'ZA_G'.                                    "DEVK912166
        syst-msgno = '922'.                                     "DEVK912166
        syst-msgty = 'E'.                                       "DEVK912166
        syst-msgv1 = sy-subrc.                                  "DEVK912166
        syst-msgv2 = tbl_smtp-adsmtp-smtp_addr.                 "DEVK912166
        PERFORM protocol_update.
        syst-msgid = 'VW'.
        syst-msgno = '001'.
        syst-msgty = 'E'.
        syst-msgv1 = 'Print successful:email Recepient Invalid'."#EC NOTEXT
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " send_email
    *&      Form  fill_orders
          text
    -->  p1        text
    <--  p2        text
    FORM fill_orders.
    tbl_ord-bstnk    = vbak-bstnk.
      tbl_ord-kdmat    = vbap-kdmat.
      tbl_ord-xblnr    = vbak-vbeln.
      tbl_ord-ean11    = vbap-pmatn.
      tbl_ord-arktx    = vbap-arktx.
      tbl_ord-csrno    = w_csrno .
      tbl_ord-csremail = w_email.
      tbl_ord-spras    = kna1-spras .
      tbl_ord-csrphone = adrc-tel_number.
      tbl_ord-csrfax   = adrc-fax_number.
      tbl_ord-csrext   = adrc-tel_extens.
      tbl_ord-total    = w_total.
      tbl_ord-custname = w_custname.
      tbl_ord-csrname  = w_csrname .
      tbl_ord-ldate    = w_ldate.
      APPEND tbl_ord.
      CLEAR tbl_ord.
      CLEAR w_total.
      CLEAR w_ldate.
    ENDFORM.                    " fill_orders
    *&      Form  writeform_text
          text
    -->  p1        text
    <--  p2        text
    FORM writeform_text.
    CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'WTEXT'
                window  = 'WINDOW2'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WTEXT'.
        syst-msgv2 = 'WINDOW2'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform_text
    *&      Form  writeform
          text
    -->  p1        text
    <--  p2        text
    FORM writeform.
    CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'EMAIN'
                window  = 'MAIN'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WTEXT'.
        syst-msgv2 = 'WINDOW2'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform
    *&      Form  writeform_footer
          text
    -->  p1        text
    <--  p2        text
    FORM writeform_footer.
    IF nast-spras = 'N'.
        CALL FUNCTION 'WRITE_FORM'
             EXPORTING
                  element = 'FOOTER'
                  window  = 'MAIN'
             EXCEPTIONS
                  element = 1
                  window  = 2.
      ENDIF.
      CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                element = 'WFOOTER'
                window  = 'WINDOW12'
           EXCEPTIONS
                element = 1
                window  = 2.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'EBR'.
        syst-msgno = '056'.
        syst-msgty = 'E'.
        syst-msgv1 = 'WFOOTER'.
        syst-msgv2 = 'WINDOW12'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " writeform_footer
    *&      Form  closeform
          text
    -->  p1        text
    <--  p2        text
    FORM closeform.
    CALL FUNCTION 'CLOSE_FORM'
           TABLES
                otfdata                  = tbl_otf
           EXCEPTIONS
                unopened                 = 1
                bad_pageformat_for_print = 2
                OTHERS                   = 3.
      IF sy-subrc NE 0.
        retcode = sy-subrc.
        syst-msgid = 'PS'.
        syst-msgno = '005'.
        syst-msgty = 'E'.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    " closeform
    *&      Form  format_pdf
          text
    -->  p1        text
    <--  p2        text
    FORM format_pdf.
    FIELD-SYMBOLS <fs>.
      DESCRIBE TABLE tbl_line    LINES  hltlines.
    DESCRIBE FIELD tbl_line    LENGTH fle1 IN BYTE MODE . Defect#1579-
    DESCRIBE FIELD tbl_objtxt  LENGTH fle2 IN BYTE MODE . Defect#1579-
    Start of Defect#1579+
      DESCRIBE FIELD tbl_line    LENGTH fle1 IN CHARACTER MODE.
      DESCRIBE FIELD tbl_objtxt  LENGTH fle2 IN CHARACTER MODE.
    End of Defect#1579+
      CLEAR   tbl_objtxt.
      REFRESH tbl_objtxt.
      LOOP AT tbl_line.
        htabix = sy-tabix.
        MOVE tbl_line TO hfeld+off1.
        IF htabix = hltlines.
          fle1 = strlen( tbl_line ).
        ENDIF.
        off1 = off1 + fle1.
        IF off1 GE fle2.
          CLEAR tbl_objtxt.
          tbl_objtxt = hfeld(fle2).
          APPEND tbl_objtxt.
          SHIFT hfeld BY fle2 PLACES.
          off1 = off1 - fle2.
        ENDIF.
        IF htabix = hltlines.
          IF off1 GT 0.
            CLEAR tbl_objtxt.
            tbl_objtxt = hfeld(off1).
            APPEND tbl_objtxt.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " format_pdf
    ANy Suggestion or help will be appreciated!
    Regards,
    Kittu
    Edited by: Kittu on Jun 30, 2008 12:32 PM

    Hello Julie Waller,
    Very Good evening!
    Thank you very much for your response!
    Sometimes...I miss the basic things and start concentarcting on typical ways to fix the issue. ....which will only make my issue critical. 
    Hello Sathya,
    Thank you for your response!
    POints are rewarded..
    Have a great day ahead!
    Regards,
    Kittu

  • Error in setting final variable using properties vs hard coding

    I am getting the following error when trying to use this line of code
    public static final String MESSAGES_BUNDLE_NAME = System.getProperty("messages");
    java.lang.ExceptionInInitializerError: java.lang.NullPointerException
    When I change the above line to
    public static final String MESSAGES_BUNDLE_NAME = "messages_usa";
    the program works fine.
    Any ideas as to why this is happening would be greatly appreciated.
    Thanks,
    Boris

    I am sorry, but I realized now that I did notdiscribe
    the problem fully.
    The error is happening on the following line
    return APPLICATION_RESOURCE_BUNDLE.getString(key);
    So it looks like APPLICATION_RESOURCE_BUNDLE is
    becoming null.
    No that is not what is happening.
    This is the error that you posted.....
    java.lang.ExceptionInInitializerError:
    java.lang.NullPointerException
    The first part is the exception, not the second part
    (although the second causes the first.)
    The java docs specifically point out that a
    NullPointerException is returned if the base name is
    null - the parameter to getBundle().
    The initialization exception occurs because when it
    tries to excecute the initialization expression for
    the final, then the getBundle() is throwing the null
    pointer exception.
    It is is not clear what you code is actually supposed
    to be doing but I think you suggested that your are
    using a system property. If so then it means that
    that system property is not defined. And it works
    when you use a hard coded value because the hard coded
    value is defined.From this explanation I don't understand why initializing the bundle name from System.getProperty() works in the same class with the bundle obejct initialization, but does not work when it is in another class from bundle object initialization.

  • Tips on avoiding hard coded paths and make a java app platform independent

    HI all,
    I would like to gather some tips on how to avoid hard coded file paths, which are plenty in the application I work on and which I inherited from previous programmers.
    Also, when deploying to the production server, my app goes from a Windows platform to a Linux machine.
    I am curious to know what tricks and tools other programmers find useful in similar contexts.
    I am sure many of us would benefit from the discussion.
    Thank you !

    Actually, Java does this for you; you can use unix-style paths and they will still work, even on Windoze. To wit:
    public static void main(String[] args) {
            File f = new File("/");
            System.out.println(f.getAbsolutePath());
    }Yields: C:\
    public static void main(String[] args) {
            File f = new File("/Program Files");
            System.out.println(f.getAbsolutePath());
    }Yields: C:\Program Files

  • Hard coded SQL string doesn't run with error PLS-00103

    I have created a package with 34 stored procedures [pre]to create some materialized view with hard coded SQL [pre]string (client required for this hard coding). The [pre]first part with 21 simple create statements has
    [pre]worked fine. 2nd part with 11 complicated create [pre]statements, only first one has worked. all others [pre]have  not worked.
    [pre]
    I used dbms_output.put_line (sql_string) to check the [pre]individual create statement, it has looked fine. I [pre]have run individual SP within package. I have got [pre]error message as ORA-06550: line 1, column 45:
    [pre]PLS-00103: Encountered the symbol "end-of-file" when [pre]expecting one of the following: ; [pre]
    <an identifier> <a double-quoted delimited-identifier> [pre]The symbol ";" was substituted for "end-of-file" to [pre]continue.
    [pre]I have checked SQL string between 1st part and 2nd [pre]part. They are the same and all with ';' to end SQL [pre]string and END SP name in the end. Please help me to [pre]identify where the problems are. Thanks. Followings [pre]are some sample SQL string:
    [pre]PROCEDURE sp_1st_string
    [pre]IS
    [pre]BEGIN
    [pre]    EXECUTE IMMEDIATE 'CREATE MATERIALIZED VIEW
    [pre]mv_name1 TABLESPACE space_name PARALLEL ( DEGREE [pre]DEFAULT INSTANCES DEFAULT ) BUILD IMMEDIATE REFRESH [pre]COMPLETE ON DEMAND WITH PRIMARY KEY AS SELECT col1, [pre]col2,col3, col4, col5 FROM tableone A, table_two B [pre]WHERE A.id = B.id';
    [pre]COMMIT;
    [pre]END sp_1st_string;
    [pre]PROCEDURE sp_2nd_string
    [pre]IS
    [pre]BEGIN
    [pre]   EXECUTE IMMEDIATE ' CREATE MATERIALIZED VIEW
    [pre]mv_name2 TABLESPACE PDE_DATA PARALLEL ( DEGREE [pre]DEFAULT INSTANCES DEFAULT ) BUILD IMMEDIATE REFRESH [pre]COMPLETE ON DEMAND WITH PRIMARY KEY AS select col1 .. [pre]col10 from tableone a, tabletwo b, tablethree c, [pre]tablefour d, tablefive e, tablesix f where clause;
    [pre]COMMIT;
    [pre]END sp_2nd_string;
    Message was edited by:
            citicbj
    Message was edited by:
            citicbj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    stevencallan:
    Thanks for your advice. I have been thinking the above problem may be [pre]caused by this. If I run 'Create MV statement' in SQL PLUS or Toad, single quote [pre]will work. But when I put hard coded SQL string in package and stored [pre]procedure, it will cause compiling error. After I took off single quote, SP will be [pre][pre]compiled successfully. When I run package.sp, it will cause the problem. [pre]Here is the sample code:[pre]
    [pre]CREATE MATERIALIZED VIEW my_mv TABLESPACE space_name [pre][pre]PARALLEL (DEGREE DEFAULT INSTANCES DEFAULT) BUILD IMMEDIATE [pre]REFRESH COMPLETE ON DEMAND WITH PRIMARY KEY AS select A.ID , [pre]A.CNTL_NUM, C.XX_CODE, D.FIRST_NAME, D.MDL_NAME, [pre]D.LAST_NAME, H.XX_DESC, TO_DATE(TO_CHAR(C.CREAT_TS, [pre]'MM/DD/YYYY'),'MM/DD/YY'), F.STATE, CASE WHEN A.XX_CODE IS NOT NULL [pre]THEN X END, E.X_DESC  from TABLE1 A, TABLE2 B, TABLE3 C, TABLE4 [pre]D, TABLE5 E, TABLE6 F, TABLE7 G, TABLE8 H
    [pre]where D.X_SW = 'X' and B.X_SW = X' and G.X_SW = 'X' and B.CNTL_ID = [pre]A.CNTL_ID and B.CNTL_ID = D.CNTL_ID and B.X_ID = C.X_ID and B.X_ID = [pre]G.X_ID and B.X_ID = F.X_ID and G.X_CD = H.X_CD and B.X_CD = E.X_CD [pre]and E.X_CD = '25' and C.ENRLMT_ID NOT LIKE 'O%'; [pre]
    [pre]When I hard coded this statement in package and sp, I have to take off single [pre]quote ' ' form 'MM/DD/YYYY', 'MM/DD/YY', X_SW ='X', X_CD = '25' AND NOT [pre]LIKE 'O%', Then I can compile whole package successfully. This is why I [pre]mentioned that 1st part 21 simple create statement work because they don't have [pre]these single quote in the statement. In 2nd part with 13 complicated create [pre]statements, some of them have no single quote in the statement. They will [pre]run. Some of them with single quote in statement. They will have the problem [pre]to run if I take off single for compiling. [pre]
    [pre]Please give me some idea what is the reason. Thanks a lot.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to print hard-coded data in multiple language in sapscript.

    Hi All,
    How to print hard-coded data in multiple language in sap-script, here the requirement is when printing the output
    we can see the window heading, description which are mostly hard-coded here I want to print these in both language as fallows,
    Goods to be delivered: = Morada de Entrega:
    Total net value excl. tax = Valor Total (IVA não Incluído)
    Description = Descrição
    Item = linha
    here I want to print in both languages like----       Goods to be delivered:/ Morada de Entrega:
    and the above headings in English are hard-coded.
    Kindly suggest me on this.
    Thanks in advance.
    Arun.

    Hi Arun,
    Use Standard text ade those text elements. Then use those in SAP script using different languages.
    Regards,
    Amitava

  • Hard Coded Path Problem while using  WEBUTIL_C_API

    My 9i form is calling a C program using WEBUTIL_C_API it works fine with out any problem, if i hard code the path of DDL FILE as follows.
    f_handle := WEBUTIL_C_API.register_function('c:\winnt\system32\tabs.dll','buildit');
    If i remove the hard coded path then the form does not work.
    How can i overcome the probelem?
    Thanks

    The DLL has to be on the OS PATH.
    So it may be
    1) c:\winnt\system32 is not on your PATH (it should be)
    2) Maybe the PATH is too long, and c:\winnt\system32 is now too 'far back' to be used by the OS. Just move it forward.
    Similarly, if you put the DLL in another folder, then that folder should be on the PATH.
    If the above do not give a solution, it would be good to check with FileMon (freeware from www.sysinternals.com) to see if the OS is actually looking at your folder to locate the DLL.
    Regards - Roelof.

  • Error due to PI 7.1 hard coding

    Hello all,
    Have installed PI 7.1 and ran the post-installation steps.Now, the goal is to run a demo that will allow one to use PI 7.1 with services residing on a gsoap server.
    So, one does the following:
    1. http://<host>:50000/rep/
    2. It then starts: http://<host>:59000/rep/start/index.jsp.
    But -
    The problem is that I did the post-installation steps from one host. The program then creates the page (index.jsp) above with the hard coded http address that I did the post-installation from. 
    In other words, if I did the post-installation from inside the network - on host "youhoo", then all throughout the document: http://<host>:59000/rep/start/index.jsp. there are references to http://youhoo:50000.
    Now,
    I could not run the page because I had not downloaded a JRE >= 1.5. So, the next day, I download the JRE onto a different laptop - OUTSIDE the network and then attempt to run the page again.
    Because I am trying to run the program from outside the network, I may do it as:
    http://youhoo.outside.com:50000/
    But,
    Because all throughout the page: index.jsp, there is a reference to http://youhoo:50000, the page fails and does not work -
    Again, it is because the old http address is hard coded into this page  index.jsp  (i.e. http://youhoo:50000 AND NOT http://youhoo.outside.com:50000).
    How can one regenerate it so that the hard code can be changed?
    I hope that this has been made clear
    TIA

    Can you note the name of the task that I need to re-run? I tried to re-run the entire thing and it stopped with the first task - I could not do it (I think) because it is something that can only be ran once.
    The name of the first task is: A1S Source System Parameter Creation
    So,
    1. Please let me know if re-running the task " A1S Source System Parameter Creation" is a good or bad thing
    --- and ---
    2. Let me know the name of the task that I need to run in order to regenerate the faulty .jnlp.

  • User Logic for Conversion Type Instead of Hard coding in query.

    Hello , Good response from SDN but thats all standard which I know. Please help me to resolve the problem as stated below. SDN friends are always best help.
    Requirement: User will select the Target Currency; Will select the Exchange Rate like Monthly Avg 002M. Now there has to be a variable in Conversion which tells the logic to pick Conversion Type ZVHGR if  Exchange Rate = 002M, but if Exchange Rate = 001, then Conversion Type ZVHMR.
    <u><b>
    Approach to solve abo</b></u>ve
    1. I have created a Currency Translation Type " FiscperConversion" "ZVHGR" now this has Exchange Rate Type from Variable "ZVARN" (Which is a variable single value manual input on 0RTYPE Infoobject for exchange rate.)
    2. Now Currency Tab: Target Currency is selected from Variable placed in the Report. ZRPVAR.
    3. Now the Variable Time Reference is used. Standard Infoobject 0FISCPER
    which is beginning of period.
    Now all the above is done. Let go to the query and For Value of kEYFIGURE "Audit Balance" in Conversion Tab Conversion Type is specified is "FiscperConversion" ZVHGR"same as above and thats it. But the problem is here user want a variable that user can select the Conversion Type Instead of Hard coding.
    <b>Please suggest how to create this variable for Conversion Type and specify in query designer since In Conversion Tab this is not allowed to have variable.</b>
    Please help me very soon
    Thanks
    Soniya Kapoor
    null

    Hello soniya
    CTK ( currency translation key) includes
    1. Exchange rate type - variable
    2. Time base              - Variable
    3. Source abd TGT currency    - variable
    if all the things are given in variable why and what extra you need by selecting currency translation key from user input. I think you should ask business user again abt their requirement.
    I can think of inputing CTK if say you have choosen time base as static ( Fix value)...say in one key u r using fiscal period as base and in other u r using calday as base...
    Thanks
    Tripple k

Maybe you are looking for

  • House move - no BT line there - contract exit opti...

    Apologies if this question has been asked before but I've searched for the offical BT policy document reagarding house move but can't find anything. I have 3 months left on a 12 month contract and i'm about to move house. According to BT my new renta

  • Incorrect display of table

    Hey all, I have a problem with the display of my table. I have a category table with category id , name, and description. The records for category id and name display perfect but in the description i have the categoryid,name, and description...here i

  • You may not need to install the Run Time Engine...

    I know this has been mentioned before, but after a long search of the archives, I couldn't find the right person to give credit to - sorry! If you have a simple exe, you may not need to install the runtime engine on the target machine at all - all yo

  • REP-51018 -- cookie method is not working :(

    Trying to invoke a simple report from a simple form by using web.show_document() if I pass the userid=x/y@z then it work fine if I try to use the cookie method as defined in the OTN whitepaper "Secure Web.Show_Document() calls to Oracle Reports", I a

  • ST04 tables

    Hi All, Can any one tell me the tables used to display the progarams performance . Actually i am suppose to write the report to work as ST04. Thanks Babu