5 Replies Latest reply: Sep 24, 2010 11:38 AM by Marcin Pciak RSS

how to change ITAB created with CL_ABAP_TABLEDESCR from hashed to std

Mr Me
Currently Being Moderated

Hello xperts,

 

Ive created an ITAB (copy from another table) over the statements:

 

" Create instances of dynamic structure and dynamic internal table

go_sdescr_new = cl_abap_structdescr=>create( P_COMPONENTS = gt_components p_strict = abap_false ).

go_tdescr = cl_abap_tabledescr=>create( go_sdescr_new ).

 

" Create data refence followed by table creation

CREATE DATA gdo_handle TYPE HANDLE go_tdescr.

ASSIGN gdo_handle->* TO <gt_itab_BCCMP07>.

 

Unfortunately it is hashed and now I need to change it to a standard table, but cant figure out the syntax.

 

Any ideas?

  • Re: how to change ITAB created with CL_ABAP_TABLEDESCR from hashed to std
    Marcin Pciak
    Currently Being Moderated

    By default method cl_abap_tabledescr=>create(...) generates standard table, unless specified differently.

    How do you know this generates hashed table? I suggest to check it like

    case go_tdescr->TABLE_KIND.
    when cl_abap_tabledescr=>TABLEKIND_STD.
       "your table is standard table
    when cl_abap_tabledescr=>TABLEKIND_HASHED.
       "it is hashed one
    endcase.
    

    Regards

    Marcin

    • Re: how to change ITAB created with CL_ABAP_TABLEDESCR from hashed to std
      Mr Me
      Currently Being Moderated

      Marcin,

      thanks for your answer.

       

      The reason for assuming it to be a hashed table is that the statement:

       

            read table <gt_itab_BCCMP07> with table key

              ('0INFOPROV')   =  'BCCMP07'

              ('0CALMONTH2')  =  <f_calmon2_ref>

              ('0CALYEAR')    =  <f_calyear_ref>

              ('BHFACTOR0')   =  <f_bhfactor0_ref>

              ('BHFUNCAG0')   =  <f_bhfuncag0_ref>

              ('BHPRODAP0')   =  <f_bhprodap0_ref>

              ('BHPSTEP0')    =  <f_bhpstep0_ref>

              ('BHSPC0')      =  <f_bhspc0_ref>

              ('BHVERSI0')    =  <f_bhversi0_ref>

              ('BLCUSTNO0')   =  <f_blcustno0_ref>

            assigning <f_interim_data>.

       

       

      Causes a dump which says:

       

      Incomplete key specification when accessing a key table

       

      An internal table was defined as a key table for quick direct access.

      When a table of this type is accessed with "READ/DELETE ... WITH TABLE

      KEY k1 = v1 ... kn = vn", the key specification "k1 = v1 ... kn = vn"

      must contain values for precisely those fields k1, ... kn that are

      listed in the table declaration.

       

      In this particular case, the value for the component "0FISCVARNT" was missing

      in

      the key specification for the table "<GT_ITAB_BCCMP07>".

      .....

       

      I did as you suggested and indeed it is NOT a hashed table.

       

      Why does it dump if it is a standard table???

Actions