Type ref to

data : r type in_table-name.
data : r type ref to in_table-name. 
what is the difference b/w them

Hi
type ref to used mostly for declaring classes.
You can not declare
DATA: l_grid type cl_gui_alv_grid.
you need to give it as
DATA: l_grid type ref to cl_gui_alv_grid.
Regards
Navneet

Similar Messages

  • How to define a TYPE REF TO data into my local variable/structure?

    Hello,
    I am trying to implementing a BADI, in its signature part,
    c_accit TYPE REF TO data.
    My pseudo code goes like,
    DATA: l_itm_details TYPE REF TO data.
    l_itm_details = c_accit.
    l_itm_details-koart = 'D' =====> here am getting error!
    * Do processing
    ENDIF.
    Here am getting error that, l_itm_details is not a structure! Pls. let me know how to fix it?
    Thank you

    Hello,
    c_accit TYPE REF TO data.
    C_ACCIT is a "data reference" parameter. In order to access its components you have to "de-reference" it!
    FIELD-SYMBOLS: <l_itm_details> TYPE ANY,
    <l_value> TYPE ANY.
    ASSIGN c_accit->* TO <l_itm_details>."De-reference the data reference
    ASSIGN COMPONENT 'KOART' OF STRUCTURE <l_itm_details> TO <l_value>.
    If you know the structure of the data reference variable you can define your field-symbol <l_itm_details> of that type directly, else you can define a generic type as mentioned in the code snippet.
    BR,
    Suhas

  • Data: lv_value1 type ref to cl_bsp_messages()

    i have a small doubt, I am confusing a lot
    1)Data: lv_value1 type ref to cl_bsp_messages
    In this case what should i call lv_value1 is instance/reference/object ?
    2) In do_finish_input() we have Global_messages import parameter which refers cl_bsp_messages as well
    In this case what should i call Global_messages is instance/reference/object ?
    3)In do_validate_input i wrote some of following code for my requirement
    data: lv_value2 type ref to cl_bsp_wd_message_service
    lv_value2 =  me->view_manager->get_message_service()
    the rv_result  of get_message_service is  cl_bsp_wd_message_service
    my question is  ,
    In this case what should i call lv_value2 is instance/reference/object ?
    4) data: lv_value3 type ref to CL_CRM_BOL_DQUERY_SERVICE.
    lv_value3 = CL_CRM_BOL_DQUERY_SERVICE=>get_instance()
    In this case what should i call lv_value3 is instance/reference/object ?

    hi ,
    1) Data: lv_value1 type ref to cl_bsp_messages
    up to here you create an instance for this class cl_bsl_meassage
    when you write create object then memory is allocated for this instance then it is called object.
    for example if you have class to add two values , and we create two objects name as obj1 and obj2
    so there we can multiple input vales at a time means using objec1 you can pass input values as 1 1 and result 2
    using obj2 you can pass another 2 input values as 2 2 then result is 4,  how it will be done
    when create an object it allocates separate memory for that object . using data statement you can just assign this object replies to this class.
    2.In do_finish_outpu() the returing parameter type ref to cl_bsp_messages so that , using that attribute you can access all the methods and attributes of that class.
    3 ) it is an object it holds the returning values of that methods , if you want get data from this object , you have some methods in that class
    4 ) here also it is an object , using that method we are getting total instance of that class in to object lv_value3.

  • Type ref to a table

    Hi Experts,
    I have an FM returning a variable which is :
      abc type ref to data.
    This actually returns a table at runtime.
    However since its declaration is such, I capture the reference in another variable
      xyz type ref to data.
    Now I need to know whether the xyz table has one row or more.
    How can I do that?
    Thanks and Regards,
    Ravi Bhatnagar

    Try something like this. Assign the data ref to a field symbol, then use the LINES operator to find out the number of lines.
    DATA: lo_ref TYPE REF TO data.
    DATA: lv_lines TYPE i.
    FIELD-SYMBOLS: <fs_tab> TYPE table.
    ASSIGN lo_ref->* TO <fs_tab>.
    lv_lines = LINES( <fs_tab> ).
    Regards,
    Rich Heilman

  • Me and type ref

    hi all,
    i read the book written by dr horst keller and sascha kruger "abap objects" with confusion on the below script. really hope can get the help.
    1) confused 1, why creator has no create object and only create reference variable? why no need to create instance of client class?
    2) confused 2. why only me? me means everything(attribute/method) of client class? why not define as me->name just like in confused 4?
    3) why creator no create object also can creator->name?
    report self_reference.
    class client definition.
    public section.
    data name(10) type c value 'master' read-only.
    methods create_server.
    endclass.
    class server definition.
    public section.
    methods acknowledge importing creator type ref to client.  "confused 1
    private section.
    data name(10) type c value 'servant'.
    endclass.
    class client implementation.
    method create_server.
    data server_ref type ref to server.
    create object server_ref.
    call method server_ref->acknowledge exporting creator = me. "confused 2
    endmethod.
    endclass.
    class server implementation.
    method acknowledge.
    data name type string.
    name = creator->name.                   "confused 3
    write: me->name, 'created by', name.  "confused 4
    endmethod.
    endclass.
    data client_ref type ref to client.
    start-of-selection.
    create object client_ref.
    call method client_ref->create_server
    the output is "servant created by master".

    hi,
       i will explain your confusion along with your example...
    report self_reference.
    class client definition.
    public section.
    data name(10) type c value 'master' read-only.
    methods create_server.
    endclass.
    class server definition.
    public section.
    methods acknowledge importing creator type ref to client. "confused 1
    private section.
    data name(10) type c value 'servant'.
    endclass.
    class client implementation.
    method create_server.
    data server_ref type ref to server.
    create object server_ref.
    call method server_ref->acknowledge exporting creator = me. "confused 2
    endmethod.
    endclass.
    class server implementation.
    method acknowledge.
    data name type string.
    name = creator->name. "confused 3
    write: me->name, 'created by', name. "confused 4
    endmethod.
    endclass.
    data client_ref type ref to client.
    start-of-selection.
    create object client_ref.
    call method client_ref->create_server
    the output is "servant created by master".
    confusion 1:
    Normaly while creating an object we have to create a reference variable to class and then create the instance of the class with 'Create Objec' statement, but in this example we are passing a parameter creator of type client is sent to acknowledge method of server class. Here the parameter  creator is sent as an reference variable which means that the object is already created and just an reference to that variable is sent to the method acknowledge.
    confusion 2:
    here 'me' is a self reference variable of a class. It does not mean an attribute or methods of a class, it denotes the object of the class itself in which it is referenced. Normally the 'me' is used for self reference inside the class methods for refering to attributes or methods of the same class.
    eg: me->attrib1 or call method me->method1
    confusion 3:
    An ABAP class has two parts namely a defenition part and an implementaion part. The defenition part of the class contains all the attributes and declaration of the methods, whereas the implementation part contains the actual implementation of methods i.e., defenition of methods. In simple words, the defenition part of the class contains the methods name and what are the parameters like exporting, importing, changing,exceptions, etc., whereas the implementation part contains actual functionality of the method.
    As i have already stated that the parameter passed to the method are passed as reference variable, there is no need for creating object seperately and just an reference to already exisiting object is passed as parameter.
    so we can obtain the value of the attribute 'name' by means of the reference variable creator which gives the value of the client object.
    confusion 4:
    'me' is a self reference variable which is nothing but a reference to the same class, so me->name refers to the attribute name of the server class.

  • Passing value from field symbol / variable type ref to data to variable

    hey ,
    DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: RT_CARRID TYPE REF TO DATA.
      FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE
    .* Retrieve the data from the select option
      RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_WEIGHT).
    Assign it to a field symbol
      ASSIGN RT_CARRID->* TO <FS_CARRID>.
    how can i pass RT_CARRID or <FS_CARRID> to a varible with type vbap-netgrw ( net weight ) ?
    thanks
    ASA

    >
    ASA MOKED wrote:
    > hey ,
    >
    >
    > DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
    >   DATA: RT_CARRID TYPE REF TO DATA.
    >   FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE

    > .* Retrieve the data from the select option
    >   RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_WEIGHT).
    > * Assign it to a field symbol
    >   ASSIGN RT_CARRID->* TO <FS_CARRID>.
    create a work area of type <FS_CARRID>.
    field-symbol: <fs_wa> type line of <FS_CARRID>.
    loop at <FS_CARRID> into <fs_wa>.
    lv_netgr = <fs_wa>-netgr.

  • Add line to type ref to data field - type table

    HI All,
    I have field that is defined as type ref to data ,and the type of it is table with data inside of it lr_data.
    I have the also the table type of lr_data and I want to add additional line to the type ref to data field.
    How can i do that ?
    For example
    TYPES: BEGIN OF bank_list,
             country_key type string,
             bank_key    type string ,
             bank_name   type string,
             bank_city  type string    ,
           END OF bank_list.
    data lt_bank type table of bank_list.
    data lr_data data  ref to data.
    Now lr_datae is  type lt_bank " in _Runtine
    and contain 4 entries .
    I get the lr_data with 4 entries and I want to add new entry to the table.
    How can I do that?
    Thanks,
    Joy
    Edited by: Joy Stpr on Feb 8, 2012 10:05 PM

    Hello Joy,
    You can check this code snippet to get an idea on how to proceed with your requirement:
    CLASS lcl_add_data DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS add_data CHANGING ch_data TYPE REF TO data
                               EXCEPTIONS err_invalid_type.
    ENDCLASS.                    "lcl_add_data DEFINITION
    *       CLASS lcl_add_data IMPLEMENTATION
    CLASS lcl_add_data IMPLEMENTATION.
      METHOD add_data.
        DATA: lo_tabdescr   TYPE REF TO cl_abap_tabledescr,
              lo_strucdescr TYPE REF TO cl_abap_structdescr,
              ls_component  TYPE abap_compdescr.
        FIELD-SYMBOLS: <lt_data>      TYPE STANDARD TABLE,
                       <ls_data>      TYPE any,
                       <lv_fieldval>  TYPE any.
        IF ch_data IS BOUND.
    *     Get the runtime type object
          lo_tabdescr  ?= cl_abap_typedescr=>describe_by_data_ref( ch_data ).
    *     Check  if supplied param is table
          IF lo_tabdescr->type_kind NE cl_abap_typedescr=>typekind_table.
            RAISE err_invalid_type.
          ENDIF.
        ELSE.
          RETURN.
        ENDIF.
        ASSIGN ch_data->* TO <lt_data>. "Dereferencing the data reference
    *   Get the line type of table
        lo_strucdescr ?= lo_tabdescr->get_table_line_type( ).
        DO 2 TIMES.
    *     Add initial line to the table
          APPEND INITIAL LINE TO <lt_data> ASSIGNING <ls_data>.
          CLEAR <ls_data>.
    *     Loop on the fields of the structure & populate them
          LOOP AT lo_strucdescr->components INTO ls_component.
            ASSIGN COMPONENT ls_component-name OF STRUCTURE <ls_data> TO <lv_fieldval>.
            CASE ls_component-name.
              WHen 'COUNTRY_KEY'.
                <lv_fieldval> = `My Country`.
              WHEN 'BANK_KEY'.
                <lv_fieldval> = `123`.
              WHEN 'BANK_NAME'.
                <lv_fieldval> = `My Bank`.
              WHEN 'BANK_CITY'.
                <lv_fieldval> = `My City`.
            ENDCASE.
          ENDLOOP.
        ENDDO.
      ENDMETHOD.                    "add_data
    ENDCLASS.                    "lcl_add_data IMPLEMENTATION
    TYPES:
    BEGIN OF bank_list,
      country_key TYPE string,
      bank_key    TYPE string,
      bank_name   TYPE string,
      bank_city   TYPE string,
    END OF bank_list.
    DATA: lt_bank TYPE STANDARD TABLE OF bank_list,
          lr_data TYPE REF TO data.
    START-OF-SELECTION.
      GET REFERENCE OF lt_bank INTO lr_data. "Get reference
    * Add the data to the data reference
      lcl_add_data=>add_data( CHANGING    ch_data = lr_data
                              EXCEPTIONS  err_invalid_type = 1 ).
    BR,
    Suhas

  • Data: stru_tab type ref to data? what data refers to?

    Dear friends,
                         Relatively iam new to WDA. can u please explain me below statement.
    data: stru_tab type ref to data.

    Actually there are not really any Web Dynpro sepecific data types.  The ones mentioned are simply data dictionary data types that are defined for use with WD, but can be used in any ABAP applications.  You should start your research with just ABAP data types.  Look in the ABAPDOCU transaction or search the keyword documentation for DATA. There is lots of documentation on the ABAP native data types.
    Here is a little bit of it:
    Predefined ABAP Types
    The table below shows the predefined ABAP types. Additional attributes can be found under value ranges and initial values.
    Type Length Standard length Description
    b 1 Byte   1 byte integer (internal)
    c 1 to 65,535 characters 1 character Text field
    cursor as i as i Database cursor
    d 8 characters   Date field
    f 8 bytes   Floating point number
    i 4 bytes   4 byte integer
    n 1 to 65,535 characters 1 character Numeric text
    p 1 to 16 bytes 8 bytes Packed number
    string variable   Text string
    s 2 bytes   2 byte integer (internal)
    t 6 characters   Time field
    x 1 to 65,535 bytes 1 byte Byte field
    xstring variable   Byte string
    These types are predefined in every ABAP program.
    All predefined ABAP types in this table are elementary.
    Apart from the types b and s, the predefined ABAP types can also be used to define your own data types and data objects and for typing. The types b and s cannot be specified directly in ABAP statements. Self-defined data types and data objects in ABAP programs are of the data type b and s if they are defined with reference to data elements to the ABAP Dictionary which are of the external data types INT1 or INT2.
    The predefined data types string and xstring describe data objects of variable length (dynamic data objects). While the length of data objects in all other elementary data types is determined for its whole lifetime, the length of text and byte strings varies according to their content (the maximum size of a string is determined by profile parameter ztta/max_memreq_MB, see Maximum size of dynamic data objects).
    The program-globally predefined data type cursor is currently synonymous with the predefined ABAP type i. This is required for the declaration of a cursor variable for database cursor handling.
    All predefined ABAP types for which a length interval is specified in second column in the table are generic, which means that the length is not part of the type description. For the type p, the fractional portion is indefinite as well as the length.
    The entries in the standard length column specify the length that is used for the corresponding generic data type when declaring data objects, if no explicit length is specified in the relevant statement.
    In Unicode systems, the length must either be specified in characters and bytes. In non-Unicode systems, the length of a character is one byte, but in Unicode systems the length of a character depends on which Unicode character representation is used.
    Generic ABAP Types
    The following table shows the predefined generic ABAP types. A generic data type is an incomplete type specification that includes several complete type specifications. The generic types can be used for the typing of field symbols and formal parameters. The only generic type that can be used for typing of data references is the predefined type data. The predefined generic type for object references is object. When a data object is assigned to generically typed field symbols using the statement ASSIGN, or to a formal parameter in procedure calls, the system checks whether its concrete data type is a of the generic type, or is compatible with it.
    Type Description
    any Any data type (suitable for any type)
    any table Internal table of any table type
    c Text field of generic length
    clike Character-type (c, d, n, t, string and character-type flat structures); in non- Unicode programs also x, xstring and any flat structures
    csequence Text-type (c, string)
    data Any data type
    hashed table Hashed table
    index table Index table
    n numeric text of generic length
    numeric Numeric (b, i, p, f, s)
    object Any object type (root class of the inheritance hierarchy)
    p Packed number of generic length and generic number of decimal places
    simple Elementary data type including structured types with exclusively character-type flat components
    sorted table Sorted table
    Standard table Standard table
    table Standard table
    x Byte field of generic length
    xsequence byte-type (x, xstring)
    The genric types clike, csequence, numeric,simple, and xsequence are available as of release 6.10.
    Notes
    The generic type any currently has the same effect in typing as the generic type data. When declaring references, any cannot yest be specified after REF TO. Generic data references (REF TO data) or generic object references (REF TO object) are possible. The generic type object can currently only be specified after REF TO.
    Except for the built-in generic types illustrated in the table above, there are at the moment no self-defined generic types in ABAP with only one exception: A table type defined with TYPES - TABLE OF or defined in the ABAP Dictionary without completely specifying the table key, is also generic.
    Predefined Types in the ABAP Dictionary
    The following table lists the predefined types in the ABAP Dictionary. These types cannot be used directly in ABAP programs, and are therefore known as external data types. Instead, they are used in the ABAP Dictionary for the definition of data types to which ABAP programs can refer. The predefined data types of the ABAP Dictionary must also be taken into account in Open SQL statements and when working with screens: Open SQL statements work with database tables defined in the ABAP Dictionary whose colums have external data types. Screen fields are also declared in the Screen Painter with reference to external data types.
    Type Permitted Places m Meaning ABAP Type
    ACCP 6 Accounting period n(6)
    CHAR 1-255 Character string c(m)
    CLNT 3 Client c(3)
    CUKY 5 Currency key c(5)
    CURR 1-31 Currency field p((m+1)/2)
    DATS 8 Date d
    DEC 1-31 Calculation/amount field p((m+1)/2)
    FLTP 16 Floating point number f(8)
    INT1 3 1 byte integer b
    INT2 5 2 byte integer s
    INT4 10 4 byte integer i
    LANG 1 Language c(1)
    LCHR 256-... Long character string c(m)
    LRAW 256-... Long byte string x(m)
    NUMC 1-255 numerischer Text n(m)
    PREC 2 Accuracy of a quantity field s
    QUAN 1-31 Quantity field p((m+1)/2)
    RAW 1-255 Byte sequence x(m)
    RAWSTRING 256-... Byte sequence xstring
    SSTRING 1-255 Character string string
    STRING 256-... Character string string
    TIMS 6 Time t
    UNIT 2-3 Unit key c(m)
    For types LCHR and LRAW, the maximum number of places in a transparent database table is the value of the preceding INT2 field.
    The types RAWSTRING and STRING have a variable length. A maximum length for these types can be specified, but has no upper limit.
    The type SSTRING is available as of release 6.10 and it has a variable length. Its maximum length must be specified and is limited to 255. The advantage of this type compared with CHAR, is that it is assigned to the ABAP type string.
    The table below shows the data types of the ABAP Dictionary that are based on the predefined types in the above table, and that can be addressed in an ABAP program. The elementary components of these data types are converted to predefined ABAP data types according to the final column in the above table, whereby the number of places m of each type is converted to lengths.
    Data types in the ABAP Dictionary Data types in ABAP
    Data element Elementary data type, Reference type
    Structure, Database table, View Structured data type
    Table type Table type
    Note
    As of release 6.20, a component of structures or database tables that has the type LANG can be identified as a text language. The text language is used for the conversion of character-type components of the structure when importing data from data clusters and for RFC between MDMP systems and Unicode systems.

  • Read parameter with type ref to

    Hi,
    I am implementing BADI "HRPAYFR_N4DS_CUST". In this, in one of the method there is a parameter (importing) "IO_N4DS_DAQ" type ref to "IF_HRPAYFR_N4DS_DAQ".
    Can you please let me know how to read PROCESS_EMPLOYEE-IO_EMPL -> CONSTRUCTOR-IV_PERNR value.
    Thanks,
    Satish

    Hi Sathish,
    In BADI  implementation try to get the PERNR like
    LV_PERNR = IO_N4DS_DAQ->MO_EMPL->MV_PERNR.

  • OUT parameter of type REF CURSOR

    DB: Oracle Database 10g Release 10.2.0.3.0 - Production
    OS: Windows xp
    I have got these two types:
    TYPE myrecord IS RECORD
    (column1           tab1.col1%TYPE,
    column2         tab1.col2%TYPE
    TYPE my_ref_cur IS REF CURSOR RETURN myrecord;Then I have this procedure:
    PROCEDURE proc1 (pid          IN       NUMBER, pout1      OUT my_ref_cur);How can I call the procedure from a pl/sql block and fetch from the cursor variable?
    I tried this, but it does not work for me:
    DECLARE
      lid NUMBER := 748;
      lcur1 my_ref_cur
    begin
      proc1 (lid, lcur1);
    end;I receive the error Wrong number or types of arguments in call to 'proc1'
    How it must be called?
    Thanks

    seems to work
    SQL> create table tab1
      2  (col1 number
      3  ,col2 number
      4  );
    Table created.
    SQL> insert into tab1 values (1,1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> create or replace package pack
      2  is
      3     TYPE myrecord IS RECORD
      4     (column1           tab1.col1%TYPE,
      5      column2         tab1.col2%TYPE
      6     );
      7     TYPE my_ref_cur IS REF CURSOR RETURN myrecord;
      8     procedure proc1 (pid          IN       number
      9                    , pout1      OUT my_ref_cur);
    10  end pack;
    11  /
    Package created.
    SQL>
    SQL> show error
    No errors.
    SQL>
    SQL> create or replace
      2  package body pack
      3  is
      4     procedure proc1 (pid          IN       number
      5                    , pout1      OUT my_ref_cur
      6                    )
      7     is
      8     begin
      9        open pout1
    10        for select col1
    11                 , col2
    12        from tab1;
    13     end proc1;
    14  end pack;
    15  /
    Package body created.
    SQL> show error
    No errors.
    SQL>
    SQL> DECLARE
      2    lid NUMBER := 748;
      3    lcur1 pack.my_ref_cur;
      4    r tab1%rowtype;
      5  begin
      6    pack.proc1 (lid, lcur1);
      7    fetch lcur1 into r;
      8    dbms_output.put_line (r.col1||' - '||r.col2);
      9    close lcur1;
    10  end;
    11  /
    1 - 1
    PL/SQL procedure successfully completed.

  • TYPE REF CURSOR

    I have two packages (please see below). A procedure from the first package (TEST1) calls a procedure in the second package (TEST2), which has an output parameter of REF CURSOR TYPE.
    I am getting an error at compile time, in the calling procedure.
    Can anyone please help on finding out what am I missing here?
    Thank you in advance.
    - Ketan Bhuptani
    Here are the procedures:
    (1)
    CREATE OR REPLACE PACKAGE TEST1
    AS
    TYPE cursor_type_pass IS REF CURSOR;
    PROCEDURE call_cursor (result_flag OUT varchar2);
    END TEST1;
    CREATE OR REPLACE PACKAGE BODY TEST1
    AS
    PROCEDURE call_cursor (result_flag OUT varchar2) IS
    v_salary int;
    proc_cursor cursor_type_pass;
    CURSOR emp_cur is select empid from emp;
    BEGIN
    FOR emp_cur_var IN emp_cur
    LOOP
    test2.open_cursor(emp_cur_var.empid, proc_cursor);
    v_salary := proc_cursor.salary;
         -- getting an error Invalid reference to variable proc_cursor at this line
    END LOOP;
    END call_cursor;
    END TEST1;
    (2)
    CREATE OR REPLACE PACKAGE TEST2
    AS
    TYPE cursor_type_return IS REF CURSOR;
    PROCEDURE open_cursor (emp_id IN varchar2, out_cur OUT cursor_type_return);
    END TEST2;
    CREATE OR REPLACE PACKAGE BODY TEST2
    AS
    PROCEDURE open_cursor (emp_id IN varchar2, out_cur OUT cursor_type_return) IS
    BEGIN
    OPEN out_cur FOR
    select location, salary from emp_information where empid = emp_id;
    END open_cursor;
    END TEST2;
    create table emp_information
    (location varchar2(30), salary int, empid varchar2(10));
    create table emp
    (empid varchar2(10));

    Your scenario is not very clear to me, but let us do some test coding here, see if it helps you,SQL> create or replace package test_pkg1 as
      2  TYPE cursor_type1 IS REF CURSOR;
      3  procedure proc1;
      4  end;
      5  /
    Package created.
    SQL> create or replace package test_pkg2 as
      2  TYPE cursor_type2 IS REF CURSOR;
      3  procedure proc2(pCur IN OUT cursor_type2);
      4  end;
      5  /
    Package created.
    SQL> create or replace package body test_pkg2 as
      2  procedure proc2(pCur IN OUT cursor_type2) is
      3  begin
      4      open pCur for SELECT ename from  my_emp;
      5  end;
      6  end;
      7  /
    Package body created.
    SQL> create or replace package body test_pkg1 as
      2  procedure proc1 is
      3  vRefCur    cursor_type1;
      4  vEname     VARCHAR2(20);
      5  vRefCur2   test_pkg2.cursor_type2;
      6  begin
      7    test_pkg2.proc2(vRefCur); -- this is possible, but I do not like it.
      8    vRefCur2 := vRefCur; -- you can also do this, but you have no reason to do this
      9    loop
    10      fetch vRefCur2 into vEname;
    11      exit when vRefCur2%NOTFOUND;
    12      dbms_output.put_line(vEname);
    13    end loop;
    14    close vRefCur2;
    15  end;
    16  end;
    17  /
    Package body created.
    SQL> exec test_pkg1.proc1;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    Let us make it simple,
    SQL> create or replace package body test_pkg1 as
      2  procedure proc1 is
      3  vRefCur    cursor_type1;
      4  vEname     VARCHAR2(20);
      5  --vRefCur2   test_pkg2.cursor_type2;
      6  begin
      7    test_pkg2.proc2(vRefCur);
      8    --vRefCur2 := vRefCur;
      9    loop
    10      fetch vRefCur into vEname;
    11      exit when vRefCur%NOTFOUND;
    12      dbms_output.put_line(vEname);
    13    end loop;
    14    close vRefCur;
    15  end;
    16  end;
    17  /
    Package body created.
    SQL> exec test_pkg1.proc1;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.You can play with it number of different ways.
    Let me know what questions and we will take it from there.
    Thx,
    SriDHAR

  • How to Get One type ref?

    Hii 
     In my Front Panel i am having 10 Boolean Controls , 5 String Controls and 3 Numeric controls ....  in that i want to take the 10 boolean control ref alone is it possible.................... 

    Hi Karthikey,
    The following code should help you:
    Ton
    Message Edited by TonP on 02-24-2009 08:02 AM
    Message Edited by TonP on 02-24-2009 08:02 AM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Example_VI_BD.png ‏7 KB

  • Xml conversion of data refs with dynamic type

    Hi Colleagues,
    I have to create an XML from a TYPE REF TO DATA, where this data is created using a dynamic internal table. By dynamic internal table i mean that the internal table is created dynamically using the class method cl_alv_table_create=>create_dynamic_table.
    Now the problem that i face is when i use the statement:
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'.
    to generate the XML i get a dump of type CX_XSLT_SERIALIZATION_ERROR saying "The ABAP data cannot be serialized."
    I found a solution to avoid the dump by adding the additional option " TECHNICAL_TYPES = 'ignore' " to the  CALL TRANSFORMATION statement, like
    CALL TRANSFORMATION id
          SOURCE jsag_data = im_context_b64
          RESULT XML lv_xml
          OPTIONS data_refs = 'embedded'
                  value_handling = 'move'
                  TECHNICAL_TYPES = 'ignore'.
    But, using this addition the dynamic type ref to data part is totally ignored from the XML generation.
    If I use a specific DDIC table type to create the data, we do not face this issue and the XML is generated as desired
    Does anyone have a solution to this problem as it has become a sort of blockade for our development?
    Thanks and Cheers,
    Gaurav.

    Hello,
    I reached same problem with dynamic data references, the only solution I got is to used global DDIC types (also for table types !!) when creating data which needs to be serialized.
    The options technical_types = 'ignore' doesn't solve the problem - it just instructs the parser to skip data references without global ddic type. The options value_handling = 'move' is very helpful as XML serialization is very picky about values beeing serialized.
    Here is summary of my observations:
    - Global DDIC type has to be associated with data reference, otherwise only technical type is there and this is not supported (you can use OPTIONS TECHNICAL_TYPES = u2018IGNOREu2019 but this will just skip the data to be serialized to XML) u2026
    - The above means that if you are serializing data reference to table then you have to have also global DDIC type for the table-type !! Unfortunatelly there is no default table type available for transparent tables u2026. They are treated as structures not as table-types u2026 thus:
    - CREATE DATA lr_data TYPE <global_ddic_structure> - can be serialized
    - CREATE DATA lr_data TYPE STANDARD TABLE OF <global_ddic_structure> - cannot be serialized
    - CREATE DATA lr_data TYPE <global_ddic_table_type> - can be serialized
    - !! Unfortunatelly !! CREATE DATA lr_data TYPE <type_pool_ddic_structure/ type_pool_table_type> - also cannot be serialized u2013 this is pitty u2026 this should be supported u2026.

  • How to determine type and access of REF TO DATA

    Hello experts,
    I have a structure with two fields, one string as name/ID and the second one REF TO DATA as placeholder for any value, so DATA can take for example another string or a numeric value or whatever. Ok, now I want to handle this DATA based on it's type, which is unknown at that point. So I first DESCRIBE the field (its type). If for example this type results in a string, I want to move this string data from REF TO DATA into a local string value. Then I want to reformat the string value and save it again to the REF TO DATA field.
    So, in short, I have these tasks:
    1. determine type of REF TO DATA
    2a. if it's a string, then move the val. of the string into a local string variable
    2b. or alternatively do something else, if it's not a string value
    3. do something with the local string, then save it back to the REF TO DATA field
    Any ideas?
    Thank in advance for your help!
    Kind regards, Matthias

    Hi Matthias
    I think you missed a little and very important detail here:
      ASSIGN ls_rec-value TO <fs>.
    That's not what we want, instead you need to use:
      ASSIGN ls_rec-value->* TO <fs>.
    That's why you are obtaining this type 'l' which is refering to a TYPE REF TO DATA itself. Doing it the right way your final type would be 'C' which corresponds with a character data type.
    Best Regards

  • Passing Ref Cursor as parameter to object type method

    I am encountering a problem passing a parameter of type REF CURSOR to methods of a set of object types I am developing.
    Here is an example of what I am trying to do:
    create or replace package p1 as
    type c_Cursor is ref cursor;
    end p1;
    create or replace type t_Object as object
    not instantiable method m1(p_Cursor in p1.c_Cursor) return varchar2
    ) not instantiable not final;
    create or replace type t_Subtype under t_Object as
    overriding method m1(p_Cursor in p1.c_Cursor)
    return varchar2
    The problem is that the PL/SQL compiler gives the error message PLS-00201 "p1.c_Cursor" not defined.
    According to my PL/SQL book (SF's Oracle PL/SQL Programming) the only way to use a ref cursor as a parameter to functions/procedures is to wrap them in a package. Indeed I have developed a test procedure in a different package that uses p1.c_Cursor as a parameter and it works fine.
    Oracle's documemtation suggests that object security (roles etc) can cause this error but as all the objects are being created in the same schema I don't see how this should be a problem.
    If anyone can suggest how to get around this problem I will be very grateful.
    BTW, if there are any mistakes in my sample code it's because I am writing it from memory as I don't have Internet access at work.
    Thanks,
    Charles.

    Thanks for your reply. I am still baffled as to why it doesn't work but, as you correctly point out, SYS_REFCURSOR works just fine. I figured that out earlier today and now the problem is solved.
    Charles.

Maybe you are looking for

  • Migration Wizard throws exception on launch

    PTPortal v5.0.1, After installation of the Exchange Integration Portlet suite, when I tried to launch the migration wizard to import the server packages (PTE's), I received the following java exception: Exception in thread main java.lang.Unsatisified

  • Ffmpeg-1:2.6-2 causes change in vlc video startup

    I use vlc-2.2.0-1 to watch dvb-t; after upgrading to the latest ffmpeg-1:2.6-2 I notice a change in decoder startup. Previously I saw nothing until a complete picture becomes available. After the upgrade I see a grey screen with partial picture which

  • Adobe Form: Potriat or Landscape display at runtime

    Hello Experts, I have a requirement where I need to dispaly an Adobe form in Potrait or Landscape format depending on the user input at runtime. There will be a checkbox on the selection screen, if it is checked, form should be displayed as landscape

  • How to insert data into two tables at once using XSJS

    Hello Experts, My requirement is to insert data into two tables at once. I have a XS JS app and want to update these tables via xsjs. How can I do this ? Is there any mechanism like sql 'transactions' also in Hana ? If yes, how can I call it via xsjs

  • KPI Audit Reports

    We want to monitor User actions and Report Scheduling. We enabled Audit Database. We setup the Activity Universe connection and the sample Audit Reports provided by Business Objects are running fine. But we are not getting any data to the reports bec