Skip to Content
author's profile photo Former Member
Former Member

Question about reading generic tables with keys


I'm wondering if it's possible to read a generic table with key statement:

    <lv_key>         TYPE zconf_key,

    <lt_data_bi>     TYPE INDEX TABLE,
    <lt_data_ai>     TYPE INDEX TABLE,

    <ls_data_bi>     TYPE any,
    <ls_data_ai>     TYPE any.

* create data types
  CREATE DATA lt_data_bi TYPE (ls_node-data_table_type).
  ASSIGN lt_data_bi->* TO <lt_data_bi>.
  CREATE DATA lt_data_ai TYPE (ls_node-data_table_type).
  ASSIGN lt_data_ai->* TO <lt_data_ai>.

* do check
  LOOP AT <lt_data_ai> ASSIGNING <ls_data_ai>.
    ASSIGN COMPONENT 'KEY' OF STRUCTURE <ls_data_ai> TO <lv_key>.

    READ TABLE <lt_data_bi> WITH KEY key = <lv_key>

I receive the message: "The specified type has no structure and therefore no component called KEY" in the read statement above.

Does anyone has an idea what I can do here?



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 19, 2008 at 03:56 PM

    > READ TABLE <lt_data_bi> WITH KEY key = <lv_key>

    In your structure ls_data_bi there is no field called KEY . please check whether you have field KEY in structure


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      ls_bi_data is a ANY structure. Since we're looking for a generic solution, we want to use ANY. We're looking for a way to check if ANY structure contains a component name KEY.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.