JCO Server - function template definition

Hi all,
I'm writing a JCO Server application where I define a function template with three tables each with a number of character fields.
It seems that I need to set the length of each field to the double of the corresponding field of the SAP function.
For example, the field COD_ZONE should be a char(2) (valid value: B1) and then I need to set the char length to 4 otherwise a truncated value is received.
It looks like a double-byte character set is set in SAP environment, but it should not be the case.
Do you have any idea ?
Thanks for helping

Yes,
we have unicode environment.
That means that I can't use following definition ?
fmeta = new JCO.MetaData("FUNC");
fmeta.addInfo("TABLE", JCO.TYPE_TABLE, 2, 0, 0, 0, "HEADER");
repository.addFunctionInterfaceToCache(fmeta);
JCO.MetaData tableMeta = new JCO.MetaData("HEADER");
tableMeta.addInfo("OBJECT_ID", JCO.TYPE_CHAR,  2, -1, 0);

Similar Messages

  • Java system error: Server repository could not create function template

    Hi, Our BI person is trying to  publish/broadcast a query to the PRODCTION  portal, she gets the below error message.  I am
    attaching the defaulttracelog file
    "Java system error: Server repository could not create function template for RSRD_X_PRODUCE_PROXY caused by: com.sap.mw.jco.JCO$Exception: (103)"
    <!LOGHEADER[START]/>
    <!HELP[Manual modification of the header may cause parsing problem!]/>
    <!LOGGINGVERSION[1.5.3.7185 - 630]/>
    <!NAME[./log/defaultTrace.trc]/>
    <!PATTERN[defaultTrace.trc]/>
    <!FORMATTER[com.sap.tc.logging.ListFormatter]/>
    <!ENCODING[UTF8]/>
    <!FILESET[8, 20, 10485760]/>
    <!PREVIOUSFILE[defaultTrace.7.trc]/>
    <!NEXTFILE[defaultTrace.9.trc]/>
    <!LOGHEADER[END]/>
    #1.5 #002264F9350800600000022F000019C000048E9B91EF3AB3#1282698726384#com.sap.security.core.persistence#sap.com/irj#com.sap.security.core.persistence#J2EE_GUEST#0##n/a##4dba6f30af8111df934c002264f93508#SAPEngine_Application_Thread[impl:3]_35##0#0#Error#1#/System/Security/Usermanagement#Java#An exception was thrown in the UME/ABAP user management connector that was caused by unavailability of the RFC communication with the backend system: "". ##An exception was thrown in the UME/ABAP user management connector that was caused by unavailability of the RFC communication with the backend system: "". #1#Connect to SAP gateway failed
    Connect_PM  TYPE=A ASHOST=localhost SYSNR=00 GWHOST=localhost GWSERV=sapgw00 PCS=1
    LOCATION    CPIC (TCP/IP) on local host with Unicode
    ERROR       partner '127.0.0.1:sapgw00' not reached
    TIME        Tue Aug 24 21:12:06 201
    RELEASE     700
    COMPONENT   NI (network interface)
    VERSION     38
    RC          -10
    MODULE      nixxi.cpp
    LINE        2823
    DETAIL      NiPConnect2
    SYSTEM CALL connect
    ERRNO       10061
    ERRNO TEXT  WSAECONNREFUSED: Connection refused
    COUNTER     56
    #1.5 #002264F93508006000000230000019C000048E9B91EF47C8#1282698726384#com.sap.engine.services.monitor.mbeans.Monitor#sap.com/irj#com.sap.engine.services.monitor.mbeans.Monitor#J2EE_GUEST#0##n/a##4dba6f30af8111df934c002264f93508#SAPEngine_Application_Thread[impl:3]_35##0#0#Error##Plain###Caller J2EE_GUEST not authorized, user J2EE_GUEST is not available from user management, reason: com.sap.security.api.NoSuchUserException:USER_AUTH_FAILED: User account for logonid "J2EE_GUEST" not found!#
    #1.5 #002264F93508006000000231000019C000048E9B91EF4CD5#1282698726384#System.err#sap.com/irj#System.err#J2EE_GUEST#0##n/a##4dba6f30af8111df934c002264f93508#SAPEngine_Application_Thread[impl:3]_35##0#0#Error##Plain###com.sap.engine.services.jmx.exception.JmxSecurityException: Caller J2EE_GUEST not authorized, user J2EE_GUEST is not available from user management, reason: com.sap.security.api.NoSuchUserException:USER_AUTH_FAILED: User account for logonid "J2EE_GUEST" not found!
         at com.sap.engine.services.jmx.auth.UmeAuthorization.checkMBeanPermission(UmeAuthorization.java:63)
         at com.sap.engine.services.jmx.JmxServerFrame.checkMBeanPermission(JmxServerFrame.java:98)
         at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.unregisterMBean(MBeanServerSecurityWrapper.java:395)
         at com.sap.engine.services.jmx.ClusterInterceptor.unregisterMBean(ClusterInterceptor.java:1327)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.unregisterMBean(MBeanServerInterceptorChain.java:258)
         at com.sap.engine.services.monitor.mbeans.Monitor.unregister(Monitor.java:106)
         at com.sap.engine.library.monitor.impl0.AbstractMonitorNode.remove(AbstractMonitorNode.java:154)
         at com.sap.engine.library.monitor.impl0.MonitorObjectFactory.uninstallMonitorNode(MonitorObjectFactory.java:483)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:595)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:581)
         at com.sap.engine.services.monitor.install.MonitorInstaller.uninstallMonitors(MonitorInstaller.java:568)
         at com.sap.engine.services.monitor.server.ApplicationLifeCycleImpl.applicationStopped(ApplicationLifeCycleImpl.java:52)
         at com.sap.engine.services.monitor.deployment.MonitorDeploymentContainer.commitStop(MonitorDeploymentContainer.java:630)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commonCommitFinished(StopTransaction.java:244)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commitCommon(StopTransaction.java:290)
         at com.sap.engine.services.deploy.server.application.StopTransaction.commitLocal(StopTransaction.java:278)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesLocal(ApplicationTransaction.java:374)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:132)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesLocalAndWait(ParallelAdapter.java:250)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.stopApplicationLocalAndWait(DeployServiceImpl.java:4569)
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.stopApplicationLocalAndWait(DeployCommunicatorImpl.java:628)
         at com.sap.portal.prt.sapj2ee.SAPJ2EEPortalRuntime$2.run(SAPJ2EEPortalRuntime.java:602)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1482)
         at java.lang.Runtime.load0(Runtime.java:737)
         at java.lang.System.load(System.java:811)
         at com.sapportals.wcm.service.fsmount.FSMountService.loadDLL(FSMountService.java:736)
         at com.sapportals.wcm.service.fsmount.FSMountService.<clinit>(FSMountService.java:796)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:219)
         at com.sapportals.wcm.repository.runtime.CmConfigurationProvider.convertGS(CmConfigurationProvider.java:637)
         at com.sapportals.wcm.repository.runtime.CmConfigurationProvider.convertServiceConfig(CmConfigurationProvider.java:601)
         at com.sapportals.wcm.repository.runtime.CmConfigurationProvider.readConfiguration(CmConfigurationProvider.java:205)
         at com.sapportals.wcm.crt.CrtSystemImpl.createComponentManager(CrtSystemImpl.java:108)
         at com.sapportals.wcm.repository.runtime.CmSystem.startUp(CmSystem.java:202)
         at com.sapportals.wcm.repository.runtime.CmSystem.getInstance(CmSystem.java:164)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResourceImpl(CmAdapter.java:974)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResource(CmAdapter.java:192)
         at com.sapportals.wcm.portal.service.KMServiceImpl.afterInit(KMServiceImpl.java:249)
         at com.sapportals.portal.prt.core.broker.PortalServiceItem.__initServiceInstanceStep2(PortalServiceItem.java:877)
         at com.sapportals.portal.prt.core.broker.PortalServiceItem.startServices(PortalServiceItem.java:1118)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.startLoadOnStartupServices(PortalAppBroker.java:1707)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.start(PortalAppBroker.java:1662)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.startNonCoreApplications(PortalAppBroker.java:1592)
         at com.sapportals.portal.prt.runtime.Portal.init(Portal.java:422)
         at com.sapportals.portal.prt.core.PortalCoreInitializer.coreInit(PortalCoreInitializer.java:54)
         at com.sapportals.portal.prt.dispatcher.PortalInitializer.<init>(PortalInitializer.java:129)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doSetupPortalInitializer.run(Dispatcher.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.initDispatcher(Dispatcher.java:361)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.access$000(Dispatcher.java:42)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$InitRunner.run(Dispatcher.java:114)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.init(Dispatcher.java:394)
         at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.addServlet(WebComponents.java:139)
         at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.loadServlets(ApplicationThreadInitializer.java:386)
         at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.run(ApplicationThreadInitializer.java:110)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    #1.5 #002264F93508005C0000042300002CF00004939AAEE9AEB7#1288192475655#com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager#sap.com/irj#com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager#J2EE_GUEST#0##n/a##c7d00e00e1dc11dfa36d002264f93508#SAPEngine_Application_Thread[impl:3]_29##0#0#Error##Plain###setting initial ACL on /reporting_backend/reports/System Administration/CM Store/cm.crawlcontent - com.sap.security.api.NoSuchRoleException: Role with uniqueName system_admin_role not found!
         at com.sap.security.core.imp.RoleFactory.getRoleByUniqueName(RoleFactory.java:1783)
         at com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager.getRoles(RPRepositoryManager.java:1474)
         at com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager.syncReportResources(RPRepositoryManager.java:1334)
         at com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager.initBackend(RPRepositoryManager.java:489)
         at com.sapportals.wcm.repository.manager.reporting.RPRepositoryManager.getResource(RPRepositoryManager.java:581)
         at com.sapportals.wcm.repository.RMAdapter.getResource(RMAdapter.java:228)
         at com.sapportals.wcm.repository.runtime.CmAdapter.findResource(CmAdapter.java:1349)
         at com.sapportals.wcm.repository.runtime.CmAdapter.findManagerAndResource(CmAdapter.java:1322)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResourceImpl(CmAdapter.java:979)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResource(CmAdapter.java:192)
         at com.sapportals.wcm.service.reporting.ReportingService.localConfigure(ReportingService.java:294)
         at com.sapportals.wcm.service.reporting.ReportingService.startUpImpl(ReportingService.java:74)
         at com.sapportals.wcm.service.AbstractService.start(AbstractService.java:167)
         at com.sapportals.wcm.crt.CrtThreadSafeComponentHandler.tryToStart(CrtThreadSafeComponentHandler.java:247)
         at com.sapportals.wcm.crt.CrtThreadSafeComponentHandler.handleLookup(CrtThreadSafeComponentHandler.java:109)
         at com.sapportals.wcm.crt.CrtComponentManager.lookup(CrtComponentManager.java:322)
         at com.sapportals.wcm.crt.CrtComponentManager.lookupChildComponent(CrtComponentManager.java:403)
         at com.sapportals.wcm.crt.CrtContainerManager.lookupComponent(CrtContainerManager.java:44)
         at com.sapportals.wcm.crt.CrtSystemImpl.lookupComponentByUri(CrtSystemImpl.java:131)
         at com.sapportals.wcm.crt.CrtComponentManager.startUp(CrtComponentManager.java:278)
         at com.sapportals.wcm.crt.CrtSystemImpl.startUpComponentManager(CrtSystemImpl.java:166)
         at com.sapportals.wcm.repository.runtime.CmSystem.startUp(CmSystem.java:227)
         at com.sapportals.wcm.repository.runtime.CmSystem.getInstance(CmSystem.java:164)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResourceImpl(CmAdapter.java:974)
         at com.sapportals.wcm.repository.runtime.CmAdapter.getResource(CmAdapter.java:192)
         at com.sapportals.wcm.portal.service.KMServiceImpl.afterInit(KMServiceImpl.java:249)
         at com.sapportals.portal.prt.core.broker.PortalServiceItem.__initServiceInstanceStep2(PortalServiceItem.java:877)
         at com.sapportals.portal.prt.core.broker.PortalServiceItem.startServices(PortalServiceItem.java:1118)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.startLoadOnStartupServices(PortalAppBroker.java:1707)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.start(PortalAppBroker.java:1662)
         at com.sapportals.portal.prt.core.broker.PortalAppBroker.startNonCoreApplications(PortalAppBroker.java:1592)
         at com.sapportals.portal.prt.runtime.Portal.init(Portal.java:422)
         at com.sapportals.portal.prt.core.PortalCoreInitializer.coreInit(PortalCoreInitializer.java:54)
         at com.sapportals.portal.prt.dispatcher.PortalInitializer.<init>(PortalInitializer.java:129)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doSetupPortalInitializer.run(Dispatcher.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.initDispatcher(Dispatcher.java:361)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.access$000(Dispatcher.java:42)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$InitRunner.run(Dispatcher.java:114)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.init(Dispatcher.java:394)

    Go to visual admin -> server -> services -> JCO RFC provider.
    Check the RFC that connects to the BI Abap.
    Its reporting the J2EE_GUEST user in the SAP with the system nr 00.
    Is this BI java portal?
    Is the java portal a addon to Abap or having seperate SID?
    Check the connection definitions are correct and the gateway is running.

  • JCO.server could not create server function - IDOC_INBOUND_ASYNCHRONOUS

    Hello all.
    On this platform I have found some threads for the above error we get, but unfortunately the solution was not described in detail.
    We get this error in sending Idocs from a SAP 4.7 system to our Business Connector.
    Complete error info is :
    com.sap.mw.jco.JCO$Exception: (120) JCO_: JCO.Server could not create server function 'ä¥u201Eä½u0192å½u2030ä¹u201Aä½u2022ä¹u201E彁åu2122ä¹u0192ä¡u2019'
    com.sap.mw.jco.JCO$Exception: (123) JCO_: Server repository could not create function template 'ä¥u201Eä½u0192å½u2030ä¹u201Aä½u2022ä¹u201E彁åu2122ä¹u0192ä¡u2019' caused by: com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed Connect_PM GWHOST=CPAAQAT.US.CPO.COM, GWSERV=sapgw01, ASHOST=CPAAQAT.US.CPO.COM, SYSNR=01 LOCATION CPIC (TCP/IP) on local host ERROR partner not reached (host 172.20.12.65, service 3301) TIME Fri Jul 15 10:35:58 2011 RELEASE 640 COMPONENT NI (network interface) VERSION 37 RC -10 MODU
    Typically the message gets rolled-back and no sender, receiver or message info in visable in the transaction list.
    Transaction List
    Date    TID    Sender    Receiver    Msg Type    State   Delete
    2011-07-14 08:00:19 BST  AC140C4150524E1E92E80002     Rolled back   
    Who can help us.
    Thanks in advance.
    Marcel

    Hi,
    ä¥u201Eä½u0192å½u2030ä¹u201Aä½u2022ä¹u201E彁åu2122ä¹u0192ä¡
    looks like a character encoding error. Did you check the Unicode, code page at the RFC destination, and related SAP notes?
    Sandra

  • JCO.Server could not find server function "ZVERIFY_FILE"

    Hi Experts,
    I am facing one problem, i have created on TCP/IP connection with connection type T and given it some Program Id.
    I have register this Program id On SRM server.
    Now from this server i want to call one JAVA file, for that purpose i have installed JCO on the server.
    My server file looks like,
    import com.sap.mw.jco.*;
    //import com.tcs.jns.JSignNS;
    //import com.tcs.jns.JSignNSException;
    //import com.tcs.jns.CertDetails;
    // added by paresh on 16.1.2009
    import java.io.FileOutputStream;
    import com.tcs.jie.jverify.JVerify;
    import com.tcs.jie.jsign.JSign;
    public class ds_listener extends JCO.Server {
    Create an instance of my own server
    @param gwhost (gateway host)
    @param gwserv (gateway service number)
    @param progid (program id)
    @param repository (repository used by the server to lookup the definitions of an inc)
         public ds_listener(String gwhost, String gwserv, String progid, boolean isUnicode,  IRepository repository) {
              super("sapdev14", "sapgw01", "DS_RFC", repository);                this.setProperty("jco.server.unicode", isUnicode?"1":"0");
         /** Overrides the default method. */
         static ds_listener serverConnections[] = new ds_listener[1];
         protected void handleRequest(JCO.Function function) {
              JCO.ParameterList input = function.getImportParameterList();
              JCO.ParameterList output = function.getExportParameterList();
              if (function.getName().equals("ZVERIFY_DATA")) {
                   try{
                        JVerify JNS = new JVerify();
                        String dbPath = "/home/admin/FormSigner_23Apr/FormSigner_Release/certdbs";
                        //boolean res = JNS.init (dbPath); // commented by paresh on 16.1.2009 as its obsolute
                        //initialize method has to be called before calling any other method of the API
                        String recdSignature = input.getString("SIGNATURE");
                        boolean ret_update = JNS.updateSignature(recdSignature.getByetes());
                        if (ret_update){
                             int count = JNS.getSignerCount();
                             boolean ret_verify_sign = false;
                             while(count > 0){
                                  ret_verify_sign = JNS.verifySignature(count - 1);
                                  if (ret_verify_sign){
                                       ret_verify_sign = false;
                                       count = count - 1;                                   
                                  }else
                                       break;
                             if (count == 0){
                                  String decoded_data = new String(JNS.getDecodedData());
                                  output.setValue("X", "STATUS");
                                  output.setValue(decoded_data, "DATA");
                             }else{
                                  output.setValue(" ", "STATUS");
                                  output.setValue("Error in Signature Verification. Please check Certificate Validity of every signer.", "DATA");
                   }catch (Exception e1){
                        output.setValue(" ", "STATUS");
                        output.setValue(e1.getMessage(), "DATA");
              }else if(function.getName().equals("ZVERIFY_FILE")) {
                   try{
                        JVerify JNS = new JVerify();
                        String dbPath = "/home/admin/FormSigner_23Apr/FormSigner_Release/certdbs";
                        //boolean res = JNS.init (dbPath);  // commented by paresh on 16.1.2009 as its obsolute
                        //initialize method has to be called before calling any other method of the API
                        String recdSignature = input.getString("SIGNATURE");
                        boolean ret_update = JNS.updateSignature(recdSignature.getBytes());
                        if (ret_update){
                             int count = JNS.getSignerCount();
                             boolean ret_verify_sign = false;
                             while(count > 0){
                                  ret_verify_sign = JNS.verifySignature(count - 1);
                                  if (ret_verify_sign){
                                       ret_verify_sign = false;
                                       count = count - 1;
                                  }else
                                       break;
                             if (count == 0){
                                  output.setValue("X", "STATUS");
                             }else{
                                  output.setValue(" ", "STATUS");
                   }catch (Exception e1){
                        output.setValue(" ", "STATUS");
              }else{
                   return ;
    Start the server
         public static void startServers() {
              JCO.addClientPool("POOL",3,"200","sisldp","paresh1234","EN","sapdev14","01");
              IRepository repository = JCO.createRepository("REP", "POOL");
              for (int i = 0; i < serverConnections.length; i++) {
                   // Server listens for incoming requests from system 1
                   // (Change gateway host, service, and program ID according to your needs)
                   serverConnections<i> = new ds_listener(
                             "sapdev14",//gateway host, often the same as host
                             "sapgw01", //gateway service, generally sapgw+<SYSNR>
                             "DS_RFC", // corresponds to program ID defined in SM59
                             true, // or false for non unicode listener
                             repository);
                   serverConnections<i>.start();
         public static void main(String[] args) {
         startServers();
    The file have no error as i have compiled it on server, its listener file given in JCO with some modification.
    I have tested the connection from SM59 it's working fine,but when i call my any of the 2  function(ZVERIFY_DATA & ZVERIFY_FILE) defined in my java file then i am getting an error "JCO.Server could not find server function 'ZVERIFY_FILE'" on SRM screen.
    Can anyone tell me what can be the reason????
    please help, i am in real trouble.

    Hi,
    This is may be of  the wrong FunctionModule name means check in case also,it may be case sensitive.
    And check whether it is remotely enabled or not and check the RFC destination.
    For more details refer these threads.
    JCO.Server could not find server function 'SET_SLD_DATA'
    JCO.Server could  not find server function
    Problems with sender RFC
    Thanks.

  • RFC call failed: JCO.Server could not find server function 'SET_SLD_DATA'

    Hi, All
    the system is PI 7.0 EHP1 oraclei Win2003 server, I configured SLD but I run RZ70, having error "RFC call failed: JCO.Server could not find server function 'SET_SLD_DATA' ". I know there are lot of tread about this error, but none of themsolve my problem. all JCO, RFC connections and SDL DATA supplier(VA) seem OK. error message in SM21 is "Could not send SLD data"
    detail from SM21
    The system could not send the data that has been collected automatical
    for the System Landscape Directory (SLD). Check whether the gateway
    configured in transaction RZ70 has been started and whether the SLD
    bridge has been registered with this gateway.
    You can use transaction SM59 to check this in the sending system for t
    implemented RFC destinations. The RFC destinations have the standard
    names "SLD_UC" for Unicode sending systems and "SLD_NUC" for non-Unico
    sending systems. If a different RFC destination has been entered in
    RZ70, check this destination instead.
    You can use the Gateway Monitor to check the target gateways. In ABAP
    systems, this monitor is started with transaction SMGW, or you can use
    the external SAP program "gwmon". Check whether the specified gateway
    has an active registration.
    OF COURSE I checked  RFC of  SLD_UC and SMGW
    any different ideas
    Regards
    ABH

    Hi
    Please check the following notes are implemented
    Note 906454                           
    Note 907729
    You may be aware but if you are not --->RZ70 creates the required SLD* RFCs during runtime - therefore if you have defined these RFCs manually first using the same namespace you can get RFC conflicts which result in a failed submission    
    Please also check the user in the RFC is known to both systems and has required authorization to write to SLD
    Generally with SLD you have to install or select a suitable gateway to handle incoming data supply traffic
    Also the gateway you are using has be known to SLD and reflected in RZ70 - i.e these defintions have to be the same
    It is also recommended to delete all references to SLD_* RFCs in data supplier and target SLD
    after a failed submission attempt to allow RZ70 to recreate these consistently once the above has been checked
    Best wishes
    Stuart

  • JCO RFC provider: Server function not found, short dump

    Hi all,
    I'm trying to use the JCO RFC provider service of NW04s (SP15) together with an ABAP 4.6C system. I've followed all the documentation that I could find, but couldn't get it to work yet. This is what I've done so far:
    Using SM59 I've had a destination APP_JK1 created for me on the R/3 system. AFAIK it's set up correctly and marked as a "registered server", connection tests were successful.
    On the portal, I've created a RFC portal destination using my R/3 credentials and successfully tested it. Then I created an entry in the RFC provider service, using the correct values for system, id & gateway, and let it point to my RFC destination for the repository connection. The program ID is also APP_JK1.
    Next, I created a stateless session bean which is part of an EAR, gave it a JNDI name of "RFCTEST" and added a method like this:
        * @ejb.interface-method view-type="both"
        * @param function called function
       public void processFunction(com.sap.mw.jco.JCO.Function function) {
          JCO.ParameterList input  = function.getImportParameterList();
          String query = input.getString("I_STRING_SEARCH");
          JCO.ParameterList output = function.getExportParameterList();
          output.setValue(query, "ECHOTEXT");
    (The project uses xdoclet for the creation of J2EE stuff)
    In application-j2ee-engine.xml located in the META-INF directory of my EAR, I've added:
    <reference reference-type="hard">
         <reference-target provider-name="sap.com" target-type="library">com.sap.mw.jco</reference-target>
    </reference>
    The application deploys without errors, and besides from my RFC connection works as expected. In the JNDI registry view of VisualAdmin I see the corresponding entry: "rfcaccessejb/RFCTEST" is a local reference to my stateless session bean.
    On ABAP, I have a tiny little program that calls my function, mainly looking like this:
    CALL FUNCTION 'RFCTEST' DESTINATION 'APP_JK1'
      EXPORTING
        I_STRING_SEARCH = query
      IMPORTING
        ECHOTEXT = t1.
    Unfortunately, it short dumps immediately. The error message is:
    JCO.Server could not find server function 'RFCTEST'
    I'm lost. What could be wrong? Any help is greatly appreciated. Kind regards,
    Christian Aust

    Hello Perry song,
    You got the short dump bcoz, there is no perform by the name you provided in the program,
    for example. consider there are 2 programs.
    Program 1 :
    REPORT  ZPGM1.
    *Calling a perform SNAME1 , the code of perform is written in ZPGM2.
    perform sname1 IN PROGRAM ZPGM2.
    Program 2 :
    REPORT  ZPGM2.
    perform sname1 .
    Form SNAME1 .
    write : 'Text in form SNAME1' .
    endform.                    " SNAME1
    (here SNAME1 is found and it works perfectly )
    Change in Program 1 :
    REPORT  ZPGM1.
    *Calling perform DELTA ,
    perform DELTA IN PROGRAM ZPGM2 IF FOUND.
    Now the perform statement will search for perform " DELTA " in ZPGM2 , but there is no perform by name DELTA , so here we need to mention the condition " IF FOUND "  , so now by mentioning the condition " IF FOUND " in perform statement ,  if the perform DELTA is not found then it wont go to DUMP.
    If condition " IF FOUND "  is not mentioned in perform statement like
    perform DELTA IN PROGRAM ZPGM2 . ( This gives DUMP )
    just type " IF FOUND " when u r calling a perform from other program ( i guess this will solve the problem ).
    Hope it might be helpfull,
    Regards ,
    Aby
    Edited by: abhi on Nov 6, 2008 10:14 AM

  • Server repository could not create function template for ...

    Hello,
    we are trying to send rfc and idocs from SAP to MII but we always get errors like:
    Server repository could not create function template ...
    or
    The meta data for the IDoc type "HRCC1DNPERSO01" is unavailable.
    Has anyone an idea?
    Kind Regards,
    Christoph Mertins

    Hi Christoph,
    Per the resolution of the CSS Ticket:
    Parameters that are not mentioned in the SDN guide were needed in your particular situation.
    The necessary parameters for configuring the MII side of the IDoc Listener are explained in the MII Help Documentation in the Client Properties section:
    http://help.sap.com/saphelp_xmii120/helpdata/en/45/a705b23c14532ae10000000a1553f7/content.htm
    All others are described in the Message Listeners section here:
    http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm
    Can you please update this post to reflect your particular situation so the SDN community can benefit from your experience?
    Kind Regards,
    Diana Hoppe
    Edited by: Diana Hoppe on Dec 9, 2008 9:06 AM

  • JCO.SERVER could not find the server function

    Hi,
    I am calling "BAPI_COMPANY_GETDETAIL".thuough the zprogram"ZBAPI_COMPANY_GETDETAIL"
    REPORT ZBAPI_COMPANY_GETDETAIL.
    DATA:BEGIN OF ITAB,
    RCOMP LIKE T880-RCOMP,
    END OF ITAB.
    ITAB-RCOMP = 99999.
    CALL FUNCTION 'BAPI_COMPANY_GETDETAIL'
    EXPORTING
    COMPANYID = ITAB.
    IMPORTING
    COMPANY_DETAIL =
    RETURN =
    The Details I Gave......
    In SM59 of R/3:
    PROGRAMID:LCRSAPRFC_PIT
    GATEWAYHOST:PITEST
    GATEWAYSERVICE:sapgw01
    Tested the connection and it is running
    ID:
    In Communication Channel.
    Application server (Gateway):PITEST
    Application server Service (Gateway):
    PROGRAMID:LCRSAPRFC_PIT
    RFC Metadata Repository parameter.
    ip of XI Server
    System No Xi System NO
    username
    pwd
    In SM58 I find the Following error.
    "JCO.SERVER could not find the server function BAPI_COMPANY_GETDETAIL.
    I Tested RFC ADAPTOR in  RWG and it is ok.
    I do not Understand where the problem is.
    Please clarify.
    Thanks,
    Srinivasa

    Thanks for the reply,
    Yes RFC is in the Sender  side.
    I am calling "BAPI_COMPANY_GETDETAIL".thuough the zprogram"ZBAPI_COMPANY_GETDETAIL"
    REPORT ZBAPI_COMPANY_GETDETAIL.
    DATA:BEGIN OF ITAB,
    RCOMP LIKE T880-RCOMP,
    END OF ITAB.
    ITAB-RCOMP = 99999.
    CALL FUNCTION 'BAPI_COMPANY_GETDETAIL'
    EXPORTING
    COMPANYID = ITAB.
    IMPORTING
    COMPANY_DETAIL =
    RETURN =
    The Details I Gave......
    In SM59 of R/3:
    PROGRAMID:LCRSAPRFC_PIT
    GATEWAYHOST:PITEST(XI system name)
    GATEWAYSERVICE:sapgw01
    Tested the connection and it is running
    ID:
    In Communication Channel.
    Application server (Gateway):PITEST(XI system name)
    Application server Service (Gateway):
    PROGRAMID:LCRSAPRFC_PIT
    RFC Metadata Repository parameter.
    ip of XI Server
    System No Xi System NO
    username
    pwd
    In SM58 I find the Following error.
    "JCO.SERVER could not find the server function BAPI_COMPANY_GETDETAIL.
    I Tested RFC ADAPTOR in RWG and it is ok.
    I do not Understand where the problem is.
    These is what I gave,

  • JCO.Server could not find server function 'CONTROL_RECIPE_AVAILABLE'

    Hi Experts,
    I've been trying to read some of the topics in the forums to find answers about the error JCO.Server could not find server function but still haven't resolve the issue.
    Basically, the scenario is from SAP r/3 to PI 7.1 ehp1 (process integration) system.
    All of the aforementioned steps we're done.
    R/3 (SAP) end
    1.) Create RFC destination (T)
    2. ) Indicate the program ID
    3.) Indicate the server/hostname
    4.) Indicate the sap gateway
    Test connection was made and it was successful.
    SAP PI end.
    Integration Directory (Let me skip from the basics and state directly the setup of my senderRFC)
    1.) RFC Comm Channel (set as Sender)
    2.) Indicated the server hostname (sending system), sap gateway and Program ID (basically what was indicated in RFC setup in SAP end)
    3.) RFC Metadata Repository Parameters (In here I used the details of PI environment)..Created user with SAP_ALL profile..I used system without Load Balancing (Parameter, AppServer, SysNo, Logon User, Logon Password, Language and Client)
    I was able to test a message from SAP end but still "JCO.Server could not find server function" was the result upon checking sm58.
    Did I miss something from my setup and config?

    Hi Michal,
    I guess there's a big difference with RFC Server Parameters and with RFC Metadata Repository Parameters.
    Note: Im using PI 7.1 ehp1
    For RFC Server Parameters it includes:
    - Application Server (gateway)*
    - Application Server Service (gateway)*
    - Program ID*
    For RFC Metadata Repository Parameters it includes:
    - Load Balancing or no Load Balancing (choices)..in here my choice is no Load Balancing
    - Application Server*
    - System No*
    - Logon Language*
    - Logon Client*
    - Authentication Mode (Use Log-on Data for SAP System or Secure Network Connection for RFC)
    if Use Log-on Data for SAP System it includes:
    - Logon User*
    - Logon Password*
    If Secure Network Connection for RFC it includes:
    - Quality of Protection
    - SNC Partner Name
    Looked onto your blogs mentioned several times, but no information on RFC Metadata Repository Parameters.

  • Server repository could not create function template for 'ZBAPI_EXPORT_SO

    Hi all,
    When i try to post a BAPI from R3 to XI i am getting this error.
    Server repository could not create function template for 'ZBAPI_EXPORT_SO
    This message was appeared in SM58.
    Can anyone no the root cause of this ?

    Hi Christoph,
    Per the resolution of the CSS Ticket:
    Parameters that are not mentioned in the SDN guide were needed in your particular situation.
    The necessary parameters for configuring the MII side of the IDoc Listener are explained in the MII Help Documentation in the Client Properties section:
    http://help.sap.com/saphelp_xmii120/helpdata/en/45/a705b23c14532ae10000000a1553f7/content.htm
    All others are described in the Message Listeners section here:
    http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm
    Can you please update this post to reflect your particular situation so the SDN community can benefit from your experience?
    Kind Regards,
    Diana Hoppe
    Edited by: Diana Hoppe on Dec 9, 2008 9:06 AM

  • SAP IGS: JCO.Server could not find server function 'PIGFARMDATA'

    dEAR ALL,
    Operating System: aix6.0
    Database: Oracle 11g
    IGS is not getting started.
    SM59--IGS_RFC_DEST--CONNECTION TEST is fine
    sigs-- IGS_RFC_DEST-- Error is generating " JCO.Server could not find server function 'PIGFARMDATA' ".
    Tried starting IGS USING the below command:
    /usr/sap/KBQ/DVEBMGS01/exe/igswd_mt -mode=profile pf=/usr/sap/KBQ/SYS/profile/KBL_DVEBMGS01_<Hostname>
    Startup using profile
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 1/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40180) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40100) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40101) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40102) [nixxi.cpp    3735]
    kbqadm>  sapcontrol -nr 01 -function GetProcessList
    22.07.2014 16:36:48
    GetProcessList
    OK
    name, description, dispstatus, textstatus, starttime, elapsedtime, pid
    msg_server, MessageServer, GREEN, Running, 2014 07 22 16:33:57, 0:02:51, 8847548
    disp+work, Dispatcher, GREEN  Running, Message Server connection ok, Dialog Queue time: 0.00 sec, AS Java: ALL processes running, 2014 07 22 16:33:57, 0:02:51, 12976352
    rslgcoll, Central Syslog Collector, GREEN, Running, 2014 07 22 16:33:58, 0:02:50, 9175214
    rslgsend, Central Syslog Sender, GREEN, Running, 2014 07 22 16:33:58, 0:02:50, 8585278
    DVEBMGS01\exe\ig.sapKBQ_DVEBMGS01, , GRAY, Stopped, , , 13566036
    ps -ef | grep igs--all igs process are running
    HTTP://<HOSTNAME>:40180---sap igs IS RUNNING
    IGS Logs: ( /usr/sap/KBQ/DVEBMGS01/igs/log)
    trace File  pw_sapbwqa_1.trc
    [Portwatcher::Ping] Ping was unsuccessful 3 times
    [Portwatcher::Ping] Reconnect Portwatcher
    Tue Jul 22 16:54:11 2014
    [Portwatcher::Ping] Ping was unsuccessful 1 times
    Tue Jul 22 16:54:41 2014
    [Portwatcher::Ping] Ping was unsuccessful 2 times
    igs vERSION IS Internet Graphics Service 7200.0.7.0
    "mux_sapbwqa.trc---tRACE File
    Tue Jul 22 16:29:13 2014
    *** ERROR => [ListenerRfc::Loop] RfcListenAndDispatch() (IGS.KBQ sapbwqa sapgw01) returned error: RFC_INVALID_HANDLE [listenerrfc_ 1039]
    *** ERROR => [ListenerRfc::OpenRfc] RfcRegisterServer() returned RFC_COMMUNICATION_FAILURE /
    ERROR       partner 'sapbwqa:sapgw01' not reached
    TIME        Tue Jul 22 16:29:13 2014
    RELEASE     720
    COMPONENT   NI (network interface)
    VERSION     40
    RC          -10
    MODULE      nixxi.cpp
    LINE        2896
    DETAIL      NiPConnect: 10.10.90.150:3301
    SYSTEM CALL connect
    ERRNO       79
    ERRNO TEXT  Connection refused
    COUNTER     18
    [listenerrfc_ 948]
    *** ERROR => [ListenerRfc::Loop] OpenRfc() (IGS.KBQ sapbwqa sapgw01) returned RFC_COMMUNICATION_FAILURE
    Still trying... [listenerrfc_ 1007]
    Tue Jul 22 16:30:13 2014
    *** ERROR => [ListenerRfc::Loop] RfcListenAndDispatch() (IGS.KBQ sapbwqa sapgw01) returned error: RFC_INVALID_HANDLE [listenerrfc_ 1039]
    trc file: "mux_sapbwqa.trc", trc level: 1, release: "720"
    Tue Jul 22 16:39:40 2014
    [IgsMux::Initialize] Internet Graphics Service 7200.0.7.1
    [IgsMux::Initialize] Platform: IBM RS/6000 with AIX (rs6000_64)
    [ListenerRfc::ListenerRfc] Constructed for R/3 NA
    [ListenerHttp::ListenerHttp] Constructed for port 40180
    *** ERROR => [ListenerHttp::Loop] NiListen on port 40180 failed [listenerhttp 703]
    [ListenerHttp::~ListenerHttp] Destroyed for port 40180
    [Multiplexer::StartUp]
    *** ERROR => [ServerTcpIp::NiServerLoop] Caught a NetError: [NetError] [NiBufListen failed] [ServerTcpIp::NiServerLoop()] [-4]. [servertcpip_ 254]
    can you please tel the reason why the IGS is not working
    Regards
    gayathri.K

    Hi Gayathri,
    Startup using profile
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 1/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40180) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40100) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40101) [nixxi.cpp    3735]
    ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use) [nixxi.cpp 3735]
    *** ERROR => NiIBindSocket: SiBind failed for hdl 2/sock 5
        (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:40102) [nixxi.cpp    3735]
    Just check the process which is using the port
    netstat -tupan|grep 40180
    With Regards
    Ashutosh

  • Error RFC sender scenario :JCO.Server could not find server function

    Hi ,
    The scenario which am working is as follows:
    I already have a report in R/3 that calls a Bapi which is in CRM system, now I want to make this point-point connection through XI(RFC sender-XI-RFC Reciever) with out changing the report (only changing the RFC destination).
    I have imported the bapi from CRM to XI , changed the rfc destination(to tcp/ip) that existed in R/3 to point to XI(test connection is working fine) and also created the RFC sender adapter .
    Now on executing the report am getting the following error.
    “JCO.Server could not find server function” 
    Please, let me know where I went wrong.
    Should the function module exists on the XI server. If the functional module is not there then I am getting the  error if the function module is there in XI then every thing is working fine.

    Hi Michal ,
    Now my scenario is working . The error <b>"JCO.Server counld not find server function"</b>  got fixed by giving the system details that contain the RFC in the adapter metadata parameters in the channel configuration.
    Thanks & Regards,
    Srikanth.

  • JCo server programming, properties and connection settings

    Greetings, SAP professionals.
    The reason I come to this forum is that I'm hoping to gain some insights into the use of the SAP Java Connector (JCo). I am a developer who was tasked with making a new component for a systems integration application. As is typical of integration software, our app can link together various different systems using a variety of protocols, as well as providing the means to apply business logic on messages passed from one location to another. We already have a connector acting as an SAP client which was implemented using JCo. Now, we were asked to develop a new component: a server capable of accepting RFCs from a remote SAP system acting as client. The server is to be created using the JCo classes, so basically an extension of JCo.Server, with some logic for creating function templates from configuration files.
    However, while I'm understanding the structure of the Java API, it's not entirely clear to me just what the classes do. I've found the JavaDoc for JCo to be mostly descriptive of the interface of classes and methods, but not really explaining what these achieve, or how. So I'm hoping to be set straight, as I fear I'm kind of misunderstanding the functionality of JCo... Being mainly an integrations developer, I unfortunately often have to settle for gaining a superficial knowledge of a variety of systems to quickly interface with them, so I don't have any prior knowledge of SAP but still need to be able to implement something with JCo without too much delay.
    The most important question I have is this: when a JCO.Server implementation is started, does it act as a fully standalone component capable of receiving calls, or does it merely act as a sort of listener for some main SAP system? I'm not talking about a reliability on the two .dll files (or .so for Linux) that are required for the use of JCo, I just wish to know if the JCo package is entirely self-sufficient for server functionality or if it is intended to be linked to some SAP system.
    A second problem I have is that the parameters passed to various constructors aren't clear to me... I'm not familiar with SAP terminology, nor have I worked with any client apps that make use of an SAP system.
    The meaning of client strings, gwhost, gwservice, ashost, system IDs and program IDs mostly elude me, especially when it comes to knowing what client parameters must match what server parameters.
    In order to familiarize myself with the classes, I've tried playing around with them a bit trying to create a small test app that first starts a JCO.Server instance, then tries to make a remote function call to it with a JCO.Client (within the same class, for simplicity and debugging purposes). I was wondering if this actually makes sense... Would a JCo client be capable of connecting to a JCo server, all running purely in Java, or is that nonsense?
    To eliminate some common troubleshooting options, I'll quicly describe the steps I've taken:
    Both librfc32.dll and sapjcorfc.dll were placed in the Windows system32 folder. Maybe only librfd32 needs to be placed there, but I copied both anyway to make sure.
    The directory containing the jar file and both dll files is included in my environment path variable.
    I've added a line to the C:\Windows\system32\drivers\etc\services file as follows:
    sapgw00          3300/tcp                           #SAP System Gateway Port
    I've opened port 3300 in my Windows firewall. In fact, I also tested with the firewall completely turned off.
    However, I do not manage to get my test class to work. I've tried ports 3300, 3200 and 3600. I've tried various permutations of the client and server properties. I've tried removing the line from the services file, which would prompt the client to state upon connecting that the service "sapgw00" is unknown. When I add it back in, the error changes to "partner not reached", so it is definitely picking something up.
    The server itself starts just fine, but connecting through a client doesn't work. My class source code is posted below. Maybe what I'm trying to do doesn't make any sense, but at the moment it's my best guess.
    I realize this is a pretty long post and the class, while not exactly big, also implies a bit of reading of its own. But if anyone could give me any answers that are new to me, I'd be hugely grateful. Right now I'm kind of stuck, and just setting up the service and letting our customer test on it is a somewhat slow approach that can't match developing and testing on one and the same host.
    Preliminary thanks to everyone who took the effort to read this.
    //Start of code
    import java.util.Properties;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.IMetaData;
    import com.sap.mw.jco.IRepository;
    import com.sap.mw.jco.JCO;
    public class Test {
         public static void main(String[] args) {
              Test test = new Test();
              ServerThread serverThread = test.new ServerThread();
              serverThread.start();
              while(!serverThread.isReady) {
                   try {
                        Thread.sleep(5000);
                   } catch(final InterruptedException i) {
                        System.out.println("Rudely awakened");
              try {
    //               JCO.Function func = getSampleFunction(test, "STAY");
    //               serverThread.server.handleRequest(func);
    //               System.out.println(func.getExportParameterList().toXML());
    //               func = getSampleFunction(test, "STOP");
    //               serverThread.server.handleRequest(func);
    //               System.out.println(func.getExportParameterList().toXML());
                   final Properties clientProps = getClientProps();
                   JCO.Client client = JCO.createClient(clientProps);
                   client.connect();
                   IRepository rep = JCO.createRepository("1", client);
                   IFunctionTemplate templ = rep.getFunctionTemplate("TEST_FUNC");
                   JCO.Function function = templ.getFunction();
                   function.getImportParameterList().setValue("STAY", "FIELD1");
                   client.execute(function);
                   JCO.Function function2 = templ.getFunction();
                   function2.getImportParameterList().setValue("STOP", "FIELD1");
                   client.execute(function2);
              } catch(final Exception e) {
                   e.printStackTrace(System.out);
                   serverThread.requestStop();
                   while(serverThread.isAlive) {
                        try {
                             Thread.sleep(5000);
                        } catch(final InterruptedException i) {
                             System.out.println("Rudely awakened");
              } finally {
         private static Properties getClientProps() {
              final Properties props = new Properties();
              props.setProperty("jco.client.client", "100");
              props.setProperty("jco.client.user", "");
              props.setProperty("jco.client.passwd", "");
              props.setProperty("jco.client.lang", "");
              props.setProperty("jco.client.sysnr", "00");
              props.setProperty("jco.client.ashost", "/H/localhost/S/sapgw00");
              props.setProperty("jco.client.gwhost", "localhost");
              props.setProperty("jco.client.gwserv", "sapgw00");
              return props;
         public class ServerThread extends Thread {
              public void run() {
                   isAlive = true;
                   IRepository repos = new TestRepository("testrep");
                   repos.addFunctionInterfaceToCache(getFunctionInterface());
                   server = new TestServer(repos);
                   server.start();
                   System.out.println("Server successfully started");
                   isReady = true;
                   while(!stop) {
                        try {
                             Thread.sleep(1000);
                        } catch(final InterruptedException i) {
                             System.out.println("Wouldn't let me sleep...");
                        stop = server.stopRequested;
                   server.stop();
                   isAlive = false;
                   System.out.println("Server successfully stopped");
              public void requestStop() {
                   server.requestStop();
              public TestServer server;
              public boolean isReady = false;
              public boolean isAlive = false;
         public class TestServer extends JCO.Server {
              public TestServer(IRepository rep) {
                   super("localhost", "sapgw00", "PROGID", rep);
              public void handleRequest(JCO.Function fct) {
                   try {
                        JCO.ParameterList importParams = fct.getImportParameterList();
                        final String importXML = importParams.toXML();
                        System.out.println("XML representation of import parameters: ");
                        System.out.println(importXML);
                        final String input = importParams.getString("FIELD1");
                        System.out.println("FIELD1 value: " + input);
                        JCO.ParameterList exportParams = fct.getExportParameterList();
                        if(input.equals("STOP")) {
                             exportParams.getField("FIELD2").setValue("OK");
                             stopRequested = true;
                   catch(JCO.AbapException ex) {
                        throw ex;
                   catch(Throwable t) {
                        throw new JCO.AbapException("SYSTEM_FAILURE", t.getMessage());
              public boolean checkAuthorization(String functionName, int authorMode, String partner, byte[] key) {
                   System.out.println(functionName + " " + partner);
                   return true;
              public void requestStop() {
                   stopRequested = true;
              public boolean stopRequested = false;
         public class TestRepository extends JCO.BasicRepository implements IRepository {
              public TestRepository(String name) {
                   super(name);
         public static IMetaData getFunctionInterface() {
              JCO.MetaData metaData = new JCO.MetaData("TEST_FUNC");
              metaData.addInfo("FIELD1", IMetaData.TYPE_STRING, 4);
              metaData.setFlags(0, IMetaData.IMPORT_PARAMETER);
              metaData.addInfo("FIELDX", IMetaData.TYPE_STRING, 8);
              metaData.setFlags(1, IMetaData.IMPORT_PARAMETER & IMetaData.OPTIONAL_PARAMETER);
              metaData.addInfo("FIELD2", IMetaData.TYPE_STRING, 2);
              metaData.setFlags(2, IMetaData.EXPORT_PARAMETER);
              return metaData;
         public static JCO.Function getSampleFunction(Test test, String s) {
              TestRepository testRep = test.new TestRepository("testrepository");
              testRep.addFunctionInterfaceToCache(getFunctionInterface());
              JCO.Function func = testRep.getFunctionTemplate("TEST_FUNC").getFunction();
              func.getImportParameterList().setValue(s, "FIELD1");
              return func;
         private static boolean stop = false;

    If I understood you correctly, you want to provide a "service" that can be called from SAP. To provide this service you've chosen to implement an (external) RFC server program via JCo. One common method for RFC server programs is to register in SAP on the gateway - you do this by supplying the three parameters
    <ol>
    <li><b>jco.server.gwhost</b> -  SAP gateway host on which the server should be registered (so this would be the server name or IP address of the SAP gateway; localhost is only correct, if your RFC server program runs on the same server as the SAP gateway)</li>
    <li><b>jco.server.gwserv</b>  - Gateway service, i.e. the port on which a registration can be done</li>
    <li><b>jco.server.progid</b> - Program ID under which your RFC server program can be reached (free, made-up case sensitive name, that should represent the service your RFC server is providing)</li>
    </ol>
    So essentially you're creating a listener, that is registered in SAP and waits for any invocations. Within SAP they will define a <i>RFC destination</i>, which basically represents a TCP/IP connection pointing to the SAP gateway where you registered with the given program ID. If you want more details, check the SAP help pages for <a target="_blank" href="http://help.sap.com/saphelp_nw04/helpdata/en/22/04262b488911d189490000e829fbbd/content.htm">RFC destinations</a> (you're looking for destination type <b>T</b>, see explanations <a target="_blank" href="http://help.sap.com/saphelp_nw04/helpdata/en/22/042652488911d189490000e829fbbd/content.htm">here</a>).
    Usually gateway host and service (port) are given to you by the SAP basis folks and you tell them which program ID you're using. They will then enter those parameters in an RFC destination of type <b>T</b> in SAP. So no need for any of the client parameters you've mentioned. Although, I'd like to repeat, it's usually handy to also have SAP logon parameters maintained on your RFC server program, so that you can utilize the repository data from SAP (might be irrelevant in your case).
    Hope this clarifies it a bit...

  • JCO.Server appends null character to string

    I am a complete SAP and JCO newbie so I'll try making as much since as I can, given the fact that I'm not familiar with SAP terminology and technology. I've been lent as a developer to another group which needs a legacy application rewritten. The application processes a RFC and decrypts the RFC encrypted payload and returns it along with a status code.
    I have made progress - I'm able to register my server with the SAP runtime and using the SAP GUI application and the help of a SAP developer, I'm able to make an RFC call to my application. I'm able to read the parameters sent from SAP and write parameters back.
    The problem is that one of the parameters I'm writing back (java.lang.String) appears to have and extra character on SAP side. On the GUI it appears as a '#' (pound) sign. The SAP developer told me the string is terminated with a null character which I know is a C/C++ thing but not a Java thing. I don't think it is a Unicode issue. The Java server is not running in Unicode mode and any attempt to set the jco.server.unicode property (I may have forgotten the exact name) to a value of 1 causes the RFC to fail.
    I think the issue is likely to be the manner in which I defined the function parameters or the manner in which I write them. The following are code snippets:
    Defining the function:
    JCO.MetaData metadata = new JCO.MetaData(Constants.FUNCTION_DECRYPT);
    metadata.addInfo(Constants.PARAMETER_SCHEME,      JCO.TYPE_INT,    255,   0,  0, JCO.IMPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_ENCRYPTED,   JCO.TYPE_STRING, 255,   0,  0, JCO.IMPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_DECRYPTED,   JCO.TYPE_STRING, 255,   0,  0, JCO.EXPORT_PARAMETER, null);
    metadata.addInfo(Constants.PARAMETER_RETURN_CODE, JCO.TYPE_INT,    255,   0,  0, JCO.EXPORT_PARAMETER, null);
    Server request handling code:
    protected void handleRequest(JCO.Function function)
                    // Obtaining import/export parameter lists.
                    JCO.ParameterList input  = function.getImportParameterList();
                    JCO.ParameterList output = function.getExportParameterList();
                    // Getting scheme and encrypted text parameters.
                    int scheme       = input.getInt(Constants.PARAMETER_SCHEME);
                    String encrypted = input.getString(Constants.PARAMETER_ENCRYPTED);
                    // Decoding base 64 string.
                    byte[] bytes = Base64.decode(encrypted);
                    // Obtaining cipher by scheme and decrypting the text.
                    AppCipher cipher = ApplicationConfiguration.getDecryptor(scheme);
                    if(cipher == null)
                                    logger.error("Unable to get cipher due to an unknown encryption scheme: " + scheme);
                    else
                                    byte[] decrypted = cipher.decrypt(bytes);
                                    String plainText = new String(decrypted);
                                    // Setting decrypted value information and return code.
                                    output.setValue(plainText, Constants.PARAMETER_DECRYPTED);
                                    output.setValue(Constants.RETURN_CODE_SUCCESS, Constants.PARAMETER_RETURN_CODE);

    I seem to have made progress. If I define the parameter type as JCO.TYPE_CHAR instead of JCO.TYPE_STRING, it works:
    metadata.addInfo(Constants.PARAMETER_DECRYPTED,   JCO.TYPE_CHAR,   255,   0,  0, JCO.EXPORT_PARAMETER, null);
    That is the only change I made. I'm still setting the parameter value as java.lang.String. I hope this won't cause issues elsewhere. I was also able to change the field definition and set it as a byte array. However, that had the problem of having to define the exact length of the byte array in the field metadata otherwise the remaining bytes would appear as null bytes on SAP side.

  • Problem in getting the function template object from the repository.

    Hi all,
    I have created a par file. I have a JCO connection in that. I am facing problems in getting the function template object from the repository. This thing is running successfully when i try to deploy it in Tomcat. But i am facing problems when i try to deploy it in SAP EP 6.0.
    Below is statement which is giving error after being deployed to SAP EP6.
    This is executing fine when executed in Tomcat Server.
    // getting the object of function template
    IFunctionTemplate functionTemplate =
    aRepository.getFunctionTemplate("YADDNEWUSER");
    Note : YADDNEWUSER is the name of the RFC which I am calling from my JAVA Code.
    Thanks in advance,
    Divija

    This sounds like a bug in the smart upload code. I have used this stuff before, but it's probably an older version, so maybe they broke something. Enumerations aren't usually guaranteed to keep things in any particular order. I would say for now, make a method to take the enumeration and a param name to find the value. And write to the JSPSmart people.

Maybe you are looking for

  • FDF Toolkit and pdf conversion

    yes, this is a newbie question...sorry if the answer is obvious. I am trying to design a form solution for my employer, and through some investigation have been given access to, and downloaded the FDF toolkit for Java from Adobe. The good news is the

  • Can i transfer music from ipod back to pc after hard drive scrubbed?

    i have a lot of music loaded. but our hard drive was scrubbed and the library from which this music came was erased. i re-installed itunes, and at first looked for a way to transfer the music from the ipod back onto the computer. couldn't figure that

  • Flagged photos in iPhoto not showing up in iMovie

    I recently updated both imovie and iphoto.  I have several flagged photos in iphoto.  I am working in imovie to create a movie.  When I cleck the camera on the lower right to import photos into imovie, I see all my photos.  However, I don't see an op

  • Domain not found........!

    After a unexpected resatrt, my i web no longer opens. I get a message saying 'Domain not found' I reloaded my applications bundle, still the same problem. I tried to load the domain file directly from the library, also the same problem............. P

  • Need help converting a document to pdf

    I have an active account and want to convert a word document to pdf but can't because I received a message to contact support.  How can I get in contact with a live person?