Sap OLE to Excel
hi all ,
I am working with organisation chart. i want to insert the org chart in excel. this is my recording in excel
ActiveSheet.OLEObjects.Add(ClassType:="OrgChart", Link:=False, _
DisplayAsIcon:=False).Activate
For this i have used this following code But it is not working what i have to change in this coding
CALL METHOD OF excel 'WORKBOOKS' = workbooks.
CALL METHOD OF workbooks 'ADD' = workbook.
*CALL METHOD OF excel 'ACTIVESHEET' = activesheet.
GET PROPERTY OF excel 'ACTIVESHEET' = activesheet.
GET PROPERTY OF activesheet 'OLEObjects' = oleobjects.
GET PROPERTY OF oleobjects 'Add' = add.
CALL METHOD OF oleobjects 'Add'
EXPORTING
#1 = 'OrgChart'
#2 = '2'
#3 = '2' .
CALL METHOD OF oleobjects 'Activate'.
Plz anyone give ur idea to correct it
hi sravanthi,
I am not able to get the answer now also.. i went throgh the document but i am not able to locate my error..
Similar Messages
-
Hi,
While maintaining Standard text in MS-WORD it giving a error 'Internal error in SAP OLE Container Control'.
According to my knowlegde its giving error because some file missed in msofficeintegration in OLE.
But i am unable to sort out this problem.
If any one have idea in this pls reply me.Hello,
Try this for Landscape (all ole objects are of type OLE2_OBJECT)
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 .
SET PROPERTY OF EXCEL 'VISIBLE' = 1.
* creating workbook
SET PROPERTY OF EXCEL 'SheetsInNewWorkbook' = 1.
CALL METHOD OF WORKBOOK 'ADD'.
CALL METHOD OF EXCEL 'WORKSHEETS' = SHEET.
CALL METHOD OF SHEET 'ADD'.
FREE OBJECT SHEET.
CALL METHOD OF EXCEL 'WORKSHEETS' = SHEET
EXPORTING
#1 = 1.
GET PROPERTY OF sheet 'PageSetup' = h_pagesetup.
set PROPERTY OF h_pagesetup 'Orientation' = 2. -
hi i worked on sap ole 2 to word and excel.. but i do not know how to proceed with visio.can anyone give me a sample code to work on visio
It s too complicated i went through structural graphics and solved
-
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 -
Hello,
I want to call a WebService from a SAP-System in Excel. I created this WebService with the WebService Creation Wizard by using a RFC function. The WebService expects two parameters of string and it delivers a table.
I'm using the MS SOAP Type Library v3.0 to call the WebService.
Here's my code:
01 Dim SOAPClient As SoapClient30
02 Set SOAPClient = New SoapClient30
03
04 SOAPClient.mssoapinit "http://" & User & ":" & pswd & "@bcrsap27.de.emea.csc.com:8000/sap/bc/srt/wsdl/bndg_DE22AF411A745FF19F270014C25BCDE3/wsdl11/allinone/ws_policy/document?sap-client=800"
05
06 With SOAPClient
07 .ConnectorProperty("UseSSL") = True
08 End With
09
10 Dim ret() As ZETT_DEFECT_T
11
12 ret = SOAPClient.ZETT_WS_READ_DEFECT("2009-01-01", "2009-04-07")
At line 4 'User' and 'pswd' is needed to authenticate the user.
But on line 12 I allways get an error:
Run-time error '5419'
Client: unspecifiedclient erro. HRESULT=0x800A152B
I hope someone can help me.
Thank you,
FrankHi,
I have progressed upto a stage where it actully connects to R/3 and goes into class
"CL_HTTP_EXT_SOAPHANDLER_RFC"
but i always get a error
<i><b>"SoapMapper:Restoring data into SoapMapper <obj> failed"</b></i>
It looks like that it is to do with complex data type.
But the function which i am using is just reutrning a result of type string.
I will post more once i solve the issue.
Regards
Raja -
Exporting reports form SAP to MS Excel file
Dear All
Our material number logic is like that having 18 digits "801062004767100001".
1. When we are exporting any std report or zreports to excel through Export to excel all the numbers are converting in to text and saving in excel file as it is displaying SAP screen.
But in SAP for all transaction not having export to excel file.
2. We have the option export to local file from there we choose "spread sheet" by this way if we export to excel the material number is displaying as "8.01062E+17"
if i convert this column as numbers excel showing " 801062004767100000" the last digit " 1" is changing as alway zero. if we manually change it to "1" excel converting it to "0"
Especially we are facing problem in SM37 after back ground job, transport in excel we have only one option point no 2.
I tried to use encode page during transport , i am not getting proper result for the material no.
Please help me , if any setting available in SAP or in EXcel.
Thanks & Regards
VinothHi,
Not in front of the system at the moment, but when you click on Local File, there is an option called Unformatted if i am right (the first one) select that & then save it in .txt format & later open in Excel, it should maintain the formatting.
Check & revert if it solves the issue.
Regards,
Vivek -
OLE Automation EXCEL.APPLICATION OPEN === CSV file
Hi Gurus,
no probs to open a XLS file via
CREATE OBJECT grc_excel 'EXCEL.APPLICATION'.
SET PROPERTY OF grc_excel 'VISIBLE' = 1.
CALL METHOD OF grc_excel 'WORKBOOKS' = grc_wbook.
Open Workbook
CALL METHOD OF grc_wbook 'Open'
EXPORTING #1 = gfd_filename.
but how to deal with CSV ? They're opened not properly.
I tried #2 = 'CSV' but no luck.
Any Idea?
Cheers
carstenCOMMA separated files are SEMICOLON separated files in German Windows systems.
This ist set in Windows System settings for regions (enhanced).
EXCEL considers this settings when running normally. CSV is stored with ; and will be loaded properly after.
In OLE mode, EXCEL does not consider this regional setting and expects COMMA
If there's no option to tell lthe open method of OLE-Excel, I must translate SEMICOLIN toCOMMA before with all risks to translate text instead of separators...
I saw some opens with #2 as parameter for "read only" but nothing regarding "separator character" (CL_RMPS_MS_OFFICE_TOOLS~GET_BUILTIN_DOC_PROPS_FROM_FIL)
Thanks & Cheers
carsten -
Rfc code to call any sap tcode in excel macro
Hi all,
We are trying call sap tcode in excel macro programm using RFC.
Can any one send me sample code for this?
This is urgent.points will be rewarded.
regards,
ShyamHi harish kollipara
you should create the FM in the B system, that return some data that you can catch in system A after have called the FM.
check this link for the function:
http://help.sap.com/saphelp_nw04/helpdata/en/f9/3f69fd11a80b4e93a5c9230bafc767/frameset.htm
CALL FUNCTION 'NAME OF FUNCTION' DESTINATION rfc_destination_name
importing ...
exporting ...
EXCEPTIONS
system_failure = 1
OTHERS = 2.
hope this help you
Marco -
INTERNAL ERROR IN SAP OLE DOCUMENT CONTAINER CONTROL. in transaction PBWW
Well while running a transaction PBWW when we click on create button it opens the word document with the
text in it but suddenly the text is gone and it is showing a error which is INTERNAL ERROR IN SAP OLE DOCUMENT CONTAINER CONTROL.
how can it be resolved????
Thanks And regards
AmitFriend,
See this line from OSS#427615:
Note:
This note is a continuation of the correction from Note 402195 (Stabilization of the Word interface). Thus, the correction from Note 402195 is an absolutely necessary prerequisite for this note.
i'm about to sure that if you implement first 402195 than 427615 problem would be solved.
Both OSS are made in continuation. -
I have used this coding for sap OLE to Ms word... but if i run this program... MS Word just opens but i am not able to view any of the statements... that is new documents are not openings and the statements are not reflecting...
Any one give me a tips what to change in this following code...
Include for OLE-enabling definitions
INCLUDE ole2incl .
*Global variables *Variables to hold OLE object and entity handles
DATA: gs_word TYPE ole2_object ,
*"OLE object handle
gs_documents TYPE ole2_object ,
*"Documents
gs_actdoc TYPE ole2_object , "Active document
gs_application TYPE ole2_object , "Application
gs_options TYPE ole2_object , "Application options
gs_actwin TYPE ole2_object , "Active window
gs_actpan TYPE ole2_object , "Active pane
gs_view TYPE ole2_object , "View
gs_selection TYPE ole2_object , "Selection
gs_font TYPE ole2_object , "Font
gs_parformat TYPE ole2_object , "Paragraph format
gs_tables TYPE ole2_object , "Tables
gs_range TYPE ole2_object , "Range handle for various ranges
gs_table TYPE ole2_object , "One table
gs_table_border TYPE ole2_object , "Table border
gs_cell TYPE ole2_object , "One cell of a table
gs_paragraph TYPE ole2_object , "Paragraph
gv_pos(5) TYPE n . "Position information for table
START-OF-SELECTION .
*--Creating OLE object handle variable
CREATE OBJECT gs_word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
*--Setting object's visibility property
SET PROPERTY OF gs_word 'Visible' = '1' .
*--Opening a new document
GET PROPERTY OF gs_word 'Documents' = gs_documents .
**--Setting the measurement unit
GET PROPERTY OF gs_application 'Options' = gs_options .
SET PROPERTY OF gs_options 'MeasurementUnit' = '1' . "CM
*Getting handle for the selection which is here the character at the *cursor position
GET PROPERTY OF gs_application 'Selection' = gs_selection .
GET PROPERTY OF gs_selection 'Font' = gs_font .
GET PROPERTY OF gs_selection 'ParagraphFormat' = gs_parformat .
*--Setting font attributes
SET PROPERTY OF gs_font 'Name' = 'Arial' .
SET PROPERTY OF gs_font 'Size' = '10' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '1' . "Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '2' . "Right-justified
CALL METHOD OF gs_selection 'TypeText'
EXPORTING #1 = 'This is an OLE example!'.
*--Setting the view to the main document again
SET PROPERTY OF gs_view 'SeekView' = '0' . "Main document view
*--Reseting font attributes for the title
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '16' .
SET PROPERTY OF gs_font 'Bold' = '1' . "Bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '1' . "Centered
CALL METHOD OF gs_selection 'TypeText'
EXPORTING #1 = text-001.
*--Advancing cursor to the new line
CALL METHOD OF gs_selection 'TypeParagraph' .
*--Reseting font attributes for ordinary text
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '12' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '3' . "Justified
CALL METHOD OF gs_selection 'TypeText'
EXPORTING #1 = text-001.
*--skip some lines
DO 4 TIMES .
CALL METHOD OF gs_selection 'TypeParagraph' .
ENDDO .
*--Getting entity handles for the entities on the way
GET PROPERTY OF gs_actdoc 'Tables' = gs_tables .
GET PROPERTY OF gs_selection 'Range' = gs_range .
*--Adding a table with 3 rows and 2 columns
CALL METHOD OF gs_tables 'Add' = gs_table
EXPORTING #1 = gs_range " Handle for range entity
#2 = '3' "Number of rows
#3 = '2'. "Number of columns
*--Setting border attribute for the table
GET PROPERTY OF gs_table 'Borders' = gs_table_border .
SET PROPERTY OF gs_table_border 'Enable' = '1' . "With border
*Filling the table with dummy data *Reseting font attributes for table content
SET PROPERTY OF gs_font 'Name' = 'Garamond' .
SET PROPERTY OF gs_font 'Size' = '11' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Getting cell coordinates
CALL METHOD OF gs_table 'Cell' = gs_cell
EXPORTING #1 = '1' "first row
#2 = '1'. "first column
*--Getting the range handle to write the text
GET PROPERTY OF gs_cell 'Range' = gs_range .
*--Filling the cell
SET PROPERTY OF gs_range 'Text' = 'OLE' .
*--Getting cell coordinates
CALL METHOD OF gs_table 'Cell' = gs_cell
EXPORTING
#1 = '3' "third row
#2 = '2'. "second column
*--Reseting font attributes for ordinary text
SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
SET PROPERTY OF gs_font 'Size' = '12' .
SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
*--Setting paragraph format attribute
SET PROPERTY OF gs_parformat 'Alignment' = '3' . "Justified *--Indent the paragraph once
GET PROPERTY OF gs_selection 'Paragraphs' = gs_paragraph .
CALL METHOD OF gs_paragraph 'Indent' .
CALL METHOD OF gs_selection 'TypeText'
EXPORTING
#1 = text-001.
FREE OBJECT gs_word .
Thanks @ Regards,
HemaHI Hema,
To open new document add this line.
*--Opening a new document
get property of gs_word 'Documents' = gs_documents.
call method of gs_documents 'ADD' ."= gs_document.
Regards,
Sravanthi -
RE: Internal error in SAP OLE document container control
Hi,
When i execute the transaction for assigning standard document to an applicant activity, PBWW, i get an error message stating 'Internal error in SAP OLE document container control'. Please help me out of this problem.
We are using SAP version ECC 6
Thanks and Regards,
sowmyaHi,
Sorry for replying so late.
Follow these steps
Create a report ZPAPUT04 in your system.
Using ZPAPUT04, upload all the templates in TEMPLATES.zip one by one. Please make sure that only the option 'Upload' in the selection screen is chosen. You have to pass the other inputs as given below
If you have extracted the templates in the 'C: \ folder of your system
then
For R3_TP97_E.dot template
FILENAME = C:\R3_TP97_E.DOT
DOTNAME = R3_TP97_E
For TEMPLATE_E.DOT template
FILENAME = C:\TEMPLATE_E.DOT
DOTNAME = TEMPLATE_E
Execute the upload program ZPAPUT04
For R3_TP97A_E.dot template
FILENAME = C:\R3_TP97A_E.DOT
DOTNAME = R3_TP97A_E
Execute the upload program ZPAPUT04
<b>Report to be executed</b>
REPORT ZPAPUT04 .
types: begin of data_type,
line(132) type x,
end of data_type.
DATA langu type thead-tdspras VALUE 'D'.
DATA data_x type table of data_type.
DATA wa_data_x type data_type.
DATA text type table of tline.
DATA wa_text type tline.
DATA header type thead.
DATA header_x type xstring.
field-symbols: <data_x> type x,
<text> type x.
DATA filename type string.
parameters: file_c(128) default 'C:\R3_TP97_D.DOT',
dotname type TDOBNAME default 'R3_TP97_D',
download as checkbox default 'X',
upload as checkbox default 'X'.
DATA bytes_up type i.
DATA bytes_down type i.
DATA result1 type string.
DATA result2 type string.
data charsize type i.
class CL_ABAP_CHAR_UTILITIES definition load.
charsize = CL_ABAP_CHAR_UTILITIES=>charsize.
filename = file_c.
if upload = 'X'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = filename
FILETYPE = 'BIN'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH = bytes_up
HEADER =
TABLES
DATA_TAB = data_x
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF bytes_up <= 0.
result1 = 'UPLOAD ERROR ?:o('.
ELSE.
result1 = 'UPLOAD OK :o)'.
ENDIF.
LOOP AT data_x INTO wa_data_x.
assign wa_data_x-line to <data_x> casting.
assign wa_text-tdline to <text> casting.
<text> = <data_x>.
append wa_text TO text.
ENDLOOP.
CALL FUNCTION 'INIT_TEXT'
EXPORTING
ID = 'TAPP'
LANGUAGE = langu
NAME = dotname
OBJECT = 'APP-DOT'
IMPORTING
HEADER = header
TABLES
LINES = text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT data_x INTO wa_data_x.
assign wa_data_x-line to <data_x> casting.
assign wa_text-tdline to <text> casting.
<text> = <data_x>.
append wa_text TO text.
ENDLOOP.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = '000'
HEADER = header
INSERT = ' '
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
if download = 'X'.
refresh data_x.
refresh text.
clear wa_data_x.
clear wa_text.
unassign <data_x>.
unassign <text>.
DOWNLOAD
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = '000'
ID = 'TAPP'
LANGUAGE = langu
NAME = dotname
OBJECT = 'APP-DOT'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT text INTO wa_text.
assign wa_data_x-line to <data_x> casting.
assign wa_text-tdline to <text> casting.
<data_x> = <text>.
append wa_data_x TO data_x.
ENDLOOP.
*DATA fn_length type i.
*DATA offset type i.
*fn_length = strlen( file_c ).
*offset = fn_length - 4.
*concatenate filename(offset) '_DOWN' filename+offset(4) INTO filename.
IF upload <> 'X'.
DATA dx_ln type i.
describe table data_x lines dx_ln.
bytes_up = dx_ln * sy-tleng.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = bytes_up
FILENAME = filename
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
IMPORTING
FILELENGTH = bytes_down
TABLES
DATA_TAB = data_x
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF bytes_down <> bytes_up and upload = 'X'.
result2 = 'DOWNLOAD ERROR ?:o('.
ELSEIF bytes_down > 0.
result2 = 'DOWNLOAD OK :o)'.
ELSE.
result2 = 'DOWNLOAD ERROR ?:o('.
ENDIF.
endif.
write: result1, / result2, / 'Bytes per Character: ', charsize.
Download the template attached to note 558548
Regards,
Sowmya -
Internal error in SAP OLE document container control
While opening WW-Invitation in so10 with standard text - WW-INVITATION where Text ID - Palt the doc is not opening and the following error as coming :
Internal error in SAP OLE document container control
Message no. SOFFICEINTEGRATION019
Can any body suggest the solution on this.....
We have SAP HR patch level 72 .
I checked in the scn they are saying about some note but those note are not applicable in my system
ThanksSame thing over here.
ECC5.0, SAP GUI 7.1 Comp 3 (win).
Whenever I try to open any Document (Transaction PBWW) I get the same error: Word 2007 opens and as soon as the document itself is loaded, it vanishes. All that is left, is the GUI showing the "Internal Error in SAP OLE Document Container Control" (SOFFICEINTEGRATION019).
What's wrong with that. GUI 6.4 and 7.1 Comp. 2 did their job...
Even GUI 7.1 Comp. 3 and Word 2003 do as they're supposed to and open the documents nicely.
What I've found out is that the Word template R3_TP97_D.dot which is created in the temporary folder in Windows needs to be deleted before using PBWW. Once the file is gone, opening any document via PBWW succeeds. SAP Note 558548 does not resolve the issue.
Regards, Oliver
Edited by: Oliver Günther on Sep 15, 2009 1:34 PM
Edited by: Oliver Günther on Sep 15, 2009 1:37 PM -
SAP OLE to Word Usage of Text Boxes & Arrow Diagrams
hi this my Macro recording in MS word How to use this as sap Code using SAP OLE
' Macro recorded 3/30/2009 by Nirmala
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 216#, _
72#, 108#, 54#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="Hma"
Selection.ShapeRange.Select
ActiveDocument.Shapes.AddLine(207#, 135#, 261#, 207#).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
Selection.ShapeRange.Flip msoFlipHorizontal
ActiveDocument.Shapes.AddLine(261#, 135#, 306#, 198#).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 153#, _
216#, 90#, 54#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="xys"
Selection.ShapeRange.Select
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 297#, _
207#, 81#, 63#).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:="lop"hi
Hthis is my sap program.. where to use this coding concept what are the data s to be declared
*DATA declarations
*--Include for OLE-enabling definitions
INCLUDE ole2incl .
*--Global variables *--Variables to hold OLE object and entity handles
DATA: word TYPE ole2_object , "OLE object handle
documents TYPE ole2_object , "Documents
doc TYPE ole2_object , "Documents
actdoc TYPE ole2_object , "Active document
application TYPE ole2_object , "Application D
options TYPE ole2_object , "Application options
actwin TYPE ole2_object , "Active window
actpan TYPE ole2_object , "Active pane
view TYPE ole2_object , "View
selection TYPE ole2_object , "Selection
font TYPE ole2_object , "Font
parformat TYPE ole2_object , "Paragraph format
tables TYPE ole2_object , "Tables
range TYPE ole2_object , "Range handle for various ranges
table TYPE ole2_object , "One table
table_border TYPE ole2_object , "Table border
cell TYPE ole2_object , "One cell of a table
paragraph TYPE ole2_object , "Paragraph
shapes TYPE ole2_object ,
logo TYPE ole2_object ,
textbox TYPE ole2_object,
find TYPE ole2_object,
picture(128) ,
gv_pos(5) TYPE n . "Position information for table
START-OF-SELECTION .
picture = 'D:\BMP\test.bmp'.
*-Creating OLE object handle variable
CREATE OBJECT word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
*-Setting object's visibility property
SET PROPERTY OF word 'Visible' = '1' .
* Adding documents
CALL METHOD OF word 'DOCUMENTS' = documents.
* Adding New page
CALL METHOD OF documents 'Add' = doc.
* Retrieving thre Property of Word for Alignment Changes
GET PROPERTY OF word 'Selection' = selection.
GET PROPERTY OF selection 'Font' = font .
GET PROPERTY OF selection 'ParagraphFormat' = parformat.
* Changes in Our Requirement
SET PROPERTY OF font 'Name' = 'Arial' .
SET PROPERTY OF font 'Size' = '20' .
SET PROPERTY OF font 'Bold' = '1' . "Not bold
SET PROPERTY OF font 'Italic' = '1' . "Italic
SET PROPERTY OF font 'Underline' = '1' . "Not underlined
* Paragraph Format 1 - Center 2 - Right 3 - Left
SET PROPERTY OF parformat 'Alignment' = '1'.
* Text to be displayed
CALL METHOD OF selection 'TypeText'
EXPORTING
#1 = 'Organisational Structure'.
*--Getting active document handle
GET PROPERTY OF word 'activedocument' = actdoc .
* To Save the document
CALL METHOD OF doc 'SaveAs'
EXPORTING
#1 = 'D:\TEMP\WordFormatOLE.doc'.
** To Quit the Document
CALL METHOD OF word 'Quit' . -
SAP extract to Excel changed after migration from ECC5 to ECC6
Hi everyone,
This issue is about getting a proper table when displaying SAP reports in Excel. When extracting to Excel, the data base is presented with summary yellow lines whereas we would rather have a regular table without subtotal. This issue appeared when the system was migrated from ECC5 to ECC6. Please notice that one of the user has currently a proper display. Do you know which parameter shall we change?
Thanks!
Stan B.There are some default setting in the parameters,
Like
RPO0 - User Settings
From FI transactions you can change ti your default settings
Have a look to:
FIT_ALVC X FI Line Items: ALV Grid Control
With KSB1 I see it direct without sub totals and saving.
Click on spreatsheet
Select All Available formats
Select EXCEL (In Existing XXL Format) -
Download SAP data to Excel file in Presentation server
Hi gurus,
I need to download SAP data to excel file. for that im using SAP_CONVERT_TO_XLS_FORMAT function module. I have to download with column header and also date should be in YYMMDD format. Im changing the format in ITAB but when populating to excel leading zero's were removed.(EX. 12102007 is converted to 071012 and it was populated as 71012). can someone explain how to use this function module or give someother solution for this....And if possible explain the parameters of the function module SAP_CONVERT_TO_XLS_FORMAT. Is there any function module for converting date as required format?
Thanks,
AmalHi Amal...
The Problem you are facing is because of Display properties of Microsoft Excel itself. I believe this can not be solver with in SAP. Instead I would suggest you to go for a .csv format. which can also be viewed in Excel.
In any case if you get to find a different solution for this, I would appriciate if you can share it with me :).
Santosh
Maybe you are looking for
-
OVS value not getting populated in field
Hi Experts, Kindly suggest me a solution for the below given issue. I have added three custom fileds to an already existing WD Coponent. And also added OVS help as an input help method to these fields. If I right click on the WD application and TEST,
-
I've got a late 2009 iMac 27". When I start it up, it chimes and makes all the normal sounds. The screen flashes white for 2 seconds, then goes black. The iMac starts up (if I use an external monitor, it works fine) but the screen remains black. Weir
-
Can't access mail after ios 8 Update- iPad 2
Updated to ios 8 on iPad 2. Tonight mail app has ben crashing after it trys to open. Repeatedly. Everything was working fine before upgrade and now having issues with mail, slow to open anything in Safari, poor wifi connection, etc. I feel like an id
-
Hi, I produced PDF File by using BSP Application but I have a problem when I open PDF. I have an Error. Adobe Reader could not open 'example.pdf' because it is either not a supported file type or because the file has been damaged. my code is : CALL F
-
Playing audio to dock thru lightning to 30-pin adapter?
Hi folks. I just bought a new iPad mini w/ retina display. I own two iPod docks. I'd like to be able to play music and podcasts--all audio, really--from the iPad through the docks. The docks have 30-pin connectors. I bought the lightnig to 30-pi