Passing hashtable to a method

Can anyone show me the syntax to pass Hashtable to a method???
c.buildHT(cal, ht); //where ht is the hashtable...
buildHT(Calendar cal, Hashtable ht) {
Is this OK? I tried....but I am getting errors...Can anyone clarify me about this?????

I guess, instead of passing the entire HashTable, why dont you try passing only the keys of the hashtable, and accessing the values of the hashtable, thro' their respective keys

Similar Messages

  • Passing Parameters via Post Method from Webdynpro Java to a web application

    Hello Experts,
    I want to pass few parameters from a web dynpro application to an external web application.
    In order to achieve this, I am referring to the below thread:
    HTTP Post
    As mentioned in the thread, I am trying to create an additional Suspend Plug parameter (besides 'Url' of type String) with name 'postParams' and of type Map.
    But when I build my DC, I am getting the same error which most of the people in the thread have mentioned:
    Controller XXXCompInterfaceView [Suspend]: Outbound plug (of type 'Suspend') 'Suspend' may have at most two parameters: 'Url' of type 'string' and 'postParams' of type 'Map'.
    I am using SAP NetWeaver Developer Studio Version: 7.01.00
    Kindly suggest if this is the NWDS version issue or is it something else that I am missing out.
    Also, if it is the NWDS version issue please let me know the NWDS version that I can use to avoid this error.
    Any other suggestion/alternative approach to pass the parameters via POST method from webdynpro java to an external web application apart from the one which is mentioned in the above thread is most welcome.
    Thanks & Regards,
    Anurag

    Hi,
    This is purely a java approach, even you can try this for your requirement.
    There are two types of http calls synchronous call or Asynchronous call. So you have to choose the way to pass parameters in post method based on the http call.
    if it is synchronous means, collect all the values from users/parameters using UI element eg: form and pass all the values via form to the next page is nothing but your web application url.
    If it is Asynchronous  means, write a http client in java and integrate the same with your custom code and you can find an option for sending parameters in post method.
    here you go and find the way to implement Asynchronous  scenario,
    http://www.theserverside.com/news/1365153/HttpClient-and-FileUpload
    http://download.oracle.com/javase/tutorial/networking/urls/readingWriting.html
    http://digiassn.blogspot.com/2008/10/java-simple-httpurlconnection-example.html
    Thanks & Regards
    Rajesh A

  • Passing parameter in a method

    hi i have a situation where i have to pass parameter to my method i don't what to pass the parameter define from the viewO because am not using parameter to query from the view,i just what to pass it to my procedure,my method is
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");
                      i don't what to use this-> sub.setNamedWhereClauseParam("tas_id", tas_id); the tas_id is not in AGR1 VIEWO
                      // sub.
                        sub.executeQuery();
                        Row row = sub.first();
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }

    i try this AM IN jDEVELOPER 11.1.2.1.0
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");                 
                        Row row = sub.first();
                        sub.setNamedWhereClauseParam("tas_id", new Number(10));-how will i pass this to my procedure
                        sub.setNamedWhereClauseParam("dref_id", new Number(10));-how will i pass this to my procedure
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        sub.executeQuery();
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }how will i pass the two prameter to my procedure
    Edited by: Tshifhiwa on 2012/07/01 3:14 PM

  • Passing object references to methods

    i got the Foo class a few minutes ago from the other forum, despite passing the object reference to the baz method, it prints "2" and not "3" at the end.
    but the Passer3 code seems to be different, "p" is passed to test() , and the changes to "pass" in the test method prints "silver 7".
    so i'm totally confused about the whole call by reference thing, can anyone explain?
    class Foo {
        public int bar = 0;
        public static void main(String[] args) {
                Foo foo = new Foo();
                foo.bar = 1;
                System.out.println(foo.bar);
                baz(foo);
                // if this was pass by reference the following line would print 3
                // but it doesn't, it prints 2
                System.out.println(foo.bar);
        private static void baz(Foo foo) {
            foo.bar = 2;
            foo = new Foo();
            foo.bar = 3;
    class Passer2 {
         String str;
         int i;
         Passer2(String str, int i) {
         this.str = str;
         this.i = i;
         void test(Passer2 pass) {
         pass.str = "silver";
         pass.i = 7;
    class Passer3 {
         public static void main(String[] args) {
         Passer2 p = new Passer2("gold", 5);
         System.out.println(p.str+" "+p.i);  //prints gold 5
         p.test(p);
         System.out.println(p.str+" "+p.i);   //prints silver 7
    }

    private static void baz(Foo foo) {
    foo.bar = 2;
    foo = new Foo();
    foo.bar = 3;This sets the bar variable in the object reference by
    foo to 2.
    It then creates a new Foo and references it by foo
    (foo is a copy of the passed reference and cannot be
    seen outside the method).
    It sets the bar variable of the newly created Foo to
    3 and then exits the method.
    The method's foo variable now no longer exists and
    now there is no longer any reference to the Foo
    created in the method.thanks, i think i followed what you said.
    so when i pass the object reference to the method, the parameter is a copy of that reference, and it can be pointed to a different object.
    is that correct?

  • Passing output to a method, I'm lost!

    I want to put all of my "output" including the returns on the three Temp functions in my method DisplayTemperatures, but I'm stuck and don't know how to do this. Please help
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class Temp {
         public static void main(String[] args) {
              int Hourly_Temperatures[];
              String output;
              Hourly_Temperatures = new int[24];
              DecimalFormat twoDigits = new DecimalFormat ("00");     
              for (int i = 0;i < Hourly_Temperatures.length;i++) { //inputs temps               
                   Hourly_Temperatures[i] = Integer.parseInt(JOptionPane.showInputDialog("Enter temperature between -50 & 130\nHour: " + twoDigits.format(i) + ":00"));
                   while (Hourly_Temperatures[i] < -50|| Hourly_Temperatures[i] > 130) {
                        Hourly_Temperatures[i] = Integer.parseInt(JOptionPane.showInputDialog(null,"Invalid Entry!\nEnter temperature"));
              output = "Hour\tTemperature\n"; // build output string
              for (int counter = 0; counter < Hourly_Temperatures.length; counter++)
              output += twoDigits.format(counter) + ":00" + "\t" + Hourly_Temperatures[counter] + "\n";
              JTextArea outputArea = new JTextArea();
              outputArea.setText(output);
              JOptionPane.showMessageDialog(null,outputArea,"24 hour Temperature",JOptionPane.INFORMATION_MESSAGE);
              //System.exit(0);
         } //end main
         public int High_Temp(int Temperatures[]){
              int highTemp = Temperatures[0];
              for (int counter =0; counter < Temperatures.length; counter++)
              if (Temperatures[counter]>highTemp)
              highTemp = Temperatures[counter];
              return highTemp;
         }//end method High_Temp
         public int Low_Temp(int Temperatures[]){
                   int lowTemp = Temperatures[0];
                   for (int counter =0; counter < Temperatures.length; counter++)
                   if (Temperatures[counter]<lowTemp)
                   lowTemp = Temperatures[counter];
                   return lowTemp;
         }//end method Low_temp
         public int Average_Temp(int Temperatures[]){
              int total = 0;
              for (int counter =0; counter < Temperatures.length; counter++)
              total += Temperatures[counter];
              return total / Temperatures.length;
         }// end method Average_Temp
         public void Display_Temperatures(int Temperatues[], int Average_Temp){
        }// end method Display_Temperatures
    } //end class

    I am not sure I understand what problem you are having in passing output to the method. However, I'll guess:
    If you want to pass output to Display_Temperatures() then:
    1. change Display_Temperatures to accept a String
    2. move display code from main to Display_Temperatures.
    3. pass output to Display_Temperatures()
    Display_Temperatures(output)If you want to do all the calculations also in Display_Temperatures:
    1. change Display_Temperatures to accept only 1 arg - int[]
    2. move all the calculations & display code from main to Display_Temperatures
    3. pass Hourly_Temperatures to Display_Temperatures()
    Display_Temperatures(Hourly_Temperatures)If you make these changes then you will encounter some compilation errors. Post them here only after you've first tried to understand and fix them.
    If it is something else you want to do, then you will have to explain it better; at least I've not understood your problem.
    The naming standards that almost all jave professionals follow is:
    1. not to use underscore char ( _ ) in method names; so Display_Temperatures shd be DisplayTemperatures
    2. var names don't have _ char within the name and begin with a lower case; so Hourly_Temperatures shd be hourlyTemperatures
    It is generally a good practice to create an instance of the class in the main() method and write the process code in the instance methods instead of putting all that code in main() itself. Read the [url http://java.sun.com/docs/books/tutorial/]tutorials for this starting from the "Your First Cup of Java".

  • Passing objects to a method.

    Hi,
    I was reading this from a book and puzzled by this suggestion:
    for example:
    public Employee findEmployee(String employeeID);
    This method takes a String specifying a unique employee id and returns the Employee object with that id, null otherwise. Don't pass un-necessary objects to methods, and return the appropriate results.
    Why not passing objects to methods, I found it is convenient to pass objects to methods, why ?
    Thanks in advance !
    Tee

    Of course you can pass objects to methods. A String is also an object.
    The author doesn't say to not pass any objects to methods, only no unnecessary objects. He propably means that you don't need a method likepublic Employee findEmployee(String employeeID, String country)to retrieve the Employee if the employee ID by itself is unique or you don't use the country in the method, to give you an example.

  • Passing paramaters to a method

    I am passing objects to another method.
    I do some changes to them and expect the changed objects to be available in the calling method ( since they are supposedely passed by reference) when the execution is returned to it. However, I don't get the changed objects but rather the old ones, before the method execution.
    Can someone explain?
    Thanks,
    Boris.

    This is an extremely common question. A search through this forum would be very useful to you.
    Java does not pass-by-reference in the same way C/C++ do. When you pass an object to a method, you can change the contents of the object using its methods and see the changes after the method completes in the calling method. In this way Java is similar to C/C++.
    However, you cannot change an object to equal another object or a new object inside a method and expect the changes to be visible after the method completes in the calling method.
    Here is an example.
    This will show changes and the line "String" would be printed.
      StringBuffer sb = new StringBuffer();
      method(sb);
      System.out.println(sb);
      public void method(StringBuffer buf) {
        buf.append("String");
      }However, this would not show changes and the line "Old String would be printed:
      String string = "Old String";
      method(string);
      System.out.println(string);
      public void method(String string) {
        string = "New String";
        // string.concat("New String) would also fail to work

  • Passing parameters to a method

    I am passing objects to another method.
    I do some changes to them and expect the changed objects to be available in the calling method ( since they are supposedely passed by reference) when the execution is returned to it. However, I don't get the changed objects but rather the old ones, before the method execution.
    Can someone explain?
    Thanks,
    Boris.

    I do some changes to them and expect the changed
    objects to be available in the calling methodIf you modify an object passed to a method, then the changes made to that object will be visible as soon as they are made.
    If you change the parameter so that it references some other object, this will NOT be seen in the calling method.
    You can "fake" it by putting the object in question in an array and passing the array. Better though is to just not expect methods to be able to change references they are passed to point at some other object.

  • Passing information to a method

    Im going through the java tutorial about passing information to a method
    and i am presented with this code.
    class RGBColor {
        public int red, green, blue;
    class Pen {
        int redValue, greenValue, blueValue;
        void getRGBColor(RGBColor aColor) {// is aColor a reference for RGBColor ?
            aColor.red = redValue; //is aColor then used to access the variables of RGBColor ?
            aColor.green = greenValue;// Are these values being initialised here
            aColor.blue = blueValue;
    RGBColor penColor = new RGBColor();// we are creating an instance of RGBColor called penColor
    pen.getRGBColor(penColor);// this is the bit i dont understand where the heck did pen.getRGBColor come from, i cant see anywhere where pen has been declared ..... or instantiated
    System.out.println("red = " + penColor.red +
                       ", green = " + penColor.green +
                       ", blue = " + penColor.blue);The follwoing is what it says in the java tutorial about the code
    The modifications made to the RGBColor object within the getRGBColor method affect the object created in the calling sequence because the names penColor (in the calling sequence) and aColor (in the getRGBColor method) refer to the same object.
    any guidance would be great

    Directly above the code that you don't understand is
    o A definition for a class Pen.
    o something called "pen" is probably declared somewhere like this:
    Pen pen;
    or
    Pen pen = new Pen(....);
    or
    Pen pen = something.getPen();
    So pen is an instance of Pen, and you can invoke the methods defined in class Pen, thus
    pen.getRGBColor(....);

  • Concatenating VARCHAR2 to pass to a Java method

    Hi, I've imported in Oracle 10g a Java method which processes a String. I've mapped the String to a varchar2 as follow:
    create or replace function PARSE(input in varchar2) RETURN varchar2
    as language java
    name 'Base64.decodeToString(java.lang.String) return String';
    I then built a simple PL/SQL program to build the string to pass to the Java method as follows:
    create or replace procedure TEST_PARSE(input_tid in number) is
    begin
    declare
    result varchar2(32767);
    cursor object_cur is select TEXT from OBJECTSTORE where TID=input_tid order by rnumber;
    object_row object_cur%ROWTYPE;
    begin
    open object_cur;
    loop
    fetch object_cur into object_row;
    exit when object_cur%NOTFOUND;
    result := result || object_cur.TEXT;
    end loop;
    close object_cur;
    result := PARSE(result);
    end
    The PL/SQL program just concatenates the TEXT column from a bunch of records in the table OBJECTSTORE. The TEXT column is defined as a VARCHAR2(4000).
    Now if the SELECT in the TEST_PARSE program returns only 1 record, then everything works and the PARSE Java function returns the processed String.
    If the SELECT returns 2 or more records then I get the following warning and the Java method doesn't return anything:
    "Warning: PL/SQL procedure successfully completed with compilation errors"
    Since I know that the Java method works fine (it has been tested within java programs successfully ) I think the problem is something to do with data types or maybe with the size of the concatenated string.
    Any help really appreciated. Thank you!

    Thanks guys, it still doesn't work, but at least now I can see some error messages:
    Error code -24345: ORA-24345: A Truncation or null fetch error occurred
    1) The error occurs when I call the Java method. As before this happens only when the select returns more than 1 record and I concatenate two or more TEXT (each one is a VARCHAR2(4000)). However the concatenation works fine so I guess the problem is that the resulting string is too big for the Java method to process.
    Or maybe the string returned by the Java method is too big for the PL/SQL varchar2?
    2) Also why do I get a compilation error if I try to add the size of the varchar2 in the mapping below?
    create or replace function PARSE(input in varchar2) RETURN varchar2
    as language java
    name 'Base64.decodeToString(java.lang.String) return String';

  • Pass parameter to success method of ExecuteQueryAsync

    I have seen how to pass a parameter to a callback method of the ExecuteQueryAsync SP.ClientContext object.  The problem occurs when multiple calls are performed.  The last value is always passed to the callback method.  Below is a sample
    of a while loop that performs multiple updates.  cT contains the value i wish to pass.  TitleVal in the success method always contains the last value. 
    Thanks in advance.
    While...{ cT = currentItem.get_item('Title'); ListItem.set_item("Approval_x0020_Status", currentItem.get_item('Approval_x0020_Status'));
    ListItem.set_item("Year", currentItem.get_item('Year'));
    ListItem.set_item("Delete_x0020_this_x0020_Risk_x00", currentItem.get_item('Delete_x0020_this_x0020_Risk_x00'));
    ListItem.update();
    var SPContextUPD = new SP.ClientContext.get_current();
    SPContextUPD.executeQueryAsync(
    Function.createDelegate(this, function() {
    CreateListItem_Success("'" + cT + "'");
    Function.createDelegate(this, function() {
    CreateListItem_Fail();
    function CreateListItem_Success(TitleVal){
    SP.UI.Notify.addNotification(TitleVal + ' updated successfully');

    also define cT variable inside loop body by adding "var" so it will have narrower scope:
    var cT = currentItem.get_item('Title');
    If it is global it may store the last updated ct value which explains why you always see the same value.
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • Passing Tables from one method to another method.

    Hi All,
    I'm creating a Web-Dynpro program in which I wouild like to passing an internal table from one method to another method within the same View. 
    Is this possible?  And if so, how can I set it up.
    Thank you.
    Paul

    Hi Paul ,
    I hope u wud be clear with passing table from one method to another now .U may also wish to see this WIKI
    Link: [Passing table parameters|https://wiki.sdn.sap.com/wiki/display/WDABAP/Passingtableparameterfromoneviewtoanotherview+locally]
    I hope it wud help u .
    regards,
    amit

  • How to pass parameter to action methods

    Hi,
    I have a button.  Enter action method is associated with this.  In the Enter action method, I have added a parameter named param1.  When the button is clicked, this method is called automatically.  But how do I pass parameters to this method, which I have declared ?
    Regards,
    Suresh.

    Hi Suresh Babu,
    The associated method (Event Handler) is triggered by default and cannot pass the values. Instead, use the context node or attributes to set/get the values in the event handler method.
    Regards,
    Sravan Varagani

  • How I can pass parameters by POST method?

    How I can pass parameters by POST method?
    I use URL Template iView. I checked Requested Method - POST, but when I started the iView the program says:"It's a GET method!"
    I use httpServletRequest.getMethod()in the program.
    Environment: EP6 SP2
    Thank's! 

    Hi Kremena,
    the OSS stands for "Online Service System" - service.sap.com - messages or directly: service.sap.com/message.
    Hope it helps
    Detlev

  • How to pass internal table to method of class

    Hi all,
    I am new to abap objects, i want to pass one internal table to class.
    i am trying in this way.
    class c1 definition.
    method get_material importing t_stpo  type any table
                                   exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in t_stpo
            where stlnr = t_stpo-stlnr.
    endmethod.
    endclass.
    ERROR:
    "stlnr" is not available
    if i use this way. its not giing error.
    class c1 definition.
    method get_material exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in it_stpo
            where stlnr = it_stpo-stlnr.
    endmethod.
    endclass.
    how to pass internal table with some specific reference may be using like or type <it_xxxx>
    thanks

    Try this.
    TYPES : BEGIN OF ty_stpo,
             stlnr TYPE stpo-stlnr,
             idnrk TYPE stpo-idnrk,
             menge TYPE stpo-menge,
            END OF ty_stpo,
            BEGIN OF ty_mast,
             matnr TYPE mast-matnr,
             werks TYPE mast-werks,
             stlnr TYPE mast-stlnr,
            END OF ty_mast,
            tt_stpo TYPE TABLE OF ty_stpo,
            tt_mast TYPE TABLE OF ty_mast.
    DATA : it_stpo TYPE tt_stpo,
           it_mast TYPE tt_mast.
    *       CLASS c1 DEFINITION
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS : get_bom_numbers EXPORTING ex_stpo type tt_stpo,
                  get_parent_material IMPORTING im_stpo TYPE tt_stpo
                                      EXPORTING ex_mast TYPE tt_mast.
        endclass.
    *       CLASS c1 IMPLEMENTATION
    CLASS c1 IMPLEMENTATION.
      METHOD get_bom_numbers.
      ENDMETHOD.                    "get_bom_numbers
      METHOD get_parent_material.
      ENDMETHOD.                    "get_parent_material
    START-OF-SELECTION.
      DATA : obj TYPE REF TO c1.
      CREATE OBJECT obj.
      CALL METHOD obj->get_bom_numbers
        IMPORTING
          t_stpo = it_stpo.
      CALL METHOD obj->get_parent_material
        EXPORTING
          im_stpo = it_stpo
        IMPORTING
          ex_mast = it_mast.
    Regards,
    Rich Heilman

Maybe you are looking for

  • IPhone 6 (iOS 8.1) hot and is draining battery, even on standby.

    Greetings Everyone, I'm having a really bad time here with my iPhone 6 4.7" iOS 8.1 device. It all started a few days ago, i was noticing that only at 100% the battery seemed to be just fine, but once it dropped just 1% of the 100% it would drain to

  • Labview Synthesiser: Problem outputting sound via MacBook soundcard

    Hi all! First time posting here, hopefully i'm in the right section of the forum. Anyway, i'm a part time student and currently studying a module on Labview in university. As a mini project i decided to build a synth using Labview. I've it mostly bui

  • Macbook Pro 15" DVD drive only displaying certain images?

    Put in the disk and it loads about half of the images on it.  The rest say they are truncated or not good files.  Or that I don't have permission to view them.  This is happening on two Mac's that we have in the office but on a windows PC these image

  • Safari vs Internet Explorer

    I just received an IPAD. My main purpose is to be able to access my Realtor Mls Sites for business. They are only compatable with Internet Explorer not Safari. Does anyone know of an APP that may help me.

  • Huge file problem

    Hi All, I have input xml file which consists of 60,000 records and its size above 10MB. I wanted to process this file in XI such a way, where file has to be pick and process, but only 10,000 records should be process also file not split. Its xml not