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: 

Saving List as Local File

Former Member
0 Kudos

hi

How to save Report output (i.e.,list) as local file that is Excel or Word Document to the system.

Is there any std procedure to save or we have to write logic using module pool by placing Save button(pushbutton).

Thanks & Regards ,

sandhya

4 REPLIES 4

Former Member
0 Kudos

Hi sandhya,

1. If the list is genereated using

se38 program,

then this facility is automatically

available (from the toolbar, or the menu)

regards,

amit m.

Former Member
0 Kudos

Hay Sandya

after Run your report program

then go to

system>List>Save-->Local File

here you will select

the following options

1) unconverted

2) Spreadsheet

3) Rich text format

4) HTML Format

5) Copy to Clipboard

try with this steps sandhya

Thanks & regards

Sreenivasulu P

Message was edited by: Sreenivasulu Ponnadi

Former Member
0 Kudos

HI

GOOD

YOU CAN'T ABLE TO SAVE THE REPORT OUTPUT IN TEXT OR EXCEL FILE BUT YOU CAN TAKE THE PRINTOUT OF THE OUTPUT USING THE PRINT OPTION.

THANKS

MRUTYUN

former_member184569
Active Contributor
0 Kudos

Hi Sandhya,

Try the following code.

You can do it this way :

You call the report whose list you want, in another program, exporting list to memory.

Then get that list and write it to file.

*****************************************************

DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.

DATA : BEGIN OF list_asc OCCURS 0,

msg(300) TYPE c,

END OF list_asc.

DATA : wa_c_filename(30) TYPE c.

wa_c_filename = '/data/ftp/out/rep.txt'.

data fname type RLGRAP-FILENAME value 'c:\audit_report.xls'.

data ftype type RLGRAP-FILETYPE value 'DAT'.

SUBMIT pgm_xyz EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list

EXCEPTIONS

not_found = 1.

CALL FUNCTION 'LIST_TO_ASCI'

  • EXPORTING

  • LIST_INDEX = -1 "LIST_INDEX SY-LSIND.

TABLES

listasci = list_asc

listobject = list.

/* To download data to the system as excel file.

perform download_file.

/* To store as a file in the SAP server . This is not required for your case. The list contents will be in the file in the server, filename and file path as specified in wa_c_filename.*/

OPEN DATASET wa_c_filename FOR OUTPUT in text mode.

IF sy-subrc NE 0.

WRITE : / 'The file could not be created'.

ELSE.

LOOP AT list_asc.

TRANSFER list_asc TO wa_c_filename.

ENDLOOP.

CLOSE DATASET wa_c_filename.

ENDIF.

***************************************************

/You can download this file to the system using the following function module/

FORM download_file.

data fname type RLGRAP-FILENAME value 'c:\audit_report.xls'.

data ftype type RLGRAP-FILETYPE value 'DAT'.

/*Table structure should match with list output.

DATA: BEGIN OF INFILE OCCURS 0,

ORDER(10) TYPE C,

COST_CTR(6) TYPE C,

PCT_1(8) TYPE C,

PCT_2(8) TYPE C,

PCT_3(8) TYPE C,

PCT_4(8) TYPE C,

PCT_5(8) TYPE C,

PCT_6(8) TYPE C,

PCT_7(8) TYPE C,

PCT_8(8) TYPE C,

PCT_9(8) TYPE C,

PCT_10(8) TYPE C,

PCT_11(8) TYPE C,

PCT_12(8) TYPE C,

END OF INFILE.

loop at list_asc.

infile = list_asc .

append infile.

endloop.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

  • Changed by sthomas

filename = fname

filetype = ftype

  • End of change

  • ITEM = ' '

  • MODE = 'A'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • SILENT = 'S'

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • ACT_FILENAME =

  • ACT_FILETYPE =

  • FILESIZE =

  • CANCEL =

TABLES

data_tab = infile.

endform.

Regards,

Susmitha