Sort table of objects by object attribute

Hi all,
I would like to write method for sorting table of objects. Sorting will be according selected attribute of object.
My problem is that when I have dynamic data, I'm not able to access attributes of object. Here is example in code. Problematic lines are commented.
If you have any idea how to solve it, I will be very happy.
CLASS lcl_reflection DEFINITION CREATE PUBLIC.
  PUBLIC SECTION.
    CLASS-METHODS: sort_object_table_by_field IMPORTING field_name   TYPE char72
                                                        direction    TYPE c DEFAULT 'A'
                                              CHANGING  object_table TYPE table.
ENDCLASS.                    "lcl_reflection DEFINITION
CLASS lcl_reflection IMPLEMENTATION.
  METHOD sort_object_table_by_field.
    DATA: obj_type_desc   TYPE REF TO cl_abap_refdescr,
          cls_type_desc   TYPE REF TO cl_abap_classdescr,
          tab_type_desc   TYPE REF TO cl_abap_tabledescr,
          elm_type_desc   TYPE REF TO cl_abap_elemdescr,
          struc_type_desc TYPE REF TO cl_abap_structdescr,
          line            TYPE REF TO data,
          tab             TYPE REF TO data,
          object          TYPE REF TO data,
          lt_component TYPE cl_abap_structdescr=>component_table,
          ls_component LIKE LINE OF lt_component.
    FIELD-SYMBOLS: <object> TYPE any,
                   <tab>    TYPE table,
                   <line>   TYPE any,
                   <value>  TYPE any.
    READ TABLE object_table INDEX 1 ASSIGNING <object>.
    cls_type_desc ?= cl_abap_classdescr=>describe_by_object_ref( <object> ).
    elm_type_desc ?= cls_type_desc->get_attribute_type( field_name ).
    obj_type_desc ?= cl_abap_refdescr=>create( cls_type_desc ).
    UNASSIGN <object>.
    ls_component-name = 'key'.
    ls_component-type = elm_type_desc.
    APPEND ls_component TO lt_component.
    ls_component-name = 'object'.
    ls_component-type ?= obj_type_desc.
    APPEND ls_component TO lt_component.
    struc_type_desc ?= cl_abap_structdescr=>create( lt_component ).
    tab_type_desc ?= cl_abap_tabledescr=>create( p_line_type  = struc_type_desc
                                                 p_table_kind = cl_abap_tabledescr=>tablekind_std
                                                 p_unique     = abap_false ).
    REFRESH lt_component.
    CLEAR ls_component.
    CREATE DATA line TYPE HANDLE struc_type_desc.
    CREATE DATA tab TYPE HANDLE tab_type_desc.
    CREATE DATA object TYPE HANDLE obj_type_desc.
    ASSIGN tab->* TO <tab>.
    ASSIGN line->* TO <line>.
    ASSIGN object->* TO <object>.
    LOOP AT object_table REFERENCE INTO object.
      APPEND INITIAL LINE TO <tab> REFERENCE INTO line.
      ASSIGN object->* TO <value>.
      ASSIGN line->* TO <line>.
*      <line>-key = <value>->(field_name).
*      <line>-object = object.
    ENDLOOP.
*    SORT <tab> BY key.
*    LOOP AT <tab> REFERENCE INTO line.
*      APPEND INITIAL LINE TO object_table REFERENCE INTO object.
*      object = line-object.
*    ENDLOOP.
  ENDMETHOD.                    "sort_object_table_by_field
ENDCLASS.                    "lcl_reflection IMPLEMENTATION

Ok guys, it's solved. It was little bit more complicated then I expected. Thanks for you help.
METHOD sort_object_table_by_field.
    TYPES: t_object TYPE REF TO object.
    DATA: obj_type_desc   TYPE REF TO cl_abap_refdescr,
          cls_type_desc   TYPE REF TO cl_abap_classdescr,
          tab_type_desc   TYPE REF TO cl_abap_tabledescr,
          elm_type_desc   TYPE REF TO cl_abap_elemdescr,
          struc_type_desc TYPE REF TO cl_abap_structdescr,
          r_line          TYPE REF TO data,
          r_tab           TYPE REF TO data,
          r_object        TYPE REF TO data,
          r_obj           TYPE REF TO data,
          lt_component TYPE cl_abap_structdescr=>component_table,
          ls_component LIKE LINE OF lt_component.
    FIELD-SYMBOLS: <object>    TYPE any,
                   <obj>       TYPE REF TO object,
                   <tab>       TYPE table,
                   <line>      TYPE any,
                   <key>       TYPE any,
                   <fs_key>    TYPE any,
                   <fs_object> TYPE any.
    READ TABLE object_table INDEX 1 ASSIGNING <object>.
    cls_type_desc ?= cl_abap_classdescr=>describe_by_object_ref( <object> ).
    elm_type_desc ?= cls_type_desc->get_attribute_type( field_name ).
    obj_type_desc ?= cl_abap_refdescr=>create( cls_type_desc ).
    UNASSIGN <object>.
    ls_component-name = 'key'.
    ls_component-type = elm_type_desc.
    APPEND ls_component TO lt_component.
    ls_component-name = 'object'.
    ls_component-type ?= obj_type_desc.
    APPEND ls_component TO lt_component.
    struc_type_desc ?= cl_abap_structdescr=>create( lt_component ).
    tab_type_desc ?= cl_abap_tabledescr=>create( p_line_type  = struc_type_desc
                                                 p_table_kind = cl_abap_tabledescr=>tablekind_std
                                                 p_unique     = abap_false ).
    REFRESH lt_component.
    CLEAR ls_component.
    CREATE DATA r_line TYPE HANDLE struc_type_desc.
    CREATE DATA r_tab TYPE HANDLE tab_type_desc.
    CREATE DATA r_object TYPE HANDLE obj_type_desc.
    CREATE DATA r_obj TYPE REF TO object.
    ASSIGN r_tab->* TO <tab>.
    LOOP AT object_table REFERENCE INTO r_object.
      APPEND INITIAL LINE TO <tab> REFERENCE INTO r_line.
      ASSIGN r_object->* TO <object>.
      ASSIGN r_obj->* TO <obj>.
      MOVE <object> TO <obj>.
      ASSIGN <obj>->(field_name) TO <key>.
      ASSIGN r_line->* TO <line>.
      ASSIGN COMPONENT 'KEY' OF STRUCTURE <line> TO <fs_key>.
      ASSIGN COMPONENT 'OBJECT' OF STRUCTURE <line> TO <fs_object>.
      <fs_object> = <object>.
      <fs_key> = <key>.
    ENDLOOP.
    DATA: sort_field TYPE fieldname.
    sort_field = 'KEY'.
    SORT <tab> BY (sort_field).
    REFRESH object_table.
    LOOP AT <tab> REFERENCE INTO r_line.
      APPEND INITIAL LINE TO object_table REFERENCE INTO r_object.
      ASSIGN r_line->* TO <line>.
      ASSIGN r_object->* TO <object>.
      ASSIGN COMPONENT 'OBJECT' OF STRUCTURE <line> TO <fs_object>.
      <object> = <fs_object>.
    ENDLOOP.
  ENDMETHOD.

Similar Messages

  • Info Object Attribute table

    Hi All,
    Could you please let us know the table name where info object attributes are stored in BW system?
    Regards,
    Rahul

    Hi,
    Try this table RSDBCHATR
    Thanks
    El.

  • How to reference the Parent view Object attribute in Child View object

    Hi , I have the requirememt to generate Tree like struture to display Salary from joining date to retirement date in yearly form.I have writtent two Pl/SQL function to return parent node and child nodes(based on selected year).
    1.First function --> Input paramter (employee id, retirement date , joining date) --> return parent node row with start_date and end_date
    2. 2nd function --> input paarmter(employee id, startDate, end_date) --> return child node based on selected parent node i.e. start date and end date
    I have created two ADF view object based on two function return
    Parent Node --> select * from Table( EUPS.FN_GET_CONTR_SAL_BY_YR(employeeId,retirement Date, dateOf joining)) ;
    Child Node --> select * FROM TABLE( EUPS.FN_GET_CONTR_SAL_FOR_YEAR( employeId,startDate, endDate) ) based on selected parent node.
    I am giving binding variable as input for 2nd function (child node) . I don't know how to reference the binding variable value in child view from parent view.
    Like I have to refernce employeId,startDate, endDate values in 2nd function from parent view object. some thing like parentNode.selectedStart_date parentNode.employeeId.
    I know we can achive this writing the code in backing bean.But i want to know how can we refernce parent view object attribute values in child view object using Groovy or otherway?
    I will appreciate your help.
    Thanks

    I have two view com.ContractualSalaryByYearlyView for Parent Node and com.ContractualSalaryByYearlyView for child Node.
    I have created view link(ContractualSalYearlyByYearViewLink) betweem two view by giving common field empId, stDate , endDate.(below is the view link xml file).
    I tried give the binding attribute values using parent object reference like below in com.ContractualSalaryByYearlyView xml file but getting error
    Variable ContractualSalaryByYearlyView not recognized.I think i am using groovy expression.
    Thanks for quick response.
    com.ContractualSalaryByYearlyView xml
    <ViewObject
    <DesignTime>
    <Attr Name="_isExpertMode" Value="true"/>
    </DesignTime>
    <Variable
    Name="empId"
    Kind="where"
    Type="java.lang.Integer">
    <TransientExpression><![CDATA[adf.object.ContractualSalaryByYearlyView.EmpId]]></TransientExpression>
    </Variable>
    ContractualSalYearlyByYearViewLink.xml file
    <ViewLinkDefEnd
    Name="ContractualSalaryByYearlyView"
    Cardinality="1"
    Owner="com.ContractualSalaryByYearlyView"
    Source="true">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryByYearlyView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryByYearlyView.EmpId"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.StDate"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>
    <ViewLinkDefEnd
    Name="ContractualSalaryForYearView"
    Cardinality="-1"
    Owner="com.ContractualSalaryForYearView">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryForYearView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryForYearView.EmpId"/>
    <Item
    Value="com.ContractualSalaryForYearView.StDate"/>
    <Item
    Value="com.ContractualSalaryForYearView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>

  • Help!! Calling PL/SQL with table of objects params

    Hi JDBC experts,
    This is probably a familiar problem to many of you and I was hoping you can help me.
    I have a JDBC application that makes calls to a PL/SQL stored procedure that accepts and returns tables (arrays) of objects. I have an equivalent representation of these in Java (the object is a simple Java class and the array of objects is a subclass of ArrayList). The object has around 10 attributes (varchar and number) and the call typically accepts and returns between 50 and 100 objects.
    I noticed that converting from one representation to the other before and after the JDBC call is very time consuming. Before calling the procedure, I need to instantiate a new oracle.sql.ARRAY and fill it with oracle.sql.STRUCT equivalents for each object in my ArrayList. After the procedure call returns, I need to instantiate a new ArrayList and fill it with my Java object representation for each oracle.sql.STRUCT in the returned oracle.sql.ARRAY. Given the # of objects returned and the size of each object, this causes performance degradation.
    Is there any way I can avoid the above conversion overhead? I was reading somewhere about jpub and CustomDatum. I tried it out but the code that sqlj generated looked rather complex - but if this is the recommended approach, I can follow that.
    Also, are there any java code examples for dealing with table of (non-scalar) objects with CustomDatum? I saw some code for using CustomDatum with single objects but not with a table of objects.
    Your help is much appreciated!
    Thanks,
    Niranjan

    I would do it like this :
    - use existsNode function in the filter predicate to look for candidate rows regardless of the number of occurrences of target nodes in the document
    - use XPath predicates on attributes to restrict target nodes
    SQL> create table temp1 of xmltype;
    Table created
    SQL>
    SQL> insert into temp1 values(xmlparse(document
      2  '<soc id="2">
      3   <listsectii>
      4    <sectie cods="4">
      5     <prodv codp="2" cant=""></prodv>
      6    </sectie>
      7    <sectie cods="5">
      8     <prodv codp="8"></prodv>
      9    </sectie>
    10    <sectie cods="6">
    11     <prodv codp="2"></prodv>
    12    </sectie>
    13   </listsectii>
    14  </soc>'));
    1 row inserted
    SQL>
    SQL> update temp1
      2  set object_value =
      3      updateXML( object_value
      4               , '/soc/listsectii/sectie[@cods="4"]/prodv[@codp="2"]/@cant'
      5               , 'new_cant' )
      6  where existsNode( object_value
      7                  , '/soc/listsectii/sectie[@cods="4"]/prodv[@codp="2"]' ) = 1
      8  ;
    1 row updated
    SQL> select * from temp1;
    SYS_NC_ROWINFO$
    <soc id="2">
      <listsectii>
        <sectie cods="4">
          <prodv codp="2" cant="new_cant"/>
        </sectie>
        <sectie cods="5">
          <prodv codp="8"/>
        </sectie>
        <sectie cods="6">
          <prodv codp="2"/>
        </sectie>
      </listsectii>
    </soc>
    Of course, that implies there's already an existing "cant" attribute (not the case in your samples).
    If you actually need to create one, then you must use insertChildXML() instead.

  • Entity object attribute with a list of objects

    Does anyone know how one sets up an entity object that has an attribute with a list of objects as the type? (assuming that's supported)
    as in:
    CREATE TYPE phones AS VARRAY(10) OF varchar2(10);
    Create table suppliers (supcode number(5),
    Company varchar2(20),
    ph phones);
    The SOA Suite in jDeveloper (new Entity Object/attributes etc) has an ARRAY that can point to REF or OBJECT. Neither work. When I try to Create DB Object later from the Entity Object I've created I get an invalid type.

    What you suggested about "validation codes on the VO" is not written on the ADF Documentation.
    I try to blindly/strictly follow best practices (particularly on Validations, using Declartive and/or built in validators) on most ADF documentation and blogs but there are many scenarios on coding some large ADF projects that I think must veer away from the best practices stated on the documentation or maybe add new rules on the documentation depending on how complex an ADF project would be.
    I religiously followed best practices stated on the documentation to use Entity and Attribute Validators when performing validations. What I did was i had created lots of Custom Validators (by implementing JboVAlidatorInterface interface) for each of the attributes on an Entity Object that need validated. So those validator is valid only for one attribute, its not reusable. And those validation codes either have reference to a ViewObject or call some PL/SQL procedure. So at some point are codes became messy.
    Ultimately the whole project became harder to manage when the codes became large. Now I am trying to refactor the whole application by separating it into project/package and I am hoping to do it with little Re-coding as possible.
    Hope to get your opinion on this one.
    regards,
    Anton

  • Business object attribute assignment

    Hi Al Experts,
    We have a transaction in SAP called SWF_BAM where we can trigger a proxy call on the basis of events triuggered.
    I created a z BO and i am trying to create the binding between my BO and proxy structure.
    Here we can link the BO attributes with proxy structure.
    In my proxy structure i have a table type .
    Is there any way to create an attribute in Business Objetc of a table type??
    Please guide me thanks in advance.

    Rick,
    Thanks for reply.
    It always ask for reference field.
    its not working.
    actually that table type of proxy structure is appearing as container element and we have business  object attributes comes as container element
    we can do it in container element but it is not allowing me to do in business object.
    Please tell me any way to do it.
    One question
    can we achieve this using ABAP class?
    Thanks in advance

  • CO data extraction:  report table CO object product cost accounting

    In <b>R/3</b> I have a report which has been created with the <u>Report Writer</u> (tCode GR31). It uses a <u>library</u> based on the <i>report table CO object product cost accounting</i> (KKBC).
    The interesting aspect is that this library contains the <u>characteristic</u> <i>sales order number</i> (KDAUF). Using it as well as other characteristics (<i>cost element</i>, <i>value type</i>, <i>results analysis version</i>), the <u>key figure</u> <i>total costs</i> SWKG has been <u>restricted</u> (in the BI meaning) in a variety of ways, giving several restricted key figures.
    I am looking for the corrisponding <u>content objects</u> in <b>BW</b> which could allow obtaining the same result. My issue is that all the objects I've found apparently don't have the detail of <u>0DOC_NUMBER</u>.
    After reading the manual page <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/cb/149b3979e90e1be10000000a114084/frameset.htm">InfoCubes in Controlling</a> I've considered the following InfoCubes:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/64/0a6937adf79120e10000009b38f842/frameset.htm">CO-PC-OBJ: Cost Object Controlling</a> (0PC_C01)
    It contains only the data of <u>cost elements</u> linked to <u>production orders</u>. As a consequence, the costs elements linked generically to the <u>customer orders</u> are not present. Please notice that the <u>navigational attribute</u> 0DOC_NUMBER is an attribute of 0PRODORDER.
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/33/6db6385443bd7ae10000009b38f8cf/content.htm">CO-OM: Costs and Allocations (Delta Extraction)</a> (0COOM_C02)
    It contains all the <u>cost elements</u>, thus also those which are linked to the <u>customer orders</u>. Unfortunately the data are not at the desired level of detail, being aggregated with respect to 0DOC_NUMBER. When a cost element is linked to a production order, the characteristic <i>partner object</i> (0PIOVALUE) contains the <i>production order number</i>. However for those cost elements which are linked to sales documents, the characteristic <i>partner object</i> has no value.
    Do you have any idea what <u>DataSource</u> could give me all the data I need, currentrly extracted in R/3 through the KKBC reporting structure?
    Cheers, Davide

    Hello all,
    the thread Business Content for Product Cost by Sales Order by Christian J explains the very same problem I'm facing - in a much clearer way. Unfortunately his issue hasn't been completely solved.
    Has anyone any idea about it?
    Thanks, Davide<b></b>
    Message was edited by:
            Davide Cavallari

  • Accessing details from multiline object attribute..

    Hi Workflowers, help sought..
    Can anyone show me how I can access the <u>value</u> attributes of a <u>multiline object reference</u> attribute.
    For example, I want to create a new multiline attribute in the <i>SalesOrder</i> object (ZBUS2032) called <b>LineQuantities</b>.  ZBUS2032 has a multiline <u>object reference</u> attribute called <i>Items</i>. I want to place the QUANTITY attributes of all of the <i>Items</i> of the SalesOrder into my new <b>LineQuantities</b> attribute.  What is the syntax to retrieve all the QUANTITY attributes of the <i>Items</i> to my new multiline attribute of the SalesOrder?
    Can I use something like
    SWC_GET_TABLE_PROPERTY self  'Items'  <b>it_quantity</b>
    to retrieve a list of the <i>Items</i> quantity attributes? In that case, <b>it_quantity</b> would need to be defined as a table of object references, and I would still need to get the quantity attribute from each object somehow. There is probably straightforward way to do this, if someone can enlighten me.
    Not sure how to do it, any pointers much appreciated.

    Hi Tony,
    Please confirm, First of all did you copy as Subtype of BUS2032. Don't copy directly.
    define virtual attribute for Quantity, then you can use multiline container element.
    Check this Link for more details:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4acd5453d11d189430000e829fbbd/frameset.htm
    Thanks and Regards,
    Prabhakar Dharmala

  • Sporadically getting error "string or binary data would be truncated" in SQL server 2008 while inserting in a Table Type object

    I am facing a strange SQL exception:-
    The code flow is like this:
    .Net 4.0 --> Entity Framework --> SQL 2008 ( StoredProc --> Function {Exception})
    In the SQL Table-Valued Function, I am selecting a column (nvarchar(50)) from an existing table and (after some filtration using inner joins and where clauses) inserting the values in a Table Type Object having a column (nvarchar(50))
    This flow was working fine in SQL 2008 but now all of sudden the Insert into @TableType is throwing  "string or binary data would be truncated"  exception. 
    Insert Into @ObjTableType
    Select * From dbo.Table
    The max length of data in the source column is 24 but even then the insert statement into nvarchar temp column is failing.
    Moreover, the same issue started coming up few weeks back and I was unable to find the root cause, but back then it started working properly after few hours
    (issue reported at 10 AM EST and was automatically resolved post 8 PM EST). No refresh activity was performed on the database.
    This time however the issue is still coming up (even after 2 days) but is not coming up in every scenario. The data set, for which the error is thrown, is valid and every value in the function is fetched from existing tables. 
    Due to its sporadic nature, I am unable to recreate it now :( , but still unable to determine why it started coming up or how can i prevent such things to happen again.
    It is difficult to even explain the weirdness of this bug but any help or guidance in finding the root cause will be very helpful.
    I also Tried by using nvarchar(max) in the table type object but it didn't work.
    Here is a code similar to the function which I am using:
    BEGIN
    TRAN
    DECLARE @PID
    int = 483
    DECLARE @retExcludables
    TABLE
        PID
    int NOT
    NULL,
        ENumber
    nvarchar(50)
    NOT NULL,
        CNumber
    nvarchar(50)
    NOT NULL,
        AId
    uniqueidentifier NOT
    NULL
    declare @PSCount int;
    select @PSCount =
    count('x')
    from tblProjSur ps
    where ps.PID
    = @PID;
    if (@PSCount = 0)
    begin
    return;
    end;
    declare @ExcludableTempValue table (
            PID
    int,
            ENumber
    nvarchar(max),
            CNumber
    nvarchar(max),
            AId
    uniqueidentifier,
            SIds
    int,
            SCSymb
    nvarchar(10),
            SurCSymb
    nvarchar(10)
    with SurCSymbs as (
    select ps.PID,
                   ps.SIds,              
                   csl.CSymb
    from tblProjSur ps
                right
    outer join tblProjSurCSymb pscs
    on pscs.tblProjSurId
    = ps.tblProjSurId
    inner join CSymbLookup csl
    on csl.CSymbId
    = pscs.CSymbId 
    where ps.PID
    = @PID
        AssignedValues
    as (
    select psr.PID,
                   psr.ENumber,
                   psr.CNumber,
                   psmd.MetaDataValue
    as ClaimSymbol,
                   psau.UserId
    as AId,
                   psus.SIds
    from PSRow psr
    inner join PSMetadata psmd
    on psmd.PSRowId
    = psr.SampleRowId
    inner join MetaDataLookup mdl
    on mdl.MetaDataId
    = psmd.MetaDataId
    inner join PSAUser psau
    on psau.PSRowId
    = psr.SampleRowId
                inner
    join PSUserSur psus
    on psus.SampleAssignedUserId
    = psau.ProjectSampleUserId
    where psr.PID
    = @PID
    and mdl.MetaDataCommonName
    = 'CorrectValue'
    and psus.SIds
    in (select
    distinct SIds from SurCSymbs)         
        FullDetails
    as (
    select asurv.PID,
    Convert(NVarchar(50),asurv.ENumber)
    as ENumber,
    Convert(NVarchar(50),asurv.CNumber)
    as CNumber,
                   asurv.AId,
                   asurv.SIds,
                   asurv.CSymb
    as SCSymb,
                   scs.CSymb
    as SurCSymb
    from AssignedValues asurv
    left outer
    join SurCSymbs scs
    on    scs.PID
    = asurv.PID
    and scs.SIds
    = asurv.SIds
    and scs.CSymb
    = asurv.CSymb
    --Error is thrown at this statement
    insert into @ExcludableTempValue
    select *
    from FullDetails;
    with SurHavingSym as (   
    select distinct est.PID,
                            est.ENumber,
                            est.CNumber,
                            est.AId
    from @ExcludableTempValue est
    where est.SurCSymb
    is not
    null
    delete @ExcludableTempValue
    from @ExcludableTempValue est
    inner join SurHavingSym shs
    on    shs.PID
    = est.PID
    and shs.ENumber
    = est.ENumber
    and shs.CNumber
    = est.CNumber
    and shs.AId
    = est.AId;
    insert @retExcludables(PID, ENumber, CNumber, AId)
    select distinct est.PID,
    Convert(nvarchar(50),est.ENumber)
    ENumber,
    Convert(nvarchar(50),est.CNumber)
    CNumber,
                            est.AId      
    from @ExcludableTempValue est 
    RETURN
    ROLLBACK
    TRAN
    I have tried by converting the columns and also validated the input data set for any white spaces or special characters.
    For the same input data, it was working fine till yesterday but suddenly it started throwing the exception.

    Remember, the CTE isn't executing the SQL exactly in the order you read it as a human (don't get too picky about that statement, it's at least partly true enough to say it's partly true), nor are the line numbers or error messages easy to read: a mismatch
    in any of the joins along the way leading up to your insert could be the cause too.  I would suggest posting the table definition/DDL for:
    - PSMetadata, in particular PSRowID, but just post it all
    - tblProjectSur, in particularcolumns CSymbID and TblProjSurSurID
    - cSymbLookup, in particular column CSymbID
    - PSRow, in particular columns SampleRowID, PID,
    - PSAuser and PSUserSur, in particualr all the USERID and RowID columns
    - SurCSymbs, in particular colum SIDs
    Also, a diagnostic query along these lines, repeat for each of your tables, each of the columns used in joins leading up to your insert:
    Select count(asurv.sid) as count all
    , count(case when asurv.sid between 0 and 9999999999 then 1 else null end) as ctIsaNumber
    from SurvCsymb
    The sporadic nature would imply that the optimizer usually chooses one path to the data, but sometimes others, and the fact that it occurs during the insert could be irrelevant, any of the preceding joins could be the cause, not the data targeted to be inserted.

  • How can I fill a table of objects from cursor with select * bulk collect???

    Hi All, I have a TYPE as OBJECT
    create or replace type dept2_o as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    I can fill a table of objects from cursor with out select * bulk collect...., row by row
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    i integer;
    begin
    i:=0;
    dept_o_tab.extend(20);
    for rec in (select * from dept) loop
    i:=i+1;
    dept_o_tab(i):=dept2_o(
    deptno => rec.deptno,
    dname => rec.dname,
    loc =>rec.loc
    end loop;
    for k IN 1..i loop
    dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
    end loop;
    end;
    RESULT
    10 ACCOUNTING NEW YORK
    20 RESEARCH DALLAS
    30 SALES CHICAGO
    40 OPERATIONS BOSTON
    But I can't fill a table of objects from cursor with select * bulk collect construction ...
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    begin
    dept_o_tab.extend(20);
    select * bulk collect into dept_o_tab from dept;
    end;
    RESULT
    ORA-06550: line 6, column 39;
    PL/SQL: ORA-00947: not enough values ....
    How can I fill a table of objects from cursor with select * bulk collect???

    create or replace type dept_ot as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    create table dept
    (deptno number
    ,dname varchar2(14)
    ,loc varchar2(13)
    insert into dept values (10, 'x', 'xx');
    insert into dept values (20, 'y', 'yy');
    insert into dept values (30, 'z', 'zz');
    select dept_ot (deptno, dname, loc)
      from dept
    create type dept_nt is table of dept_ot
    declare
       l_depts dept_nt;
    begin
       select dept_ot (deptno, dname, loc)
         bulk collect
         into l_depts
         from dept
       for i in l_depts.first .. l_depts.last
       loop
          dbms_output.put_line (l_depts(i).deptno);
          dbms_output.put_line (l_depts(i).dname);
          dbms_output.put_line (l_depts(i).loc);    
       end loop;
    end;
    /

  • Issue with internal table in object oriented ABAP.

    Hello Gurus,
    I am having trouble defining internal table in Object oriented ABAP. for following:
    DATA: BEGIN OF IT_TAB OCCURS 0.
            INCLUDE STRUCTURE ZCUSTOM.
    DATA    tot_sum   TYPE char40.
    DATA END OF IT_TAB.
    Can someone help ?
    Regards,
    Jainam.
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Moderator message - Please post in the correct forum. You can easily find out for yourself by looking at SAP help for internal tables using OOP - thread locked
    Edited by: Rob Burbank on Feb 5, 2010 2:49 PM

    No, you can not declare internal table with header line in OO context. You have to declare the work are/header line separately
    Example:
    TYPES: BEGIN OF ty_it_tab.
            INCLUDE STRUCTURE mara.
    TYPES:  tot_sum TYPE char40.
    TYPES: END OF ty_it_tab.
    DATA: it_tab TYPE STANDARD TABLE  OF ty_it_tab.
    DATA: wk_tab TYPE ty_it_tab.
    LOOP AT it_tab INTO wk_tab.
    ENDLOOP.
    Edited by: Dean Q on Feb 5, 2010 8:50 PM

  • Archiving Object - Entry missing in Customizing table for object Z*********

    Hello friends,
    We have created a archiving object in transaction AOBJ. However when i enter this object in SARA, we get this error message.
    "Entry missing in Customizing table for object Z******* "
    I have matched my object with few other archiving objects and things looks similar.
    Have you faced this kind of problem..
    thanks
    ashish

    Hi,
    I checked and i can see entry for ZSCS_TRAFO object in AOBJ.
    But when i enter ZSCS_TRAFO, i get this error :
    Entry missing in Customizing table for object ZSCS_TRAFO
    Message no. BA057
    Diagnosis
    A function cannot be executed due to a missing table entry.
    Procedure
    Please create an entry for the archive object ZSCS_TRAFO with the AOBJ transaction.
    However, a few other Z objects works well.
    thanks
    ashish

  • Problem to access the object attribute in a code

    Hi guys,
    I need to pass the attribute of a business object to class.Below is the code but its throwing an error 'There is no component ZYBTT in l_bus2000116'.Since the business object conatins the attribute but its throwing an error.Could any one throw some light on the below code -
    data: l_BUS2000116 type swc_object,
          Z_BRF_Function_name TYPE FDT_UUID.
    swc_get_element ac_container 'Z_Quotation' l_BUS2000116.
    swc_get_element ac_container 'Z_BRF_Function_name' Z_BRF_Function_name.
    CALL METHOD ZYCLOTO_AGENTDTMT_BRF=>ZYOTOM_GET_AGENT_IDS_SING_LEV
      EXPORTING
        IM_FUNCTION_ID  = Z_BRF_Function_name
        IM_BTT          = l_BUS2000116-ZYBTT
       IM_COMPL_CAT    =
       IM_COUNTRY_CODE = ZYCOUNTRY
        IM_LEAD_BRAND   = l_BUS2000116-leadbrand
        IM_RISK_LEVEL   = l_BUS2000116-ZYRISKLEVEL
        IM_SALES_ORG    = l_BUS2000116-ZYsalesorg
        IM_TCV          = l_BUS2000116-ZYTCV.
    IMPORTING
       EX_FULL_NAME    =
       EX_RETURN       =

    Hi,
    Is ZYBTT a new attribute? Have you changed the status of the attribute to implemented or released (in SWO1: Edit -> Change release status)?
    And actually I think that your syntax is wrong too (BOR world is different compared to classes). If you want to use an attribute, I think that the syntax should be something like this:
    SWC_GET_PROPERTY <Object> <Attribute> <AttributeValue>.
    Read more here:
    http://help.sap.com/saphelp_nw04/helpdata/en/c5/e4acef453d11d189430000e829fbbd/content.htm
    Regards,
    Karri

  • Setting object attribute in dynamic sql

    I am trying to set an object attribute in PL/SQL. It looks like execute immediate is unhappy with
    create type test_object as object(username varchar2(200),id number);
    declare
    obj test_object;
    username varchar2(50);
    begin
    obj := test_object(null,null);
    username := 'MIKE';
    execute immedaite 'begin :x.username := :y; end;' using obj,username;
    end;
    Is this supposed to work?

    Hi Tony,
    Thanks so much for your response. I've had to study up on the dbms_sql package to understand your function... first time I've used it. I've fed my dynamic query to your function and see that it returns a colon delimited list of the column names; however, I think I need a little more schooling on how and where exactly to apply the function to actually set the column names in APEX.
    From my test app, here is the code for my dynamic query. I've got it in a "PL/SQL function body returning sql query" region:
    DECLARE 
      v_query      VARCHAR2(4000);
      v_as         VARCHAR2(4);
      v_range_from NUMBER;
      v_range_to   NUMBER;         
    BEGIN
      v_range_from := :P1_FY_FROM;
      v_range_to   := :P1_FY_TO;
      v_query      := 'SELECT ';
      -- build the dynamic column selections by looping through the fiscal year range.
      -- v_as is meant to specify the column name as (FY10, FY11, etc.), but it's not working.
      FOR i IN v_range_from.. v_range_to  LOOP
        v_as    := 'FY' || SUBSTR(i, 3, 4);
        v_query := v_query || 'MAX(DECODE(FY_NB,' || i || ',PFH_HEADCOUNT,0)) '
          || v_as || ',';
      END LOOP;
      -- add the rest of the query to the dynamic column selection
      v_query := rtrim(v_query,',') || ' FROM ('
        || 'SELECT FY_NB, PFH_HEADCOUNT FROM ('
        || 'SELECT FY_ID, FY_NB FROM FISCAL_YEAR) A '
        || 'LEFT OUTER JOIN ('
        || 'SELECT FY_ID, PFH_HEADCOUNT '
        || 'FROM PROJECT_FY_HEADCOUNT '
        || 'JOIN PROJECT_FY USING (PF_ID) '
        || 'WHERE PL_ID = ' || :P1_PROJECT || ') B '
        || 'ON A.FY_ID = B.FY_ID)';
      RETURN v_query;
    END;I need to invoke GET_QUERY_COLS(v_query) somewhere to get the column names, but I'm not sure where I need to call it and how to actually set the column names after getting the returned colon-delimited list.
    Can you (or anyone else) please help me get a little further? Once again, feel free to login to my host account to see it first hand.
    Thanks again!
    Mark

  • Add Object Attributes to a DisplayObject that is created in the Authoring Tool

    Hello, how can I add attributes to a Display Object, that I have created in the Authoring Tool, so I can acces it by:
    myDisplayObjectInstance.myNewAttribute
    Is a DisplayObejct a dynamic class, that can be extended from anywhere?
    Thanks a lot

    I just found the syntax to add a new ObjectAttribute to an Instance of the Object. But is this ObjectAttribute also added to all other  Instances of the Obejct?
    My plan was to create a MovieClip and set some ActionScript inside its timeline in the first frame that adds some Objcet Attributes to that MovieClip, so that the new Object Attribute can be used for all Instances of this MovieClip, that are created in the runtime.

Maybe you are looking for

  • Calendar invites not showing up in icloud email

    Hi all - I gave my son an 8GB 4th gen iPod Touch this week and went about setting it up for him. I got him an icloud email address and started sending calendar invites from my .mac address along with my wife's gmail address. None of these calendar in

  • Create an audiobook playlist

    Hi.  I ripped some Spanish lessons from CD, and now I want to: -change the tracks to "audiobook" rather than "music";  and -create an audiobook playlist. I don't want the audiobook tracks shuffling through with music. Thanks for your help. M

  • What the best ways to save web pages  on the cloud ? Using an iPhone ?

    Dear folks I read a lot of web pages on iPhone that I need to refer to / come back to later I have limited space on my iPhone and do not want to clutter the phone saving all these pages What are the best options to a) save these web pages on the clou

  • ERROR com.day.crx.core.util.console.AbstractConsole using CRX console tool

    Hello Experts, I am having issue while running CRX console tool (console.sh with CRX 2.2). I was trying to execute "check" command using this tool to perform repository check but unfortunately its throwing following exception while running. 268154 [m

  • Goods Reciept Table

    Hi all, Can any body tell me the tables for Goods Reciept, Balu.