Application Development 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: 

Problem in passing table properties.

ankur_sharma16
Active Participant
0 Kudos

Hello experts,

I want to create a new table i.e. i have an old table ZDBTAB1 and i want to rename it to ZDBTAB2 and am doing so by passing all the properties of old table ZDBTAB1 to the new table ZDBTAB2.

Using fm 'DD_TABL_GET', am getting the technical properties and fields of ZDBTAB1.

Using fm 'DD_TABL_PUT', am creating the new table with the same technical properties and fields as of ZDBTAB1.

Now my problem is that after it the technical properties which is being passed to the new table ZDBTAB2 is not being reflected there. That is if you go to SE11 and see the tech prop of ZDBTAB2, it is not there. So due to this (may be) if i use 'WHERE USED FUCNTIONALITY' on ZDBTAB2 then it will not be able to search.

Please suggest.

Regards,

Ankur Sharma.

1 ACCEPTED SOLUTION

ankur_sharma16
Active Participant
0 Kudos

CALL FUNCTION 'DD_TABL_GET'

   EXPORTING

     tabl_name = old_name_get

     WITHTEXT = 'X'

   IMPORTING

     dd02v_wa_a = ls_dd02v

     dd09l_wa_a = ls_dd09l

   TABLES

     dd03p_tab_a = lt_dd03p

   EXCEPTIONS

     access_failure = 1

     OTHERS = 2.

IF sy-subrc <> 0.

     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT lt_dd03p INTO ls_dd03p.

   ls_dd03p-tabname = new_name.

   MODIFY lt_dd03p FROM ls_dd03p.

ENDLOOP.

ls_dd02v-tabname = new_name_put.

CALL FUNCTION 'DD_TABL_PUT'

   EXPORTING

     dd02v_wa = ls_dd02v

     dd09l_wa = ls_dd09l

     put_state = 'A'

     tabl_name = new_name_put

   TABLES

     dd03p_tab = lt_dd03p

   EXCEPTIONS

     db_access_failure = 1

     object_inconsistent = 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.

CALL FUNCTION 'DDIF_TABL_ACTIVATE'

     EXPORTING

       NAME              = TAB_NAME_activate

*     AUTH_CHK          = 'X'

*     PRID              = -1

*   IMPORTING

*     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.

   ELSE.

*    WRITE: 'Table', TAB_NAME, 'Activated', /.

   ENDIF.

11 REPLIES 11

yogendra_bhaskar
Contributor
0 Kudos

HI ,

can you see that table ZDBTAB2 is active or not.

Regards ,

Yogendra Bhaskar

0 Kudos

It is Active, it contains the old table's fields but enhancement category and technical properties are not present in new table.

0 Kudos

hi ankur ,

Then check for the enhancement category and technical properties ZDBTAB1 .

or you may be missing some parameter .

or for the best if you want to create a copy of your old table , better use FM RS_DD_COPY .

CALL FUNCTION 'RS_DD_COPY'
         EXPORTING
           objname1 = <Source>
           objname2 = <Target>
           objtype  = <type of Object>.

For <type of Object > select any one :

A    Table Type

D    Domain

E    Data Element

F    Table Field

G    Type Group

H    Search Help

I    Matchcode ID

L    Lock Object

M    Matchcode Object

N    Table Index

S    Internal Structure

T    Transparent Table

U    Table/Structure

V    View

X    Table Pool

Y    Table Cluster

Z    Table cluster/pool

0 Kudos

But this FM will show pop ups, which i dont want, i want it to be done without any screen or pop-ups.

And this will ask for package and rest everything while copying.

0 Kudos

Alright , Then Ankur

Can you provide the details , what are the parameters you are passing in DD_TABL_GET and DD_TABL_PUT .

Regards ,

Yogendra Bhaskar

ankur_sharma16
Active Participant
0 Kudos

CALL FUNCTION 'DD_TABL_GET'

   EXPORTING

     tabl_name = old_name_get

     WITHTEXT = 'X'

   IMPORTING

     dd02v_wa_a = ls_dd02v

     dd09l_wa_a = ls_dd09l

   TABLES

     dd03p_tab_a = lt_dd03p

   EXCEPTIONS

     access_failure = 1

     OTHERS = 2.

IF sy-subrc <> 0.

     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT lt_dd03p INTO ls_dd03p.

   ls_dd03p-tabname = new_name.

   MODIFY lt_dd03p FROM ls_dd03p.

ENDLOOP.

ls_dd02v-tabname = new_name_put.

CALL FUNCTION 'DD_TABL_PUT'

   EXPORTING

     dd02v_wa = ls_dd02v

     dd09l_wa = ls_dd09l

     put_state = 'A'

     tabl_name = new_name_put

   TABLES

     dd03p_tab = lt_dd03p

   EXCEPTIONS

     db_access_failure = 1

     object_inconsistent = 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.

CALL FUNCTION 'DDIF_TABL_ACTIVATE'

     EXPORTING

       NAME              = TAB_NAME_activate

*     AUTH_CHK          = 'X'

*     PRID              = -1

*   IMPORTING

*     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.

   ELSE.

*    WRITE: 'Table', TAB_NAME, 'Activated', /.

   ENDIF.

0 Kudos

Hi Ankur,

You need to change the table name in ls_dd02v and ls_dd09l.

Check in debug mode.

Thanks,

Shambu

0 Kudos

Thanks Shambu VS for the correct answer and Thanks to Yogendra Bhaskar for help.

Regards,

Ankur Sharma

0 Kudos

hi ,

agreed with shambu ,

include this line in code

ls_dd09l-tabname = new_name_put.

regards,

Yogendra Bhaskar

0 Kudos

How is your tool doing, almost finished?

Thomas

0 Kudos

Hello Thomas,

Going good. Its like still skeleton is developing, alot of work is to be done.