Create wrapper to FM and handle the exceptions

HI All
I need to create wrapper FM to fm BDC_RECORD_TRANSACTION like zBDC_RECORD_TRANSACTION.
the parameter should be the same and my question is how to handle the exceptions
do i need to keep the exception in the wrapper fm exactly the same i.e.
exactly the same signature for the exception and noting more or I need to add
additional coding to handle it .
CALL FUNCTION 'BDC_RECORD_TRANSACTION'
    EXPORTING
      tcode               = tcode
      authority_check     = 'X'
      OPTIONS             = ' '
      mode                = 'A'
      UPDATE              = 'A'
    TABLES
      dynprotab           = dynprotab
      messtab             = messtab
    EXCEPTIONS
      system_failure      = 1
      invalid_transaction = 2
      invalid_mode        = 3
      invalid_update      = 4
      OTHERS              = 5.
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Regards
Chris

HI
do you mean like this ?
CALL FUNCTION 'BDC_RECORD_TRANSACTION'
    EXPORTING
      tcode               = tcode
      authority_check     = 'X'
      OPTIONS             = ' '
      mode                = 'A'
      UPDATE              = 'A'
    TABLES
      dynprotab           = dynprotab
      messtab             = messtab
    EXCEPTIONS
      system_failure      = 1
      invalid_transaction = 2
      invalid_mode        = 3
      invalid_update      = 4
      OTHERS              = 5.
  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN 1.
        RAISE system_failure.
      WHEN 2.
        RAISE invalid_transaction.
      WHEN 3.
        RAISE invalid_mode.
      WHEN 4.
        RAISE invalid_update.
      WHEN OTHERS.
    ENDCASE.
Thanks
Chris
Edited by: ChrisGW on Mar 16, 2011 11:40 AM

Similar Messages

  • Error in Raising exceptions in a method and handling the same in the WF

    Hi All
    I tried to implement Raising exceptions in a method and handling the same in the workflow
    in the same way given in SAPtechnical site .
    1.by adding a error msg in exception parameter .
    2. if the select query fails, to fetch the agent then :exit_return 9001 'ztable name' space space space.
    3.in the Background activity in which this method is called there automatically one outcome appears ,and I hav acitvated that outcome and in that done what need to be done for that error handling - just send a mail to concern person .
    4. in the normal outcome of the activity , the step to be executed are there .
    but its not working , if exception come then the WF stuck there only . it do not follow the exception outcome .
    Kindly help me , How can I do the exception handly in WF.
    thanks & Regards
    Kakoli

    > That is usually the case - you catch an error in the underlying program and pass that back so the workflow can go into error.
    > You're doing it correctly.
    I don't think that's quite right.
    If you define an error/exception in a method, it is automatically mapped to an outcome of the step/task.
    If you activate that outcome, then you can handle the exception in a branch of the workflow.
    For example: 'Remote connection is down, please contact Basis'
    The step should only go into error if an outcome occurs that you have NOT activated.
    So the original question is valid. Please give some more information on what the error message is..
    chrs
    Paul

  • How to handle the Exception in GP using executable callabel object.

    Hi all,
            I handled an exception in GP using Background callable Object. That is working fine.
    (Ex: Exception_No_User_Found). The Problem is I am not able to handle the exceptions for normal callable object. I have done the same thing as i did in background callable object except implementing IGPBackgroundCallableObject Class.  I have created an WebDynpro DC Project where in getDescription method i declared an Exception and in execute method of component controller I caught the exception if no user found.
    Then i created an callable object for this simple DC project. but that is not working i could not catch the exception. when i execute the process it is asking the User ID if i give the wrong userId it is not refreshing back to the user id input form.
    But if i test that simple callable object separately it is throwing an Exception when I give the wrong input..
    but the same thing is working fine using background callable object.
    I couldn't handle the exception for the simple callable object or executable callable object.
    Please If anyone bring me the solution that would be appreciated.
    Thanks in advance.
    Regards,
    Malar.

    Hi Shikhil
    Thanks for your reply
    Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
    1) "Activity could not be read"
    2) "Action has been stopped"
    3) error while processing the item can not be displayed
    if you give any idea/clue how to handle these exceptions then it would be great help to me
    Thanks
    Sunil

  • How to handle the Exception when RegisterEventProcessorAsync

    In our Cloud Service project, we have 2 instances for work role (deploy to Azure), the work role is consume events from the EventHub using EventProcessorHost).
    When we want to register EventProcessor to consume data (see below):
    await eventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
    Sometimes we will got the Exception:
    Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (412) There is
    currently a lease on the blob and no lease ID was specified in the request.. ---> System.Net.WebException: The remote server returned an error: (412)
    There is currently a lease on the blob and no lease ID was specified in the request..
      at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpWebResponse resp, T retVal, StorageCommandBase`1 cmd, Exception ex)
       at Microsoft.WindowsAzure.Storage.Blob.CloudBlobSharedImpl.<DeleteBlobImpl>b__1b(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
       at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
       --- End of inner exception stack trace ---
       at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End()
       at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.EndDeleteIfExists(IAsyncResult asyncResult)
       at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass1`1.<CreateCallback>b__0(IAsyncResult ar)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at Microsoft.ServiceBus.Messaging.BlobLeaseManager.<DeleteAllAsync>d__2a.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.ServiceBus.Messaging.EventProcessorHost.<InitializeAsync>d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.ServiceBus.Messaging.EventProcessorHost.<StartAsync>d__e.MoveNext()
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
       at System.Threading.Tasks.Task.Wait()
    at awaiteventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
    If we got the Exception, we won’t got messages any more.
    From the Call Stack, we found it was cause by delete the Blob. So we wonder that, when we call
    RegisterEventProcessorAsync,
    the hub will delete the blob and renew one in Storage?
    If we delete the blob for the EventHub manually and then run our server again. It worked as usual.
    But we can do it like this way manually, so is there any way to handle the exception in code to make the EventProcessorHost worked?
    Thanks so much!

    If we use different blob container name for different EventProcessorHost, is it a workaround for the issue?
       var
    eventProcessorHost = new
    EventProcessorHost(
                    hostName,
                    hubName,
                    consumerGroupName,
                    serviceBusConnectionString,
                    storageConnectionString,
    leaseContainerName);

  • Write and read txt files and catch the exceptions

    hey everyone, im in a bit of a bind. im trying to set up this try catch statement. here is what i have for code so far.
    import java.util.Scanner;
    import java.io.*;
    public class Warning
        //   Reads student data (name, semester hours, quality points) from a
        //   text file, computes the GPA, then writes data to another file
        //   if the student is placed on academic warning.
        public static void main (String[] args)
         int creditHrs;         // number of semester hours earned
         double qualityPts;     // number of quality points earned
         double gpa;            // grade point (quality point) average
         String line, name, inputName = "students.dat";
         String outputName = "warning.dat";
         try
              Scanner FileScan1 = new Scanner (new File("students.dat"));
              // Set up scanner to input file
              // Set up the output file stream
              // Print a header to the output file
              outFile.println ();
              outFile.println ("Students on Academic Warning");
              outFile.println ();
              // Process the input file, one token at a time
              while (FileScan1.hasNext())//there is another line...
                  {               // Get the credit hours and quality points and
                   // determine if the student is on warning. If so,
                   // write the student data to the output file.
              // Close output file
         catch (FileNotFoundException exception)
              System.out.println ("The file " + inputName + " was not found.");
         catch (IOException exception)
              System.out.println (exception);
         catch (NumberFormatException e)
              System.out.println ("Format error in input file: " + e);
    }I am pretty sure the layout is good to go, but first and foremost that try statement is hanging me up. Could someone give me some suggestions about how i should set this up.
    i want to read in this students.dat file, then output another file called warning.dat.
    Thanks i really appreicate the help.

    no, i was really hoping to just see if the way it is
    set up it will be doable, that way i wouldn't be
    working on code that was impossiable to sort through
    properlyFair enough.
    One thing I'd suggest is that if you're really basically only going to be printing the exceptions, and since that is the top-level method (main) --
    I'd instead just add some "throws" clauses to main, get rid of the try/catch stuff, and just let the VM handle the exceptions for you. It will print them, just like you're doing, except that it will also print the stack traces, which you are not doing.
    If you're going to handle exceptions, it's better to actually do something about them rather than just print them - otherwise you might just as well let the runtime do that for you.

  • Error occurred. Contact the administrator and report the exception ID

    Dear All,
    We are on EP 7 SP8. We just now performed a system copy and are right now done with the post installation activities. All seems fine but we are having a problem in the Navigation Windown Quick Create link on the left hand side. Here I am always getting an error: Error occurred. Contact the administrator and report the exception ID in the log: 001A4B066A940068000001B500002946000433EB006CFEAC
    Can someone please guide me with how to remove this error.
    Please let me know as we are stuck and need to give the system to the client.
    Thanks a lot in advance.
    Best Regards,
    Rajeet

    Hello
    Can you see the defaulttrace file for more details?
    Open up Visual Administrator and go to Log Viewer.  Then open up the Defaulttrace file. Generate the same error message and look in the file for more details.
    What do you see?
    And of course.. What did you do to make this error ?
    Best Regards
    Kristoffer Engh

  • I've created a Photoshop PDF and all the text is editbale after passing through indesign to add crop marks and bleeds - one line now isn't editable, what's causing this

    I've created a Photoshop PDF and all the text is editable in the resulting PDF.
    The PDF created by Photoshop is completely editable, all text! I put it through indesign so I could add crop marks and reduce the pdf file size and now all the text is editable except one line!
    I've not used any faux styles or effects...what could be causing this?
    Thanks!

    I've created a Photoshop PDF and all the text is editable in the resulting PDF.
    The PDF created by Photoshop is completely editable, all text! I put it through indesign so I could add crop marks and reduce the pdf file size and now all the text is editable except one line!
    I've not used any faux styles or effects...what could be causing this?
    Thanks!

  • I created a signature ID and customized the signature; however, when I go to sign it only shows the name layout or graphic image? How do I go back to using the certificate?

    Dear Forum
    I was using Adobe version XI and the signature feature disappeared from the menu. Now I downloaded Acrobat Reader DC. Using the menu and instructions I created a signature ID and customized the signature; however, when I go to sign a document it only shows the name layout or graphic image? How do I go back to using the certificate that I created?
    Any help would be greatly appreciated.
    Regards
    Carlos

    Firefox works fine on Windows 2000 SP4 for me.
    Any chance you have a dial-up connection that uses a web accelerator to speed the loading of content?

  • I have .me and .mac email accounts on my iPhone 4. I thought I had successfully transitioned from MobileMe to iCloud, but something must be wrong. iCloud seems to work fine on my computer and, with the exception of two email accounts, seems to be fine on

    I have .me and .mac email accounts on my iPhone 4. I thought I had successfully transitioned from MobileMe to iCloud, but something must be wrong. iCloud seems to work fine on my computer and, with the exception of two email accounts, seems to be fine on my phone. Can/should I delete the accounts on my phone and start over? It is somewhat of a nuisance to have two email accounts and double the amount of emails. The only thing different about the two iCloud accounts is the email addresses. Thanks.

    Well, seems I managed to unscrew this...I deleted my iCloud mail account and reinstalled it on my phone. That got rid of the duplicate .me/.mac email accounts.

  • I am creating a photo book and made the grandios mistake of using auto fill and have a zillion pics and pages i do not want I eliminated the pics but cannot delete the empty pages How can i do it  The back inside cover and back page are at the end  and I

    i have tried to create a photo book and made the mistake of trying auto fill I got a number of pages and many pics i do not want I found a way to eliminate the pics but cannot get rid of the pages unfortunately the inside back page and the back page are also there  ANY IDEAS

    At the bottom of the photo tray at the right click on the Clear Placed Photos button.  This will remove the photos from the pages but not from the book.
    Click to view full size
    OT

  • Can you copy/paste files from the Finder to Mail in Lion, or drag them onto the Mail icon in the Dock to create a new message and attach the files to it?

    Message title says it: Can you copy/paste files from the Finder to Mail in Lion, or drag them onto the Mail icon in the Dock to create a new message and attach the files to it?
    I can't find anything in the Knowledge Base that says these two options no longer work or still do.
    I do not have a system capable of running Lion, but I need to know the answer nonetheless.

    Gee, I don't know: "paste attachments mail Lion"? ;-)
    One further question, if I may: in Panther (which is where I've aggregated nearly 7 years of mail), if you copy more than one file in the Finder, switch to Mail, and paste the files into a new message, only the file names paste in. If you copy one file and paste it into a Mail message, you get the file, not just the name. Is that still true, or has that (IMHO) bug been fixed since 10.3.9?

  • We are creating a photo book and on the cover in the lower right hand corner there is part of the title. We did not create it and cannot find how to delete it. Any ideas.

    We are creating a photo book and on the cover in the lower right hand corner there is part of the title. The cover title is centred below the cover picture. We did not create it and cannot find how to delete it.  Any ideas?

    Preview according to this article and see what it does. http://support.apple.com/kb/PH2486
    The printed book will match the preview
    LN

  • I recently created a new Appleid and then the password to my old Appleid suddenly did not work.  When I tried to reset the password I do not receive the email with the link and Apple does not either recognize my birthday.  What to do?

    I recently created a new Appleid and then the password to my old Appleid suddenly did not work.  When I tried to reset the password I do not receive the email with the link and Apple does not either recognize my birthday.  What to do?

    Hi ingaosk,
    Thanks for the question. Based on what you stated, it seems like you did not receive the reset email. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    If you didn't receive your Apple ID verification or reset email - Apple Support
    Thanks for using Apple Support Communities.
    Cheers,
    Mario

  • Throwing or handling the exception.

    Hi,
    Which is the good idea.
    *1 .* throwing the exception to the caller method.
    *2 .* handle the exception at the save place.(with the help of try/catch).
    Any pointer will be highly appreciated.
    Regards,
    Alok

    Usually #1, though sometimes you'll wrap it in an exception more appropriate for that layer.
    To handle the exception, you have to truly handle it.You have to provide a correction for whatever went wrong. That might mean retrying or using some default value or calling some other "safe" algorithm. If you can't actually fix it, you have to throw something to let the caller know what went wrong. It's then up to him to determine whether to handle it or throw it to his caller.

  • Handling no_Data_found and handling the cursor context not found exceptions

    hi all,
    when the value is not there in table, we will get the no_data_found exception.
    im sending the sample procedure.
    check that one.
    create or replace procedure registration.P_GetPatientDetails(in_UHID in Patient.Uhid%Type,
    ocursor_Component1 OUT SYS_REFCURSOR,
    ---ocursor_Component2 OUT SYS_REFCURSOR,
    ocursor_Component3 OUT SYS_REFCURSOR,
    ocursor_Component4 OUT SYS_REFCURSOR
    AS
    in_RegistrationID varchar2(50);
    ln_genderLovID NUMBER(10);
    ln_rhfactorLovID NUMBER(10);
    BEGIN
    SELECT RegistrationId
    into in_RegistrationID
    from Patient
    where (Upper(UHID) = Upper(in_UHID)) ;
    /* COMMIT;*/
    /*dbms_output.put_line(in_RegistrationID);*/
    OPEN ocursor_Component1 FOR
    SELECT RegistrationID,PreRegistrationNo,EmergencyNo,UHID
    FROM patient p LEFT OUTER JOIN EHIS.Titlemaster TM ON p.title = tm.titlecode LEFT OUTER JOIN EHIS.SuffixMaster SM on p.sufix = SM.SUFFIXCODE LEFT OUTER JOIN EHIS.Maritalstatusmaster MSM ON MSM.MARITALSTATUSID = p.maritalstatus LEFT OUTER JOIN EHIS.Bloodgroupmaster BGM ON BGM.BLOODGROUPID = p.bloodgroup LEFT OUTER JOIN EHIS.LovDetail LD ON(LD.LOVDETAILID = p.gender AND LD.LOVID = ln_genderLovID) LEFT OUTER JOIN EHIS.LovDetail rf ON(rf.LOVDETAILID = p.rhfactor AND rf.LOVID = ln_rhfactorLovID)
    WHERE RegistrationID = in_RegistrationID AND p.Status = 1 ;
    OPEN ocursor_Component3 FOR
    SELECT RegistrationID,ResidenceNumber,MobileNumber,PrimaryEmail
    FROM AddressMaster
    WHERE UPPER(RegistrationID) = UPPER(in_RegistrationID) AND Status = 1 AND
    AddressTypeID =
    (SELECT AddressTypeID
    FROM AddressTypeMaster
    WHERE AddressTypeName = 'PermanentAddress');
    /* COMMIT;*/
    OPEN ocursor_Component4 FOR
    SELECT ResidenceNumber, MobileNumber,EmergencyNumber,PrimaryEmail
    FROM AddressMaster am LEFT OUTER JOIN EHIS.Countrymaster CM ON CM.COUNTRYID = am.country LEFT OUTER JOIN EHIS.Statemaster SM ON SM.STATEID = am.state LEFT OUTER JOIN EHIS.Districtmaster DM ON DM.DISTRICTID = am.district LEFT OUTER JOIN EHIS.Citymaster CM1 ON CM1.CITYID = am.city
    WHERE UPPER(RegistrationID) = UPPER(in_RegistrationID) AND Status = 1 AND
    AddressTypeID =
    (SELECT AddressTypeID
    FROM AddressTypeMaster
    WHERE AddressTypeName = 'CurrentAddress');
    /* COMMIT;*/
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQLCODE) || SQLERRM);
    END;
    if the data is not there for teh given uhid,
    we are displaying the err msg in exception block
    but from .net environment ,
    they will define the cursors as out params.
    if they wont get the data,
    in .net environment, the exception is raised.
    how to handle these situations.

    Implicit cursors are prone to both the NO_DATA_FOUND and TOO_MANY_ROWS errors. They MUST return precisely one row or you get to do extra coding in the form of exception handlers. Using explicit cursors (declared in the DECLARE SECTION) will avoid both errors, though they have their own considerations. When an explict cursor doesn't find something it doens't put NULL into the destination variable(s); it leaves them alone so its a good idea to null out variables and records before fetching into them.

Maybe you are looking for