How to pass an object as method parameter

Hi Guys
I was testing a simple program and was trying to pass an object to a method but it didnt seem to work and I couldnt find out WHY.
I am posting the code so please let me know who can i make my method ADD_EMPLOYEE work so that when i pass an object of LCL_EMPLOYEE, it updates I_EMPLOYEE_LIST.
*& Report:  ZOO_HR_SAMPLE_1
*& Author:  Avinash Pandey
*& Date:    25.03.2009
*& Description: Concepts of OO in ABAP
REPORT  zoo_hr_sample_1.
*&       Class LCL_EMPLOYEE
       Local class
CLASS lcl_employee DEFINITION.
Public section
  PUBLIC SECTION.
Data type
    TYPES:
      BEGIN OF t_employee,
        no  TYPE i,
        name TYPE string,
        wage TYPE i,
     END OF t_employee.
Method
    METHODS:
      constructor
        IMPORTING im_employee_no TYPE i
                  im_employee_name TYPE string
                  im_wage TYPE i,
        add_employee
         IMPORTING im_employee TYPE REF TO lcl_employee,
       display_employee_list,
       display_employee,
       get_no EXPORTING ex_no TYPE i,
       get_name EXPORTING ex_name TYPE string,
       get_wage EXPORTING ex_wage TYPE i.
  Class methods are global for all instances
    CLASS-METHODS: display_no_of_employees.
Protected section
  PROTECTED SECTION.
  Class data are global for all instances
    CLASS-DATA: g_no_of_employees TYPE i.
    CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
Private section
  PRIVATE SECTION.
   CLASS-DATA: i_employee_list TYPE TABLE OF t_employee.
    DATA: g_employee TYPE t_employee.
ENDCLASS.               "LCL_EMPLOYEE
*&       Class (Implementation)  LCL_EMPLOYEE
       Text
CLASS lcl_employee IMPLEMENTATION.
Class constructor method
  METHOD constructor.
    g_employee-no = im_employee_no.
    g_employee-name = im_employee_name.
    g_employee-wage = im_wage.
    g_no_of_employees = g_no_of_employees + 1.
  ENDMETHOD.                    "constructor
Method
  METHOD display_employee.
    WRITE:/ 'Employee', g_employee-no, g_employee-name.
  ENDMETHOD.                    "display_employee
Method
  METHOD get_no.
    ex_no = g_employee-no.
  ENDMETHOD.                    "get_no
Method
  METHOD get_name.
    ex_name = g_employee-name.
    WRITE: / 'Name is:' , ex_name.
  ENDMETHOD.                    "get_no
Method
  METHOD get_wage.
    ex_wage = g_employee-wage.
  ENDMETHOD.                    "get_no
Method
  METHOD add_employee.
  Adds a new employee to the list of employees
    DATA: l_employee TYPE t_employee.
    l_employee-no = im_employee->get_no.
    l_employee-name = im_employee->get_name.
    l_employee-wage = im_employee->get_wage.
    APPEND l_employee TO i_employee_list.
  ENDMETHOD.                    "add_employee
Method
  METHOD display_employee_list.
  Displays all employees and there wage
    DATA: l_employee TYPE t_employee.
    WRITE: / 'List of Employees'.
    LOOP AT i_employee_list INTO l_employee.
      WRITE: / l_employee-no, l_employee-name, l_employee-wage.
    ENDLOOP.
  ENDMETHOD.                    "display_employee_list
Class method
  METHOD display_no_of_employees.
    WRITE: / 'Number of employees is:', g_no_of_employees.
  ENDMETHOD.                    "display_no_of_employees
ENDCLASS.               "LCL_EMPLOYEE
REPORT
DATA: g_employee1 TYPE REF TO lcl_employee,
      g_employee2 TYPE REF TO lcl_employee.
START-OF-SELECTION.
Create class instances
  CREATE OBJECT g_employee1
    EXPORTING
      im_employee_no   = 1
      im_employee_name = 'John Jones'
      im_wage          = 20000.
  CREATE OBJECT g_employee2
    EXPORTING
      im_employee_no   = 2
      im_employee_name = 'Sally Summer'
      im_wage          = 28000.
Call methods
  CALL METHOD g_employee1->display_employee.
  CALL METHOD g_employee1->add_employee
    EXPORTING
      im_employee = g_employee1.
  CALL METHOD g_employee1->get_name.
  CALL METHOD g_employee2->display_employee.
  CALL METHOD g_employee2->display_no_of_employees.
The error I am getting is:
Field GET_NO/GET_NAME/GET_WAGE is unknown.
Please help me out on this.
Thanks a lot you people

hi.
The following parts of your program were changed.
The result is OK?.
*(1)change
CLASS lcl_employee DEFINITION.
Public section
PUBLIC SECTION.
display_employee,
*get_no EXPORTING ex_no TYPE i,
*get_name EXPORTING ex_name TYPE string,
*get_wage EXPORTING ex_wage TYPE i.
get_no returning value(ex_no) TYPE i,
get_name returning value(ex_name) TYPE string,
get_wage returning value(ex_wage) TYPE i.
*(2)change
CLASS lcl_employee IMPLEMENTATION.
Method
METHOD add_employee.
Adds a new employee to the list of employees
DATA: l_employee TYPE t_employee.
*l_employee-no = im_employee->get_no.
*l_employee-name = im_employee->get_name.
*l_employee-wage = im_employee->get_wage.
l_employee-no   = im_employee->get_no( ).
l_employee-name = im_employee->get_name( ).
l_employee-wage = im_employee->get_wage( ).
APPEND l_employee TO i_employee_list.
ENDMETHOD. "add_employee
Result List
Employee          1  John Jones
Name is: John Jones
Name is: John Jones
Employee          2  Sally Summer
Number of employees is:          2

Similar Messages

  • How to pass an object as a parameter

    how do you pass an object as a parameter? (what type should it be ?)

    Well you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html]String
    Or you can take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Double.html]Double
    And you can pass [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Event.html]Events
    and get yourself in trouble
    and you can use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html]Frame
    or maybe take a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html]List
    but some will use [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html]Collection
    depends you your direction
    so if you need to know
    if you should use a [url http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html]Map
    then this is what to do
    just browse the [url http://java.sun.com/j2se/1.4.2/docs/api/]API

  • How to pass class object  as in parameter in call to pl/sql procedure ?

    hi,
    i have to call pl/sql proecedure through java. In pl/sql procedure as "In" parameter i have created "user defined record type" and i am passing class object as "In" parameter in call to pl/sql procedure. but it is giving error.
    so, anyone can please tell me how i can pass class object as "In" parameter in call to pl/sql procedure ?
    its urgent ...
    pls help me...

    793059 wrote:
    I want to pass a cursor to a procedure as IN parameter.You can use the PL/SQL type called sys_refcursor - and open a ref cursor and pass that to the procedure as input parameter.
    Note that the SQL projection of the cursor is unknown at compilation time - and thus cannot be checked. As this checking only happens at run-time, you may get errors attempting to fetch columns from the ref cursor that does not exist in its projection.
    You also need to ask yourself whether this approach is a logical and robust one - it usually is not. The typical cursor processing template in PL/SQL looks as follows:
    begin
      open cursorVariable;
      loop
        fetch cursorVariable bulk collect into bufferVariable limit MAX_ROWS_FETCH;
        for i in 1..bufferVariable.Count
        loop
          MyProcedure( buffer(i) );   --// <-- Pass a row structure to your procedure and not a cursor
        end loop;
        ..etc..
        exit when cursorVariable%not_found;
      end loop;
      close cursorVariable;
    end;

  • How to pass an "object" as a parameter in an web services request?

    I am developing a simple web service client and server (using Eclipse for auto code generation). I am able to pass String and Byte array from the client. However, there is a parameter "statusInfo" which is an object of the class "cz.unmz.namespaces.csn369791.SendCertificatesRequestStatusInfo" and I have no idea of how to do so.
    Below is an extract of the wsdl file:
       <xs:element name="SendCertificatesRequest">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="callerID" type="xs:string"/>
          <xs:element name="messageID" type="xs:string" minOccurs="0" maxOc-curs="1"/>
          <xs:element ref="certificateSequence"  minOccurs="0" maxOccurs="1"/>
          <xs:element name="statusInfo">
           <xs:simpleType>
            <xs:restriction base="xs:string">
             <xs:enumeration value="new_cert_available_notification"/>
             <xs:enumeration value="ok_cert_available"/>
             <xs:enumeration value="failure_inner_signature"/>
             <xs:enumeration value="failure_outer_signature"/>
             <xs:enumeration value="failure_syntax"/>
             <xs:enumeration value="failure_request_not_accepted"/>
             <xs:enumeration value="failure_internal_error"/>
            </xs:restriction>
           </xs:simpleType>
          </xs:element>
         </xs:sequence>
        </xs:complexType>
       </xs:element>Below is an extract of the auto-gen SendCertificatesRequest.java file:
       private java.lang.String callerID;
       private java.lang.String messageID;
       private byte[][] certificateSequence;
       private cz.unmz.namespaces.csn369791.SendCertificatesRequestStatusInfo statusInfo;
       public SendCertificatesRequest(
          java.lang.String callerID,
          java.lang.String messageID,
          byte[][] certificateSequence,
          cz.unmz.namespaces.csn369791.SendCertificatesRequestStatusInfo) {
          this.callerID = callerID;
          this.messageID = messageID;
          this.certificateSequence = certificateSequence;
          this.statusInfo = status = statusInfo;
       public void setStatusInfo(cz.unmz.namespaces.csn369791.SendCertificatesRequestStatusInfo) {
          this.statusInfo = statusInfo;
       Below is the auto-gen SendCertificatesRequest.java file:
    * SendCertificatesRequestStatusInfo.java
    * This file was auto-generated from WSDL
    * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
    package cz.unmz.namespaces.csn369791;
    public class SendCertificatesRequestStatusInfo implements java.io.Serializable {
        private java.lang.String _value_;
        private static java.util.HashMap _table_ = new java.util.HashMap();
        // Constructor
        protected SendCertificatesRequestStatusInfo(java.lang.String value) {
            _value_ = value;
            _table_.put(_value_,this);
        public static final java.lang.String _new_cert_available_notification = "new_cert_available_notification";
        public static final java.lang.String _ok_cert_available = "ok_cert_available";
        public static final java.lang.String _failure_inner_signature = "failure_inner_signature";
        public static final java.lang.String _failure_outer_signature = "failure_outer_signature";
        public static final java.lang.String _failure_syntax = "failure_syntax";
        public static final java.lang.String _failure_request_not_accepted = "failure_request_not_accepted";
        public static final java.lang.String _failure_internal_error = "failure_internal_error";
        public static final SendCertificatesRequestStatusInfo new_cert_available_notification = new SendCertificatesRequestStatusInfo(_new_cert_available_notification);
        public static final SendCertificatesRequestStatusInfo ok_cert_available = new SendCertificatesRequestStatusInfo(_ok_cert_available);
        public static final SendCertificatesRequestStatusInfo failure_inner_signature = new SendCertificatesRequestStatusInfo(_failure_inner_signature);
        public static final SendCertificatesRequestStatusInfo failure_outer_signature = new SendCertificatesRequestStatusInfo(_failure_outer_signature);
        public static final SendCertificatesRequestStatusInfo failure_syntax = new SendCertificatesRequestStatusInfo(_failure_syntax);
        public static final SendCertificatesRequestStatusInfo failure_request_not_accepted = new SendCertificatesRequestStatusInfo(_failure_request_not_accepted);
        public static final SendCertificatesRequestStatusInfo failure_internal_error = new SendCertificatesRequestStatusInfo(_failure_internal_error);
        public java.lang.String getValue() { return _value_;}
        public static SendCertificatesRequestStatusInfo fromValue(java.lang.String value)
              throws java.lang.IllegalArgumentException {
            SendCertificatesRequestStatusInfo enumeration = (SendCertificatesRequestStatusInfo)
                _table_.get(value);
            if (enumeration==null) throw new java.lang.IllegalArgumentException();
            return enumeration;
        public static SendCertificatesRequestStatusInfo fromString(java.lang.String value)
              throws java.lang.IllegalArgumentException {
            return fromValue(value);
        public boolean equals(java.lang.Object obj) {return (obj == this);}
        public int hashCode() { return toString().hashCode();}
        public java.lang.String toString() { return _value_;}
        public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
        public static org.apache.axis.encoding.Serializer getSerializer(
               java.lang.String mechType,
               java.lang.Class _javaType, 
               javax.xml.namespace.QName _xmlType) {
            return
              new org.apache.axis.encoding.ser.EnumSerializer(
                _javaType, _xmlType);
        public static org.apache.axis.encoding.Deserializer getDeserializer(
               java.lang.String mechType,
               java.lang.Class _javaType, 
               javax.xml.namespace.QName _xmlType) {
            return
              new org.apache.axis.encoding.ser.EnumDeserializer(
                _javaType, _xmlType);
        // Type metadata
        private static org.apache.axis.description.TypeDesc typeDesc =
            new org.apache.axis.description.TypeDesc(SendCertificatesRequestStatusInfo.class);
        static {
            typeDesc.setXmlType(new javax.xml.namespace.QName("http://namespaces.unmz.cz/csn369791", ">>SendCertificatesRequest>statusInfo"));
         * Return type metadata object
        public static org.apache.axis.description.TypeDesc getTypeDesc() {
            return typeDesc;
    }    In the client (an auto-gen JSP file), Eclipse has generated the following two lines of code:
    cz1unmz1namespaces1csn3697911SendCertificatesRequest_4id.setMessageID(messageID_5idTemp);
    cz1unmz1namespaces1csn3697911SendCertificatesRequest_4id.setMessageID(callerID_6idTemp);    I have also added the following line for the parameter "certificateSequence" (I have already prepared a Bytearray of certificateSequence)
    cz1unmz1namespaces1csn3697911SendCertificatesRequest_4id.setCertificateSequence(certificateSequence);    Can anyone suggest a way of passing the parameter "statusInfo"? Thanks.
    Edited by: stupidtss on Oct 28, 2009 12:32 AM

    You want something like this:
    DECLARE
      lio_success  VARCHAR2( 2000 );
      li_id        NUMBER;
      li_dep_id    NUMBER;
      li_sel_id := NUMBER;
      li_date DATE;
      lo_date DATE;
      lio_return_message xyz_bpe_rec_fn.xyz_bpe_rec_col;
      l_ret xyz;
    BEGIN
      lio_success := 'some value';
      li_id := NULL;     -- or some number
      li_dep_id := NULL; -- or some number
      li_sel_id := NULL; -- or some number
      li_date DATE := sysdate;
      lio_return_message.col1 := somevalue;
      lio_return_message.col2 := somevalue;
      lio_return_message.coln := somevalue;
      l_ret := get_xyz( lio_success
                      , li_id
                      , li_dep_id
                      , li_sel_id
                      , li_date
                      , lo_date
                      , lio_return_message );
    END;
    /

  • How to pass an object from jsp to other jsp using SendRedirect

    How to pass an object from one jsp to the other jsp using ssendRedirect with out using the session
    I am having 2 jsps
    x.jsp and y.jsp
    From x.jsp using sendRedirect iam going to y.jsp
    From x.jsp i have pass an object to the y.jsp
    Is it possible without putting the object in session
    Is it possible using EncodeUrl
    Please help me Its Urgent

    Is it possible without putting the object in sessionAnything is possible. Would you accept that it is very difficult?
    When you send a redirect, it tells the browser to send a new request for the target page. That means any request parameters/attributes are lost.
    Is it possible using EncodeUrl response.encodeURL() puts the session id into a url if the browser does not support cookies. It is purely for retaining the session.
    There are two ways that you can communicate across a sendRedirect.
    1 - use the session
    2 - pass a parameter in the url.
    parameters are string based, so passing objects is almost out of the question.
    Potentially you could serialize your object, encode it in base64 (so it is composed completely as characters) and pass it as a parameter to the other page, where you retrieve it, unencode it, and then load the serialized object.
    Or you can just use the session.

  • MVC2.0-- how to pass bean object to jsp

    Hi All,
    Anybody please tell me how to pass bean class object from controller to jsp ?
    I am developing an application in MVC2.0.
    I am creating an object of bean class in controller servlet and want to pass this object to jsp so anybody please tell how to pass this object to jsp.
    ControllerServlet--
    Bean obj = new Bean();
    Bean --
    public String aMethod() {
    return data;
    I have to use this method in my jsp and I am creating an object of this bean in controller servlet.
    Please help
    Thanks
    Please reply soon

    Hi,
    Thanks for your response. I knew it is possible with session objects. But I want to perform this operation with out using session objects. Is there a way to accomplish this with out using Session objects.
    Please help.
    Thanks

  • How to pass  internal table values to parameter

    hi,
             how to pass  internal table values to parameter in selection screen.if is it possible means please sent codeings.
    thanks.
      stalin.

    hi,
    tables : mara.
    data :  begin of itab_mara occurs 0,
              matnr like mara-matnr,
              ernam like mara-ernam,
              end of itab_mara.
    selection-screen : begin of block blk1 with frame title text-001.
    parameters : p_matnr like mara-matnr.
    selection-screen : end of block blk1.
    select matnr ernam from mara into corresponding fields of itab_mara
                                                                    where matnr = p_matnr.
    loop at itab_mara.
    write :/ itab_mara-matnr,
               itab_mara-ernam.
    endloop.
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

  • How to pass a "object" as a prameter from one java class to another java

    hi experts, I want to know "How to pass and get object as a parameter from one java class to another java class". I tried follwoing code just check it and give suggetions..
    import Budget.src.qrybean;
    public class ConfirmBillPDF extends HttpServlet
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");
    }Here i want to pass db with simplePDFTableShow method. simplePDFTableShow is in another java class. So how can i do this.
    And also i want to know, how this obj will get.
    please help me.
    Edited by: andy_surya on Jul 14, 2010 7:51 AM

    Hi andy_surya
    what is this i am not understand
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");but i am try to solve your problem try this
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow(db);and access like this in SimplePDFtable class update your method
    simplePDFTable(qrybean tempDB)
    // write your code
    }

  • 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

  • HOW TO PASS SELECT-OPTIONS AS IMPORT PARAMETER TO A CLASS

    Hi experts,how to pass select options value as a export parameters to a zclass.
    can  give me some idea.
    Thanks
    sai

    As Sachin already said, selection options are stored in an internal table. You can reconstruct the table type without the corresponding input fields using the type addition RANGE OF.
    So - assuming you have the following in your program:
    DATA: wa TYPE sflight.
            SELECT-OPTIONS so_car FOR sflight-carrid.
    you can create a publically-visible type in your class using direct type entry and the code
    TYPES: my_selectoption TYPE RANGE OF sflight-carrid.
    and use this to define the importing parameter of the method.
    The only other thing you have to remember is that select-options generates an internal table with header line. Thereore, to pass the table to the method, you would use (in the above example) so_car[], and not just the name of the select-option.
    Hope this helps.
    Regards
    Jon.

  • How to figure out class of method parameter given a VariableElement?

    Background:
    I have a class that extends AbstractElementVisitor6<String, VisitorContext>
    In visitExecutable() I do something like this...
    try {
        // processingMethod is a member variable of the visitor
        processingMethod = true; 
        MyAnnotation foo = e.getAnnotation(MyAnnotation.class);
        if (foo != null) {
            List<? extends VariableElement> parameters = e.getParameters();
            for (Element enclosee : parameters) {
                enclosee.accept(this, context);
            // do other stuff
            return null;
        return null;
    } finally {
        processingMethod = false;
    }I then end up in visitVariable(VariableElement ve, P). Which is good.
    However, I have been running in circles for at least a day now in the javadoc, trying to figure out how to get from a VariableElement to knowing what the class of the parameter is. I have figured out a way (correct or not) of knowing if it's a primitive type...
    ve.asType() instanceof PrimitiveType But I'm stuck on figuring out what the class of the thing is. The closest thing I can see is if I can somehow turn the VariableElement into a TypeElement, I can use getQualifiedName(), but I'm haven't found that, and I'm not sure if that's the right answer either.
    Here's the pseudocode of visitVariable...
    public String visitVariable(VariableElement e, VisitorContext context) {
        if(processingMethod) {
            // if it's a primitive type - OK
            //  do the right thing
            // else
            //   figure out what the class of e is   HELP!
            //   do the right thing  
            return null;
    }In summary...
    How do I get the class of a method parameter from a VariableElement?
    Thanks

    When would this not be possible? Intersections types. See [JLS 3rd 4.9|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.9] Specifically
    "It is not possible to write an intersection type directly as part of a program; no syntax supports this."
    Also, I'm curious about the string representation in the first place. I assume there's not direct handout of class objects because we're in the compiler and can't assume that a type is a valid "thing" yet? e.g. it may not have been compiled yetCorrect.
    I was just thinking about how to represent the information, when it occurred to me that I probably ought to just reuse type mirrors and/or elements. Would you recommend this strategy? This is an interesting area of writing annotation processors. In order to apply any (what we call) extra-lingustic constraints and generate error messages when someone breaks the rules, you normally need the elements and types in order to make assertions about types being correct etc. I normally do this in the data collection phase, and don't collect any data for uses that are erroneous. I haven't tried doing the error checking after the collection phase.
    When you are generating the source code, (after all the data is collected) all you need is CharSequences (normally Strings). In fact extracting those from elements and types at the point that is writing the source file can make the code more complex than it needs to be, so I prefer to just have everything in Strings at this point. It makes the code that is generating code a little easier to understand. I often build an inner class to hold all the strings (in fields or in collections as appropriate) which I have collected from each annotated element, so there is some structure there.
    Are there any examples or other advice out there for doing this that you can point to?There are a few examples. Check out the [hickory project on java.net|https://hickory.dev.java.net/] You might find some useful tools there to assist writing your processor (such as prisms ) and [writing you unit tests|https://hickory.dev.java.net/nonav/apidocs/index.html?net/java/dev/hickory/testing/Compilation.html] . Hickory's unit tests include several examples of annotation processors, [this one|https://hickory.dev.java.net/source/browse/hickory/trunk/code/test/net/java/dev/hickory/incremental/ServiceProviderProcessor.java?rev=22&view=markup] illustrates the points I am making, and there are also some in code samples in the javadoc, for example [the same thing again |https://hickory.dev.java.net/nonav/apidocs/index.html?net/java/dev/hickory/incremental/StateSaver.html].
    Bruce

  • SSRS How to pass a value for Hidden parameter ?

    Hello,
    I have a SSRS report deployed on the Report server. This report is having an "Hidden" parameter.
    Could someone please guide me, how to pass the value to this internal parameter in each of the following case - 
    1. Report is accessed through a Desktop application/Web application in Report Viewer.
    2. Report is accessed through the Url.
    3. Report is accessed through the Report Manager.
    Any quick help on this is highly appreciated.
    Thanks!
    -Vinay Pugalia
    If a post answers your question, please click "Mark As Answer" on that post or
    "Vote as Helpful".
    Web : Inkey Solutions
    Blog : My Blog
    Email : Vinay Pugalia

    Hi Vinay Pugalia,
    Internal Parameters in SSRS are parameters that are not configurable by the end-user at run-time and values cannot be passed to this type of parameter (when present in the child report) in case of a drill-through report implementation. This
    type of parameter is read-only and not accessible in parent report.
    This varies from a Hidden Parameter, which the user is not prompted to provide, but can still be configured through the URL to the report server.
    So no matter you access the report through report manager, URL or Report Viewer. The passing value to the internal parameter will not work.
    As you have mentioned that I will also suggest you use the hidden parameter instead.
    More details information in this blog for your reference:
    SSRS – Understanding Report Parameter Visibility
    How to pass value to  hide parameter is the same as that of the visible parameter, similar thread for your reference:
    Passing the value in action property of a text box
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • How to pass (String[] args), as a parameter.

    * StringMethods
    * @author (Robin)
    * @version (1)
    public class StringMethods
        private String[] args;
        private int numArgs;
        public void printIt(String[] args)
            System.out.print ("You have entered " + numArgs + " Strings");
                if (numArgs > 10)
                    int temp = numArgs;
                    System.out.print (", the last " + (numArgs - 10) + " will not be processed.");
                    numArgs = temp;
            for (int i = 0; (i < numArgs) && (i < 10); i++)
            System.out.println ("[" + i + "] : " + args[i] + " is " + (args).length() + " characters long.");
    public void getArgs(String[] input)
    numArgs = input.length;
    arraycopy(input, 0, args, 0, numArgs-1);
    arraycopy(input, 0, args, 0, numArgs-1)This is my method class for my main method StringArray.
    What I want to know is how to pass command line arguments, i.e. {"example1", "example2", "example3"} from my main method to my method class?

    * StringMethods
    * @author (Robin)
    * @version (1)
    public class ArgMethods
    private String[] args = new String[0];
    private int numArgs;
    public String[] input = {"null", "null"};
    // constructor that takes string args to be manipulated by methods
    public ArgMethods(String[] input)
    numArgs = input.length;
    String[] args = new String[numArgs];
    System.arraycopy(input, 0, args, 0, input.length);
    public void printIt()
    if (args.length > 0)
    System.out.print ("You have entered " + numArgs + " Strings");
    if (numArgs > 10)
    int temp = numArgs;
    System.out.print (", the last " + (numArgs - 10) + " will not be processed.");
    numArgs = temp;
    for (int i = 0; (i < numArgs) && (i < 10); i++)
    System.out.println ("[" + i + "] : " + args[i] + " is " + (args).length() + " characters long.");
    else
    System.out.println ("You must enter at least one String at the command line.");
    public void reverseIt()
    if(args.length > 0)
    int next = args.length-1;
    for (int index = 0; index < args.length/2; index++)
    String temp = args[index];
    args[index] = args[next];
    args[next] = temp;
    next--;
    * StringArray
    * @author (Robin)
    * @version (1)
    public class stringArray
    public static void main (String[] args)
    int numArgs = args.length;
    // correct for output if strings less than 10 and greater than 0
    if (numArgs > 0)
    System.out.print ("You have entered " + numArgs + " Strings");
    if (numArgs > 10)
    int temp = numArgs;
    System.out.print (", the last " + (numArgs - 10) + " will not be processed.");
    numArgs = temp;
    for (int i = 0; (i < numArgs) && (i < 10); i++)
    System.out.println ("[" + i + "] : " + args[i] + " is " + (args[i]).length() + " characters long.");
    else
    System.out.println ("You must enter at least one String at the command line.");
    ArgMethods test = new ArgMethods( args );
    // test.printIt();
    // test.reverseIt();
    // test.printIt();
    *almost finished -- posting this up here so i can get it at home ((only accessible e-mail down plus can't find pen drive))..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to pass value to select-option parameter using SET PARAMETER Command

    Hi,
        Am passing values to selection-screen fields in report RV13A004 ( used in VK11, VK12 and VK13). using below statement but material number is select-option in this report. am able to pass  MATERIAL FROM using SET PARAMETER ID, can i know how to pass values MATERIAL TO range in select-options fields using SET PARAMETER Command ??
    Passing values to parameter id
    set parameter id 'VKS' field kschl.
    set parameter id 'VKO' field vkorg.
    set parameter id 'VTW' field vtweg.
    set parameter id 'KDA' field erdat.
    set parameter id 'MAT' field matnr_from.
    Change condition price.
    call transaction 'VK12' and skip first screen.
    Thanks in advance.
    Regards,
    Balamurugan.

    Hi,
    instead of using set parameters and dden call transaction use this..........
    submit RV13A004  WITH SELECTION-TABLE rspar
    Effect
    If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
    SELNAME (length 8),
    KIND (length 1),
    SIGN (length 1),
    OPTION (length 2),
    LOW (length 45),
    HIGH (length 45).
    To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
    SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
    KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
    SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
    If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
    The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
    Notes
    In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.
    When entering values, you must ensure that these are entered in the internal format of the ABAP values, and not in the output format of the screen display.
    Cheers
    Will.

  • How to pass JSON object for a PUT operation of restful

    Hi,
    I am trying to proxy restful call through an OSB proxy and I would like to know how I can pass json object via OSB proxy to an external rest service for a PUT operation? I am using Oracle 11g.
    I have created a business service, that point to the external rest service and created a proxy service that route to the business service. I thought it automatically takes the JSON, which is the data need to be send to the rest service, but didn't work, I get 405 error in the osb access log. is that how it works, or there is something else I need to do? if so, can you please help and tell me how?
    appreciate any kind of help.
    thanks
    Marwa.

    Hi Anju,
    Most of the example I see is dealing with data being pass either as query-string or html form. We are passing JSON object from the UI and rest services are configured to take JSON. therefore, in the PUT and POST data are passed either as an attachment or part of the request object. Do you know or have an example how to do it? I don't need to any kind of transformation of data because I need JSON on both end and I am trying to use the OSB proxy in between my UI and rest services to take advantage of monitoring capability of the OSB.
    appreciate any help, my deadline is getting close and I kind stuck.
    Thanks
    M.

Maybe you are looking for

  • Print issue with HP1510

    I have an issue when printing a 2 page brochure in pages, word or even from pdf. The problem is that the far right side of the print is always cutting off at the default a4 of 1.43cm. i have set up custom paper sizes in page set up and even put the m

  • Hdmi tv connection

    Hello, I would like to connect my Mac Book Pro 13 Inch with my TV. Bought an HDMI adapter from Miniport to HDMI with Audio Features and the TV shows the apple Galaxi picture but that is as far as I can get. Want to watch DVD or Video Streams via the

  • My CS5 will not update to Camera Raw 6.7.

    When I run the updater, continue to get error saying my product does not have valid serial number.  Adobe says my version is registered.  What gives?

  • URL Customization Using Experience Rules

    We've got a bit of a sticky problem and am wondering if anyone can point me in the right direction. We've used experience rules to point custom URLs to communities. However, when another user types in a URL to access a community on the portal, the pr

  • Mainframe to BEA Linux call; Help in finding a solution

    Some background: Our Linux/Web Logic services are based on synchronous HTTP (aka REST) calls, similar to the way a browser gets a web page, a client application, MF clients will do the same by calling our Linux-based HTTP service . Parameters are pas