Skip to Content
0
Apr 01, 2009 at 07:40 PM

Short Dump for Dynamic Select Query

184 Views

Hello all,

I get a short dump for my dynamic select query at the end of the code. The error is "The types of operands "dbtab" and "itab" cannot be converted into one another."

My code looks like below.

FORM get_ccnum_2  USING    p_tabname TYPE dd03l-tabname.

DATA: p_table(30)  TYPE c.

  FIELD-SYMBOLS:  <dyn_wa>,
                               <t> TYPE table.
  DATA: it_fldcat    TYPE lvc_t_fcat.

  TYPE-POOLS : abap.

  DATA: it_details   TYPE abap_compdescr_tab,
        wa_details   TYPE abap_compdescr.

  DATA: ref_descr    TYPE REF TO cl_abap_structdescr.

  DATA: new_table    TYPE REF TO data,
        new_line     TYPE REF TO data,
        wa_it_fldcat TYPE lvc_s_fcat.


 p_table = p_tabname.

  ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
  it_details[] = ref_descr->components[].

  LOOP AT it_details INTO wa_details.
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = wa_details-name .
    wa_it_fldcat-datatype  = wa_details-type_kind.
    wa_it_fldcat-intlen    = wa_details-length.
    wa_it_fldcat-decimals  = wa_details-decimals.

    APPEND wa_it_fldcat TO it_fldcat .
  ENDLOOP.


  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_fldcat
    IMPORTING
      ep_table        = new_table.

 ASSIGN new_table->* TO <t>.

 CREATE DATA new_line LIKE LINE OF <t>.
  ASSIGN new_line->* TO <dyn_wa>.

wa_cond = 'CCNUM <> '' '' '.
APPEND wa_cond TO tab_cond.

      SELECT * INTO TABLE <t>
               FROM     (p_table)
               WHERE    (tab_cond)
               ORDER BY (tab_ord).

ENDFORM.                    " GET_CCNUM_2