CFC Vs. Structure of functions.

Hi,
I've written a small framework for Coldfusion that has
similar functionality to that of CakePHP, but ran into a strange
performance issue. Here's the basic operation of the framework as
far as the problem is concerned...
URL's rewritten and handled by
"router.cfc" that processes the URL.
Router then calls the related
controller/action.
A View.cfc is instantiated and used
to call "helpers" (CFC containing functions for form validation or
other tasks).
The View.cfc then cleans the
variables scope and passes any variables set by the
controller/action, to the requested view (cfm).
View.cfc captures the view output and
then uses this in the relevant layout.
Now here's the problem, everything works well up until the
view itself (the [action].cfm template
included by the view.cfc with a clean variables scope)
starts using a helper cfc. The helper CFC is loaded into this.html
(for example) and is used like this.html.error('fieldname') to
return a message or variable. Creation of the CFC is fine but
multiple calls to it's functions is slow.
I compared this against calling the same functions but held
in a structure in the views variables scope and the performance was
perfect.
Does anyone know of performance pitfalls with CFC's that
might be causing this, or ways around it. I'd be happy enough to
use normal functions if I could keep the variables scope clean by
storing them in a structure, but Coldfusion doesn't seem happy
about '<cffunction name="help.html.error">'.
Any ideas?
Thanks

ddks2 wrote:
> Thanks for the reply.
>
> Regarding the CFReports vs. Flashpaper. Still some
confusing here on my side.
> From my understanding I could use CFReport to create a
report and then output
> this as a FlashPaper (or PDF). I thought one could also
use CFQuery to create
> a report (more or less manually in HTML) and import this
into FlashPaper?! Is
> this not possible? I tried looking at the Flashpaper
documentation but couldn't
> find this specifically but again assume CF8 has the
Flash integration to make
> this possible?!
>
> Thanks,
> Daniel
>
Well the you could use the <cfquery...> tag to get data
from a database
and then use several tags such as <cfoutput
query="recordset"> to output
the file as HTML or other text formats.
What you maybe thinking of is the <cfdocument...> tag
which can be
wrapped around basic HTML or other text. This content would
then be
delivered to the client as PDF or FlashPaper. This can be a
nice way to
make 'printer' friendly versions of a web page, but is by no
means
limited to just that purpose.
The difference between <cfdocument...> and
<cfreport...> is that report
supports pagination features then document. The ability to
have report,
section and page headers and footers, sub-reports, and other
nice to
have report formating functionality. But it requires an
seperate tool
to build the report templates over the simple text editor
required for a
HTML document converted with the <cfdocument...> tag.
Then, of course, there are the stand alone Flashpaper tools
available to
people who just want to create Flashpaper documents on their
desktops
and deliver these over the internet. The same as PDF people
who use
Adobe Acrobat to create PDF documents on their desktop that
can be
delivered over the internet if desired. But neither of these
are
particularly ColdFusion concepts.

Similar Messages

  • To pass the values in repetitive structures any function module

    hi all,
          Is there any function module to pass the values in repetitive structures like infotype 0041(Date spcification). I heard there is a function module, so any of you can tell that function module.
    thanks,
    sekhar.

    Hi Chandra,
    If your question is to find a date for a given dar value in IT 0041 then this is the sol:
    Yes there is a function Module for IT0041, HR_ECM_READ_IT0041_DATE_TYPE
    eg: 
    INFOTYPES: p0041.
    DATA: lv_msg TYPE REF TO if_hrpa_message_handler,
              lv_date TYPE D.
    GET pernr.
    CLEAR: lv_date.
        CALL FUNCTION 'HR_ECM_READ_IT0041_DATE_TYPE'
          EXPORTING
            datar           = 'U2'       " specify the value of the dar value, for which u have to find date
            p0041           = p0041
            message_handler = lv_msg
          IMPORTING
            date            = lv_date.
    For the dar value U2, lv_date will have the corresponding date.
    Hope this will clear your doubt.
    Thanks,
    Kishore

  • BRFplus: DDIC Structure as Function Parameter results in Dump

    Hi all,
    I want to use Data Dictionary structure VBAK as a (signature) parameter to a BRFplus Function.
    I have created a Data Object VBAK bound to the DDIC structure VBAK, and defined it as a parameter to my Function.
    In my code to call the BRF function, I have:
    DATA:
      lo_context            TYPE REF TO if_fdt_context,
      lo_function           TYPE REF TO if_fdt_function.
    DATA:
      ls_vbak               TYPE VBAK.
      lo_context  = lo_function->get_process_context( ).
      lo_context->set_value(
        EXPORTING
          iv_name = 'VBAK'
          ia_value = ls_vbak ).
    The SET_VALUE method results in a runtime error (program dump) of type UC_OBJECTS_NOT_CONVERTIBLE description u201CData objects in Unicode programs cannot be convertedu201D.
    On investigation this seems to be because certain fields are represented differently in BRF.  For example, the DDIC field VBAK-ERDAT (type DATS) is stored in BRF as TIMEPOINT, which is itself a structure (type FDT_S_TIMEPOINT).  Trying to move the date value to the timepoint value is not possible and results in the dump.
    How do I get around this ?  Or in practice is it not feasible to use DDIC structures containing dates, times and possibly numbers as function parameters ??
    Running on SAP NW 7.0 EHP1 SP5.
    Thanks,
    Grogan

    Therefore you best create an internal structure reusing the types in IF_FDT_TYPES. Then you copy the data into the BRFplus internal format and then you process the function.
    Is there a method to do this, or do I have to develop my own using RTTI / RTTC ?
    NW 701 - *sigh*.
    Thanks & regards,
    Grogan

  • How to set optional for table structure in functiona module

    hi experts,
    as i have small doubt regarding
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure ....
    reagrds prabhanjan

    Ignoring the TABLES/CHANGING/EXPORTING argument...
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure
    Why not?  There's no issue with marking a TABLES interface parameter with 'Optional' and publishing the function module or function group as a web service...

  • Portal Navi Structure: Business Function Cnetric or SAP Module Centric?

    Dear all,
    When designing your portal navigation, which layout would you prefer?
    1. Business Function Centric
    top level has tabs representing different business departments (HR, Finance, Sales, etc.)
    2. SAP Module Centric
    top level has tabs representing different SAP modules (HR, MM, SD, BW, etc.)
    We know that either design has its pros and cons. Really would like to know which way most you go?
    Many thanks and best regards,

    You raised in deed a very good question. For people new to SAP products it is not always clear what belongs to what since a lot of stuff is part of SAP ERP (deployed as a SAP ECC system).
    To answer most of your questions:
    Most of the things above are in deed part of ECC. ESS/MSS is part of ERP HCM and therefore ECC. But many companies dont deploy HCM with the rest of ECC, but put HCM in a seperate installation/deployment - so two deployments of ECC.
    SolMan is not part of ECC. It comes as an own system which need to be deployed seperately from ECC. SolMan helps IT departments with ITIL processes, technical monitoring, etc.
    TM is based on SCM, I am not sure if it can run with other SCM modules.
    BW as well as BO are seperate and used for data warehouse and reporting toolsets.
    PI is SAP's Enterprise Service Bus and also used for SOA.
    CRM is for Sales and Marketing processes - a seperate deployment deeply integrated with ECC.
    For Strategy management and BPC I am not 100% sure.
    Hope that helps!
    Wolfgang

  • How to use percentage functions in BEx with structures

    Hi, I need a help.
    I have a query with a structure in the rows: two characteristics at left then the structure.
    Plant, Year/Month and a structure with 3 lines (Line A = movement type = 1, 2, 3, Line B types 4, 5, 6, Line C types 7, 8, 9).
    In the rows just a quantity.
    I'm trying to use percentage functions CT or GT in the rows, but it's not working.
    The idea is something like:
    Plant 01    07/2010   Line A    30  30%
                                     Line B    20  20%
                                     Line C    50  50%
                     Result                          33%
                     08/2010   Line A    40  20%
                                     Line B    60  30%
                                     Line C   100 50%
                     Result                          66%.
    When I do not use the structure percentage function works well, but with the structure results are completely wrong.
    Any help will be appreciated.
    César Menezes

    You either have to use exception aggregation to give you the total per plant and use that in your percentage calculation, or you could define a formula in the cells. Here you can reference the specific cells you want to use as inputs.

  • Function module to get Structure components

    Hi friends,
    is there a function module to get structure components,if we give a structure name.
    regards
    kaushik

    Sample program using the function module.
    report zrich_0003.
    types: begin of type_item,
           f1(3),
           f2(3),
           f3(3),
           f4(3),
           end of type_item.
    types: begin of type_data,
           data(800),
           end of type_data.
    data:  lineitems type table of type_item with header line,
           t_output type table of type_data with header line,
           fieldlist type table of rstrucinfo with header line,
           fieldsym  type table of rfieldlist with header line.
    data:  syrepid type sy-repid.
    data:  fieldname like fieldlist-compname,
           data_line type type_data.
    field-symbols : <fs1> type any,
                    <fs2> type any.
    lineitems-f1 = 'a1'.
    lineitems-f2 = 'a2'.
    lineitems-f3 = 'a3'.
    lineitems-f4 = 'a4'.
    append lineitems.
    lineitems-f1 = 'b1'.
    lineitems-f2 = 'b2'.
    lineitems-f3 = 'b3'.
    lineitems-f4 = 'b4'.
    append lineitems.
    lineitems-f1 = 'c1'.
    lineitems-f2 = 'c2'.
    lineitems-f3 = 'c3'.
    lineitems-f4 = 'c4'.
    append lineitems.
    lineitems-f1 = 'd1'.
    lineitems-f2 = 'd2'.
    lineitems-f3 = 'd3'.
    lineitems-f4 = 'd4'.
    append lineitems.
    syrepid = sy-repid.
    * Gets all of the global data types.
    call function 'GET_GLOBAL_SYMBOLS'
         exporting
              program   = syrepid
         tables
              fieldlist = fieldsym.
    * gets all of the components of a structure
    call function 'GET_COMPONENT_LIST'
         exporting
              program    = syrepid
              fieldname  = 'lineitems'
         tables
              components = fieldlist.
    format color 3.
    loop at lineitems assigning <fs2> .
      loop at fieldlist.
        fieldname = fieldlist-compname .
        assign component  fieldname  of structure <fs2> to <fs1>.
        concatenate data_line <fs1> into data_line .
      endloop.
      append data_line to t_output.
      clear data_line.
    endloop.
    loop at t_output.
      write:/ t_output.
    endloop.
    Regards,
    Rich Heilman

  • Org Model structure function changing after saving also

    HI,
    I am new to CRM and learning CRM.i have created org model by creating marketing,sales and service structure.
    everything works fine.
    but my issue is when i click in service org tab and in function i am selecting service and service org.then i am going to sales org structure and click on it in function i see service is enabled where i have enabled sales before .In same case if i m scrolling through marketing and going to service structure then in service structure in function tab marketing is enabled.
    Can any body tell me any functionality is available in sap CRM to restrict above structure once i have saved it .it will be as usual irrespective If I scroll to different structure.please help me regarding this.
    Reagrds,
    Debesh

    Hi Phani,
    Thanks for your reply.
    I've configured in the same way that you have mentioned but still the same issue is existing.
    Could anyone in the SAP SD Network assist me for the same.
    Reply awaited.
    Regards,
    Sri...

  • CFC web service function take only 16 arguments

    Hi
    I created a web service in coldfusion 9 (installed while ago and also installl update 9.0.1). All other cfc's works fine only one cfc that have two functions with more than 16 arguments that cause problem and gives error "Unable to read WSDL..."   and 500 internal server error. When I remove arguments those more than 16, it works fine.
    Any idea?
    Thanks
    Paresh

    Ok, while scowering the internet for more examples to help. I
    see that i missed a very big step in not including the Operation
    call. I modified my code to include it, but seems like everyones
    examples are to simply get info from other sites and not
    passmultiple variables. What am I missing my my code below. I need
    to pass 4 varbales to the CFC (addOne, duration, action, VideoFile)
    var trackerDAO:WebService = new WebService();
    trackerDAO.wsdl =
    "https://umm/prmc/videotrack/trackerDAO.cfc?wsdl";
    trackerDAO.loadWSDL();
    var operation:Operation = new Operation(null, "countIt");
    operation.addEventListener(FaultEvent.FAULT, alertFault);
    operation.request(addOne, results, action, source);
    <---Wrong??
    operation.send();

  • How to use Flex Builders Auto Generated CFCs

    OK. Not only have I already gone to a 4 day flex training,
    have an advanced coldfusion certification and work with 3 coworkers
    who have done the same...none of us can figure out how in the heck
    the flex builder's autogenerated cfc's are to be used. No big deal
    on the fact that this might be something we simply are encountering
    for the first time, but the complete and utter absence of a single
    piece of example code or documentation stating how to use this code
    correctly is very very very very irritating.
    Can anybody, share with me anything about how these CFCs are
    to be used correctly. For example. We are using the wizard to
    generate an "Active Record CFC" set of cfc's for an example table
    contain four fields. We have a data grid that is now populated by
    the "getAllAsQuery" function....we would like to implement the
    feature of making this dataGrid updateable. We know how to pass
    data back and forth and yes we could write our own CFC to do
    this...but having it autogenerated is a really neat option...but
    the question remains....how does one use them!!!
    Any help would be much appreciated. Thanks in advance!

    Hi there, what's your name by the way?
    What is a VO or DTO, and why would you use it?
    This was copy from the Java world, so it's a very OOP principle, basically in the OOP world everything is a class that has methods and properties, and you represent everything with classes, a VO is just that a class that represents an entity in your app. You use it for a few reasons in my opinion:
    It allows you to pass strongly typed data between different layers in your app.
    It's more verbose, it's a good OOP practice, and also makes debugging and reading you code easier.
    It allows easy data type conversion between CF and Flex.
    You obviously know how to use the wizards, after you select your table and open the wizard you'll see three different CFC types, if you're using LCDS then select that type if you don't I'll recommend you to go with BEAN/DAO. In Flex Builder you can create a folder link to a system folder, so if you create a folder named MyCFCs and you set this virtual folder to be hold inside c:\ColdFusion8\wwwroot every file that you put in this folder will be place in c:\ColdFusion8\wwwroot so you don't have to manually copy those files.
    In this wizard you'll see CFC folder in there you can select your virtual folder, you'll see below the CFC package name this is extremely important to be set right, what is the CFC package name? Basically it's the same folder structure where your CFCs will be located for instance let's say you're gonna place the files in this folder structure c:\ColdFusion8\wwwroot\com\myPersonalDomain\ so your CFC package name will be com.myPersonalDomain.
    You'll probably also would like to enable the option: Create an ActionScript value object in addition to CFCs, the folder where you place this file have to mimic the CFCs folder structure so for an instance you'll have to save inside your src folder, inside a folder com, an finally inside a folder myPersonalDomain . src/com/myPersonalDomain, and the AS Package name should be the same as the CFC.
    Once you're done and click finish, you'll see for files created, one of the the AS VO , and three CFCs.
    yourDataTable.CFC
    This is a CFC that creates the VO or DTO in CFC, it has the same properties definition that the AS version has, also the setters and getter for every property.
    yourDataTableDAO.CFC
    This CFC contains all the code that handles the database access it a could be an insert, update delete or just a read query.
    yourDataTableGateway.CFC
    This is a bridge between your Flex app and your CFCs, it contains a set of methods commonly use when you access a DB, this CFC invocates the methods in the yourDataTableDAO.cfc and returns an object or an array of objects of yourDataTable.CFC type to Flex.
    In Flex what do you have to do in order to use VOs?
    Add a reference to yourDataTable.as class
    Create a remote object.
    Create the event handler(s)
    Make a call to the remote object.
    <mx:Script>
         <![CDATA[
                   import com.myPersonalDomain;
                   import mx.controls.Alert;
                 import mx.rpc.events.ResultEvent;
                  private var myDummyVar:myDataTable;
              private function myEventHandler(e:ResultEvent):void{
                   //do Something
                   trace(event.result.toString());
         ]]>
    </mx:Script>
    <mx:RemoteObject id="myRO" destination="ColdFusion"
    source="com.myPersonalDomain.myDataTableGateway">
         <mx:method name="getAll" result="myResultHandler(event)"
    fault="Alert.show(event.fault.toString())" >
    </mx:RemoteObject>
    <mx:Button label="Call CF" click="myRO.getAll()" />
    Well I hope this would help you, I'm kinda tired this has been by far the largest post I've written.

  • Bug: 1st Date value returned from CF function as an Array

    I am encountering an annoying behavior in Flex.  I call a CF function to return a query into an arraycollection - very basic.  If the SELECT statement in the CF function includes any dates as returned values, the first date in the SELECT statement comes back into Flex as an array object that includes all of the fields in the query.  The other dates are returned normally as Date data types.
    This started happening a month or two ago, and I've reproduced it on several machines.  Needless to say, it is causing numerous errors when my code excpects a Date and gets an Array.
    Do you have any ideas of what might be causing this and what I can do about it?
    Thanks!!

    I'm not sure where to post it, but here are some snippets:
    in the cfc, I have a function as such:
    <CFFUNCTION name="GetPersonLog" returntype="query">
        <CFARGUMENT name="STUDENTID" type="numeric" required="Yes">
        <CFQUERY name="qry" datasource="#connection_string#">
            SELECT tblStudentLog.STUDENTLOGID, tblStudentLog.STUDENTID,
            <!---GETDATE() AS TESTTHIS,--->
            tblStudentLog.LOGDATE,
            tblStudentLog.LASTUPDATED,
            tblStudentLog.LOGENTRY
            FROM  tblStudentLog LEFT OUTER JOIN
            tblStudentDiscipline ON tblStudentLog.StudentDisciplineID = tblStudentDiscipline.StudentDisciplineID
            WHERE tblStudentLog.STUDENTID = <CFQUERYPARAM value = "#studentid#">
            ORDER BY tblStudentLog.LOGDATE DESC
        </CFQUERY>
        <CFRETURN qry>
    </CFFUNCTION>
    You see I have a REMmed out line to get a test date.  If I check the results in CF using cfdump, all dates come back as dates.
    In flex, the handler for the call to this function is simple:
            private function PersonLogHandler(event:ResultEvent):void{
                personlog = event.result as ArrayCollection;
                CursorManager.removeBusyCursor();}  
    If I stop the code here and evaluate the results in debug mode, I find that the LOGDATE result is an array of values, while the LASTUPDATED field is a date.
    If I put back the GETDATE() AS TESTTHIS, statement in the cfc function, then the result includes LOGDATE as a date object, but now the TESTTHIS result is an array.
    I have experienced this on 2 different machines, and it has brought my development to a standstill.  I can't thin of what changed to start these problems, except that I am now using the FlashPlayer 10 (with debugger).  This happens in Firefox and IE.  I am using FlexBuilder 3 and Coldfusion 8.

  • Jobs to run the function modules to extract the generic extarctors

    Gurus,
    I have a Datasource 'ZCMS_PP_TRAN' with extract structure 'ZBW_ST_CMSD_PP'. The extract structure is populated using the function module Z_BW_GET_CMSD_PP.
    But how do I schedule this FM or in general, are they run using std programs?
    Thanks,
    Simmi

    Hi Simmi,
       what ever it may be the DS(i mean Business Content DS, Generic DS).... these will extract the Data using Dynamic Function Calls(not always). Comming to Generic DS using FM, this will be called using Dynamic Function Module.
    In RSA3 or while extracting data from BW, you will pass request number, Update Mode, debugging option, selection fields, BW source System ID, DS Name.
    Based on these details system will extract the underlying extract structure and function module(or table/view/infoset).
    No job(Job created from BW while extracting data in the source system BI_requestid) created for Generic DS while extracting data in SAP.
    For Queue Delta, Background job will be created, it will move the data to Delta Queue.
    i will update the thread with related function modules. Try to debugg in RSA3, you could find all the information.
    all the best.
    Nagesh.

  • FI organizational structure in ECC 6.0

    Dear all,
    I would like to know what is the suggested organizational structure in FI in ECC 6.0. For example, whether it supports multiple company code or single company code. If a company code is situated out of India, how the taxation and all will be consolidated etc. etc.
    Kindly can any one provide me documents on the above subject related to Finance Module.
    It will be very helpful If anyone sends the required documents
    Email id : [email protected]
    Thanking you in advance
    Vijaya

    Hi Vijayalaxmi,
    SAP 6.0 ECC is supports what data you doing in previous versions like 4.7 or 5.0 etc
    you can set company in india or out of india and  taxation also same what you doing in previous versions
    differece is ECC 6.0 is some extra functions is added on advance purpose
    Organizational Units and Basic Settings
    Definition
    Elements of the SAP System logical structure, important for Financial Accounting.
    Organizational units are used to structure business functions and for reporting. The organizational units of Financial Accounting are used for external reporting purposes, that is, they fulfil requirements that your business is subject to from external parties, for example, legal regulations. The financial statements for example, are created based on the organizational units of Financial Accounting.
    Basic settings in Financial Accounting are Customizing settings that you have to make in order to be able to carry out processes in Financial Accounting.
    Use
    You create your company-specific organizational structure in the SAP System by defining the organizational units and making the basic settings. Defining organizational units for Financial Accounting is obligatory, that is, you have to define these units in order to be able to implement the Financial Accounting component.
    Organizational unit
    Definition
    Client
    Obligatory
    Company
    Optional
    Company code
    Obligatory
    Business area
    Optional
    Basic setting
    Chart of accounts
    Obligatory
    Fiscal year
    Obligatory
    Currencies
    Obligatory
    Integration
    In the SAP System, you define the relevant organizational units for each component that you are implementing. For example, for Sales and Distribution, you define sales organizations, distribution channels, and divisions (product groups). Similarly, for Purchasing, you define purchasing organizations, evaluation levels, plants, and storage locations. The organizational units are independent of one another at this stage.
    Components and Organizational Units
    Component
    Organizational unit
    Sales and Distribution
    Sales organization, ...
    Logistics
    Purchasing organization, ...
    Financial Accounting
    Company code, ...
    Controlling
    Controlling area, ...
    Human Resources
    Employee groups, ...
    To transfer data between the individual components, you have to assign the organizational units to each other. You only need to make these assignments once in the system. Whenever you enter data subsequently, it is automatically transferred.
    For example, invoices that are posted in SD are transferred to FI.
    Below link will give total structure of organisational structure
    http://help.sap.com/saphelp_470/helpdata/en/e5/0779ee4acd11d182b90000e829fbfe/frameset.htm
    Hope this infirmation will helps you
    Prem

  • Problem while calling RFC function module in java

    Hi all
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<system.ab.ydydy.yyyd.com>, GWSERV=sapgw00, ASHOST=<system.ab.ydydy.yyyd.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<system.ab.ydydy.yyyd.com>' unknown
    TIME        Mon Jun 06 14:50:25 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname '<system.ab.ydydy.yyyd.com>' not found
    SYSTEM CALL gethostbyname_r
    COUNTER     1
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:43)
         at MyProject.Bapi2.main(Bapi2.java:231)
    Pl help me
    pradeep

    Hi
    This is my code....
    Created on Jun 2, 2005
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package MyProject;
    @author pradeep
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import com.sap.mw.jco.*;
    public class Bapi2 extends Object {
       JCO.Client mConnection;
       JCO.Repository mRepository;
       public Bapi2() {
           try {
              // Change the logon information to your own system/user
              mConnection =
                JCO.createClient("122", // SAP client
                   "<pradeep>", // userid
                   "*****", // password
                   "EN", // language
                   "<abc11.aa.abc23.company.com>", // application server host name
                   "<00>");//system no
              mConnection.connect();
              mRepository = new JCO.Repository("HLL", 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");
               codes.setRow(2);
    codes.deleteRow();
    codes.deleteRow(5);
    codes.appendRow();
    codes.setValue("XXXX", "COMP_CODE");
    codes.setValue("Does not exist", "COMP_NAME");
    codes.appendRows(2);
    codes.setValue("YYYY", "COMP_CODE");
    codes.setValue("Does not exist either", "COMP_NAME");
    codes.nextRow();
    codes.setValue("ZZZZ", "COMP_CODE");
    codes.setValue("Nor does this", "COMP_NAME");
    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");
                 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[]) {
          Bapi2 app = new Bapi2();
    This is the error i'm getting...
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<abc11.aa.abc23.company.com>, GWSERV=sapgw00, ASHOST=<abc11.aa.abc23.company.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<abc11.aa.abc23.company.com>' unknown
    TIME        Mon Jun 06 17:15:12 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname
                '<abc11.aa.abc23.company.com>' not
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:45)
         at MyProject.Bapi2.main(Bapi2.java:233)
    Thx
    PRadeep

  • Set BAPITID in JCO.Structure

    hello all,
    i'm using JCO to monitoring CCMS architecture; i need to read properties of each MTE of CCMS.
    my problem is:
    i have a TID set of value for an MTE and i want to get results from the bapi:
    BAPI_SYSTEM_MTE_GETPERFCURVAL
    my code:
    nodes = table "TREE_NODES" resulting from BAPI_SYSTEM_MON_GETTREE call;
    // set BAPITID structure as import param for bapi
    IMetaData metaTid      = myJCORepository.getStructureDefinition("BAPITID");
    JCO.Structure struTid = new JCO.Structure(metaTid);
    struTid.setValue(nodes.getString("MTSYSID"),          "MTSYSID");
    struTid.setValue(nodes.getString("MTCLASS"),          "MTCLASS");
    struTid.setValue(nodes.getString("MTNUMRANGE"),"MTNUMRANGE");
    struTid.setValue(nodes.getString("MTMCNAME"),      "MTNUMRANGE");
    struTid.setValue(nodes.getString("MTUID"),           "MTUID");
    struTid.setValue(nodes.getString("MTINDEX"),          "MTINDEX");
    struTid.setValue(nodes.getString("EXTINDEX"),      "EXTINDEX");
    JCO.Function getPerfData = createFunction("BAPI_SYSTEM_MTE_GETPERFPROP");
    if (getPerfData != null)
    JCO.ParameterList input6     = getPerfData.getImportParameterList();
    // input param:
    input6.setValue(struTid, "TID") ;
    input6.setValue(user, "EXTERNAL_USER_NAME");
    super.mConnection.execute(getPerfData);
    // leggo eventuali errori derivati dalla chiamata alla BAPI
    returnStructure = null;
    returnStructure =  getPerfData.getExportParameterList ().getStructure("RETURN");
    System.out.println( "BAPI_SYSTEM_MTE_GETPERFPROP RETURN : " + returnStructure.getString("TYPE") + " " +
    returnStructure.getString("ID") + " " + returnStructure.getString("NUMBER") + " " +returnStructure.getString("MESSAGE"));
    JCO.Structure propertiesStructure =  getPerfData.getExportParameterList ().getStructure("PROPERTIES");
    // at this point my code return:
    (error type 'E')
    RA 341 No additional information available (function BAPI_SYSTEM_MTE_GETPERFCURVAL)
    XAL 1.0 documentation write:
    RA 341 : An unknown problem occurred during the execution of the method.
    any idea?

    hello i have found a solution, i hope this will be helpful for anyone.
    this is an example using html auto generated template.
    1. method call
                this.debugBAPI_SYSTEM_MTE_GETPERFCURVAL(
                     nodes.getString("MTSYSID")
                     ,nodes.getString("MTCLASS")
                     ,nodes.getString("MTNUMRANGE")
                     ,nodes.getString("MTMCNAME")
                     ,nodes.getString("MTUID")
                     ,nodes.getString("MTINDEX")
                     ,nodes.getString("EXTINDEX")) ;
    2. method definition:
    public void debugBAPI_SYSTEM_MTE_GETPERFCURVAL(String MTSYSID, String MTCLASS, String MTNUMRANGE, String MTMCNAME, String MTUID, String MTINDEX, String EXTINDEX)
    System.out.println("debugBAPI_SYSTEM_MTE_GETPERFCURVAL") ;
    JCO.Function function = mRepository.getFunctionTemplate("BAPI_SYSTEM_MTE_GETPERFCURVAL").     getFunction();
    System.out.println("function : " + function) ;
    JCO.ParameterList input2 = function.getImportParameterList();
    JCO.Structure st = input2.getStructure("TID") ;
        st.setValue(MTSYSID,     "MTSYSID");
        st.setValue(MTCLASS,     "MTCLASS");
        st.setValue(MTNUMRANGE,      "MTNUMRANGE");
        st.setValue(MTMCNAME,     "MTMCNAME");
        st.setValue(MTUID,     "MTUID");
        st.setValue(MTINDEX,     "MTINDEX");
        st.setValue(EXTINDEX,     "EXTINDEX");
    input2.setValue(<myR3user>, "EXTERNAL_USER_NAME");
    mConnection.execute(function);
    JCO.Structure currValStructure =  function.getExportParameterList ().getStructure("CURRENT_VALUE");
    System.out.println("currValStructure : " + currValStructure) ;
    String oldMaxRows = JCO.getProperty("jco.html.table_max_rows");
    JCO.setProperty("jco.html.table_max_rows", "99999");
    currValStructure.writeHTML("c:
    BAPI_SYSTEM_MTE_GETPERFCURVAL.html");
    JCO.setProperty("jco.html.table_max_rows", oldMaxRows);
    JCO.Structure returnStructure =  function.getExportParameterList ().getStructure("RETURN");
    System.out.println( "BAPI_SYSTEM_MTE_GETPERFCURVAL RETURN : " + returnStructure.getString("TYPE") + " " +
    returnStructure.getString("ID") + " " +
    returnStructure.getString("NUMBER") + " " +     returnStructure.getString("MESSAGE"));
    open c:\BAPI_SYSTEM_MTE_GETPERFCURVAL.html and then check the result.

Maybe you are looking for

  • Itunes can't see my backups/backup not working properly

    For some reason my copy of itunes does not seem to back up properly. The back up seems to run but then I can't see my backup under the preferences/devices tab. I have a PC It is an iphone 3G I have reinstalled itunes following apples instructions. It

  • Time Machine: External Hard Drive with Additional Files + Back-up

    Hi- I am hoping someone can clarify something for me. I use a 500GB external drive (WD-My Book) to back-up my macbook periodically (2x month). I also use this same external drive to store additional files from an old computer. I just spoke with some

  • How do i copy files from my macbook pro to a usb drive

    how do i copy files from my macbook pro to a usb drive

  • AP PO Reconcilliation Summary Report

    Hi, I have some confusion in AP PO Accraul Reconcilliation Summary Report. even after write off the transactions are still showing the report. is it the usual behaviour of the report? can anybody help me in this regard. Rgds, Abdul Wasi

  • Problem in BEX Analyzer

    Hi Gurus, *Sales Query 1     * *CUSTOMER ID     * *MATERIAL ID     * *Key Figures     * *SALES REP ID     * *No Applicable Data Found.     * Could you guys please help me to solve the above problem in BEX when excute query. No data is showing in BEX