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: 

Function Module for Creation of Data Dictionary Object Structure

former_member188829
Active Contributor
0 Kudos
2,025

Hi All,

I would like to know the Function Module name for creating the Data Dictionary Object Structure.

If i give input as the table name, NEW structure name and (Development class, Transport Request or Local Object), it has to create the NEW structure based on the Database table fields and structure(If table contains any structure).

Example: I pass input as Table name 'MARA' and New Structure name as 'YS_MARA', then it has to copy the all fields and structures in MARA to New structure 'YS_MARA'.

If there is no SAP standard Function module available then i can go for BDC.

Could you please suggest me on this?

Thank you in advance.

Thanks,

Vishnu.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
966

Hi,

I guess you could use FM DDIF_TABL_GET, DDIF_TABL_PUT & DDIF_TABL_ACTIVATE for that...

Kr,

Manu.

23 REPLIES 23

Former Member
0 Kudos
966

Hi,

There is a copy function for all most all Repository objects in Workbench, which will do the exact functionality that you are askign for. What is your exact requirement, please be more specific.

Regards

Senthil.

0 Kudos
966

Hello Senthil,

Thanks for your reply.

We are developing one automation tool which needs to create the structure based on the table fields.

I really do not require it manually. Because, we need to do it through program.

How ever, If there is no SAP standard function module then i will go for BDC.

Thanks,

Vishnu

0 Kudos
966

Hi ,

I just debugged the standard copy functionality and found this fm DDUT_OBJECT_COPY.Its documented too.

But there are lot of other functions getting triggered related to development class,locks etc. May be you can have alook into it.

0 Kudos
966

Thanks Keshav. I will get back to you.

Thanks,

Vishnu

Former Member
0 Kudos
967

Hi,

I guess you could use FM DDIF_TABL_GET, DDIF_TABL_PUT & DDIF_TABL_ACTIVATE for that...

Kr,

Manu.

0 Kudos
966

Hi Manu,

Thanks for your reply.

That function modules can be used for read a table from the ABAP Dictionary, to write a table in the ABAP Dictionary

and to activate a table.

Thanks,

Vishnu

0 Kudos
966

Or a structure... If you don't define the parameter DD09L_WA...

Kr,

Manu.

Edited by: Manu D'Haeyer on Nov 16, 2011 10:18 AM

0 Kudos
966

Hi Manu,

Yes, it is for Table only. I have read the Function module documentation.

Thanks,

Vishnu

0 Kudos
966

Check method GENERATE_STRUCTURE defined in class CL_HRPAYIT_DDIC_GENERATOR for an example...

Kr,

m.

0 Kudos
966

re-read it

it says:

The following constellations (or combinations) are possible:

1. The table should be completely revised or redefined:

In this case all the parameters should be defined. If it is a structure, the technical settings (DD09L_WA) should not be defined

Kr,

m.

Edited by: Manu D'Haeyer on Nov 16, 2011 10:22 AM

0 Kudos
966

Hi Manu,

Let me check again, I will get back to you.

Thanks,

Vishnu

0 Kudos
966

Hi Manu/Keshav,

Below is the sample which i have written and it is working fine. I have done the mistake while passing the Table Class.

DATA:dd03p_tab       LIKE dd03p OCCURS 2 WITH HEADER LINE,
     lwa_dd02v       TYPE dd02v.

dd03p_tab-tabname = 'YSVISHNU1'.
dd03p_tab-fieldname = 'MANDT'.
dd03p_tab-position = '1'.
dd03p_tab-keyflag = 'X'.
dd03p_tab-rollname = 'MANDT'.
APPEND dd03p_tab.

dd03p_tab-tabname = 'YSVISHNU1'.
dd03p_tab-fieldname = 'VBELN'.
dd03p_tab-position = '2'.
dd03p_tab-keyflag = ' '.
dd03p_tab-rollname = 'VBELN'.
APPEND dd03p_tab.

lwa_dd02v-ddlanguage = 'E'.
lwa_dd02v-ddtext = 'Vishnu Test'.
lwa_dd02v-tabname = 'YSVISHNU1'.
lwa_dd02v-tabclass = 'INTTAB'.

CALL FUNCTION 'DDIF_TABL_PUT'
  EXPORTING
    name        = 'YSVISHNU1'
    dd02v_wa    = lwa_dd02v
  TABLES
    dd03p_tab   = dd03p_tab
  EXCEPTIONS
    put_failure = 01
    OTHERS      = 02.
IF sy-subrc = 0.
  WRITE / 'Structure YSVISHNU1 is created successfully'.
ELSE.
  WRITE / 'Structure YSVISHNU1 is NOT created'.
ENDIF.

Thanks for your help,

Thanks,

Vishnu

0 Kudos
966

You asked for

I pass input as Table name 'MARA' and New Structure name as 'YS_MARA', then it has to copy the all fields and structures in MARA to New structure 'YS_MARA'.

and now you are manually populating it ?

Kesav

0 Kudos
966

May be he is doing that in Original program...For simplicity he is doing like that in sample code. I am just guessing

0 Kudos
966

Hi Keshav,

Yes, Vijay guess is correct , That structure name every thing can do my original program and that was the sample program only.

Thanks,

Vishnu

0 Kudos
966

Hi Vishnu,

How are you going to copy a a structure using DDIF_TABL_PUT ?

Anyways , no more confusions, happy that its resolved...Good Luck

Kesav

0 Kudos
966

Hi Keshav,

We can get the all details of the table by using the Function module "DDIF_TABL_GET" and we can get the all field details into table DD03P_TAB of the Function module "DDIF_TABL_GET". After that i can use the Function module 'DDIF_TABL_PUT'.

Suppose, If i pass the table name 'MARA' to FM "DDIF_TABL_GET" and we can get the field details of that table to DD03P_TAB table of the Function module "DDIF_TABL_GET".

Thanks,

Vishnu.

Edited by: Vishnu on Nov 16, 2011 4:18 PM

0 Kudos
966

Instead of that two step process, you can directly use DDUT_OBJECT_COPY. SAP standard functionality uses this.


CALL FUNCTION 'DDUT_OBJECT_COPY'
  EXPORTING
    type                  = 'STRU'
    src_name              = 'MARA'
*   SRC_ID                = ' '
    dst_name              = 'YTESTMARA'
*   DST_ID                = ' '
*   STATE                 = 'A'
*   WITH_SUBOBJECTS       = 'X'
*   WITH_DOCU             = 'X'
* EXCEPTIONS
*   ILLEGAL_INPUT         = 1
*   SRC_NOT_FOUND         = 2
*   COPY_FAILURE          = 3
*   COPY_REFUSED          = 4
*   OTHERS                = 5
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Kesav

0 Kudos
966

Hi Keshav,

Sure, I will check it and get back to you. Thank you very much for your help.

Thanks,

Vishnu.

0 Kudos
966

Indeed...and if you look deeper, you'll see that this FM is just calling the DDIF_* ones...

Moreover, this one is very restrictive as it does not allow to add extra/custom fields...

Kr,

Manu.

Former Member
0 Kudos
966

HI,

Fm : DDIF_TABL_PUT should work.

Search for all DDIF* in SE37

Regards,

Jhings

0 Kudos
966

Hi Jhings,

Thanks for your reply.

The Function module which suggested you is work for Table only.

Thanks,

Vishnu

Former Member
0 Kudos
966

Dear friend,

to create dynamic ddic object

this might be useful...create 1 table in data dictionary here in this case i have created ZAVI_TST

and run below program..

REPORT ZAVI_LOGIC.

data : DD03P_TAB LIKE DD03P OCCURS 2 WITH HEADER LINE.

DD03P_TAB-TABNAME = 'ZAVI_TST'.

DD03P_TAB-FIELDNAME = 'F1'.

DD03P_TAB-POSITION = '1'.

DD03P_TAB-KEYFLAG = 'X'.

DD03P_TAB-ROLLNAME = 'CHAR1'.

APPEND DD03P_TAB.

DD03P_TAB-TABNAME = 'ZAVI_TST'.

DD03P_TAB-FIELDNAME = 'F2'.

DD03P_TAB-POSITION = '2'.

DD03P_TAB-KEYFLAG = ' '.

DD03P_TAB-ROLLNAME = 'CHAR2'.

APPEND DD03P_TAB.

COMMIT WORK.

CALL FUNCTION 'DDIF_TABL_PUT'

EXPORTING

NAME = 'ZAVI_TST'

TABLES

DD03P_TAB = DD03P_TAB

EXCEPTIONS

PUT_FAILURE = 01

OTHERS = 02.

IF SY-SUBRC = 1.

ROLLBACK WORK.

ENDIF.

IF SY-SUBRC = 0.

COMMIT WORK.

WRITE / 'Table ZAVI_TST is now revised with two fields.'.

WRITE / 'The active version is unchanged.'.

ELSE.

WRITE / 'Table ZAVI_TST is still active in the old state.'.

ENDIF.

after successful completion of the program...

open tcode se14

press enter with table name selection

then press button active and adjust data

with option save data or delete data (as per your choice)

revert back if any help needed... enjoy programming.... good luck...

avirat