SAP Query : Excel sheet download problem
Hi,
While executing a Z SAP query in SQ01 and data is displaying fine in the ALV format. But when we export the data to excel sheet, every column is appearing twice (repeating only the header, with empty items)
something like this......
Excel sheet...
Header MATNR MATNR MATKX MATKX LIFNR LIFNR KUNNR KUNNR
Item 10 Test ABC ABC
20 Test2 XYZ XYZ
30 Test3 MNO MNO
What can be possible cause of this ? What can be the corrective step to the issue?
Thanks,
Jai
Hi ,
Please follow the below step .
In SQ01 --> In the List Display screen --> click on Export --> Local file --> Spread Sheet --> Give the File name and click on generate .
It s working file . and i can be able to download all the records to excel without any repeatation .
Thanks
Pavendhan
Similar Messages
-
Excel sheet download problem from ALV
Hi all,
when i am trying to download an ALV report into localfile... Excel, two middle coloum values are not appeared in excel sheet but headings are available.
last three coloums values are overlapped in these headings.
Where might be the problem exist?Hi,
Reprots
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
http://www.sap-img.com/abap-function.htm -
Alv Grid to Excel Sheet Downloading problem for Bank account Number(CHAR18)
Hi every one,
I am downloading Alv grid to excel using local file---> spreadsheet
but, the bank account no is populating as like ''11+E213". When press F2 in that column then only its showing the correct value.
If i do download directly from ctrlshiftF7 , its down loading perfectly but my user Needs the Header of the ALV also, Buecause HEader Consists of Payment Date and all details.
I have checked the same from the Satandard table also its also populating in the same way as in the report,
So if any body have valueble suggestions, Please reply soon,
Thanks & Regards,
Raj SHi Lalit,
Thanks for Ur promt reply,
I ahve alraedy Changed the lenght to 25 but it doesnot effect,
But when i concatenate the same number with any one character in front of the A/C No. Its generating perfectly,
But i cant do so as its an account No.
Thanks,
Raj S -
hi experts,
i need to shedule a report in back ground which has to download a excel sheet
on my presentation server i know we cannot get it directly.
if we have done it to application layer how can we get it to presentation layer
can we code it in same report which is sheduled in backgrund r we need to do another code
plz help i got struct at this pointHi,
Just search for the "GUI_DOWNLOAD" in the forums and you will get lots of examples for this.
You will not have much difference from using the CG3Y of CG3Z transactions or writing the program as you will have to run the program in the <b>foreground</b> only to download the file.
I cannot give you the code now as I do not have access to SAP right now. -
Down load report output from SAP to Excel sheet
Hi,
Actually i am downloading report out into Excel sheet using FM GUI_LOAD. But in this case in Excel sheet we are getting the date format as *3/21/2008. But the requerment is the date format in Excel sheet should be display like 3/21/2008.So please advice me.
Code:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = w-filename
filetype = 'DBF'
col_select = 'X'
col_select_mask = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
wk1_n_format = 'X'
wk1_t_format = 'X'
DAT_MODE = 'X'
TABLES
data_tab = dtab_dat
fieldnames = htab.
Thanks in advance.
Regards,
Satya.Hi,
Please let me know the type of dtab_dat.
Regards
jana -
Is there any function module which can help me download data from an internal table into mutiple sheets on an excel workbook ?
My internal table contains more than 65536 records.Check it out !!
*& Report Y_EXCEL_MULTIPLE *
REPORT Y_EXCEL_MULTIPLE.
parameters: p_fname like RLGRAP-FILENAME
default 'C:\temp\testNN.xls'.
data: fname like p_fname,
kn like sy-repid.
data: cnt type i value 0.
data: sheetname(10) value 'TEST ',c_row type i,
scnt type i,
val(20), wb(2).
parameters: p_exvis as checkbox default 'X',
p_workbk(2) type p default '01',
p_wsheet(2) type p default '01'.
CONSTANTS: OK TYPE I VALUE 0.
INCLUDE OLE2INCL.
DATA: EXCEL TYPE OLE2_OBJECT,
WORKBOOK TYPE OLE2_OBJECT,
SHEET TYPE OLE2_OBJECT,
CELL TYPE OLE2_OBJECT,
CELL1 TYPE OLE2_OBJECT,
COLUMN TYPE OLE2_OBJECT,
RANGE TYPE OLE2_OBJECT,
BORDERS TYPE OLE2_OBJECT,
button TYPE OLE2_OBJECT,
int TYPE OLE2_OBJECT,
FONT TYPE OLE2_OBJECT,
ROW TYPE OLE2_OBJECT.
data: application type ole2_object,
book type ole2_object,
books type ole2_object.
data: ole_book TYPE ole2_object.
do p_workbk times.
move p_fname to fname.
unpack sy-index to wb.
replace 'NN' with wb into fname.
perform create_EXCEL.
create sheets and save
perform sheet.
perform save_book.
enddo.
write: ' Done'.
FORM create_excel *
form create_excel.
CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
if sy-subrc ne 0.
write: / 'No EXCEL creation possible'.
stop.
endif.
set property of EXCEL 'DisplayAlerts' = 0.
CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK .
Put Excel in background
if p_exvis eq 'X'.
SET PROPERTY OF EXCEL 'VISIBLE' = 1.
else.
SET PROPERTY OF EXCEL 'VISIBLE' = 0.
endif.
Create worksheet
set property of excel 'SheetsInNewWorkbook' = 1.
call method of workbook 'ADD'.
endform.
FORM save_book *
form save_book.
get property of excel 'ActiveSheet' = sheet.
free object sheet.
free object workbook.
GET PROPERTY OF EXCEL 'ActiveWorkbook' = WORKBOOK.
call method of workbook 'SAVEAS' exporting #1 = p_fname #2 = 1.
call method of workbook 'CLOSE'.
call method of excel 'QUIT'.
free object sheet.
free object workbook.
free object excel.
endform.
FORM sheet *
form sheet.
do p_wsheet times.
unpack sy-index to sheetname+5(2).
if sy-index gt 1.
CALL METHOD OF EXCEL 'WORKSHEETS' = sheet.
call method of sheet 'ADD'.
free object sheet.
endif.
scnt = sy-index.
call method of excel 'WORKSHEETS' = SHEET EXPORTING #1 = scnt.
call method of sheet 'ACTIVATE'.
SET PROPERTY OF SHEET 'NAME' = sheetname.
free object sheet. "OK
perform fill_sheet.
CALL METHOD OF EXCEL 'Columns' = COLUMN.
CALL METHOD OF COLUMN 'Autofit'.
free object COLUMN.
call method of sheet 'BUTTON' = button.
call method of button 'ADD'.
set property of button 'fmButtonStyle' = 0.
exporting #1 = '96.75' #2 = '372' #3 = '123.75' #4 = '12'.
set property of button 'Characters' = 'ButtonTest'.
free object button.
free object font.
free object int.
free object cell.
free object: cell1.
free object range.
free object borders.
free object: column, row.
enddo.
free object font.
free object int.
free object cell.
free object cell1.
free object range.
free object borders.
free object column.
free object row.
free object sheet.
endform.
FORM border *
--> we *
form border using we.
*left
call method of CELL 'BORDERS' = BORDERS exporting #1 = '1'.
set property of borders 'LineStyle' = '1'.
set property of borders 'WEIGHT' = we. "4=max
free object borders.
right
call method of CELL 'BORDERS' = BORDERS exporting #1 = '2'.
set property of borders 'LineStyle' = '2'.
set property of borders 'WEIGHT' = we.
free object borders.
top
call method of CELL 'BORDERS' = BORDERS exporting #1 = '3'.
set property of borders 'LineStyle' = '3'.
set property of borders 'WEIGHT' = we.
free object borders.
bottom
call method of CELL 'BORDERS' = BORDERS exporting #1 = '4'.
set property of borders 'LineStyle' = '4'.
set property of borders 'WEIGHT' = we.
set property of borders 'ColorIndex' = 'xlAutomatic'.
free object borders.
endform.
FORM border2 *
--> we *
form border2 using we.
*left
call method of CELL 'BORDERS' = BORDERS exporting #1 = '1'.
set property of borders 'LineStyle' = '5'.
set property of borders 'WEIGHT' = we. "4=max
free object borders.
right
call method of CELL 'BORDERS' = BORDERS exporting #1 = '2'.
set property of borders 'LineStyle' = '6'.
set property of borders 'WEIGHT' = we.
free object borders.
top
call method of CELL 'BORDERS' = BORDERS exporting #1 = '3'.
set property of borders 'LineStyle' = '7'.
set property of borders 'WEIGHT' = we.
free object borders.
bottom
call method of CELL 'BORDERS' = BORDERS exporting #1 = '4'.
set property of borders 'LineStyle' = '8'.
set property of borders 'WEIGHT' = we.
set property of borders 'ColorIndex' = 'xlAutomatic'.
free object borders.
endform.
FORM border3 *
--> we *
form border3 using we.
*left
call method of CELL 'BORDERS' = BORDERS exporting #1 = '1'.
set property of borders 'LineStyle' = '9'.
set property of borders 'WEIGHT' = we. "4=max
free object borders.
right
call method of CELL 'BORDERS' = BORDERS exporting #1 = '2'.
set property of borders 'LineStyle' = '10'.
set property of borders 'WEIGHT' = we.
free object borders.
top
call method of CELL 'BORDERS' = BORDERS exporting #1 = '3'.
set property of borders 'LineStyle' = '11'.
set property of borders 'WEIGHT' = we.
free object borders.
bottom
call method of CELL 'BORDERS' = BORDERS exporting #1 = '4'.
set property of borders 'LineStyle' = '12'.
set property of borders 'WEIGHT' = we.
set property of borders 'ColorIndex' = 'xlAutomatic'.
free object borders.
endform.
FORM fill_cell *
--> color *
--> pattern *
form fill_cell using color pattern.
call method of cell 'INTERIOR' = int.
set property of int 'ColorIndex' = color.
set property of int 'Pattern' = pattern.
free object int.
endform.
FORM font *
--> bold *
--> size *
form font using bold size.
call method of CELL 'FONT' = font.
set property of font 'BOLD' = bold.
set property of font 'SIZE' = size.
free object font.
endform.
FORM fill_sheet *
form fill_sheet.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'A1'.
perform font using 1 '14'.
SET PROPERTY OF CELL 'VALUE' = 'Counter'.
perform fill_cell using '15' '1'.
perform border using '2'.
free object cell.
val = 'Workbook-Count'.
move wb to val+16.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'B1'.
SET PROPERTY OF CELL 'VALUE' = val.
perform fill_cell using '14' '1'.
perform border using '4'.
free object cell.
val = 'Sheet-Count'.
unpack sy-index to val+12.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'C1'.
SET PROPERTY OF CELL 'VALUE' = val.
perform fill_cell using '12' '1'.
perform border using '4'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'E3'.
perform border using '1'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'E5'.
perform border using '2'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'E7'.
perform border using '3'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'E9'.
perform border using '4'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'F3'.
perform border2 using '1'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'F5'.
perform border2 using '2'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'F7'.
perform border2 using '3'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'F9'.
perform border2 using '4'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'G3'.
perform border3 using '1'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'G5'.
perform border3 using '2'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'G7'.
perform border3 using '3'.
free object cell.
CALL METHOD OF EXCEL 'RANGE' = CELL EXPORTING #1 = 'G9'.
perform border3 using '4'.
free object cell.
val = 'ROW-Count'.
do 19 times.
c_row = sy-index + 1.
unpack c_row to val+12(4).
CALL METHOD OF excel 'CELLS' = CELL1 EXPORTING #1 = c_row #2 = 2.
SET PROPERTY OF CELL1 'VALUE' = val.
free object cell1.
CALL METHOD OF excel 'CELLS' = CELL1 EXPORTING #1 = c_row #2 = 4.
SET PROPERTY OF CELL1 'VALUE' = val.
free object cell1.
enddo.
endform.
You find SAP OLE programs under development Class 'SOLE' *
MSTAPPL Table Maintenance APPL *
RSOLEDOC Document list *
RSOLEIN0 OLE Load Type Information *
RSOLEINT Type Info Loaded *
RSOLETI0 OLE Object Browser *
RSOLETI1 OLE Object Browser *
RSOLETI2 OLE Object Browser *
RSOLETI3 F4 Help For OLE Objects *
RSOLETT1 OLE 2.0 Automation Demo Program *
Transactions: *
SOLE *
SOLO - List of OLE applcations with loaded type info *
You will find the decription of possible objects and methods in the *
windows help file for excel. *
Hope thisll give you idea!!
<b>P.S award the points.!!! !!!</b>
Good luck
Thanks
Saquib Khan
"Some are wise and some are otherwise" -
SAP Query Manager Parameter selection problem
Experts,
Declare @Fromdate datetime
Declare @ToDate datetime
set @Fromdate =(select MIN(T0.docdate) from OPCH T0 where T0.DocDate >='[%0]')
set @Todate =(select Max(T0.docdate) from OPCH T0 where T0.DocDate <='[%1]')
select
ROW_NUMBER() OVER (ORDER BY T0.DocNum) '#',
T0.DocNum 'AP Invoice Document Number',
T0.DocDate 'AP Invoice Posting Date',
T0.NumAtCard 'Vendor Ref No',
T0.CardName 'Vendor Name',
T1.ItemCode 'Item Code',
T1.Dscription 'Item Description',
T1.Quantity 'Quantity',
T1.LineTotal 'Gross Total',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '4') ), 0) 'VAT 4',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '5') ), 0) 'VAT 5',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '12.5') ), 0) 'VAT 12.5',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '14') ), 0) 'VAT 14',
T0.DocTotal 'Grand Total'
from OPCH T0 inner join PCH1 T1 on T0.DocEntry = T1.DocEntry
where T0.DocDate >= @Fromdate
and T0.DocDate <= @ToDate
This gives error againHi,
Try this one:
Declare @Fromdate datetime
Declare @ToDate datetime
set @Fromdate =(select MIN(T0.docdate) from OPCH T0 where T0.DocDate >='[%0]')
set @Todate =(select Max(T0.docdate) from OPCH T0 where T0.DocDate <='[%1]')
Select * FROM ( select ROW_NUMBER() OVER (ORDER BY T0.DocNum) '#',
T0.DocNum 'AP Invoice Document Number',
T0.DocDate 'AP Invoice Posting Date',
T0.NumAtCard 'Vendor Ref No',
T0.CardName 'Vendor Name',
T1.ItemCode 'Item Code',
T1.Dscription 'Item Description',
T1.Quantity 'Quantity',
T1.LineTotal 'Gross Total',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '4') ), 0) 'VAT 4',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '5') ), 0) 'VAT 5',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '12.5') ), 0) 'VAT 12.5',
ISNULL ((Select MAX(T2.TaxSum) from PCH4 T2 where (T2.DocEntry = T1.DocEntry and T2.LineNum = T1.LineNum and T2.staType = '1' and T2.TaxRate = '14') ), 0) 'VAT 14',
T0.DocTotal 'Grand Total'
from OPCH T0 inner join PCH1 T1 on T0.DocEntry = T1.DocEntry
where T0.DocDate BETWEEN @FromDate AND @ToDate ) as result
Thanks.
CLint -
Download date into excel sheet without changing the properties of column
Hi All,
I am trying to download a date field from SAP to Excel sheet. But the date is getting downloaded successfully, but the format of the column is getting changed to DATE. Is there any way to restrict it?
I am using GUI_DOWNLOAD for downloading the data.
I have declared the date field as CHAR10 Eg (09/13/2011) and moving the data into excel.
Result i need : data should be downlaoded as 09/13/2011 but format of the cell should not be changed.
Regards
Eswar.Hi Eswar,
Change the date format type dats instead of char format or any standards like erdat from vbak.Then you can in proper format.
Regards,
Madhu. -
Hello all,
I am transferring the ALV output from SAP to Excel sheet using the standard button i.e. To Local FIle.... but i am not getting the text of the last column in the excel sheet. the last column is being displayed empty where as its heading is being displayed....
Regards.
Sabah...Go through the code and Execute it on your system, I think this will do for you.
In this code I used 3 radio buttons in my selection screen:
If u selects the first radio button your out put shows into to the Excel sheet.
If u selects the second radio button your out put shows the in the Editor screen.
If u clicks the third radio button your output shows into the Excel as well as in the Editor.
*& DATA DECLARATION *
TABLES: MARA, "GENERAL MASTER DATA
MARC, "PLANT DATA FOR MATERIAL
MARD, "STORAGE LOCATION DATA FOR MATERIAL
MBEW, "MATERIAL VALUATION
MVKE, "SALES DATA FOR MATERIAL
MAKT, "MATERIAL DESCRIPTION
EKKO, "PURCHASING DOCUMENT HEADER
EKPO, "PURCHASING DOCUMENT ITEM
VBAK, "SALES DOCUMENT HEADER DATA
VBAP. "SALES DOCUMENT ITEM DATA
TYPE-POOLS : SLIS.
DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
V_LAYOUT TYPE SLIS_LAYOUT_ALV,
BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR, "MATERIAL NUMBER
MBRSH LIKE MARA-MBRSH, "INDUSTRY SECTOR
MEINS LIKE MARA-MEINS, "BASE UNIT OF MEASURE
MATKL LIKE MARA-MATKL, "MATERIAL GROUP
END OF I_MARA,
BEGIN OF I_MARC OCCURS 0,
MATNR LIKE MARC-MATNR, "MATERIAL NUMBER
WERKS LIKE MARC-WERKS, "PLANT
LVORM LIKE MARC-LVORM, "FLAG MATERIAL FOR DELETION AT PLANT
"LEVEL
DISPO LIKE MARC-DISPO, "MRP CONTROLLER
END OF I_MARC,
BEGIN OF I_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR, "MATERIAL NUMBER
MAKTX LIKE MAKT-MAKTX, "MATERIAL DESCRIPTION
SPRAS LIKE MAKT-SPRAS, "LANGUAGE KEY
END OF I_MAKT,
BEGIN OF I_MVKE OCCURS 0,
MATNR LIKE MVKE-MATNR, "MATERIAL NUMBER
VKORG LIKE MVKE-VKORG, "SALES ORGANIZATION
VTWEG LIKE MVKE-VTWEG, "DISTRIBUTION CHANNEL
END OF I_MVKE,
BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR, "MATERIAL NUMBER
LGORT LIKE MARD-LGORT, "STORAGE LOCATION
LABST LIKE MARD-LABST, "VALUATED STOCK WITH UNRESTRICTED USE
END OF I_MARD,
BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN, "PURCHASING DOCUMENT NUMBER
EBELP LIKE EKPO-EBELP, "ITEM NUMBER OF PURCHASING DOCUMENT
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
END OF I_EKPO,
BEGIN OF I_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF I_VBAP,
BEGIN OF I_OUT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
DISPO LIKE MARC-DISPO,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF I_OUT,
BEGIN OF I_HEADING OCCURS 0,
TEXT1(20),
TEXT2(20),
TEXT3(20),
TEXT4(20),
TEXT5(20),
TEXT6(20),
TEXT7(20),
TEXT8(20),
TEXT9(20),
TEXT10(20),
TEXT11(40),
TEXT12(20),
TEXT13(20),
TEXT14(20),
TEXT15(20),
TEXT16(20),
TEXT17(20),
END OF I_HEADING.
*& S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
S_DISPO FOR MARC-DISPO,
S_EBELN FOR EKPO-EBELN .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
PARAMETERS : RB1 RADIOBUTTON GROUP G1,
RB2 RADIOBUTTON GROUP G1,
RB3 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
*& S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
SELECT MATNR WERKS LVORM DISPO FROM MARC
INTO CORRESPONDING FIELDS OF TABLE I_MARC
WHERE MATNR IN S_MATNR
AND DISPO IN S_DISPO
AND WERKS = P_WERKS.
IF I_MARC[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
EXIT.
ENDIF.
PERFORM PURCHASEDATA_VALIDATION.
PERFORM SALESDATA_VALIDATION.
SELECT MATNR LGORT LABST FROM MARD INTO TABLE I_MARD
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND WERKS EQ P_WERKS
AND LGORT IN S_LGORT.
IF I_MARD[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
EXIT.
ENDIF.
SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
IF I_MVKE[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
EXIT.
ENDIF.
LOOP AT I_MARC.
MOVE-CORRESPONDING I_MARC TO I_OUT.
CLEAR MARC.
SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
INTO CORRESPONDING FIELDS OF MARA
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MARA-MBRSH TO I_OUT-MBRSH,
MARA-MEINS TO I_OUT-MEINS,
MARA-MATKL TO I_OUT-MATKL.
ELSE.
CONTINUE.
ENDIF.
SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
INTO CORRESPONDING FIELDS OF MAKT
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
MAKT-SPRAS TO I_OUT-SPRAS.
ELSE.
CONTINUE.
ENDIF.
LOOP AT I_EKPO WHERE MATNR = I_MARC-MATNR.
MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
I_EKPO-EBELP TO I_OUT-EBELP.
ENDLOOP.
LOOP AT I_VBAP WHERE MATNR = I_MARC-MATNR.
MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
I_VBAP-POSNR TO I_OUT-POSNR.
ENDLOOP.
LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
MOVE: I_MARD-LABST TO I_OUT-LABST,
I_MARD-LGORT TO I_OUT-LGORT.
ENDLOOP.
LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
I_MVKE-VTWEG TO I_OUT-VTWEG.
APPEND I_OUT.
ENDLOOP.
CLEAR I_OUT.
ENDLOOP.
PERFORM OPTIONS.
FORM OPTIONS *
FORM OPTIONS.
IF RB2 = 'X'.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ELSE.
IF RB1 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
ELSE.
IF RB3 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "OPTIONS
FORM HEADINGS *
FORM HEADINGS.
I_HEADING-TEXT1 = 'MATNR'.
I_HEADING-TEXT2 = 'WERKS'.
I_HEADING-TEXT3 = 'LVORM'.
I_HEADING-TEXT4 = 'DISPO'.
I_HEADING-TEXT5 = 'MBRSH'.
I_HEADING-TEXT6 = 'MEINS'.
I_HEADING-TEXT7 = 'MATKL'.
I_HEADING-TEXT8 = 'VKORG'.
I_HEADING-TEXT9 = 'VTWEG'.
I_HEADING-TEXT10 = 'SPRAS'.
I_HEADING-TEXT11 = 'MAKTX'.
I_HEADING-TEXT12 = 'LGORT'.
I_HEADING-TEXT13 = 'LABST'.
I_HEADING-TEXT14 = 'EBELN'.
I_HEADING-TEXT15 = 'EBELP'.
I_HEADING-TEXT16 = 'VBELN'.
I_HEADING-TEXT17 = 'POSNR'.
APPEND I_HEADING.
ENDFORM. "HEADINGS
FORM DLOAD *
FORM DLOAD.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_HEADING
EXCEPTIONS
FILE_WRITE_ERROR = 1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_OUT.
ENDFORM. "DLOAD
FORM FIELDCAT *
FORM FIELDCAT.
V_FIELDCAT-COL_POS = '1'.
V_FIELDCAT-FIELDNAME = 'MATNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '2'.
V_FIELDCAT-FIELDNAME = 'WERKS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '3'.
V_FIELDCAT-FIELDNAME = 'LVORM'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '4'.
V_FIELDCAT-FIELDNAME = 'DISPO'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '5'.
V_FIELDCAT-FIELDNAME = 'MBRSH'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '6'.
V_FIELDCAT-FIELDNAME = 'MEINS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '7'.
V_FIELDCAT-FIELDNAME = 'MATKL'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '8'.
V_FIELDCAT-FIELDNAME = 'VKORG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '9'.
V_FIELDCAT-FIELDNAME = 'VTWEG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '10'.
V_FIELDCAT-FIELDNAME = 'SPRAS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '11'.
V_FIELDCAT-FIELDNAME = 'MAKTX'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '12'.
V_FIELDCAT-FIELDNAME = 'LGORT'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
V_FIELDCAT-OUTPUTLEN = 10.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '13'.
V_FIELDCAT-FIELDNAME = 'LABST'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-SELTEXT_M = 'STOCK'.
V_FIELDCAT-OUTPUTLEN = 15.
V_FIELDCAT-REF_FIELDNAME = 'LABST'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-DO_SUM = 'X'.
V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
V_FIELDCAT-HOTSPOT = 'X'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '14'.
V_FIELDCAT-FIELDNAME = 'EBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '15'.
V_FIELDCAT-FIELDNAME = 'EBELP'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '16'.
V_FIELDCAT-FIELDNAME = 'VBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '17'.
V_FIELDCAT-FIELDNAME = 'POSNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
ENDFORM. "FIELDCAT
FORM OUTPUT *
FORM OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = VT_FIELDCAT1
TABLES
T_OUTTAB = I_OUT.
IF SY-SUBRC 0.
ENDIF.
ENDFORM. "OUTPUT
FORM TOP-OF-PAGE *
FORM TOP-OF-PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'REPORT FOR : '.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'MATERIAL DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'SALES ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'GEAR'
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "TOP-OF-PAGE
*& FORM PURCHASEDATA_VALIDATION *
FORM PURCHASEDATA_VALIDATION.
SELECT EBELN EBELP MATNR
FROM EKPO
INTO TABLE I_EKPO
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND EBELN IN S_EBELN
AND WERKS EQ P_WERKS.
IF I_EKPO[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
EXIT.
ENDIF.
DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
T_EKPO] = I_EKPO[.
REFRESH I_EKPO.
FREE I_EKPO.
LOOP AT T_EKPO.
SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
WHERE EBELN = T_EKPO-EBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_EKPO TO I_EKPO.
APPEND I_EKPO.
CLEAR I_EKPO.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_EKPO.
ENDFORM. "PURCHASEDATA_VALIDATION
*& FORM SALESDATA_VALIDATION *
FORM SALESDATA_VALIDATION.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE
I_VBAP FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
T_VBAP] = I_VBAP[.
REFRESH I_VBAP.
FREE I_VBAP.
LOOP AT T_VBAP.
SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
WHERE VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_VBAP TO I_VBAP.
APPEND I_VBAP.
CLEAR I_VBAP.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_VBAP.
ENDFORM. "SALESDATA_VALIDATION -
Need leading Zeros in the excel sheet which is sent from ABAP
Hi ,
I am downloading data from SAP to excel sheet using the WS_DOWNLOAD Function Module. The numeric data in not having leading zeros. if it is 0010 it is displaying 10 in the excel sheet . i need the leading zeros in the excel sheet. without manulally changing it to Text in the excel sheet .
Is there any way to do it .
Thanks,
ChetanHi Chetan,
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = w_file_path
filetype = 'DBF' "declare the File type as DBF then leading zeros will appear
write_field_separator = 'X'
confirm_overwrite = 'X'
TABLES
data_tab = Itab.
Regards,
Prabhudas -
ColdFusion Search with Excel Sheet creation
I created a form search with two buttons - one for results on the web page and one to create an excel sheet.
Problem: When a user conducts a search with results on the web page - the user would have to select the criteria again then click the create excel button to create the sheet.
How can I work it, so the user after conducting a search can just click one button to create the excel sheet?
(Using "Post" for the form - will change to get if needed will your help)I'm still freshman with CF - this means I have a lot of questions.
When I tried using the excel.cfm page I receive: Variable MRESULTS is undefined.
How do I send "mresults" to the excel page?
Search Page Link:
<a href="javascript:document.
getElementById('yourForm').submit()">Excel</a>
<form id="yourForm" action="excel.cfm" method="post">
<!--- save search values sent via POST --->
<cfoutput>
<input name="ship" value="#mresults.ship#">
</cfoutput>
</form>
Excel page:
<cfquery name="MResults"
datasource="support">
select *
from table1
<cfform action="/msr/excel.cfm" method="post">
<cfset sObj=SpreadsheetNew()>
<!--- Create header row --->
<cfset SpreadsheetAddRow(sObj, "Name,address")>
<cfset SpreadsheetFormatRow(sObj, {bold=TRUE,fgcolor="grey_25_percent", alignment="center"}, 1)>
<cfset SpreadsheetFormatColumn(sObj, {alignment="left", dataformat="mm/dd/yyyy"}, 14)>
<cfset SpreadsheetAddRows(sObj, MResults)>
<cfspreadsheet action="write" name="sObj" filename="C:Orders.xls" overwrite="true">
<cfheader name="Content-Disposition"
value="inline; filename=Orders.xls">
<cfcontent type="application/csv"
file="C:\Orders.xls"
deletefile="yes">
</cfform>
</cfquery> -
Reading Archived Data Through SAP Query Report
Dear SAP Gurus,
My client archived their SAP data in a particular year range and all the Z reports have to modified to read these archive data. Normal ABAP reports can be modified to read the archive data without no problem.
But there are two Z SAP query reports which should be modified the same way so it will be able to read archive data.
What is the best method for this? Does SAP Query tool provide facility to read archive data? or do I have to append the code?
Thank you in advance for your help
Regards,
Isuru Fernando>
Isuru U Fernando wrote:
> hi Manthan,
>
> Yes I used these FMs and read the data without any problem for normal ABAP reports.
>
> But SAP query report is the problem. Is it advisobale to modify the SAP query generated report source code? since it is a system generated report.
>
> Regards,
> Isuru
No, do not adapt the SAP generated report source. The reason is: every time someone re-generates the query from tx. SQ01 your changes will be lost.
You could add the functionality Manathan gave you to add to the infoset of said query - but to be honest: in my opinion that is shooting nuclear rockets at flies. Also you run the risk that every change of the infoset (add a join/delete a join) requires adjustment of said coding you applied ... and where will you be then? Fancy repairing the same query over and over again? Try talk sense to your client - go for a Z-report here ... -
Error 'Unable to open file' when downloading SAP Query to Excel
Hi all
I'm running a SAP Query which is set to download straight to a spreadsheet (Pivot Table / Microsoft Excel). Intermittently it does not work - apparently at random (at least, I've can't recreate the error at will).
It does one of the following:
- Works ok, and creates the pivot table
- Gives an Excel error message 'Unable to open file', then returns to the 'save the data in a spreadsheet' popup when enter is pressed on the error.
- Does not issue error message, just goes to the 'save the data in a spreadsheet' popup.
In the last two cases, the excel pivot table sheet is not created.
Has anyone seen anything similar, or have any idea as to what is causing the problem?
Any help gratefully received!
Not urgent as I've found a way round - further testing seems to show that I don't get the error is Excel is already open - but in the past I've run many SAP query downloads without needing to open Excel first. I suppose it's possible that this is just something to do with the Excel setup at the user site
Message was edited by:
E GregoryHi,
Ensure that file name with same name and in same path should not be open while saving the data.
Award if it helps.
Jogdand M B -
SAP Query output download to Excel
Hi All,
Once I export/download Query Output to Excel the fields are not in the order of Actul Query output
<u><i><b>Char fields are treated as Key fields and displayed Left side.</b></i></u>
As it is a SAP Query where to keep this kind of setting(key columns = 0).?
Thanks in advance and useful answer will be awarded.
cheers!!
Komatsuwhen u download data to excel sheet, u can't handle the data from SAP....The data in excel takes excel properties and accordingly data gets adjusted to the formats of excel.
If u need formatting u need to use OLE concepts in SAP from which u can set the formats of Excel Sheet. -
SAP Query output download to excel fields order is different
Hi All,
while download Query Output to Excel the fields are not in the order of actual Query output
Char fields are treated as Key fields and displayed Left side.
As it is a SAP Query where to keep this kind of setting(key columns = 0).?
Thanks
Komatsuwhen u download data to excel sheet, u can't handle the data from SAP....The data in excel takes excel properties and accordingly data gets adjusted to the formats of excel.
If u need formatting u need to use OLE concepts in SAP from which u can set the formats of Excel Sheet.
Maybe you are looking for
-
Itunes 9.0.2.25 Crashes any time my Shuffle is plugged in
Hi I just purchased a new shuffle and Itunes works great as long as I do not plug in my Shuffle I have already tried the standard stuff I've uninstalled and reinstall Itunes multiples times I've run the Itune's diagnostics and my shuffle will not det
-
1440x900 resolution missing in Bootcamp (MBPr+Retina)
I just installed Windows 8 RP on my new MacBook Pro with Retina display and realized that the 1440x900 resolution option is completely missing from Windows (and games). I've tried installed NVIDIA's latest 650M beta drivers (304.79), but they refuse
-
Outgoing mail blocked by spamhaus
I am using zen.spamhaus for spam protection and it seems to work great. One problem though... it also check outgoing messages. This is good in that it prevent unauthorized mail from going out, but it is also blocking some of my users, even though the
-
Hi, We recently purchased a few more 1131 APs for a remote office. For some reason, only one came as LWAPP AP, and the rests are all Autonomous APs. I have successfully upgraded one Auto AP into LWAPP, it is under control of that office's WLC. The im
-
Add the new item through the Bapi 'bapi_outb_delivery_change'
I want to add the new item to the existing outbound delivery.How to add the new item in the bapi 'bapi_outb_delivery_change'. Please provide me the code for the bapi 'BAPI_OUTB_DELIVERY_CHANGE' to add the new item.