Calling compiled subroutines

I would like to programmatically call (load and unload)
subroutines from a VI.  There must be a way to do it, but I haven't quite
figured it out.
First the scenario:
ABSTRACT SCENARIO: I have a LabView VI that will end up being compiled into an
EXE.  In this VI, I have a file list (Array) of which I will pick one file
each pointing to a VI.  I plan on using a Menu Ring that selects one of
the options from the file list and then runs the corresponding VI.  I
would like to be able to add or remove VIs
from the list.  Furthermore, I would like to be able to change this so
each file in the list points to a compiled function (maybe a dll?). 
SPECIFIC SCENARIO: I have a measurement program that controls (adjusts
settings/returns readings) external equipment.  I would like to be able to
change the piece of equipment and simply change a measurement subroutine so
that I can "drop in" different modules for each power meter, using
the same main program.  I would like to programmatically load and unload
these depending on usage.  After compilation of the main program, I would
like to be able to add/change/remove subroutines to accommodate different
equipment.
When I compile the main program, if I compile the supporting VIs, I am no
longer calling VIs.  If I don't compile
the supporting VIs,  then I am running
uncompiled code from compiled code (not very efficient).  I believe the
way to do this is to actively load and unload dlls but I can't seem to do this
programmatically (i.e. define what dll to call based on a file string). 
The only dll calls seem to be "Call Library Function Node" and
"Code Interface Node" each which must be linked to a dll a priori.
I thank anyone sincerely for their feedback.

A few points of my own. If, when you say compile, you mean build an ".exe" that is really "building an application", which takes the vi's in your program, essentially builds them into a ".llb" type file, removing diagrams and front panels from all but those that display user interfaces at runtime. When you run the resulting .exe file it is loaded by LabVIEW, the runtime engine version if the development system isn't installed, and I believe compiled at that time. When you run a VI during development, the time delay before running the first time is LabVIEW compiling the code. If you stop the VI and rerun it you will see that it starts running much more quickly the next time.
You can build a structure that dynamically loads called vi's. Depending on the complexity of the called "plugin" there may be a delay before it executes, but it should be pretty brief, partly time to read it from disk, partly to compile the vi's code. I'm pretty sure that subsequent calls to that vi will be essentially instantaneous. Attached is a snip from some of my code that preloads the names and filepathes of vi's that may be run into two arrays and then when a specific vi name is called indexes the filepath based on the name. The VI plugins have to meet the criteria of having identical connector panes in this application, so you would need to develope an architecture that allows that.
P.M.
Message Edited by LV_Pro on 09-09-2005 04:58 PM
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion
Attachments:
plugins.PNG ‏65 KB

Similar Messages

  • Error in calling a subroutine in Fortan

    I am trying to get this program to work. It is designed to accept integer values and sort them into order. For some reason when the program is executed an error occurs. I'm not sure why, but I think it may be the way I am calling the subroutine? Does anyone know?
    The program is:
    program sorter
    read*,value
    call sort(value)
    end program sorter
    subroutine sort(value)
    implicit none
    integer,dimension(:),intent(inout) :: value
    integer :: first,temp,number,index,i,j
    number=size(value)
    do i=1,number-1
    first=value(i)
    index=i
    do j=i+1,number
    if (value(j) < first) then
    first = value(j)
    index=j
    end if
    end do
    if (index /= i) then
    temp=value(i)
    value(i)=value(index)
    value(index)=temp
    end if
    end do
    print*,value
    end subroutine sort

    A couple of comments:
    * In the main program, the 'Value' variable isn't declared
    * If you are compiling this as an F90/F95 code, the subroutine 'sort' needs to be declared with an interface
    program sorter
    interface sort
       subroutine sort(value)
          integer, dimension(:), intent(inout) :: value
       end subroutine
    end interface
    integer, dimension(10) :: value
    read*,value
    call sort(value)
    end program sorter
    subroutine sort(value)
    implicit none
    integer,dimension(:),intent(inout) :: value
    integer :: first,temp,number,index,i,j
    number=size(value)
    do i=1,number-1
       first=value(i)
       index=i
       do j=i+1,number
          if (value(j) < first) then
             first = value(j)
             index=j
          end if
       end do
       if (index /= i) then
          temp=value(i)
          value(i)=value(index)
          value(index)=temp
       end if
    end do
    print*,value
    end subroutine sort% f90 -o sorter sorter.f90
    % sorter
    3 4 5 1 2 9 0 8 7 6
    0 1 2 3 4 5 6 7 8 9

  • How to call a subroutine in a script ?

    Hi ,
      How to call a subroutine in a script ?
    bye,
    Satya.

    Hello,
    Syntax goes like this
    /: PERFORM <form> IN PROGRAM <prog>
    /: USING &INVAR1&
    /: USING &INVAR2&
    /: CHANGING &OUTVAR1&
    /: CHANGING &OUTVAR2&
    /: ENDPERFORM
    INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
    OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
    Example:
    In script form
    /:   PERFORM READ_TEXTS IN PROGRAM 'Z08M1_FORM_EKFORM1'
    /:   USING &EKKO-EKORG&
    /:   USING &EKPO-WERKS&
    /:   USING &EKKO-EKGRP&
    /:   USING &EKKO-BSTYP&
    /:   CHANGING &COMPNAME&
    /:   CHANGING &SENDADR&
    /:   CHANGING &INVCADR&
    /:   CHANGING &COMPADR&
    /:   CHANGING &COVERLTR&
    /:   CHANGING &SHIPADR&
    /:   CHANGING &REMINDER&
    /:   CHANGING &REJECTION&
    /:   CHANGING &POSTADR&
    /:   CHANGING &LOGO&
    /:   ENDPERFORM
    In program
    FORM Read_texts - To extract the standard texts from the table      *
    FORM READ_TEXTS TABLES IN_PAR   STRUCTURE ITCSY
                           OUT_PAR  STRUCTURE ITCSY.
      DATA : L_EKORG TYPE EKORG,
             L_WERKS TYPE WERKS_D,
             L_BSTYP TYPE BSTYP,
             L_EKGRP TYPE BKGRP.
      READ TABLE IN_PAR WITH KEY 'EKKO-EKORG' .
      CHECK SY-SUBRC = 0.
      L_EKORG = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKPO-WERKS' .
      CHECK SY-SUBRC = 0.
      L_WERKS = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKKO-EKGRP' .
      CHECK SY-SUBRC = 0.
      L_EKGRP = IN_PAR-VALUE.
      READ TABLE IN_PAR WITH KEY 'EKKO-BSTYP' .
      CHECK SY-SUBRC = 0.
      L_BSTYP = IN_PAR-VALUE.
      CLEAR Z08M1_ORG_TEXTS.
      SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
                                              AND WERKS = L_WERKS
                                              AND EKGRP = L_EKGRP
                                              AND BSTYP = L_BSTYP.
      IF SY-SUBRC NE 0.
        SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
                                               AND WERKS = L_WERKS
                                               AND EKGRP = L_EKGRP
                                               AND BSTYP = SPACE.
      ENDIF.
      READ TABLE OUT_PAR WITH KEY 'COMPNAME'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COMP.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'SENDADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_ADRS.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'INVCADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_INVC.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'COMPADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_CPAD.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'COVERLTR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COVR.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'SHIPADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_SHIP.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'REMINDER'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RMDR.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'REJECTION'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RJCT.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'POSTADR'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_POST.
      MODIFY OUT_PAR INDEX SY-TABIX.
      READ TABLE OUT_PAR WITH KEY 'LOGO'.
      OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_LOGO.
      MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    Hope this helps.
    Regards

  • Calling ABAP Subroutines: PERFORM  example

    hi friends,
    Can any one give me an example on Calling ABAP Subroutines: PERFORM   or provide any links for that example already posted in sdn ...
    points will be awarded
    regards and thanks
    Vijaya

    hi
    With the PERFORM statement, you can call subroutines which are coded in the same ABAP program (internal calls), or subroutines which are coded in other ABAP programs (external calls).
    You can also specify the name of the subroutine dynamically at runtime, and call subroutines from a list.
    Internal Subroutine Calls
    To call a subroutine defined in the same program, you need only specify its name in the PERFORM statement:
    PERFORM <subr> http://USING ... <pi>...
    http://CHANGING... <pi>... .
    The internal subroutine can access all of the global data of the calling program.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db978335c111d1829f0000e829fbfe/content.htm
    reward point if helpful.
    thanks

  • Calling a subroutine from BSP application

    Hi
    i want to know how to call a subroutine/form in another package in same R/3 system in my BSP application.
    Is there any way to implement this. ?
    What if the subroutine has furhter LOCAL forms called inside it. will they be used as well while calling from my BSP application.
    PLease help.

    you can do that.
    perform p1 IN PROGRAM ('Y_P_TEST') IF FOUND  .
    do you have problem in doing this? what issues are you facing.
    Regards
    Raja

  • How to call a subroutine from sap script

    hi friends,
    Can anybody tell me How to call a subroutine from sap script .
    thanks n regards .
    Mahesh

    hi..
    Calling ABAP Subroutines: PERFORM 
    You can use the PERFORM command to call an ABAP subroutine (form) from any program, subject to the normal ABAP runtime authorization checking. You can use such calls to subroutines for carrying out calculations, for obtaining data from the database that is needed at display or print time, for formatting data, and so on.
    PERFORM commands, like all control commands, are executed when a document is formatted for display or printing. Communication between a subroutine that you call and the document is by way of symbols whose values are set in the subroutine.
    The system does not execute the PERFORM command within SAPscript replace modules, such as TEXT_SYMBOL_REPLACE or TEXT_INCLUDE_REPLACE. The replace modules can only replace symbol values or resolve include texts, but not interpret SAPscript control commands.
    Syntax in a form window:
    /: PERFORM <form> IN PROGRAM <prog>
    /: USING &INVAR1&
    /: USING &INVAR2&
    /: CHANGING &OUTVAR1&
    /: CHANGING &OUTVAR2&
    /: ENDPERFORM
    INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
    OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
    The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:
    FORM <form> TABLES IN_TAB STRUCTURE ITCSY
    OUT_TAB STRUCTURE ITCSY.
    ENDFORM.
    The values of the SAPscript symbols passed with /: USING... are now stored in the internal table IN_TAB . Note that the system passes the values as character string to the subroutine, since the field Feld VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR 80). See the example below on how to access the variables.
    The internal table OUT_TAB contains names and values of the CHANGING parameters in the PERFORM statement. These parameters are local text symbols, that is, character fields. See the example below on how to return the variables within the subroutine.
    From within a SAPscript form, a subroutine GET_BARCODE in the ABAP program QCJPERFO is called. Then the simple barcode contained there (‘First page’, ‘Next page’, ‘Last page’) is printed as local variable symbol.
    Definition in the SAPscript form:
    /: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
    /: USING &PAGE&
    /: USING &NEXTPAGE&
    /: CHANGING &BARCODE&
    /: ENDPERFORM
    / &BARCODE&
    Coding of the calling ABAP program:
    REPORT QCJPERFO.
    FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
    OUT_PAR STRUCTURE ITCSY.
    DATA: PAGNUM LIKE SY-TABIX, "page number
    NEXTPAGE LIKE SY-TABIX. "number of next page
    READ TABLE IN_PAR WITH KEY ‘PAGE’.
    CHECK SY-SUBRC = 0.
    PAGNUM = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.
    CHECK SY-SUBRC = 0.
    NEXTPAGE = IN_PAR-VALUE.
    READ TABLE OUT_PAR WITH KEY ‘BARCODE’.
    CHECK SY-SUBRC = 0.
    IF PAGNUM = 1.
    OUT_PAR-VALUE = ‘|’. "First page
    ELSE.
    OUT_PAR-VALUE = ‘||’. "Next page
    ENDIF.
    IF NEXTPAGE = 0.
    OUT_PAR-VALUE+2 = ‘L’. "Flag: last page
    ENDIF.
    MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    regards,
    veeresh

  • Query regerding Sapscript : Calling abap subroutines

    Hello everybody
    Hope everyone is doing fine.
    I've a small query. Whenever we require to call an abap subroutine from an abap sapscript we do the same using PERFORM statement. The syntax for the same is as below:
    PERFORM SUBROUTINE_NAME IN PROGRAM PROGRAM_NAME
    USING &VARAIABLE&
    CHANGING &VARAIABLE&
    ENDPERFORM
    Here we are passing the varaiables to the subroutine and getting back values in varaibles. In the actual program we then read values from in_tab and out_tab having structures similar to itcsy.
    The above mentioned is as per my understanding. My query is as follows:
    If in the above statement instead of passing varaibles abnd getting back variables can be pass/get back an internal table?
    I had read somewhere that it is possible using structures. If anyone is aware of how to do the same can you please give me the syntax. Actually how to get value from subroutine into an internal table. What will be the structure? Will it be same as itcsy?
    Thanks a lot to everybody in advance.
    Thanks & Regards
    Kabir Radhakrishnani

    hi check this program!!!
    REPORT Z_TEST_VBBE .
    types : begin of t_vbap ,
             VBELN like vbap-VBELN,
             posnr like vbap-posnr,
             concat(18),
            end of t_vbap.
    tables : vbap .
    select-options : s_vbeln for vbap-vbeln .
    data : it_vbap type table of t_vbap ,
           wa_vbap type t_vbap.
    select vbeln posnr from vbap into table it_vbap
    where vbeln in s_vbeln .
    " group by vbeln.
    loop at it_vbap into wa_vbap .
      perform select_data using wa_vbap-vbeln
                                wa_vbap-posnr
                       changing wa_vbap-concat      .
      modify it_vbap from wa_vbap .
    endloop .
    *&      Form  select_data
    *form select_data using vbeln type vbap-vbeln
                          posnr type vbap-posnr
                          concat.
    *endform.                    " select_data
    *&      Form  select_data
    form select_data using    p_wa_vbap_vbeln
                              p_wa_vbap_posnr
                     changing p_wa_vbap_concat.
             concatenate p_wa_vbap_vbeln
                         p_wa_vbap_posnr
                    into p_wa_vbap_concat
                    separated by '|' .
    endform.                    " select_data

  • Problem in calling ABAP Subroutine from SAPSCRIPT

    Hi,
    I need to get the reason for cancellation of a Business Even in Training & Event Management module, so I am passing Emp_id.
    But the reason(CAAATRT) is returned with blank by the code.
    please help.
    /:DEFINE &EMP_ID&= &PPVAR-TOBJD&
    /:PERFORM HR_REASON_PRINT IN PROGRAM ZHR_REASON_PRINT
    /:USING &EMP_ID&
    /:CHANGING &CAATRT&
    REPORT  ZHR_REASON_PRINT.
    DATA : BEGIN OF in_par OCCURS 10.
            INCLUDE STRUCTURE itcsy.
    DATA : END OF in_par.
    DATA : BEGIN OF out_par OCCURS 0.
            INCLUDE STRUCTURE itcsy.
    DATA : END OF out_par.
    DATA:   TOBJD TYPE PPVAR-TOBJD,
            ADATANR TYPE HRP1001-ADATANR,
            CAATR TYPE HRPAD25-CAATR,
            CAATRT TYPE T77CART-CAATRT,
            EMP_ID TYPE C.
    TABLES     : PPVAR,
             HRP1001,
             HRPAD25,
             T77CART.
    FORM HR_REASON_PRINT TABLES input output.
    in_par[] = input[].
    out_par[] = output[].
    READ TABLE in_par INDEX 1.
    CHECK sy-subrc = 0.
    TOBJD = in_par-value.
    MOVE in_par-value TO TOBJD.
    SELECT ADATANR
    into ADATANR
    FROM HRP1001
    WHERE OBJID EQ TOBJD.
    ENDSELECT.
    SELECT CAATR
    into CAATR
    FROM HRPAD25
    WHERE ADATANR EQ ADATANR.
    ENDSELECT.
    SELECT CAATRT
    INTO CAATRT
    FROM T77CART
    WHERE CAATR EQ CAATR.
    ENDSELECT.
    REFRESH out_par.
      out_par-name = 'DREASON'.
      move CAATRT To out_par-value.
      MODIFY out_par INDEX 1.
    APPEND out_par.
      output[] = out_par[].
    Thanks
    Ramakrishna

    Hi ramakrishna,
    1. while calling subroutines from sapscripts,
    there is a special technique,
    which has got its own limitations.
    2.
    FORM abc
    TABLES
    in_tab STRUCTURE itcsy
    out_tab STRUCTURE itcsy.
    ENDFORM.
    3. The perform in se38 program should be of the
    above format only.
    4. We cannot pass internal tables.
    5. Rather we need to pass
    VARIABLE NAME
    VARIABLE VALUE
    (see the structure of itcsy in se11)
    6. In this form, we have to read
    the internal table in_tab
    to capture the variable name and its value.
    7. Similary, to return the values,
    we have to put one record (for each variable)
    in out_tab.
    regards,
    amit m.

  • Call compiled LabView from Delphi

    Argh!  I've done this already, but try as I can, I can't remember how, nor can I find my simple example!
    I have a Delphi program that needs to communicate with my LabView app.  The LabView app will be compiled into a standalone executable using the LabView (V7.1.1) Application Builder, as the target machines will not have LabView installed; hence, I can't take the approach of automating LabView.
    For discussion purposes, the LabView app has a string control and a "go" button as controls, and a string indicator for indicators.  The Delphi client supplies an XML fragment as a text string to the LabView app's string control, then "hits" the go button.  The LabView app then processes the XML fragment, and outputs the results to the string indicator.
    The LabView app is contained in a VI that has the aforementioned controls and indicator as input and output terminals, and has been compiled into an application with the "Enable ActiveX server" option selected.  The Delphi app is built using Delphi 2007 for Windows.
    How exactly do I import the LabView app into the Delphi programming environment?  I've tried many things, have gotten close, but I'm not sure if I've got it right.  I can connect to the LabView app, in that running the Delphi app starts up the LabView app, but I can't access the VI's controls or indicators.
    How do I access the VI's controls and indicators from Delphi?
    How do I simulate a button press?
    This is very frustrating, as I had prototyped this six months ago!
    Thanks for any help!
    -Bob

    Hi Donovan,
    donovanb wrote:
    Hi Bob,
    You can use LabVIEW as an ActiveX Server, and thus expose properties and methods to ActiveX client applications, such as the Delphi app you're referring to.  You can read and write front panel controls/indicators through the LabVIEW ActiveX Server interface, and it seems like this is what you are looking for.
    Yes, that is exactly what I am looking for!  Right now, I can only "see" a few, very generic methods, such as the GetVIReference() function in my second post.  What I don't get is what to do with my "newapp" variable; how to I access the front panel controls and indicators?
    Looking back at my second post, it seems the VI.Call may not really be the right thing to do, is that right?  I have demonstrated to myself that the newapp.Connect call starts the LabView app - so then, I suppose the VI.Call is illegal, as the VI is already started - is that correct?
    So I'm guessing that, after newapp.Connect, all I need to do is read/write the front panel controls/indicators, right?
    But how?!!!
    I'm not aware of a way to insert a LabVIEW front panel into an ActiveX container in another application, but even if you could, you would still need to use the ActiveX Server interface to actually access the data by the rest of the Delphi program.
    That would be cool, but not necessary.  Probably, I'll end up bringing the LabView app to front, and just using its front panel as is.  That said, if someone know how...
    The LabVIEW application doesn't even need to display the front panel, but can instead be called by the Delphi program, run in the background, and be polled/updated when needed by the Delphi application.
    That's the other possibility...
    Thanks!
    -Bob

  • Calling functions / subroutines

    Hi,
    Can Mathscript handle functions subroutines?  In the Mathscript window I get the error message
    "unexpected token: function"
    For example:
    function y = xx(a, b, c)
    return
    where xx is being called from the main program.
    Thanks in advance

    Hi,
    Yes, you can invoke user-defined function in either MathScript Window or MathScript Node. You can use path or addpath to specify the search path list. Another way to specify the search path list is in LabVIEW Options. Find it at Tools->Options ...->MathScript: Search Paths.

  • Calling a subroutine referenced in a variable?

    Can anyone tell me if there is any way in AppleScript to store a subroutine reference in a variable in such a way that the variable can then be used as though it were a subroutine itself? As an experiment, I tried this:
    set selectedSub to a reference to Flip
    set x to selectedSub()
    set selectedSub to a reference to Flop
    set y to selectedSub()
    display dialog x & "/" & y
    on Flip()
    return "Flip"
    end Flip
    on Flop()
    return "Flop"
    end Flop
    I was rather hoping that this would cause the message "Flip/Flop" to be displayed, but it doesn't work. I think, however, that it illustrates what I'm trying to do: I have a situation where I want to call one of several subroutines. I could use an if/else if/else if/etc. structure to select which subroutine, but for my application it would be much more elegant to set a variable to reference one of about a dozen subroutines, and then use the variable as though it were a subroutine name. Is this possible?
    Thanks in advance.

    Wow, three helpful answers at one go. I hope you don't mind if I reply to you all in a bunch, because your answers all sort of affected my ultimate solution.
    osimp: I was certain you had solved my problem for about an hour, because your answer certainly produces the correct answer: Flip/Flop. But eventually I noticed that
    set selectedSub to Flip()
    is indistinguishable from an ordinary subroutine call. So I decided to look at the class of the object selectedSub:
    set selectedSub to Flip()
    display dialog class of selectedSub as string
    This displays the class "string" which, in spite of its eventually producing the correct answer, was not what I was hoping for: an interesting example of confirmatory bias on my part.
    Comparing this to Hiroto's first suggestion:
    set selectedSub to Flip
    display dialog class of selectedSub as string
    I find that now selectedSub is an object of class "handler" which is more like what I was hoping for. Actually, I didn't know there was a class "handler" but it makes sense. I haven't tried all of Hiroto's scripts -- I'm going to need a bit of time before I understand what precisely is going on in a couple of them -- but the first one definitely nails the problem.
    Camelot's suggestion of embedded scripts is also good, but it sent me back to the AppleScript Language Guide because I skipped the chapter on script objects the first time around. The only problem I see is that it works fine with my example subroutines of Flip and Flop because they have no parameters, but, if I'm following the chapter on script objects correctly, while handles take parameters, script objects don't. I tried to think of a way around this and came up with this:
    set selectedScript to Flip
    set x to theSub("I am") of selectedScript
    set selectedScript to Flop
    set y to theSub("I am") of selectedScript
    display dialog x & "/" & y
    script Flip
    on theSub(prefix)
    return prefix & space & "Flip"
    end theSub
    end script
    script Flop
    on theSub(prefix)
    return prefix & space & "Flop"
    end theSub
    end script
    This displays "I am Flip/I am Flop" which is what I was hoping for. The only caution is that both embedded scripts must have a handler named the same: in this case, theSub. I've also discovered that selectedScript is an object of class "script" while theSub of selectedScript is of class "handler" which makes perfect sense, and I think I'm really beginning to understand what's going on.
    Thanks to all.

  • Call Standard subroutine in Z-FM

    Hi Experts,
    I wanted to call one subrotine of standard program to my Z-function module. Can anybody will suggest me how I can achieve this requirement?
    Thanks,
    Neha
    Edited by: neha gupta on Mar 9, 2009 5:58 AM

    Hi,
    Perfrom <Subroutine Name>(<Program name>)  Table ...
                                                                           using....
                                                                           Changing...
    Example..
        PERFORM re510a_tartx(sapfhcmp)
                             USING    tcs_masterdata_wa-molga
                                      tcs_masterdata_wa-trfar
                             CHANGING tcs_masterdata_wa-trfar_text.
    Edited by: Avinash Kodarapu on Mar 9, 2009 10:30 AM

  • Calling fortran subroutine from C in sunstudio

    I am using Sun Studio 12 under Linux,
    Could anyone give me an example project which shows how to use a fortran subroutine in C.
    For example in the project "application_1" I have 2 source codes one with .c and the other one with .f90 extension. The main source is the C code but this one call a fortran subroutine "mysub". I am going to do it in a project in Sun Studio not via command line.
    Thanks.

    Refer to Chapter 11 "C-Fortran Interface" in the Fortran Programming Guide:
    [http://docs.sun.com/app/docs/doc/819-5262/aeuku?a=view]

  • Can I call c subroutines from xml

    I want to do XML to XML conversion by filtering the content based on a variable which is calculated in a C program. I want to know that wheather this variable of C can be taken on the fly to an XML file from where I can test it using XSL if condition.
    Please post your valuable sugessions.

    What is the problem with the Java Stored Procedures calling a URL ?
    Can you give me more details on this.
    For calling a C function from pl/sql you can use external procedures. please give me your email id so that ,I can send you more details on this.

  • Calling a Subroutine

    Hi Experts
    I have the requirement as follows:
    When I press /N or Exit Button(Yellow Arrow) from the screen, it shoud trigger a subroutine to reset some variables or entries.
    How to do this?
    Rewardable
    Santo!

    Hi
    TABLES kna1.
    *-- Declaring the structure,internal table and workarea for Kna1 table.--*
    TYPES:BEGIN OF st_kna1,
          kunnr TYPE kna1-kunnr,
          name1 TYPE kna1-name1,
          ort01 TYPE kna1-ort01,
          pstlz TYPE kna1-pstlz,
          regio TYPE kna1-regio,
          stras TYPE kna1-stras,
          END OF st_kna1.
    DATA:wa_kna1 TYPE st_kna1,
         it_kna1 TYPE STANDARD TABLE OF st_kna1.
    --MODULE user_command_0100 INPUT--
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'DISPLAY'.
          SELECT kunnr
                 name1
                 ort01
                 pstlz
                 regio
                 stras
             FROM kna1
             INTO TABLE it_kna1
             WHERE kunnr = kna1-kunnr.
          IF sy-subrc EQ 0.
            LOOP AT it_kna1 INTO wa_kna1.
              kna1-kunnr = wa_kna1-kunnr.
              kna1-name1 = wa_kna1-name1.
              kna1-ort01 = wa_kna1-ort01.
              kna1-pstlz = wa_kna1-pstlz.
              kna1-regio = wa_kna1-regio.
              kna1-stras = wa_kna1-stras.
            ENDLOOP.
          ELSE.
            MESSAGE i001.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
          when 'EXIT'.
          PERFORM LEAVING_SCREEN.
      ENDCASE.
    ENDMODULE.                    "USER_COMMAND_0100 INPUT
    --Module  STATUS_0100  OUTPUT--
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'S0100'.
      SET TITLEBAR 'S100'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  LEAVING_SCREEN
          text
    -->  p1        text
    <--  p2        text
    form LEAVING_SCREEN .
    LEAVE PROGRAM.
    endform.                    " LEAVING_SCREEN

Maybe you are looking for