ColdFusion.navigate call JS function

Hi,
I use ColdFusion.navigate to call a cfc method. In this function, it loads a list from database and set the div innerhtml to the list content.
Then, get the list and it can do the confirmation function.
However, I find that it always call the confirmation function before loading the list complete.
What I use is the following:
ColdFusion.navigate('cfc/control.cfc?method=findSimilarName&new_name='+encodeURIComponent( document.getElementById('name').value),'tempMessage', confirmUpdate(i));
findSimilarName method will set the similar name list to a div named similarName. And I will use it to do the confirmation.
Is there any method to force ColdFusion.navigate calling my confirmation function after the findSimilarName method completed?

Hi Mehdi,
I'm not really sure what you mean here, but let me suggest a solution.
I fyou want to execute javascript at the end of a request you can use the ExtendedRenderKitService.
This makes it possible to add a javascript function call from within javacode.
Example:
You have a javascript function named "pressButton"
<af:resource type="javascript">
     function pressButton() {
         var component = AdfPage.PAGE.findComponentByAbsoluteId("pt1:pt_region0:1:r4:0:cb1");
         AdfActionEvent.queue(component, component.getPartialSubmit());
</af:resource> Now you want to call that function from within javacode using the ExtendedRenderKitService;
public void actionListener(ActionEvent actionEvent) {  
     FacesContext context = FacesContext.getCurrentInstance();
     AdfFacesContext.getCurrentInstance().isPartialRequest(context)) {
     ExtendedRenderKitService erks = Service.getRenderKitService(context, ExtendedRenderKitService.class);
     erks.addScript(context, "pressButton();");
} good luck
Luc Bors

Similar Messages

  • Issues with coldfusion.navigate (CF9) in Safari & Chrome

    I am using Coldfusion 9. I have a ColdFusion.navigate call in a cfdiv tag located within a Cflayout tag (type tab).
    The following piece of code is located in a file called "inc_shjobs.cfm" and is being called using the src attribute from a Cflayout tag on another page:
    <script>
            ColdFusion.navigate('inc_shjobs.cfm?morejobs','jobs1')
      </script>
    <cfdiv id="jobs1">
    <form name="ne">   
        <table width="98%" cellspacing="1" cellpadding="6" border="0" bgcolor="white" >
          <tr>
            <td colspan="1" align="center"><br />
    <input type="submit" name="morejobs" style="font-size:1.4em; font-style:bold " value="Expand Job Search" onClick="javaScript:ColdFusion.navigate('inc_shjobs.cfm?morejobs','jobs1');    "></td>
          </tr>
      </tr>
      <tr><td><br /><br /></td></tr>
           <tr><td valign="top">
                 <strong>Search Within</strong> <select name="radius" >
          <option value="0" <cfif session.trn.jsradius is 0> selected</cfif>>0 miles</option>
          <option value="5" <cfif session.trn.jsradius is 5> selected</cfif>>5 miles</option>     
          <option value="10" <cfif session.trn.jsradius is 10> selected</cfif>>10 miles</option>           
          <option value="25" <cfif session.trn.jsradius is 25> selected</cfif>>25 miles</option>                 
          <option value="50" <cfif session.trn.jsradius is 50> selected</cfif>>50 miles</option>                 
          <option value="100" <cfif session.trn.jsradius is 100> selected</cfif>>100 miles</option>                 
          <option value="-1" <cfif session.trn.jsradius is -1> selected</cfif>>Statewide</option>                 
          <option value="-2" <cfif session.trn.jsradius is -2> selected</cfif>>Nationally</option>                 
          </select>
        <input type="submit" name="rad" value="Go" onClick="javaScript:ColdFusion.navigate('inc_shjobs.cfm?radius='+ne1.radius.options[radiu s.selectedIndex].value,'jobs1')">  center of  <strong><cfoutput>#session.trn.city#</cfoutput></strong></td>
    <td  valign="top"><a href="dsp_jobresearch.cfm" ><img src="images/justjobs1.gif" alt="Just Job Search" border="0" /> </a></td>
             </tr>
        </table>
        </form>
        </cfdiv>
    In IE and FF, it behaves approriately by loading only the div. In Chrome and Safary, it reloads the entire page and ignores the parameters. When the same code was run under CF8, it also worked.
    Anyone got a clue as to why?
    Thanks!

    I just tested ColdFusion.navigate on Safari and Chrome (Win 7) and everything works fine.
    I recently ran into that same behavior and it had to do with submitting a form. I set an onSuccess or an onSubmit javascript function, which caused an exception and IE didn't handle it very well. It reloaded the entire page.
    I suspect it has to do with a javascript error. I would start by doing some simple js debugging.

  • ColdFusion.navigate and PIE.htc

    Hello, everyone.
    I'm not sure if PIE.htc is part of the problem; I am assuming.
    But most of the links that appear in Google when using "ColdFusion 9" +"'f' is null or not an object" as the keyword search are links related to PIE.htc.
    I have a list of links that load in a cfdiv when clicked.  [onClick = ColdFusion.navigate('doc.cfm?param=blah blah blah','div_name',myCallback,myErrorHandler)]
    The first time a link is clicked, no problems whatsoever.
    The second time a link is clicked (ANY link), I get the error message 'f' is null or not an object.
    Does ColdFusion.navigate clear/delete a JavaScript variable called 'f' when it kicks in?
    Any suggestions on what could be causing this?
    Thanks,
    ^_^

    The following code works.
    Here you go:
    I had to make a simple version. I am swamped today.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    <cfajaximport tags="cfinput-autosuggest,cfinput-datefield,
    cfajaxproxy, cfpod, cftooltip, cfdiv, cfwindow, cflayout-tab,
    cfform,cftextarea">
    <script language="javascript">
    var orgcallBack = function(){
    document.getElementById("orgsection").innerHTML = "This
    Works";
    var salescallBack = function(){
    document.getElementById("").innerHTML = "";
    var oppscallBack = function(){
    document.getElementById("").innerHTML = "";
    <!--- The error handler pops an alert with the error code
    and message. --->
    var myerrorhandler = function(errorCode,errorMessage){
    alert("[In Error Handler]" + "\n\n" + "Error Code: " +
    errorCode + "\n\n" + "Error Message: " + errorMessage);
    </script>
    </head>
    <body>
    <cfform format="html" name="enterpartner" id="form1">
    <cfinput type="text"
    name="partnername"
    size="35"
    style="z-index:1000;"
    tabindex="0">
    <cfinput type="button" name="Submit" value="Go!"
    onClick="javascript:ColdFusion.navigate('testcfdiv.cfm','orgsection',orgcallBack,myerrorh andler,'POST','form1');"
    tabindex="1">
    <cfinput type="button" name="Print" value="Print"
    tabindex="2">
    </cfform>
    <cfdiv id="orgsection"/>
    </body>
    </html>
    Hope this helps!
    Ron

  • Calling a function from another class - help!

    I realize that this is probably a basic thing for people who have been working with JavaFX for a while, but it is eluding me, and I have been working on it for over a week.
    I need to call a function that is in another class.  Here's the deal.  In EntryDisplayController.java, there are 2 possible passwords that can be accepted - one will give full access to the car, the second will limit functions on the car.  So when a password is entered and verified as to which one it is, I need to call a function in MainDisplayController.java to set a variable that will let the system know which password is being used - full or restricted.
    So in MainDisplayController.java I have this snippet to see
    public class MainDisplayController implements Initializable, ControlledScreen {
        ScreensController myController;
        public static char restrict;
         * Initializes the controller class.
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            // TODO
        public void setRestriction(){
            restrict = 0;
            restrictLabel.setText("RESTRICTED");
        public void clearRestriction(){
            restrict = 1;
            restrictLabel.setText("");
    And in EntryScreenDisplay.java I have this snippet:
    public class EntryDisplayController implements Initializable, ControlledScreen {
         @FXML
        private Label passwordLabel ;
        static String password = new String();
        static String pwd = new String("");
         ScreensController myController;
         private MainDisplayController controller2;
         * Initializes the controller class.
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            setPW(pwd);    // TODO
         @FXML
        private void goToMainDisplay(ActionEvent event){
            if(password.equals ("123456")){
              controller2.clearRestriction();
               myController.setScreen(ScreensFramework.MainDisplayID);
               pwd = "";
               password = "";
               setPW(pwd);
            else if(password.equals ("123457")){
               controller2.setRestriction();
                myController.setScreen(ScreensFramework.MainDisplayID);
               pwd = "";
               password = "";
               setPW(pwd);
            else{
                password = "";
                pwd = "";
                setPW(pwd);
    When I enter the restricted (or full) password, I get a long list of errors, ending with
    Caused by: java.lang.NullPointerException
      at velocesdisplay.EntryDisplayController.goToMainDisplay(EntryDisplayController.java:60)
    Line 60 is where "controller2.setRestriction(); is.
    As always, thanks for any help.
    Kind regards,
    David

    You never set the controller2 variable to anything, which is why you get a null pointer exception when you try to reference it.
    public static variables (and even singletons) are rarely a good idea as they introduce global state (sometimes they can be, but usually not).
    If a static recorder like this can only have a binary value, use a boolean, if it can have multiple values, use an enum.
    Some of the data sharing solutions in dependency injection - Passing Parameters JavaFX FXML - Stack Overflow might be more appropriate.
    I also created a small framework for roll based solutions in JavaFX which perhaps might be useful:
    http://stackoverflow.com/questions/19666982/is-there-a-way-to-implement-a-property-like-rendered-on-javafx
    https://gist.github.com/jewelsea/7229260
    It was just something I hacked together, so it's not a fully polished solution and you probably don't need something quite so complex.
    What you need is a model class shared between the components of your application.  Dependency injection frameworks such as afterburner.fx can help achieve this in a fairly simple to use way.
    If you don't want to go with a dependency injection framework, then you could use either a static singleton model class for your settings or pass the model class using the mechanism in defined in the passing parameters link I provided.  For a model class example, see the ClickCounter class from this example.   That example doesn't use FXML, but to put it together with the passing parameters solution, for your restriction model, you would have something like the following:
       private class Restricted {
         private final ReadOnlyBooleanWrapper restricted;
         public Restricted(boolen isRestricted) {
           restricted = new ReadOnlyBooleanWrapper(isRestricted);  
         public boolean isRestricted() {
           return restricted.get();
         public ReadOnlyBooleanProperty restrictedProperty() {
           return restricted.getReadOnlyProperty();
    Then in your EntryDisplayController you have:
    @FXML
    public void goToMainDisplay(ActionEvent event) {
         // determine the restriction model as per your original code...
         RestictionModel restrictionModel = new RestrictionModel(<appropriate value>);
      FXMLLoader loader = new FXMLLoader(
      getClass().getResource(
       "mainDisplay.fxml"
      Stage stage = new Stage(StageStyle.DECORATED);
      stage.setScene(
       new Scene(
         (Pane) loader.load()
      MainDisplayController controller =
        loader.<MainDisplayController>getController();
      controller.initRestrictionModel(restrictionModel);
      stage.show();
    class MainDisplayController() {
      @FXML private RestrictionModel restrictionModel;
      @FXML private RestrictLabel restrictLabel;
      public void initialize() {}
      // naming convention (if the restriction model should only be set once per controller, call the method init, otherwise call it set).
      public void initRestrictionModel(RestrictionModel restrictionModel) {
        this.restrictionModel = restrictionModel;
         // take some action based on the new restriction model, for example
        restrictLabel.textProperty.bind(
          restrictionModel.restrictedProperty().asString()
    If you have a centralized controller for your navigation and instantiation of your FXML (like in this small FXML navigation framework), then you can handle the setting of restrictions on new screens centrally within the framework at the point where it loads up FXML or navigates to a screen (it seems like you might already have something like this with your ScreensController class).
    If you do this kind of stuff a lot, then you would probably benefit from a move to a framework like afterburner.  If it is just a few times within your application, then perhaps something like the above outline will give you enough guidance to implement a custom solution.

  • ERROR: -Type conflict when calling a function module

    hi to all,
    when iam executing the program in browser   Type conflict when calling a function module  error is showing, i have bind all the attribute correctly still iam getting error, WHEN I  CLICK ON THE SEARCH BUTTON DATA IS NOT COMING  TO MY TABLE ITAB1 plz help me....
      DATA:
          NODE_IP_SELECTION                   TYPE REF TO IF_WD_CONTEXT_NODE,
          ELEM_IP_SELECTION                   TYPE REF TO IF_WD_CONTEXT_ELEMENT,
          STRU_IP_SELECTION                   TYPE IF_PLANNING_HISTORY=>ELEMENT_IP_SELECTION ,
          ITAB TYPE TABLE OF ZSL_PL_UPDATE1,
          WA TYPE ZSL_PL_UPDATE1.
      navigate from <CONTEXT> to <IP_SELECTION> via lead selection
        NODE_IP_SELECTION = WD_CONTEXT->GET_CHILD_NODE( NAME = `IP_SELECTION` ).
      get element via lead selection
        ELEM_IP_SELECTION = NODE_IP_SELECTION->GET_ELEMENT(  ).
      get all declared attributes
        ELEM_IP_SELECTION->GET_STATIC_ATTRIBUTES(
          IMPORTING
            STATIC_ATTRIBUTES = STRU_IP_SELECTION ).
    CALL FUNCTION 'ZBAPI_PL_UPDATE'
            EXPORTING
              GV_LIFNR           =  STRU_IP_SELECTION-LIFNR
              GV_MATNR           = STRU_IP_SELECTION-LIFNR
              GV_GJAHR           = ' '
            GV_WEEK_LOW        =   STRU_IP_SELECTION-FROM_WEEK
             GV_WEEK_HIGH       =  STRU_IP_SELECTION-TO_WEEK
          IMPORTING
            RETURN             =
            TABLES
              GT_PL_UPDATE       = ITAB
             DATA:
               NODE_PLANN_NODE                     TYPE REF TO IF_WD_CONTEXT_NODE,
               ELEM_PLANN_NODE                     TYPE REF TO IF_WD_CONTEXT_ELEMENT,
               STRU_PLANN_NODE                     TYPE IF_PLANNING_HISTORY=>ELEMENT_PLANN_NODE,
               WA1 TYPE IF_PLANNING_HISTORY=>ELEMENT_PLANN_NODE,
               ITAB1 TYPE TABLE OF IF_PLANNING_HISTORY=>ELEMENT_PLANN_NODE.
              LOOP AT ITAB INTO WA.
               MOVE-CORRESPONDING WA TO WA1.
               APPEND WA1 TO ITAB1.
              ENDLOOP.
           navigate from <CONTEXT> to <PLANN_NODE> via lead selection
             NODE_PLANN_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = `PLANN_NODE` ).
             CALL METHOD NODE_PLANN_NODE->BIND_TABLE
               EXPORTING
                 NEW_ITEMS            = ITAB1
                SET_INITIAL_ELEMENTS = ABAP_TRUE
                INDEX                =
    ENDMETHOD.

    CALL FUNCTION 'ZBAPI_PL_UPDATE'
    EXPORTING
    GV_LIFNR = STRU_IP_SELECTION-LIFNR
    GV_MATNR = STRU_IP_SELECTION-LIFNR
    GV_GJAHR = ' '
    GV_WEEK_LOW = STRU_IP_SELECTION-FROM_WEEK
    GV_WEEK_HIGH = STRU_IP_SELECTION-TO_WEEK
    IMPORTING
    RETURN =
    TABLES
    GT_PL_UPDATE = ITAB
    Problem is here
    check out the type GV_GJAHR whether it accepts string type.
    thanks
    sarbjeet singh

  • Cfmenuitems no longer work after coldfusion.navigate

    There are times when you want to make slight changes to menus based on what a user does.  It would be nice to simply "refresh" the menu (likely a cfdiv containing a cfmenu) using ColdFusion.navigate(..).  However, if your menu contains cfmenuitems, they no longer appear ("drop down") after performing the navigate. If this is the intended behavior I think it is a major limitation.  (CF9 and CF8)
    code for my_test.cfm:
    <cfajaximport />
    <cfdiv id="myDiv">
    <cfmenu name="my_menu" type="horizontal">
    <cfmenuitem name="options" display="My Options">
    <cfmenuitem name="option1" display="Option 1" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
    <cfmenuitem name="option2" display="Option 2" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
    <cfmenuitem name="option3" display="Option 3" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
    </cfmenuitem>
    </cfmenu>
    </cfdiv>

    It turns out that if you remove any one of the cfmenuitem elements prior to doing the navigate the cfmenuitems work correctly...
    <cfajaximport />
    <script type="text/javascript">
      function myNav() {
                removeElements();
                ColdFusion.navigate('my_test.cfm','myDiv');
      function removeElements() {
              var d = document.getElementById('myDiv');
              var e = document.getElementById('option1');
              d.removeChild(e);
    </script>
    <cfdiv id="myDiv">
      <cfmenu name="my_menu" type="horizontal">
      <cfmenuitem name="options" display="My Options">
      <cfmenuitem name="option1" display="Option 1" href="javascript:myNav();" />
      <cfmenuitem name="option2" display="Option 2" href="javascript:myNav();" />
      <cfmenuitem name="option3" display="Option 3" href="javascript:myNav();" />
      </cfmenuitem>
      </cfmenu>
    </cfdiv>

  • Custom widget triggers - or call widget functions

    The title says it !
    Take for example three scenarios:
    1. We have a lightbox display with several slides. Each slide has interactive content like buttons. Some of the buttons will cause the lightbox to close but at the same time we need the close button. So, more than one close buttons.
    2. We need to navigate between slides in a certain order, so on the first slide, we dont need the previous button although it will have to appear as soon as we move on. Likewise, the next button should be removed on the last slide.
    3. After opening a slide in a lightbox we want a css animation to play. The css is created externaly, its put into assets and linked from an html object. But when and how would we call the animation to start? The css fires up as soon as stuff is loaded but we need it to play exactly after the slide is brought into view.
    • So the question is clear: Is it possible to do those from inside muse, or we need to create custom widgets from scratch? Like with jquery maybe.
    • Is there a way to alter the default muse scripts, or simply call widget functions from our buttons? Example: button calls lightbox.close() or lightbox.next(); etc...
    I'm sorry if it has been asked before, i just couldn't find something the way i've searched it. Maybe I'm asking the wrong way but I believe its clear. Anyway, there is not need for muse to do everything, if someone has a workaround would be also welcome!
    Thanks alot!

    Hi Fabrice,
    You should be able to use the cpCmndGotoSlide variable. I suspect that the problem is something with your path in Flash.
    Can you post an excerpt of the code you use for your buttons in the Flash widget?
    /Michael
    Click here to visit the www.captivate4.com blog

  • Calling a function from a dll written by using visual studio c++

    Hi, how can i call a function from a dll which is written by visual studio c++ in test stand?  Although the functions in dll are exported and i've chosen c/c++ adapter, i saw no function in test stand. Is there a different step while i'm calling a function from a dll written by c++ than calling a function from a dll written by cvi?

    Hey Sadik,
    Selecting the C/C++ DLL Adapter Module should be sufficient for this. When you drag an action step for this onto the Main Step and navigate to the location of the DLL, the function list should populate and you should be able to select the function you want to use. If this is not the case, would you be able to post this DLL so that we can test this on our end?
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

  • Calling ORACLE Functions from within CF Builder report

    Hi, I have an ORACLE function that I would like to call from within my CF REPORT.
    I know there is a section in the report builder where you can write coldfusion code to perform tasks, but I would rather simply call the ORACLE function for each detail row in the report
    I do not want to call this function from within my main ORACLE query that I use for the report, so please don't suggest that.
    Thanks so much.
    -Jim

    6.0.5 is not certified against 10g database, so I suggest to upgrade to 6.0.8.26 (6i patch 17) first to see if the problem is gone.

  • Call a function at specific intervals

    Hi,
    I need to call a function or page at specific intervals. Or I need a ping a page at specific intervals, to keep the session alive.
    I found window.setInterval() works fine. Is there any such function in coldfusion?

    put your function in a cfc and use cfschedule to call to that method.  Example :
    remoteCalls.cfc
    <cfcomponent>  <cffunction name="callMe" access="remote">     .. do stuff here ..  </cffunction></cfcomponent>
    Setup a scheduled task in coldfusion to call your url every X minutes :
    http://www.domain.com/remoteCalls.cfc?method=callMe
    If you have arguments, pass them in as url variables.

  • Coldfusion.navigate moving my browser scrollbar

    I have a little Ajax application to build a document a
    section at a time. It works great except whenever I use
    Coldfusion.navigate to reload my <cflayout type="vbox"> the
    whole page automatically scrolls to the top of the page. Is there
    any way to "lock" the scroll bar in position so it will not move
    when reloading a container? Alternatively is there a way to pass an
    anchor through this function? So far I can't get it to work.

    If you can't see half of your page, it's probably in your
    code. Sounds like
    a tag of somesort hasn't been closed.
    As Ade said, post a link to your page, or put the page
    through the validator
    http://validator.w3.org/ this
    may pick up your problem.
    Nadia
    Adobe� Community Expert : Dreamweaver
    http://www.DreamweaverResources.com
    |Tutorials|SEO |CSS Templates
    http://www.csstemplates.com.au
    http://www.adobe.com/devnet/dreamweaver/css.html
    CSS Tutorials for Dreamweaver
    > Hello, I was editing a new template and doing fine until
    SOMETHING in
    > dreamweaver altered my browser settings and now when you
    click on ' view
    > page"
    > in IE browser I have lost the scroll bar and can no
    longer access half of
    > my
    > page. ITS GONE. I have gone over the code dozens of
    times, I even
    > downloaded a
    > new template and still I cannot get the scrollbar to
    show.
    >
    > I have tried to work on this for a week contacting the
    template people and
    > my
    > hosting. While I was working on another page I put my
    cursor over an area
    > on
    > my page where some of the borders were.... just looking
    around at
    > different
    > areas but NOT altering ANYTHING. When I went to close
    that page a notice
    > came
    > up from DREAMWEAVER that ' Settings for the browser had
    been altered did
    > I
    > want to save them?" SEEING THIS ALARMED ME that this may
    be the problem
    > so I
    > said NO and the page was okay. However this may have
    been what happed on
    > my
    > index.html page. Even tho I didnt type or edit ANYTHING
    on the page at
    > the
    > time. I was moving the cursor around on the ' design"
    protion looking at
    > varioius areas on the template.
    >
    > THIS MAY HAVE BEEN WHAT ALTERED MY PAGE and now I cant
    see ' half of my
    > index.html page and there is no scroll bar.
    >
    >
    > PLEASE HELP I have gone everywhere to get some help
    >
    >

  • CNTL_ERROR while calling a function module from Java webdynpro

    I am calling a RFC function module from javawebdynpro app
    which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java webdynpro app, it raises a CNTL_ERROR exception and creates a short dump.
    Any help on this is highly appreciated

    Good catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
    Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
    DATA:
          SOURCEVAL TYPE  /BIC/OIINVQTY,
          SOURCEUOM TYPE  /BIC/OIUSUOM,
          USITM TYPE  /BIC/OIUSITM,
          TARGETUOM TYPE  /BIC/OIUSUOM,
          CONVERTED_COST TYPE  /BIC/OIINVQTY.
    DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
    " get the Production UOM
        SELECT SINGLE I~/BIC/USPRDUOM
          FROM /BIC/PUSITM AS I
          INTO PRODUCTION_UOM
          WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
        IF ( SY-SUBRC = 4 ). " no records found
          "RAISE PARTNO_NOT_FOUND.
          RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
        ENDIF.
    " load the parameters
        SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
        SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
        USITM = SOURCE_FIELDS-/BIC/USITM.
    " then you can call the FM
        CALL FUNCTION 'Z_CA_CONVERT_US_COST'
          EXPORTING
            PSOURCEVAL                = SOURCEVAL
            PSOURCEUOM                = SOURCEUOM
            PUSITM                    = USITM
            PTARGETUOM                = PRODUCTION_UOM
          IMPORTING
            PTARGETVAL                = CONVERTED_COST
          EXCEPTIONS
            CONVERSION_NOT_MAINTAINED = 1
            PARTNO_NOT_FOUND          = 2
            OTHERS                    = 3.
    " ... [do the rest]
    Thanks for your help,
    Dennis

  • Error while calling a function.

    Hi,
    below is my callable statement through which am calling a function which returns the service years of a person with personid as parameter.
    But dont know why am getting an error which is returning the serviceyrs as 0.
    when i try to debug, the problem is in this statement
    System.out.println("the output1 is "+cs.getInt(1));
    is there any problem with my code.
    please look the code below
    thanks
    kumar
    OADBTransaction txn=getOADBTransaction();
    OracleCallableStatement cs = (OracleCallableStatement) txn.createCallableStatement("begin :1:=LMIG_UTILITY_PKG.GET_TOTAL_SERVICE(p_person_id => :2); end;",1);
    try
    cs.registerOutParameter(1,Types.INTEGER);
    cs.setInt(2,Integer.parseInt(pid));
    System.out.println("person id is "+pid);
    System.out.println("the output1 is "+cs.getInt(1));
    cs.execute();
    serviceyrs= cs.getInt(1);
    cs.close();
    catch(SQLException sqle)
    System.out.println("ERROR"+sqle.toString());
    System.out.println("Service years are "+serviceyrs);

    Hi, Guess u are missing the connection to the JDBC call.
    Try the following...it worked for me..
    Connection conn = this.getOADBTransaction().getJdbcConnection();
    OracleCallableStatement ocs = null;
    String param = null;
    try {       
         String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
         ocs = (OracleCallableStatement)conn.prepareCall(stmt);
         ocs.registerOutParameter(1, OracleTypes.CHAR);
         ocs.setString(2, <param>);
         ocs.execute();
         param = ocs.getString(1);
    } catch(SQLException se)
    {       throw OAException.wrapperException(se);    
    finally
         try {               
              ocs.close();
              return(param);
         } catch(Exception e)
              throw OAException.wrapperException(e);
    }

  • Can we call a function module in ADHOC query

    Hi
    Can we call a function module in ADHOC query if yes how.
    Also we ned to know how to call a function module in SAP query.
    An early responce is appreciated.
    Thanks and best regards
    Rajeev

    Okay as far as I understand your aim is:
    To fill a field in the output list with a value that is based on the current line information and calculated by a function module
    So go to SQ02 and create an additional field in the InfoSet.
    You can refer in the coding to the technical names you can see in the left tree window like P0000-PERNR.
    More information is avaiable in the Help part look for additional field in SQ02.
    Regards,
    Michael

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

Maybe you are looking for

  • Error: 1002097 Unable to load database [$DM_DB$]

    What is this error ..I came across $DM_APP$ but not this _DB$?? I can stop/start, retrieve data, copy ....but not rename... When I try to rename it gives this error?? I tried restarting Essbase services ...but the same issue still... Any suggestions?

  • Help error while booting sunfire v440 (error)

    Hi solaris admins. i am getting the following error while trying to install the solaris 10 OS on a sunfire v440 server.Please can someone help me out here.i think the problem is with the Hard Drives or something. =====================================

  • Documents are not included in COPA

    Hi COPA Experts, The accounting documents are not included in COPA KE21N settings. could you please assist us how to include accounting document in COPA.

  • Adobe Reader - Continued Vulnerabilities - Embarrassing

    It is simply embarrassing that Adobe can't stop releasing products with so many security vulnerabilities.  Do to the latest vulnerability in 9.1, our organization of over 5000 employees will never use your product again.  Additionally, the news is sp

  • Thumbnails in Published album

    HI there, I am trying to share an album of photos to mobile me within I-Photo. I never share albums before and allow someone to download. I now need to do that, and when I share then try to download a photo is is like 156 kb. They are the thumbnails