OLE Method SAVEAS
Hi,
I am using OLE to open and save an excel file in a different format. But the code is not working.
This is the code I am using:
INCLUDE ole2incl.
DATA file_in TYPE rlgrap-filename.
DATA file_out TYPE rlgrap-filename.
DATA excel TYPE ole2_object.
DATA workbook TYPE ole2_object.
file_in = 'C:\Read.xls'.
file_out = 'C:\Write.csv'.
CREATE OBJECT excel 'Excel.Application'.
IF sy-subrc NE 0.
WRITE: / 'No EXCEL creation possible'.
STOP.
ENDIF.
CALL METHOD OF excel 'WORKBOOKS' = workbook.
CALL METHOD OF workbook 'Open' EXPORTING #1 = file_in.
CALL METHOD OF workbook 'SAVEAS' EXPORTING #1 = file_out #2 = '6'.
CALL METHOD OF workbook 'CLOSE'.
CALL METHOD OF excel 'QUIT'.
* Code errors out here with sy-subrc = 2
IF sy-subrc <> 0.
WRITE: / 'OLE ERROR: RETURN CODE ='(i10), sy-subrc.
STOP.
ENDIF.
FREE OBJECT workbook.
FREE OBJECT excel.
Please help me out solve this one,
Thanks,
CD
Hello.. try this
INCLUDE ole2incl.
DATA file_in TYPE rlgrap-filename.
DATA file_out TYPE rlgrap-filename.
DATA excel TYPE ole2_object.
DATA workbook TYPE ole2_object.
DATA SHEET TYPE ole2_object. "changed
file_in = 'C:\it_results.xls'.
file_out = 'C:\Write.csv'.
CREATE OBJECT excel 'Excel.Application'.
IF sy-subrc NE 0.
WRITE: / 'No EXCEL creation possible'.
STOP.
ENDIF.
CALL METHOD OF excel 'WORKBOOKS' = workbook.
CALL METHOD OF workbook 'Open' EXPORTING #1 = file_in.
GET PROPERTY OF excel 'ActiveSheet' = sheet. " changed
CALL METHOD OF sheet 'SaveAs' EXPORTING #1 = file_out #2 = 6. " changed
CALL METHOD OF workbook 'CLOSE'.
CALL METHOD OF excel 'QUIT'.
* Code errors out here with sy-subrc = 2
IF sy-subrc NE 0.
WRITE: / 'OLE ERROR: RETURN CODE ='(i10), sy-subrc.
STOP.
ENDIF.
FREE OBJECT workbook.
FREE OBJECT excel.
Similar Messages
-
Import OLE methods in Oracle Forms 6i
Hi,
I am experiencing some problems to import OLE methods in Oracle
Forms 6i.
In Forms 6i, I select Program->Import OLE Library Interfaces
menu option. After the Import OLE Library Interfaces dialog box
appears, I can see the OLE Class that I would like to access
but none of its methods or events.
Why the methods and events do not appear?
Thanks in advance.If all you want to do is extract the documents from the Long Raw columns, you can use UTL_FILE to extract the binary content to the file system. You would have to loop through the records in your table to extract each file. Take a look at article Export BLOB Contents Using UTL_FILE that I googled. Granted, this article discusses exporting a BLOB not a Long Raw, but the concept is the same and you should be able to modify the code sample in the article to work with your Long Raw columns.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Invalid method "Save As" from Excel application object
I have Windows 2000 and Excel 2002 installed on my machine.
I down loaded "renamed Excel 2000 workbook.vi" from NI website. Relinked ref num to Excel application object but get the error of invalid method (Save As). Tried to relink invoke node to Save As by selecting method from drop down menu. However this method is not on the list. Tried other excel objects but can not find "Save As" method. Has this been removed/moved?I was able to correct the error by relinking the Workbooks->Open to Open. This changes the subsequent Invoke Node from IAppEvents to _Workbook. There you will find the Save As method.
Michael
www.abcdefirm.com
Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Find and fix bad VI Properties with Property Inspector -
OLE Methods Storage Table?
Hi everyone.
Where my methods related to OLE will be stored? (call method 'ACTIVESHEET' .,)
If you have an ideA,PLEASE post the reply.
Regards,
Kranti .I am not sure to understand your question, do you want to know the list of OLE methods that can be called? Answer: refer to the windows software language reference guide (in your case it's EXCEL). "activesheet" is a property of "application" object. See sap documentation http://help.sap.com/saphelp_nw70/helpdata/EN/59/ae3c98488f11d189490000e829fbbd/frameset.htm
Example:
INCLUDE ole2incl.
DATA lole_excel_appli TYPE OLE2_OBJECT.
DATA lole_workbooks TYPE OLE2_OBJECT.
DATA lole_workbook TYPE OLE2_OBJECT.
CREATE OBJECT lole_excel_appli 'excel.application'.
* Next corresponds to VBA: "application.visible = true"
SET PROPERTY OF lole_excel_appli 'visible' = 1.
* Next corresponds to VBA: "set workbook = application.workbooks.open("c:\test.xls")"
CALL METHOD OF lole_excel_appli 'workbooks' = lole_workbooks.
CALL METHOD OF lole_workbooks 'open' = lole_workbook EXPORTING #1 = 'c:\test.xls'.
Instead of direct OLE, you can also use the Desktop Office Integration classes http://help.sap.com/saphelp_nw2004s/helpdata/en/e9/0be775408e11d1893b0000e8323c4f/frameset.htm .
(corrected code) Edited by: Sandra Rossi on Mar 24, 2008 6:09 PM -
I have a problem in formatting cells in Excel while using OLE method.
Hi All,
I have a problem in formatting cells in Excel while using OLE method.
My requirement is to have certain fields of a cell as text and amount fields should be in number format.
How to format a cell in Excel in OLE method of downloading data to excel.
For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
I want that field to be shown as 0002.(text format)
Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
000000000000000051.(text format).
Amount field should be in number format so that totalling is possible .
So I need some cells in text format and some in number format.
Please suggest a sloution.
Thanks in advance,
Regards,
vidyulatha.Uhttps://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
hope this helps. -
Thanks to those that responded to my previous E-Mail on how to get the
Forte project & class generated. This worked great!! I'm able to start
Word and create documents, etc.Thanks!
Now I'm having a problem calling an OLE method that were generated. I
have a project called Word and a class called Application of type
CDispatch. The Application class has a method called "Insert" on it. I
want to be able to start a Word document and then insert some text into
it from Forte. When I try to call this method I get the following error:
SYSTEM ERROR: Error during Invoke; status code:
-2147352565(0x8002000B)
Class: OLEException
Last TOOL statement: method CDispatch.Invoke
Error Time: Wed Mar 12 15:55:09
Exception occurred (locally) on partition "Forte_cl0_Client",
(partitionId = 6C32C516-7616-11D0-B5DD-EE36DFEAAA77:0x8ff:0x1,
taskId
= [6C32C516-7616-11D0-B5DD-EE36DFEAAA77:0x8ff:0x1.4]) in
application
"Forte_cl0", pid 149 on node SCURD01-1 in environment
CentralEnv.
Here's my code:
tWordApplication : Word.Application = new();
when <wNewDocumentButton>.click do
<YourDocument>.CreateEmbeddedObjectFromProgId(
cacheFile = tCacheFileName,
progId = 'Word.Document');
tWordApplication.ObjectReference = <YourDocument>.OleObjectReference;
tWordApplication.Insert( 'This is a test' ); <==== this is the line
getting the error
Since I've never worked with OLE & am not that familiar with how it
works, any suggestions/comments are greatly appreciated.
Doug Scurr
Senior Technologist - Application Development
Piper Jaffray Companies
612-342-1748
[email protected]
Thanks,
DougI'm afraid we have to make it work for NT, 95 and probably 98 too, so we're
looking for something a bit more robust than the environment variable.
Thanks,
Tim Sawyer
PanCredit
Leeds, UK.
From: Daniel Nguyen[SMTP:[email protected]]
Reply To: [email protected]
Sent: 07 May 1999 20:40
To: Tim Sawyer
Cc: '[email protected]'; '[email protected]'
Subject: Re: Calling Windows API from Tool
Hi,
If it's only for the UserName on NT you can get the environment variable
USERNAME.
Hope this helps,
Daniel Nguyen
Freelance Forte Consultant
Url : http://perso.club-internet.fr/dnguyen/
Tim Sawyer a écrit:
Hi George,
I think you need to find out which Windows DLL implements the functionand
then wrapper it, using Forté's C Wrappering technique. I'm going to be
doing this for the GetUserName() function, so we can login to our
application automatically, using the username that the user logged intoNT
with.
Hope this helps!
Tim Sawyer
PanCredit
Leeds, UK.
From: Aberdour George <[email protected]>
Date: Thu, 6 May 1999 09:08:03 +1000
Subject: Calling Windows API from Tool
Hi,
Does anyone know how to call Windows API calls such as WinExec,
CreateProcess, RegSetValue, etc directly from TOOL ?
These are just examples calls. I know some Windows API calls can be
called
via equivalent OperatingSystem method calls, but I would really like toknow
if it is possible to call Windows API routines directly.
Thanks in advance,
George Aberdour
TAFE NSW-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Create a Word document in a OLE container, save it in a BLOB and display it in a rep!
When im saving a worddoc like a OLE container in a BLOB and trying to display it in a report the text does not look exactly like it did in word. What i happening whit the doc while saving it into the BLOB and tryning to display it in another OLE container?
Best Regards
Fredrik HammarqvistYou might want to add a browser layer over your flex
application and let the browser manage the file types. I personally
use the HTML component from
http://drumbeatinsight.com/. -
Ignoring Optional parameter during OLE method calling
Hi guys,
I got a problem:
Application.Workbooks.OpenXML(Filename, Stylesheets, LoadOption) here's a defination from Microsoft help.
Stylesheets and LoadOption are optional parameters.
ABAP calling:
CALL METHOD OF workbooks 'OpenXML'
EXPORTING #1 = filename
#2 = '3'
#3 = 2 .
How can ignore parameter #2(Stylesheets) in the calling statement? I found no documentation about calling functions ignoring some optional parameters. Normaly there's posibility to explicitely define passing parameter, for example:
Application.Workbooks.OpenXML _
Filename:="customers.xml", _
LoadOption:=xlXmlLoadImportToList
With kind regards
Long.UP
-
OLE objects and OO methods - Error using OLE automation
Hi,
I'm developing an class to read/write excel sheets and i'm getting an error on the OLE method that is:
on this instruction
call method of l_obj_excel 'WORKBOOKS' = l_workb_col.
i got a dump that give me the following error UC_OBJECTS_NOT_CONVERTIBLE
The strange is that i've got the same code running on reports and it works fine only when passing it to a oo method i get that dump.
Thzs in advanced to all
Best regards
Jaimehi check this..
Report ZMULTICOLOR_TEST no standard page heading.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
include ole2incl.
handles for OLE objects
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
h_c type ole2_object. " color
DATA: FILENAME LIKE RLGRAP-FILENAME.
tables: spfli.
data h type i.
table of flights
data: it_spfli like spfli occurs 10 with header line.
*& Event START-OF-SELECTION
start-of-selection.
read flights
select * from spfli into table it_spfli.
display header
uline (61).
write: / sy-vline no-gap,
(3) 'Flg'(001) color col_heading no-gap, sy-vline no-gap,
(4) 'Nr'(002) color col_heading no-gap, sy-vline no-gap,
(20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
(20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
(8) 'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
uline /(61).
display flights
loop at it_spfli.
write: / sy-vline no-gap,
it_spfli-carrid color col_key no-gap, sy-vline no-gap,
it_spfli-connid color col_normal no-gap, sy-vline no-gap,
it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
endloop.
uline /(61).
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
set property of h_excel 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls' .
PERFORM ERR_HDL.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 200 'Carrier id'(001).
perform fill_cell using 1 2 1 200 'Connection id'(002).
perform fill_cell using 1 3 1 200 'City from'(003).
perform fill_cell using 1 4 1 200 'City to'(004).
perform fill_cell using 1 5 1 200 'Dep. Time'(005).
loop at it_spfli.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
if it_spfli-carrid cs 'AA'.
perform fill_cell using h 1 0 000255000 it_spfli-carrid.
elseif it_spfli-carrid cs 'AZ'.
perform fill_cell using h 1 0 168000000 it_spfli-carrid.
elseif it_spfli-carrid cs 'JL'.
perform fill_cell using h 1 0 168168000 it_spfli-carrid.
elseif it_spfli-carrid cs 'LH'.
perform fill_cell using h 1 0 111111111 it_spfli-carrid.
elseif it_spfli-carrid cs 'SQ'.
perform fill_cell using h 1 0 100100100 it_spfli-carrid.
else.
perform fill_cell using h 1 0 000145000 it_spfli-carrid.
endif.
if it_spfli-connid lt 400.
perform fill_cell using h 2 0 255000255 it_spfli-connid.
elseif it_spfli-connid lt 800.
perform fill_cell using h 2 0 077099088 it_spfli-connid.
else.
perform fill_cell using h 2 0 246156138 it_spfli-connid.
endif.
if it_spfli-cityfrom cp 'S*'.
perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
elseif it_spfli-cityfrom cp 'N*'.
perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
else.
perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
endif.
if it_spfli-cityto cp 'S*'.
perform fill_cell using h 4 0 200200200 it_spfli-cityto.
elseif it_spfli-cityto cp 'N*'.
perform fill_cell using h 4 0 000111222 it_spfli-cityto.
else.
perform fill_cell using h 4 0 130230230 it_spfli-cityto.
endif.
if it_spfli-deptime lt '020000'.
perform fill_cell using h 5 0 145145145 it_spfli-deptime.
elseif it_spfli-deptime lt '120000' .
perform fill_cell using h 5 0 015215205 it_spfli-deptime.
elseif it_spfli-deptime lt '180000' .
perform fill_cell using h 5 0 000215205 it_spfli-deptime.
else.
perform fill_cell using h 5 0 115115105 it_spfli-deptime.
endif.
endloop.
EXCEL FILENAME
CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
free object h_excel.
perform err_hdl.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold col val.
call method of h_excel 'Cells' = h_zl
exporting
#1 = i
#2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'Color' = col.
perform err_hdl.
endform. "FILL_CELL
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
form err_hdl.
if sy-subrc <> 0.
write: / 'OLE-Automation Error:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL
regards,
venkat -
Not able to properly Save OLE Storage to .docx format.
Hi,
We have legacy C++ code that would embed word .doc files using OLE and save them back to .doc disk based files whenever necessary.
This code does not now work with .docx(.xlsx to that matter).
I am aware that old .doc files are Structured Storage files whereas the latest .docx are zipped xml files.
I am attaching code that would create an OLE storage out of .docx file and save it back to .docx.
When opening the saved .docx file, an error message pops in WinWord indicating that the file is corrupted and that it can repair that file. It works after word repairs the file. But Excel cannot even repair such .xlsx files.
Further, the saved OLE storages are well displayed in our application(in place editing for embedded files).
Can any one suggest what needs to be done?
the following is a sample code.
void CreateStorage()
HRESULT hr = S_OK;
WCHAR filePath[] = L"E:\\Sample.docx";
OleInitialize(NULL);
DWORD renderopt = OLERENDER_FORMAT;
FORMATETC formatEtc;
formatEtc.cfFormat = CF_ENHMETAFILE;
formatEtc.dwAspect = DVASPECT_CONTENT;
formatEtc.lindex = -1;
formatEtc.ptd = NULL;
formatEtc.tymed = TYMED_ENHMF;
LPSTORAGE m_pSrcStorage = NULL; // Pointer to the source storage
IOleObject *pObj = NULL;
ILockBytes *pLockBytes = NULL;
CLSID clsID;
hr = StgCreateStorageEx(NULL, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
STGFMT_DOCFILE, 0, NULL, NULL, IID_IStorage, (void **)&m_pSrcStorage);
hr = OleCreateFromFile(CLSID_NULL, filePath, IID_IOleObject, renderopt,
&formatEtc, 0, m_pSrcStorage, (void**)&pObj);
IPersistStorage* pPersist = NULL;
hr = pObj->QueryInterface(IID_IPersistStorage, (void**)&pPersist);
if (pPersist != 0)
// Sample code to test OleSave. hr fails due to Access Denied
hr = OleSave(pPersist, m_pSrcStorage, FALSE);
pPersist->Release();
// Debugging code to know the CLSID of the document
pObj->GetUserClassID(&clsID);
unsigned long mytempdata = clsID.Data1;
LPSTORAGE pOleStorage = NULL;
hr = pObj->QueryInterface(IID_IStorage, (void**)&pOleStorage);
if (pOleStorage != NULL)
pOleStorage->Release();
WCHAR newFilePath[] = L"E:\\TestMe.docx";
DWORD STORAGE_OPEN_MODE = STGM_READWRITE | STGM_CREATE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE;
LPSTORAGE pNewStorage = NULL;
hr = ::StgCreateStorageEx(newFilePath, STORAGE_OPEN_MODE, STGFMT_DOCFILE,
0, NULL, NULL, IID_IStorage, (void **)&pNewStorage);
hr = m_pSrcStorage->CopyTo(0, NULL, NULL, pNewStorage);
hr = pNewStorage->Commit(STGC_DEFAULT);
if (pLockBytes != NULL)
pLockBytes->Release();
pNewStorage->Release();
m_pSrcStorage->Release();
pObj->Release();
OleUninitialize();Hi Phani,
As far as I know,only the Office 97-2003 binary file formats use the Windows Structured Storage APIs. Please refer to this KB article:
https://support.microsoft.com/kb/840817?wa=wsignin1.0
And the .docx file should be Office Open XML Formats which do not support Windows Structured Storage APIs.
If you want to manipulate .docx documents using Visual C++, please think about MS Office OLE Automation APIs.
http://www.codeproject.com/Articles/34998/MS-Office-OLE-Automation-Using-C
Also please check this : Sample code for creating a DOCX file. But these sample is written by C#.
http://blogs.msdn.com/b/brian_jones/archive/2006/06/29/651190.aspx
http://blogs.msdn.com/b/dmahugh/archive/2006/06/26/647859.aspx
Best regards,
Shu Hu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
BAPI_ALM_ORDER_MAINTAIN error "BAPI call must have a SAVE or DIALOG method"
I have this test code below that I have written to update the work duration on a work order to 5 hours using the BAPI BAPI_ALM_ORDER_MAINTAIN. I however keep getting the error "BAPI call must have a SAVE or DIALOG method". Can someone tell me what I am doing wrong
data: begin of it_methods occurs 0.
include structure bapi_alm_order_method.
data: end of it_methods.
data: begin of it_operation occurs 0.
include structure bapi_alm_order_operation.
data: end of it_operation.
data: begin of it_operation_up occurs 0.
include structure bapi_alm_order_operation_up.
data: end of it_operation_up.
data: begin of it_return occurs 0.
include structure bapiret2.
data: end of it_return.
data: begin of it_et_numbers occurs 0.
include structure bapi_alm_numbers.
data: end of it_et_numbers.
it_methods-refnumber = '0000040000020010'.
it_methods-objecttype = 'OPERATION'.
it_methods-method = 'CHANGE'.
it_methods-objectkey = '0000040000020010'.
append it_methods.
it_operation-duration_normal = '5'.
append it_operation.
it_operation_up-duration_normal = 'X'.
append it_operation_up.
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_methods = it_methods
it_operation = it_operation
it_operation_up = it_operation_up
return = it_return
et_numbers = it_et_numbers.
call function 'BAPI_TRANSACTION_COMMIT'
IMPORTING
RETURN = it_return.
Edited by: Martin Kay on Mar 5, 2009 2:17 PMhello martin
u have to use the save method for saving the contents
in mehtod tabel u have to add method as save
if ur method internal table is it_method then
it_method-method = 'save'.
append it_method .
and also in ur bapi code u have assigned wrong reference number
reference number always should start from 1
it_methods-refnumber = '0000001'
not '0000000400123' which u have used for order number
and after call of bapi u have to call
bapi_transaction_commitn which u have used
hope it solves ur problem -
Saving excel file as .csv via OLE program
Hi all,
in my abap OLE program i'd like to save an excel file as .csv file with ";" separator according to the frontend settings. Unfortunately the file is saved with "," separator (and not ";").
Here is the code:
<<...
call method of e_newappl 'SAVEAS'
exporting
#1 = path
#2 = '23' ....>>
I also tried 6, 22, 24 as #2 parameter values, with the same result. Running the program in differents workstations (all with ";" separator in the general settings) sometimes i get a file with ";" and sometimes with ",".
Is there a way to always get the .csv file with ";"? Or at least to check what separator will be used?
Thanks for replies.hi,
please check this similar thread for the answer
Sample code to download data to .CSV file using OLE method
thanks -
IDoc creation on save and change of production order
I am looking for a way to create, and send if possible (if not I'll send with a batch job), on the save (creation and change) of production orders. This will be a modified LOIPRO iDoc. Currently we have a customer exit on the save of the production order but because it is before the save we must predict the number of the prod order. This has worked but now we are creating one production order per line item in a sales order (automatically) so this is causing us to predict the same production order number twice. We need a way to automatically create and send an iDoc for all production orders for given plants. Right now the solution we are looking at is creating an output type and running through those output types a few times a day, sending them down to the Shop Floor system (proprietary system).
Is there anything setup in SAP that we can utilize?
Regards,
DavisHi Rick,
Follow the below sample steps for changing component quantity:
DATA:
l_methods TYPE bapi_alm_order_method,
it_boperations TYPE STANDARD TABLE OF bapi_alm_order_operation_e WITH HEADER LINE,
it_components TYPE STANDARD TABLE OF bapi_alm_order_component_e WITH HEADER LINE,
it_components1 TYPE STANDARD TABLE OF bapi_alm_order_component WITH HEADER LINE.
1. Call BAPI :BAPI_ALM_ORDER_GET_DETAIL , it will give existing order component details.
CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
EXPORTING
number = <production order number>
TABLES
et_operations = it_boperations
et_components = it_components
return = it_bapiret2.
2. Move it_components to components table compatibel to BAPI "BAPI_ALM_ORDER_MAINTAIN".
LOOP AT it_components.
MOVE-CORRESPONDING it_components TO it_components1.
_*"Note here while moving change the component quantity"*_
APPEND it_components1.
CLEAR it_components1.
ENDLOOP.
3. Build the methods table for change production order :
it_methods-refnumber = v_refnumber.
it_methods-objecttype = 'COMPONENT'.
it_methods-method = 'CHANGE'.
it_methods-objectkey = v_objectkey.
APPEND it_methods.
"Note v_refnumber has 1 to 1 relation ship with the components table, if you want to change First component in it_components1 then you have to enter value '1' here for v_refnumber.
it_methods-method = 'SAVE'.
APPEND it_methods.
4 . Call
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods
it_component = it_components1
return = it_bapiret2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. -
ABAP OLE Word - Delete last page
Dear all,
I have a SAP program which prints some documents in Microsoft Word by using ABAP OLE Objects.
I use a template to take the main context, and after that I send some variables in order to populate the word document.
The problem is when I create the new word document, I paste the template text in a new document, but at the end I have always an empty page. I don't know how to delete this final page, I don't find the corresponding OLE method to do it.
I have found a method to cut a line, but the problem is that line is also empty, and I cannot cut it.
Could anyone help me?
Many thanks in advance and best regards.Hi,
post some code lines. Format as code, use preview.
Regards,
Clemens -
Ole excel application from abap
Hi all ,
I an calling one excel application from abap . I don't want to make excel file visible , but insted want to save and close the file , by using method
saveas for excel application and later i want to see the file . file name i want to store in a variable .
eg :
CALL METHOD OF H_EXCEL 'FILESAVEAS' = RC
EXPORTING #1 = filename .
Can it be possible ?
regards,
SAhi
i simpler method will be to use the function modules for this purpose.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
file_name = file_name .
lc_filename = file_name.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = lc_filename
filetype = 'DAT'
TABLES
data_tab = gt_itab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Fn module F4_filename will prompt for the name of the file to be saved and GUI_DOWNLOAD will save the file.
gt_itab is the internal table containing the data to be stored in excel.
Maybe you are looking for
-
Receiving Open Interface not picking Inter-Org records from Interface
Hi, I am trying to receive the inter org transfer through the Receiving Open interface, but the interface not picking the data from the interface tables (RCV_HEADERS_INTERFACE, RCV_TRANSACTION_INTERFACE). I am in 11.5.10.2, all the sources worked fin
-
Storing Orders into Site using streamWriter Class in c# getting Error
Hi, I am using streamWriter class to write orders into text file.It's working.,But not my client asking to change site URL to store orders into that site. I need to save orders into below path: https://SP2010.org/Departments/Community/Communicati
-
Exception in newInstance in windows NT (CORBA persistent server)
I have used this code for CORBA persistent server....its working fine in Solaris OS ,but getting exception in newInstance call in the following code.Code fragment and Exception are given below,....pls help private org.omg.PortableServer.Servant loadM
-
Emergency Access request (Fire Fighter)
Dear Experts, I am configuring SPM 10.0, I have assigned FF role to the FFID in the backend system. I have configured connectors between GRC system and ERP system. After running GRAC_ROLEREP_USER_SYNC I am getting below error. Processing for connecto
-
No name screen display receiving texts
Hi When I receive CALLS, the name in the Phonebook appears on the screen. But when I receive TEXTS then only the number appears. Can anyone tell me what I'm doing wrong please? I want the name to appear in both cases. The Phonebook is on the simcard.