Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Short Dump for Dynamic Select Query

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

Former Member replied

Hi,

I tried to execute the code using table BSEGC and it gave a short dump..

the actual exception that shows in ST22 IS ..UNICODE_TYPES_NOT_CONVERTIBLE..

I think there is something wrong in the internal table creation..

Instead of using the method cl_alv_table_create=>create_dynamic_table to create the dynamic table I used the following and it worked..

CREATE DATA new_table TYPE TABLE OF (p_table).

* Comment begin  " Naren
*  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.

* Comment End.  " Naren

 CREATE DATA new_table TYPE TABLE OF (p_table).   " New code by naren

Please Try this..

Thanks

Naren

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question