Commit Handling for Synchronous Write Scenarios

Hello gurus,
I have to use syncronous interfaces between SAP and custom UI application. SAP will both be client and server in different scenarios. I would like to know how I can achieve consistency for write operations with commit handling mechanisms, both for PI 7.0 and PI 7.1. Proxies will be used on SAP side.
All helpful hints/linkd/docs will be very much appreciated and rewarded.
Thank you for your input.
Gökhan

Hi Gokhan,
I believe you refer to the server proxy coding where the write operations are performed.
If you are using ABAP server proxy, then the coding should be similar to the way you handle SAP LUW in any ABAP program. In the method of your ABAP proxy class, you can group several BAPI calls or changes to several tables into one LUW and just the do the commit at the very end.
You need to create update FM to updae your tables and call them in update task mode.
For example.
LOOP AT <your incoming message table>
  CALL <BAPI> IN UPDATE TASK
  CALL <custom FM to update tables> IN UPDATE TASK
ENDLOOP.
CALL BAPI_TRANSACTION_COMMIT.
Regards,
Lim...

Similar Messages

  • Commit Handling In RFC adapter

    hi...
    Can any one explain what is the commit Handling in RFC Adapter scenario
    venkat

    Hi ,
    From documentation
    <i>"Commit Control for Individual BAPI Calls
    If you want to use this communication channel to call BAPIs as remote-enabled function modules that change data in the database, set the indicator.
    If executed successfully, the transaction is written to the database by calling the function module BAPI_TRANSACTION_COMMIT explicitly. If an error occurs, the transaction is rolled back by BAPI_TRANSACTION_ROLLBACK.
    The result is determined by the value of the field TYPE in parameter RETURN. If successful, the tables are empty and the values “”, “S”, “I”, and “W” are displayed. All other values are regarded as errors.
    To change this setting, set the indicator BAPI Advanced Mode.
    In the Successful RETURN-TYPE Values table, enter the values that should lead to a successful execution."</i>
    We have a " Commit Control for Individual BAPI Calls" option in RFC reciever adapter to commit the BAPI.
    Sekhar

  • SAP PI conceptual best practice for synchronous scenarios

    Hi,
    <br /><br />Apologies for the length of this post but I'm sure this is an area most of you have thought about in your journey with SAP PI.
    <br /><br />We have recently upgraded our SAP PI system from 7.0 to 7.1 and I'd like to document  best practice guidelines for our internal development team to follow.
    I'd be grateful for any feedback related to my thoughts below which may help to consolidate my knowledge to date.
    <br /><br />Prior to the upgrade we have implemented a number of synchronous and asynchronous scenarios using SAP PI as the hub at runtime using the Integration Directory configuration.
    No interfaces to date are exposes directly from our backend systems using transaction SOAMANAGER.
    <br /><br />Our asynchronous scenarios operate through the SAP PI hub at runtime which builds in resilience and harnesses the benefits of the queue-based approach.
    <br /><br />My queries relate to the implementation of synchronous scenarios where there is no mapping or routing requirement.  Perhaps it's best that I outline my experience/thoughts on the 3 options and summarise my queries/concerns that people may be able to advise upon afterwards.
    <br /><br />1) Use SAP PI Integration Directory.  I appreciate going through SAP PI at runtime is not necessary and adds latency to the process but the monitoring capability in transaction SXMB_MONI provide full access for audit purposes and we have implemented alerting running hourly so all process errors are raised and we handle accordingly.  In our SAP PI Production system we have a full record of sync messages recorded while these don't show in the backend system as we don't have propogation turned on.  When we first looked at this, the reduction in speed seemed to be outweighed by the quality of the monitoring/alerting given none of the processes are particularly intensive and don't require instant responses.  We have some inbound interfaces called by two sender systems so we have the overhead of maintaing the Integration Repository/Directory design/configuration twice for these systems but the nice thing is SXMB_MONI shows which system sent the message.  Extra work but seemingly for improved visibility of the process.  I'm not suggesting this is the correct long term approach but states where we are currently.
    <br /><br />2) Use the Advanced Adapter Engine.  I've heard mixed reviews about this functionaslity, there areh obvious improvements in speed by avoiding the ABAP stack on the SAP PI server at runtime, but some people have complained about the lack of SXMB_MONI support.  I don't know if this is still the case as we're at SAP PI 7.1 EHP1 but I plan to test and evaluate once Basis have set up the pre-requisite RFC etc. 
    <br /><br />3) Use the backend system's SOAP runtime and SOAMANAGER.  Using this option I can still model inbound interfaces in SAP PI but expose these using transaction SOAMANAGER in the backend ABAP system.  [I would have tested out the direct P2P connection option but our backend systems are still at Netweaver 7.0 and this option is not supported until 7.1 so that's out for now.]  The clear benefits of exposing the service directly from the backend system is obviously performance which in some of our planned processes would be desirable.  My understanding is that the logging/tracing options in SOAMANAGER have to be switched on while you investigate so there is no automatic recording of interface detail for retrospective review. 
    <br /><br />Queries:
    <br /><br />I have the feeling that there is no clear cut answer to which of the options you select from above but the decision should be based upon the requirements.
    <br /><br />I'm curious to understand SAPs intention with these options  -
    <br /><br />- For synchronous scenarios is it assumed that the client should always handle errors therefore the lack of monitoring should be less of a concern and option 3 desirable when no mapping/routing is required? 
    <br /><br />- Not only does option 3 offer the best performance, but the generated WSDL is ready once built for any further system to implement thereby offering the maximum benefit of SOA, therefore should we always use option 3 whenever possible?
    <br /><br />- Is it intended that the AAE runtime should be used when available but only for asynchronous scenarios or those requiring SAP PI functionality like mapping/routing otherwise customers should use option 3?  I accept there are some areas of functionality not yet supported with the AAE so that would be another factor.
    <br /><br />Thanks for any advice, it is much appreciated.
    <br /><br />Alan
    Edited by: Alan Cecchini on Aug 19, 2010 11:48 AM
    Edited by: Alan Cecchini on Aug 19, 2010 11:50 AM
    Edited by: Alan Cecchini on Aug 20, 2010 12:11 PM

    Hi Aaron,
    I was hoping for a better more concrete answer to my questions.
    I've had discussion with a number of experienced SAP developers and read many articles.
    There is no definitive paper that sets out the best approach here but I have gleaned the following key points:
    - Make interfaces asynchronous whenever possible to reduce system dependencies and improve the user experience (e.g. by eliminating wait times when they are not essential, such as by sending them an email with confirmation details rather than waiting for the server to respond)
    - It is the responsibility of the client to handle errors in synchronous scenarios hence monitoring lost through P-P services compared to the details information in transaction SXMB_MONI for PI services is not such a big issue.  You can always turn on monitoring in SOAMANAGER to trace errors if need be.
    - Choice of integration technique varies considerably by release level (for PI and Netweaver) so system landscape will be a significant factor.  For example, we have some systems on Netweaver 7.0 and other on 7.1.  As you need 7.1 for direction connection PI services we'd rather wait until all systems are at the higher level than have mixed usage in our landscape - it is already complex enough.
    - We've not tried the AAE option in a Production scenarios yet but this is only really important for high volume interfaces, something that is not a concern at the moment.  Obviously cumulative performance may be an issue in time so we plan to start looking at AAE soon.
    Hope these comments may be useful.
    Alan

  • An exception handler is obligatory for synchronous RFC communication

    I am getting the error "An exception handler is obligatory for synchronous RFC communication" when I try to activate an Integration Process. Under a synchronous Send step, under Exceptions, I have System Error and the RFC.Exception Application Error to be handled. For both I have given the same Exception handler block. Is this not allowed? Why am I not able to go to same Exception handler block in case of both System Error as well as Application Error?
    Thanks

    you are right, it was erroring out due to the next step. Now if there is system error or exception, it will go to the exception branch. Here I need to have the ability to restart the process from this point after being alerted and having fixed the issue. So I am thinking of doing the send step again in the exception branch. But since the application error initially will exist soon after the alert is issued, this step will complete as I cannot handle application error a second time (this is where it was giving that error that exception handler was mandatory).
    Is there a way in which I can stop/fail the process after the exception branch gives the alert so that I can restart the failed branch again?

  • Multimapping for Synchronous interfaces.

    Hi,
    Is it possible to do multi mapping for synchronous interfaces.
    I have observed that when the cardinality of the target service  interface is changed to 0:unbounded , the response message mapping  tab disappears from operation mapping.
    Can anyone please suggest how it can be handled?
    I have a requirement to call a webservice and then write multiple files from the webservice response.

    Hi Soumya,
    i dont think so ...if you think theroitically. you are doing multimapping   where u  have a N:M relation... so it will be difficult match the respose directly.
    Since your scenario is syncrhronous, u have to rember the identity of source messgaes and then u need to reply back to those same identitiies. That means u have to use correlations  and that can be achived by BPM.

  • Exception handling in synchronous client proxy

    Hi, I have a synchronous outbound proxy-web service scenario. If our Post request (unknown data in the receiver) fails, the receiver system returns a 404 error that results in application error in PI. Now, I want know how to handle CX_AI_APPLICATION_FAULT using the standard fault message type (ExchangeFaultData). I couldn't find any reference for synchronous client proxies using this. I hope you can help me out. Thank you.

    Hi Mark,
    You have a link here How to handle CX_AI_SYSTEM_FAULT in RFC - Code Gallery - SCN Wiki or here https://help.sap.com/saphelp_nw04/helpdata/en/75/a55c3cff8ca92be10000000a114084/content.htm
    I dont know what is your exact problem, you can retrieve certain information in the ABAP code but i usually set a generic message like "Connection unsuccessful" because if you debbug the object the information is so technical to be showed to a client.
    Hope this helps.
    Regards.

  • Specify handler for a logger in properties file

    Hello All,
    Is there a way of specifying a specific handler for a specific logger within the logging.properties file? I have not been able to find any documentation on the logging.properties file settings. I am looking for something like this:
    com.eric.program.handlers = java.util.logging.ConsoleHandler
    com.frank.handlers = java.util.logging.FileHandler
    I would rather keep all my settings within this properties file instead of coding it. If you know where I can find some documentation, please let me know. I am using J2SE 1.4.1.
    Thanks.

    Well, after failing to assign a handler to a specific logger, I checked the LogManager source code and, alas, it only supports assigning handlers to the root logger.
    What a bummer ... I think this is a real flaw in the LogManager design, especially since log4j supports assigning appenders to specific logger.
    The (more or less) good news is that LogManager is designed for subclassing (by j2ee container apps, but hey) ... so you can try to add this functionality to your own LogManager and use that through the system property java.util.logging.manager.
    import java.io.*;
    import java.security.*;
    import java.util.*;
    import java.util.logging.*;
    * All properties whose names end with ".handlers" are assumed to define a
    * whitespace separated list of class names for handler classes to load and
    * register as handlers on the logger (whose name corresponds to the property
    * prefix). Each class name must be for a Handler class which has a default
    * constructor.
    public class CustomLogManager extends LogManager
        public CustomLogManager()
            super();
         * Overwritten to also add handlers
        public synchronized boolean addLogger(Logger logger)
            final boolean res = super.addLogger(logger);
            final String property = logger.getName() + ".handlers";
            if ( null != getProperty(property) )
                setHandlers(logger, property);
            return res;
        // Taken from java/util/logging/LogManager.java#initializeGlobalHandlers()
        private void setHandlers(final Logger logger, final String property)
            // We need to raise privilege here.  All our decisions will
            // be made based on the logging configuration, which can
            // only be modified by trusted code.
            AccessController.doPrivileged(new PrivilegedAction() {
                public Object run() {
                    // Add new global handlers.
                    String names[] = parseClassNames(property);
                    for (int i = 0; i < names.length; i++) {
                        String word = names;
    try {
    Class clz = ClassLoader.getSystemClassLoader().loadClass(word);
    Handler h = (Handler) clz.newInstance();
    try {
    // Check if there is a property defining the
    // handler's level.
    String levs = getProperty(word + ".level");
    if (levs != null) {
    h.setLevel(Level.parse(levs));
    } catch (Exception ex) {
    System.err.println("Can't set level for " + word);
    // Probably a bad level. Drop through.
    logger.addHandler(h);
    } catch (Exception ex) {
    System.err.println("Can't load log handler \"" + word + "\"");
    System.err.println("" + ex);
    ex.printStackTrace();
    return null;
    // Taken from java/util/logging/LogManager.java
    // get a list of whitespace separated classnames from a property.
    private String[] parseClassNames(String propertyName) {
    String hands = getProperty(propertyName);
    if (hands == null) {
    return new String[0];
    hands = hands.trim();
    int ix = 0;
    Vector result = new Vector();
    while (ix < hands.length()) {
    int end = ix;
    while (end < hands.length()) {
    if (Character.isWhitespace(hands.charAt(end))) {
    break;
    if (hands.charAt(end) == ',') {
    break;
    end++;
    String word = hands.substring(ix, end);
    ix = end+1;
    word = word.trim();
    if (word.length() == 0) {
    continue;
    result.add(word);
    return (String[]) result.toArray(new String[result.size()]);
    On the other hand, it might be possible to write a reusable config class which does that kind of initialization, too.

  • Make asynchronous event handler as synchronous using Powershell

    Hi All,
    Using custom coding i am able to change the asynchronous event handle to synchronous.
    Can anybody let me know Is there any other way to change the same. Like Powershell script or any.
    Without deploying the solution i want to change the event handler type.
    Please advice.
    Thanks & Regards
    MD.Liakath ali

      
    Hi 
    you can use power shell to do so
    Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue 
    $web = Get-SPWeb -Identity http://...
    $list = $web.GetList($web.Url + "/Lists/" + “list name”) 
    $type = "ItemAdded" #or any other type, like ItemDeleting, ItemAdding, ItemUpdating, ... 
    $numberOfEventReceivers = $list.EventReceivers.Count 
    if ($numberOfEventReceivers -gt 0)
     for( $index = $numberOfEventReceivers -1; $index -gt -1; $index–-) {
        $receiver = $list.EventReceivers[$index] ;
        $name = $receiver.Name
        $typ = $receiver.Type ;
     if ($typ -eq $type)  #or you can check ($name -eq "event receiver's name") if you have more then one event receivers of the same type
        $receiver.Synchronization = "Synchronous"
        $receiver.Update()
        Write-Host "Event receiver " $name " is changed to Synchronous"
    else
        Write-Host " There is no EventReceiver of type " $type " registered for this list "
    $web.Dispose()
    or
    $list = (get-spweb http://sharepoint/sites/test).lists['somelist']
    $def = $list.EventReceivers.Add()
    $def.Assembly = "MyReceiverAssembly, Version=1.0.0.0, Culture=Neutral,PublicKeyToken=a00000000a000ce0"
    $def.Class = "MyReceiverAssembly.MyReceiverClass"
    $def.Type = [Microsoft.SharePoint.SPEventReceiverType]::ItemAdded
    $def.Name = "My ItemAdded Event Receiver";
    $def.Synchronization = [Microsoft.SharePoint.SPEventReceiverSynchronization]::Synchronous
    $def.Update()
    this should be done at each level where list is present.
    or you can Edit the Elements.xml file of the event receiver in(14 hive layouts/feature folder) and set the synchronization element as below..
    <Synchronization>Synchronous</Synchronization>
    Synchronous</Synchronization> https://naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/">https://naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/
    Regards,
    Rajendra Singh
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
    http://sharepointundefind.wordpress.com/

  • An event handler for several subclasses.

    I've been trying to write an event handler that is parameterized by a window
    being passed to it. The event handler is intended to handle the exception event
    that occurs when the window completes. I have had problems trying to write this.
    The scenario is as follows.
    I have a task that listens to events that respresent requests for a window being
    opened. On receiving these, it starts the window, also as an asynchronous task.
    The windows that may be opened (say window classes B, C, and D) are all
    subclasses of window class A. The event handler that I register for (after
    instantiating the window) takes a window of class A as parameter. It responds to
    the exception events for the Display() method of window passed in.
    Now the problems I have encountered are as follows :
    To allow the event handler to respond to the exception event of a window of
    class A, class A has the exception event defined for it. To allow me to start a
    window of class B where completion = event, I also have to define the same
    exception event. This hides the return and exception for class A. The
    implications of this in the event handler is that the event cannot be trapped
    unless I cast the parameter passed in into class B on the ' when return_event '
    line. This makes the event handler specific to class B.
    (This situation is also presumable caused by the fact that each subclasses
    overrides the Display method of window class A, and the exception event is
    defined for the Display method.)
    An alternative approach I tried was using interfaces. I defined the exception
    event as an event on an interface. This was defined with the same parameters as
    the exception events of classes B, C, and D would have (ie. the exception
    event had two parameters - one of type GenericException, and one of ErrorMgr). I
    then made classes B, C, and D implement the interface. The event handler
    parameter would be the interface rather than class A. However class B would not
    compile as the GenericException parameter for the event in the interface uses
    the input mechanism, but the GenericException parameter for the exception event
    in the display event of classes B, C, and D uses copy input. I have ben unable
    to find a way to change the mechanism for event parameters.
    Has anybody got any ideas as to how I may be able to achieve the goals of an
    event handler that can respond the exception event of a number of subclasses.
    Thanks
    Steve Elvin
    Systems Developer
    Frontline Ltd.
    UK.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Steve,
    Try this. Have a method in your super class A , say StubDisplay
    which processes the event loop.
    Also make this method return Exception and/or completion events you
    desire.
    Instead of overriding Display() in your sublclasses, override this
    StubDisplay method.
    You need not have to redefine the exception/completion events in
    your sublclasses B,C ..because they naturally inherit from the super class
    A.
    Using interfaces may not be a good idea in this case because, you
    will be forced to implement them in your subclasses even if you dont
    need them in some specific cases.
    Good luck!
    Ajith Kallambella M.
    Forte Systems Engineer,
    Internationational Business Corporation.
    From: [email protected][SMTP:[email protected]]
    Reply To: [email protected]
    Sent: Wednesday, May 13, 1998 4:42 AM
    To: [email protected]
    Subject: An event handler for several subclasses.
    I've been trying to write an event handler that is parameterized by a
    window
    being passed to it. The event handler is intended to handle the exception
    event
    that occurs when the window completes. I have had problems trying to write
    this.
    The scenario is as follows.
    I have a task that listens to events that respresent requests for a window
    being
    opened. On receiving these, it starts the window, also as an asynchronous
    task.
    The windows that may be opened (say window classes B, C, and D) are all
    subclasses of window class A. The event handler that I register for (after
    instantiating the window) takes a window of class A as parameter. It
    responds to
    the exception events for the Display() method of window passed in.
    Now the problems I have encountered are as follows :
    To allow the event handler to respond to the exception event of a window
    of
    class A, class A has the exception event defined for it. To allow me to
    start a
    window of class B where completion = event, I also have to define the same
    exception event. This hides the return and exception for class A. The
    implications of this in the event handler is that the event cannot be
    trapped
    unless I cast the parameter passed in into class B on the ' when
    return_event '
    line. This makes the event handler specific to class B.
    (This situation is also presumable caused by the fact that each subclasses
    overrides the Display method of window class A, and the exception event is
    defined for the Display method.)
    An alternative approach I tried was using interfaces. I defined the
    exception
    event as an event on an interface. This was defined with the same
    parameters as
    the exception events of classes B, C, and D would have (ie. the
    exception
    event had two parameters - one of type GenericException, and one of
    ErrorMgr). I
    then made classes B, C, and D implement the interface. The event handler
    parameter would be the interface rather than class A. However class B
    would not
    compile as the GenericException parameter for the event in the interface
    uses
    the input mechanism, but the GenericException parameter for the exception
    event
    in the display event of classes B, C, and D uses copy input. I have ben
    unable
    to find a way to change the mechanism for event parameters.
    Has anybody got any ideas as to how I may be able to achieve the goals of
    an
    event handler that can respond the exception event of a number of
    subclasses.
    Thanks
    Steve Elvin
    Systems Developer
    Frontline Ltd.
    UK.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Ref in MBIA for stock write off required to be reflected in GL

    Dear Forum,
    We have a scenario where by the Approval is obtained before the stocks could be written off and the users want this manual approval no. to be recorded while creating the transaction for stock write off thru MB1A, such that this approval no. appears in the Stock Write Off GL against each of the line items for write offs. How could we achieve this? Is there a way to handle this.
    Thanks!
    Regards,

    Hi Shukitz,
    Thanks for the prompt response. Are you referring to the Doc Header Text, I tried putting the approval no. there but it does not get reflected in the GL Account. Is the item text different and where can I find the same in MB1A?
    Thanks once again for the help!
    Regards

  • Sematic group for a write optimized DSO

    Hello,
    I am loading from a datasource to a write optmized DSO. While doing so, I am not able to set semtantic key/group for the DTP.  I have turned error handling on using the setting 'Valid records update, No reporting(request RED)'.
    Is this setting not possible for a write optimized DSO? if not why not? and if yes, what am i missing!?
    Thanks a lot in advance,
    Prakash

    Thank you,
    here are my findings:
    - if data has been loaded with delta using the DTP, it is not possible to change the sematic groups any more - all requests have to be deleted first
    - the error handling must be turned on
    The issue is resolved.
    Marek

  • Exception handling for all the insert statements in the proc

    CREATE PROCEDURE TEST (
    @IncrStartDate DATE
    ,@IncrEndDate DATE
    ,@SourceRowCount INT OUTPUT
    ,@TargetRowCount INT OUTPUT
    ,@ErrorNumber INT OUTPUT
    ,@ErrorMessage VARCHAR(4000) OUTPUT
    ,@InsertCase INT --INSERT CASE INPUT
    WITH
    EXEC AS CALLER AS
    BEGIN --Main Begin
    SET NOCOUNT ON
    BEGIN TRY
    DECLARE @SuccessNumber INT = 0
    ,@SuccessMessage VARCHAR(100) = 'SUCCESS'
    ,@BenchMarkLoadFlag CHAR(1)
    ,@BenchmarkFlow INT
    ,@MonthYearStart DATE
    ,@MonthYearEnd DATE
    ,@StartDate DATE
    ,@EndDate DATE
    /* Setting the default values of output parameters to 0.*/
    SET @SourceRowCount = 0
    SET @TargetRowCount = 0
    /*Setting the Start and end date for looping */
    SET @MonthYearStart = @IncrStartDate;
    SET @MonthYearEnd = @IncrEndDate;
    /* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
    @InsertCase =0 means data will be inserted in the target TAB1
    @InsertCase =1 means data will be inserted in the target TAB2
    @InsertCase =2 means data will be inserted in the target TAB3
    @InsertCase =3 means data will be inserted in the target TAB4
    @InsertCase =4 means data will be inserted in the target TAB5
    @InsertCase =5 means data will be inserted in the target TAB6
    if @InsertCase =0
    WHILE (@MonthYearStart <= @MonthYearEnd)
    BEGIN
    SET @StartDate = @MonthYearStart;
    SET @EndDate = @MonthYearEnd;
    /* Delete from target where date range given from input parameter*/
    DELETE FROM TAB1
    WHERE [MONTH] BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
    AND [YEAR] BETWEEN year(@StartDate) and year(@EndDate)
    /*Insert data in target-TAB1 */
    BEGIN TRANSACTION
    INSERT INTO TAB1
    A,B,C
    SELECT
    A,BC
    FROM XYZ
    COMMIT TRANSACTION
    SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
    SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
    END -- End of whileloop
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT>0
    ROLLBACK TRANSACTION
    SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
    END CATCH
    END--End of Main Begin
    I have the above proc inserting data based on parameters  where in @InsertCase  is used for case wise execution.
     I have written the whole proc with exception handling using try catch block.
    I have just added one insert statement here for 1 case  now I need to add further insert  cases
    INSERT INTO TAB4
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    INSERT INTO TAB3
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    INSERT INTO TAB2
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    I will be using following to insert further insert statements 
    if @InsertCase =1 
    I just needed to know where will be my next insert statement should be fitting int his code so that i cover exception handling for all the code
    Mudassar

    Hi Erland & Mudassar, I have attempted to recreate Mudassar's original problem..here is my TABLE script;
    USE [MSDNTSQL]
    GO
    /****** Object: Table [dbo].[TAB1] Script Date: 2/5/2014 7:47:48 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[TAB1](
    [COL1] [nvarchar](1) NULL,
    [COL2] [nvarchar](1) NULL,
    [COL3] [nvarchar](1) NULL,
    [START_MONTH] [int] NULL,
    [END_MONTH] [int] NULL,
    [START_YEAR] [int] NULL,
    [END_YEAR] [int] NULL
    ) ON [PRIMARY]
    GO
    Then here is a CREATE script for the SPROC..;
    USE [MSDNTSQL]
    GO
    /****** Object: StoredProcedure [dbo].[TryCatchTransactions1] Script Date: 2/5/2014 7:51:33 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[TryCatchTransactions1] (
    @IncrStartDate DATE
    ,@IncrEndDate DATE
    ,@SourceRowCount INT OUTPUT
    ,@TargetRowCount INT OUTPUT
    ,@ErrorNumber INT OUTPUT
    ,@ErrorMessage VARCHAR(4000) OUTPUT
    ,@InsertCase INT --INSERT CASE INPUT
    WITH
    EXEC AS CALLER AS
    BEGIN --Main Begin
    SET NOCOUNT ON
    BEGIN TRY
    DECLARE @SuccessNumber INT = 0
    ,@SuccessMessage VARCHAR(100) = 'SUCCESS'
    ,@BenchMarkLoadFlag CHAR(1)
    ,@BenchmarkFlow INT
    ,@MonthYearStart DATE
    ,@MonthYearEnd DATE
    ,@StartDate DATE
    ,@EndDate DATE
    /* Setting the default values of output parameters to 0.*/
    SET @SourceRowCount = 0
    SET @TargetRowCount = 0
    /*Setting the Start and end date for looping */
    SET @MonthYearStart = @IncrStartDate;
    SET @MonthYearEnd = @IncrEndDate;
    /* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
    @InsertCase =0 means data will be inserted in the target TAB1
    @InsertCase =1 means data will be inserted in the target TAB2
    @InsertCase =2 means data will be inserted in the target TAB3
    @InsertCase =3 means data will be inserted in the target TAB4
    @InsertCase =4 means data will be inserted in the target TAB5
    @InsertCase =5 means data will be inserted in the target TAB6
    IF @InsertCase =0
    WHILE (@MonthYearStart <= @MonthYearEnd)
    BEGIN
    SET @StartDate = @MonthYearStart;
    SET @EndDate = @MonthYearEnd;
    /* Delete from target where date range given from input parameter*/
    DELETE FROM TAB1
    WHERE START_MONTH BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
    AND START_YEAR BETWEEN year(@StartDate) and YEAR(@EndDate)
    /*Insert data in target-TAB1 */
    BEGIN TRANSACTION
    INSERT INTO TAB1 (COL1,COL2,COL3)
    VALUES ('Z','X','Y')
    SELECT COL1, COL2, COL3
    FROM TAB1
    COMMIT TRANSACTION
    SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
    SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
    END -- End of whileloop
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT > 0
    ROLLBACK TRANSACTION
    SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
    END CATCH
    PRINT @SUCCESSMESSAGE
    END--End of Main Begin
    GO
    I am just trying to help --danny rosales
    UML, then code

  • Creation of package structure for ABAP proxy scenario

    Hi All,
    I have a doubt on package structure used for ABAP proxy scenario. What is the specific reason to create a four level package structure? Can some one please explain? Thanks in advance.
    Regards,
    Sudheer.

    Hi Sudheer,
    Can you pls clarify what do you mean by 'four level package structure' ?
    Are you referring to the ABAP structures that get created during creating the proxy by SPROXY transaction ? These structures get automatically created. We simply have to write the code using these structures.
    Or do you mean the 'package' which is mandatory to create a transportable ABAP object ? i.e. transport from Development to Staging and then Production.
    Regards,

  • Alerting for complete async scenario

    I'm new to XI and I need advice from XI experts.
    Could any one explain me how to setup the alert scenario for complete async scenario in case of any errors in XI like mapping error etc. I have gone through some alert config documents but what I'm looking for is, suggestions and recommondations for as how to implement alert scenario for async processes. how is it implemented in async and sync processes in real time. whats the good approach for alerting and error handling.
    Thanks,
    Sudha Madhuri

    HI,
    You can use alerts for alert the msg/error msg to user with/without interpt the process or while processing the msg.
    In Async process you can use alerts in UDF or through BPM.
    In Sync , you can raise alerts through BPM.
    Also reconcile the process with BPM.
    Please see the below links..
    Alerts with variables from the messages payload (XI) - UPDATED - /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step - Alert Configuration
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide - Trouble shoot alert config
    XI ALerts with container elements - /people/sukumar.natarajan/blog/2007/01/07/how-to-raise-alerts-from-abap-proxy
    Reconciliation of Messages in BPM - /people/krishna.moorthyp/blog/2006/04/08/reconciliation-of-messages-in-bpm
    /people/sap.india5/blog/2005/12/06/xi-ccms-alert-monitoring-overview-and-features - CCMS Alert Monitoring
    Triggering XI Alerts from a User Defined Function - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    blogs for alerts
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2b/d925bf4b8a11d1894c0000e8323c4f/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9c/34193cb4f5131de10000000a11405a/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8a/3e2d4105f8d92be10000000a1550b0/content.htm
    Regards
    Chilla..
    <i>Points rewarded if it is useful..</i>

  • Linkage Error in Mapping and Operation mapping testing for Synchronous in NWDS

    Dear Experts,
    Hope you all are doing fine..
    I am working in a synchronous scenario Proxy via SAP PI 7.4 to JAVA Application supporting JSON.I wrote JAVA program to convert JSON to XML and while performing test for the JAVA mapping in response structure at Operation Mapping,I am receiving following error..
    LinkageError at JavaMapping.load(): Could not load class: json2xml/bin/pack/EsrJson2Xml
    java.lang.NoClassDefFoundError: json2xml/bin/pack/EsrJson2Xml (wrong name: pack/EsrJson2Xml) at
    java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:735)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:716) at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at com.sap.aii.ib.server.mapping.execution.MappingLoader.findClass(MappingLoader.java:195)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:372) at java.lang.ClassLoader.loadClass(ClassLoader.java:313)
    I followed some of discussions for the Linkagae error http://scn.sap.com/thread/1418477 but could not help..
    Following are details of my NWDS and PI server:
    SAP NetWeaver Developer Studio
    SAP Enhancement Package 1 for SAP NetWeaver Developer Studio 7.3 SP10 PAT0000
    Compiled the project with JAVA SE-1.6 as well as 1.5
    SAP PO 7.4 Java Only , Release: NW731CORE_10_REL
    SP: 05 JDK: jdk16 Latest Change: 353688
    I have taken care to export all the Jar files used in NWDS to be exported and then imported as Archived files in PI server.
    But could not see the 5 jar files in ESR. I hope there is some issue with name as can see in the log.Can the issue be solved?
    How to test the Operation mapping for Synchronous Message in NWDS?
    Regards
    Rebecca

    Dear Hareesh and Experts,
    I resolved the issue by doing the below steps.
    1. Downloaded the JDK5 and updated the Java console i.e. JRE 15.
    2. I had  created this project using the JAVA Compiler with JAVA SE1.6 initially. Changed this to 1.5 in the Properties of the Project.
    3. Uploaded the project again in ESR Imported Archive.
    The issue is solved.
    Thanks a lot for all your inputs.

Maybe you are looking for