Hash tables in combination with data references to the line type.

I'm having an issue with hash tables - in combination with reference variables.
Consider the following:  (Which is part of a class)  -  it attempts to see if a particular id exists in a table; if not add it; if yes change it.   
  types: BEGIN OF TY_MEASUREMENT,
           perfid      TYPE zgz_perf_metric_id,
           rtime       TYPE zgz_perf_runtime,
           execount    TYPE zgz_perf_execount,
           last_start  TYPE timestampl,
         END OF TY_MEASUREMENT.
METHOD START.
  DATA:  ls_measurement TYPE REF TO ty_measurement.
  READ TABLE gt_measurements WITH TABLE KEY perfid = i_perfid reference into ls_measurement.
  if sy-subrc <> 0.
    "Didn't find it.
    create data ls_measurement.
    ls_measurement->perfid = i_perfid.
    insert ls_measurement->* into gt_measurements.
  endif.
  GET TIME STAMP FIELD ls_measurements-last_start.
  ls_measurement->execount = ls_measurement->execount + 1.
ENDMETHOD.
I get compile errors on the insert statement - either "You cannot use explicit index operations on tables with types HASHED TABLE" or "ANY TABLE".      It is possible that.
If I don't dereference the type then I get the error  LS_MEASUREMENT cannot be converted to the line type of GT_MEASUREMENTS.
I'm not looking to solve this with a combination of references and work ares - want a reference solution.   
Thanks!
_Ryan
Moderator message - Moved to the correct forum
Edited by: Rob Burbank on Apr 22, 2010 4:43 PM

I think it might work when you change it for
insert ls_measurement->* into TABLE gt_measurements.
For hashed table a new line here will be inserted according to given table key.
Regards
Marcin

Similar Messages

  • Can not see the option Execution with Data Change in the infoprovider?

    Hi team,
    i am using query designer 3.x, when i go into my bex brodcaster settings and schedule my report
    i can not see the option "Execution with Data Change in the infoprovider",
    i can only see 2 options
    Direct scheduling in background process
    create new scheduling
    periodic,
    is there any setting which i would be able to see the option "Execution with Data Change in the infoprovider"?
    kindly assist

    Hi Blusky ,
    check the below given link.
    http://help.sap.com/saphelp_nw04/Helpdata/EN/ec/0d0e405c538f5ce10000000a155106/frameset.htm
    Regards,
    Rohit Garg

  • When I try to use 'Stacked Column Bar'. with data assigned in the graphs, and want to see it in the 'Preview' mode in Xeclsius, I unable to see the graphs apart from the Axes ans Series Value, the graphs becomes totaly invisible why So ?

    When I try to use 'Stacked Column Bar'. with data assigned in the graphs, and want to see it in the 'Preview' mode in Xeclsius, I unable to see the graphs apart from the Axes ans Series Value, the graphs becomes totally invisible why So ?

    Hi Ranendra,
    For basic understanding of Dashboards and Models you can use standard Templates or samples which ll come along with dashboard designer(Formly Xcelsius) installation.
    For path   File-->Templates(or Samples).
    Under Templates you ll have different categories and for each you ll find the dashboard Templates.
    Regards,
    Venkat P

  • In "LOOP ... WHERE ..." the line type of the table must be statically defin

    Hi All,
            I have written the code, for greater than (GJAHR) 2007 and restricted company codes ( table name = ZGLCCODE).
         Here I have written the following the code which is giving an error
    In "LOOP ... WHERE ..." the line type of the table must be statically defin
    ZGLCCODE Contains only restricted company codes.
    Code is as follows
    TABLES : ZGLCCODE. 
    DATA : LT_DATAPACKAGE TYPE TABLE OF DTFIGL_4.
    DATA : LS_PACKAGE TYPE DTFIGL_4.
    TYPES: BEGIN OF LS_TZGLCCODE,
           ZBUKRS type BUKRS,
            END OF LS_TZGLCCODE.
    DATA : LT_ITZGLCCODE TYPE LS_TZGLCCODE OCCURS 0 WITH HEADER LINE.
    DATA : LI_NUM TYPE I,
           LC_ZGJAHR TYPE BSEG-GJAHR VALUE '2007'.
    SELECT ZBUKRS INTO TABLE LT_ITZGLCCODE FROM ZGLCCODE.
    Note:  "C_T_DATA" dynamic structure = "DTFIGL_4" structure
    *-  Remove from the DataSource Company Code -
    LOOP AT C_T_DATA INTO LS_PACKAGE WHERE GJAHR GE '2007'.
    READ TABLE LT_ITZGLCCODE WITH KEY ZBUKRS = LS_PACKAGE-BUKRS.
    IF SY-SUBRC <> 0.
       APPEND LS_PACKAGE TO LT_DATAPACKAGE.
    ENDIF.
      CLEAR LS_PACKAGE.
    ENDLOOP.
    IF LT_DATAPACKAGE[] IS NOT INITIAL.
    DESCRIBE TABLE LT_DATAPACKAGE LINES LI_NUM.
    IF LI_NUM GT 0.
       REFRESH C_T_DATA.
       APPEND LINES OF LT_DATAPACKAGE TO C_T_DATA.
       REFRESH LT_DATAPACKAGE.
       FREE LT_DATAPACKAGE.
    endif.
    ELSE.
       REFRESH C_T_DATA.
    ENDIF.
    Please give me your valuable suggestions.
    Thanks
    Ganesh Reddy.

    Hi Ganesh,
    whatever you do, you can try like this:
    1 - any code posted should be wrapped in \
    then try something like this:
    field-symbols:
      <tabrec> type any,
      <field>   type any.
    sort ITZGLCCODE by bukrs.
    LOOP AT C_T_DATA ASSIGNING <tabrec>.
      ASSIGN component 'GJAHR' of structure <tabrec> to <field>.
      check <field> <= 2007.
      ASSIGN component 'BUKRS' of structure <tabrec> to <field>.
      READ TABLE LT_ITZGLCCODE WITH KEY ZBUKRS = <field>
        BINARY SEARCH TRANSPORTING NO FIELDS. "speed up the volume.
      IF SY-SUBRC 0.
        MOVE-CORRESPONDING <tabrec> to  LS_PACKAGE.   
        APPEND LS_PACKAGE TO LT_DATAPACKAGE.
      ENDIF.
    ENDLOOP.
    Regards,
    Clemens

  • Urgent : How to modify the line type and table type

    I am working on ALV Grid Control, i need to know how to modify the line type values to table type.
                 ls_celltab-fieldname = 'ZSAVINGS '.
                 ls_celltab-style = l_mode.
            INSERT ls_celltab INTO TABLE pt_celltab.
    Here ls_celltab is line type and pt_celltab is table type.
    Please give me the suggestion ASAP.
    C.Bharath Kumar

    Hi,
    Here is the example
    DATA: BEGIN OF LINE,
            LAND(3)  TYPE C,
            NAME(10) TYPE C,
            AGE      TYPE I,
            WEIGHT   TYPE P DECIMALS 2,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE
              WITH NON-UNIQUE KEY LAND NAME AGE WEIGHT.
    LINE-LAND = 'G'.   LINE-NAME   = 'Hans'.
    LINE-AGE  = 20.    LINE-WEIGHT = '80.00'.
    INSERT LINE INTO TABLE ITAB.
    LINE-LAND = 'USA'. LINE-NAME   = 'Nancy'.
    LINE-AGE  = 35.    LINE-WEIGHT = '45.00'.
    INSERT LINE INTO TABLE ITAB.
    Regards
    Sudheer

  • Which table i can use to find out the condition type in PO item ?

    Hello, erveryone. Which table i can use to find out the condition type in PO item ? Thank you.
    Xinzhou.

    hi
    The Table name used to find the Tax Values are
    KOMV: Pricing Communications-Condition Record
    KONV: Conditions (Transaction Data)
    From the above tables you can refer the fields below.
    KAWRT
    KBETR
    for excise check table J_1IEXCHDR for header
    J_1IEXCDTL for item excise
    Fetch the corresponding records based on the field
    KNTYP
    regards
    kunal

  • How to get the line type of a table type

    Hi,
      i want to indetify the line type of a table type dynamically in my program. how to do?
    For example:
    data: lv_ttype type type ROLLNAME value 'PRXCTRLTAB'.
    how to identify line type of lv_ttype in the program.
    Thanks,
    johnney.

    Hello Johnney,
    try like this...
    types: begin of ty_itab,
                matnr like mara-matnr,
                werks like marc-werks,
                maktx like makt-maktx,
              end of g_t_itab.
    data: g_t_itab type table of ty_itab.
    data: <b>wa_itab like line of g_t_itab.</b> " This is line type... so called work area.
    Reward If Helpful.
    Regards
    Sasidhar Reddy Matli.

  • Please resolve the Error:Element Entry over laps with another entry of the same type

    Hi Buddies,
                    I have been trying to resolve the error : Element Entry over laps with another entry of the same type while entering salary to an employee.
    I have tried to resolve this issue by created a new salary basis with new element. But still I could not make it.
    Please let me know how to move forward? Thanks for your help.
    Thanks
    Ganesh kumar M

    Hi Ganesh,
    We have a similar post which have some recommendation. please go through the comments and check if it helps.
    https://forums.oracle.com/thread/2440864
    Thanks,
    Sanjay

  • Error: Element entry overlaps with another entry of the same type

    Dear,
    while entering salary this error comes (Error: Element entry overlaps with another entry of the same type). what should i do for solving this issue? your feed back will be highly appreciated.
    REGARDS SAJJAD HASSAN KHAN

    Hi,
    I have faced the similar issue. And got it resolved after deleting the Element entries made for the employee.
    After deleting the similar element I was able to create Salary proposal for the employee.
    Please Verify whether any future dated salary proposal are existing for this employee.
    Also check if it has similar entries made for the ELEMENT.
    Thanks,
    Prem

  • Internal table with data reference variable as component

    Hi
    i have a below structure and itab in my program and i have the issue mentioned below..
    Data: begin of wa,
              col1 type i,
              col2 type ref to data,
            end of wa.
    data itab like table of wa.
    create data wa-col2 type p decimals 2.
    Now my requirement is to fill the work area wa and append it to the table.
    i have used field symbols and references but i am not sucessful as the value of wa-col2 is getting overwritten  by the field symbol and it is not accomodating distinct values.
    kindly help me out.
    thanks
    abdul hakim

    hi clemens,
    thanks for the help.
    my complete code:
    data: begin of wa,
              col1 type i,
              col2  type ref to data,
            end of wa.
    data itab like table of wa.
    field-symbols <fs> type any.
    create data wa-col2 type p decimals 2.
    assign wa-col2->* to <fs>.
    <fs> = '123.45'.
    append wa to itab.
    <fs> = '456.78'.
    append wa to itab.
    when i loop through itab the colum wa-col2 only contains 456.78 for both the records. the value 123.45 that i have passed for the first record is lost. how can get the values 123.45 for first record and 456.78 for the second record using this technique.
    thanks
    abdul hakim
    Edited by: Abdul Hakim on Feb 19, 2011 4:02 AM

  • Using own SQLite DB in combination with Data Management

    Hi,
    Currently on a huge project we're we are using LCDS 3.1 in combination with a AIR 2.5 client.
    I've been reading "Using Adobe LiveCycle Data Services ES2 version 3.1" and I have a question. In the chapter "Building an offline-enabled application" it says on the very first line:
    "You can use an offline adapter with an AIR SQLite database to perform offline fills when a desktop client is disconnected from the LiveCycle Data Services server. An offline adapter contains the SQL queries for AIR SQLite for retrieving cached items like an assembler on the server retrieves items from the data source."
    However, in my experience that AIR SQLite database is not just any DB but one that Datamanagment designs and generates itself, based on the Dto the DataManagement destination is managing. The offline adapter doesn't work like an assembler at all, because the documentation says you can only override the methods pertaining to constructing the WHERE, and ORDER BY parts of the queries, not the SELECT, CREATE, FROM,... parts.
    In our case, we have a database on the server, constructed according to a very specific ERD, and we have a SQLite database on the client, also constructed according to a very specific ERD. What we want to do is execute every fill, create, update, delete against the offline cache and only synchronize with the backend when we want it the synchronize (technically possible by playing with the autoMerge, autoSaveCache, autoConnect,... properties). So what part of datamanagement can we customize to use our DB instead of a generated one?
    Thx in advance!

    You are correct in noting that Data Management does not allow you to use your own database to store offline data.  This data is exclusively managed by the LCDS library for the developer.  The intent is that the local cache is a reflection of the server data, not an independent copy.
    If you have an existing database in AIR, then you will have much more direct control over the querying and updating of that data by using the SQLite APIs directly.
    That being said, you can in essence replicate the data stored on the server, managed by Data Management, in the offline cache.  In an upcoming release (winter 2011) we will have a few features ('briefcases' and a 'changes-only' fill) that will make this story even more compelling for your use cases.  But even with the 3.1 functionality, you can do something like the following:
    Perform a fill() to collect the data you want to have available on the client, save this in the offline cache
    Construct an Offline Adapter Actionscript class that implements the fills you want to perform on the local data
    Use the DataService.localFill() API to perform all of the client application fills, turn off autoCommit.
    When the client is online, call commit() to store client changes and call fill() to refresh the cached data.
    This should give you some ideas on how you could go about constructing your app to leverage the offline features of Data Services.
    Tom

  • Logical table with data restrictions from the physical table

    Hello, I have a question about the relationships between the Logical Tables in Business Model and Mapping and The Physical table in the physical layer. The problem is the next one:
    I have a Physical Table named T1 that contains the attributes: Id, DateChangeState, State,…
    T1
    DateChangeState| ID |State     | Other columns….
    01/01/2011 | 1 | 03 |     …
    02/01/2011 | 1 |     11 |     …
    03/01/2011 | 1 |     02 |     …
    02/02/2011 | 2 |     01 |     …
    03/02/2011 | 2 |     02 |     …
    I need filter this table and extract only one row per ID. The row that I need is the row who contains the Max(DateChangeState) per ID. I don’t know how extract only the rows selected from the physical table to the Logical Table.
    I need that the logical table contains the next rows:
    T1_Logical
    DateChangeState |ID |     State     Other columns….
    03/01/2011 | 1 | 02 |     …
    03/02/2011 | 2 | 02 |     …
    How can I extract only the rows with the Max(DateChangeState) grouped by ID in the BMM?
    I thought put this condition in the column mapping (CASE WHEN DateChangeState=Max(DateChangeState)) but the Max(DateChangeState) was not grouped by ID.
    Any idea about how solve this problem?
    I can not use the group by in the answer and I can not change the physical layer.
    Thank you,
    Best Regards.

    Hi Rajeevagrl your solution is very good but I dont´t know why obiee is applying twice the max condition, The select is the next one:
    select distinct D1.c1 as c1,
    D1.c2 as c2,
    D1.c1 as c3
    from
    (select D1.c1 as c1,
    D1.c2 as c2
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    max(D1.c3) over () as c3
    from
    (select T379.ID as c1,
    T379.DATE as c2,
    max(T379.DATE) as c3
    from
    T1 T379
    group by T379.ID, T379.DATE
    ) D1
    ) D1
    where ( D1.c2 = D1.c3 )
    ) D1
    order by c2
    Edited by: 848497 on 14-abr-2011 3:58

  • Table joining query with dates

    Hello,
    I have two tables, one containing a list of pupils, their class start date and their class end dates. The second table contains the address (postcode) history of the pupil. I need to bring these two tables together into one query to show all the classes from the 'pupils' table and add in the most recent postcode of the address prior to the start date of the clasS from the 'addresses' table.  I.e. to show where the pupil lived when they started the class.
    Could anyone show me how to do this please? I've provided a 'desired' table to show what I need the results to look like.
    I hope this is clear, please ask if it isn't - I'm sure this should be simple! But I can't get my head around it. I'm using Oracle 9i and SQL Developer.
    Thanks :)
    select pupils.* from
    (select 'A227' as pupil_id, to_date('21/04/2010','dd/mm/rrrr') class_start, to_date('21/09/2010','dd/mm/rrrr') class_end from dual union all
    select 'A227' as pupil_id, to_date('08/08/2011','dd/mm/rrrr'), to_date('26/10/2011','dd/mm/rrrr') from dual ) pupils
    select addresses.* from
    (select 'A227' as pupil_id, to_date('20/04/2010','dd/mm/rrrr') address_start, null address_end, 'TW1 XVT' as postcode from dual union all
    select 'A227' as pupil_id, to_date('03/08/2011','dd/mm/rrrr'), to_date('31/10/2011','dd/mm/rrrr'), 'TW3 ZE3' as postcode from dual union all
    select 'A227' as pupil_id, to_date('01/11/2011','dd/mm/rrrr'), null, 'n23 4ty' as postcode from dual) addresses
    select desired.* from
    (select 'A227' as pupil_id, to_date('21/04/2010','dd/mm/rrrr') class_start, to_date('21/09/2010','dd/mm/rrrr') class_end, to_date('20/04/2011','dd/mm/rrrr') as address_start, 'TW1 XVT' as postcode from dual union all
    select 'A227' as pupil_id, to_date('08/08/2011','dd/mm/rrrr') class_start, to_date('26/10/2011','dd/mm/rrrr') class_end, to_date('03/08/2011','dd/mm/rrrr') as  address_start, 'TW3 ZE3' as postcode from dual) desired
     

    Hi,
    That's an example of a Top-N Query , and here's one way to do it:
    WITH     got_r_num     AS
         SELECT     p.*
         ,     a.address_start
         ,     a.postcode
         ,     ROW_NUMBER () OVER ( PARTITION BY  p.pupil_id
                                   ,                    p.class_start
                                   ORDER BY          a.address_start     DESC
                           )         AS r_num
         FROM     pupils        p
         JOIN     addresses  a  ON   p.pupil_id        = a.pupil_id
                         AND  p.class_start  >= a.address_start
    SELECT     pupil_id, class_start, class_end, address_start, postcode
    FROM     got_r_num
    WHERE     r_num     = 1
    ;As you can see, the sib-query pairs each pupil and class with all the earlier addresses, and then numbers the addresses such that the latest address_start gets the lowest r_num (that is, 1, since ROW_NUMBER always starts with 1). The main query displays only the most recent address (the one with r_num = 1) for each pupil and class.
    Does addresses.address_end plays any role in this problem? For example, would it matter if the most recent address for a given pupil and class had expired before the class started? That is, if we change the middle of address to:
    select  'A227'          as pupil_id
    ,      to_date ('03/08/2011', 'dd/mm/rrrr')
    ,      to_date ('07/08/2011', 'dd/mm/rrrr')     -- Not 31/10/2011
    ,      'TW3 ZE3'      as postcode
    from      dual would it still count as the last address before the class that started on 08/08/2011?
    Edited by: Frank Kulash on Nov 1, 2011 11:36 AM
    Added question about address_end

  • Join multiple tables to create one new table with data from all the other

    CREATE TABLE NAME2012 (STOCKNAME2012 VARCHAR(255), VAL2012 FLOAT)
    INSERT INTO NAME2012 VALUES (‘Stock3’, 50)
    INSERT INTO NAME2012 VALUES (‘Stock2’, 55)
    INSERT INTO NAME2012 VALUES (‘Stock4’, 45)
    CREATE TABLE NAME2011 (STOCKNAME2011 VARCHAR(255), VAL2011 FLOAT)
    INSERT INTO NAME2011 VALUES (‘Stock1’, 56)
    INSERT INTO NAME2011 VALUES (‘Stock2’, 48)
    INSERT INTO NAME2010 VALUES (‘Stock3’, 59)
    CREATE TABLE NAME2010 (STOCKNAME2010 VARCHAR(255), VAL2010 FLOAT )
    INSERT INTO NAME2010 VALUES (‘Stock1’, 47)
    INSERT INTO NAME2010 VALUES (‘Stock2’, 46)
    I would like a new Table STOCKS populated with names of stocks from the other tables as well as values. So I get a new table STOCKS, with data as below.
    CREATE TABLE STOCKS (NAME VARCHAR(255), VALUE2012 FLOAT , VALUE2011 FLOAT, VALUE2010 FLOAT)
    End result in table STOCKS should be like:
    NAME               VALUE2010              VALUE2011             
    VALUE2012
    Stock1                 47                          
    56                            NULL
    Stock2                 46                          
    48                             50
    Stock3                NULL                         59                          
     55
    Stock4                NULL                       NULL                         
    45
    How can I write a T-SQL expression that could do this?

    Hi
    There must be StockMaster
    Try this
    CREATE TABLE NAME2012 (
    STOCKNAME2012 VARCHAR(255)
    ,VAL2012 FLOAT
    INSERT INTO NAME2012
    VALUES (
    'Stock3'
    ,50
    INSERT INTO NAME2012
    VALUES (
    'Stock2'
    ,55
    INSERT INTO NAME2012
    VALUES (
    'Stock4'
    ,45
    CREATE TABLE NAME2011 (
    STOCKNAME2011 VARCHAR(255)
    ,VAL2011 FLOAT
    INSERT INTO NAME2011
    VALUES (
    'Stock1'
    ,56
    INSERT INTO NAME2011
    VALUES (
    'Stock2'
    ,48
    CREATE TABLE NAME2010 (
    STOCKNAME2010 VARCHAR(255)
    ,VAL2010 FLOAT
    INSERT INTO NAME2010
    VALUES (
    'Stock1'
    ,47
    INSERT INTO NAME2010
    VALUES (
    'Stock2'
    ,46
    INSERT INTO NAME2010
    VALUES (
    'Stock3'
    ,59
    Create table stockMaster(STOCKNAME VARCHAR(255))
    go
    Insert into stockMaster values('Stock1')
    Insert into stockMaster values('Stock2')
    Insert into stockMaster values('Stock3')
    Insert into stockMaster values('Stock4')
    Select Distinct S.STOCKNAME , A.VAL2010 ,B.VAL2011,C.VAL2012 from  stockMaster S
    left join NAME2012  C on S.STOCKNAME = C.STOCKNAME2012
    left join NAME2011 B on s.STOCKNAME = B.STOCKNAME2011
    left join NAME2010 A on s.STOCKNAME = A.STOCKNAME2010
    go
    Drop table NAME2010
    Drop table NAME2011
    Drop table NAME2012
    Drop table stockMaster 
    Mark as Ans if you find it useful
    Shridhar J Joshi Thanks a lot

  • Using formulas in combination with dates

    I'm a salesman and I track my daily sales on numbers. I have 5 columns: date, sales number, sales amount, then other stuff. I need a formula to track on the sales for a certain 2 weeks pay period for another table. I need one that sums the total $ amount of the sales and one that just counts the number of sales. Any help would be greatly appreciated.
    Thanks

    to get the count, I had to use the countif and the concatenate command together.
    If my compare date was in A1 and my information was in Table 2.. Column A was dates and B was Dollars.. modify to fit your final data, it would look like this:
    =countif(Table 2::A,concatenate(">=",A1))
    And the sum of the Column B in table 2 for the same condition would be:
    =Sumif(Table 2::A,concatenate(">=",A1),Table 2::B)
    Jason

Maybe you are looking for

  • Time Machine can no longer write to drive

    I have been using Time Machine to back up my iMac G5 for over a year. About two weeks ago the computer started acting really strange so I actually restored the entire system from my Time Machine backup. Everything was working great until today. The e

  • Looking for best compatible camcorder for Mac

    Which format is best duited for I movie and Macbook's in general. I want a mid level camcorder for vacations and family and would like ease of use for editing in I movie & other video editing programs with my new Macbook pro. Is Mini DV still the for

  • My remote apps no longer recognize the Apple TV

    My dear sweet son has lost my remote for the Apple TV.  This usually isn't a problem because of the remote app on my iPod, iPhone, and iPad.  However, none of them are recognizing my Apple TV for some reason.  I have home sharing turned on, and iTune

  • Can not open pdf attachment in email (SBWP)

    Hello Expert, I created a program to covert a form to pdf format, then, send it to SAPoffice (SBWP) as an attachment successfully. But I cannot open the pdf attachment. I don't know the reason. Could you please give me some suggestion? use function m

  • Adobe Photoshop crashes after opening

    Hi, I would really appreciate if someone could help me troubleshoot my issue; Adobe Photoshop CS4 crashes almost immediately after I open it.  This problem suddenly started occurring.  I hadn't used Photoshop for maybe a month, but before then it was