Download the output into Excel...(List- export- spreadsheet)
Dear friends,
I want to download the output into Excel...
I am using all SAP standards and using the ALV Block list
Ex: List->export->local file.. is anable from here i can download to excell .....but the same there is anothere option : List->export->spreadsheet...( this one inactive.)
I want to activate the List->export->spreadsheet option.
how to do this???
Thanks,
Sridhar.
Hi
Use the Function Module:
EXCEL_OLE_STANDARD_DAT
For your purpose.
But by default you can get the option to download into several formats including your desired one.
Regards,
Sreeram
Similar Messages
-
Excel download for ALV Block report (List- export- spreadsheet)
Dear friends,
I want to download the output into Excel...
I am using all SAP standards and using the ALV Block list
Ex: List->export->local file.. is anable from here i can download to excell .....but the same there is anothere option : List->export->spreadsheet...( this one inactive.)
I want to activate the List->export->spreadsheet option.
how to do this???
Thanks,
Sridhar.hi Sridhar,
there is already an option to download in spreadsheet format when saving to local file...then why do you want to activate List->export->spreadsheet ????
regards,
madhu -
Download the data into excel sheet
hello experts,
I am using the GUI_DOWNLOAD fm to download the data in to excell sheet on to the desktop but here i am getting some problem
For some of the fields i put constant values like '004' or '001' when it is downloaded the data into to .xls its removing the leading zeros.. and just downloading the values as 4 or 1
can anyone guide me how to hold those leading zeros
its bit urgent plzThese are XL Issue ,you can use diffrenet logic
Check the below logic :
REPORT ZTEST3 line-size 400.
<b>DATA : V_CHAR(1) TYPE C VALUE ''''.</b>
data : v_field(12) type c.
data : begin of itab occurs 0,
fld1(12) type c,
end of itab.
start-of-selection.
v_field = '0000012345'.
CONCATENATE V_CHAR V_FIELD INTO V_FIELD.
itab-fld1 = v_field.
append itab.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME =
'C:\Documents and Settings\smaramreddy\Desktop\fff.xls'
FILETYPE = 'ASC'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I have used one field here ,i am not sure for many fields in internal table.
Thanks
Seshu -
Execute in background but download the data into excel file
I would like to know if it is possible to exceute the report in background but generate the output in excel file instead of to spool request.
Hi
It is possible.You can use Open_Dataset to do this.Also you can use
"Set_Function_Code" also to do this. I think to download to excel the function code is "%EXCEL". Try this..
Hope this willl solve your query.
Reward All Helpfull Answers....... -
Downloading the data into excel sheet , how can i maintain page numbers
I need some information. In output screen pagenumber is displayed.
when i am downloading the data from se38 into excel sheet.
How can i write the code to display the page number in excel sheet . waiting for your responseHi
Please see below code for ur requirement.
DATA: BEGIN OF li_field OCCURS 0,
field(16) TYPE c,
END OF li_field.
CLEAR li_field[].
REFRESH li_field.
li_field-field = text-t01.
APPEND li_field.
CLEAR li_field.
li_field-field = text-006.
APPEND li_field.
CLEAR li_field.
li_field-field = text-t04.
APPEND li_field.
CLEAR li_field.
li_field-field = text-t05.
APPEND li_field.
CLEAR li_field.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = file_path
TABLES
data_tab = data_table
fieldnames = li_field
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_pivot_fields = 6
download_problem = 7
OTHERS = 8.
please reward points if helpful -
Material num truncated while downloading the data into excel in ALV GRID
Hi,
I developed a report with ALV GRID display. The reoport is having Material number as one of the column. The report shows the total 10 digit material number. When i tried to downlaod the report into an excel sheet or a TXT file, material number in the text file shows only the last two digits.
Please let me know if you have any solution for this.
URGENTHi,
I developed a report with ALV GRID display. The reoport is having Material number as one of the column. The report shows the total 10 digit material number. When i tried to downlaod the report into an excel sheet or a TXT file, material number in the text file shows only the last two digits.
Please let me know if you have any solution for this.
URGENT -
HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE
Hi SAP Gurus,
I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.You can transfer the contents of internal table to excel using this code..
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of itab.
select vbeln
posnr
from vbap
up to 20 rows
into table itab.
* EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
* handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_WORK TYPE OLE2_OBJECT,
H_SHEET TYPE OLE2_OBJECT,
H_CELL TYPE OLE2_OBJECT,
V_COL LIKE SY-TABIX. " column number of the cell
DATA:
V_STEP(30),
V_FILE LIKE RLGRAP-FILENAME.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Creating Excel...'
EXCEPTIONS
OTHERS = 1.
* start Excel
V_STEP = 'Starting Excel'.
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
* CALL METHOD OF H_EXCEL 'OPEN' EXPORTING #1 = 'C:DMC_REC.XLS'.
* PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* Get the list of workbooks
V_STEP = 'Preaparing Excel'.
CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
PERFORM ERR_HDL.
** Add new workbook (create a file)
CALL METHOD OF H_WORK 'ADD'.
PERFORM ERR_HDL.
* Get the created worksheet
************************Sheet Number
CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
************************Sheet Number
PERFORM ERR_HDL.
* Activate (select) the first sheet
CALL METHOD OF H_SHEET 'ACTIVATE'.
PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
V_STEP = 'Adding data to Excel'.
LOOP AT ITAB.
V_COL = SY-TABIX.
PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
ENDLOOP.
V_STEP = 'Releasing Excel'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
H_EXCEL-HANDLE = -1.
*& Form ERR_HDL
* text
* --> p1 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Error in processing Excel File:', V_STEP.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*& Form FILL_CELL
* text
* -->P_1 text
* -->P_1 text
* -->P_1 text
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_CELL
EXPORTING #1 = ROW #2 = COL.
PERFORM ERR_HDL.
SET PROPERTY OF H_CELL 'Value' = VAL .
PERFORM ERR_HDL.
ENDFORM. " FILL_CELL -
HI ,
I developed ALV report, the output is coming properly. But if i download that output into local file or spreadsheet from ALV output screen am unable to get the data only header and field headers are coming but data is not coming. But for other ALV with same importing parameters it is downloading properly. I donu2019t know whatu2019s problem only for this ALV, any one can please help me out from this situation pls.
ThxHi Lavanya
There can be two possibilities
1.) check the authorization, if it's missing, then this might happen...u hav said that the other report, it's downloading fine...r u trying to download the other report also with the same user id? is it a standard program or a customized report?
2.) just try reducing the security level in excel --> Tools -> Macros -> Security
regards
Sathish -
Regarding Downloading of Report[List] output into Excel Sheet
Hi All,
Hi i have written one Classical report. I got the output Correctly.
Now i want to download that data into Excel Sheet in excatly the way it displayed in List[Report] output.
I had followed the path <b>System->List->Save->LocalFile->Spread Sheet</b> and tried to download the same.
Though it is downloaded it has not come in exact format.
Now what i want is to add a button above that report & write a program in that to download that data into Excel Sheet.
Can anybody tell me how can solve this issue. If i follow above procedure will the data[List Output] be downloaded into exact format into excel.
If anybody knows other way please sujjest.
Thanks in advance.
Thanks & Regards,
Prasad.Hi Prasad,
I have done a program which downloads the output in the excel sheet in the correct format.
Just check the program. The code given in bold is what you have to use.
REPORT zexp MESSAGE-ID f4 LINE-SIZE 195.
Tables Used ***********************************
TABLES : bseg, bkpf, bsak, lfa1, payr .
Declaring Internal Tables **************************
DATA :
Internal table to hold header data *************
BEGIN OF header OCCURS 0,
ext_date(10) TYPE c,
delimit(1) TYPE c,
ext_time(8) TYPE c,
END OF header,
Internal table to hold detail info **************
BEGIN OF i_data OCCURS 0,
belnr LIKE bsak-belnr,
gjahr LIKE bsak-gjahr,
bukrs LIKE bsak-bukrs,
bldat LIKE bsak-bldat,
xblnr LIKE bsak-xblnr,
blart LIKE bsak-blart,
augdt LIKE bsak-augdt,
augbl LIKE bsak-augbl,
wrbtr LIKE bsak-wrbtr,
shkzg LIKE bsak-shkzg,
lifnr LIKE bsak-lifnr,
name1 LIKE lfa1-name1,
chect LIKE payr-chect,
status(1) TYPE c,
END OF i_data,
Internal table to to collect *****************
BEGIN OF i_data1 OCCURS 0,
belnr LIKE bsak-belnr,
gjahr LIKE bsak-gjahr,
bukrs LIKE bsak-bukrs,
bldat LIKE bsak-bldat,
xblnr LIKE bsak-xblnr,
blart LIKE bsak-blart,
augdt LIKE bsak-augdt,
augbl LIKE bsak-augbl,
wrbtr LIKE bsak-wrbtr,
shkzg LIKE bsak-shkzg,
lifnr LIKE bsak-lifnr,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
chect LIKE payr-chect,
status(1) TYPE c,
END OF i_data1,
String variables for formatting file data *************
fidoc_year TYPE string,
comp_code TYPE string,
check_numbr TYPE string,
vendor TYPE string,
inv_date TYPE string,
inv_nbr TYPE string,
paid_dat TYPE string,
inv_amt TYPE string,
status TYPE string,
ref_doc TYPE string,
************Internal table to store the file contents **************
BEGIN OF i_final_file OCCURS 0,
record(300) TYPE c,
END OF i_final_file,
Internal table to store the list of allowed document types ****
BEGIN OF i_doctype OCCURS 0,
blart LIKE bsak-blart,
END OF i_doctype,
Internal table to hold vendor information ************
BEGIN OF i_lfa1 OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
END OF i_lfa1,
Internal table to hold check information *************
BEGIN OF i_payr OCCURS 0,
chect LIKE payr-chect,
vblnr LIKE payr-vblnr,
gjahr LIKE payr-gjahr,
zbukr LIKE payr-zbukr,
END OF i_payr.
Data declarations **************************
DATA : ws_stblg TYPE bkpf-stblg,
todate TYPE bsak-augdt,
fromdate TYPE bsak-augdt,
w_day LIKE dtresr-weekday,
day LIKE scal-indicator,
d TYPE n,
e_date LIKE sy-datum,
e_time LIKE sy-uzeit,
dd(2) TYPE c,
mm(2) TYPE c,
yy(4) TYPE c,
hh(2) TYPE c,
min(2) TYPE c,
sec(2) TYPE c.
DATA : wa_filepath(50) TYPE c,
wa_filename(50) TYPE c,
wa_c_filename(100) TYPE c,
arch_path(50) TYPE c.
<b>* Data for downloading to list
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: BEGIN OF i_invoiceheader OCCURS 0,
name(30) TYPE c,
END OF i_invoiceheader.
RANGES dates FOR bkpf-budat.</b>
Selection Screen ************************
SELECTION-SCREEN SKIP 2.
SELECT-OPTIONS:
s_bukrs FOR bkpf-bukrs ,
s_blart FOR bkpf-blart ,
s_augdt FOR bsak-augdt. " memory id todat TO fromdat.
PARAMETERS :submit AS CHECKBOX DEFAULT ' ' .
<b>* Download list to file.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'LIST'.
PERFORM download.
WHEN 'BACK'.
EXIT.
ENDCASE.</b>
<b>----
FORM download *
FORM download.
if s_augdt is initial.
dates-sign = 'I'.
dates-option = 'BT'.
dates-low = '20050901'.
dates-high = '20050920'.
APPEND dates.
else.
dates = s_augdt.
append dates.
endif.
/* Submit the same program .
SUBMIT zexp WITH s_augdt IN dates
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.
PERFORM download_file.
ENDFORM.
FORM download_file *
FORM download_file.
DATA fname TYPE rlgrap-filename VALUE 'c:\audit_report.xls'.
DATA ftype TYPE rlgrap-filetype VALUE 'DAT'.
DATA numeric_data(10) TYPE c VALUE '0123456789'.
*Table structure should match with list output.
DATA : BEGIN OF i_data1 OCCURS 0,
belnr(12) TYPE c,
gjahr(6) TYPE c,
bukrs(8) TYPE c,
chect(13) TYPE c,
lifnr(12) TYPE c,
name1(37) TYPE c,
bldat(14) TYPE c,
xblnr(18) TYPE c,
augdt(14) TYPE c,
wrbtr(17) TYPE c,
status(4) TYPE c,
augbl(18) TYPE c,
sortl(17) TYPE c,
END OF i_data1.
Header record of the excel sheet.
PERFORM fill_header.
LOOP AT list_asc.
Reads lines starting from the first record in the report. All informatory statements in the report are not read.
IF list_asc+1(10) CO numeric_data.
i_data1 = list_asc .
APPEND i_data1.
ENDIF.
ENDLOOP.
Call the download function.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = fname
filetype = ftype
TABLES
data_tab = i_data1
FIELDNAMES = i_invoiceheader.
ENDFORM.
FORM fill_header *
FORM fill_header.
i_invoiceheader-name = 'Doc Number'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Fsc Year'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Cmp Code'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Check No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Vendor No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Entered by'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Doc Date'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Ref Doc No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Clearing Date'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Amount'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Status'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Clearing Doc No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Sort field'.
APPEND i_invoiceheader.
ENDFORM. " fill_header</b>
Initialization *************************
INITIALIZATION.
To initialize the date parameter on the selection screen.
The date by default ranges from previous Monday to Sunday.
todate = sy-datum.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = todate
IMPORTING
day = day.
d = day.
if d < 4.
todate = sy-datum - d - 4 .
else.
todate = sy-datum - d + 3 .
endif.
fromdate = todate - 6.
MOVE: 'BT' TO s_augdt-option,
fromdate TO s_augdt-low,
todate TO s_augdt-high.
APPEND s_augdt.
Start of Selection **************************
START-OF-SELECTION.
Checking the validity of the inputted dates ****************
IF s_augdt-low > sy-datum OR s_augdt-high > sy-datum.
MESSAGE i999 WITH 'You cannot input future date'.
EXIT.
ENDIF.
IF NOT s_bukrs IS INITIAL.
MESSAGE i999 WITH 'Program will run with input parameters in screen!!'.
ENDIF.
Initialize the header data ***********************
e_time = sy-uzeit.
MOVE e_time+0(2) TO hh.
MOVE e_time+2(2) TO min.
MOVE e_time+4(2) TO sec.
CONCATENATE hh min sec INTO header-ext_time SEPARATED BY ':'.
e_date = sy-datum.
MOVE e_date+0(4) TO yy.
MOVE e_date+4(2) TO mm.
MOVE e_date+6(2) TO dd.
CONCATENATE mm dd yy INTO header-ext_date SEPARATED BY '/'.
header-delimit = '~'.
APPEND header.
List allowed document types **********************
PERFORM fill_doc_types.
**To select the documents within the range of week or as inputted **
IF s_augdt IS INITIAL.
MOVE: 'I' TO s_augdt-sign,
'BT' TO s_augdt-option,
fromdate TO s_augdt-low,
todate TO s_augdt-high.
APPEND s_augdt.
ENDIF.
Selecting the records from the database ****************
IF s_bukrs IS INITIAL AND s_blart IS INITIAL.
Select all documents of company code 1000, *********
4200 and 8000, and allowed document types *********
SELECT belnr gjahr augdt augbl bukrs
blart bldat xblnr lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
FOR ALL ENTRIES IN i_doctype
WHERE blart EQ i_doctype-blart
AND augdt IN s_augdt
AND ( bukrs = '1000' OR bukrs ='4200' OR
( bukrs = '8000' AND blart NE 'ZP' ) ).
loop at i_data.
Exclude reversed documents
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
endif.
endloop.
ELSEIF s_blart IS INITIAL.
Select all documents of allowed document types ******
and inputted company code ************
SELECT belnr gjahr augdt augbl bukrs
blart bldat xblnr lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
FOR ALL ENTRIES IN i_doctype
WHERE blart EQ i_doctype-blart
AND augdt IN s_augdt
AND bukrs IN s_bukrs .
LOOP AT i_data.
Exclude documents of type ZP
for company code 8000.
IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
DELETE i_data.
continue.
ENDIF.
Exclude reversed documents
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
continue.
endif.
ENDLOOP.
READ TABLE i_data INDEX 1.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
ELSE.
Select the documents matching the company codes *****
and document types inputted in the selection screen ****
SELECT belnr gjahr augdt augbl bukrs bldat xblnr
blart lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
WHERE bukrs IN s_bukrs AND blart IN s_blart
AND augdt IN s_augdt.
SORT i_data BY blart.
LOOP AT i_data.
Filtering the records selected
based on the document type
READ TABLE i_doctype WITH KEY blart = i_data-blart.
IF sy-subrc NE 0.
DELETE i_data.
continue.
ENDIF.
Exclude documents of type ZP
for company code 8000.
IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
DELETE i_data.
continue.
ENDIF.
Exclude reversed documents.
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
continue.
endif.
ENDLOOP.
READ TABLE i_data INDEX 1.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
ENDIF.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
credit/debit identification ***********************
LOOP AT i_data.
IF i_data-shkzg EQ 'H'.
i_data-wrbtr = i_data-wrbtr * 1.
ELSEIF i_data-shkzg EQ 'S'.
i_data-wrbtr = i_data-wrbtr * -1.
ENDIF.
MODIFY i_data.
ENDLOOP.
for summarizing ******************************
LOOP AT i_data.
MOVE-CORRESPONDING i_data TO i_data1.
COLLECT i_data1.
ENDLOOP.
Vendor informations and Check Informations *****************
SELECT lifnr name1 sortl
FROM lfa1
APPENDING CORRESPONDING FIELDS OF TABLE i_lfa1
FOR ALL ENTRIES IN i_data1
WHERE lifnr = i_data1-lifnr.
SELECT chect vblnr gjahr zbukr FROM payr APPENDING CORRESPONDING
FIELDS OF TABLE i_payr FOR ALL ENTRIES
IN i_data1 WHERE vblnr = i_data1-augbl
AND gjahr = i_data1-augdt(4)
AND zbukr = i_data1-bukrs.
SORT i_data1 BY augbl gjahr bukrs lifnr.
SORT i_payr BY vblnr gjahr zbukr.
SORT i_lfa1 BY lifnr.
LOOP AT i_data1.
READ TABLE i_payr WITH KEY vblnr = i_data1-augbl
gjahr = i_data1-gjahr
zbukr = i_data1-bukrs.
IF sy-subrc EQ 0.
i_data1-chect = i_payr-chect.
ENDIF.
READ TABLE i_lfa1 WITH KEY lifnr = i_data1-lifnr.
IF sy-subrc EQ 0.
i_data1-name1 = i_lfa1-name1.
i_data1-sortl = i_lfa1-sortl.
ENDIF.
i_data1-status = 'X'.
MODIFY i_data1.
ENDLOOP.
**The records are sorted by clearing date, check number and doc type**
SORT i_data1 BY augdt chect blart.
**********The header record is outputted on the screen****************
PERFORM write_header.
********Data is moved to internal table in the file format *************
PERFORM move_data.
Line items are outputted on the screen *********************
PERFORM write_output.
*& Form write_header &*
*& This outputs the header information to screen &*
FORM write_header.
SKIP.
SET PF-STATUS 'LIST'.
Outputting the header information *********************
WRITE : / 'Extraction Date : ' , header-ext_date.
WRITE : / 'Extraction Time : ' , header-ext_time.
FORMAT COLOR 1." INTENSIFIED.
SKIP.
ULINE AT 0(190) NO-GAP.
Outputting line level information **********************
WRITE:/ sy-vline NO-GAP,
(10) 'DOC NUMBER',
sy-vline NO-GAP,
(4) 'F-YR',
sy-vline NO-GAP,
(6) 'C-CODE',
sy-vline NO-GAP,
(10) 'CHECK NUM',
sy-vline NO-GAP,
(10) 'VENDOR NUM',
sy-vline NO-GAP,
(35) 'VENDOR NAME',
sy-vline NO-GAP,
(12) 'INVOICE DATE',
sy-vline NO-GAP,
(16) 'INVOICE NUMBER',
sy-vline NO-GAP,
(12) 'PAID DATE',
sy-vline NO-GAP,
(15) 'INVOICE AMOUNT',
sy-vline NO-GAP,
(2) 'SC',
sy-vline NO-GAP,
(16) 'REFERENCE FI DOC',
sy-vline NO-GAP,
(15) 'SORT FIELD',
sy-vline NO-GAP.
ULINE AT 0(190) NO-GAP.
ENDFORM. " write_header
*& FORM MOVE_DATA &*
*& Formats data in internal table as is required in the file &*
FORM move_data.
LOOP AT i_data1.
Document number and fiscal year should be separted by '|' *****
CONCATENATE i_data1-belnr i_data1-gjahr INTO fidoc_year
SEPARATED BY '|'.
MOVE i_data1-bukrs TO comp_code.
MOVE i_data1-chect TO check_numbr.
Vendor number and vendor name should be separted by '|' *****
CONCATENATE i_data1-lifnr i_data1-name1 INTO vendor
SEPARATED BY '|'.
SHIFT vendor LEFT DELETING LEADING '0'.
SHIFT vendor RIGHT DELETING TRAILING space.
Date fields converted to MM/DD/YYYY format ****************
MOVE i_data1-bldat+0(4) TO yy.
MOVE i_data1-bldat+4(2) TO mm.
MOVE i_data1-bldat+6(2) TO dd.
CONCATENATE mm dd yy INTO inv_date SEPARATED BY '/'.
MOVE i_data1-xblnr TO inv_nbr.
SHIFT inv_nbr RIGHT DELETING TRAILING space.
MOVE i_data1-augdt+0(4) TO yy.
MOVE i_data1-augdt+4(2) TO mm.
MOVE i_data1-augdt+6(2) TO dd.
CONCATENATE mm dd yy INTO paid_dat SEPARATED BY '/'.
MOVE i_data1-wrbtr TO inv_amt.
CONDENSE inv_amt.
SHIFT inv_amt RIGHT DELETING TRAILING space.
MOVE i_data1-status TO status.
MOVE i_data1-augbl TO ref_doc.
CONCATENATE fidoc_year
comp_code
check_numbr
vendor
inv_date
inv_nbr
paid_dat
inv_amt
status
ref_doc
INTO i_final_file-record SEPARATED BY '~'.
APPEND i_final_file.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form write_output &*
*& Outputs all data to screen &*
FORM write_output.
LOOP AT i_data1.
FORMAT COLOR 2 INTENSIFIED.
Outputting line level information *******************
WRITE : / sy-vline NO-GAP,
(10) i_data1-belnr,
sy-vline NO-GAP,
(4) i_data1-gjahr,
sy-vline NO-GAP,
(6) i_data1-bukrs,
sy-vline NO-GAP,
(10) i_data1-chect,
sy-vline NO-GAP,
(10) i_data1-lifnr,
sy-vline NO-GAP,
(35) i_data1-name1,
sy-vline NO-GAP,
(12) i_data1-bldat MM/DD/YYYY,
sy-vline NO-GAP,
(16) i_data1-xblnr,
sy-vline NO-GAP,
(12) i_data1-augdt MM/DD/YYYY,
sy-vline NO-GAP,
(15) i_data1-wrbtr,
sy-vline NO-GAP,
(2) i_data1-status,
sy-vline NO-GAP,
(16) i_data1-augbl,
sy-vline NO-GAP,
(15) i_data1-sortl,
sy-vline NO-GAP.
ENDLOOP.
ULINE AT 0(190) NO-GAP.
ENDFORM. " write_output
In the program, I am downloading only the list.. The description of report outputted in the beginning of the report is not downloaded to excel.
What has to be taken into consideration is that, the structure of the table i_data1 which contains the data to be downloaded to the table.
I hope that this will help you.
Regards,
Susmitha -
Excel download(List -- Export -- Spreadsheet) not working in GUI 710
Dear All,
My client is using SAP 4.7. Recently my client upgrade the SAP GUI from GUI 620 to GUI 710. Now we are unable to download any report output when we follow path '* List --> Export --> Spreadsheet*'.
When we click on List --> Export --> Spreadsheet, system give a pop up screen 'Filter criteria, sorting, totals and subtotals are not taken into account', after that nothing coming. Its returning back to the report output.
Your quick answer will be highly appriciated.
Thanks,
sp sahuHi,
you can download it from SAP Service Marketplace:
https://service.sap.com/swdc
Download
Support Packages and Patches
Support Packages and Patches - Entry by Application Group
SAP Frontend Components
SAP GUI FOR WINDOWS
SAP GUI FOR WINDOWS 7.10 CORE
Win32
Here you can choose the needed SAPGUI Patch.
I hope this helps.
Regards
Jozsef -
How to download the output of two reports in WebTemplate into excel sheet?
How to download the output of webtemplate which consists of two reports in one Web Template into same Excel sheet?
hi sunil,
here is the HTML code for 'export to excel'
<!-- Display Export Excel--->
<td class="SAPBEXNavLine"> <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 ></td>
you can also use BEx download scheduler to download the precalculated webtemplate report to excel sheet.
Check the link below.
https://websmp104.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000401962004E
i think this will help u
regards,
sindhu. -
How to download output into Excel with Header?
Dear Friends,
I want to download a my list output into excel format with <b>Column heading</b>. How will I do this?
Another question is i want name of database table in Which SAP stores <b>DDIC object name and its property</b>, so that i can write Select * from ' ' where .... For example i have table ZABC with three fields so i need In which table it stores ZABC as table and a table in which it stores Its field name.Hi,
Look at the sample code for Download into Excel.
data: begin of excel_sum_it occurs 0,
bukrs(80),
belnr(80),
gjahr(80),
blart(80),
budat like bkpf-budat,
monat(80),
cpudt like bkpf-cpudt,
cputm like bkpf-cputm,
usnam(80),
tcode(80),
xblnr(80),
waers(80),
dwrbtr(25),
cwrbtr(25),
end of excel_sum_it.
data: begin of titles_it occurs 10,
title(80),
end of titles_it.
at user-command.
case sy-ucomm.
when 'SUMMARY'.
perform summary_download.
when 'DETAIL'.
perform detail_download.
when others.
endcase.
******Create one PF-STATUS for one push button for download.
Before this FM you need to move your date to Execl_sum_it Internal table.
For example here I used this table for down load.
*& Form summary_download
text
--> p1 text
<-- p2 text
form summary_download.
data: fname like rlgrap-filename value 'Summary_Details.xls'.
perform fill_titles.
check not excel_sum_it[] is initial.
call function 'DOWNLOAD'
exporting
filename = fname
filetype = 'DAT'
tables
data_tab = excel_sum_it
fieldnames = titles_it
exceptions
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
others = 8.
if sy-subrc ne 0.
message e000 with text-e07.
endif.
endform. " summary_download
*& Form fill_titles
text
--> p1 text
<-- p2 text
form fill_titles.
refresh titles_it.
concatenate text-h06 text-h16 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h17 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h18 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h19 into titles_it-title
separated by space.
append titles_it.
concatenate text-h09 text-h20 into titles_it-title
separated by space.
append titles_it.
concatenate text-h08 text-h21 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h22 into titles_it-title
separated by space.
append titles_it.
concatenate text-h11 text-h23 into titles_it-title
separated by space.
append titles_it.
concatenate text-h12 text-h24 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h25 into titles_it-title
separated by space.
append titles_it.
concatenate text-h07 text-h26 into titles_it-title
separated by space.
append titles_it.
concatenate text-h13 text-h28 into titles_it-title
separated by space.
append titles_it.
concatenate text-h14 text-h27 into titles_it-title
separated by space.
append titles_it.
concatenate text-h15 text-h27 into titles_it-title
separated by space.
append titles_it.
endform. " fill_titles
***Here in the FILL_TITLES you give you own HEADER .
Thanks.
If this helps you reward with points. -
Facing problem while downloading ALV grid Output into Excel
Hi Guys,
I am facing problem while downloading ALV grid Output into Excel.
It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
Can someone help me regarding this
thanks for your helpHi,
Open up Excel on your desktop. Goto Tools > Macro > Security.
Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
Was this your problem? Don't forget those points, either.
check with this wetther it is solved or not.
Regards,
sana. -
How to export report output into excel.
Hi all
how to export report output into excel sheet can any on give me answer step by step please as soon as possible
kkHi Prashanth,
If you are executing Query from WAD ---> Right click on Table (only on Characteristics Data) --> Enhanced Menu ---> Export as --> CSV file or MS Excel
assign points if this helps,
Thanks,
Sudhakar -
Display report through List-export-spreadsheet
Hi,
I am outputting a report using REUSE_ALV_GRID_DISPLAY and my reports are outputting correctly. And also when I download directly through excel also my reports are coming out correctly. But the users wanted to download it through list-export-spreadsheet at that time, the fields like amount, quantity gets sorted into one group which I do not want.
Is there a way for me to ungroup this and make it display in the format that it gets displayed on ALV. Pls help
thank you very much.ok
Maybe you are looking for
-
I just got my macbook and aside from using my iPhone i have no experiance with mac products.. I just got it home and wanted to go online and as i typed in the password a message pops up and says "the wi-fi network "MIFI" requires a WPA2 password. i c
-
Problem with 2 tables nodes in MAIN window in smartforms...
Hello Experts, I have created 2 table nodes in my MAIN window to display data coming from different internal tables. Now, the problem is that whenever the 1st table node page breaks, the 2nd table node gets affected and it also page breaks. What I wa
-
[SOLVED] URxvt doesn't allow tabs to be opened as regular user
I recently had my file system become corrupted as was forced to restore 2 week old backup, after configuring the backup and booting into the system I fired up urxvt opened journalctl -f. When I tried to open a new tab I got this error: Jan 05 01:49:0
-
Agentry: Edit Property from List View when scanning
Hallo, i have a detail screen with a list view. The List View shows a collection with orders. The order properties are orderNumber, orderStatus and some other details. In the List View i create a single match action for the list view scanner. The pro
-
Timeline inside timeline: how to relink to original clips?
Hello. One of our editors has started huge project in FCP 7 from organizing every shoot day in separated timelines. Then he has started editing using these timelines like a source clips, so, finally we have "master edit" made using 10+ timelines, ins