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

Read Statement in Dynamic Internal Table?

Hi,

Is it possible <b>read</b> statement in <b>Dynamic Internal</b> table?

Thanls,

Suresh.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Oct 17, 2006 at 02:04 PM

    Hello Suresh

    Yes, it is possible. However, the table field must be provided dynamically, too.

    Regards

    Uwe

    *&---------------------------------------------------------------------*
    *& Report  ZUS_SDN_READ_DYNAMIC_TABLE
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  zus_sdn_read_dynamic_table.
    
    
    DATA:
      gdo_data      TYPE REF TO data.
    
    
    FIELD-SYMBOLS:
      <gt_itab>     TYPE table,
      <gs_entry>    TYPE ANY.
    
    
    PARAMETERS:
      p_table    TYPE tabname    DEFAULT 'KNA1',
      p_fld      TYPE fieldname  DEFAULT 'KUNNR'.
    
    
    
    START-OF-SELECTION.
    
      CREATE DATA gdo_data TYPE TABLE OF (p_table).
      ASSIGN gdo_data->* TO <gt_itab>.
    
    
      SELECT * FROM (p_table) INTO TABLE <gt_itab>.
    
    
      READ TABLE <gt_itab> ASSIGNING <gs_entry>
           WITH KEY (p_fld) = '0000000001'.
    
    
    END-OF-SELECTION.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2006 at 02:12 PM

    Hi,

    I think it will be possible. look at the following code u may get some idea.

    FORM field_check_blank USING pi_zcheck_name TYPE zcheck_name

    pi_mara TYPE mara

    pi_keys TYPE yi_keys

    CHANGING pio_failed TYPE char1.

    DATA: li_ftab TYPE TABLE OF string,

    li_wtab TYPE TABLE OF string,

    l_tabnam TYPE string,

    l_tabfld TYPE string,

    l_txt TYPE string,

    lw_keys LIKE LINE OF pi_keys.

    CONSTANTS: lc_key_def TYPE string VALUE '&1 = &2-&1'.

    FIELD-SYMBOLS: <fval> TYPE ANY,

    <fval2> TYPE ANY,

    <fstruct> TYPE ANY.

    CLEAR: pio_failed.

    SPLIT pi_zcheck_name AT '-' INTO l_tabnam l_tabfld.

    APPEND l_tabfld TO li_ftab.

    ASSIGN (l_tabnam) TO <fstruct>.

    IF NOT sy-subrc EQ 0.

    MESSAGE e787 WITH l_tabnam.

    ENDIF.

    CLEAR: <fstruct>.

    LOOP AT pi_keys INTO lw_keys

    WHERE TABLE = L_TABNAM.

    ASSIGN COMPONENT lw_keys-field OF STRUCTURE <fstruct> TO <fval>.

    IF NOT sy-subrc EQ 0.

    MESSAGE e787 WITH lw_keys-field.

    ENDIF.

    ASSIGN COMPONENT lw_keys-field OF STRUCTURE pi_mara TO <fval2>.

    IF NOT sy-subrc EQ 0.

    MESSAGE e787 WITH lw_keys-field.

    ENDIF.

    <fval> = <fval2>.

    l_txt = lc_key_def.

    REPLACE ALL OCCURRENCES OF '&1' IN l_txt WITH lw_keys-field.

    REPLACE '&2' IN l_txt WITH lw_keys-table.

    IF NOT li_wtab IS INITIAL.

    CONCATENATE 'AND' l_txt INTO l_txt SEPARATED BY space.

    ENDIF.

    APPEND l_txt TO li_wtab.

    ENDLOOP.

    ASSIGN (pi_zcheck_name) TO <fval>.

    IF NOT sy-subrc EQ 0.

    MESSAGE e787 WITH pi_zcheck_name.

    ENDIF.

    SELECT SINGLE (li_ftab)

    INTO <fval>

    FROM (l_tabnam)

    WHERE (li_wtab).

    IF NOT sy-subrc EQ 0

    OR NOT <fval> IS INITIAL.

    pio_failed = c_true.

    ENDIF.

    ENDFORM. " FIELD_CHECK_BLANK

    Note:

    BEGIN OF y_keys,

    table TYPE tabname,

    field TYPE fieldname,

    END OF y_keys.

    If helpful pl reward.

    Cheers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2006 at 02:41 PM

    hi

    good

    go through thiw weblog

    /people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table

    thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

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.