How to collect returns from recursive function calls without a global var?

Usually global variables shouldnt be used, I was told. Ok. But:
How can I avoid using a global var when recursively using a function, when the function returns an object and when I want to have the collection of all these objects as the result?
For example, I think of determine the users of a group including group nesting. I would write a function that adds the direct group members to a collection as a global var and call itself recusively if a member is another group. This recursively called function
would do as well: Update the global var and if needed call itself.
I'm afraid this is no good programming style. What algorithm would be better, prettier? Please dont focus on the example, it is a more general question of how to do.
Thanks
Walter

I rarely needed to create/use recursive functions. Here's one example I did:
function New-SBSeed {
<#
.Synopsis
Function to create files for disk performance testing. Files will have random numbers as content.
File name will have 'Seed' prefix and .txt extension.
.Description
Function will start with the smallest seed file of 10KB, and end with the Seed file specified in the -SeedSize parameter.
Function will create seed files in order of magnitude starting with 10KB and ending with 'SeedSize'.
Files will be created in the current folder.
.Parameter SeedSize
Size of the largest seed file generated. Accepted values are:
10KB
100KB
1MB
10MB
100MB
1GB
10GB
100GB
1TB
.Example
New-SBSeed -SeedSize 10MB -Verbose
This example creates seed files starting from the smallest seed 10KB to the seed size specified in the -SeedSize parameter 10MB.
To see the output you can type in:
Get-ChildItem -Path .\ -Filter *Seed*
Sample output:
Mode LastWriteTime Length Name
-a--- 8/6/2014 8:26 AM 102544 Seed100KB.txt
-a--- 8/6/2014 8:26 AM 10254 Seed10KB.txt
-a--- 8/6/2014 8:39 AM 10254444 Seed10MB.txt
-a--- 8/6/2014 8:26 AM 1025444 Seed1MB.txt
.Link
https://superwidgets.wordpress.com/category/powershell/
.Notes
Function by Sam Boutros
v1.0 - 08/01/2014
#>
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Low')]
Param(
[Parameter(Mandatory=$true,
ValueFromPipeLine=$true,
ValueFromPipeLineByPropertyName=$true,
Position=0)]
[Alias('Seed')]
[ValidateSet(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)]
[Int64]$SeedSize
$Acceptable = @(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)
$Strings = @("10KB","100KB","1MB","10MB","100MB","1GB","10GB","100GB","1TB")
for ($i=0; $i -lt $Acceptable.Count; $i++) {
if ($SeedSize -eq $Acceptable[$i]) { $Seed = $i }
$SeedName = "Seed" + $Strings[$Seed] + ".txt"
if ($Acceptable[$Seed] -eq 10KB) { # Smallest seed starts from scratch
$Duration = Measure-Command {
do {Get-Random -Minimum 100000000 -Maximum 999999999 |
out-file -Filepath $SeedName -append} while ((Get-Item $SeedName).length -lt $Acceptable[$Seed])
} else { # Each subsequent seed depends on the prior one
$PriorSeed = "Seed" + $Strings[$Seed-1] + ".txt"
if ( -not (Test-Path $PriorSeed)) { New-SBSeed $Acceptable[$Seed-1] } # Recursive function :)
$Duration = Measure-Command {
$command = @'
cmd.exe /C copy $PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed $SeedName /y
Invoke-Expression -Command:$command
Get-Random -Minimum 100000000 -Maximum 999999999 | out-file -Filepath $SeedName -append
Write-Verbose ("Created " + $Strings[$Seed] + " seed $SeedName file in " + $Duration.TotalSeconds + " seconds")
This is part of the SBTools module and is used by the
Test-SBDisk function. 
Example use:
New-SBSeed 10GB -Verbose
Test-SBDisk is a multi-threaded function that puts IO load on target disk subsystem and can be used to simulate workloads from multiple machines hitting the same SAN at the same time, and measure disk IO and performance.
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

Similar Messages

  • Validation of recursive function call fails

    We want to use a call to a recursive function from a HTMLDB application. It should be used in a page region to generate a query string ("PL/SQL function body returning SQL query"). Everything works fine with a call to a non-recursive function. The recursive function also works fine when called from SQL+.
    After pressing "Apply changes" on "HTML DB Home>Builder - Application 148>Page Definition>Edit Page Region"-page I get the following error message after a long delay:
    Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing
    (ORA-00600: internal error code, arguments: [kohdtf048], [], [], [], [], [], [], [])
    I assume that the validation routine follows the recursion until the memory limit is reached.
    Please give me a hint how to solve this problem.
    DB version: 10.1.0.2.0
    HTMLDB version: 1.5.0.00.33
    running on Win2000 server

    Since the original function is confidential, I have created a simple one showing the same behavior (and the same error). Termination does not depend on session state:
    Called function (to replace spaces with #):
    create or replace function MF_Test
         p_querystring     varchar2     
         return varchar2 is
         v_position integer;
    begin
         v_position:=instr(p_querystring,' ');
         if v_position=0 then     /* termination condition */
              return p_querystring;
         else
              return substr(p_querystring,1,v_position-1)||'#'||MF_Test(substr(p_querystring,v_position+1));
         end if;
    end MF_Test;
    calling function (from the page region, to generate a query string):
    declare
    q varchar2(500);
    begin
    q:='select * from hardware where model=''';
    q:=q||mf_test(:P3_SEARCH);
    q:=q||'''';
    end
    Validation seems not to terminate in case of recursive function calls.
    Thanks for your input.

  • Help!! recursive function call

        *   The function which build the category tree
        public String categoryTree(Statement stat, boolean isMore, int id) {
            if(!isMore) {
                return "";
            else
               String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
                            " t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
                            " t_category_item, t_category_relation " +
                            " where " +
                            " t_category_item.category_item_id = t_category_relation.category_item_id and " +
                            " t_category_relation.parent_id = " + id + " and t_category_relation.parent_id<>0";
    //           return sql;
               try{
                   ResultSet res = stat.executeQuery(sql);
                   String spacer = "";
                   String input = "";
                   while(res.next()) {
                        int level = res.getInt(2);
                         id = res.getInt(1);
                         for(int i = 0; i < level; i ++) {
                            spacer +="   ";
                         input ="+ id: " +id + " NAME  " + res.getString(4) + "\n</td>\n<td align=center>\n<input type=checkbox value=" +String.valueOf(id) + " name=categoryid>\n</td>\n</tr>\n";
                         return "\t\t<TR>\n\t\t\t<TD>" + spacer + input + categoryTree(stat, true, id);
                   if(spacer.equals("")){
                        return input+categoryTree(stat, false, id);
                }catch(SQLException e) {
                        return "SQL Exception";
                return categoryTree(stat, false, id);
        }I am writing a menu generated base on a tree like relation ship that is store in a database. assume
    vegetable has two child and one of the child has another child and so forth.
    But I am getting a result like this:
    vegetable-->
    <1>childe
    <1.1>childe
    but missing <2>child
    because the while loop doesn't continous looping after the 1.1.
    please help me out
    thanx in advance

    >
    Re: help!! recursive function call
    Author: DrClap Aug 3, 2001 1:15 PM
    When you call the method recursively, the second call makes a second query to the database, before you have finished using the ResultSet from the first query. Since you are using the same Statement, executing the second query causes the first query to, um, disappear.
    The API documentation for java.sql.Statement says this: "Only one ResultSet object per Statement object can be open at any point in time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All statement execute methods implicitly close a statment's current ResultSet object if an open one exists."
    thanx for your reply!
        public String categoryTree(int id) {
               String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
                            " t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
                            " t_category_item, t_category_relation " +
                            " where " +
                            " t_category_item.category_item_id = t_category_relation.category_item_id and " +
                            " t_category_relation.parent_id = " + id;
               try{
                   Connection con = DataSourceUtil.getConnection("name");
                   Statement stat = con.createStatement();
                   ResultSet res = stat.executeQuery(sql);
                   String spacer = "";
                   String row = "";
                   while(res.next()) {
                        int level = res.getInt(2);
                         id = res.getInt(1);
                         for(int i = 0; i < level; i++) {
                            spacer +="   ";
                        row = " \t\t<tr>\n " +
                              " \t\t\t<td colspan='2'>" + spacer + " <a href=inventory_edit_product.jsp?categoryid=" + id +">" + res.getString(4) + "</a></td>\n" +
                              " \t\t</tr>\n ";
                         return (row + categoryTree(id));
                   con.close();
                }catch(SQLException e) {
                        return "<tr><td colspan=2>SQL Exception</td></tr>";
                return "";
        }New I think every recursive call will have it's own statement and resultSet but I am still getting same problem. The while loop stopped when calls reached first base case. Does anybody know why. I expect, assume that while loop will go next when a call reaches the base case which will return "".
    Thanx for help

  • Exiting from SQLPLUS on failure returned from a function

    I am working on Oracle 11g (R2). I want to call a function in package and if that function returns zero then I want to quit/exit from SQLPLUS prompt.
    I will be calling that function of package from an .sql file.
    How can i do this?
    I can also call raise_application_error() from that function. Without using WHENEVER SQLERROR EXIT, is there any way of doing this?

    Thanks, but if i am calling that function from a .sql file, can i verify the return value and exit from sqlplus prompt.

  • How do I escape from receiving unsolicited calls

    How do I escape from receiving unsolicited calls from overseas females who want to connect,ShaneShane

    You have to tap on the "x" button on the search box to clear the search or go back to an empty search box. I hope that answered your question, if not..i would like you to please elaborate more on the question.

  • How to transfer files from mac to ipad without using itunes

    how to transfer files from mac to ipad without using itunes ???
    as i want to use my ipad for official use as well...please suggest..

    well to be 100% technical, no you didn't but that aside, it good to know there are ways for people to transfer music into the default apps without iTunes, if they have a need.
    I tend to use 3rd party apps for documents, like your mentioned iExplorer etc, which are handy.
    I see from a search the two "apps" you mentioned are not iOS apps, which I had assumed, SyncPod and FreeSync are apps for your computer, that would explain their access to the default Music/Video apps.
    I had wondered how Apple had allowed iOS apps in the store that could get around the sandboxing in iOS of apps.
    Message was edited by: CGW3

  • How can I print from my ipad air without buying a new "air print" compatable printer?

    How can I print from my ipad air without buying a new "air print" compatable printer? I currently have a HP Photosmart plus B210. Can I make that work?

    Although you have posted in a Mavericks forum, implying that you have a Mac computer, your profile doesn't say that you have one. Printer Pro requires the printer to be connected to a Mac.

  • HT4623 How to downgrade iPhone from ios6 to ios5 without jailbreaking?

    How to downgrade iPhone from ios6 to ios5 without jailbreaking?
    It is uncomfortable to use Appstore and uninformative Apple maps.
    I regret, that I updated my iOS5, can I get it back?

    Sadly, Apple is amazingly good at keeping users from downgrading an iPhone. For some reason, a prior update (5.1.1) bricked my 3GS, and that's how I learned the hard way how firmly Apple had control of the upgrade/downgrad process. I find that annoying, as well as the fact that Apple "pushes" (figureatively and literally) updates on users, many of whom simply update immediately, without realizing there could be a downside. I've been amazed at how many non-techy iPhone using friends have complained to me about maps, and they wish they had never updated to iOS 6.
    Anyway, I'm still using iOS 5 on my iPhone 4S, as I just feel too attached to my good old Google-based Map app (and the web version of Google Maps is really very different than the App version -- I tried it, thinking I would finally update my iPhone, but was really dissatisfied with the web version). I do know iOS 6 is superior in many ways, but for now, I am just that attached to my good old Map app.

  • PowerShell: Possible to return a DataReader object from a function call

    I have to interact with several different db's.  I was wondering how I could use a common Function for the connection and commnad params and have it return a DatReader object that I then could evaluate?
    Example: (psuedo-code)
    Function SqlCmd(Db, instance, command) {... return <DataReader onject>}
    $Datareader= SqlCmd Db instance command
    if ($Datareader.HasRows) {..to something..}
    Thanks
    TR

    Hi TR,
    This is possible by using the Dot.Net Sql objects. Below is a small function which takes a connection string and a SQL query string and returns a DataReader object:
    function
    Get-SQLData()
    param (
       [string]$sqlConnectionString,
       [string]$query
    # Create a connection to the OLAP Database
    $connection
    =
    New-Object
    System.Data.SqlClient.SqlConnection
    $sqlConnectionString
    $connection.Open()
    if (!$?)
    {throw
    "Could not open the connection."}
    $command
    =
    New-Object
    System.Data.SqlClient.sqlCommand
    $query,
    $connection
    $dataReader
    =
    $command.ExecuteReader()
    ,$dataReader
    The most important thing to note in this entire function in the comma in front of the $dataReader at the end of the function. As PowerShell implicitly tries to unpack collection objects, this comma forces the collection to
    be returned intact allowing you to use it as required. So here is an example of usage:
    $dr
    =
    Show-SQLData
    $sqlConnectionString
    $query
    if ($dr.HasRows)
       while ($dr.Read())
    "$($dr[0]) $($dr[1]) $($dr[2])"
    Hope that helps!
    Chris

  • Dynamic return from a function based on an argument

    I have a function that I am using to output a nested list of
    child/parent relationships
    the function works wonderfully except that i want to be able
    to change the way the list is displayed depending on an argument
    being passed
    i want the list to be displayed twice on the same page, one
    with output in a table, and one with output in a drop down box
    i thought the easiest way would be to create an argument that
    can be used in IF statements
    look at my code below
    quote:
    <!--- establish default values --->
    <cfparam name="output" default="">
    <cfparam name="catNameOutput" default="">
    <cfparam name="indent" default="">
    <cffunction name="GenerateCategories" access="public"
    returntype="string">
    <!--- this holds the outermost parent value being passed
    to the function --->
    <cfargument name="GenCatParent" type="uuid"
    required="yes" default=0 >
    <!--- this holds the nested level we are on --->
    <cfargument name="level" type="numeric" required="yes"
    default=0 >
    <!--- this holds the output_type we need for display
    purposes --->
    <cfargument name="output_type" type="numeric"
    required="yes" default=0 >
    <!--- grab the children of the received category --->
    <cfquery name="rsCategoryChildren"
    datasource="webdsn">
    SELECT * FROM dbo.BlogCategories
    WHERE catParent = '#GenCatParent#'
    ORDER BY catName ASC
    </cfquery>
    <cfloop query="rsCategoryChildren">
    <!--- keep track of the indentation needed depending on
    which level we are at --->
    <cfloop from="0" to="#arguments.level#" index="i">
    <cfset indent = indent & "  ">
    </cfloop>
    <!--- if the nest is being used in the dropdown on the
    category manage page, we need to use option tags --->
    <cfif arguments.output_type EQ 1>
    <cfset catNameOutput = "<option value='" & catPK
    & "'>" & indent & Trim(catName) &
    "</option>">
    </cfif>
    <!--- if the nest is being used in the table on the
    category manage page, we need to use table row tags --->
    <cfif arguments.output_type EQ 2>
    <cfset catNameOutput = "<tr>
    <td>edit</td> <td>delete</td> <td>"
    & indent & Trim(catName) & "</td>
    </tr>">
    </cfif>
    <cfset output = output & catNameOutput>
    <!--- reset the indentation --->
    <cfset indent = "">
    <!--- check for children of this child --->
    <cfquery name="checkForKids" datasource="webdsn">
    SELECT * FROM dbo.BlogCategories
    WHERE catParent = '#rsCategoryChildren.catPK#'
    ORDER BY catName ASC
    </cfquery>
    <!--- if there are any, call this function recursively
    --->
    <cfif checkForKids.recordcount GT 0>
    <cfset GenerateCategories(genCatParent=catPK, level =
    level +1, output_type = arguments.output_type)>
    </cfif>
    </cfloop>
    <cfreturn output>
    </cffunction>
    <cfquery name="rsCategoryParents" datasource="webdsn">
    SELECT * FROM dbo.BlogCategories
    WHERE catParent IS NULL
    ORDER BY catName ASC
    </cfquery>
    and here is how i am calling the function for each situation
    (the table and the dropdown):
    quote:
    <table width="100%" class="managementtable">
    <tr bgcolor="#F6F6F6">
    <td> </td>
    <td> </td>
    <td>Category Name</td>
    </tr>
    <cfloop query="rsCategoryParents">
    <cfoutput><tr> <td>edit</td>
    <td>delete</td> <td>#Trim(catName)#</td>
    </tr></cfoutput>
    <cfset recursivecats =
    GenerateCategories(genCatParent=catPK,level=0,output_type=2)>
    <cfoutput>#recursivecats#</cfoutput>
    </cfloop>
    </table>
    <!---------------------------------------------------------------------------->
    <select name="select">
    <option>None</option>
    <cfoutput query="rsCategoryParents">
    <option value="#catPK#">#Trim(catName)#</option>
    <cfset recursivecats =
    GenerateCategories(genCatParent=catPK,level=0,output_type=1)>
    #recursivecats#
    </cfoutput>
    </select>
    calling the function for the table and the dropdown on the
    same page does not work
    if the function is first called with the argument for table,
    it tries to also output the table formatted code when the function
    is called again (even if it is called again with the argument for
    dropdown)
    is there another way i can have the same function output two
    different sets of data based on an argument? what am i doing wrong
    thanks for your time

    sjlsam2,
    Yeah, I think the main problem you had was a scoping one. For
    the second function call, the output variable already contained all
    of the output code from the first function call. In fact, I
    wouldn't be surprised to find that the output string for the second
    function call contained the output of the first plus the output of
    the second, and that it didn't render correctly on screen. A
    View Source would have determined that.
    Anyhow, I suggest that you VAR your output variable as
    cf_dev2 suggests, and delete the three CFParam lines at the top.
    Further, your recursive call would therefore need to return it's
    result to the output variable, thus completing the recursive loop.
    See below:
    <!--- this holds the output_type we need for display
    purposes --->
    <cfargument name="output_type" type="numeric"
    required="yes" default=0 >
    <CFSet Var Output = "">
    <CFSet Var catNameOutput = "">
    <CFSet Var indent= RepeatString("  ",
    Arguments.Level)>
    <!--- grab the children of the received category --->
    <cfquery name="rsCategoryChildren" datasource="webdsn">
    SELECT * FROM dbo.BlogCategories
    and
    <!--- if there are any, call this function recursively
    --->
    <cfif checkForKids.recordcount GT 0>
    <cfset
    Output = Output & GenerateCategories(genCatParent=catPK,
    level = level +1, output_type = arguments.output_type)>
    </cfif>
    </cfloop>
    This is what I suggest with your code. HTH :)
    Swift

  • [SOLVED] How to use return parameter of function as paramter of table?

    Hi all,
    As continue of post "ADF Faces: how to execute pl/sql function when page is loaded." I came up with an other problem where I can't find an easy solution for.
    The problem is easy.
    1) I execute a procedure, this returns a value
    2) I have a table which needs one input parameter
    3) How can I bind the return value of the procedure to the input paramter of the table:
    A simple example:
    1) I created a pl/sql function that returns 1
    CREATE FUNCTION zz_return_1
    is
    RETURN NUMBER
    BEGIN
      RETURN 1
    end;2) I exposed the function in my TestModule so I can use it on a jps page.
    3) I created a table TEST_PARAM_1_TABLE with two columns: a, b
    4) I created a view read-only object with one paramter
    SELECT a,b
    FROM zz_scn_test_tab
    where a = :var_15) I added the view object to a jps page as tabe > adf read-only
    6) I added a methodAction and invokeAction to execute the function on page load
    <executables>
          <iterator id="zzscntest1Iterator" RangeSize="10" Binds="zzscntest1"
                    DataControl="TestModuleDataControl"/>
                <invokeAction id="runProc" Binds="ftn_return_1"/>
          </executables>
    <bindings>
          <methodAction id="ftn_return_1"
                        InstanceName="TestModuleDataControl.dataProvider"
                        DataControl="TestModuleDataControl"
                        MethodName="ftn_return_1" RequiresUpdateModel="true"
                        Action="999" IsViewObjectMethod="false"
                        ReturnName="TestModuleDataControl.methodResults.TestModuleDataControl_dataProvider_ftn_return_1_result"/>
          <table id="zzscntest1" IterBinding="zzscntest1Iterator">
              <AttrNames>
                  <Item Value="A"/>
                  <Item Value="B"/>
              </AttrNames>
          </table>
    </bindings>how can I bind the return value of the function to the var_1 variable of the table?
    Additional to this: Is there a way to store the return value in a managed bean?
    for example: if I create a managed bean:
    public class globalVars {
        private Number ftnReturnValue;
        public globalVars() {
        public void setFtnReturnValue(Number ftnReturnValue) {
            System.out.println("return value is set to: " + ftnReturnValue);
            this.ftnReturnValue = ftnReturnValue;
        public Number getFtnReturnValue() {
            return ftnReturnValue;
    }how to store the return value in this ftnReturnValue variable?

    Thanks to Frank,
    I finally got it to work!
    For those with the same problem, this is what I did:
    - I created a VO material_details with one parameter :sequence_num
    - I created a master/detail viewlink from my materials list to the materials_details
    - In the application module, I created a call to the procedure, and within this procedure, I set the sequence_num variable.
        public Number f_ltf3_adf_syf_init(String reporting_group
                                         , String username
                                         , String RAG_code
                                         , String ABC_class
                                         , String SBU_code){
           CallableStatement st = null;
           String stmt = "M_LTF3_SFM_CALC.f_ltf3_adf_syf_init('"+ reporting_group
                                                           +"','"+ username
                                                           +"','"+ RAG_code
                                                           +"','"+ ABC_class
                                                           +"','"+ SBU_code+"')";
           try {
               // prepare the statement
               st = getDBTransaction().createCallableStatement("begin ? := "+stmt+";end;",0);
               st.registerOutParameter(1,2);  // register output parameter as Number
               //execute the statement
               st.executeUpdate();
               //set paramter in detail VO of master/view
               getLtfSyfRevDetails1().setNamedWhereClauseParam("session_seq", (Number)st.getObject(1));
               return (Number)st.getObject(1);
           }catch (Exception e){e.printStackTrace();}
           return null;
        }

  • How to get BOOLEAN from STORED FUNCTION

    We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
    FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
    Where the return type is BOOLEAN calling the named query fails with
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    A couple of threads have hinted that what we are trying to do is not possible:
    How to get BOOLEAN from STORED PROCEDURES
    Re: Creating Named Query: from OracleCallableStatement
    This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
    thanks

    I can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
    TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
      DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
            returnField.setName(name);
            returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
    Best Regards,
    Chris

  • How to execute FM from Javascript function?

    Hi All,
    I have a requirement to execute ABAP FM from Javascript function in BSP Application.
    How do I implement this?
    Is there any document/link in SDN?
    Thanks
    Thruna Shanmuga

    Hi,
    When button is clicked capture the event in OnInPutProcessing and call the function module.
    In layout mention the java code
    Here is a sample code:
    Layout Code:
    < script >
    document.on keydown=function( )
    if (event.key Code==13)
    htmlb SL(this,2,'get') Mention the button ID
    < /script >
      <htmlb:button id      = "get"
                             text    = "Execute"
                            width   = "35%"
                            on Click = "On InputProcessing()" />
    OnInPutProcessing Code:
    data:
      w_event type ref to cl_htmlb_event,
    call method cl_htmlb_manager=>get_event
      exporting
        request = runtime->server->request
      receiving
        event   = w_event.
    case w_event->id.(To capture the event)
    when 'get'.
    <<Call the function module>>
    endcase.
    Hope this solves the issue, Let me know if any queries.
    Regards,
    Rajani

  • I just upgraded on May 11 and find I cannot open a fold for bookmarks. I research and bookmarks are my lively hood. How can I return the bookmark functionality?

    MS 7 and long time user of Firefox so this is the recent upgrade of May 11. Unlike the prior bookmark functionality, I cannot indicate I want to bookmark a link and designate a new folder for a new topic in two to three clicks. This is critical to what I do for a living. How can I return the prior format and be sure bookmarks are backed up automatically. Does going back to the older and more functional tool bar restore this? And why does clicking the bookmarks toolbar show getting started, most visited and the printer icon? Getting started takes one to a new user set of instructions. But there are no functional operations in the tool bar? I am not going to go thru a lot of commands, this should be a automatic as before.

    '' the bookmark facility is not functional in 29 ... Bookmark puts all bookmarks there into "recently bookmarked" ''
    It does not.
    It works much the same as the old system does. Or at least it should do and does do for me.
    * Carefully reads the following article so you are certain what should be happening '''[[How to use bookmarks to save and organize your favorite websites ]]'''
    # From an unbookmarked page click the bookmarks star.
    #* That results in the bookmark being added, and yes initially it is just as an unsorted bookmark. (No doubt that is where most people put most bookmarks)
    # IMPORTANT click the star a second time. (But not so rapidly it counts as a doubleclick)
    #* You now have the options you had in the old version of Firefox <br /> Create new folders <br /> Save to a recently used folder <br /> Show all bookmark folders - and expand nested folders
    If your bookmarks are not working possibly the file is corrupted in which case see
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox#Damaged_Places_database
    I am hoping it is just that you are doubleclicking the star too quickly.

  • Material Return from 542 movement type without purchase order

    HI Expert
    I have a problem regaring material return from vendor through 542 mov type against purchase order.
    when i transfer material to vendor with mov type 541. and after grv if we return material from vendor against purchase order.
    system doesnot allow to return material against purchase order. it allows mov type 542 for returning material from venodr without pruchase order.
    Suppose we have 10 quality for a component to transfer vendor we take grv and issue 5 qty through 543 move type automatically. if we want to take return 5 remaining qty from vendor against purchase order .
    system doesnot allow to return component from vendor against purchase order.
    but allow  to return component from vendor without purchase order.
    vendor stocks becomes less but purchase order still open for open quantity.
    how we could control vendor's returing material with the reference of purchase order after grv.
    with regards
    sanjay agrawal

    HI,
    Are you creating return Po for subcontracting vendor with item category L.?
    we used movement type 541 to send material to vendor ,now you want movement type 542 in system means take back from vendor?
    I don't think so it will make work and make any sense
    why you are not adjust your component with subcontracting adjustment in sap mm
    check following link
    [http://help.sap.com/saphelp_470/helpdata/en/4d/2b908943ad11d189410000e829fbbd/content.htm]
    Regards
    Kailas Ugale

Maybe you are looking for