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

How to down load data from table maintainance screen to excel ?

Former Member
0 Likes
3,158

HI all ,

Could you please tell me how to down load data from table maintainance screen to excel ?

SM30 -> Ztable -> display--from here user wants to down load the data .

If we need to code that functionality , how we will do that? , any sample code is appreciable .

Thanks in advance ,

Dharma .

6 REPLIES 6
Read only

Former Member
0 Likes
1,749

Hi Dharma,

to satisfy your requirement first you must define a table maintenance generator.after that you have two chances.one is already there in the tablemaintenance screen you have a facility to download data into excel ,another one is customizing the screen means providing your own button and code.

for first one follow these steps.

1) go to sm30

2)open the table in display mode

3)press shift+ f1.it will show you a screen with values in a in grid view.

4)then press ctrlshiftF7(direct download to excel)

or

ctrl + shift + F9

5)it will show you a modaldialog in which you have to select to which format means whether to excel,word or html you want to download the data.

6)select spreadsheet and click on ok

7)it will ask you path and file name.

8)after giving both click on generate

for customizing

follow these steps carefully.

1)go to se11

2)type the tablename and click on display.

3)go to utilities->tablemaintenance

4)you will get tablemaintenance screen.in that double click on

overview screen.

5)you will go to the tablemaintenance screen program.

there in the PAI module type MODULE DOWNLOADEXCEL.

and then double click on DOWNLOADEXCEL.it will show a message ,click tickmark then it will create a include for your module.

in that module write the following code.

data:begin of itab occurs o.

include structure ztable. "ztable is the table for which you want to do all these

data:end of itab.

case sy-ucomm.

when 'SHOW'. "fcode for display button

get the data from dbtable to the internal table. "its not code what you have to do

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\test.xls'

FILETYPE = 'ASC'

tables

data_tab = itab

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

better to use existed one.if you have any doubts let me know.

please reward points if helpful.

Read only

0 Likes
1,749

Hi Krishan/Shyam,

Happy to see you responses.. Thank you very much . Solution provided by you is working well . But the problem is , if main screen regenerated (Tablemaintainance screen) for any reason later , Our cutom code in PAI section will get vanished . Hence is there any chance that we can code in Table maintanance events .

Request Every body to advice on this .

Thanks ,

Dharma .

Edited by: Dharma Rao potladhurthi on Apr 25, 2008 6:33 PM

Read only

0 Likes
1,749

Hi Dharma,

3rd post on the same query!

I have answered the previous one. Please refer to that, and kindly close this thread.

Best Regards,

Rekha

Read only

Former Member
0 Likes
1,749

Hi Dharma,

There is a function module called gui_download.

You can use that in an ABAP program and download the data to excel sheet.

Give the values like file name, separator and table name

The required table is to be copied to an internal table and this is to be used as table name.

Let me know if you want more help.

I shall give a sample code as soon as possible if u want.

Reward points if this finds helpful

Read only

Former Member
0 Likes
1,749

Hi Dharma,

I think there is no option to download data excel from SM30

but there is one alternative option to you that u need to go SE11 and give table name and fetch data whatecer as per your requirment once data displayed in ALV then you need to follow...

table entry>list>export>spreed sheet.....from se11 itself..

here you can transport data to excel..

hope this would help

please reward if solve!

Amit

Read only

Former Member
0 Likes
1,749

Hi,

Goto SE11-> Utilities->Tablecontents->create entries

In that screen, TABLEVIEW MENU -> PRINT.

Then in that screen you have 5 and 7 Buttons for downloading data to excel files.

5 button for direct EXCEL sheet. save the sheet after data gets displayed in to the sheet.

7 button for Spreadsheet, HTML, Rich text format, etc

Same can be done with SM30.

In that screen, TABLEVIEW MENU -> PRINT.

Then in that screen you have 5 and 7 Buttons for downloading data to excel files.

5 button for direct EXCEL sheet. save the sheet after data gets displayed in to the sheet.

7 button for Spreadsheet, HTML, Rich text format, etc

Reward points if helpful.

Thanks and Rewards.

Edited by: Ammavajjala Narayana on Apr 24, 2008 2:22 PM