Download to Excel 2000 Functionality
Hi,
I use the "Download to Excel 2000" functionality in OBIEE.
When i see the output in Excel,columns B and C of excel get merged and display the second column in my report
The point here is the first column in the report also has the same property and type as Column 1.but it is displayed properly in Cell A in the excel
Is this an known OBIEE issue?
Can anybody please help in this regard??
Thanks in advance
I think you got it correctly.
I doubt this is Analytics problem - I think it's more of international codepages.
Even if you open the same spreadsheet in a different localized Excel version, you'll see similar results. And then if you save it and open it in original version, it'll be messed up.
Globalization :-)
Similar Messages
-
OBIEE 11G report download with excel 2000 is not working properly
Hi all,
The Analytics report download is not working properly in excel 2000.
This version is no longer supported?
Is any way to workaround this problem?
Cheers
Carlos PereiraHi,
which version r u using? until obiee11.1.1.5 its bug but solve it by workaround method . also the bug fixed in obiee.11.1.1.6
11700314 REPORT NOT EXPORTED FULLY INTO EXCEL WHEN DOWNLOADING FROM PAGES OTHER THAN 1
1) stop it all u r bi serivices then take a back of u original instanconfig.xml file then do the below changes
D:\Oracle\Middleware\instances\instance1\config\OracleBIPresentationServicesComponent\coreapplication_obips1
instanceconfig.xml
just add below content then
<Views>
<Pivot>
<MaxCells>6500000</MaxCells>
<MaxVisibleColumns>100</MaxVisibleColumns>
<MaxVisiblePages>1000</MaxVisiblePages>
<MaxVisibleRows>65000</MaxVisibleRows>
<MaxVisibleSections>25</MaxVisibleSections>
<DefaultRowsDisplayed>500</DefaultRowsDisplayed>
<!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
<!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>64000</DefaultRowsDisplayedInDownload>
<!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DisableAutoPreview>false</DisableAutoPreview>
</Pivot>
<Table>
<MaxCells>6500000</MaxCells>
<MaxVisiblePages>1000</MaxVisiblePages>
<MaxVisibleRows>65000</MaxVisibleRows>
<MaxVisibleSections>25</MaxVisibleSections>
<DefaultRowsDisplayed>500</DefaultRowsDisplayed>
<!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
<!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>64000</DefaultRowsDisplayedInDownload>
</Table>
</Views>
Restart all u r bi services..
then test it out.
Thanks
Deva -
Download to excel issue.
Hi All,
When I download a report to excel, one of my percent field with one decimal place, is increased to two decimal places in excel.
does anyone of a work around or a fix to this issue?
ThanksChecking the Oracle bug database there are the following bugs/enhancements logged that sounds relevant and some workarounds we can try:
Bug 865450 DOWNLOAD TO EXCEL ALWAYS OPENS AS HTML FILE
Bug 5592823 EXCEL DOWNLOAD TREATED AS HTML FILE BY MOZILLA FIREFOX 1.5
Enh 6906146 DOWNLOAD TO EXCEL 2000 OUTPUT SHOULD BE EXCEL FORMAT NOT HTML
Workarounds:
(1) If your server is Tomcat
(From bug log...)
The real issue is IE fails to to detect the file type correctly in some cases
in absence of proper MIME headers from the Tomcat servers especially on
Linux.
The fix is to
Add a mime-mapping in tomcat/conf/web.xml. Under the section
Default MIME Type Mappings
Restart tomcat and delete temporary internet files from IE
<mime-mapping>
<extension>xls</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
(2) Switch browser to Firefox instead of IE. This sounds drastic but reading the bug logs it appears that Firefox will ask you what to use to open the file the first time it is used via Download to Excel - and at this point you can choose Excel and ask it to remember that decision.
Let me know if any of this useful. If not I'll drill further and see if I can dig up a better workaround. -
Hi all,
I am calling an ABAP program in an iView in the portal. The program has an function to download to Excel using function module XXL_SIMPLE_API. In the portal this results in a 'CNTL_ERROR' exception in program CL_GUI_FRONTEND_SERVICES. I have tried several function modules (SAP_CONVERT_TO_XLS_FORMAT, WS_EXCEL) but none of these can be used from the portal.
Is there any function module or class that I can use to download data to excel from the portal??
Thanks!
PatrickI'm not specialist in that area but not surprised that it doesn't work, as these functions use OLE, and this is forbidden via internet navigator (security reasons I guess).
Either download a simple CSV file (download any internal table using CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD method),
or if you really want to make special things, look at ActiveX and ACF sap notes, and also demo web dynpro ios_test_helloworld_ms (office integration), but I don't have more info. -
Any workaround for using Excel 2000 in 2004s ???
Greetings.
1. We have Excel 2000 and Windows 2000 standardized in the company and not upgrading to the Windows XP/Vista in the immediate future.
2. Since the new 2004s BI tools do not support downloading to Excel 2000, we are looking for other options such as continue using 3.5 query designer. But from the 3.5 Query designer "Display Query on the web", Publish to Portal or Bex Broadcaster links not working or erroring out.
Greatly appreciate your tips and suggestions for this scenario.
Thanks.
PKHello PK,
Do not try to find a workaround to use excel 2000 with NW 2004s. This may not be useful as Excel 2000 is not supported by SAP for NW 2004s.
But you should be able continue using BW 3.5 tools. Please post the errors that you are getting so that members can help you.
Regards,
Sheik Bilal -
Download to Excel Function in ALV
Hai Friends,
I am using the following methods to download the report to an Excel Sheet from ALV.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
CALL FUNCTION 'GUI_DOWNLOAD'
The report is downloaded to Excel but the Column names are not displayed. It is displaying as F1, F2, F3..................
How can i solve this?.Hi,
Please check with the sample code below:
*"Excel sheet header
CLEAR e_excel.
MOVE text-001 TO e_excel-var1.
MOVE text-002 TO e_excel-var2.
APPEND e_excel TO t_excel.
CLEAR e_excel.
UNASSIGN <fs_t_final>.
REFRESH t_excel.
LOOP AT t_final
ASSIGNING <fs_t_final>.
CHECK <fs_t_final> IS ASSIGNED.
*"Data continued after the header part
MOVE <fs_t_final>-var1 TO e_excel-var1.
MOVE <fs_t_final>-var2 TO e_excel-var2.
APPEND e_excel TO t_excel.
CLEAR e_excel.
data: w_savetitle TYPE string,
w_filname TYPE string,
w_filename TYPE string,
w_path TYPE string,
w_fpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = w_savetitle
CHANGING
filename = w_filname
path = w_path
fullpath = w_fpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = w_filename
filetype = ASC
write_field_separator =
codepage =
TABLES
data_tab = t_excel
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. -
Download to Excel" function cuts off leading zeros in string
When a text column contains leading zeros for example "000250" the download to Excel stores the string as "250" in the spreadsheet
I am unable to find a log about this
thanks Muthanna1) Click on the fx button of the column in question. Enter this:
'<span style="display:none"> </span>' || columnname Between the double quotes, type display:none
2) Click on the Data Format tab and change the type to HTML.
Edited by: David_T on Sep 14, 2010 8:25 AM
(Edited to make the instructions clearer.)
Edited by: David_T on Sep 14, 2010 9:54 AM -
Cuts off leading zeros in a report column when "Download to Excel" function
Hello
When a text column contains leading zeros for example "000250" the download to Excel stores the string as "250" in the spreadsheet. I am using a column which is a string.(varchar)
Can somebody suggest me , how to go ahead with it
Thanks
Edited by: user647228 on Sep 11, 2008 1:40 PM
Edited by: user647228 on Sep 11, 2008 1:42 PM(To Vins) Actually, concatenating a space doesn't do it. When the file is downloaded into Excel, the leading space is ignored and it the leading zeroes are still trimmed.
To user647228: A non-space character needs to be concatenated. Regarding what character to append, I would give the following consideration: If the users are content with seeing an added character to the "number," you can append say an underscore "_" and Excel will download the number properly. It's fairly unobtrusive and can be "visually ignored."
If the end user insists on gettin rid of the extra character once the file is downloaded, I would append a character that is rarely, if not never, used in the report. (This ensures or mitigates replacing other instances of the character.) Then you can do a Replace All in Excel to replace the extra character with a single apostrophe. The single apostrophe will be interpreted by Excel to mean "text" and the appearance will change to exactly what is desired.
Note: Replacing the extraneous character with a space for example, will result in the leading zeroes being again lopped off by Excel... -
Hi.
I am trying to use ALV functionality in Web Dynpro ABAP. When downloading to excel I only see the xml data. Is it possible to use the ALV functionality with Microsoft Excel 2000? If not, is there anyway to use the framework by doing some modifications?
Thanks!
/ElvezHi Thomas,
thanks for the reply. OSS note 1064756 is already in the system. When I look at the code, via the debugger, it seems to follow the path for Excel 2000/97. In other words, SAP supports Excel 2000. Nevertheless, when I open the excelsheet it displays the xml data:
MIME-Version: 1.0
X-Document-Type: Worksheet
Content-Type: multipart/related; boundary="----=_NextPart_123"
------=_NextPart_123
Content-Location: file:///C:/xyzhtm
Content-Transfer-Encoding: text/html
Content-Type: text/html; charset="utf-8"
<html xmlns="http://www.w3.org/TR/REC-html40" xmlns:alv="http://www.sap.com/ALV/2.5" ...>
I tried to remove the part before the <html>-tag and then everything worked fine. Do you know if there is a way to remove the initial information before and after the <html>-tags?
Thanks!
/Elvez -
Problem for Report Generation Toolkit for excel 2000
Hi all,
Now I am Developing my program with Report Generation Toolkit 1.1.0 and Labview 7.1.
In my computer I am using Excel XP, and there is not any problem. But when I build to
a exe file, and use in a computer with Excel 2000, it didn't work.
And I try to check the source file in this computer, I found that there any some connection
error. And this is caused by the active X class. As I know Excel 2000 is using Microsoft Excel
Object Library 9.0, but i cannot find it in the list of active x. So it is using Microsoft Excel Object
Library with a very old verison. So in the property node there are missing functions, such as the
UsedRange in _Worksheet in the Excel_Get_Range.vi. However, In VBA, I can find the 9.0 Library.
Is it the problem of 9.0 library? How can I solve the problem? How can I upgrade the library to 10.0?
Thanks.
Regard,
RyanHi Mike,
Since my program is for all the staff in office, everyone may use it.
I cannot call the whole office to upgrade the excel to XP.
And I think Report Generation Toolkit is alway support Excel 2000,
since the old version of it is not support for Excel XP.
Regard,
Ryan -
Warning while downloading an Excel file from WD ABAP
Hi folks,
In one of requirements, Client wants to download all the data that is appearing on the screen ( WD ABAP Application ) to an Excel with a layout in different manner.
We achieved this with Simple Transformations.
Now the question is while downloading the excel file, the framework/other is throwing an Warning like
" The file you are trying to open, 'info.xls', is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? "
Note: All the users of my client are using MS Office 2002 / 2003.
I am using the following code........!
*------ Call Transformation for Excel OUTPUT
CALL TRANSFORMATION ZEXCEL_OUTPUT
SOURCE
t_dates = t_dates
t_info = t_info
RESULT XML l_xml_string.
REPLACE ALL OCCURRENCES OF '<?xml version="1.0" encoding="utf-16"?>' l_xml_string WITH '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'.
**-- Call Function Module for converting string data to XSTRING
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_xml_string
mimetype = 'application/xml'
IMPORTING
buffer = l_xml_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'info.xml'
i_content = l_xml_xstring
i_mime_type = 'application/vnd.ms-excel'.
With this code I am generating a file of type XML SPREADSHEET 2003. While opening this file I am getting the above message which the user unwanted......
Can any one help me on this -
> How to avoid this warning?
Thanks and Regards,
Aneel Danda
Edited by: danda aneel on Jul 13, 2010 1:43 PMFirstly, Thanks for Your quick Response, Thomas.
Even though what ever may be the file name I am passing either info.xml or Info.xls , In error info.xls is coming.
Kindly provide me an alternative on this XML doesn't seem like it would match the 'application/vnd.ms-excel'.
what is the supported format.?
Similarly, It is not considering the UTF-8 / UTF-16 for xml.........same result is appearing in the output.
Edited by: danda aneel on Jul 14, 2010 7:52 AM -
Help needed: Download to excel without pop-up
Hi All,
In a particular scenario, I require to trigger an action once a file have been successfully downloaded to EXCEL from Webdynpro UI. But in case of download functionilty, once the MS window pop-up for download comes up, the control is lost from Webdynpro and its impossible to track whether user have saved, opened or canceled the file.
Is there any functionality to directly download internal table content to EXCEL, without facing the download popup. Please let me know any function module or functionality for this.
Thanks in advance to all.
Regards,
Mainakyes there are many tutorials on SDN regarding this
u may procced like this :
get the contents in internal table and then use the FM 'SCMS_STRING_TO_XSTRING'
DATA text TYPE string.
DATA xtext TYPE xstring.
* get all declared attributes
lo_nd_sbook->get_static_attributes_table(
IMPORTING
table = lt_sbook ).
LOOP AT lt_sbook INTO ls_sbook.
CONCATENATE text ls_sbook-carrid
ls_sbook-connid
ls_sbook-fldate
ls_sbook-bookid
ls_sbook-order_date
ls_sbook-counter
ls_sbook-passname
cl_abap_char_utilities=>newline INTO text SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = text
IMPORTING
buffer = xtext.
wdr_task=>client_window->client->attach_file_to_response(
**path to the word file
i_filename = 'WDP.xls'
* String Variable
i_content = xtext
* File Type
i_mime_type = 'EXCEL' ).
here it_sbook is the inernal table and ls_sbook is the structure type of the attributes declared in the context node sbook
DATA ls_sbook TYPE wd_this->element_sbook.
* data LT_SFLIGHT type WD_THIS->ELEMENTS_SFLIGHT.
DATA lt_sbook TYPE wd_this->elements_sbook.
Edited by: amit saini on Oct 14, 2009 1:30 PM -
Reg: ALV report download to excel currency columns
Hi All,
While downloading the alv report to excel, currency fields with negative sign(less than 0) is downloading without negative sign.
And field catalog wad declared as 'CURR' field for that particular column, if I declared as 'CHAR', i am getting shortdump.
Can any one tell me how to get the negative sign.
Thanks in advance.Hi,
Do you use ALV to excel standard functionality or your own code to excel?
Please provide more information.
Thanks, -
How can i bring the column heading downloaded in excel sheet?
hi all,
I am using FM SAP_CONVERT_TO_XLS_FORMAT to downloading populated internal table data into excel sheet by using filename type rlgrap-filename.
Now I need the column heading(field name) for downloaded data in excel sheet.
pls tell me how can i merge the col heading with data perfectly. Is there any FM fulfills this requirement.
pls give me a suitable approch.
Thanks
PRRHI,
Go thru this code.
REPORT ZRMM0056 NO STANDARD PAGE HEADING
MESSAGE-ID ZZ
LINE-SIZE 300
LINE-COUNT 65.
Program : ZRMM0056
Title : Non Inventory PO's
Description : Non Inventory Purchase Orders details with
Vendor and Invoice Receipts and Goods Receipts.
Input :
Select-options : 1. G/L Account No
Parameters : 1.File Paths for the Excel sheet
Others (Specify):
Output : Extract Files in the application server
Report :
Hear Ticket # : 113392
Created by : Srinivas Rao.M
Created on : 12/15/2005
Version : 1
Request : D10K944304
Transaction Code : Z420
Change History *
Date Programmer Search String Description *
12/19/2005 Srinivas D10K944316 Removed Purchasing document
Company code and Plant from
Select-Options and Inculded
G/L Account No and changed
code accordingly.
T A B L E S *
TABLES: EKBE, " History of Purchasing Document
EKPO, " Purchasing Document Item
EKKO, " Purchasing Document Header
LFA1, " Vendor master (general section)
EKKN. " Account Assignment in Purchasing Doc
INTERNAL TABLES
*--Internal table to store Purchasing document header data
DATA : BEGIN OF IT_POHEADER OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing document
AEDAT LIKE EKKO-AEDAT, "Created on
ERNAM LIKE EKKO-ERNAM, "Created by
LIFNR LIKE EKKO-LIFNR, "Vendor
END OF IT_POHEADER.
*--Internal table to store Purchasing document Item data
DATA : BEGIN OF IT_POITEM OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing document
EBELP LIKE EKPO-EBELP, "Item Number
MATNR LIKE EKPO-MATNR, "Material number
BUKRS LIKE EKPO-BUKRS, "Company code
WERKS LIKE EKPO-WERKS, "Plant
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Order Quantity
NETPR LIKE EKPO-NETPR, "Net Price
PEINH LIKE EKPO-PEINH, "Price unit
NETWR LIKE EKPO-NETWR, "Net Value
END OF IT_POITEM.
*--Internal table to hold final display data.
DATA : BEGIN OF IT_FINAL OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing document
EBELP LIKE EKPO-EBELP, "Item Number
AEDAT LIKE EKKO-AEDAT, "Created on
ERNAM LIKE EKKO-ERNAM, "Created by
MATNR LIKE EKPO-MATNR, "Material number
BUKRS LIKE EKPO-BUKRS, "Company code
WERKS LIKE EKPO-WERKS, "Plant
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Order Quantity
NETPR LIKE EKPO-NETPR, "Net Price
PEINH LIKE EKPO-PEINH, "Price unit
NETWR LIKE EKPO-NETWR, "Net Value
LIFNR LIKE EKKO-LIFNR, "Vendor
NAME1 LIKE LFA1-NAME1, "Vendor Name
GSBER LIKE EKKN-GSBER, "Business area
*--IR details
IR_BELNR LIKE EKBE-BELNR, "IR-Number of Material Document
IR_BUZEI LIKE EKBE-BUZEI, "IR-Item in material Document
IR_BUDAT LIKE EKBE-BUDAT, "IR-Posting date
IR_MENGE LIKE EKBE-MENGE, "IR-Quantity
*--GR details
GR_BELNR LIKE EKBE-BELNR, "GR-Number of Material Document
GR_BUZEI LIKE EKBE-BUZEI, "GR-Item in material Document
GR_BUDAT LIKE EKBE-BUDAT, "GR-Posting date
GR_MENGE LIKE EKBE-MENGE, "GR-Quantity
END OF IT_FINAL.
*--Internal table to store History per Purchasing Document data
DATA : BEGIN OF IT_HISTORY OCCURS 0,
EBELN LIKE EKBE-EBELN, "Purchasing document
EBELP LIKE EKBE-EBELP, "Item
VGABE LIKE EKBE-VGABE, "Trans/Event type
BELNR LIKE EKBE-BELNR, "Number of Material Document
BUZEI LIKE EKBE-BUZEI, "Item in material Document
BUDAT LIKE EKBE-BUDAT, "Posting date
MENGE LIKE EKBE-MENGE, "Quantity
BEWTP LIKE EKBE-BEWTP, "Posting history category
END OF IT_HISTORY.
*--Internal table to store vendor name.
DATA : BEGIN OF IT_VENDOR OCCURS 0,
LIFNR LIKE LFA1-LIFNR, "Vendor Number
NAME1 LIKE LFA1-NAME1, "Vendor Name
END OF IT_VENDOR.
*--Internal table to store Business area for Purchasing document
DATA : BEGIN OF IT_BUSINESS OCCURS 0,
EBELN LIKE EKKN-EBELN, "Purchasing document
EBELP LIKE EKKN-EBELP, "Purchasing Item
SAKTO LIKE EKKN-SAKTO, "G/L Account No
GSBER LIKE EKKN-GSBER, "Business area
END OF IT_BUSINESS.
DATA : BEGIN OF FIELDNAMES OCCURS 0,
TEXT(40),
END OF FIELDNAMES.
VARIABLES DECLARATION *
DATA: V_FILE LIKE IBIPPARMS-PATH, "File path
V_FLD LIKE DYNPREAD-FIELDNAME, "Dynpread fieldname
V_FLAG(1) VALUE SPACE. "FLAG VARIABLE
SELECTION-SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.
*--Begin of change D10K944316
SELECT-OPTIONS : S_SAKTO FOR EKKN-SAKTO. "G/L Accoun no.
*--End of change D10K944316
SELECTION-SCREEN END OF BLOCK S1.
SELECTION-SCREEN BEGIN OF BLOCK S2 WITH FRAME TITLE TEXT-002.
PARAMETERS : P_EXCEL AS CHECKBOX DEFAULT ' ' . " download to excel
PARAMETERS : C_FILE(128) DEFAULT : 'C:\ZRMM0056.xls'.
SELECTION-SCREEN END OF BLOCK S2.
A T S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR C_FILE.
*-Form to get file path for download of data
PERFORM GET_FILE_PATH.
AT SELECTION-SCREEN.
PERFORM SCREEN_VALIDATIONS.
START-OF-SELECTION
START-OF-SELECTION.
*--Extract Purchasing document header data.
PERFORM GET_PO_HEADER_DATA.
*--Extract Purchasing document Item data.
IF NOT IT_BUSINESS[] IS INITIAL.
PERFORM GET_PO_ITEM_DATA.
*--Get complete required data in final internal table
PERFORM GET_FINAL_DATA.
ENDIF.
END-OF-SELECTION
END-OF-SELECTION.
IF V_FLAG IS INITIAL.
*--Display Purchasing document details
IF NOT IT_FINAL[] IS INITIAL.
PERFORM DISPLAY_PODATA.
IF P_EXCEL = 'X'.
*--To down load data to excel sheet
PERFORM DOWN_LOAD_TO_EXCEL.
ENDIF.
ENDIF.
ELSE.
MESSAGE I001(ZZ) WITH 'No data found'(003).
ENDIF.
TOP-OF-PAGE
TOP-OF-PAGE.
*--To display page header
PERFORM PAGE_HEADER.
*& Form GET_PO_HEADER_DATA
To Get Purchasing header data
FORM GET_PO_HEADER_DATA .
*--To extract Business Area details
CLEAR IT_BUSINESS.
REFRESH IT_BUSINESS.
SELECT EBELN "Purchasing document
EBELP "Purchasing document item
SAKTO "G/L Account no
GSBER "Business area
FROM EKKN
INTO TABLE IT_BUSINESS
WHERE SAKTO IN S_SAKTO.
IF SY-SUBRC <> 0.
V_FLAG = 'X'.
MESSAGE I001(ZZ) WITH
'No data selected for the given selection criteria'(004).
STOP.
ELSE.
*--To extract Purchasing document details with respect
to G/L Account no
CLEAR IT_POHEADER.
REFRESH IT_POHEADER.
SELECT EBELN "Purchasing document
AEDAT "Created on
ERNAM "Created by
LIFNR "Vendor
FROM EKKO
INTO TABLE IT_POHEADER
FOR ALL ENTRIES IN IT_BUSINESS
WHERE EBELN = IT_BUSINESS-EBELN.
IF NOT IT_POHEADER[] IS INITIAL.
CLEAR IT_VENDOR.
REFRESH IT_VENDOR.
*--Extracting Vendor details
SELECT LIFNR "Vendor #
NAME1 "Name
FROM LFA1
INTO TABLE IT_VENDOR
FOR ALL ENTRIES IN IT_POHEADER
WHERE LIFNR = IT_POHEADER-LIFNR.
ENDIF.
ENDIF.
ENDFORM. " GET_PO_HEADER_DATA
*& Form GET_PO_ITEM_DATA
To extract Purchasing document item data
FORM GET_PO_ITEM_DATA .
CLEAR IT_POITEM.
REFRESH IT_POITEM.
SELECT EBELN "Purchasing document
EBELP "Item Number
MATNR "Material number
BUKRS "Company code
WERKS "Plant
MATKL "Material Group
MENGE "Order Quantity
NETPR "Net Price
PEINH "Price unit
NETWR "Net Value
FROM EKPO
INTO TABLE IT_POITEM
FOR ALL ENTRIES IN IT_BUSINESS
WHERE EBELN = IT_BUSINESS-EBELN
AND EBELP = IT_BUSINESS-EBELP.
IF NOT IT_POITEM[] IS INITIAL.
CLEAR IT_HISTORY.
REFRESH IT_HISTORY.
SELECT EBELN "Purchasing document
EBELP "Item
VGABE "Trans/Event type
BELNR "Number of Material Document
BUZEI "Item in material Document
BUDAT "Posting date
MENGE "Quantity
BEWTP "Posting history category
FROM EKBE
INTO TABLE IT_HISTORY
FOR ALL ENTRIES IN IT_POITEM
WHERE EBELN = IT_POITEM-EBELN
AND EBELP = IT_POITEM-EBELP
AND ( VGABE = '1' OR VGABE = '2' ) "1 = GR , 2 = IR
AND ( BEWTP = 'Q' OR BEWTP = 'E' ). "Q = GR , R = IR
IF SY-SUBRC = 0.
SORT IT_HISTORY BY EBELN EBELP.
ENDIF.
ENDIF.
ENDFORM. " GET_PO_ITEM_DATA
*& Form GET_FILE_PATH
Select file path
FORM GET_FILE_PATH .
CLEAR V_FILE.
MOVE 'p_flname' TO V_FLD.
MOVE C_FILE TO V_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = V_FLD
IMPORTING
FILE_NAME = V_FILE
EXCEPTIONS
OTHERS = 1.
MOVE V_FILE TO C_FILE.
ENDFORM. " GET_FILE_PATH
*& Form PAGE_HEADER
To Print page header and other details
FORM PAGE_HEADER .
*--Page Header
ULINE AT /1(300).
FORMAT COLOR 1.
WRITE:/ 'Run Date:'(005), SY-DATUM, 45 'Stanley Works'(006),
100 'Page No:'(007), SY-PAGNO LEFT-JUSTIFIED, 298 ''.
WRITE:/ 'Run Time:'(008), SY-UZEIT, 43 SY-TITLE, 100 SY-UNAME, 298 ''.
WRITE:/ 'Source :'(009), SY-SYSID, 100 SY-CPROG, 298 ''.
FORMAT COLOR OFF.
ULINE AT /1(300).
FORMAT COLOR 4.
WRITE : / SY-VLINE , (10) 'Purchasing Doc'(010),
SY-VLINE, (5) 'Item'(011),
SY-VLINE, (10) 'Created On'(012),
SY-VLINE, (7) 'Crea By'(013),
SY-VLINE, (10) 'Material'(014),
SY-VLINE, (6) 'Com cd'(015),
SY-VLINE, (5) 'Plant'(016),
SY-VLINE, (10) 'Mat Group'(017),
SY-VLINE, (13) 'Order Qty'(018),
SY-VLINE, (11) 'Net Price'(019),
SY-VLINE, (10) 'Price Unit'(020),
SY-VLINE, (13) 'Net Value'(021),
SY-VLINE, (8) 'Bus Area'(022),
SY-VLINE, (10) 'Vendor'(023),
SY-VLINE, (28) 'Vendor Name'(024),
*--IR details
SY-VLINE, (10) 'IR-Mat Doc'(025),
SY-VLINE, (5) 'IR-It'(026),
SY-VLINE, (9) 'IR-Post dt'(027),
SY-VLINE, (13) 'IR-Quantity'(028),
*--GR details
SY-VLINE, (10) 'GR-Mat Doc'(029),
SY-VLINE, (5) 'GR-It'(030),
SY-VLINE, (9) 'GR-Post dt'(031),
SY-VLINE, (13) 'GR-Quantity'(032), SY-VLINE.
FORMAT COLOR OFF.
ULINE AT /1(300).
ENDFORM. " PAGE_HEADER
*& Form SCREEN_VALIDATIONS
Selection screen validations
FORM SCREEN_VALIDATIONS .
*--Validation for G/L Account No
IF NOT S_SAKTO IS INITIAL.
SELECT SAKNR UP TO 1 ROWS
INTO EKKN-SAKTO
FROM SKA1 WHERE
SAKNR IN S_SAKTO.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ) with 'Please enter a valid G/L Account no'(048).
ENDIF.
ENDIF.
*--Validation for Excel file path
IF P_EXCEL = 'X'.
IF C_FILE = ' '.
MESSAGE E001(ZZ) with 'Please enter a valid Excle Path'(035).
ENDIF.
ENDIF.
ENDFORM. " SCREEN_VALIDATIONS
*& Form DISPLAY_PODATA
To Display Purchasing Document details
FORM DISPLAY_PODATA .
FORMAT COLOR 2.
SORT IT_FINAL BY EBELN EBELP AEDAT BUKRS WERKS.
LOOP AT IT_FINAL.
WRITE : / SY-VLINE ,(10) IT_FINAL-EBELN, "Purchasing Doc
SY-VLINE, (5) IT_FINAL-EBELP, "Item
SY-VLINE, (10) IT_FINAL-AEDAT, "Created On
SY-VLINE, (7) IT_FINAL-ERNAM, "Created By
SY-VLINE, (10) IT_FINAL-MATNR, "Material
SY-VLINE, (6) IT_FINAL-BUKRS, "Company code
SY-VLINE, (5) IT_FINAL-WERKS, "Plant
SY-VLINE, (10) IT_FINAL-MATKL, "Material Group
SY-VLINE, (13) IT_FINAL-MENGE, "#EC UOM_IN_MES
"Order Qty
SY-VLINE, (11) IT_FINAL-NETPR, "#EC UOM_IN_MES
"Net Price
SY-VLINE, (10) IT_FINAL-PEINH, "#EC UOM_IN_MES
"Price Unit
SY-VLINE, (13) IT_FINAL-NETWR, "#EC UOM_IN_MES
"Net Value
SY-VLINE, (8) IT_FINAL-GSBER, "Bus Area
SY-VLINE, (10) IT_FINAL-LIFNR, "Vendor
SY-VLINE, (28) IT_FINAL-NAME1, "Vendor name
*--IR details
SY-VLINE, (10) IT_FINAL-IR_BELNR, "IR-Mat Doc
SY-VLINE, (5) IT_FINAL-IR_BUZEI, "IR-It
SY-VLINE, (9) IT_FINAL-IR_BUDAT, "IR-Post dt
SY-VLINE, (13) IT_FINAL-IR_MENGE, "#EC UOM_IN_MES
"IR-Quantity
*--GR details
SY-VLINE, (10) IT_FINAL-GR_BELNR, "GR-Mat Doc
SY-VLINE, (5) IT_FINAL-GR_BUZEI, "GR-It
SY-VLINE, (9) IT_FINAL-GR_BUDAT, "GR-Post dt
SY-VLINE, (13) IT_FINAL-GR_MENGE, SY-VLINE.
"#EC UOM_IN_MES
"GR-Quantity
ENDLOOP.
FORMAT COLOR OFF.
ENDFORM. " DISPLAY_PODATA
*& Form DOWN_LOAD_TO_EXCEL
text
FORM DOWN_LOAD_TO_EXCEL .
<b>REFRESH FIELDNAMES.
FIELDNAMES-TEXT = TEXT-010.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-011.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-012.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Created By'(036).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-014.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Company Code'(037).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-016.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Material Group'(038).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Order Quantity'(039).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-019.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-020.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-021.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'Business Area'(040).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-023.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-024.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Material Doc'(041).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Item'(042).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'IR Posting Date'(043).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-028.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Material Doc'(044).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Item'(045).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = 'GR Posting Date'(046).
APPEND FIELDNAMES.CLEAR FIELDNAMES.
FIELDNAMES-TEXT = TEXT-032.
APPEND FIELDNAMES.CLEAR FIELDNAMES.
*--FM to download data to Excel sheet
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = C_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_FINAL
FIELDNAMES = FIELDNAMES
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ) WITH 'Data could not downloaded'(047).
ENDIF.</b>ENDFORM. " DOWN_LOAD_TO_EXCEL
*& Form GET_FINAL_DATA
To Populate required data in final internal table
FORM GET_FINAL_DATA .
CLEAR IT_FINAL.
REFRESH IT_FINAL.
LOOP AT IT_POITEM.
CLEAR IT_POHEADER.
READ TABLE IT_POHEADER WITH KEY EBELN = IT_POITEM-EBELN.
IF SY-SUBRC = 0.
MOVE : IT_POHEADER-EBELN TO IT_FINAL-EBELN, "Purchasing Doc
IT_POITEM-EBELP TO IT_FINAL-EBELP, "Item
IT_POHEADER-AEDAT TO IT_FINAL-AEDAT, "Created On
IT_POHEADER-ERNAM TO IT_FINAL-ERNAM, "Created By
IT_POITEM-MATNR TO IT_FINAL-MATNR, "Material
IT_POITEM-BUKRS TO IT_FINAL-BUKRS, "Company code
IT_POITEM-WERKS TO IT_FINAL-WERKS, "Plant
IT_POITEM-MATKL TO IT_FINAL-MATKL, "Material Group
IT_POITEM-MENGE TO IT_FINAL-MENGE, "Order Qty
IT_POITEM-NETPR TO IT_FINAL-NETPR, "Net Price
IT_POITEM-PEINH TO IT_FINAL-PEINH, "Price Unit
IT_POITEM-NETWR TO IT_FINAL-NETWR, "Net Value
IT_POHEADER-LIFNR TO IT_FINAL-LIFNR. "Vendor
*--To Insert IR details
CLEAR IT_HISTORY.
READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP
VGABE = '2'
BEWTP = 'Q'.
IF SY-SUBRC = 0.
MOVE :
IT_HISTORY-BELNR TO IT_FINAL-IR_BELNR, "IR-Number of Mat Doc
IT_HISTORY-BUZEI TO IT_FINAL-IR_BUZEI, "IR-Item in mat Doc
IT_HISTORY-BUDAT TO IT_FINAL-IR_BUDAT, "IR-Posting date
IT_HISTORY-BUDAT TO IT_FINAL-IR_MENGE. "IR-Quantity
ENDIF.
*--To insert GR details
CLEAR IT_HISTORY.
READ TABLE IT_HISTORY WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP
VGABE = '1'
BEWTP = 'E'.
IF SY-SUBRC = 0.
MOVE :
IT_HISTORY-BELNR TO IT_FINAL-GR_BELNR, "IR-Number of Mat Doc
IT_HISTORY-BUZEI TO IT_FINAL-GR_BUZEI, "IR-Item in mat Doc
IT_HISTORY-BUDAT TO IT_FINAL-GR_BUDAT, "IR-Posting date
IT_HISTORY-BUDAT TO IT_FINAL-GR_MENGE. "IR-Quantity
ENDIF.
*--To insert Vendor details
CLEAR IT_VENDOR.
READ TABLE IT_VENDOR WITH KEY LIFNR = IT_POHEADER-LIFNR.
IF SY-SUBRC = 0.
MOVE : IT_VENDOR-NAME1 TO IT_FINAL-NAME1.
ENDIF.
*--To insert Business area
CLEAR IT_BUSINESS.
READ TABLE IT_BUSINESS WITH KEY EBELN = IT_POITEM-EBELN
EBELP = IT_POITEM-EBELP.
IF SY-SUBRC = 0.
MOVE : IT_BUSINESS-GSBER TO IT_FINAL-GSBER.
ENDIF.
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDIF.
ENDLOOP.
ENDFORM. " GET_FINAL_DATA
thanks
Sunil -
Reg: ALV output download using excel option
Hi Team,
I created a report using ALV Function modules, I want to download in Excel sheet the output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
is there any settings for these download.
<<removed by moderator>>
Thanks & Regards,
Mahendar patha.hi mahendra;
use this step-by-step procedure it will help u a lot:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma
Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM
Maybe you are looking for
-
10g Forms and reports standalone - 64 bit software available?
Hi All, Is oracle application server 10g forms and reports standalone softaware available in 64-bit version? Please provide the link to download thye same. Thanks, Anand.
-
Hi Sometimes I have some bad songs after sync on my ipod touch , these songs have silence of 10s in the middle and then after all is correct If I listen the song on my library ITUNES it's correct ( no silence ) and if I transfer again the song after
-
Sudden increase in native heap memory
Hi all, we are using JRockit 26.4 and currently configured with 1800MB heap on windows 2003 with /3GB switch. We noticed that after the weblogic server is started the total memory (java heap + native memory) lingers around 2550 MB... (We monitored th
-
Error code 2155348010 windows server 2008
How to solve this error code. I have WD 2 TB hard disk in my environment its give error 2155348010 and reconfigured some many times. Please tell me solutions on this.
-
How to connect JSP with MySql Database?
HI All... I want to know or How to connect Mysql with JSP or JSF any other software is available? please help me.....