JCo Calling BAPI and generate htm and xml page in output

Friends,
        I am developing an Application in Java using JCO. The requirement there is a list of BAPI's are available for the selection, once the user select the BAPI , it will dynamically generates the screen of input parameters and than result will be stored in .htm and .xml file. It works for many BAPI's, but for few of that it won't work. Will you help me out why its gng to create problem for other BAPI's.
e.g.
BAPI_SALESORDER_GETLIST
BAPI_PO_GETITEMS
BAPI_MATERIAL_GET_DETAIL and few more...
It doesn't generate the proper output of these BAPI's.
Thanks.
HItesh Shah

Tanveer,
There are many files so i wont be able to put the codes but let me tell u how i m doing.
1) Giving the options to user in which server they want to connect.
2) After connection has been established there is a plain text file available which consists the list of BAPI's which will be displayed in the list box.
3) After user select any BAPI and press a button named 'DETAILS' it will display the Import/Export/Tables list.
4) After clicking on Next , i m generating a dynamic screen for input parameters.
5)Here is this step also one problem is that i have to write all the zeros, can u tell me if i want to pad the zeroes automatically what i will do.Becz every time the input parameters of each BAPI would be different.
6) After getting input parameters i will generate the .htm and .xml file using writeXML and writeHTML function.
7) I want to show them generated xml and html file in iexplore using clicking button...Can u tell me how to achieve that.
Here is the code through which my xml and htm file will be generated.
import com.sap.mw.jco.*;
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.Iterator;
// Quick imports
import com.jxml.quick.QDoc;
import com.jxml.quick.Quick;
  class RFCG {
      static final String SID = "R3";
      String conDetails []=new String[6];
      String ErrorMsg;
      int i=0;
      String LogonDetail;
      int Rows;
      IRepository repository;
      String InputName[]=new String[200];
      String InputType[]=new String[200];
      String OutputName[]=new String[200];
      String OutputType[]=new String[200];
      String OutputINTTYPE[]=new String[200];
      String OutputField[]=new String[200];
      String TableName[]=new String[500];
      String TableType[]=new String[500];
      String TableINTTYPE[]=new String[500];
      String FIELDNAME[]=new String[500];
      //String FIELDNAME[]=new String[20];
      String FIELDINTTYPE[]=new String[500];
      String OutputFieldType[]=new String[200];
      String OutputFieldINTTYPE[]=new String[200];
      String InputParFieldName[][]=new String[200][200];
      String InputParFieldDatatype[]=new String[200];
      String InputParFieldIntType[]=new String[200];
      int l,j,k,m,n,o,t,q;
       /** public static void main(String [] args){
              new RFCG("SAPR3.txt");
         public RFCG(String LogonDetail,String BAPI)
                  this.LogonDetail=LogonDetail;
                  cleanUp();
                  try {
                             /* for xml */
                             // Initialize Quick
                              QDoc schema = PersonSchema.createSchema();
                          // Convert input XML to Java
                              QDoc doc = Quick.parse(schema, "input.xml");
                         // Get the result
                              Person person = (Person)Quick.getRoot(doc);
                           for (Iterator i = person.getClientList().iterator(); i.hasNext(); ) {
                                        Client number = (Client)i.next();
                                       // String type=number.getType();
                                        //System.out.println(type);
                                       // System.out.println(LogonDetail+"LOGO");
                                        if(LogonDetail.equals(number.getType())){
                                               //conDetails[0]=number.getType();
                                               conDetails[0]=number.getSapclient();
                                               conDetails[1]=number.getUserid();
                                               conDetails[2]=number.getPassword();
                                               conDetails[3]=number.getLanguage();
                                               conDetails[4]=number.getHostname();
                                               conDetails[5]=number.getSystemnumber();
                                        //System.out.println("  Client Type(" + number.getType() + "):");
                                      //System.out.println("  Sapclient " + number.getSapclient());
                                      //System.out.println("  Userid  " + number.getUserid());
                                      //System.out.println("  Password " + number.getPassword());
                                      //System.out.println("  Language " + number.getLanguage());
                                      //System.out.println("  Hostname  " + number.getHostname());
                                      //System.out.println("  Systemnumber  " + number.getSystemnumber());
                                      //System.out.println("   \n  ");
                           } catch (Exception e) {
                                 e.printStackTrace();
                  Connect(LogonDetail);
                  zbapi(BAPI);
                  new BapiParameters1(InputName,InputType,OutputName,OutputType,TableName,TableType,BAPI,repository,OutputINTTYPE,FIELDNAME,FIELDINTTYPE,OutputField,OutputFieldType,OutputFieldINTTYPE,LogonDetail,InputParFieldName,InputParFieldDatatype,InputParFieldIntType);
                  for (int i = 0; i < 10; i++) {
                           //System.out.println("STRING***RFCG*******"InputName<i>'\t'+InputType<i>);
     public void Connect(String LogonDetail){
     //CustName=CustName;
  /** try{
       File myFile = new File(LogonDetail);
       FileReader fr= new FileReader(myFile);
       BufferedReader reader=new BufferedReader(fr);
       String line=null;
       while ((line=reader.readLine())!=null){
                 String[] result=line.split(":");
                 conDetails<i>=result[1];
                 System.out.println(conDetails<i>);
                 ++i;
            reader.close();
       }catch(Exception ex){
            ex.printStackTrace();
           try {
             JCO.addClientPool( SID,           // Alias for this pool
                                10,            // Max. number of connections
                                conDetails[0], // SAP client
                                conDetails[1], // userid
                                        conDetails[2], // password
                                conDetails[3], // language
                                conDetails[4], // host name
                                conDetails[5] );
             this.repository = JCO.createRepository("MYRepository", SID);
             //System.out.println("Connected"+ repository);
           catch (JCO.Exception ex) {
             //System.out.println("Caught an exception: \n" + ex);
             ErrorMsg=ex.toString();
             //new Error(ex);
             if (ErrorMsg!=null){
                  new Error(ErrorMsg);
         protected void cleanUp() {
                       JCO.removeClientPool(SID);
public void zbapi(String BAPI)
    JCO.Client client = null;
    JCO.Table codes = null;
    try {
      // Get a function template from the repository
      //FunctionTemplate ftemplate = repository.getFunctionTemplate(person.getRFCName());
         IFunctionTemplate ftemplate = repository.getFunctionTemplate("FUNCTION_GET");
      // if the function definition was found in backend system
      if(ftemplate != null) {
      // Create a function from the template
        JCO.Function function = ftemplate.getFunction();
        // Get a client from the pool
        client = JCO.getClient(SID);
        // Fill in input parameters
        JCO.ParameterList input = function.getImportParameterList();
        input.setValue(BAPI, "FUNCNAME");
        client.execute(function);
        // Print return message
        //JCO.Structure ret = function.getExportParameterList().getString("NAME1");
          codes = function.getTableParameterList().getTable("PRMTAB");
             //System.out.println("ROWS:"+codes.getNumRows());
             this.Rows=codes.getNumRows();
             //System.out.println(this.Rows);
          //System.out.println("PTYPE" + '\t' + "PNAME" + '\t' + "FIELDNAME" + '\t' + "DATATYPE");
     for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                              //System.out.println(codes.getString("PARAMTYPE")+ '\t' +
                              //codes.getString("NAME") + '\t'codes.getString("FIELDNAME")
                              //'t' +codes.getString("DATATYPE"));
                              if (codes.getString("PARAMTYPE").equals("1")){
                                    InputName[j]=codes.getString("NAME");
                                    InputType[j]=codes.getString("INTTYPE");
                                    //InputINTTYPE[j]=codes.getString("INTTYPE");
                                    ++j;
                              else if(codes.getString("PARAMTYPE").equals("2")){
                                         OutputName[k]=codes.getString("NAME");
                                         OutputType[k]=codes.getString("DATATYPE");
                                         OutputINTTYPE[k]=codes.getString("INTTYPE");
                                         ++k;
                              else if(codes.getString("PARAMTYPE").equals("3")){
                                         TableName[l]=codes.getString("NAME");
                                         TableType[l]=codes.getString("DATATYPE");
                                         TableINTTYPE[l]=codes.getString("INTTYPE");
                                         ++l;
                                   /**else if(codes.getString("PARAMTYPE").equals("5")){
                                        //System.out.println("RFCGGGGG"+InputParFieldName[o]);
                                         InputParFieldName[q][o]=codes.getString("FIELDNAME");
                                         if(t==0){
                                              t=1;
                                              //System.out.println("RFCGGGGG"InputParFieldName[o]"           "+t);
                                                    InputParFieldDatatype[o]=codes.getString("NAME");
                                          else{
                                               int w=o-1;
                                               System.out.println("OoOoOooo"w"\t"+o);
                                               if(InputParFieldDatatype[w].equals(InputParFieldDatatype[o])){
                                              //System.out.println("RFCGGGGG"InputParFieldName[o]"           "+t);
                                              System.out.println("yes");
                                             else{
                                               InputParFieldDatatype[o]=codes.getString("NAME");
                                               ++q;
                                         InputParFieldIntType[o]=codes.getString("INTTYPE");
                                                                            ++o;
                              else if(codes.getString("PARAMTYPE").equals("6")){
                                        if(!codes.getString("NAME").equals("RETURN")){
                                              //if(codes.getString("NAME").equals(TableName[]))
                                              OutputField[n]=codes.getString("FIELDNAME");
                                              //OutputFieldType[n]=codes.getString("DATATYPE");
                                              OutputFieldINTTYPE[n]=codes.getString("INTTYPE");
                                              ++n;}
                              else if(codes.getString("PARAMTYPE").equals("7")){
                                         FIELDNAME[m]=codes.getString("FIELDNAME");
                                         FIELDNAME[m]=codes.getString("DATATYPE");
                                         //System.out.println("TABLEFIELD"+FIELDNAME[m]);
                                         FIELDINTTYPE[m]=codes.getString("INTTYPE");
                                         ++m;
      else {
            //System.out.println("Function not found"  );
               //new Error("Function not Found");
        //System.out.println("Function BAPI_SALESORDER_GETLIST not found in backend system.");
      }//if
    catch (Exception ex) {
     System.out.println("Caught an exception: \n" + ex);
     ErrorMsg=ex.toString();
          //System.out.println("2222Caught an exception: \n" + ErrorMsg);
               if (ErrorMsg!=null)
                           new Error(ErrorMsg);
     //        new Error(ex);
    finally {
      // Release the client to the pool
                //System.out.println("2222Caught an exception: \n" + ErrorMsg);
      JCO.releaseClient(client);
/**protected void cleanUp() {
              JCO.removeClientPool(SID);
Thanks,
Hitesh

Similar Messages

  • From JCO calling BAPI and want to get the list

    Friends,
            Using JCO i connected to SAP server and want the list of profitcenter and all creditors.
    For Creditors    : BAPI_CREDITOR_GETDETAIL
    For Profit center: BAPI_PROFITCENTER_GETLIST
    I am using both the bapi's but i am not getting the list of it. Basically this two bapi will return table so..will u pls. help me out to solve this problem.
    Thanks
    Hitz

    Hi,
    probably you work wiht wrong data (if is something wrong with connection to SAP, some exception will erased).
    First connect to SAP with SAP gui, go to transaction se37 and try run BAPI_CREDITOR_GETDETAIL. That is a test do you work wiht correct data (in BAPI_CREDITOR_GETDETAIL creditorid is mandatory).
    Other you can do is: get bapi's return table (also export table) and read message.

  • Calling BAPI and manipulating using macros

    Hello Guys,
    Calling BAPI from SAP and manipulating the same using some macros or similar kind of code in MS Excel.
    Can u give one example to the above scenario with step by step procedure.
    thanks.
    Regards,
    reddy.

    Hello Guys,
    Calling BAPI from SAP and manipulating the same using some macros or similar kind of code in MS Excel.
    Can u give one example to the above scenario with step by step procedure.
    thanks.
    Regards,
    reddy.

  • Navigate with MVC and XML pages

    Hi guys,
    I'm having some trouble with navigating through my app.
    Although there are lots of examples on SCN, it's probably something that I didn't pick up or I missed.
    I'm creating an app, that has an index.HTML starter file, and all others are XML.
    Index:
    jQuery.sap.registerModulePath('Application', 'Application');
    // Load your application js   
    jQuery.sap.require("Application");
    Index.js
    jQuery.sap.declare("Application");
    jQuery.sap.require("sap.ui.app.Application");
    sap.ui.app.Application.extend("Application", {
      init : function() {
      main : function() {
      // create app view and put to html root element
      var root = this.getRoot();
      var view = sap.ui.xmlview("App", "view.App");
      // set i18n model
      var i18nModel = new sap.ui.model.resource.ResourceModel({bundleUrl : "i18n/i18n_ro_RO.properties"});
      view.setModel(i18nModel, "i18n");
      view.placeAt(root);
    >  }
    App.view.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <core:View
        controllerName="view.App"
        xmlns:core="sap.ui.core"
        xmlns="sap.m"
        xmlns:mvc="sap.ui.core.mvc">
        <App id="app">
            <mvc:XMLView viewName="view.HomePage" id="idHomePage" />
            <mvc:XMLView viewName="view.Order" id="idOrder" />
        </App>
    </core:View>
    And 2 pages. HomePage and DetailPage.
    What I want is to navigate from Home to Detail. I can't use split app.
    This is the function that I'm using to do it:
    handleListSelect : function (evt) {
      var app = sap.ui.getCore().byId("App");
      app.to("Detail");
    but I get the awesome error: "Uncaught TypeError: Object [object Object] has no method 'to' "
    That means I didn't declare something right or at all ?
    Thanks in advance,
    Marius

    Hi Maria,
    Got it,
    In the App.view.xml:
    Replace the following line :
    <mvc:XMLView  viewName="view.HomePage" id="idHomePage" />
    with the following
    <mvc:XMLView  id="homePageView"  viewName="view.HomePage" />
    And Similarly,
    Replace the following line:
    <mvc:XMLView viewName="view.Order" id="idOrder" />
    with the following:
    <mvc:XMLView id="orderView" viewName="view.Order" />
    Please do let me know

  • Return values from a popup to calling form and refresh page?

    Hi,
    Following thread Re: Popup report window from a PL/SQL proc.? I'm trying to pass the record values(checkbox + record values) to the parent windows (the retruned value is always a unique record). I was able to set the variables values with a procedure ( I vierfied in session state), but I'm unable to pass these values to the parent form and then refreshing the page. I tried the following thread without success : Refresh from Popup page
    Any hint would be appreciated.
    Thanks

    Andy,
    My page has the following query for the report region (PL/sql function):
    DECLARE
    v_string VARCHAR2(2000);
    vc VARCHAR2(2):=chr(39);
    BEGIN
    v_string:= 'SELECT '||vc||'<img src="/i//edit_big2.gif" onClick="f_payment_clrRow(this)"></img>'||vc||' Clr, '||
    ' APEX_ITEM.SELECT_LIST_FROM_QUERY(1,NULL,'||vc||'SELECT TRX_DESCRIPTION, TRX_ID FROM WTL_V_TRX_PAYMENTS WHERE TRX_EFFECT='''||V_Effect||''' '||vc||',''onchange=f_payment_trx_paymode(this); '',''NO'') Description,'||
    ' APEX_ITEM.SELECT_LIST_FROM_QUERY(2,NULL,'||vc||'SELECT DESCRIPTION, ID_VALUE FROM GEN_PR_TYPES_ENTITY '||vc||',null,''NO'') Bank,'||
    ' APEX_ITEM.TEXT(3,NULL,10,10,''ondblclick=f_callMyPopup(this);'') Document,'||
    ' APEX_ITEM.TEXT(4,NULL,10,15) Account,'||
    ' APEX_ITEM.SELECT_LIST_FROM_QUERY(5,NULL,'||vc||'SELECT ID_VALUE, ID_VALUE FROM WTL_V_TRX_CURRENCY'||vc||',''onchange=f_payment_currency_rate(this);'',''NO'') Currency,'||
    ' APEX_ITEM.TEXT(6,NULL,15,20,''onblur=f_payment_trx_amount(this); style="text-align:right;" '') Amount, '||
    ' APEX_ITEM.TEXT(7,NULL, 5, 8,''onblur=f_payment_trx_amount(this); style="text-align:right;" '') Rate, '||
    ' APEX_ITEM.TEXT(8,NULL,15,20,''readonly style="text-align:right;" '') Trx_Amount, '||
    ' APEX_ITEM.HIDDEN (9,NULL), '||
    ' APEX_ITEM.HIDDEN (10,NULL) '||
    ' from dual';
    return v_string;
    As u can see, the 3rd item uses the ondblclick to call the js function f_callMyPopup.
    My js function in the header of the page is below:
    <script>
    function f_open_lov2(page, request)
    { var url;
    url = 'f?p='+$x('pFlowId').value+':'+page+':'+$x('pInstance').value+':'+request;
    w = open(url,"winLov","Scrollbars=1,resizable=1,width=500,height=600");
    if (w.opener == null)
    w.opener = self;
    w.focus();
    function f_callMyPopup(x)
    var f01;
    var p = x.parentNode;
    while (p.tagName != "TR")
    { p = p.parentNode;}
    var inputs = p.getElementsByTagName("INPUT");
    var zz;
    for (zz = 0; zz < inputs.length; zz++)
    {if (inputs[zz].name = 'f01')
    {f01 = inputs[zz].id;}
    f_open_lov2(17,97);// I sent 97 as an example.
    </script>
    and the js in the custom popup page (17) has the following function which is executed when the user selects one of the rows using a button.
    <script>
    function f_return_value(cstring)
    opener.document.getElementById("f03").value = cstring;
    close();
    </script>
    When f_return_value is executed, the selected value is pasted in the first row of the parent page.
    Sorry , i don't know what do you mean when you say to pass the id to the custom popup page.
    Thanks again,
    Fernando
    Edited by: fnovilloes on 16/09/2009 12:01 PM
    Edited by: fnovilloes on 16/09/2009 03:56 PM
    Edited by: fnovilloes on 16/09/2009 03:59 PM

  • Calling Main and Extra Pages of Custom Device(s) from LabVIEW

    Hi,
    I am currently evaluating VeriStand (VeriStand 2011) and its control from LabVIEW using .NET APIs.
    I am trying to use LabVIEW to add and configure custom devices for a given system definition file.
    For that I am using a subpanel, the same way it is done in the System Explorer.
    It is almost working.
    I only get errors from VIs that are dynamically called from the Custom Devices API. These VI's are part of an lvlib which is called "Custom Devices Storage.lvlib".
    I can't find this lvlib on my Computer. So, I guess, this error is normal. The only way to get rid of this error would be to load this lvlib in memory, but how ?
    An example of a dynamically loaded VI from the Custom Device API :
    If I can't configure a Custom Device inside my own Human Man Interface, there is no way I use VeriStand in the future. I don't wan't an operator or an administrator to open the System Explorer and change anything else than Custom Devices that may change in several of our test benches.
    Is there a way to do that or should I throw VeriStand to the trashcan ?
    Thanks in advance for your answer(s).
    Regards,
     

    Hi DaHelmut,
    First of all, I apologize for the lack of applicable replies. What you're attempting isn't something we usually encounter so our team didn't quite understand.
    I'll restate what you want to make sure its clear: You want to make your own version of system explorer fir your team to edit system definitions with. You also want it to support configuring custom devices. Therefore, you need custom devices to work inside your system explorer just like they do inside the shipping system explorer.
    This is technically possible, and I will help you accomplish this with some advice, however I have never seen this done before so it might take us a while to figure out all the issues. Typically people developing a custom GUI for a test bench just use the system definition API directly instead of using custom device's as-is... which is more difficult, and I agree your approach is better if it works. However, most test benches have a known set of custom devices (maybe just XCP/CCP and scan engine) so they only need to use the system definition API for maybe a few custom devices... not any device.
    First things I should mention:
    Editing a system definition, either through your custom gui and therefore through the system definition API, or through the system explorer... always requires a PC or Full development license. An operator licenses will never be able to edit system definitions no matter what.
    There is a set of VIs provided by the ECUMC toolkit to add/remove/edit system definitions with the XCP/CCP custom device. You would have to put your own GUI on top, but the VIs are installed here: <\LabVIEW>\vi.lib\ECUMC\NIVS
    I have an unreleased set of VIs that do the same thing for the scan engine and ethercat custom device I can provide
    If you still want to create your own system explorer thats capable of loading and configuring any custom device, here are some suggestions:
    Custom devices are built into LLBs that include all of their dependencies, so they can be loaded by the LabVIEW run time engine. If you create a VI that loads custom device's, you should be careful to avoid cross linking corrupting your development system or your custom device's. For example your system explorer might use "Get File Extension.vi" from vi.lib, but the custom device you're loading might also use this VI and therefore its linked to a copy inside its LLB. You will know when cross linking happens when the LabVIEW load warning dialog appears saying "vi X loaded vi Y from Z instead of A". If that happens, do not save. To avoid this entirely, it might be easiest to test your system explorer only as a compiled exe.
    As you saw, some custom device API VIs used by custom device developers make dynamic VI calls to an in-memory library named "Custom Device Storage.lvlib". Since this library is part of the shipping system explorer.exe source, these dynamic calls will error when not run inside the shipping system explorer.exe. There are two types that must be handled separately.
    Some custom device APIs like "NI VeriStand - Signal When Ready for Shutdown.vi" just make this dynamic call, and will simply return an error. These are mostly system explorer GUI specific custom device APIs. To avoid this error, you must create and bring this VI into memory yourself. So create that library and the stub VIs you need, then place static VI references to those stub VIs on your custom system explorer's block diagram. That will bring them into memory so when the custom device VIs try to dynamically call them, it will not error.
    Most custom device APIs like "NI VeriStand - Get Item Description.vi" make the dynamic call and instead of simply erroring, they will instead catch the error and switch to using a .NET implementation of the API call. I advise looking at the block diagram of this VI and then the corresponding offline API VIs to better understand this redirect system. Unfortunately, this redirection gets the offline API VI path relative to vi.lib which doesn't exist for exe's. So when you build your custom system explorer into an exe, you will need to place the "NI VeriStand\Custom Device Offline API" folder adjacent to the exe with these VIs for them to be found because the "vi library" primitive returns the exe's directory when inside an exe
    Let me know if that helps or if you have questions.
     

  • Click to call crashing and freezing pages

    Since I upgraded to version 6.3.0.105, skype click to call keeps freezing pages and I get crash messages. This is happening in Chrome and explorer

    Dear Readers,
    Here is my idea: ensure you are using the latest and greatest Chrome.
    Then, download and install the latest and greatest Click-to-Call (an update was issued late last week - so as of Friday, 16 August 2013, this thread is out-of-date).
    Finally, ensure the C2C extension is enabled in Chrome.
    Eureka!  Look up your favourite mall store directory, and check out the blue S beside the highlighted numbers.  It works!
    Mine has never crashed.
    @CarlDrogo: If after having checked my points, above, please post back with the error messages or any other clues - I am on Windows 7.  Screen shots would be ideal, as long as no personally identifiable information is revealed.  Thanks!
    Cheers,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Difference between bapi and function module

    Can you guys tell me what are the differences in calling bapis and function modules?
    I see we are calling both as the same way we call function modules. May be for bapis, we need to be careful in declaring and passing those exact structures. Can you please make it clear reg. the differences between them?
    I appreciate it.
    Thanks!

    HI,
    See these links on help.sap.com
    <b>For BAPI:</b>
    The data entered in the Internet is transferred to the R/3 System via BAPIs (Business Application Programming Interfaces).
    Data in the R/3 System is accessed via BAPIs as well.
    A Good Site for BAPI's
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://help.sap.com/saphelp_erp2005/helpdata/en/7c/3ce38765ba11d395fe00a0c94260a5/frameset.htm
    <b>For Function Module:</b>
    The important use of functional module is it is used by Enhancements.
    SAP Enhancements are used to expand the standard functionality within SAP.
    Enhancements use function modules and are called from the standard SAP code.
    http://help.sap.com/saphelp_erp2005/helpdata/en/41/7af4daa79e11d1950f0000e82de14a/frameset.htm
    List of functional modules ( Good Site)
    http://www.geocities.com/victorav15/sapr3/abapfun.html
    Hope it helps!!!!
    Thanks
    Sudheer

  • Connect NDS to r3 for calling bapi

    Hi,
    How can I connect netweaver developer studio to r3 for calling bapi and rfc?
    Many thanks,
    I'm new, very new, in the portal development.

    HI,
    How can I connect netweaver developer studio to r3 for calling bapi and rfc?
    will you elaborate more about what you want.
    1. If you wan to connect to R3 to create an RFC model for web dynpro project then.
       After creating the project, when you say create an adaptive rfc model a wizard will open
    where you can insert the information about server, as load balancing or single server.
    2. there you need to give information about host name, instance no,client, username and password.
        after that it will show you all the bapis.
    But there is nothing like connecting R3 to NWDS and calling bapi and RFC. as it is a development studio, form where you can develope an application.
    after deploying your application on J2EE server(WAS as Java), it will call a BAPI or RFC.
    for that you need to create JCO connections between your WAS as JAVA and R3 server

  • Using the container format to call BAPIs

    I'm trying to call BAPIs with the SWO_CREATE and SWO_INVOKE RFC's, and having a difficult time getting the container marshalled correctly.  Can anyone supply or point me to information about marshaling arguments in the container?
    Thanks

    Hi Jhon,
    I have seen your question for the container format to call BAPI and could not find any replies or any kind of information regarding the container marshalling on the web. I am having a simillar problem when invoking the SWO_INVOKE, i am passing a container and it gives me a error saying "packed field with incorrect BCD format" and i am trying to find some kind of solution for this, if you  had a some kind of solution or guidance that would be great.
    Thanks,
    Praveen

  • D/W BAPI and sesssion ,call transaction

    Hi ,
    can any one help me in finding difference from BAPI and call transaction ,session method .
    If you can provide any URL that can be vary  useful .
    Thank u,
    Mahendra.

    Hi Mahendra,
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    BAPI stands for Business API(Application Program Interface).
    Please check these links which will give you step by step for learning BAPI.
    http://www.erpgenie.com/sap/abap/bapi/example.htm
    http://www.sap-img.com/bapi.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/43/b46c1e53c111d395fa00a0c94260a5/content.htm
    http://www.sappoint.com/abap/bapiintro.pdf#search=%22BAPI(SAP)%22
    http://www.erpgenie.com/sap/abap/bapi/index.htm
    http://www.erpgenie.com/sap/abap/bapi/conventions.htm
    http://www.erpgenie.com/sapgenie/docs/BAPI%20Programming.doc
    http://64.233.167.104/custom?q=cache:eyMZ5qPOH-0J:www.erpgenie.com/sapgenie/docs/BAPI%2520Intro.doc+bapi&hl=en&ct=clnk&cd=6&ie=UTF-8&client=pub-2723892367221695
    http://64.233.167.104/custom?q=cache:c7cwsXMxq-UJ:www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf+bapi&hl=en&ct=clnk&cd=1&ie=UTF-8&client=pub-6389415953938571
    http://www.sapgenie.com/abap/bapi/example.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    List of all BAPIs
    http://www.planetsap.com/LIST_ALL_BAPIs.htm

  • Sample ABAP code for userexits, and calling bapi's

    Hi,
    Can someone please send me sample ABAP code
    1) to do extractor enhancement using user exit.
    2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
    3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
    Thank you very much in advance and appreciate any help.
    Regards
    Prasad

    hai ,
    check this code...
    *& Tables
    tables : tstc,     "SAP Transaction Codes
             tadir,    "Directory of Repository Objects
             modsapt,  "SAP Enhancements - Short Texts
             modact,   "Modifications
             trdir,    "System table TRDIR
             tfdir,    "Function Module
             enlfdir,  "Additional Attributes for Function Modules
             tstct.    "Transaction Code Texts
    *& Variables
    data : jtab like tadir occurs 0 with header line.
    data : field1(30).
    data : v_devclass like tadir-devclass.
    *& Selection Screen Parameters
    selection-screen begin of block a01 with frame title text-001.
    selection-screen skip.
    parameters : p_tcode like tstc-tcode obligatory.
    selection-screen skip.
    selection-screen end of block a01.
    *& Start of main program
    start-of-selection.
    Validate Transaction Code
      select single * from tstc
        where tcode eq p_tcode.
    Find Repository Objects for transaction code
      if sy-subrc eq 0.
        select single * from tadir
           where pgmid    = 'R3TR'
             and object   = 'PROG'
             and obj_name = tstc-pgmna.
        move : tadir-devclass to v_devclass.
        if sy-subrc ne 0.
          select single * from trdir
             where name = tstc-pgmna.
          if trdir-subc eq 'F'.
            select single * from tfdir
              where pname = tstc-pgmna.
            select single * from enlfdir
              where funcname = tfdir-funcname.
            select single * from tadir
              where pgmid    = 'R3TR'
                and object   = 'FUGR'
                and obj_name = enlfdir-area.
            move : tadir-devclass to v_devclass.
          endif.
        endif.
    Find SAP Modifactions
        select * from tadir
          into table jtab
          where pgmid    = 'R3TR'
            and object   = 'SMOD'
            and devclass = v_devclass.
        select single * from tstct
          where sprsl eq sy-langu
            and tcode eq p_tcode.
        format color col_positive intensified off.
        write:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        skip.
        if not jtab[] is initial.
          write:/(95) sy-uline.
          format color col_heading intensified on.
          write:/1 sy-vline,
          2 'Exit Name',
          21 sy-vline ,
          22 'Description',
          95 sy-vline.
          write:/(95) sy-uline.
          loop at jtab.
            select single * from modsapt
            where sprsl = sy-langu and
            name = jtab-obj_name.
            format color col_normal intensified off.
            write:/1 sy-vline,
            2 jtab-obj_name hotspot on,
            21 sy-vline ,
            22 modsapt-modtext,
            95 sy-vline.
          endloop.
          write:/(95) sy-uline.
          describe table jtab.
          skip.
          format color col_total intensified on.
          write:/ 'No of Exits:' , sy-tfill.
        else.
          format color col_negative intensified on.
          write:/(95) 'No User Exit exists'.
        endif.
      else.
        format color col_negative intensified on.
        write:/(95) 'Transaction Code Does Not Exist'.
      endif.
    Take the user to SMOD for the Exit that was selected.
    at line-selection.
      get cursor field field1.
      check field1(4) eq 'JTAB'.
      set parameter id 'MON' field sy-lisel+1(10).
      call transaction 'SMOD' and skip first screen.

  • Reading XML file using BAPI and then uploading that xml file data into SAP

    I am getting a xml file from Java server. I need to take
    data from this file using BAPI and need to upload into SAP using SAP.
    Please tell me how to read XML files using BAPI's.

    <b>SDIXML_DATA_TO_DOM</b> Convert SAP data (elementary/structured/table types) into DOM (XML
    <b>SDIXML_DOM_TO_XML</b>  Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
    <b>SDIXML_DOM_TO_SCREEN</b> Display DOM (XML)
    <b>SDIXML_DOM_TO_DATA</b>
    data: it_table like t001 occurs 0.
    data: l_dom      TYPE REF TO IF_IXML_ELEMENT,
          m_document TYPE REF TO IF_IXML_DOCUMENT,
          g_ixml     TYPE REF TO IF_IXML,
          w_string   TYPE XSTRING,
          w_size     TYPE I,
          w_result   TYPE I,
          w_line     TYPE STRING,
          it_xml     TYPE DCXMLLINES,
          s_xml      like line of it_xml,
          w_rc       like sy-subrc.
    start-of-selection.
      select * from t001 into table it_table.
    end-of-selection.
    initialize iXML-Framework          ****
      write: / 'initialiazing iXML:'.
      class cl_ixml definition load.
      g_ixml = cl_ixml=>create( ).
      check not g_ixml is initial.
      write: 'ok'.
    create DOM from SAP data           ****
      write: / 'creating iXML doc:'.
      m_document = g_ixml->create_document( ).
      check not m_document is initial.
      write: 'ok'.
      write: / 'converting DATA TO DOM 1:'.
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
        EXPORTING
          NAME               = 'IT_TABLE'
          DATAOBJECT         = it_table[]
        IMPORTING
          DATA_AS_DOM        = l_dom
        CHANGING
          DOCUMENT           = m_document
        EXCEPTIONS
          ILLEGAL_NAME       = 1
          OTHERS             = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
      check not l_dom is initial.
      write: / 'appending DOM to iXML doc:'.
      w_rc = m_document->append_child( new_child = l_dom ).
      if w_rc is initial.  write  'ok'.
      else.                write: 'Err =', w_rc.
      endif.
    visualize iXML (DOM)               ****
      write: / 'displaying DOM:'.
      CALL FUNCTION 'SDIXML_DOM_TO_SCREEN'
        EXPORTING
          DOCUMENT          = m_document
        EXCEPTIONS
          NO_DOCUMENT       = 1
          OTHERS            = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
    convert DOM to XML doc (table)     ****
      write: / 'converting DOM TO XML:'.
      CALL FUNCTION 'SDIXML_DOM_TO_XML'
        EXPORTING
          DOCUMENT            = m_document
        PRETTY_PRINT        = ' '
        IMPORTING
          XML_AS_STRING       = w_string
          SIZE                = w_size
        TABLES
          XML_AS_TABLE        = it_xml
        EXCEPTIONS
          NO_DOCUMENT         = 1
          OTHERS              = 2.
      if sy-subrc = 0.   write  'ok'.
      else.              write: 'Err =', sy-subrc.
      endif.
      write: / 'XML as string of size:', w_size, / w_string.
      describe table it_xml lines w_result.
      write: / 'XML as table of', w_result, 'lines:'..
      loop at it_xml into s_xml.
        write s_xml.
      endloop.
      write: / 'end of processing'.
    end of code
    Hope this will be useful.
    regards
    vinod

  • Call from Java to combine PDF and XML

    What adobe software do I need to combine PDF form template and XML data to produce PDF with XML data embedded.
    Also is there any samples/references available to make a call to the above from a Java program ?
    Any help is deeply appreciated.
    Thanks!
    Priya

    Hi Priya,
    Just curious if you figured out how to generate a PDF out of a template? I've a similar requirement where I transform XML schemas into templates, convert the template into a PDF document, and at run time bind the PDF with the form data.
    To sort of answer your question of how to bind an XML instance file to a form, if that form is an XML-FORM, then all you'd need to do is open that document as a PDF document using the PDFFactory, and invoke the importFormData() method on it, passing the XML instance as the input stream.
    The harder part though is getting the PDF out of the template in the first place, without using any adobe user interface period.
    Karthick

  • Generating PDF with XML and XSL

    Hi, quick basic question...
    I'm trying to generate pdf doc from xml with xsl.
    I'm using following sample code from xml.apache.org
    response.setContentType("application/pdf");
    Driver driver =new Driver();
    driver.setOutputStream(response.getOutputStream());
    driver.setRenderer(Driver.RENDER_PDF);
    Transformer transformer=TransformerFactory.newInstance()
    .newTransformer(new StreamSource("foo.xsl"));
    transformer.transform(xmlsource, new SAXResult(driver.getContentHandler()));
    xmlSource is my regular xml that wants to be pdf.
    is foo.xsl any regular xsl that I use to coonvert xml into html?
    or is it some special xsl that is tailored for pdf.
    Is this what is called xsl-fo?
    Thanks
    IL

    Hi IL,
    XSLT can translate XML to something else. It is most suited to transforming to another tree-like format (XML, HTML, etc.) but can be 'asked' to produce other kinds of output, flat text for example.
    It is driven by an XSL file which is a series of patterns to match and output to produce.
    This XSL file can be used to generate another XML document in which the nodes come from the Formatting Object namespace. These describe, in generic terms the format of an output document based upon the contents of the original XML.
    The formatting object XML document can then be used as input to a formatting object XML processor which can generate PDF output from it.
    You may want to check out:
    www.w3c.org
    for all the stuff on XML, XSL, XSLT, Formatting Objects, etc., and:
    xml.apache.org
    for imformation on Xalan, which is an XSL processor and FOP, which is a formatting object processor.
    Hope that helps,
    Peter.

Maybe you are looking for

  • ICal shows old reminders!

    I like the new iCal design, but one thing has me confused: in Day view, iCal shows the reminders/appointments from yesterday or earlier in Today's page. In other words, iCal now, correctly, shows a big "26" at the top for today, July 26. Yet, directl

  • ABAP Web Dynpro Application changes in Administation mode

    Hi, I Made changes to a webdynpro application using Administrator mode in se80 ie Web Dynpro Application->Test->Test in Administation mode. I made one element 'invisible' and ticked 'Final' check box. This element disappeared from my application. Now

  • Error code -50 when downloading music

    I keep getting an error code -50 when I download music..it happens sporatically, about every third song I attempt to download. I have sent endless emails to suport..and no one has an answer--i've done the diagnostics and sent them to support--disable

  • 2 contact lists ( Groups )

    I have a complicated problem On my i phone 5s. i have 2 contact lists ( Groups ) one under the name of I Cloud (750 contacts ) and the other under e-mail name( 650 contact ) some contacts are duplicated in both groups , the problem that i clouds only

  • Certain pdf pages do not get printed but print blank

    I am a mac user (OS X Yosemite v. 10.10.2) and have used acrobat xi pro 11.0.10. I notice once that some pages did not print from a pdf and after updating all drivers of the printer still I have the same problem. My printer is Canon ImageClass MF 858