Using Java Connector Calling RFC.....But it's not returning correct result

Hi Friends,
In the code ....
I am calling Remote Function module ZRFC_PO_VEND_VALID using java connector and passing PO_Number and Vendor Number as input parameters and after execution it returns (E_POVALID =1 [PO_NUMBER exists for Vendor number] otherwise E_POVALID = 0 )
when i am executing the below code ....in both cases it is returning Zero value.
I tested the function module in se37 its working....
may i know the reason for this....
import com.sap.mw.jco.*;
@author Thomas G. Schuessler, ARAsoft GmbH
http://www.arasoft.de
public class TutorialBapi1 extends Object {
JCO.Client mConnection;
JCO.Repository mRepository;
public TutorialBapi1() {
try {
// Change the logon information to your own system/user
mConnection =
JCO.createClient("100", // SAP client
"abap", // userid
"abap", // password
"en", // language
"sapdev1", // application server host name
"00"); // system number
mConnection.connect();
mRepository = new JCO.Repository("ARAsoft", mConnection);
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("ZRFC_PO_VEND_VALID");
if (function == null) {
System.out.println("ZRFC_PO_VEND_VALID" +
" not found in SAP.");
System.exit(1);
//mConnection.execute(function);
JCO.Field vendID = function.getImportParameterList().getField("I_EBELN");
JCO.Field poID = function.getImportParameterList().getField("I_LIFNR");
vendID.setValue("20081");
poID.setValue("4500000017");
try {
mConnection.execute(function);
catch (Exception ex) {
     ex.printStackTrace();
     System.exit(1);
JCO.Field povalid =
     function.getExportParameterList().getField("E_POVALID");
//if (povalid.getValue() == null ){
     // System.out.println("Error Message");
System.out.println(povalid.getValue());
     //if (povalid == null ){
          //System.out.println(povalid.getValue("E_POVALID"));
          //System.out.println("Error Message");
          //System.exit(1);
catch (Exception ex) {
     ex.printStackTrace();
     System.exit(1);
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.");
     public static void main (String args[]) {
     TutorialBapi1 app = new TutorialBapi1();
with warm regards,
Madhu.

Hi Ravi ,
I tried as per your sugggestion..still getting the same problem.
Regards,
Madhu!!

Similar Messages

  • To access a particular website , I need to use Java 6 u 37, but Firefox will not allow me to enable it since it is outdated. How can I do it?

    I have downloaded Java 6 update 37, but Firefox does not recognize it as a valid plug-in, and so will not even give me the option of enabling it. Is there any workaround for this?

    Firefox is a 32 bit application, so make sure that you've installed the 32 bit Java program and that Firefox can find its plugins.

  • IPTObjectManager.Query not returning correct result (Java)

    Hi,
    I am having a problem with the IPTObjectManager.Query method. The code is given below. The issue I am having is, that when I search for a community in a specific folder not results are returned. However if I search in all folders (using -1 as the second parameter to the method) it returns multiple communities including the one I need. Anyone else had the same issue with this??
    // THIS CODE WORKS AND RETURN MULTIPLE COMMUNITIES
    // THE hotelCode VARIABLE IS A STRING VARIABLE CONTAINING A VALUE
    // WHICH IS THE COMMUNITY NAME.
    // Create a ObjectManager object
    IPTObjectManager objectManager = session.GetObjectManagers(ObjectClass.Community.toInteger());
    // define the query based on the passed string
    Object[][] vQueryFilter = {
         new Object[]{new Integer(PT_PROPIDS.PT_PROPID_NAME)},
         new Object[]{new Integer(PT_FILTEROPS.PT_FILTEROP_CONTAINS)},
         new Object[]{hotelCode}};
    // Run the query and return results
    IPTQueryResult ptQueryResult = objectManager.Query(
         PT_PROPIDS.PT_PROPID_ALL, -1, PT_PROPIDS.PT_PROPID_NAME, 0, -1, vQueryFilter);
    // THIS CODE DOES NOT WORK. I AM PASSING IS THE FOLDER ID OF THE
    // FOLDER WHICH CONTAINS THE COMMUNITY
    // Create a ObjectManager object
    IPTObjectManager objectManager = session.GetObjectManagers(ObjectClass.Community.toInteger());
    // define the query based on the passed string
    Object[][] vQueryFilter = {
         new Object[]{new Integer(PT_PROPIDS.PT_PROPID_NAME)},
         new Object[]{new Integer(PT_FILTEROPS.PT_FILTEROP_CONTAINS)},
         new Object[]{hotelCode}};
    // Run the query and return results
    IPTQueryResult ptQueryResult = objectManager.Query(
         PT_PROPIDS.PT_PROPID_ALL, 303, PT_PROPIDS.PT_PROPID_NAME, 0, -1, vQueryFilter);

    I don't know about G6, however in version 5 there does not appear an easy way of doing it. I guess the "easiest" way would be to query sub-folders first, build and array of their ids, and then query for communities in those folders. This is using server API. Something like this (.NET):
    publicvoidGetFolderCommunities(intfolderId){    IPTAdminFolder folder =this.session.GetAdminCatalog().OpenAdminFolder(folderId, false);    IPTQueryResult qr =folder.QuerySubfolders(PT_PROPIDS.PT_PROPID_ALL, [b]1, null, 0, -1, newobject[][] {             newobject[] { PT_PROPIDS.PT_PROPID_FOLDER_FOLDERTYPE }, newobject[] { PT_FILTEROPS.PT_FILTEROP_EQ } , newobject[] { PT_ADMIN_FOLDER_TYPES.PT_ADMIN_FOLDER_TYPE_COMMUNITYFOLDER } } ); int[] folderIds =newint[qr.RowCount()]; Console.WriteLine("------ sub-folders for communities -------"); for(inti =0; i <qr.RowCount(); i++) {        intobjectId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_OBJECTID);        stringobjectName =qr.ItemAsString(i, PT_PROPIDS.PT_PROPID_NAME);        intparentFolderId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_FOLDER_PARENTFOLDERID);        folderIds[i] =objectId; Console.WriteLine("{0}: {1}; parent: {2}", objectId, objectName, parentFolderId); } qr =this.session.GetCommunities().Query( PT_PROPIDS.PT_PROPID_ALL, -1, (object) null, 0, -1, newobject[][] {            newobject[] { PT_PROPIDS.PT_PROPID_FOLDERID }, newobject[] { PT_FILTEROPS.PT_FILTEROP_IN } , newobject[] { folderIds } } ); Console.WriteLine("------ communities from sub-folders -------"); for(inti =0; i <qr.RowCount(); i++) {        intobjectId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_OBJECTID);        stringobjectName =qr.ItemAsString(i, PT_PROPIDS.PT_PROPID_NAME);        int parentFolderId =qr.ItemAsInt(i, PT_PROPIDS.PT_PROPID_FOLDERID);        Console.WriteLine("{0}: {1}; folder: {2}", objectId, objectName, parentFolderId); }}
    Or you could use EDK RPC search. Again, in .NET:
    publicvoidSearchForCommunities(intfolderId){ IPortalSearchRequest searchRequest =this.ptSession.GetSearchFactory().CreatePortalSearchRequest(); searchRequest.SetObjectTypesToSearch(newObjectClass[] { ObjectClass.Community }); searchRequest.SetDocFoldersToSearch(newint[] {}, true); searchRequest.SetAdminFoldersToSearch(newint[] { folderId}, true); searchRequest.SetResultsCount(0, 100); searchRequest.SetResultsOrderBy(PortalField.OBJECT_ID); searchRequest.SetFieldsToReturn(newPlumtreeField[] {}); searchRequest.SetQuery("*"); ISearchResponse searchResponse =searchRequest.Execute(); intreturnedMatches =searchResponse.GetReturnedCount(); ISearchResultSet resultSet =searchResponse.GetResultSet(); IEnumerator enumerator =resultSet.GetResults(); while(enumerator.MoveNext()) { ISearchResult result =(ISearchResult) enumerator.Current; Console.WriteLine( result.GetFieldAsInt(PortalField.OBJECT_ID) +": "+ result.GetFieldAsString(PlumtreeField.NAME) ); }}
    Ruslan.

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • Exception when using jco to call rfc

    Hi All,
        When I used JCO to call rfc 'RFC_GET_TABLE_ENTRIES' to get the records of the table 'MARC'. I met the following Exception, it seems that there are too many records in the table. And I have used the import parameter 'MAX_ENTRIES' to set the number of records , but it seems no use. So is there any suggestion to solve this problem?
    Exception in thread "main" com.sap.conn.jco.JCoException: (104) RFC_ERROR_SYSTEM_FAILURE: No storage space available for extending an internal table.
         at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:602)
         at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1679)
         at com.sap.conn.jco.rt.ClientConnection.execute(ClientConnection.java:1018)
         at com.sap.conn.jco.rt.RfcDestination.execute(RfcDestination.java:1071)
         at com.sap.conn.jco.rt.RfcDestination.execute(RfcDestination.java:1056)
         at com.sap.conn.jco.rt.AbapFunction.execute(AbapFunction.java:251)
         at JTest.step4WorkWithTable(JTest.java:179)
         at JTest.main(JTest.java:351)
    Caused by:
    RfcException: [null]
        message: No storage space available for extending an internal table.
        Return code: RFC_SYS_EXCEPTION(3)
        error group: 104
        key: RFC_ERROR_SYSTEM_FAILURE
        message class: SR
        message type: A
        message number: 044
        message parameter 0: TSV_TNEW_PAGE_ALLOC_FAILED
         at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:1927)
         at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1631)
         ... 6 more
    Caused by: com.sap.conn.rfc.exceptions.RfcGetException: No storage space available for extending an internal table.
         at com.sap.conn.rfc.engine.RfcImp.ab_rfcerror(RfcImp.java:1233)
         at com.sap.conn.rfc.engine.RfcGet.rfcget_run(RfcGet.java:128)
         at com.sap.conn.rfc.engine.RfcGet.ab_rfcget(RfcGet.java:23)
         at com.sap.conn.rfc.engine.RfcRcv.ab_rfcreceive(RfcRcv.java:32)
         at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:1884)
         ... 7 more
    Thank you very much

    Congrats Darek!
    That function really works... here is my program test:
    package integracao.sap.teste;
    import java.util.Properties;
    import integracao.sap.config.ConfigUtil;
    import integracao.sap.funcao.RFC_READ_TABLE;
    import com.sap.mw.jco.IRepository;
    import com.sap.mw.jco.JCO;
    public class TestJCOError {
         private static Properties config;
         private static JCO.Client createJCOClient(){
              JCO.Client client = JCO.createClient(config.getProperty("numClient"), config.getProperty("user"), config.getProperty("password"), "EN", config.getProperty("host"), config.getProperty("numPrograma"));
              return (client);
    @param args
         public static void main(String[] args) {
              config = ConfigUtil.getConfig();
              JCO.Client client = createJCOClient();
              client.connect();
              IRepository repository = JCO.createRepository("REP", client);
              JCO.Function func = RFC_READ_TABLE.createFunction(repository);
              func.getImportParameterList().setValue("MARC", "QUERY_TABLE");
              func.getImportParameterList().setValue(";",    "DELIMITER");
              func.getTableParameterList().getTable("OPTIONS").appendRow();
              func.getTableParameterList().getTable("OPTIONS").setValue("MATNR = '000000000000000011'", "TEXT");
              func.getTableParameterList().getTable("FIELDS").appendRow();
              func.getTableParameterList().getTable("FIELDS").setValue("MATNR", "FIELDNAME");
              client.execute(func);
              JCO.Table table = func.getTableParameterList().getTable("DATA");
              System.out.println("NumRows: " + table.getNumRows());
              System.out.println("Content: " + table.getValue("WA"));
    Result:
    NumRows: 1
    Content: 000000000000000011
    Hope it helps everybody!
    Regards,
    Danilo Andrade

  • Using java to call a text file

    I am new to java and was wondering if there is a way of using java to call a text file on my server and use it to create a webpage using a template. Namely to click a link to a poem, and have the java automatically create a page from a text file of the poetry. I need to know if this is even possible, what I would need to look into, (IE: which software or applet to look for), and if there are any sites that anyone knows about that I could learn how to do this. currently I am having to create a page for every poem posted on my site, which takes a great deal of time, and I would like to speed the process up a bit if it is possible. Any suggestions would be greatly appreciated.

    Why a text file? I don't think it is a best practice of doing that. Just use a database, keep your poem collections there, and set up a jsp page that seek the database, and then display it on another jsp page. I guess you can find similar application in the sample projects provided by JSC.

  • Java connector calls against sap system with logon groups

    hi there.
    i want to use java connector to connect to a sap system and run a function. my problem: the sap system has more than one instance and i do not want to connect against the central instance. i want to use a logon group. does anyone have an idea how to handle this?
    thanks,
    martin

    hi,
    check this
    http://help.sap.com/saphelp_nw04/helpdata/en/f6/daea401675752ae10000000a155106/frameset.htm
    http://nwadave.com/NwadExplorer/data/SAPDoc/architecture/SAP-Client_LogonAndCommunication.doc
    let me know  u need any further info
    bvr

  • Java communication error - RFC destination NOT_CONFIGURED does not exist

    Hello,
    We are facing problem when sending reports(BEx Quert) through broadcasting to the users. We are getting the error "Java communication error RFC destination NOT_CONFIGURED does not exist"  in the Log Display (Tcode: RSRD_ADMIN).
    In the broadcasting setting, if we select variable values in the tab "General Precalculation" then we can able to send the report to user, instead of selecting variable values, if we use the option "User Specific" check box in the tab Receipient(s) (which will take selection from the role authorizations defined in the respective user roles), then we are getting the above error.
    Recently we have upgraded suppor package, please find the system details below
    P_BASIS - SAPKB70025
    PI_BASIS - SAPKIPYM12
    SAP_BW - SAPKW70027
    Java - Support Package 25
    We didn't change any roles and authorizations recently, just upgraded to latest SP. Can anyone suggest if any steps or checks need to be perfomed after applying these SP or missing anything?
    Thanks in advance
    Regards,
    Venkatesh

    Hi,
    This is configuration issue. Please check the configuration between BW and EP below link:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0a5216a-349c-2a10-9baf-9d4797349f6a?QuickLink=index&overridelayout=true
    Thanks,
    Venkat

  • Downloaded Yosemite but it will not install on Macintosh HD as it says it is used for Time Machine Backups but it is not.  TM backup is to an external 2TB HD.  Downloaded OX x twice with the same result.

    Downloaded Yosemite but it will not install on Macintosh HD as it says it is used for Time Machine Backups but it is not.  TM backup is to an external 2TB HD.  Downloaded OX X twice with the same result.

    OS X: Cannot install on a volume used by Time Machine for backups
    For some reason you have a folder called Backups.backupdb at the root level of the hard disk on which you want to install Yosemite.
    Move it to the Trash.

  • My dad gave me an iPhone 3G to use as an ipod touch but it's not picking up wifi. ive tried everything to like resetting the network settings turning wi fi off and on mutable times, turned the phone off on and on. What do i do?

    My dad gave me an iPhone 3G to use as an ipod touch but it's not picking up wifi. ive tried everything to like reseting the network settings turning wi fi off and on mutable times, turned the phone off on and on. What do i do?
    the iphone never really picked up wi fi when it was used as a phone and it didnt really matter because he had unlimited internet but it still wont go on wi fi. does any one know why it is doing this?
    The iphone works fine other wise i just really want it to go on wi fi. We just got new wi fi too and all of our other apple products go on the wi fi just fine. I dont know if its because its newer or what but my brothers 1st gen ipod goes on wi fi just fine.
    The iphone is updated to the latest ios too
    WHAT SHOULD I DO!!!!!!!!!!!???????

    This might help
    http://support.apple.com/kb/ht3406

  • I've bought an app called WhatsApp but I was not told that app doesn't work for ipod. So I would like to know how to turn back and get my money back.

    I've bought an app called WhatsApp but I was not told that app doesn't work for ipod. So I would like to know how to turn back and get my money back.

    Did you fail to look at the requirements before purchasing?
    All sales are final.  You can try contacting itunes support and asking for an exception

  • I recently buyed totally unlocked sprint iphone which was legally contract free and i am using that phone in india but i am not able to send sms .everything is working fine except sending sms. i have tried everything plz help me !!

    i recently buyed totally unlocked sprint iphone which was legally contract free and i am using that phone in india but i am not able to send sms .everything is working fine except sending sms. i have tried everything plz help me !! i have tried everything i.e. reset iphone /hard reset/network setting reset /sms service no i have also changed but i am still not able to send sms.. please help me as i am really worried .. thank you !!

    I had the same problem.  Kept getting message of waiting for activation or check network connections.  I also tried every solution out there and nothing worked.  This did though:  I download the newest version of itunes (through Internet Explorer - Google Chrome wouldn't work).  It pulled in my entire library thank goodness and then I plugged my iphone 4s into the computer.  I let itunes find it, did a complete backup in icloud, then did a restore.  Entire process took a couple of hours, but I now have imessage and facetime back.  I was about ready to give up on Apple and go get a different phone ~

  • In firefox, the video from website "tv.vu.edu.pk" is not displaying even i have installed the latest version of JAVA. There rotates a circle around java monogram every time but video is not playing even it is working fine with internet explorer

    In firefox, the video from website "tv.vu.edu.pk" is not displaying even i have installed the latest version of JAVA. There rotates a circle around java monogram every time but video is not playing even it is working fine with internet explorer

    It's not working here as well with Java 6 U25 on Linux.

  • My iPhone 5s was bought with full price in the USA from Sprint, and I was told that it is a global phone. And I can use it in china. But I can not use it in the USA, so could you mind help me to solve that problem.  I think someone of you must help me to

    My iPhone 5s was bought with full price in the USA from Sprint, and I was told that it is a global phone. And I can use it in china.
    But I can not use it in the USA, so could you mind help me to solve that problem.
    I think someone of you must help me to solve this problem !
    Details:
    SN:F2*****FDR
    <Edited by Host>

    See the response in your other thread:
    https://discussions.apple.com/message/24641427#24641427

  • I have Lightroom 5.5 as standalone app on my laptop and I want to use Lightroom mobile too. But I am not an Adobe CC subscriber. Can I use LR mobile? Right now it's telling me it's on trial and I have only 17 days left.

    I have Lightroom 5.5 as standalone app on my laptop and I want to use Lightroom mobile too. But I am not an Adobe CC subscriber and I don't have Photoshop CC. Can I use LR mobile? Right now it's telling me it's on trial and I have only 17 days left.

    But I paid for my Lightroom 5.5, LR Mobile is an app for LR5, isn't that unfair not to allow me to use LR Mobile? Adobe should change this policy.

Maybe you are looking for

  • Why does illustartor CC open then crashes and i get a message saying windows don't know the prob?

    why does illustartor CC open then crashes and i get a message saying windows does not know what the problem is. everytime i open it, Now i know it works on my computer becuase i've used illustartor plenty of times on my current desktop but ever since

  • Edit the Default CSS file

    I want to know if there is a way to edit the default CSS file for Webi.  The reason I am asking is because of the way in which hyperlinks are formatted.  When I go into the document properties and change the formatting (color only), it does not updat

  • Migration Date when migrating from classic to new g/l

    Hello gurus, I am planning a migration from classic to new g/l, but this fiscal year it will be not possible to finish phase 0 (from migration model plan). Is it possible to do it in the middle of the new fiscal year, what are the withdrawls or issue

  • Online/Offline issues

    I have a friend living in Finland and we arranged to go Online at about 11am UK time yesterday 27 May 2015.  Skype showed my friend was Offline. Waited another 15 minutes, no sign of my friend.  Texted my friend to find out where she was. The reply w

  • How to create a buffer  by passing  a just polygonpopints  as a parameter

    hi , this query about oracle spatial... please tell me how to create a buffer around a single polygon data.. by passing single polygon co-ordinates as a parameter.. ex: for a point the following works.. select * from TEMIS where SDO_INSIDE(TEMIS.GEOM