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

Table types

Former Member
0 Likes
1,099

Hi Experts,

Is there any customized report or code (not standard) through which I can download all Z table types. We are using SAP CRM 7.0. Kindly help me on this.

Thanks,

Varun

1 ACCEPTED SOLUTION
Read only

Kartik2
Contributor
0 Likes
1,058

hi!!

All the data regarding table types is stored in tables DD40L and DD40T. To retrieve only the names of table types you can write your own custom code using table DD40L. Here is what i have tried.

report  ykk_table_types.
types:  begin of ty_types,
        table_type type ttypename,
        end of ty_types.

data:   lt_table_types type standard table of ty_types.

select typename
  from dd40l
  into table lt_table_types
  where typename like 'Z%'.

write sy-subrc.

after executing this code you will have names of all the custom table types in internal table lt_table_types. from here you can simply download the internal table. Like wise you can modify the code according to your requirements of what fields you need, such as data type, row type etc, hope this will be helpful, Thank you.

Regards,

kartik

9 REPLIES 9
Read only

Former Member
0 Likes
1,058

Hi,

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-DownloadAllCustom(Z)ObjectswithrespecttoDEV+Class

this may help u..have a look..

Thanks & regards.

Read only

Former Member
0 Likes
1,058

Hi,

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-DownloadAllCustom(Z)ObjectswithrespecttoDEV+Class

try this link it will helps you

krishnakiran

Read only

Kartik2
Contributor
0 Likes
1,059

hi!!

All the data regarding table types is stored in tables DD40L and DD40T. To retrieve only the names of table types you can write your own custom code using table DD40L. Here is what i have tried.

report  ykk_table_types.
types:  begin of ty_types,
        table_type type ttypename,
        end of ty_types.

data:   lt_table_types type standard table of ty_types.

select typename
  from dd40l
  into table lt_table_types
  where typename like 'Z%'.

write sy-subrc.

after executing this code you will have names of all the custom table types in internal table lt_table_types. from here you can simply download the internal table. Like wise you can modify the code according to your requirements of what fields you need, such as data type, row type etc, hope this will be helpful, Thank you.

Regards,

kartik

Read only

Former Member
0 Likes
1,058

Hi kartik,

I want to download it from my SAP system to hard drive (location C or D ) in excel format. Can you provide me with full code. Please help.

Thanks,

Varun

Read only

0 Likes
1,058

Hi Varun,

here it is full code,

try it,

hope it will help your problem.

TYPES:  BEGIN OF ty_types,
        table_type TYPE ttypename,
        END OF ty_types.
 
DATA:   lt_table_types TYPE STANDARD TABLE OF ty_types.
DATA:   wa_table_types type ty_types.
data : p_file TYPE string.
 
SELECT typename
  FROM dd40l
  INTO TABLE lt_table_types
  WHERE typename LIKE 'Z%'.

 PERFORM EXCEL_DWLD.

FORM EXCEL_DWLD.
Data:    wf_filename       like rlgrap-filename value 'C:\DATA.XLS'.
TYPES: BEGIN OF TY_FILE,
             table(20),
             END OF TY_FILE.
DATA WT_FILE TYPE TABLE OF TY_FILE.
DATA WA_FILE TYPE TY_FILE.

TYPES: BEGIN OF TY_FIELDNAME,
             FIELD(60),
             END OF TY_FIELDNAME.
DATA   WT_FIELDNAME TYPE TABLE OF TY_FIELDNAME.
DATA   WA_FIELDNAME TYPE TY_FIELDNAME.

WA_FIELDNAME-FIELD = 'Table Names'.
APPEND WA_FIELDNAME TO WT_FIELDNAME.

LOOP AT lt_table_types into wa_table_types.
WA_FILE = WA_TABLE_TYPES- table_type.
APPEND WA_FILE TO WT_FILE.
ENDLOOP.

    Call function 'EXCEL_OLE_STANDARD_DAT'
       exporting
            file_name                 = wf_filename
          tables
            data_tab                  = wt_file
            fieldnames                = wt_fieldname
       exceptions
            file_not_exist            = 1
            filename_expected         = 2
            communication_error       = 3
            ole_object_method_error   = 4
            ole_object_property_error = 5
            invalid_filename          = 6
            invalid_pivot_fields      = 7
            download_problem          = 8
            OTHERS                    = 9.

ENDFORM.

Read only

Former Member
0 Likes
1,058

Hi,

Thanks to all.

Read only

Former Member
0 Likes
1,058

Hi Sendil,

With the help of your code I am able to download Z table types names but not description, length etc other fields of table types. Kindly provide me full code with the names and fields of table types to be download.

Thanks,

Varunsh

Read only

sendhil_kumar
Active Participant
0 Likes
1,058

Hi Varun,

U can download to Excel. Try the code given below.

TYPES:  BEGIN OF ty_types,
        table_type TYPE ttypename,
        END OF ty_types.

DATA:   lt_table_types TYPE STANDARD TABLE OF ty_types.
data : p_file TYPE string.

SELECT typename
  FROM dd40l
  INTO TABLE lt_table_types
  WHERE typename LIKE 'Z%'.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename                        = 'C:\Apps\Aa.xls'
   filetype                        = 'ASC'
  TABLES
    data_tab                        = lt_table_types.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Edited by: sendhilb4u on Oct 27, 2011 1:45 PM

Read only

0 Likes
1,058

Hi,

DATA: LT_EXCEL1 TYPE TABLE OF TY_EXCEL1 WITH HEADER LINE,

DATA: SOURCEFILENAME TYPE STRING,

*Downloading Data to Excel File

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = SOURCEFILENAME

FILETYPE = 'XLS'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = LT_EXCEL1.

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

MESSAGE I000(ZZ) WITH 'Unable to download error file.'.

ENDIF.

FOLLOW THIS.

Thanks & regards.