How to handle JCO.AbapException on JCO call in ABAP

Hello Forum,
I am implementing an JCO Server scenario.
I use dynamic repositories like Example7.java from the JCO documentation.
Example7 throws an JCO.AbapException if anything went wrong, e.g. the function is not implemented. My coding is like:
     protected void handleRequest(JCO.Function function) throws AbapException {
          try {
            // Process incoming requests
          } catch (Exception e) {
            log.error(this.getProgID() + ": error handling request " + function.getName(), e);
            throw new AbapException(function.getName(), e.getMessage());
How to react on this AbapException?
The examples in SAP Help documentation only catch
SYSTEM_FAILURE and COMMUNICATION_FAILURE.
I implemented the JCO call as well like following.
CALL FUNCTION 'MY_JCO_FUNCTION_MODULE'
    DESTINATION JCO_DEST
    <...>
    EXCEPTIONS
      SYSTEM_FAILURE        = 1  MESSAGE RFC_MESS
      COMMUNICATION_FAILURE = 2  MESSAGE RFC_MESS.
But these two are only thrown and caught when something with communication went completely wrong, e.g. RFC not found.
When the exception in the JCO server occured and JCO.AbapException was thrown I always get an ABAP short dump, i.e. the exception was not handled.
Additionaly, the exception is named like the JCO function called and the message text which was submitted to JCO.AbapException is not displayed. I think that means that the AbapException was not recognized at all?
The JCO API doc says:
Creates an exception with the specified key. This constructor is normally used in the server's handleRequest() methods to throw an exception which is part of the function interface definition. In such a case the SAP system will not raise a system exception. If however the specified key is not a defined exception for the currently processed function module the SAP will raise a system exception.
But whether I define an exception in the function interface definition named like the module (thererfor new AbapException(function.getName(), <...>)) or not, it always dumps. I understand the exception that a system exception is raised when the exception is not defined? But this is not been handled with above ABAP code as well.
What is wrong here? Could anyone post an example please how the exception has to be handled?
Please note that I do not define static repositories but have the remote function defined on in the ABAP server to be used by dynamic repository (like the STFC_CONNECTION test rfc). Am I right that the exception should be defined in that RFC remote definition?
Thanks,
Carsten

Dear everybody,
Finally I solved this old problem
I am a novice in JCO and played a little with the problem and found an old reference to the difference between J2EEAbapException and AbapException classes. I modified my program and it works! ABAP caller gets the correct exception, not system_failure! The details:
1. modify beanname.java source
     import com.sap.mw.jco.JCO;
     import com.sap.mw.jco.JCO.J2EEAbapException;
     public interface ... extends EJBObject {
    public void processFunction(JCO.Function function) throws RemoteException, J2EEAbapException;
2. modify beannamebean.java source
    import com.sap.mw.jco.JCO.J2EEAbapException;
     public void processFunction(JCO.Function function) throws J2EEAbapException {
     throw new JCO.J2EEAbapException("NODATA");
3. modify beannamelocal.java source
      import com.sap.mw.jco.JCO;
     import com.sap.mw.jco.JCO.J2EEAbapException;
          public void processFunction(JCO.Function function) throws J2EEAbapException;
I hope it helps for somebody else too!
Imre

Similar Messages

  • How to handle lock object in BDC  call transcation method?

    Hi,
    how to handle lock object in BDC  call transcation method?
    Thanks In advances.

    If you are updating Z-fields then you need to create a lock entry, before you use call transaction.
    After creating lock object, please use FM Enqueue_<lockname> before CALL transaction and FM Dequeue_<lockname> after you have commited your data.
    Thanks,
    Kartavya

  • How to handle currency & unit fields in call transaction?

    Hi,
    Can any one tell me How to handle currency & unit fields in call transaction? & how to dael with error for this fields? whith some sort of coding.
    Thanks In Advance.
    Pravin

    Hi Pravin,
    The same topic has been discussed in the following thread:
    How to handle currency & unit fields in BDC recording method?
    Regards,
    Chandra Sekhar

  • How to handle multiple connection through JCO

    Hello JCo Experts,
    My requirement is as follows:
    > I need to create a Web Dynpro Java Application
    > I have multiple users (different Users on SAP System).
    > I need to execute BAPI/Module Functions through these multiple users.
    Example:
    Users: A and B
    User A has logged in from a remote location
    User B has logged in from a another remote location
    both users have logged in through SAP system Login Ids
    Two JCo Connections should be created and all the request from User A must use Connection A and request from B must use Connection B.
    > The connection should be created at first time when user login first time.
    How can I handle this scenario through JCo or other way. I have multiple BAPI/ModuelFunction which I need to execute but with User specific.
    waiting for positive response.

    Dear Shiv,
    Please need to look into [How to Configure the JCo Destination Settings|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/3103eb90-0201-0010-71af-be6f4a6f61d1]
    http://wiki.sdn.sap.com/wiki/display/Snippets/DynamicJCOHandling-Creation,Updationetc
    Best Regards
    Arun Jaiswal

  • How to handle unsaved data in portal through webdynpro ABAP ?

    Hi Experts ,
         I  need to handle unsaved data in SAP Enterprise Portal through webdynpro for ABAP . I got a sdn link which explained some code for this..
    http://help.sap.com/saphelp_nw70/helpdata/EN/45/b76f4169e25858e10000000a1550b0/frameset.htm
    I tired to implement this in EXIT method of the view. but im not able to get this . Can any one help me in this ? .
    Regards ,
    Kalpana .

    Hi ,
    Yes i have checked the code . But the example itself not working when i linked the same with portal . If EXIT is not the right method , Can you help in placing the code in right method ? The code i pasted in EXIT method is 
    data L_COMPONENTCONTROLLER type ref to IG_COMPONENTCONTROLLER .
    data L_API_COMPONENTCONTROLLER type ref to IF_WD_COMPONENT.
    data L_PORTAL_MANAGER type ref to IF_WD_PORTAL_INTEGRATION.
    L_COMPONENTCONTROLLER =   WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).
    L_API_COMPONENTCONTROLLER = L_COMPONENTCONTROLLER->WD_GET_API( ).
    L_PORTAL_MANAGER = L_API_COMPONENTCONTROLLER->GET_PORTAL_MANAGER( ).
    call method L_PORTAL_MANAGER->SET_APPLICATION_DIRTY_FLAG
      exporting
        DIRTY_FLAG = ABAP_TRUE .

  • How to (can I?) debug EJB called from ABAP?

    I have developed a small bean that I am calling remotely from ABAP.  I have done the development work in the WebAS 6.40 Sneak Preview NetWeaver Dev. Studio.  I cannot figure how (or even if it's possible) to debug this bean.
    I have followed the instructions on debugging referred to elsewhere in this forum, but I'm hung up at the point where I'm to create a debug configuration.  E.g., what kind of configuration should I specify?  (EJB is not one of the choices.)  If I try any of those that <i>are </i> available, I always get to a point where it says that it can't connect to the JVM.  Well, that's not what I'm trying to do, is it?
    Has anybody successfully done such debugging?  If so, can you get me past this sticking point?
    Thanks...

    Hi David,
    prerequisite to use debugging is, that the server you want to connect to runs in debug mode:
    Open "Window->Show View->Other->J2EE->J2EE Engine". The configurated J2EE engine is displayed. Use the context menu of the "server0" entry to "Enable debugging of process". The server restarts then. If it's (already) running in Debug Mode, this is visible on the right side "Debug Mode = ON".
    I suggest to define a "Remote Java Application" configuration like this:
    Name: Whatever you like
    Project: The project containing the classes to debug.
    Connection Type: Standard
    Host: Hostname or IP of J2EE server host
    Port: 50021
    Choose "Apply" and "Debug".
    Set breakpoints for example by double-clicking on the frame on the left side of the Java editor (or using the context menu -> Add Breakpoint there). There's a very good documentation about debugger usage in the NWDS online help.
    Trigger the remote call from the ABAP system. As soon as a line with a breakpoint is hit, the debugger displays the line and stops the active thread.
    Hope that helps.
    Regards
    Stefan
    PS: As soon as you don't need debugging any longer, disable debug mode of the engine, since it slows down everything.

  • How to handle JCO Exceptions at JCO (RFC) function call

    Hello Forum,
    I am implementing an JCO Server scenario.
    I use dynamic repositories like Example7.java from the JCO documentation.
    Example7 throws an JCO.AbapException if anything went wrong, e.g. the function is not implemented.
    How to react on this AbapException?
    The examples in SAP Help documentation only catch
    SYSTEM_FAILURE and COMMUNICATION_FAILURE.
    All other RFC modules I have seen which declare the function modules to be used by dynamic JCO repositories (like Example7.java) do not define any other Exception parameters.
    But these two are only thrown and caught when something with communication went completely wrong, e.g. RFC not found.
    But when RFC can be reached and the JCO Server is executing the Java method, an AbapException could be thrown on error. How to react on this?
    In my implementation based on the examples I always get a ABAP dump. The dump says:
    Exception named  without message text. Why that name?
    How to handle this type of exception in order to avoid the dump?
    Can anyone post an example please?
    Thanks,
    Carsten
    Edited by: Carsten Schön on Apr 15, 2008 4:22 PM
    Edited by: Carsten Schön on Apr 15, 2008 4:24 PM

    Hi Micky,
    thanks for your quick response.
    If so, to throw JCO.AbapException on JCO Server side is not correct?
    What I do is throwing the JCO.AbapException (like in the JCO Example 7).
    At the RFC call in APAB I handle both exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE like
    CALL FUNCTION 'MY_JCO_FUNCTION_MODULE'
        DESTINATION JCO_DEST
        <...>
        EXCEPTIONS
          SYSTEM_FAILURE        = 1  MESSAGE RFC_MESS
          COMMUNICATION_FAILURE = 2  MESSAGE RFC_MESS.
    This works as far something with RFC is wrong, e.g. Server can not find the function or Server not reachable.
    But the AbapException thrown by the JCO Server (Java) is not handled that way. Why?
    Sorry if this is the wrong forum but I tried posting in Netweaver integration and got no answer for 1 week and because it's ABAP related I thought the topic suites here.
    Carsten
    Edited by: Carsten Schön on Apr 15, 2008 5:10 PM

  • Jco connection error while calling Custom FM in CRM Internet Sales Application

    Hi ,
    I am trying to do some customisation in the CRM ISA 4.0 development component.
    Have followed the steps given in the Development and Extension Guide and tutorial PDF
    Steps done for Custom RFC Call
    1.       Create RFCs
    2.       Edit file backendobject-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification:-
    3.       BackendBusinessObject Jco -
    4.       BusinessObject -
    5.       Edit file bom-config.xml in folder project_root\b2b_z\WEB-INF\xcm\customer\modification
    6.       BusinessObjectManager BoM
    7.       BackendAware-
    8.       config.xml - to add custom actions
    9.       Action  creation
    10.     Page : Order_change.jsp.
    The backend is the CRM system while making a call to the CRM system the connection to the CRM system is not working .
    Similar to what is given in the tutorial the  getDefaultJCoConnection() is used .
    But gettting null at the JCO connection.
    JCO.Function func = getDefaultJCoConnection().getJCoFunction(‘CRM_ISA_SHOP_GETLIST’);
    This is how my custom FM is being called.
    Can someone help me with what may be the possible reason for this call failure.
    While debugging and checking it shows null pointer exception in the JCo connection .
    Thanks
    Chinju

    Hi Hamendra,
    When the code debugging was done in Java then we got just the NullPointerException for the JCo.
    In the nwa log shows
    where BackendBusinessObjectBaseSAP is the standard Java Class in the ISA
    Error at
    com.sap.isa.core.eai.sp.jco.BackendBusinessObjectBaseSAP.getDefaultJCoConnection(BackendBusinessObjectBaseSAP.java:46)
    Thanks
    Chinju

  • JCO Exception in Background calling

    Hi,
    i am trying to upload data using sap standard uplaod programs throug a java application using JCO.
    Unfortunately these standard programs sometimes pops up with a info message and i am getting these exceptions for Suppressing unwanted SAP GUI screens from BAPI/RFC when calling them from external system in background
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Session 1: Special character for 'empty field' is /
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
    at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:871)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:2995)
    at com.sap.mw.jco.JCO$Client.execute(JCO.java:2669)
    at myJCoClient.myJCoClientCall(myJCoClient.java:95)
    at myJCoServer$Server.handleRequest(myJCoServer.java:65)
    at com.sap.mw.jco.JCO$Server.dispatchRequest(JCO.java:5409)
    at com.sap.mw.jco.rfc.MiddlewareRFC$Server.nativeListen(Native Method)
    at com.sap.mw.jco.rfc.MiddlewareRFC$Server.listen(MiddlewareRFC.java:1010)
    at com.sap.mw.jco.JCO$Server.listen(JCO.java:5205)
    at com.sap.mw.jco.JCO$Server.run(JCO.java:5139)
    at java.lang.Thread.run(Thread.java:595)
    i want to call these sap standard upload programs completely in backgroung through JCO.how can i do that??
    how can i suppress info messages in standard programs when called externally???
    any help will be appreciated...
    thanks in advance
    berry

    Hi Gregor,
    The Messages i am getting i.e. "Session 1: Special character for 'empty field' is /" is one of the GUI information messages that the standard SAP uplaod program is popping.
    i want to suppress these messages when calling them through an external system so that they can be called in background.
    The standard program is using the batch input method.
    Thanks and Regards
    Berry

  • How to create an instance of JCO.Table

    hi,
    I am facing a problem while migrating from JCO Client service to Connector Framework.
    Basically i get the output in the format of IRcordSet after calling Back End system.
    I need to convert this to JCO.Table to continue in my code so that i wont change all the code which uses JCO.Table.
    Ex:
                   IConnection connection = null;
                   IConnectorGatewayService service = (IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorGatewayService.KEY);
                   try {
                             ConnectionProperties props = new ConnectionProperties(request.getLocale(),request.getUser());
                             String destination = Util.getBESystemID(request);
                             connection = service.getConnection(destination, props);
                             IInteraction interaction = connection.createInteractionEx();
                             IInteractionSpec intSpec = interaction.getInteractionSpec();
                             intSpec.setPropertyValue("NAME", BE_FM_DOWNLOAD); //Function Call /RPM/MSPC_DOWNLOAD;
                             RecordFactory rf = interaction.getRecordFactory();                    
                             MappedRecord inputParams = rf.createMappedRecord("INPUT");
                             //inputParams.put(BE_IN_DOWNLOAD_APP, BE_IN_DOWNLOAD_APP_DEFVALUE, JCO.TYPE_STRING);
    JCO.Table to Object (??)
                             inputParams.put(BE_IN_DOWNLOAD_EXPORTLOG, exportLog);
    exportlog is type JCO.Table
                             MappedRecord outputParams = (MappedRecord) interaction.execute(intSpec, inputParams);
                             connection.close();
              Object result = outputParams.get(BE_OUT_DOWNLOAD_EXPORTLOG);
              //JCO.Table m_downloadExportLog = (JCO.Table)result;//error this wont work
    //Here i need to get m_downloadExportLog
    IRecordSet irs = (IRecordSet)Object;
    Here how can get JCO.Table from IRecordSet???
    Thanks in advance!!
    Regards,
    Ramesh.

    You could retrieve the values and store in a TableView in the following manner.....
    //zData is a JCo.Table
         for (int i = 0; i < TableData.getNumRows(); i++) {
                             //ABCBean zAIPBean = (ABCBean)zData.getRow(i);
                   j = 0;
              //for (JCO.FieldIterator e = zData.fields(); e.hasMoreElements(); ){
                   JCO.FieldIterator e = zData.fields();
                   while (e.hasMoreElements()) {
                             JCO.Field field = e.nextField();
                             data<i>[j] = field.getString();
                             j = j + 1;
                        zData.nextRow();
    Consider rewarding points if the issue is solved ...
    Thanks,
    Devina

  • How to handle the call transaction in method of a custom business object

    Hello all,
    There is a custom report " RPTCORAPP" for approving leaves . As per my requirement i have develop a copy of leave workflow and for approval process i have call  "RPTCORAPP" in Custom method of custom object. i have made a transaction for this custom report for approving attendances. I am calling this method though call transaction statement within method.
    Problem: while approving the attendance workitem is not disappearing from the portal. Problem is due to call transaction statement.
                   once workitem come to the user, user click on it. control goes to the report, which display all the leave to approve on
                   the portal.
                   If after approving/ rejecting attendance user close the screen.workflow remain in the "process" status.Control wont come  back after call transaction statement in the method.
                 At the same time if user clicks on back button inspite of closing the screen. it is working fine. workitem disappears from the portal.
    How to handle the scenarion. if after approving/rejecting, i want the control to come back to the NEXT STATEMENT after call transactionstatement in my method.
    Please help it out........:)

    Hi swami,
    thanks for reply. but i am not using BDC in my method. iam just calling a custom transaction thriugh statement
    Call transaction 'ZHR_APPROVE_CLINOUT'. This transaction directly run the report RPTCORAPP and display all the request.

  • How to create a model and JCO connection

    Hi all,
             The Userid and Password given while creating new model at Singleserver/Load balancing tab should be same as the userid and password given while creating JCO connection. i.e in JCO creation  while mapping modeldata to Application data and Metadata to metadata we will give some userid and password.
    will those 2 userids and passwords should be same.
    the error which i am getting is
    com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException: Error connecting using JCO.Client: null
    Regards
    Padma N

    2 userids and passwords need not be same
    i got similar problem and this is how i resolved
    this is because jco connections are Using SSO and the user who is accessing that webdynpro application is not present in the backend system.
    please make sure user is there in the backend system from which you are getting data
    xxxxxxxxxxxxxxxxxxxxx
    Edited by: Armin Reichert on Feb 18, 2008 7:26 PM

  • Who know how to handle pl/sql table return from stored procedure calling from jsp

    I have some stored procedure which return pl/sql table (index by table), It is look like an array. how jdbc handle this?
    CallableStatement cs = con.prepareCall("EXECUTE bill.getcountry(?,?)");
    cs.setInt(1, cid);
    cs.registerOutParameter(2, java.sql.Types.VARCHAR);// ARRAY?
    ResultSet rs = cs.executeQuery();
    Array array = (Array) rs.getObject (1);
    ResultSet array_rset = array.getResultSet ();

    Not that familiar with the OCI (Oracle Call Interface), but I think this call will be problematic - the OCI deals with SQL data types and not with PL/SQL structures.
    The OCI has since Oracle 8i sported an object call interface (see OCI Runtime Environment for Objects for details).
    This allows you to use the CREATE TYPE command to create advance user data types - and these are supported by the SQL engine, PL/SQL engine and external languages via the OCI.
    So you need to have a look at the Perl-DBI documentation to see how it supports Oracle object types and consider using these. As for internal PL/SQL data structures. These are not supported by the SQL engine and I would expect limited or no support in the OCI for these. Anyway, using SQL data types makes a lot more sense ito flexibility and transparency across languages and environments.

  • How to handle a return statement from a login webservice call

    Hi all,
    I am new to this iPhone apps. I am trying to wirte a webservice call in which I am comparing my username and password details in webservice and getting an boolean statement as a response. By using that response i should display valid or invalid statement on the screen.
    Now i am able to get the response from the webservice, but i am unable to handle that boolean variable present in the xml statement.
    Can any one please suggest me how to handle that boolean value from the xml statement?
    Thanks
    SRI.

    Since you are a registered developer you would be far better off posting this in the developers site, this forum is for users of apps.

  • How to handle Asynchronous calls using OSB?

    Hi There,
    How to handle Asynchronous calls using OSB?
    Please help me out??
    -Venkat

    Hello friend, here is what you need.
    Oracle Service Bus, invoke asynchronous webservices | Oracle .. Java .. OpenSource .. SOA

Maybe you are looking for

  • XML not pulling color correction or Motion Generator data?

    Does FCPX 10.0.8 support exporting XML data related to color correction or motion Generator templates? If I export a project to XML and reimport the same XML film into FCPX all resources are recognized and appear in the correct place/lane. My custom

  • Using bt fon

    MY husband has NOKIA E7 and with our previous broadband could use wifi internet but he cant get connected since we changed to BT TOTAL BROADBAND is this possible using this type of phone to connect to BT FON or OPENZONE THANKS

  • Xfinity and Apple TV?!

    Hi, i got Xfinity but can't connect it with my  Apple TV. It's not scanning for networks and if i enter it manually it keep's telling me no network found...any ideas?? thank you Andrea

  • Runtime error on AS Deployment

    Hi guys! I have a ADF BC, ADF Faces, JSF application build on jdeveloper 10.1.3 as I test in my jdev it works fine. The I deployed it on my AS 10.1.2 and the deployment is ok. But as I when go into the page of my application, It is rendered but when

  • Start up password

    while trying to recover original system password with the Mac OS installation disk, the system rebooted and now when I try to turn it on,I face the same pop-up requesting the system password, which I don't have !!!! I cannot seem to get around it. I