Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What is the wrong in the below code

Former Member
0 Likes
658

Hello All,

I am creating a DDIC table dynamically through a program.


REPORT  zbc_create_table2.

TABLES: dd02l.

PARAMETER: tab_name TYPE tabname OBLIGATORY VISIBLE LENGTH 18 .
SELECT-OPTIONS s_table FOR dd02l-tabname.

DATA: gs_cl_bc_dyn TYPE REF TO zcl_bc_dyn.
DATA rc TYPE sy-subrc.
DATA: ls_dd02v TYPE dd02v.
DATA: gt_fields TYPE TABLE OF dd03p,
      gs_field TYPE dd03p,
      gs_progname TYPE trdir-name,
      ls_dd05m TYPE dd05m,
      ls_dd08v TYPE dd08v.
ls_dd05m-tabname = tab_name.
ls_dd08v-tabname = tab_name.

TRANSLATE gs_progname TO UPPER CASE.

CREATE OBJECT gs_cl_bc_dyn.


gs_field-tabname = 'TEST'. gs_field-fieldname = 'MANDT'.
gs_field-position = '1'. gs_field-keyflag = 'X'.
gs_field-rollname = 'CHAR1'.

APPEND gs_field TO gt_fields.


ls_dd02v-tabname = tab_name.
ls_dd02v-contflag = 'A'.
ls_dd02v-mainflag = 'X'.


CALL FUNCTION 'DDIF_TABL_PUT'
  EXPORTING
    name                    = tab_name
 dd02v_wa                = ls_dd02v
*   DD09L_WA                = ' '
 TABLES
   dd03p_tab               = gt_fields
*   DD05M_TAB               = ls_DD02V
*   DD08V_TAB               = ls_DD08v
*   DD35V_TAB               =
*   DD36M_TAB               =
 EXCEPTIONS
   tabl_not_found          = 1
   name_inconsistent       = 2
   tabl_inconsistent       = 3
   put_failure             = 4
   put_refused             = 5
   OTHERS                  = 6
          .

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
  EXPORTING
    name        = tab_name
*      auth_chk    = 'X'
*      prid        = -1
  IMPORTING
    rc          = rc
  EXCEPTIONS
    not_found   = 1
    put_failure = 2
    OTHERS      = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

i am getting an error message 'tabl_inconsistent' in FM 'DDIF_TABL_PUT'

Regards,

Lisa

3 REPLIES 3
Read only

JozsefSzikszai
Active Contributor
0 Likes
605

hi Lisa,

first of all you have to add the following lines (before the FM is called to create the table):

ls_dd02v-tabclass = 'TRANSP'.

this will create a transparent table.

but there could be more errors, you just have to debug the FM if it still does not work

hope this helps some

ec

Read only

0 Likes
605

Dear Eric,

This time i am getting an error name inconsistent.

Please help me.

Regards,

Lisa

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
605

Make sure that the name of the table in TABNAME is in the customer namespace, meaning that it begins with "Z" or "Y".

Regards,

Rich Heilman