Sending a table to remote RFC in Java UDF

Hello,
<br><br>
We use the API "com.sap.aii.mapping.lookup" often to make RFC calls from a UDF and return data. We typically create an import parameter in the Function Module and pass the value into the RFC. We now need to send in an unlimited number of values so we understand that instead of the import paramter we need to use a table. The problem is we get an error when we build the XML in our UDF and try to call the RFC. We tried wrapping the values in item nodes and several other approaches but we are not sure if we can populate a table via XML and make the RFC call.
<br><br>
Example of what we tried:
<br><br>
String sRfcxml = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;ns0:ZCAE_MX_CONTRACT_ROUTING xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"&gt;&lt;E_ZCAE_COCODE&gt;&lt;item&gt;0445&lt;/item&gt;&lt;/E_ZCAE_COCODE&gt;&lt;/ns0:ZCAE_MX_CONTRACT_ROUTING&gt;";
<br><br>
Regardless of what we try we get the following error during the call:
<br><br>
error of "RuntimeException in Message-Mapping transformation: Exception:[java.lang.RuntimeException: com.sap.aii.mapping.lookup.LookupException: Exception during processing the payload.Problem when calling an adapter by using communication channel RFC_RCV_ORGDATA (Party: , Service: ValidateXIData_BusiServ, Object ID: d5401e52ad1039df96f02bde53b23c06) XI AF API call failed. Module exception: 'error while processing the request to rfc-client: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not convert request from XML to RFC:com.sap.mw.jco.JCO$Exception: (130) JCO_ERROR_XML_PARSER: Expecting a tag to begin with '<' instead of '0', in "ODE><item>0965</item"'. Cause Exception: 'error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not convert request from XML to RFC:com.sap.mw.jco.JCO$Exception: (130) JCO_ERROR_XML_PARSER: Expecting a tag to begin with '<' instead of '0', in "ODE><item>0965</item"'. com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel RFC_RCV_ORGDATA (Party: , Service: ValidateXIData_BusiServ, Object ID: d5401e52ad1039df96f02bde53b23c06) XI AF API call failed. Module exception: 'error while processing the request to rfc-client: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not convert request from XML to RFC:com.sap.mw.jco.JCO$Exception: (130) JCO_ERROR_XML_PARSER: Expecting a tag to begin with '<' instead of '0', in "ODE><item>0444</item"'. Cause Exception: 'error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not convert request from XML to RFC:com.sap.mw.jco.JCO$Exception: (130) JCO_ERROR_XML_PARSER: Expecting a tag to begin with '<' instead of '0', in "ODE><item>0444</item"'."
<br><br>
Now if we do not pass any data or use an import versus table parameter in the function module it works just fine.
<br><br>
We know we can work around this by using an import parameter and stringing the values together with a delimiter and then breaking this apart in ABAP but we are looking for a cleaner solution.
<br><br>
Any thoughts?
<br><br>
Joe
Edited by: Joe Wright on Nov 16, 2009 10:45 PM

Not sure what's wrong, but are you sure your "stringed" XML document matches the expected RFC structure ? Btw, I'd replace (though it could be considered as a cosmetic change) to replace "ns0" with "rfc" in your namespaces declaration, it's what you'll see in all imported RFC objects in XI/PI
Rgds
Chris

Similar Messages

  • RFC error sending a table

    People.. please... I am sending one table to one RFC with this code:
    wdContext.nodeZctftv003_Input().bind( inputSol );
    wdContext.nodeT_Saida().bind( new ArrayList() );
    wdContext.nodeT_Saida().addElement(  tSaida );     
    inputSol.modelObject().execute();
    but the RFC always returns me the follow:
    Caused by: com.sap.aii.proxy.framework.core.DataAccessException: Mandatory parameter T_SAIDA of method ZCTFTV003 missing
    Edited by: Michel Dambros Figueiredo - BR on Nov 6, 2008 12:22 PM

    This is the complete code:
    Yes I think the node is initialized, doesn´t it ?
    The server was restarted
    About the mapping.. I imported the nodes from de model side.
              IPublicFcTreReview.IZctftv003_InputElement inputSol= wdContext.createZctftv003_InputElement( new Zctftv003_Input() );
              inputSol.setV_Pernr( wdContext.currentEnviaParaRFCElement().getV_Pernr() );
              inputSol.setV_Reinr( wdContext.currentExpenseReportSave_OutputElement().getE_Tripnumber() );
              inputSol.setV_Botao( wdContext.currentEnviaParaRFCElement().getV_Botao() );          
              IPublicFcTreReview.IT_SaidaElement tSaida= wdContext.createT_SaidaElement( new Zctts001() );
              tSaida.setCountry_Beg( "BR" );
              tSaida.setCountry_End( "CO" );
              tSaida.setDate_Beg( new Date( System.currentTimeMillis() ) );
              tSaida.setDep_Arr( true );
              tSaida.setLocation_Beg( "SP" );
              tSaida.setLocation_End( "CA" );
              tSaida.setPernr( wdContext.currentEnviaParaRFCElement().getV_Pernr() );
              tSaida.setReinr( wdContext.currentExpenseReportSave_OutputElement().getE_Tripnumber() );
              tSaida.setRequest_Type("OF");
              tSaida.setTime_Beg( new Time( System.currentTimeMillis() ) );
              wdContext.nodeZctftv003_Input().bind( inputSol );
              wdContext.nodeT_Saida().bind( new ArrayList() );
              wdContext.nodeT_Saida().addElement(  tSaida );     
              inputSol.modelObject().execute();

  • Passing table to RFC in Java iview

    Hi - I am trying to pass a table to an RFC.  No error on the RFC call - but no data is being passed in the table either...any recomendation on what I am missing - here is my code:
               public String submitOrder(JCO.Table iTab, String iType) {
               String errMsg = "";
                JCO.Function function = null;
               try {
         functionRepository = new JCO.Repository("custCSM", sapConnection);
         function = this.createFunction("Z_RFC_POST_IDOC_1");
            function.getImportParameterList().setValue(iType, "BUILD_SHIP");
            function.getTableParameterList().setValue(iTab, "ZIDOC_POST");
         sapConnection.execute(function);
               } catch (Exception e) {errMsg = "Submission had errors. Order not Submitted.";
          e.printStackTrace();}
              return errMsg;
    many thanks - Janet

    Hi Janet
    I can give you a pointer here.
    just plug in either of these calls just before the execute
    function.writeXML("C:/call.xml");
    (This will print out data you are trying to send in an XML file )
    or
    sapConnection.setAbapDebug(true);
    (This will open a SAP gui with the Function Module in debug mode , you can then double click the table params to see if it is populated)
    Regards
    Pran

  • Cannot send a null Map key for type 'java.util.HashMap'

    Hi All,
      I am haing an issue with sending data from Server to the client using the AMF Channel.
      Most of the method invocations on the RemoteObject are throwing the following Exception.
    [CODE]
    (mx.rpc.events::FaultEvent)#0
      bubbles = false
      cancelable = true
      currentTarget = (null)
      eventPhase = 2
      fault = (mx.rpc::Fault)#1
        content = (null)
        errorID = 0
        faultCode = "Server.Processing"
        faultDetail = (null)
        faultString = "Cannot send a null Map key for type 'java.util.HashMap'."
        message = "faultCode:Server.Processing faultString:'Cannot send a null Map key for type 'java.util.HashMap'.' faultDetail:'null'"
        name = "Error"
        rootCause = (null)
      headers = (null)
      message = (mx.messaging.messages::ErrorMessage)#2
        body = (null)
        clientId = "22E55FB1-910E-312F-E37A-ED5167139CB0"
        correlationId = "4DB54224-662A-C596-D165-F7C3EBB64DB8"
        destination = "TimeMap"
        extendedData = (null)
        faultCode = "Server.Processing"
        faultDetail = (null)
        faultString = "Cannot send a null Map key for type 'java.util.HashMap'."
        headers = (Object)#3
        messageId = "22E56255-D62F-2ACF-4DA5-CF1E4D6353BB"
        rootCause = (null)
        timestamp = 1266877198902
        timeToLive = 0
      messageId = "22E56255-D62F-2ACF-4DA5-CF1E4D6353BB"
      statusCode = 0
      target = (null)
      token = (mx.rpc::AsyncToken)#4
        message = (mx.messaging.messages::RemotingMessage)#5
          body = (Array)#6
          clientId = (null)
          destination = "TimeMap"
          headers = (Object)#7
            DSEndpoint = "my-amf"
            DSId = "22E53936-7E0E-B21C-C936-EF1078000306"
          messageId = "4DB54224-662A-C596-D165-F7C3EBB64DB8"
          operation = "getMapKey"
          source = (null)
          timestamp = 0
          timeToLive = 0
        responders = (Array)#8
          [0] (com.universalmind.cairngorm.events::Callbacks)#9
            conflictHandler = (null)
            faultHandler = (function)
            priority = 0
            resultHandler = (function)
        result = (null)
      type = "fault"
    [CODE]
    The Spring bean which is exposed as a Remote Object has the following method signature..
    [CODE]
    public String getMapKey() {
            return mapKey;
    [/CODE]
    I am unable to understand why AMF Channel or Blaze DS is treating the String as HashMap !!!
    This was working pefectly fine till yesterday !!
    The version of the BlazeDS i am using is : blazeds_turnkey_3-0-0-544
    and the Flex SDK Version is : flex_sdk_3.5.0.12683
    We recently upgraded to Flex 3.5.0 version earlier we were using 3.3 version
    Thanks
    mars

    Hi All,
    I chcked my server side java beans ( which are managed by Spring) and they are all returning the data property and none of the Keys in the returned hashmaps are null.
    Not sure why this is happening.
    Thanks
    kumars

  • Flow of tables information between sap and java

    How should i pass the table information from sap to java.
    and how to process the data of a table in the java program. i had seen the examples of JCO. BUT I IS VERY CONFUSING (BCOZ I DON'T KNOW JAVA).
    PLZ IF U DON'T MIND SEND ME CODE SNIPPET TO
    1.GET THE TABLE INTO THE JAVA PROGRAM
    2.PROCESSING THE TABLE INFORMATION IN JAVA PROGRAM
    3.MODIFYING THE TABLE INFORMATION IN JAVA PROGRAM
    4.SENDING BACK THE TABLE TO SAP FROM JAVA PROGRAM

    hi,Kondani
    as JCO offers both Client side and server Side programming.
    you can use JCO to connect SAP ABAP.outbound and inbound.
    1) JCO example 5 is about Server side programming java code. And you can see the data mapping is this example.And you must use sm59 to define the connections in SAP before you start.
    2) example 1 is about client side programming.
    try example 1 first. you can get a table from SAP using BAPI.
    Lots of JCO weblog you can see here
    https://www.sdn.sap.com/sdn/search.sdn?contenttype=url&query=jco&selected=9&content=/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fSDN!2fiViews!2fWCM!2fcom.sap.sdn..wcm.search.search_adv%3Fprttheme%3DCSIN%26QueryString=jco%26SearchPluginName=sdn_weblog%26SelectedCustomProps=resourcetype(value=sdn_weblog)
    Regards

  • Flow of tables informaion between sap and java

    How should i pass the table information from sap to java.
    and how to process the data of a table in the java program. i had seen the examples of JCO. BUT I IS VERY CONFUSING (BCOZ I DON'T KNOW JAVA).
    PLZ IF U DON'T MIND SEND ME CODE SNIPPET TO
    1.GET THE TABLE INTO THE JAVA PROGRAM
    2.PROCESSING THE TABLE INFORMATION IN JAVA PROGRAM
    3.MODIFYING THE TABLE INFORMATION IN JAVA PROGRAM
    4.SENDING BACK THE TABLE TO SAP FROM JAVA PROGRAM

    hi,Kondani
    as JCO offers both Client side and server Side programming.
    you can use JCO to connect SAP ABAP.outbound and inbound.
    1) JCO example 5 is about Server side programming java code. And you can see the data mapping is this example.And you must use sm59 to define the connections in SAP before you start.
    2) example 1 is about client side programming.
    try example 1 first. you can get a table from SAP using BAPI.
    Lots of JCO weblog you can see here
    https://www.sdn.sap.com/sdn/search.sdn?contenttype=url&query=jco&selected=9&content=/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fSDN!2fiViews!2fWCM!2fcom.sap.sdn..wcm.search.search_adv%3Fprttheme%3DCSIN%26QueryString=jco%26SearchPluginName=sdn_weblog%26SelectedCustomProps=resourcetype(value=sdn_weblog)
    Regards

  • Create a Table Dynamically in WEB Dynpro Java with diferent type of column

    Hi everyone, I have a question if is possible to create a table dynamically in Web Dynpro Java?, depending of the RFC consults create the rows dynamically, ,this table must have diferent type of columns, for example link column (when the user click this link execute an action and show a adobe interactive form in another view), image column (show an image depending of the information)
    Thank you everyone
    Atte Israel

    Hello,Israel.
    Yes , it is possible through dynamic programming in wdModify of the View.
    You can do this ,for example, using cell variants.
    IWDTable tab = (IWDTable) view.getElement("TABLE_NAME");               
    IWDTableStandardCell cellV= (IWDTableStandardCell) view.createElement(IWDTableStandardCell.class,"TableStandardCell"+i); 
    cellV.setVariantKey("NotEditableVariant");
    cellV.setCellDesign((WDTableCellDesign)wdContext.nodeTableDaysTitle().currentTableDaysTitleElement().getAttributeValue("CellDesign"+i));
    IWDTextView textViewi= (IWDTextView) view.createElement(IWDTextView.class,"TextView"+i);  // -- here you control the type of the object that is displayed in the cell
    textViewi.bindText(dayAttrib);
    cellV.setEditor(textViewi);          
    tabColumn.addCellVariant(cellV);
    tab.addGroupedColumn(tabColumn,tab.numberOfGroupedColumns());     
    Using this code you can control even specific cells in the table and not only columns.
    Hope this helps you,
    Constantine

  • RFC - XI - Java Proxy HTTP_RESP_STATUS_CODE_NOT_OK

    Hi all,
    I need to work on RFC->XI-> Java proxy.
    While excuting, i am getting an error :
    <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">HTTP_RESP_STATUS_CODE_NOT_OK</SAP:Code>
      <SAP:P1>400</SAP:P1>
      <SAP:P2>Bad Request</SAP:P2>
    Can any body please guide?
    Regards,
    Kulwant

    Hi Kulwanth,
    Plz do check the mentioned possibilities for your error one by one:
    1.Did you maintain Client, userid, password, and lang information in SICF transaction -> sap/xi/engine? Double click on service and check whether you have entered correct information.
    2.Then you might check the roles of the XIISUSER in SU01. In some case there are some double roles, i.e., two times the role SAP_XI_IS_SERV_USER assigned. One might have the date of the last update, the other one might have apparently the older version. Delete the older roles manually and the error should disappear.
    3.to send messages to xi you need a service id / pwd which is specific to your landscape usually its xiappluser. Contact your basis group for password.
    4.
    Activated all services on the r3 system.
    Create HTTP connection to XI from r3
    sm59-> http connetons to r3
    let us say you have created a HTTP connection in the integrationserver_XI, make sure in its settings the prefix path is set to /sap/xi/engine?type=entry. Also check its log on credentials, you can use xiappluser.
    IN Integration builder, receiver communication channel make sure you have entered proper
    host service number
    path = /sap/xi/enigne?type = receiver.
    5. It might also be that you have authorization problems with your XISUPER. In the visual administrator and in ABAP SU01, make your XISUPER has all the necessary(SAP_SLD* and SAP_XI*) roles assigned to it. If not, try to assign these and see if this can be of any help.
    6. can you also try the following;
    Visual Admin -> start the service,
    "com.sap.aii.af.ms.app".
    Please go through the followings links also :
    http://help.sap.com/saphelp_nw04/helpdata/en/82/f4993c03e0cd37e10000000a11405a/content.htm
    The specified item was not found.
    http://help.sap.com/saphelp_nw04/helpdata/en/39/83682615cd4f8197d0612529f2165f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/39/83682615cd4f8197d0612529f2165f/frameset.htm
    I hope the info provided help you solve your error.
    Regards,
    Vinod.

  • Accessing Java tables of XI within GUI/Java mapping

    Hi,
    I am looking for a way to access tables of a java dictionary within java/GUI mapping. Specifically, if it is possible some simple API to access  java tables within user-defined functions.
    I know you can access tables via JDBC/RFC lookups. But, this way more applies to external to SAP XI tables. Is there a more simpler way to access java native tables inside SAP XI.
    Thank you in advance,
    Dmitriy Mindich

    Hi Stephan,
    I agree that first case should not be implemented. But, I would like to disagree on the second case. I am not talking about storing application data, but interface-related intformation, such is file generation id or date generation. This information is interface-specific, and unfortunately XI does not provide a way to store persistent variables inside XI.
    There are a couple of options:
    1. Use SEEBURGER's functionality. Unfortunately, I dont have the need to use EDI functionality of SAP, thus I dont want to buy SEEBURGER's license.
    2. Use ABAP Mapping and store it inside tables inside ABAP-stack. However, as I said before this step would be performance intensive for me, since the majority of mapping in my case is done in Java/GUI mapping.
    Based on these cases, I was thinking there should be an easier way to store/retrieve interface related information inside XI tables. And, since most of my mappings are Java-based, I was thinking I can use Java-stack to store persistent variables.
    Would you agree, Stephan?
    Regards,
    Dmitriy Mindich

  • How to send database table

    how to send database table one sever to another server in the form of  tms request.
    i want send a particular database table one server to another as a request.
    give solution plz
    Message was edited by:
            mahesh

    Hi Mahesh,
    Technically it is possible to transport entries of every table in SAP even if changes dont prompt for a transport request. Do the following. Create a customising/workbench request. It depends of the table whose entires you wish to transport. .If you wish you can just  use workbench transport for all tables.
    After you have created the transport click on the request and in menu bar choose Request/Task and then Display object list. Goto change mode.
    Click on Inset line icon in application tool bar. A new line for input will come up.
    In PGMID give the value R3TR
    In Obj give value TABU
    In Object Name give the name of the table.
    After that double click on table name entry. You will come to the screen: Transport organizer:Change Key List.
    Here again choose insert line. A new line with table  name and key as the column headers will come up.
    Double click on the empty input field for the key. In the next screen you will get options to fill in the key.
    You can insert key as per your choice. However one thing needs to be remembered. If you put * in any field SAP wont allow you fill in value in later fields as only a final asterisk can be used as a generic entry.
    Please try out this option. I use this option to transport RFC destinations as well profile parameters across systems.
    Please award points if the answer was of help to you.
    Regards.
    Ruchit.

  • Failed to send SLD settings to remote agent

    Dear Guru's,
    I'm facing problem when trying to register SLD Agent. I have run this command :
    /smdsetup.sh sldconf , /smdsetup.sh managingconf and etc but nothing is worked for me.
    after i have run those command, Agent is available within system, but when i tried to push SLD Setting i got this error :
    "Failed to send SLD settings to remote agent (detail: Failed to save new SLD settings; nested exception is: java.lang.Exception: Unexpected error while changing SLD settings - exit code: -1)"
    I just update the Solution Manager ABAP SPS11, but my JAVA SPS is still 07.
    Is it because i don't upgrade my Java ?
    My DAA Agent is 7.20 patch level 87.
    kindly need your help to enlighten me about this issue, i cannot move to other configuration because this error.
    thankyou.
    Best Regards,
    Marvin

    Hi Marvin,
    Can you explain in details which system are you trying to connect with some screenshot and logs.
    Are you trying to connected a non-ABAP/non-AS-java system ?
    If yes, you check this thread.
    http://scn.sap.com/community/netweaver-administrator/blog/2013/08/11/trex-configuration-with-solution-manager-71--part-1
    Also, check this sap KBA for more information.
    1147499 - Connection to the System Landscape Directory
    If you are registering DAA of SLD.
    then Use below command
    smdsetup managingconf hostname:"sapms://<fqn>" port:"<MS httpPort>" [optional user:"<...>" pwd:"<...>" servername:"<...>"]
    smdsetup managingconf hostname:"<fqn>" port:"<p4 port>" [optional user:"<value>" pwd:"<value>" servername:"<value>"]
    If this is also not working,
    Execute the command
    smdsetup supportlogs
    At the end of the execution of the command, a Zip file is generated in at the following location: /usr/sap/<AGENT_SID>/<AGENT_INSTANCE_NUMBER>/SMDAgent/supportLogs_<TIMESTAMP>.zip.
    Ans share the zip file.
    Regards,
    Divyanshu

  • Does the local server send the query to remote server?

    I have 2 servers,a local server connect with remote server through database link.If I execute a query at local server but only access tables in remote server,does local server send this query to remote server or all the tables at remote server will send to local server?If local server send this query to remote server,does it can execute another query while it waits the result send from remote server?
    Any help would be appreciated
    Regards

    Yes is executed on remote , and the remote can accept queries as normal see my example below
    SQL> select * from v$database@prod_p;
    Execution Plan
    Plan hash value: 3039639316
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
    | Inst |
    | 0 | SELECT STATEMENT REMOTE| | 100 | 64400 | 0 (0)| 00:00:0
    1 | |
    | 1 | MERGE JOIN CARTESIAN | | 100 | 64400 | 0 (0)| 00:00:0
    1 | |
    |* 2 | FIXED TABLE FULL | X$KCCDI | 1 | 582 | 0 (0)| 00:00:0
    1 | RPRD |
    | 3 | BUFFER SORT | | 100 | 6200 | 0 (0)| 00:00:0
    1 | |
    | 4 | FIXED TABLE FULL | X$KCCDI2 | 100 | 6200 | 0 (0)| 00:00:0
    1 | RPRD |
    Predicate Information (identified by operation id):
    2 - filter("DI"."INST_ID"=USERENV('INSTANCE'))
    Note
    - fully remote statement

  • Sample Java code and detail to call RFC from Java clas developed in Eclipse

    Hi All,
    I am new to Java. I have downloaded Eclipse IDE  and planning to use for developing Java application to send data to SAP by calling RFC JCO Interface.
    I need a sample java code/tutorial step by step to create Java class for simple example to call RFC from Java.
    I have downloaded SAPJCO3 from service market place.
    Kindly help me to send steps involved to configure for JCO  with my Eclipse with JCO.
    Thanks in advance.
    Sharma

    Hi Sharma,
    Please have a look at [Example: Using Generated Proxies to Call Function Modules |http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm]
    JCo Exceptions : http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f6/daea401675752ae10000000a155106/content.htm
    Hope it will helps
    Regards
    Arun

  • Permissions for PIAPPLUSER for running remote RFC

    Hi guys,
    I want the PIAPPLUSER in ABAP stack to have permissions to run RFC. Which permissions/role is needed for this? I will be connecting from Java stack via PIAPPLUSER to ABAP and want to run remote RFC using it.
    Thanks, Olian

    Hi Olian,
    You can create a new Z role and add the below authorization objects and attach the role to the created user.
    S_RFC
    S_RFC_ADM
    S_RFCACL
    Cheers....,
    Raghu

  • How to run a remote application (Non Java) from a Java program

    Could you please tell me how to run a remote application (Non-Java) from a Java program without using RMI. Please tell me know the procedure and classes to be used.
    Cheers
    Ram

    what do you mean remote application.In the other pc or in your pc just apart from you application?
    If the application is in your pc,the method which the upper has mentioned is
    a good one!
    But if the application you want to run is not in your computer,the method can't do. And you can use socket with which you can build an application listening some port in the pc which contains the application you want to run .When you want to run that application ,send the Start_Command to the listening application.Then listening application will run the application with the help of the method the upper mentioned.

Maybe you are looking for