Exceptions in BAPI

Hi ALL,
Can u pls help me out with the following queries?
1. how can we handle exceptions in BAPI?
2.wats the major/important differences between BAPI and RFC?( im really confused)
Pls help me out!!!
<REMOVED BY MODERATOR>
Jack
Edited by: Alvaro Tejada Galindo on Apr 9, 2008 5:51 PM

Hi Jack,
            BAPI stands for Business Application Programming Interface. It is a library of functions that are released to the public as an interface into an existing SAP system from an external system.
RFC is the protocol used to call functions in an R/3 system by a caller external to R/3 or to call programs external to R/3 from an R/3 system.
Functions can only be called via RFC, if they are tagged as RFC functions in the SAP development workbench. They are then called RFC function modules. BAPIs are complete sets of (BAPI) function modules that model a business application.
When you are familiar with web developments: RFC can be compared to HTTP and BAPIs are CGI applications.
In other words: A BAPI function is a function module that can be called remotely using the RFC technology.
Thanks,
Greetson

Similar Messages

  • How to handle exceptions in BAPI

    Dear Gurus,
    Is there any specific way to handle exceptions in BAPI? I mean the way one handles exception in FM...can tat be applicable to BAPI or is there something specific.
    Regards,
    Shiku

    The export parameter Return can be implemented as follows:
    As a structure, whereby it must be defined in the function module as an export parameter, as well as in the method in the BOR.
    As a table, whereby it must be defined in the function module as a table parameter, as well as in the method in the BOR as an export parameter.
    Before filling the Return parameter you should either initialize the structure with CLEAR or the table with REFRESH and CLEAR.
    If the return parameter is not set or is set to an initial value this means that no error has occurred.
    The Return parameter may be based on the following reference structures:
    BAPIRET2
    You must use this reference structure when developing new BAPIS.
    BAPIRET1, BAPIRETURN
    These reference structures are still partly used in old BAPIs.
    Both structures must be filled in the logon language.
    Regards,
    SuryaD.
    Found this info for you shiku at http://help.sap.com/saphelp_46C/helpdata/EN/a5/3ec9f74ac011d1894e0000e829fbbd/content.htm.
    Hope this was helpful.

  • Exception during BAPI execution

    Hello:
    I've been working with JCAPS, but today I'm having an exception that I cannot resolve.
    [#|2008-11-20T20:00:36.418-0600|SEVERE|IS5.1.2|STC.eWay.SAP.BAPI.java.lang.Class|_ThreadID=55; ThreadName=Worker: 62;|----- Error occurred during execute -----
    |#]
    [#|2008-11-20T20:00:36.419-0600|SEVERE|IS5.1.2|STC.eWay.SAP.BAPI.java.lang.Class |_ThreadID=55; ThreadName=Worker: 62;|\
    *********** Exception occurred while executing the BAPI
    ****************Exception String = No RFC function available to execute
    Unfortunately, I don't have more information, except that this code was working yesterday ....
    Regards, Alfredo

    If the outcome of the relaunch is random it sounds like a connection or network issue to me. Do you get any more information in the ide.log when you can't relaunch the OTD?
    /Alex

  • How to handle exceptions in BAPI's and RFC

    Hi! Gurus,
    Please help me why we cant raise exceptions in RFC or Badi and hw to handle them further..
    regards,
    Digvijay

    Hi,
    to handle the Exceptions,
    1. You have to declare the exceptions in Exceptions section in SE37.
    2. Use Raise statement to raise the exception When the particular condition reached.
        Eg: when you are dividing A with B,
              if B = 0.
                 Raise B_Zero [With message I001(ZZZ)]
             endif.
    3. When you call this function module you have to assign some value in exceptions section.
       Eg: Call function 'ZDIVIDE'
             exporting
                 a = a
                 b = b
             importing
                 result = r
             exceptions
                 B_Zero = 1
                 others  = 99.
    4. If you dont specify message extension in Raise statement, then you should use the code like this
                 if Sy-subrc = 1.
                     message E001(00) with 'Should not divide with zero'.
                 endif.
    Regards,
    Jagan.

  • ABAP Proxy Exception

    Hello everybody i have this error in my sxmb_moni of xi for a abap proxy server receiver:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProxy</SAP:Category>
      <SAP:Code area="ABAP">DYNAMIC_CALL_FAILURE</SAP:Code>
      <SAP:P1>UNCAUGHT_EXCEPTION</SAP:P1>
      <SAP:P2>ZFUS_CL_MI_FMGOB_CAT_FONDOS_C1</SAP:P2>
      <SAP:P3>EXECUTE_SYNCHRONOUS</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText>Unable to execute the dynamic application call (kernel error ID UNCAUGHT_EXCEPTION, class ZFUS_CL_MI_FMGOB_CAT_FONDOS_C1, method EXECUTE_SYNCHRONOUS)</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    any suggestions?
    Regards,
    Julio Cesar

    Hi
    Below is the full details of above links
    For link 4196517?
    Q) Hi All,
    I have got a requirement to raise an exception from existing ABAP Proxy depending on condition. XI consultant created a fault messge type and attached to the inbound interface message type. I have regenerated the ABAP proxy but I cant find any thing in excpetion tab to raise exception.
    Please let me know the solution for this.
    Answers : 1) Go to Sproxy .
    Select the message interface for which you generated the proxy.
    Click on the Structure tab. Do you see any Exception Class generated for fault message ?
    2) Just follow all the steps defined in the below Blog and you will find the solution.
    /people/shabarish.vijayakumar/blog/2006/11/02/fault-message-types--a-demo-part-1
    3) I can't find any exception class there in 'Structure' tab. what might be the problem.
    4) In SProxy ..under the Message Interface you will see Fault Message Type.
    Click on Fault Message Type and check if you can see the fault message type created by xi consultant.
    Also ask your xi team to login to IR and re-activate the interface.
    5) I can't find any fault message type under Fault Message Type. I will ask my XI consultant to reactivate the interface.
    Is this the only problem for this or is htere any other reason for not finding this fault message type in SPROXY.
    6) Ideally the fault message type should be visible unless he has defined Software Dependencies and using MT from some other SC.
    Even if the fault message type is not visible everything could be all right.
    Ask him to check if he selected the fault message type while activating the interface.
    Do update us when you get a reply from ur xi team.
    7) I have checked with XI admin, he said that he created fault message types in Development Xi but R/3 Development refers to Production XI system in exchange profiles. He asked me to change it to XI development in exhange profile settings. So I am searching info on how to set exchange profiles.
    8) The following link will guide you ..
    http://help.sap.com/saphelp_nw04s/helpdata/en/c9/7a1041ebf0f06fe10000000a1550b0/frameset.htm
    I dont think we need to do any changes in Exchange Profile for proxy communication.
    Changing the RFC Destinations (in your R/3 system)- LCRSAPRFC & SAPSLDAPI should solve your problem.
    II) For Link :4147406?
    Q) Hi All,
    We have an ABAP Proxy implemented for posting goods movement and it is calling BAPI function module to post good movement. We have got a requirement that if BAPI returns any error, this error message send back to SAP XI.
    data call proxy
    Legacy -
    > XI -
    > SAP R/3(call bapi)
    <----
    error message
    Please let me know how to send the message back to XI.
    Answers: 1) Refer the following
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy - ABAP Proxy to File
    /people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy - File to ABAP Proxy
    2) you can utilize the fault messages for such an usage -
    Ref:
    Fault messages -
    /people/shabarish.vijayakumar/blog/2006/11/02/fault-message-types--a-demo-part-1
    Handling Web Service SOAP Fault Responses in SAP NetWeaver XI -
    /people/jin.shin/blog/2007/05/21/handling-web-service-soap-fault-responses-in-sap-netweaver-xi
    3) You have to do Fault message implementation in this case...
    A no. of exception will be there.For any error proxy will catch the exception and will write it in the fault message...so....from r/3 response will go to Xi as Fault message response in case any error/exception occours......
    have look here...
    Fault message implementation.
    /people/shabarish.vijayakumar/blog/2006/11/02/fault-message-types--a-demo-part-1
    4) Please go through it is very useful.
    /people/krishna.moorthyp/blog/2005/12/23/monitoring-for-processed-xml-messages-in-abap-proxy --Monitoring for Processed XML messages in ABAP Proxy
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy --ABAP Proxies in XI(Client Proxy)
    /people/sap.user72/blog/2005/12/29/service-enable-your-sap-application-component --- Service Enable Your SAP Application Component
    5) the file adapter can work only asynchronous, so you cant have a response. You should build two asynchronous messages. File -> proxy inbound and after the bapi call an outbound proxy is called which is sending a second messge to the file adapter.
    6) you can define a synchronous scenario which will include request/response messages.
    send the response back to XI.
    the file adapter supports BE QoS.
    http://help.sap.com/saphelp_nw04s/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm
    7)I have an interface Z_stock_move(message interface(inbound)) and class z_STOCK_MOVE in that. I have clicked exception tab but not able to add exception there as its not enabled for change.
    Please let me know how to add the exception to an existing abap proxy.so that i can raise an exception when bapi call to goods movenment returns errors.
    Might be useful to U.

  • Error handling in bapi

    hi all,
          how to handle errors in bapis,and also can anyone send faqs on bapis.

    Hi
    A BAPI should be able to record and classify all possible errors that may occur a function Module BAPI_MESSAGE_GETDETAIL is used to Handle the Error Messages..
    You have to create a parameter named Return for every BAPI. This parameter returns exception messages or success messages to the calling program.
    BAPIs themselves must not trigger any messages (such as MESSAGE xnnn) in the coding. In particular they must not generate terminations or display dialog boxes. Instead, all messages must be intercepted internally and reported back to the calling program in the Return parameter. Otherwise the BAPI will not be processed correctly and control may not be given back to the calling program.
    All error messages or indeed any message that may be returned by the BAPI, must be defined in message table (Tools ® ABAP Workbench ® Development ® Programming environment ® Messages) and described in the documentation for the return parameter. This also applies to the most important or most likely error messages generated by other programs that can be indirectly passed via the BAPI to the application program.
    You must not use exceptions in BAPI interfaces.
    When a termination message (message type A) is triggered, a database rollback is executed in the standard programming model, that is, all tasks performed since the last COMMIT WORK are canceled. When you program BAPIs, we recommend that you also execute a database rollback in the return parameter for termination messages. You must describe this process in the documentation for the Return parameter. For messages of type E (error), the calling program performs the error handling.
    Application developers are provided with two service BAPIs to diagnose and process error messages from BAPI calls:
    BapiService.MessageGetDetail() displays the short and long texts of BAPI error messages.
    BapiService.ApplicationLogGetDetail(), with which information in application logs can be displayed.
    Features
    The export parameter Return can be implemented as follows:
    As a structure, whereby it must be defined in the function module as an export parameter, as well as in the method in the BOR.
    As a table, whereby it must be defined in the function module as a table parameter, as well as in the method in the BOR as an export parameter.
    Before filling the Return parameter you should either initialize the structure with CLEAR or the table with REFRESH and CLEAR.
    If the return parameter is not set or is set to an initial value this means that no error has occurred.
    The Return parameter may be based on the following reference structures:
    BAPIRET2
    You must use this reference structure when developing new BAPIS.
    BAPIRET1, BAPIRETURN
    These reference structures are still partly used in old BAPIs.
    Both structures must be filled in the logon language.
    Reward if Helpfull,
    Naresh.

  • How to update  Service Contract using BAPI/FM for ME31K

    Hi ,
    I am using BAPI BAPI_CONTRACT_CREATE to create contracts.
    It works fine, the only problem i am facing is while updating line item with item category "D' its simply skips the item category and create a item. The item category is blank when i see in transaction ME33K.
    When i create it using ME31K transaction with line item item category type  "D' its ask me to fill the services also for that line item.
    My question is is there any BAPI which i can use to update the Services for item line with item category  D.
    Thanks
    Amar

    Hi Amar,
    Not sure if this would help you but you can consider writing different logic (probably a BDC) for item category 'D', and use BAPI for all other cases (if 'D' is the only exception).
    BAPI documentaion says:
    *External services (planned and unplanned services) are not supported.
    Creation of configurations is not supported*
    Regards,
    Shyam

  • Bapi doubts

    Hi All ,
    I have some doubts in Bapi
    1) why we can not use exception in Bapi ?
    2)  BAPI must not execute a COMMIT-WORK command.
    3) why its necessary to released the bapi & how ?
    4) In Bapi there is a test  for Example IF 1 = 2. If the test is true a message is displayed. The condition will obviously never be true, and we will never want to display a message in a BAPI
    then why it is necessary ?
    Thanks in advance
    Rahul

    solved

  • Few question on raise exception

    hi,
    i got this in the previous post.
    1) i need to define not_found in exception tab in 'string_split' function module right?
    2) what is the type for not_found?
    3) why not_found can equal to 7? how do we know 7 is not success?
    4) why not_found value can same as sy-subrc?
    5) may i know the difference for FM raise exception and bapi bapiret2.
    thanks
    FUNCTION-POOL CSTR.
    FUNCTION STRING_SPLIT.
      IF STRING NA DELIMITER.
        RAISE NOT_FOUND.
      ENDIF.
    ENDFUNCTION.
    The calling program could then include the following code:
    PROGRAM EXAMPLE.
    CALL FUNCTION 'STRING_SPLIT'
         EXCEPTIONS
              NOT_FOUND = 7.
    IF SY-SUBRC = 7.
      WRITE / 'There is a problem.'.
    ELSE.
    ENDIF.

    1) i need to define not_found in exception tab in 'string_split' function module right?
    The exception NOT_FOUND is already there, why do you want to define another?
    Even if you want to include another exception, you cannot simple define in the same function module. You have to copy the fm into a Z function module and then do wahtever you want to do.
    2) what is the type for not_found?
    No need for TYPE. the exceptions tab doesnt have any type.
    3) why not_found can equal to 7? how do we know 7 is not success?
    In general the order in which the exceptions are definned determines the subrc value they represent.
    example
    NOT_FOUND 1
    NOT_VALID 2
    TOO_LONG 3
    TOO_SMALL 4
    4) why not_found value can same as sy-subrc?
    sy-subrc is a system field which would have the value of the exception that is raised
    5) may i know the difference for FM raise exception and bapi bapiret2.
    bapiret2 is a structure like any other structures that we see in the se11.
    a filling the values in the bapiret2 structure wouldn't set the sy-subrc value to non zero.
    thanks
    Regards,
    Ravi

  • BAPI Upgradation

    BAPI's can work for upgradation ....what it means?
    What is the use of exception in BAPI's?

    hi
    good
    go through  link, which ll give you idea about the BAPI upgradation.
    >
    When we go for upgradation, there might be pozzibility to change the screen elements for transactions depending on the requirement. In that case,our BDC pgm may or may not work (depending on the screen changes they have made). Unless and until we prepare new BDC we cant use the old BDC pgm. But in BAPI, SAP promises that they are going to keep the old BAPI and for new functionality they will provide an upgraded BAPI. Until we write a new BAPI pgm, we can use the exisitng BAPI pgm.
    EXCEPTIONS IN BAPIS->
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3795 [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    THANKS
    MRUTYUN^

  • Problem Automating FPOP

    Hi,
    Iu2019m new to SAP (and BW), so please bear with me.  We went live with CRB and BW about four months ago.  At that time we could not automate our Sales Statistics and Business Partner data extractors because of various issues.  Weu2019ve since resolved those issues and are now attempting to automate these extractors.
    Our Basis team is working on getting these two processes automated in Redwood (we had to purchase this scheduling software to resolve some of our CRB issues).  The data extractor for Sales Statistics (BW-DQ-SS) works fine, but the extractor for Business Partner (FPOP), for the FICA BP Items Transaction process chain produces an error in Redwood (I have included the error message at the end of this post).
    Basis believes the problem is due to the Parallel Processing Object (u2018KEYPPu2019 u2013 3-Character Number) set on the Technical Settings tab, which was selected by the consultants that set up the process.  If we select help on the Object field under Parallel Processing Object, it actually mentions u2018GPARTu2019 for business partner in the help text.  However, this field is read-only.  The process runs fine with this object when we run it manually; it just fails when we try to automate it with Redwood.
    Can anyone tell me what they are using for this parameter, and how we can change it (new variant, etc)?  Or does anyone have any other suggestions on how we can get this process automated?
    Thank you very much for your help!
    program rw_macp.
    Form rwChangeParameters.
    data: h_basics  type FKK_MAD_BASICS.
    data: h_addons  type FKK_MAD_BWOP.
      import basics to h_basics from memory id 'FKKMADBASICS'.
      import addons to h_addons from memory id 'FKKMADADDONS'.
    processing field OBJECT
      h_basics-TECH-OBJECT = 'KEYPP'.
    processing field VARI
      h_basics-TECH-VARI = 'LESVar2'.
    processing field USE_LOAD_BALA
      h_basics-TECH-USE_LOAD_BALA = 'X'.
    processing field JOBS_LOAD_BALA
      h_basics-TECH-JOBS_LOAD_BALA = 5.
      export basics from h_basics to memory id 'FKKMADBASICS'.
      export addons from h_addons to memory id 'FKKMADADDONS'.
    EndForm.
    com.redwood.scheduler.connector.sap.rfc.connection.exception.SapBapiException: BAPI exception while calling /SCJS/ISU_NEW_PARAMETER_SET: E XM 300  {FKKBW,121} Enter an interval distribution [BWOP,,09/23/2011,84T] [, {FKKBW,121}, Enter an interval distribution, [BWOP,,09/23/2011,84T]]
    BAPI exception while calling /SCJS/ISU_NEW_PARAMETER_SET: E XM 300  {FKKBW,121} Enter an interval distribution [BWOP,,09/23/2011,84T] [, {FKKBW,121}, Enter an interval distribution, [BWOP,,09/23/2011,84T]]
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.checkBapiReturnCode(ClientConnectionImpl.java:789)
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.call(ClientConnectionImpl.java:602)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection$4.doPerform(AbstractRfcConnection.java:296)
                    at com.redwood.scheduler.connector.sap.rfc.connection.RemoteFunctionCall.perform(RemoteFunctionCall.java:120)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.perform(AbstractRfcConnection.java:456)
                    at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.execute(AbstractRfcConnection.java:289)
                    at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.SapFunctionModuleWrapper.execute(SapFunctionModuleWrapper.java:200)
                    at com.redwood.scheduler.connector.sap.rfc.jco.AbstractSapFunctionModule.execute(AbstractSapFunctionModule.java:109)
                    at com.redwood.scheduler.connector.sap.rfc.command.impl.MassActivityRunCommand.doExecute(MassActivityRunCommand.java:110)
                    at com.redwood.scheduler.connector.sap.rfc.command.impl.AbstractMassActivityCommand.execute(AbstractMassActivityCommand.java:57)
                    at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpCommand.doExecute(AbstractXbpCommand.java:85)
                    at com.redwood.scheduler.connector.sap.rfc.command.AbstractCommand.execute(AbstractCommand.java:56)
                    at com.redwood.scheduler.connector.sap.rfc.service.SapJobWork.doWork(SapJobWork.java:99)
                    at com.redwood.scheduler.infrastructure.workqueue.Worker.run(Worker.java:74)
                    at java.lang.Thread.run(Thread.java:708)

    Jeff:
    The parallel processing variant KEYPP is the object which is used internally by the system to break up all of the relevant data into more manageable chunks.  KEYPP is not related to BP - it is essentially a counter field.  See the SE11 documentation for data element KEYPP_KK.  The system uses these values to break up the documents by comparing their last 3 digits to that in the intervals.
    As to your issue, it is possible that you are not properly using the interval variant within the scheduled process.  Maybe you are using a variant that does not exist?  If you are trying to run something in parallel without providing a valid parallel variant, then i think that might be an issue.
    regards,
    bill.

  • URGENT HELP !JCO RETURN structure from SAP

    Hello,
    I am working on my intern project and I got some trouble.
    I have used JDBC to access a table in Oracle(this is an independent DB)I updated a column in the table and selected all data that
    was marked as 6 based on the update(SAP needs this data). I passed the values to a JCO application,
    which connects to SAP and send the data (I presume what I'm doing is correct) to a structure in SAP.
    SAP does some internal calculations with the data and should return the data back using the same
    structure but this time with some changes on the data.
    For example the field steuk is marked as 7 if the data processing was successful and if the data
    structure wasn't successful a 6 will be return.
    The return Values should be updated in the oracle DB indicating if the transfer was successful
    or not. And next time the same data will be sent to SAP following the same path.
    Now when I look at the return getString data in Eclipse, the result seems ambiguous.I don't see the data I presumably
    sent to the SAP structure using:
    JCO.ParameterList list = function.getTableParameterList();
    JCO.Table ztable =  list.getTable("ZSAORA_RUECK");
         for (int i = 0; i < 19; i++) {
         ztable.appendRow();
         ztable.setValue(value,field name);
    Am I doing some thing wrong here??? Any Help will be highly appreciated. Codes could be sent to [email protected]
    BELOW are the codes:
    CONNECTING TO test_table in Oracle DB:
    import java.sql.*;
    public class DatabaseConnect {
         public static void main(String[] args) {
         Connection con = null;
         Statement stmt = null;
         ResultSet re = null;
         String[] ParamArray;            
            ParamArray = new String[24];
         //Properties logon;
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
         con = DriverManager.getConnection
    ("jdbc:oracle:thin:@226.190.0.1:1521:testdb","test","test1");
         stmt = con.createStatement ();
         stmt.executeUpdate("UPDATE test_table set steuk = 6 WHERE steuk = 5");
    ResultSet rs = stmt.executeQuery("SELECT mandt,kokrs,werks,arbpl,aufnr,vornr,ile01,"+
    "lsa01,ism01,ile02,lsa02,ism02,ile03,lsa03,ism03,"+
    "ile04,lsa04,ism04,steuk,matnr,budat,kostl,pernr,"+
    "rueckid FROM test_table where steuk =6");                              
         while (rs.next()) {
         for (int i = 1; i <= 24; i++){
         ParamArray[i-1] = rs.getString(i);
         System.out.print(rs.getString(i) + 't');
         System.out.println();                    
         } catch(Exception e) {
         e.printStackTrace();                    
         } finally {
              try
         if(stmt != null) stmt.close();
         if(con != null) con.close(); 
         } catch (Exception exception) {
              exception.printStackTrace();
         // Bapi call
         TryBapi sap = new TryBapi(ParamArray);
    BELOW IS THE JCO Code which connects to SAP and send data to the structure:
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    public class TryBapi extends Object {     
    JCO.Client mConnection;     
    JCO.Repository mRepository;     
    OrderedProperties logonProperties;
    public TryBapi(String[] paramArray){
         try {
         logonProperties = OrderedProperties.load("/logon.properties");
         mConnection = JCO.createClient((String)logonProperties.get("jco.client.client"),
             (String)logonProperties.get("jco.client.user"),
            (String)logonProperties.get("jco.client.passwd"),
                             null,
           (String)logonProperties.get("jco.client.ashost"),
         String)logonProperties.get("jco.client.sysnr")
         mConnection.connect();
         mRepository = new JCO.Repository("SAPJCO",mConnection);
         catch (Exception ex) {
         ex.printStackTrace();
         System.exit(1);
         JCO.Function function = null;
         JCO.Table tab = null;
         try {
              function = this.createFunction("Z_UPDATE_SAORA_RUECK");
              if (function == null) {
              System.out.println("Z_UPDATE_SAORA_RUECK not found in SAP.");
              System.exit(1);
         JCO.ParameterList list = function.getTableParameterList();
              JCO.Table ztable =  list.getTable("ZSAORA_RUECK"); //inserting 24 records loop.
         for (int i = 0; i < 24; i++) {
         ztable.appendRow(); //ztable.setValue(value, field name)
         ztable.setValue("300","MANDT");
         ztable.setValue("KOKRS" + i, "KOKRS");
         ztable.setValue("WERKS" + i, "WERKS");
         ztable.setValue("ARBPL" + i, "ARBPL");
         ztable.setValue("AUFNR" + i, "AUFNR");
         ztable.setValue("VORNR" + i, "VORNR");
         ztable.setValue("ILE01" + i, "ILE01");
         ztable.setValue("LSA01" + i, "LSA01");
         ztable.setValue("ISM01" + i, "ISM01");
         ztable.setValue("ILE02" + i, "ILE02");
         ztable.setValue("LSA02" + i, "LSA02");
         ztable.setValue("ISM02" + i, "ISM02");
         ztable.setValue("ILE03" + i, "ILE03");
         ztable.setValue("LSA03" + i, "LSA03");
         ztable.setValue("ISM03" + i, "ISM03");
         ztable.setValue("ILE04" + i, "ILE04");
         ztable.setValue("LSA04" + i, "LSA04");
         ztable.setValue("ISM04" + i, "ISM04");
         ztable.setValue("STEUK" + i, "STEUK");
         ztable.setValue("MATNR" + i, "MATNR");
         ztable.setValue("BUDAT" + i, "BUDAT");
         ztable.setValue("KOSTL" + i, "KOSTL");
         ztable.setValue("PERNR" + i, "PERNR");
         ztable.setValue("RUECKID" + i, "RUECKID");
         list.setValue(ztable,"ZSAORA_RUECK");
         function.setTableParameterList(list);
         mConnection.execute(function);
         catch (Exception ex) {
         ex.printStackTrace();
         System.exit(1);
          JCO.Table codes = null;
         try {
         codes = function.getTableParameterList().getTable("ZSAORA_RUECK");
         System.out.println("Return Values starts HERE:");
         for (int i =0; i < codes.getNumRows(); i++){                 
         codes.setRow(i);
         System.out.println(codes.getString("MANDT")+ 't'+
         codes.getValue("KOKRS")+ 't'+
         codes.getString("WERKS")+ 't'+
         codes.getString("ARBPL")+ 't'+
         codes.getString("AUFNR")+ 't'+
         codes.getString("VORNR")+ 't'+
         codes.getString("ILE01")+ 't'+
         codes.getString("LSA01")+ 't'+
         codes.getString("ISM01")
    /*     codes.getString("ILE02")+ 't'+
         codes.getString("LSA02")+ 't'+
         codes.getString("ISM02")+ 't'+
         codes.getString("ILE03")+ 't'+
         codes.getString("LSA03")+ 't'+
         codes.getString("ISM03")+ 't'+
         codes.getString("ILE04")+ 't'+
         codes.getString("LSA04")+ 't'+
         codes.getString("ISM04")+ 't'+
         codes.getString("STEUK")+ 't'+
         codes.getString("MATNR")+ 't'+
         codes.getString("BUDAT")+ 't'+
         codes.getString("KOSTL")+ 't'+
         codes.getString("PERNR")+ 't'+
         codes.getString("RUECKID")       */
         catch (Exception ex) {
         ex.printStackTrace();
         System.exit(2);           
         mConnection.disconnect();
    public JCO.Function createFunction(String name) throws Exception {
         try {
         IFunctionTemplate ft =     mRepository.getFunctionTemplate(name.toUpperCase());
         if (ft == null)
         return null;
         return ft.getFunction();
         catch (Exception ex) {
         throw new Exception("Problem retrieving JCO.Function object.");
    Message was edited by: Rudolph Emange
    Message was edited by: Rudolph Emange

    Hi Astrid,
    Thank you for your remarks. The problem I'm having is that when I do send the values to SAP using the loop:
    JCO.ParameterList list = function.getTableParameterList();
    JCO.Table ztable =  list.getTable("ZSAORA_RUECK");
         for (int i = 0; i < 19; i++) {
         ztable.appendRow();
         ztable.setValue(value,field name);
    I do expect to have(or see) some values when I do access the same table structure(This is just a structure and
    not a real table as I do understand that there is a different between a structure and a table in SAP) and
    not the field names back.In the second try and catch block:
    try {
         codes = function.getTableParameterList().getTable("ZSAORA_RUECK");
         System.out.println("Return Values starts HERE:");
         for (int i =0; i < codes.getNumRows(); i++){                 
         codes.setRow(i);
         System.out.println(codes.getString("MANDT")+ 't'+
         codes.getValue("KOKRS")+ 't'+
         codes.getString("WERKS")+ 't'+
         codes.getString("ARBPL")+ 't'+
         codes.getString("AUFNR")+ 't'+
         codes.getString("VORNR")+ 't'+
         codes.getString("ILE01")+ 't'+
         codes.getString("LSA01")+ 't'+
         codes.getString("ISM01")
    I'm trying to access the values I sent in the first try and catch block. I presume I should see some real values and not the
    field names.This is how my output looks like:
    300     KOKR     WERK     ARBPL0     AUFNR0     VORN     ILE     
    300     KOKR     WERK     ARBPL1     AUFNR1     VORN     ILE     
    300     KOKR     WERK     ARBPL2     AUFNR2     VORN     ILE     
    300     KOKR     WERK     ARBPL3     AUFNR3     VORN     ILE     
    300     KOKR     WERK     ARBPL4     AUFNR4     VORN     ILE     
    300     KOKR     WERK     ARBPL5     AUFNR5     VORN     ILE
    This does not reflect the values but the field names. Why is it this way? Does it mean that my array is wrong or I'm not at all
    sending the values. Please HELP ME OUT HERE.
    Could any one show me a better way how to send the values selected from Oracle table using perhaps an
    ARRAY to the ZSAORA_RUECK structure in SAP?
    I am trying to send the values from the select statement in the first jdbc application
    to the value field in ztable.setValue(value,  field name).
    My Regards!
    Message was edited by: Rudolph Emange

  • Unable to insert  through   Adaptive RFC

    Hi
    i am sending the code which i implemented in my programme where i am facing problem while inserting into R3 neither i am getting any error nor i am able to insert into R3. through JCO i tried but unable to execute the rfc. i will be greateful if any body provide solution to this issue.
    // all binding i am doing inside controller's init
    insert_input = new Zhr_Fun_Appl_Emp_Ref_Input();
    //create object of structure in RFC
    edu=new Zbapieduc();
    quali=new Zbapiquali();
    emp=new Bapiemploy();
    //adding object to the input element
    insert_input.addEducation(edu);
    insert_input.addQualification(quali);
    insert_input.addPrevious_Employment(emp);
    //binding inputobject with current context
    wdContext.nodeZhr_Fun_Appl_Emp_Ref_Input().bind(insert_input);
    //executing the model inside the method which is defined in controller
    //setting the value of input parameter and table parameter
    try
    wdContext.currentZhr_Fun_Appl_Emp_Ref_InputElement().modelObject).execute();
    wdContext.nodeOutput().invalidate();
    }catch(Exception ex)
    //@@bapi objects
         Zhr_Fun_Appl_Emp_Ref_Input insert_input=null;
         Zbapieduc edu=null;//@@education
         Zbapiquali quali=null;//@@Qualification
         Bapiemploy emp=null;//@@experience
      //@@end

    Hi Sukanta,
                        First of all u r not calling the transaction commit,If ur bapi has internal commit,then its not a problem but if its doesn't then even if data is getting passed to R/3 system,it will not get saved.
    2nd u r telling that u r unable to execute the bapi,have u checked in debug mode whether its going to r/3 or not??
    logon to r/3 system->go to se37->put an external breakpoint in that bapi
    then execute ur application.So atleast u can find out whether its goin to r/3 or not.
    regards
    Sumit

  • Error occured when starting process chain

    When we want to start a process chain via SAP_BW_ProcessChainRun we get the following error log:
    Failed to start process chain /NSN/C_DSP_TR_GLOBAL_II. No logid was returned by the BW-SCH API.
    com.redwood.scheduler.connector.sap.rfc.connection.exception.SapBapiException: BAPI exception while calling RSPC_API_CHAIN_START: E RSPC 022 Processes with Error
    BAPI exception while calling RSPC_API_CHAIN_START: E RSPC 022 Processes with Error
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.checkBapiReturnCode(ClientConnectionImpl.java:789)
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.handleRscpApiErrors(ClientConnectionImpl.java:808)
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.call(ClientConnectionImpl.java:505)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection$4.doPerform(AbstractRfcConnection.java:296)
         at com.redwood.scheduler.connector.sap.rfc.connection.RemoteFunctionCall.perform(RemoteFunctionCall.java:120)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.perform(AbstractRfcConnection.java:461)
         at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.execute(AbstractRfcConnection.java:289)
         at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.SapFunctionModuleWrapper.execute(SapFunctionModuleWrapper.java:200)
         at com.redwood.scheduler.connector.sap.rfc.jco.AbstractSapFunctionModule.execute(AbstractSapFunctionModule.java:109)
         at com.redwood.scheduler.connector.sap.rfc.command.impl.BwProcessChainCommand.execute(BwProcessChainCommand.java:98)
         at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpCommand.doExecute(AbstractXbpCommand.java:86)
         at com.redwood.scheduler.connector.sap.rfc.command.AbstractCommand.execute(AbstractCommand.java:56)
         at com.redwood.scheduler.connector.sap.rfc.service.operation.RunJobOperation.doWork(RunJobOperation.java:103)
         at com.redwood.scheduler.connector.sap.rfc.service.SapJobWork.doWork(SapJobWork.java:38)
         at com.redwood.scheduler.infrastructure.workqueue.Worker.run(Worker.java:74)
         at java.lang.Thread.run(Thread.java:579)
    What could be the reason?
    Thanks
    Br
    Günter

    O.K. I can answer the question by myself: Is an authorisation issue. The rfc user who starts the PCs didn't have enough rights.
    Br
    Günter

  • Mass Activity - Error in SAP CPS

    Hi guys,
    I am trying to run a mass activity from SAP CPS in the ISU system. I imported the mass activity - 0004, the posting and the document date had to be changed dynamically, so I created a parameter set as shown here.
    Created a job to copy parameters(these two parameters only). Ran the job, the parameters are created and copied to target id FPMA5
    Created a copy of the job SAP_MassActivityTemplateRun -> Used the Target ID as shown and date as today.
    So, I am consuming the Identification FPMA5 from the previous job run here. Tried to run it, getting the below error in the SAP CPS system.
    com.redwood.scheduler.connector.sap.rfc.connection.exception.SapBapiException: BAPI exception while calling /SCJS/ISU_START_MASS_ACTIVITY: E XM 300 RAISE_EXCEPTION {00,341} Runtime error & has occurred [0004,K2,26.05.2014,FPMA5]
    BAPI exception while calling /SCJS/ISU_START_MASS_ACTIVITY: E XM 300 RAISE_EXCEPTION {00,341} Runtime error & has occurred [0004,K2,26.05.2014,FPMA5] [RAISE_EXCEPTION, {00,341}, Runtime error & has occurred, [0004,K2,26.05.2014,FPMA5]]
    Parameters:
      0004
        2014-05-26
      FPMA5
      X
            at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.checkBapiReturnCode(ClientConnectionImpl.java:727)
            at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.ClientConnectionImpl.call(ClientConnectionImpl.java:533)
            at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection$4.doPerform(AbstractRfcConnection.java:310)
            at com.redwood.scheduler.connector.sap.rfc.connection.RemoteFunctionCall.perform(RemoteFunctionCall.java:147)
            at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.perform(AbstractRfcConnection.java:481)
            at com.redwood.scheduler.connector.sap.rfc.connection.AbstractRfcConnection.execute(AbstractRfcConnection.java:303)
            at com.redwood.scheduler.connector.sap.rfc.jco2.connection.impl.SapFunctionModuleWrapper.execute(SapFunctionModuleWrapper.java:200)
            at com.redwood.scheduler.connector.sap.rfc.jco.AbstractSapFunctionModule.execute(AbstractSapFunctionModule.java:109)
            at com.redwood.scheduler.connector.sap.rfc.command.impl.AbstractMassActivityRunCommand.startMassActivity(AbstractMassActivityRunCommand.java:264)
            at com.redwood.scheduler.connector.sap.rfc.command.impl.MassActivityTemplateRunCommand.doExecute(MassActivityTemplateRunCommand.java:50)
            at com.redwood.scheduler.connector.sap.rfc.command.impl.AbstractMassActivityCommand.execute(AbstractMassActivityCommand.java:67)
            at com.redwood.scheduler.connector.sap.rfc.command.AbstractXbpCommand.doExecute(AbstractXbpCommand.java:84)
            at com.redwood.scheduler.connector.sap.rfc.command.AbstractCommand.execute(AbstractCommand.java:57)
            at com.redwood.scheduler.connector.sap.rfc.service.operation.RunJobOperation.doWork(RunJobOperation.java:136)
            at com.redwood.scheduler.connector.sap.rfc.service.SapJobWork.doWork(SapJobWork.java:38)
            at com.redwood.scheduler.infrastructure.workqueue.Worker.run(Worker.java:76)
            at java.lang.Thread.run(Thread.java:722)
    I now added other parameters into the parameter set, maintained them in the COPY_Parameter job. Even then I get the same error!
    I believe my problem is this - I am able to copy the parameters, but passing them to the Mass activity is somehow failing(I am using the MASS_ACTIVITY_TARGET_ID field output from Copy parameters to MASS_ACTIVITY_ID, which I believe is wrong. But I want to use the copy parameter job's output in the mass activity template run). Please let me know.
    I followed this guide: Importing and Running Mass Activities - SAP Central Process Scheduling by Redwood - SAP Library
    Thanks and regards,
    Pavan

    Hi Pavan,
    To create a job chain-level parameter, proceed as follows:
    Go to Definitions > Job Chains and choose Edit on your job chain
    In the job chain editor, click on the Parameters tab
    Click Add, fill in Name, for example MASS_ACTIVITY_DATE, fill 0 into Display Order.
    In default expression field, fill =Time.expressionNow('truncate day add 3 days')
    Make sure Display is checked, click Save
    Submit the job chain, you will notice that the date is as expected, cancel the submit.
    In the job chain, go to the job for which you want to set the parameter and choose Reference, select the job chain parameter.
    The above will use the date at submit time + 3 days, if you want to use the runtime date, when the job chain starts, you disable Display and enable Runtime, remove 'add 3 days'.
    Hope that helps.
    Regards,
    HP

Maybe you are looking for

  • Why do imported pictures end up in an "Originals" folder I can't locate?

    I am trying to import pictures to IPhoto from a CD. I am choosing "Import to Library" under "Files" on the IPhoto library menu, and then highlighting several folders on the CD.  I click the message that says do not import (all) duplicates. The import

  • Adobe Creative Cloud CC Update is not being installed - error code 50

    Hi, I'm trying to update my Adobe Creative cloud client to the current version At exactly 50% the installation stops and the message "Creative cloud could not be updated, error code 50" appears. What can I do?

  • Hint captions - how to make them work

    Hello all, Can someone shed light how to make hint captions work? I created a training progect with all default options - it generates all four caption: Text, success, failure and hint. The problem is that hint captions are not shown when hoovering o

  • Order of records in o/p  of select statement

    Hi all I have doubt regarding the select statement. I need to execute a select statement (with out any order ie with out "order by") which searchs a table. I want to know whether in any circumstances the order of the records of the select statement i

  • Macbook Pro and Architecture

    What type of Macbook Pro and software should I get for an Architecture student?