Database updatation of status

Hi friends
I am working in Multilevel ESS leave request workflow. After 1st level approval the status has to convert from approved to sent my code is doing that by calling the method but when i use the commit work its not updating the database table throwing some expection. Every time it throws different expection. Is there any standard function module which updates the table with status sent.
Am using the following method to change the status from approved to sent.
CALL METHOD CL_PT_REQ_BADI=>INITIATE_STATE_TRANSITION
               EXPORTING
                IM_REQUEST    = L_V_REQUEST
                IM_EVENT      = L_V_EVENT
               IMPORTING
                EX_NEW_STATUS = STATUS.
            IF SY-SUBRC = 0.
            COMMIT WORK.           " AND WAIT.
Here my sy-subrc = 0 but when it commits its going in loop inside the standard code which throws some expection.
Is there any standard BAPI or function module to update the tables.
Regards
vijay

Hi Vijay,
If I get you right, you need to change status of a business transaction. To do so you can use the FM CRM_ORDER_CHANGE_STATUS.
CALL FUNCTION 'CRM_ORDER_CHANGE_STATUS'
  EXPORTING
    IV_REF_GUID           = <Guid>
    IV_STATUS             = <Status Code>
EXCEPTIONS
   PARAMETER_ERROR       = 1
   NOT_ALLOWED           = 2
   ERROR_OCCURRED        = 3
   OTHERS                = 4
Hope this helps!
Regards,
Saumya

Similar Messages

  • Locking issue in workflow with conseutive database update

    Dear Workflowers,
    We are in ECC 5.0 and release 6.40. We went live for SAP in February and we are currently using workflow in PLM module for DMS and ECM.
    We have been facing this locking issue randomly happened in our production and quality system. The error from workflow log is "Document XXXX is locked by WF-BATCH". I have two steps in workflow one is to update the document user( from originator to editor with custom BO "zdraw" new method "setuser") and the next step is to update the document status( BO "zdraw" "setstatus" method which inherited form standard BO "draw").  
    I have tried to use "wait" (1st try) , statements  "BAPI_DOCUMENT_ENQUEUE", "BAPI_DOCUMENT_DEQUEUE" (2nd try) and  "Commit work and wait" (3rd try) to add one step in between, however the issue remains.
    The other question I had was we need to write "commit work" when we use BAPI to perform database update in the ABAP program. But I don't see "commit work" in the method of BO(for example "setstatus" in "draw" object) which performs database update. How does workflow perform DB update properly without "commit work" by referencing standard method?
    Could anyone please share your expertise with the issue I am facing?
    Thank you in advance,
    Merta

    Hi Merta,
    Regarding COMMITs: theoretically you should never use COMMIT statements because the Workflow runtime handles that - the transaction of executing the task is the LUW, not your method. By adding COMMIT WORK you are also committing the workflow task execution.
    In practice however there are the occasional exceptions where something just won't work without an explicit commit - but the theory remains that you should always try it without.
    Regarding your problem, the one way to be certain that a DB update is complete is to use a terminating event - either through change documents or status management.
    Failing that, you can write a wrapper method for SETSTATUS that does something like:
    do 10 times.
      try to lock it.
      if success.
        unlock.
        swc_call_method self 'SetStatus' container.
        set success flag.
      else.
        wait up to 3 seconds.
      endif.
    enddo.
    if no success, raise exception.
    Cheers,
    Mike

  • VAMT 3.0 unknown error 0x80131904 on update license status

    I have VAMT 3.0 installed on a windows 2008 R2 server with SQL Express installed also, both from Windows ADK.
    When I try to update license status on VAMT 3.0 on a specific windows 7 computer it ends with error: unknown error (0x80131904).
    For Windows Servers an Office on windows XP it works fine.
    These are some events:
    Log Name:      Volume Activation Management Tool
    Source:        VAMT Runtime
    Date:          4/17/2013 11:52:50 AM
    Event ID:      1000
    Task Category: None
    Level:         Warning
    Keywords:      Classic
    User:          N/A
    Computer:      VMATServer
    Description:
    Software provider for application: 59a52881-a989-479d-af46-f275c6370663 was unavailable on machine:
        Machine Name: Windows7Computer.mycompanydomain
        OS Version  : 6.1.7601
        OS Edition  : Microsoft Windows 7 Professional
        Network Type: Domain
        Network Name: mycompanydomain
        Is KMS Host? False
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="VAMT Runtime" />
        <EventID Qualifiers="0">1000</EventID>
        <Level>3</Level>
        <Task>0</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-04-17T17:52:50.000000000Z" />
        <EventRecordID>29540</EventRecordID>
        <Channel>Volume Activation Management Tool</Channel>
        <Computer>VAMTserver.mycompanydomain</Computer>
        <Security />
      </System>
      <EventData>
        <Data>Software provider for application: 59a52881-a989-479d-af46-f275c6370663 was unavailable on machine:
        Machine Name: Windows7Computer.mycompanydomain
        OS Version  : 6.1.7601
        OS Edition  : Microsoft Windows 7 Professional
        Network Type: Domain
        Network Name: mycompanydomain
        Is KMS Host? False
    </Data>
      </EventData>
    </Event>
    Log Name:      Volume Activation Management Tool
    Source:        VAMT Runtime
    Date:          4/17/2013 11:52:49 AM
    Event ID:      1000
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      VAMTServer.mycompanydomain
    Description:
    Encountered error while updating product on machine
        Machine Name: Windows7Computer.mycompanydomain
        OS Version  : 6.1.7601
        OS Edition  : Microsoft Windows 7 Professional
        Network Type: Domain
        Network Name: mycompanydomain
        Is KMS Host? False
     System.Data.SqlClient.SqlException: String or binary data would be truncated.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
       at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges()
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProductsInternal(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProducts(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.UpdateProductsProvider.DiscoverProducts()
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="VAMT Runtime" />
        <EventID Qualifiers="0">1000</EventID>
        <Level>2</Level>
        <Task>0</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-04-17T17:52:49.000000000Z" />
        <EventRecordID>29538</EventRecordID>
        <Channel>Volume Activation Management Tool</Channel>
        <Computer>VAMTServer.mycompanydomain</Computer>
        <Security />
      </System>
      <EventData>
        <Data>Encountered error while updating product on machine
        Machine Name: Windows7Computer
        OS Version  : 6.1.7601
        OS Edition  : Microsoft Windows 7 Professional
        Network Type: Domain
        Network Name: mycompanydomain
        Is KMS Host? False
     System.Data.SqlClient.SqlException: String or binary data would be truncated.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
       at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges()
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProductsInternal(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProducts(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.UpdateProductsProvider.DiscoverProducts()</Data>
      </EventData>
    </Event>
    Log Name:      Volume Activation Management Tool
    Source:        VAMT Runtime
    Date:          4/17/2013 11:52:49 AM
    Event ID:      1000
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      VAMTserver.mycompanydomain
    Description:
    Encountered an error while saving discovered products to database: System.Data.SqlClient.SqlException: String or binary data would be truncated.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
       at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges()
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProductsInternal(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProducts(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="VAMT Runtime" />
        <EventID Qualifiers="0">1000</EventID>
        <Level>2</Level>
        <Task>0</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2013-04-17T17:52:49.000000000Z" />
        <EventRecordID>29537</EventRecordID>
        <Channel>Volume Activation Management Tool</Channel>
        <Computer>VAMTServer.mycompanydomain</Computer>
        <Security />
      </System>
      <EventData>
        <Data>Encountered an error while saving discovered products to database: System.Data.SqlClient.SqlException: String or binary data would be truncated.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteReader()
       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)
       at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
       at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
       at System.Data.Linq.DataContext.SubmitChanges()
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProductsInternal(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)
       at Microsoft.Licensing.VolumeActivation.VamtDataStore.AddDiscoveredProducts(IList`1 availableProducts, IList`1 activeProducts, SoftwareProtectionService provider, Boolean doNotDeleteProducts)</Data>
      </EventData>
    </Event>
    Please help.

    String or binary data would be truncated.
    The statement has been terminated.
    Above is the error in stack. The general meaning of the error is what we are trying to insert a larger length value. For example inserting value 'Balmukund' in varchar(8) column would fail because my name as 9 characters.
    Since its raised by VAMT, this has to be reported to them to find where the problem is.
    Balmukund Lakhani
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog |
    Team Blog | @Twitter
    | Facebook
    Author: SQL Server 2012 AlwaysOn -
    Paperback, Kindle

  • SAP database updations

    Hi all
         I just want to know whether we can do the SAP database updations through a JAVA program.If we can do this then please explain to me how we can do this.I just want to access the data in the database(SAP) and do the updations whenever we need it through the JAVA program.
    Thank You.
    Regards
    Giri

    Giri,
    Ya...Java APP sents data to XI and XI needs to insert the data into the database.
    Before the next round of data is sent by the Application, Xi should sent back info on the status of the records.
    Is this what you want?
    This will be like I have pointed earlier possible without a BPM. But, make the call from the sending application Synchronous. And then map the JDBC response to the calling aplication.
    But this updation is only possible through XI.
    If i got the requirement wrong can you let me know in more detail, what is it that you are trying?
    Reward if solved

  • Update parent status based on all children status and sum of children amount.

    Hi,
    I need to write sql query for the following scenarios.
    We have 3 financial systems (sys1, sys2, sys3) where a same transaction gets entered independently into each system OR entered into one and exported to the other system. Transaction need not be in all 3 systems.
    We need to create reconcile report to see the status of transaction and display if it is reconciled or not. For this, in our stored procedure we are pulling data from 3 systems into temp tables and using CTE and other logic marking each transaction status
    in each system temp table. One of the systems (eg sys1), we made it as source.
    Sys1 temp table has both parent and child records and are distinguished using type. Sys2 and sys3 has only children records.  When report is created, we are showing parent  from sys1 temp table and
    children from new temp table where children status is updated based on availability of it in all 3 systems.
    DECLARE
    @sys1 TABLE
    ID int,
    childID varchar(20),
    ParentID varchar(20),
    RecType decimal(3,0),
    SettleDate smalldatetime,
    Principal money,
    Sys3ID varchar(16)
    NULL,
    Sys2ID int
    NULL,
                            Status varchar(25) NULL
    DECLARE
    @sys2 TABLE
    TxID int
    PRIMARY KEY NOT
    NULL,
    CommonTransactionID varchar(16),
    SettleDate smalldatetime,
    Par money,
    Sys3ID varchar(16) NULL,
    Sys1ChildID,
    Sys1ParentID bigint
    DECLARE
    @sys3 TABLE
    Sys3ID varchar(16),
    REFERENCE
    varchar(16),
    VALUE_DATE datetime,
    DIRECTION char(1),
    AMOUNT money,
    RecSource varchar(2)
    Insert Into @sys1 (ID, childID, ParentID, RecType, SettleDate, Principal)
    Select 172876, 217955, 217954, 100, ‘2015-03-01’, 100.00
    Union
    Select 172877, 217956, 217955, 50, ‘2015-03-01’, 15.00
    Union
    Select 172878, 217957, 217955, 50, ‘2015-03-01’, 25.00
    union
    Select 172879, 217958, 217955, 50, ‘2015-03-01’, 10.00
    Union
    Select 172880, 217959, 217955, 50, ‘2015-03-01’, 10.00
    union
    Select 172881, 217960, 217955, 50, ‘2015-03-01’, 40.00
    Insert Into @sys2(TxID, Sys1ID, settleDate, Par)
    Select 4336620, 217956, ‘2015-03-01’, 15.00
    Union
    Select 4336621, 217957, ‘2015-03-01’, 25.00
    union
    Select 4336613, 217958, ‘2015-03-01’, 10.00
    Union
    Select 4336614, 217959, ‘2015-03-01’, 10.00
    union
    Select 4336615, 217960, ‘2015-03-01’, 40.00
    Insert into @sys3(Sys3ID, Reference, Value_Date, Direction, Amount)
    Select 1, ‘5654471 4336620’, ‘2015-03-01’, ‘O’, 15.00
    Union
    Select 2, ‘5654481 4336621’, ‘2015-03-01’, 'O',25.00
    Union
    Select 3, ‘5654491 4336613’, ‘2015-03-01’, 'O',10.00
    Union
    Select 4, ‘5654501 4336614’, ‘2015-03-01’, 'O',10.00
    Union
    Select 5, ‘5654511 4336615’, ‘2015-03-01’, 'O', 40.00
    After going thru lot of other logic, final temp table will have only children with status assigned. The above temp table data is only for 1 scenario.
    The following are status of children.
    This is how status of children is determined:
    Not Settled – All child records start as Not settled in temp tables.
    Settled – when record exists in sys3 and other criteria is met.
    Partially settled – record exists in sys3 and either in sys1 or sys2 or other criteria is not met.
    Reconciled – child record should exist in all 3 systems and all criteria is match
    Mismatched – record has wrong amount when compared in any of 2 systems.
    **************** My Part below*******************
    My part is to update the status of parent based on children status and parent amount must match sum of child amounts. If amounts don’t match, then leave the status of parent as null.
    Determining the status of parent:
    Not Settled – None of children has yet settled.
    Settled – All children are settled.
    Partially settled – some of children are as settled OR 1+ children are partially settled.
    Reconciled – All children are reconciled.
    Partially Reconciled – some children are partially reconciled.
    Null – 1 or more childen has a status of mismatched.
    AND sum of children amount should match parent amount
    How can I update the status of parent based on all children and sum of amount of children equal to parent amount.
    Thanks,
    Spunny

    >> We have 3 financial systems (sys1, sys2, sys3) where the same transaction gets entered independently into each system OR entered into one and exported to the other system. Transaction need not be in all 3 systems. <<
    Your design is fundamentally wrong. In RDBMS, we want to have one fact, one way, in one place in the schema. The goal of all databases is to remove redundancy, not increase it. This not just SQL; this was true for hierarchical and network databases before them! 
    >> We need to create reconcile report to see the status of transaction and display if it is reconciled or not. For this, in our stored procedure we are pulling data from 3 systems into temp tables and using CTE and other logic marking each transaction
    status in each system temp table. One of the systems (eg sys1), we made it as source. <<
    You have re-invent the worst of 1970's file processing, but you want to use a temp table instead of scratch tape. This is not RDBMS or good SQL. 
    >> Sys1 temp table has both parent [sic] and child [sic] records [sic] and are distinguished using type. Sys2 and sys3 has only children [sic] records [sic]. When report is created, we are showing parent from sys1 temp table and children from new temp
    table where children [sic] status is updated based on availability of it in all 3 systems. <, 
    The terms “child” and “parent” are not part of RDBMS. They come from network databases. You are building fake pointer chains we do have referenced and referencing tables. Or do you mean to model weak and strong entities? Where is the DRI actions?
    These things are not tables! They have no keys, so they are called (garbage) piles. But even the garbage is wrong. There is no generic “id” in RDBMS; it has to be “<something in particular>_id” to be valid. Since you do not do math on it, it should not
    be a numeric. 
    A “rec_type” is a nominal scale, so it cannot be a numeric either! Likewise, we have no generic “status”, but a status is state of being so it has to have a temporal dimension. And did you know that “reference” is a reserved word in SQL as well as another ISO-11179
    violation. 
    The MONEY data type does not do correct math. Google it! It is another Sybase left-over that nobody should ever use. 
    Finally, you used the old Sybase INSERT INTO ..SELECT..), .. disaster instead of the ANSI/ISO Standard VALUES table constructor. 
    >> This is how status of children [sic] is determined: ..
    My part is to update the status of parent [sic] based on children [sic] status and parent [sic] amount must match sum of child [sic] amounts.<<
    Your narrative describes what Tom Johnston called a Non-Normal Form Redundancy. We do not put summary data in the strong entity; another basic data modeling principle. We build a VIEW that gives us the current summary. Your mindset is still in punch cards and
    magnetic tape files. 
    "No matter how far you have gone down the wrong road, turn around!" -- Turkish proverb. 
    Can you start over and do it right? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Monitoring database updation / LAN connection

    I have a database (SQL) installed in server and all other PC is connected throught LAN. I am running one application in remote PC in which continous testing is running and status is updated in database.
    During testing if LAN is disconnected then database updation will be failed and hence record won't be added to database.
    How to ensure record I am writing to database is written without reading it back?
    My only objective is to ensure that LAN is connected and record is continously updated 
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

    If you want a simple solution, that is replication. You see replication works both ways. The network database keeps your local copy updated with new data that it has and which you will need, and your local copy keeps the network database updated with new data that you generate. You don't have to do anything, the two copies of SQL Server handles it all between themselves.
    And for what it's worth, I have been using databases with LV for over 20 years and have never seen a single instance where an INSERT or UPDATE ran error-free to completion and the data wasn't in the database. If that's your concern, there is nothing to worry about.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Error while updating the status record of IDOC in SAP

    Hi All,
    I am facing this problem. I have done outbound processing and IDOC was sent successfully from SAP to EDI system and it was processed in EDI and now EDI system wants to send the status back to SAP with a status message and the status number that we are using is '24' and we have mapped all the fields in the status table EDIDS and made sure that EDI system sends all those and I think Counter field can not be determined by EDI system so EDI system used the counter '1' since it can not determine how many counters are already there in SAP and unless we pass the value to this counter field we were getting the error. After passing all the values the status of the IDOC is updated with the status '00' instead of '24' and we do not know why it is happened and I would like to know how SAP converts the status record that is received from the EDI system.
    Please let me know how the status record will be translated into SAP from EDI system and I ahve followed basically EDIDS structure and the IDOC status is updating in SAP but with wrong status number and the alignemnt also missing in SAP fields like if I give some text in the EDI it is splitting and storing in 2 fields.
    Please help me in this and I think I have explained the problem in a detail manner.
    Thanks,
    Ramesh.

    Hi Naresh,
    Thanks for the reply and my question is since EDI system is able to send the status back to SAP from EDI system and only problem is it is updatinf the status wrong and I have checked the EDIDS table also and the entry is creating with another counter and please confirm me that it is because of EDI does not support the status record update so that I can confirm to the client that there is nothing wrong in the way SAP functions and EDI system can not update the status code in the SAP.
    Thanks,
    Ramesh.

  • Why is it when i update my status on facebook from iohone it splits the updates into two differents boxes with some funky symbol. I have uninstall facebook and installed it over and it still does it. only the facebook IPHONE app.

    why is it when i update my status on facebook from iphone it splits the updates into two differents boxes with some funky symbols at the beginning.. I have uninstall facebook and installed it over and it still does it. only the facebook IPHONE app where it says to update staus text to FBOOK  i have already update my phone too.
    if i go on the facebook site and update there through a brower on iphone it will work fine just cant us IPHONE mobile upload,  . But its a pain of not using my IPHONE APP for facebook cause it does that.

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • Update activity status based on Customer request status,

    Hello,
    I have a requirement to update the status field of a service request activity to Completed when the service request status = closed. Any suggestions?
    Thanks,
    SKJ

    If the field they are updating is in the same object it shouldn't be an issue. If another object needs to be updated then the workflow won't work.
    Integration events can be used for this. generate a event and have a external process poll the integration event queue for new events. when received, it can do whatever is necessary via web services.

  • User Exit to update user status at VA01/VA02

    Hi Expert
    Please help identify any User Exit to update User Status stored in tables (JSTO/JEST), at time of sales order (Business Object 2032) creation / change.
    Requirement is to set check mark on a specific user status in case of a material master is missing HTS code.
    Regards-Aamir

    Hi,
    If your requirement is to set the check the HTS field in the material master, you can make the field as Mandatory without which the  Material cant be saved
    You can make this field mandatory in OMS9 transaction code with field status as 89 and the field is MARC-STAWN
    Please revert if you need more details
    regards,
    santosh

  • STATUS_UPDATE error to update USER STATUS - Update termination error

    Hi All,
    I am using status_update FM in sales order user exit MV45AFZZ in a perform routine for updating user status in line item for sales order. There are 4 custom statuses created for the sales order line item. 1,2 3, and 4 by configuration. My job is to select one of those based on user selection.
    Scenario: During change order process using  VA02, I have to change the existing status to a third status when user selects the second one. That is for example, in VA02, user selects status 4 from previous status 3, and save, I have to make the status 4 inactive and save the new status 2 instead of 3 though user selected 3. How do I achieve this.?  ????Any programming example is really appreciated. Thanks!!!
    I am right now using STATUS_READ and reading the existing status 4. Then making it inactive using status_update FM. And updating the new status 2 as active one and 3 as inactive again. Two inactive updates and one active update is throwing an update termination error while saving the sales order.
    Any help is really appreciated. 
    Thanks
    Ricky

    Hi ricky,
    For saving any changes you need to have a Z-table.
    In programs we can't store the user selection. In your case you can create a z-table and store the status there and delete the last status. The process would be faster as you will always have one record in the table.
    . One more advantage is you can even track the changes through the Z-table(User who is changing it.)
    Hope this solution will surely help you.
    Cheers
    Suvi

  • In Update_Opportunity_Pre error while updating opportunity status

    Hello,
    We are encountering an error 'In Update_Opportunity_Pre' in the log when trying to update apportunity status to a closed status using Update Opportunity API. Has anyone encountered this error before? If so, I would appreciate if you could share the fix/work around for this issue.
    Thanks,
    Dinakar.

    Hi,
    The log is as follows:
    Opportunity status changes to Cancelled
    ..... in pel_lead_utilities.update_oppty_header
    ..... Error Message In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre
    ..... AS_OPPORTUNITY_PUB.Update_Opp_Header
    ..... x_return_status = E
    ..... Error Details = In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre
    ... pel_lead_utilities.update_oppty_header :: v_return_status : E
    ... pel_lead_utilities.update_oppty_header :: In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre In Update_Opportunity_Pre

  • How to "roll back" the model if a database update fails

    I'd like to know if there's a way to "roll back" the model (the values in the managed beans) if a service call to a database fails during the Invoke Application phase. My understanding of the JSF lifecycle is that the values in the model are updated before a service call to a database would happen. If the database update operation fails, it seems to me that the data in the model and the database would be inconsistent.
    For example, say I have a ridiculously simple application that updates a names database. The fields are id, last name, first name. The application has a simple view that allows the user to update a name in the database. The user updates the last name field for a particular record from "Doe" to "Smith" and clicks "submit". The request goes through the lifecycle, the model values are updated from the web form during the Update Model Values phase, then the call to update the database fails during the Invoke Applications phase (the database connection failed). When the Render Response phase completes, the UI would display an error message where I put <h:messages> but the last name value in the UI would show "Smith" instead of "Doe". Is there something I can do to roll the model value back to "Doe" if the database call fails?
    I know that I could redirect to a technical error page, but I'd like to avoid it unless it is the best thing to do.
    I'd appreciate any advice you can offer.
    Thanks.
    - Luke

    I'd like to know if there's a way to "roll back" the model (the values in the managed beans) if a service call to a database fails during the Invoke Application phase. My understanding of the JSF lifecycle is that the values in the model are updated before a service call to a database would happen. If the database update operation fails, it seems to me that the data in the model and the database would be inconsistent.
    For example, say I have a ridiculously simple application that updates a names database. The fields are id, last name, first name. The application has a simple view that allows the user to update a name in the database. The user updates the last name field for a particular record from "Doe" to "Smith" and clicks "submit". The request goes through the lifecycle, the model values are updated from the web form during the Update Model Values phase, then the call to update the database fails during the Invoke Applications phase (the database connection failed). When the Render Response phase completes, the UI would display an error message where I put <h:messages> but the last name value in the UI would show "Smith" instead of "Doe". Is there something I can do to roll the model value back to "Doe" if the database call fails?
    I know that I could redirect to a technical error page, but I'd like to avoid it unless it is the best thing to do.
    I'd appreciate any advice you can offer.
    Thanks.
    - Luke

  • Why do we have to use SwingUtilities.invokeLater() to update UI status?

    I just don't understand very well why we have to use SwingUtilities.invokeLater() to update UI status. Why not just new a thread in actionPerformed() method and do time consuming tasks in this thread and update UI status in it? Some tutorials say it is not safe to update UI status not in Event Dispatch Thread, I don't understand, why is it not safe? Can anyone provide a scenario for this? I just write an example, a button and a progressbar, click button, progressbar keeps updating value. I just create a new thread to do this, don't find any issue. Thanks.

    [Swing single threaded rule|http://www.lmgtfy.com/?q=swing+single+threaded+rule]
    db

  • To perform database update in a module with AT EXIT-COMMAND addition

    Dear All,
    I have a function code 'EXIT' with function type 'E'. When this function code is triggered, my screen should close.
    In the module that handles this function code (defined with AT EXIT-COMMAND addition), I will prompt the user whether he/she want's to save the data before exiting with the POPUP_TO_CONFIRM_STEP function module. The text message in the dialog box is "Do you want to save before exiting?".
    When the user wants to save the data, a simple UPDATE statement will be executed to write the data on screen to database.
    The problem here is since the module is defined with AT EXIT-COMMAND addition, the data on screen won't be copied to their corresponding variable on the code (correct me if I'm wrong). Therefore, even though database update is performed, the data written to database are no different that the original.
    How to perform database update in a module with AT EXIT-COMMAND addition?
    or
    Is it even a "custom" or a "good practice" to prompt user to save data before exiting?
    Thanks in advance,
    Haris

    With an exit command, if there's anything that would be lost, I would prompt "Data will be lost, do you wish to continue?". If they do, the database is not updated, if they don't, they stay in the transaction.
    This is because the exit command runs before validation. So how can you know the data is correct?
    If you have a button to leave the transaction that isn't an exit command, then you could prompt to save instead. There the choices should be - quit without saving, save and quit, don't quit.
    Doing a database update in an exit command is not a good idea.
    matt
    Edited by: Matt on Mar 15, 2011 11:53 AM

Maybe you are looking for