JCO to access BAPI

Hi,
  I am trying to access an BAPI which has an Import parameter as an Table "ORDERDATA". So i need to form the Table with the values entered in the textboxes in Portal to send the Import input Table while calling a BAPI.
Can someone help me out to  Create an Table "Ord_Table" with 5 fields or more so that i can pass it as an import to the function module?
JCO.Function function = repository.getFunctionTemplate("Z_ORDER_CREATE").getFunction();
JCO.ParameterList input = function.getImportParameterList();
input.setValue(<b>Ord_Table</b> , "ORDERDATA");
client = JCO.getClient(SID);
client.execute(function);
JCO.Structure ret=function.getExportParameterList().getStructure("RETURN");
            System.out.println("RETURN MESSAGE: " + ret.getString("MESSAGE"));
JCO.Table code=function.getTableParameterList().getTable("STATUS");
Thank you
arun

Hey Arun,
Tables are not quite treated the in the same manner that inputFields are.  Check it out:
JCO.ParameterList importList = function.getImportParameterList();
// set import field and table
importList.setValue(myVariable, "SOME_SAP_ INPUT_FIELD");
// retrieve JCO.Table structure from backend
JCO.Table newDataTable = function.getTableParameterList().getTable("ORDERDATA");
// append data to Table
newDataTable.appendRow();
// these are the column names of the 'import' table
newDataTable.setValue(myVar1, "ORDERDATA_COLUMN_1");
newDataTable.setValue(myVar2, "ORDERDATA_COLUMN_2");
newDataTable.setValue(myVar5, "ORDERDATE_COLUMN_5");
// call the function module
client.execute(function);
Hopefully that helps,
Mike
P.S. if you are dev'ing for EP6.0 you should be using the JCA instead of the JCo.

Similar Messages

  • Only can use JCo to access default BAPIs but can't access developed  BAPIs

    Hi,
    My problem is I can't use JCo to access the BAPI developed by myself, but can access the default BAPI like BAPI_COMPANY_GETLIST.
    These BAPIs developed by myself can be tested in BAPI Explore correctly.
    But It can't work in java program using JCo. (can't work means it can run without any bug and I can set values into ImportParameters, but I can't get ExportParameters and Table Parameters)
    It sounds like the BAPI can't access remotly but I'm sure that I set the "remote enabled" in attribute tab.
    I really don't know what's the problem, and spent many hours try to solve it but it still can't work.
    Is there anything I should check? I really need some help.
    Here is some part of my source code. The biggest problem is I can't retrieve the returned internal table, but if I change the function module from BAPI_ZAB02_TH2 to any other default function module (like BAPI_COMPANY_GETLIST) and I can retreive the returned internal table....
    Thanks in advance.
    createConnection();
    IFunctionTemplate functionTemplate =
    mRepository.getFunctionTemplate("BAPI_ZAB02_TH2");
    JCO.Function function = new JCO.Function(functionTemplate);
    JCO.ParameterList Input = function.getImportParameterList();
    Input.setValue("80013145","VBELN");
    mConnection.execute(function);
    JCO.ParameterList outnput = function.getExportParameterList();
    JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN");
    JCO.Table ODTable = null;
    //retrieve table
    ODTable =function.getTableParameterList().getTable("ITAB2");
    System.out.println(ODTable.getNumRows());
    for (JCO.FieldIterator e = ODTable.fields(); e.hasMoreElements(); )
    JCO.Field field = e.nextField();
    if (field.getName().equals("VBELN"))
    Ship_to_party = field.getString();

    I find the answer of this problem.
    I forget the leading spaces. Need to add some "0".

  • How to access BAPI in enterprise portal perspective?

    hi,I am venkat new to the portal.can anyone plz tel me how to access BAPI in enterprise portal perspective?is done through JCo or any other database connection?I hav not seen in System Landscape about BAPI access.plz give guidance about BAPI interface in enterprise portal.Hope u  will understand the question and answer the query.
    thanx in advance.
    Regards:
    Venkataramana.

    Guys,
    Herez how you call a BAPI:
         public void buildConnection(){
              try {
                        System.out.println("**** DI2 *****");
                     //      Add a connection pool to the specified system
                     //    The pool will be saved in the pool list to be used
                     //    from other threads by JCO.getClient(SID).
                     //    The pool must be explicitely removed by JCO.removeClientPool(SID)
                       com.sap.mw.jco.JCO.addClientPool( SID,         // Alias for this pool
                                             10,          // Max. number of connections
                                             "040",       // SAP client
                                             "USERNAME",   // userid
                                             "PASSWORD",  // password
                                             "EN",        // language
                                             "IPADDRESS",// host name
                                             "40" );
                     //      Create a new repository
                     //    The repository caches the function and structure definitions
                     //    to be used for all calls to the system SID. The creation of
                     //    redundant instances cause performance and memory waste.
                       repository = com.sap.mw.jco.JCO.createRepository("MYRepository", SID);
                        JCO.Client client = null;
                        client = JCO.getClient(SID);
    //                 Get a function template from the repository
                        //IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_CUSTOMER_GETDETAIL2");
                        IFunctionTemplate ftemplate = repository.getFunctionTemplate("YGGLB_BAPI_YGGLB9PRK_PRKDOCU");
    //                 Create a function from the template
                        JCO.Function function = ftemplate.getFunction();
    //                 Get import (of Function Module) "Parameter list"
                        JCO.ParameterList input = function.getImportParameterList();
    //                 Set inputs for import parameters
                        //input.setValue("0000009000", "CUSTOMERNO");
                        //input.setValue("0248","COMPANYCODE");
    //                 Get import (of Function Module) "Structure list".
                       //JCO.Structure importStructure = function.getImportParameterList().getStructure("CUSTOMERADDRESS");
                        JCO.Structure importStructure = function.getImportParameterList().getStructure("IM_DOCUMENTHEADER");
    //                 Set values for import parameters (of Function Module) "Structure list"                     
                        importStructure.setValue( "SA", "DOC_TYPE" );
                        importStructure.setValue( "20080910", "PSTNG_DATE" );
                        importStructure.setValue( "20080910", "DOC_DATE");
                        importStructure.setValue( "BHARDWS", "USERNAME" );
                        importStructure.setValue( "2008", "FISC_YEAR" );
                        importStructure.setValue( "FRE1", "COMP_CODE" );
    //                 Get import (of Function Module) "Table list - 1".
                        JCO.Table orderPartners = function.getTableParameterList().getTable("TBL_ACCOUNTGL");
    //                 Set values for import parameters (of Function Module) "Table list - 1"
                        //Append Row -1
                        orderPartners.appendRow();
                       orderPartners.setValue("0000000001", "ITEMNO_ACC" );
                         orderPartners.setValue("0000400100", "GL_ACCOUNT" );
                        orderPartners.setValue("H", "DE_CRE_IND" );
                        orderPartners.setValue( "ANYTHING", "ITEM_TEXT" );
                        //orderPartners.setValue( "AG", "PROFIT_CTR" );
                        orderPartners.setValue( "AIG0000007", "COSTCENTER" );
                        //Append Row -2
                        orderPartners.appendRow();
                       orderPartners.setValue("0000000002", "ITEMNO_ACC" );
                        orderPartners.setValue("0000400100", "GL_ACCOUNT" );
                        orderPartners.setValue("S", "DE_CRE_IND" );
                        orderPartners.setValue( "NOTHING", "ITEM_TEXT" );
                        //orderPartners.setValue( "AG", "PROFIT_CTR" );
                        orderPartners.setValue( "AIG0000007", "COSTCENTER" );
    //                 Get import (of Function Module) "Table list - 2".
                        JCO.Table orderItems = function.getTableParameterList().getTable("TBL_CURRENCYAMOUNT");
    //                 Set values for import parameters (of Function Module) "Table list - 2"
                        //Append Row -1
                        orderItems.appendRow();
                       orderItems.setValue("0000000001", "ITEMNO_ACC" );
                        orderItems.setValue("USD", "CURRENCY" );
                        orderItems.setValue( "2000", "AMT_DOCCUR" );
                        //Append Row -2
                        orderItems.appendRow();
                       orderItems.setValue("0000000002", "ITEMNO_ACC" );
                        orderItems.setValue("USD", "CURRENCY" );
                        orderItems.setValue( "2000", "AMT_DOCCUR" );
    //                 Execute client
                        client.execute(function);
    //******************Start to work on fetching values now********************************
    //                 Get export (of Function Module) "Structure list".
                        /*JCO.Structure returnStructure = function.getExportParameterList().getStructure("CUSTOMERADDRESS");
                        JCO.Structure returnStructure2 = function.getExportParameterList().getStructure("CUSTOMERGENERALDETAIL");
                        returnStructure.getString("NAME");
                        returnStructure2.getString("ENTERED_BY");*/
    //                 Get export (of Function Module) "Table list"./// Create a new template if fetching table data from a different function module than above
                        //IFunctionTemplate ftemplateTable = repository.getFunctionTemplate("BAPI_CURRENCY_GETLIST");
                        //JCO.Function functionTable = ftemplateTable.getFunction();
                        //client.execute(functionTable);
                        JCO.Table table_return = function.getTableParameterList().getTable("RETURN");
                        Vector tbl = new Vector();
                        Vector row = new Vector();
                        Vector colNames = new Vector();
                        //Loop over all rows
                        do {
                        //Loop over all columns in the current row and add all those colums values to the current row
                        for (JCO.FieldIterator e = table_return.fields();
                             e.hasMoreElements();
                             JCO.Field field = e.nextField();
                             row.add(field.getString());
                             System.out.println(field.getName() + ":\t" + field.getString());
                             } // end for
                             //Add this newly built row to the table     
                             tbl.add(row);
                             } while (table_return.nextRow());
                             table_return = null;
                             table_return = function.getTableParameterList().getTable("RETURN");
                             table_return.nextRow();
                             for (JCO.FieldIterator e = table_return.fields();
                             e.hasMoreElements();
                             JCO.Field field = e.nextField();
                             colNames.add(field.getName().toString());
                        //DefaultTableViewModel dtvModel = new DefaultTableViewModel(tbl, colNames);
                        //beanObj.setModel(dtvModel);
                             System.err.println("getting value for you from session in Get Data 1:-");
                             JCO.releaseClient(client);
                        //     return dtvModel;
                   catch (JCO.Exception ex) {
                     System.out.println("Caught an exception: \n" + ex.getMessage());
                   }catch (Exception e){
                        System.out.println("Final Message" + e.getMessage());

  • Again runtime error in accessing Bapis?

    Hi all,
    I was doing some FlightCheck WD appl that would retrieve data from R/3. For this I have created a model that can access this data. I deployed successfully, and ran the appl. The error i got is:
    Failed to process request.
    com.sap.tc.webdynpro.services.exceptions.WDTypeNotFoundException: type com.sap.demo.flightchecking.model.types.S_Carr_Id could not be loaded: com.sap.dictionary.runtime.DdException:
    Let me know the answers for these questions:
    <b>1. Is it necessary that all the tables that we are going to use must contain data.
    2. What else to be inorder to run this type appls?I mean
       JCo Connections/Destinations?</b>
    What JCo connections needs to be maintained.
    Please answer me, or has any one done the scenarios like
    accessing Bapi functions(r/3).
    Regards,
    Ganesh

    Hi Ganesh,
    1. Check you are using correct Name Space in SLD and in service File for message service.
    2.Are you create the JCO for WD_MODELDATA_DEST in Application Data->Single Server Connection? and 
    WD_CVEMP_RFC_METADATA_DEST in Dictionary Meta Data?
    and in step 3.2 Msg. Server Connection please check you have give the correct name for Message Server and Logon Group.
    I referred the flight ticket pdf only for the guidence
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/cf40cf90-0201-0010-4a85-e5a207b900d8
    Kind Regards
    Mukesh

  • Accessing BAPIs in JSP Dynpage

    Dear Experts,
    I need to access BAPIs in my JSP Dynpage applications. As per my understanding, there are in two ways we can acheive this JCO and JCA. I would like to know the difference between these two methods ibased on performance.
    Any pointers? Thanks for your help!
    Ram

    Hi ,
    Please take a look at the below links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f5/cfa441cd47a209e10000000a155106/frameset.htm
    JCA
    Hope these will help.
    Thanks,
    Sandip

  • Access BAPIs Using the SAP Java Resource Adapter

    Hi experts,
    Can someone tell me how to Access BAPIs Using the SAP Java Resource Adapter?

    hi Shweta,
    Please refer the step by step procedure:
    1. Start the deploy tool of the SAP J2EE Application Server with the DeployTool.bat in the directory //<SAP J2EE Engine Installation Directory/.../j2ee/deploying.
    2. Choose Project &#8594; New Project and enter a name for the new project.
    3. Click on the Deployer tab.
    4. From the menu path, choose Deploy &#8594; EAR &#8594; Load Module and select the sapjra.rar file.
    5. For the newly created node sapjra.rar, choose Server Settings &#8594; Identity Subjects and select Caller Impersonation as authentication type, so that the J2EE user data is used to log on to the ABAP system.
    6. Make sure that the J2EE Application Server is running. Connect to the J2EE Application Server with Deploy &#8594; Connect.
    7. Deploy the sapjra.rar using the menu Deploy &#8594; Deployment &#8594; Deploy Module.
    8. Enter SAPJRADemo as application name and start the application.
    9. Close the deploy tool.
    10. Start the Visual Administrator again.
    11. Select the Cluster tab and switch to <Server Node> &#8594; Services &#8594; Connector Container.
    12. Click on the Runtime tab and choose sap.com/SAPJRADemo &#8594; eis/SAPJRADemoFactory.
    13. Choose Managed Connection Factory &#8594; Properties. On this page, you need to specify the logon data for the ABAP system. There is already some dummy data visible in the property list if no real system data has been specified so far.
    14. To change the value of a property, select the property in the list, change the value underneath it, and add the changes using the Add button. At the end, do not forget to save all changes by pressing the button Save Changes. The user configured for the SAP JRA must be the user authorized to read metadata of function modules.

  • Urgent Please help me... How to access BAPIs from abstract portal component

    I am developing an application in Abstract Portal Component (in
    PDK).
    In that application I can able to acess BAPIs from my Componets
    using the code like
    inputPopSearchBapi = new Zad_Bapi_Pop_Search_Form_Input();
    outputPopSearchBapi = new Zad_Bapi_Pop_Search_Form_Output();
    popSearchBapi = new DropBox_PortType();
    colorList = new Tjj12Type_List();
    inputPopSearchBapi.setIm_Agencyid("0010000001");
    try {
    jcoClient.connect();
    outputPopSearchBapi =
    popSearchBapi.zad_Bapi_Pop_Search_Form(inputPopSearchBapi);
    colorList = outputPopSearchBapi.get_as_listIt_Color();
    request.getComponentContext().putValue("color",colorList.iterat
    or());
    jcoClient.disconnect();
    But I am not able to Access the data that is comming from the
    BAPI in my JSP Page. Pleeeeeeease help me. If you want any
    clarification about my problem then ask for further
    clarifications

    Hi,
      You can refer this link, to connecting the BAPI from Abstract Portal Component <a href="http://www.huihoo.org/openweb/jco_api/com/sap/mw/jco/JCO.html">JCo Tutorial1</a>
    <a href="http://www.apentia-forum.de/viewtopic.php?t=1962&sid=9ac1506bdb153c14edaf891300bfde25">JCo Tutorial2</a>
    With Regards,
    Venkatesh. K
    /* Points are Welcome */

  • Accessing BAPI's using JAVA with out using webdynpro URGENT

    hi Experts,
    What is the procedure for calling RFC/BAPI's using JAVA with out using the webdynpro. Please let me know what are the possibilities with step by step implementation.
    Regards
    Vijay

    Hi Boris Rubarth,
    Thaks for relavant information.
    I have kind of the requirement. The clinet is asking for connecting the SAP RFC using java application. The build Jar or .war or .Ear for which are going to develop should be compatible for running on any of the Applications server like they have Tom cat, weblogic, websphere server.
    so the .jar for or .ear file which we are going to develop should be able to run accessing the RFC/ BAPIs from any of these servers other than SAP WAS that is what their target.
    Please give me your suggestion, which is better approach. currently their SAP system is 4.6c . So presently it is not possible the webservice approach. But they have plans to go for upgrade to ECC6.0
    In that case only JCO option is possible. If use this option . Is it possible to access application which is deployed irrespective of the WAS by doing the required configuration.
    Basically i am aware of the ABAP webservice work bech steps and also the JAVA coding also.
    Please suggest me what is the better way to achieve this.
    Regards

  • Error in JCo while connecting BAPI SALES ORDER.

    package com.sap;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.Exception;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class DirectBAPI extends AbstractPortalComponent
        public void doContent(IPortalComponentRequest request,   
             IPortalComponentResponse response)
                 JCO.Client mConnection;
                  JCO.Repository mRep;
          response.write("Connecting..........");
        try
                                    // Change the logon information to your own system/user
       mConnection =  JCO.createClient("<client number>",  "<user Id>",  "password",                             
              null,                 // language
         "application server number",                "<system no..>");       
               response.write("Reached");
             mConnection.connect();                // connecting JCo...
    mRep = new JCO.Repository("SAPJCo", mConnection);   //use JCo    Repository....
         response.write("Connected Succesfully");
        //response.write( mConnection.getAttributes() );
       // mConnection.disconnect();
    catch (Exception ex)
         ex.printStackTrace();
           response.write(ex.getMessage());
       JCO.Function function = null;
       JCO.FunctionTemplate ftp = null;        
       JCO.Table codes = null;
    try
             ftp = mRep.getFunctionTemplate();
             function = ftp.getFunction();
             function = this.createFunction("BAPI_SALESORDER_GETSTATUS");   
                                             // Accessing SALES_ORDER_GETSTATUS.
             if (function == null)
                 response.write("BAPI_COMPANYCODE_GETLIST"  +  " not found in SAP.");
       catch (Exception exx)
          response.write(exx.getmessage() );
       In the above code while while connecting to the BAPI SALES ORDER GET_STATUS an error is coming for JCO connection for the JCo Repository.
    The method createFunction() is undefined for the type of Project.
    plz guide how to rectify this so as to connect BAPI SALES ORDER thru JCo connection.
    Thanx in advance.
    Regards:
    Hanif

    Hi,
    The below Code is helpful for Calling BAPI's Using JCO .
    public class TestJCO {
         JCO.Client mConnection;
          JCO.Repository mRepository;
          public TestJCO() {
            try {
               // Change the logon information to your own system/user
    //           mConnection =
    //             JCO.createClient("800", // SAP client
    //                "USERID",           // userid
    //                "password",               // password
    //                null,                 // language
    //                "appserver hostname",         // application server host name
    //                "00");                // system number
              mConnection =
                JCO.createClient("002", // SAP client
                   "userid",           // userid
                   "password",               // password
                   null,                 // language
                   "app server host name",         // application server host name
                   "00");                // system number
               mConnection.connect();
               mRepository = new JCO.Repository("companyname", mConnection);
            catch (Exception ex) {
               ex.printStackTrace();
               System.exit(1);
            JCO.Function function = null;
            JCO.Table codes = null;
            try {
               function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
               if (function == null) {
                 System.out.println("BAPI_COMPANYCODE_GETLIST" +
                                         " not found in SAP.");
                 System.exit(1);
               mConnection.execute(function);
               JCO.Structure returnStructure =
                 function.getExportParameterList().getStructure("RETURN");
               if (! (returnStructure.getString("TYPE").equals("") ||
                        returnStructure.getString("TYPE").equals("S")) ) {
                 System.out.println(returnStructure.getString("MESSAGE"));
                 System.exit(1);
               codes =
                 function.getTableParameterList().getTable("COMPANYCODE_LIST");
               for (int i = 0; i < codes.getNumRows(); i++) {
                 codes.setRow(i);
                 System.out.println(codes.getString("COMP_CODE") + '\t' +
                                         codes.getString("COMP_NAME"));
            catch (Exception ex) {
               ex.printStackTrace();
               System.exit(1);
            try {
               codes.firstRow();
               for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                 function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
                 if (function == null) {
                    System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
                                            " not found in SAP.");
                    System.exit(1);
                 function.getImportParameterList().
                    setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
                 function.getExportParameterList().setActive(false, "COMPANYCODE_ADDRESS");
                 mConnection.execute(function);
                 JCO.Structure returnStructure =
                    function.getExportParameterList().getStructure("RETURN");
                 if (! (returnStructure.getString("TYPE").equals("") ||
                          returnStructure.getString("TYPE").equals("S") ||
                          returnStructure.getString("TYPE").equals("W")) ) {
                    System.out.println(returnStructure.getString("MESSAGE"));
                 JCO.Structure detail =
                    function.getExportParameterList().
                    getStructure("COMPANYCODE_DETAIL");
                 System.out.println(detail.getString("COMP_CODE") + '\t' +
                                         detail.getString("COUNTRY") + '\t' +
                                         detail.getString("CITY"));
            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) {
              TestJCO app = new TestJCO();
    Please Check your code with above code.
    Thanks,
    SubbaRao Chinta

  • Sample code to access BAPI Web services from JAVA required

    Hi All,
    I am a java developer. I am new to SAP. I just want to know how to use the web services from ABAP
    I got the WSDL, and able to convert the WSDL into java classes using java2wsdl command.
    Now i want to know how to use these classes, in my java class.  i want to know two things
    1) How to get authentication or session  or token to use the service
    2) How to consume BAPI services by using above session or token.
    Any help, really appreciated. Plz help me if any one knows.
    Thanks alot,
    Mohan

    Triplehhh wrote:
    Hi,
    I have a web application developed with java,jsp and javascript and server used is weblogic.
    Now this application is running fine on my PC. I assume from this that there is no client side Java. Is this right?
    So what steps are required so that I can access the application from other PCs also.If there is no client side Java then you have to do nothing other than make sure your PC can be reached from the other PCs. i.e. no firewalls blocking the access and routing available between the client PC and the server PC.
    I don't see what this has to do with JNLP. Am I missing something?

  • Accessing BAPI

    While going throught the documentaion i found different  ways to Call BAPI.Those are 
    Adaptive RFC with WebDynpro, SAP Java Resource Adapter,
    SAP Enterprise Connector,SAP Java Connector.
    We have SSO setup for portal and Backend R/3 using logon tickets..
    I am trying to develop a Java Webservice (based on EJB). Which of the above method can i use to Call BAPI from my EJB with SSO login tickets support.. I hope i am clear with my question . Please advice...
    regards
    Krishna.

    Hi Krishna,
          You are going develop application using JSPDynpage use SAP Java connector.
          Webdynpro means i will prefer Adaptive RFC model.
          EJB web service is bit slow when your going  fetch more records because it has to format both request and response in XML format.
          There is one good Flight example for accessing R/3 in help.
    Regards, Suresh KB

  • Problem: Accessing BAPI using SAP System Connector and setting SELOPT_TAB

    Hi,
    I am trying to use the SAP System Connector (based on JCA) to connect to a BAPI and do a search for a customer with EP SP15. (Using BAPI_CUSTOMER_FIND).
    I established the connection and can set simple input parameters, however I didn't find a way for setting the SELOPT_TAB in the IInteraction instance.
    This is what the table should contain:
    Table SELOPT_TAB
    Field Content
    COMP_CODE SPACE
    TABNAME KNA1
    FIELDNAME NAME1
    FIELDVALUE Ma*
    Here the import parameter:
    IMPORT-Parameter
    MAX_CNT 100
    PL_HOLD X
    And here the code for the IInteraction without the SELOPT_TAB that I want to include.
    // Get the Interaction interface for executing the command
    IInteraction ix = connection.createInteractionEx();
    IInteractionSpec ixspec = ix.getInteractionSpec();
    String functionName = "BAPI_CUSTOMER_FIND";
    ixspec.setPropertyValue("Name", functionName);
    String function_out = "RESULT_TAB";
    RecordFactory rf = ix.getRecordFactory();
    MappedRecord input = rf.createMappedRecord("input");
    // put function input parameters
    input.put("MAX_CNT", "100");
    input.put("PL_HOLD", "X");
    MappedRecord output = (MappedRecord) ix.execute(ixspec, input);
    Does anybody know how to set the SELOPT_TABLE as input parameter?
    Any help would be appreciated.
    Regards, Andy

    Maybe your application isn´t run in x84
    #Go to properties of your project ->Build -> changed platform target of "Any CPU" to "x86"
    #Copy these libraries from our 32-bit environment :
    *SAP.Connector.dll
    *SAP.Conector.Rfc.dll
    *librfc32.dll
    *msvcp71.dll
    *msvcr71.dll
    In 64 bits environment:
    1. librfc32.dll to C:WINDOWSsystem
    2. msvcp71.dll to C:WINDOWSsystem32
    3. msvcp71.dll and  msvcr71.dll to C:WINDOWSSysWOW64
    4. SAP.Connector.dll and SAP.Conector.Rfc.dll to C:WINDOWSassembly (DRAG)

  • Want JCO to access DB02 data

    Hi,
    I trying to retreive data from transaction DB02 using the JCO. Is there any function module that will fetch the data for me..?
    I'm interested in retreving the table & index sizes as displayed in transaction DB02. Also, is there any other way to retreive this data from a java program apart from a RFC enabled function module ?
    Thanks,
    Deepika.
    Message was edited by: Deepika Bhaskar

    Well, I dont have a solution per se to this as yet. However I did find out various function modules that would fetch the data required for transaction DB02. These function however are database dependent. It's fine as far as you are trying to connect to any particular SAP system, since you can specify which functions to call.
    A generic function which would call either an ABAP report/transaction would be good. But have not heard anything on that one.
    Deepika.

  • Is RFC destination is required for accessing BAPI from java/VB program.

    I am not able to understant that all BAPI are Remote enabled ,but no where I observed that RFC destination is required.
    Can any body tell me exact flow and things step by step.
    Any example/full source code so that I can call from java program.
    I have tried some java code posted here but not able to understand ..
    please provide me setttings also in SAP and java system

    Hi Nagaraju,
    Thank you very much. your post resolve one of my basic need .really appreciate your post.
    I was not able to execute bapi BAPI_MATERIAL_GETLIST but I executed BAPI_PO_GETDETAIL succesfully.
    Still I have 2 doubt.
    [1]. I called BAPI function module(BAPI_PO_GETDETAIL) from simple java program,But I need to call API method ( GETDETAIL) created for this BAPI not direct BAPI function module.
    [2] this is something apart from original topic.
    I have tested your java code in java as well as similar in ECC 6.0
    But I am not getting any output in JAVA program.
    I am getting output in ECC6.0 only when I will take internal table lt_mara[] with header line.
    if I will take separate workarea output is not coming. I think this is the problem in JAVA also.
    Please see the code and tell me where I am wrong.
    REPORT ZTEST1.
    types: begin of ty_mara .
       include STRUCTURE BAPIMATRAM.
    TYPES: END OF ty_mara.
    types: begin of ty_list .
      include STRUCTURE BAPIMATLST.
    TYPES: END OF ty_list.
    data: lt_mara type STANDARD TABLE OF ty_mara with HEADER LINE.
    data: lt_list type STANDARD TABLE OF ty_list,
          ls_list like LINE OF lt_list.
    START-of-SELECTION.
    lt_mara-SIGN = 'I'.
    lt_mara-option = 'EQ'.
    lt_mara-matnr_low = '000000000000000088'. "'P1001087'.
    lt_mara-matnr_high = ''.
    APPEND lt_mara.
    lt_mara-SIGN = 'I'.
    lt_mara-option = 'EQ'.
    lt_mara-matnr_low = '000000000000000089'. "'P1001087'.
    lt_mara-matnr_high = ''.
    APPEND lt_mara.
    CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
    TABLES
      MATNRSELECTION                     = lt_mara
      MATNRLIST                          = lt_list[]   .
    WRITE / 'output:  '.
    LOOP AT lt_list into ls_list .
      write: ls_list .
    ENDLOOP.
    REPORT ZTEST2.
    types: begin of ty_mara .
       include STRUCTURE BAPIMATRAM.
    TYPES: END OF ty_mara.
    types: begin of ty_list .
      include STRUCTURE BAPIMATLST.
    TYPES: END OF ty_list.
    data: lt_mara type STANDARD TABLE OF ty_mara, ">> Without header line
           ls_mara like line of lt_mara.
    data: lt_list type STANDARD TABLE OF ty_list,
          ls_list like LINE OF lt_list.
    START-of-SELECTION.
    ls_mara-SIGN = 'I'.
    ls_mara-option = 'EQ'.
    ls_mara-matnr_low = '000000000000000088'. "'P1001087'.
    ls_mara-matnr_high = ''.
    APPEND ls_list to lt_mara.
    ls_mara-SIGN = 'I'.
    ls_mara-option = 'EQ'.
    ls_mara-matnr_low = '000000000000000089'. "'P1001087'.
    ls_mara-matnr_high = ''.
    APPEND ls_list to lt_mara.
    CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
    TABLES
      MATNRSELECTION                     = lt_mara
      MATNRLIST                          = lt_list[]          .
    WRITE / 'output:  '.
    LOOP AT lt_list into ls_list .
      write: ls_list .
    ENDLOOP.

  • Accessing BAPI through Tree UI Element

    Hi,
    I have one Tree Structure where i have to populate one BAPI and display the data on the browser .I have created two tree node elements and finished the binding  .The  tree is getting diaplayed in the browser.
    But i am facing difficulty in populating data from the BAPI into the tree .
    I tried to search in web dynpro tutorials regarding this but the exmples for tree are not much useful .
    They are populating manually created data and not the data from BAPI .
    Can anybody suggest me how to do this.If anybody can suggest some other tutorials for this then it will be very much useful for me .
    Thanks.

    Hi,
    take a look at this:
    http://help.sap.com/saphelp_nw04/helpdata/en/13/4cde139306304480e89d815ffcf891/content.htm
    here you will find links to create recursive as well as non-recursive tree.
    Though the example is of value node, you can extend that to be done from BAPI node. Simply replace the loop of value node by loop which iterate through the BAPI model class' output node.
    regards

Maybe you are looking for

  • IPod Touch 4G 8GB in bootloop during update accident

    Hi ervyone! Well i as updating my iPodTouch4G to iOS6.1  i downloaded correctly iOS6.1 to my ipod (i was'nt  using iTunes) and after it was downloaded in 25 minutes i was going to install it, it all went well and was going as it must be, but during t

  • "New or Refurbished" iPod won't sync; error messages

    I recently used my warranty on my old 30 gig classic iPod to get a "new or refurbished" iPod because the battery life was terrible. When i got the iPod everything looked like it was working right, until i got to about 1550/6000 songs. I got a message

  • Trying to connect to Windows on LAN with MacBook outside of LAN

    Folks, I've scoured the support site thinking someone else has had this issue but no luck...I have a LAN powered by an Airport Extreme. I am trying to use my MacBook to access a Windows PC back in my LAN. Within the Airport Utility, under the advance

  • Isolation Level of iViews

    Hi, I have an iView, on an EP5 SP6, that currently has Isolation Level 4 enabled. I would like it to go to Isolation Level 3 since the size of the iView changes each day. The iView is inherited from a KM iView and I have been told that KM iViews need

  • Adobe Premier Elements and Intel Duo Core Macs

    If I download (sorry) Vista to my iMac as above, is it worth me buying a copy of Premier Elements? Will it work?