01-03-2014 3:16 PM
Hello,
I writing a function module. I have string that contains the name of database table, and I need to know if the table is SAP standart table, or z table that not created by SAP.
Thanks,
Ednri.
01-03-2014 3:49 PM
Ednri,
Custom table should always start either with Z or Y so check for first character in the string and find out if it is a stanndard table or custom table
To find out who created table look into table DD02L
Thanks
Bala Duvvuri
01-03-2014 3:49 PM
Hi ednri,
you can use this link Where all the database tables are stored? | SCN.
and the table name is DD02L help to solve your problem.
Regards
sudhakar
01-03-2014 3:51 PM
HI Ednri,
There is a Table for the TABLE DD02L that table store the SAP Table name with Author.
Select TABNAME from DD02l where AS4user = (Function module paramter name) and Tabname like 'Z%' .
Try this code its works fine for me.
Regards.
Nishant
01-04-2014 3:11 AM
DD02L table does not contain the user who created the table but contains only who last changed that table.
01-04-2014 12:10 PM
01-04-2014 1:02 PM
Hi,
You can find the table history in DBTABLOG table! check the report RSTBZAHL
01-05-2014 9:47 PM
I don't understand how should I use this table in order to check who created the table.
01-06-2014 3:02 AM
It is stored in TADIR table : AUTHOR field.
TADIR -> OBJECT= TABL and OBJ_NAME = Table Name -> AUTHOR
Regards.
01-06-2014 10:42 AM
Hi Ednri,
you can try this code on your Function Module. i think it works fine.
goto se37,
make the following entries.
import parameter
export parameter
include the below code in source code
TYPES : BEGIN OF ty_tables,
tabname TYPE tabname,
END OF ty_tables.
TYPES : BEGIN OF ty_tadir,
author TYPE author,
END OF ty_tadir.
DATA lt_dd02l TYPE TABLE OF ty_tables.
DATA ls_tadir TYPE ty_tadir.
SELECT tabname
FROM dd02l
INTO TABLE lt_dd02l
WHERE tabname EQ im_tabname.
IF sy-subrc NE 0.
return-type = 'W'.
return-message = 'NO tables found'.
ELSE.
return-type = 'S'.
return-message = 'Table exists'.
SELECT SINGLE author
FROM tadir
INTO ls_tadir
WHERE obj_name EQ im_tabname.
IF sy-subrc eq 0.
MOVE ls_tadir-author to author.
MOVE im_tabname to tablename.
ELSE.
return-type = 'E'.
return-message = 'Could not found'.
ENDIF.
ENDIF.
save and activate.
Cheers
01-06-2014 11:04 AM
As already written, information is stored in repository table TADIR. Access the table with the full primary key (as another type of object may share the same name) PGMID = 'R3TR', OBJECT = 'TABL',OBJ_NAME = name of the table .
In most systems, customer namespace are the default 'Y*' or 'Z*' range (1), in some other some namespace were reserved (2), so from package DEVCLASS you could check in table TDEVC the value of NAMESPACE which should be /0CUST/ for your customer developments and start with /0SAP for SAP standard /0SAP/, /0SAPBAS/, etc.) or even check owner of namespace in table TRNSPACETT.
DD02L -> TADIR -> TDEVC -> TRNSPACETT
Regards,
Raymond
01-06-2014 11:58 AM
Hi Ednri,
As most of us have already indicated above, use table TADIR with the fields PGMID as R3TR, OBJECT as TABL and OBJ_NAME as the table name that you want to check. The correct field to retrieve the name of the user who created the table is TADIR-AUTHOR. Use this for your results.
Also, to find if the table is standard or a custom, check the first character of the table name and it should be Z or Y. Thats a standard coding practice for mostly all SAP implementations.
Hope it helped.
Thanks,
Anupam
01-06-2014 12:00 PM