Clear clipboard
My work involves a lot of bouncing back and forth between finder and PS. I also do a lot of large cut/paste operations in actions.
Most of the time, when I click on a finder window (or anything else) PS kicks up a message that it was unable to export the clipboard. This is irritating enough, but then after a couple seconds in finder, PS will force itself (and all its documents) back to the foreground.
Is there a way to suppress this message? Or is there a way to clear the clipboard that I can put at the end of my actions?
Cliff
You can turn "export clipboard" off - its in the first pane, General Preferences. Its pointless to have it on, UNLESS you know that you will be copying and pasting into other apps, so its standard practice to turn it off these days.
Similar Messages
-
[SOLVED] Can't clear clipboard in KDE
I wanted to erase the clipboard in Klipper, the popup window asked if I am sure, I checked that "Don't ask again" tick, and accidentally clicked on No.
now I can't erase the clipboard, as the "Clear clipboard history" doesn't do anything anymore...
how can I reset this?
Last edited by Lenry (2012-06-21 11:13:28)arojas wrote:Remove the [Notification Messages] section in ~/.kde4/share/config/klipperrc and restart klipper
it worked, thank you -
Help with Automator to Clear Clipboard
This posting is for Terence Devlin because his email address is not available. I really
appreciated your postings on how to create a Services option to send iPhotos to
Apple Mail and this got me started on using the Automator.
I have a very simple AppleScript that I need to use all the time to clear the clipboard
and I would like to have it show up under the Services menu using Automator.
The simple AppleScript is
tell application "System Events" to set the clipboard to ""
For reasons I don't understand my OS X sometimes fails to clear the clipboard after
a paste action. You cannot add a new item until the old item is cleared
Apple used to have a Finder Clear Clipboard command but is became history.
Can this easy AppleScrip be converted to Automator format?But why do you need to clear the clipboard? Surely copying something
new to the cipboard overwrites what was there?
I agree that something new should overwrite the clipboard but sometimes
mine does not clear on paste. It something is on the clipboard, you cannot
write to the clipboard. Apple used to have a menu item in the Finder to
clear the Clipboard and it is no longer there.
Thank you again.
BTW, I changed the name of your Send via Mail to Send iPhoto via Mail because
my wife was trying use it from Safari to send a picture to someone. -
Illustrator copy/paste does not clear clipboard
I am running OSX Yosemite, and latest version of Illustrator.
I have a file, which has multiple artboards and symbols.
When I am copying text and pasting it into another text placeholder, it pastes all text previously copied on the clipboard. So, first copy/paste works fine, but all the times after this include a lot of text from previous paste attempts. It looks like, Illustrator is not clearing the clipboard when copying text into it.
Also, pasting in text from Mac TextEdit doesn't seem to work.
This feels a lot like a bug, and really slows me down. Are there some sort of settings for the clipboard, or other ways to get rid of this feature?drawnworder,
If no brighter solutions appear, you may try the list.
The following is a general list of things you may try when the issue is not in a specific file (you may have tried/done some of them already); 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
If possible/applicable, you should save current artwork first, of course.
1) Close down Illy and open again;
2) Restart the computer (you may do that up to at least 5 times);
3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
Even more seriously, you may:
6) Uninstall, run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
http://www.adobe.com/support/contact/cscleanertool.html -
Compiled Visual Studio Express 2013 clears clipboard...
Hi,
I have a Winforms program that saves a password to the clipboard before going to a web site with "System.Diagnostics.Process.Start(URL)"....
This routine has worked perfectly for a long time, and still works now if I build and run the program from the VS environment...but, it seems to clear the clipboard from the compiled executable. In other words, I can't paste the previously saved password
into the password field on the website. Also, I can't paste it into anything (like Notepad). The clipboard seems to have been cleared out.
I tested the 'paste' function by copying something else after the website is already loaded, and paste works fine...because it has something to paste.
Has anyone run into this problem? I recently updated to Windows 8.1 from Windows 8. I thought maybe the bug was in Windows 8.1, but Cut, copy, paste works fine until I try to use my compiled program.
Suggestions?
BobHi Carl,
Problem Solved! I suspected a security program I also installed at the same time I updated Windows to 8.1.
I installed Webroot, a highly recommended security tool, malware scanner, and firewall. I uninstalled it and PRESTO!
Everything works fine again! Now I have to speak to the Webroot people and find out why they are preventing me from using my clipboard correctly.After I did that, I noticed you mentioned above about security tools, etc. And you were right.
Thanks for all your help, Carl. I really appreciate it......Bob
Hello,
Glad that you have solved your issue.
Indeed, the way checking security tools was suggested by
Sheng Jiang 蒋晟.
Regards.
Carl
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. -
As the title says, how do i clear the clipboard while scripting with copy/paste functions?
Because i am affraid for crashes because too much items are on the copy buffer
Thanks.deselect all and copy
app.activeDocument.selection = null;
app.copy(); -
Win 7 Clipboard clears contents when opening a new application or window
There are similar posts on this issue, but I see none with a satisfactory fix.
I have a brand new Dell Laptop, running Win 7 Pro 64-bit SP1.
If I copy anything to the Clipboard, it works fine *IF* where I want to paste it is already open.
However, If after I copy, I do ANYTHING in between, the clipboard is cleared out.
Examples: I'm in an Email (MS Outlook, Office 10) and copy a string of text from the body of the email.
I then open a new email, and attempt to Paste it, the clipboard is empty.
However, if I open the New email First, then go to the existing email and do the copy,
It pastes in Fine if I just flip directly to the already open new email.
This behavior is not limited to Outlook, Office, or even any Microsoft products.
I could try the same sequence of events from Chrome browser to Evernote for example. If Evernote is already open it works.
If I have to open Evernote after doing the copy, the Clipboard clears. Same is true for ANY 2 applications on the PC.
System File Checker finds no errors, and I didn't expect it to as the clipboard does work as long as everything is already open.
Thanks in Advance for your help.Hi,
As I known, some memory management softwares WILL clear the clipboard queue every time it engages. Check to be sure you do not have any kind of memory management or RAM MANAGER type of software loaded.
If so, remove it or disable the option to clear clipboard catch.
For the similar issues, you can refer to this thread and check other suggestions:
http://social.technet.microsoft.com/Forums/windows/en-US/5bbc11e8-ca2d-41ac-b640-d66ce971f58f/copy-paste-clipboard-issues-not-working
Kate Li
TechNet Community Support -
Good day to all genies. I am working on a mini-project in which I have to perform mark and sweep of garbage objects from recognizing the clipboard status. I hereby seek your attention in the problem as to how exactly to find whether something (image, text or anything) is present in the clipboard (Toolkit.getDefaultToolKit().getSystemClipboard() - how to check the contents in it as checking it for "null" is not helpful since transferrable object is returned which is not null). My second element of doubt is , if the clipboard is cleared from some other application (for eg, office- ms word - view -toolbar - clipboard- Clear clipboard), is providing a "TIMER" and listening to it in our program is the only way , or is there a more sophisticated and neat rouund about for this? Please do help.
Thanks.Not Sure if this'll help not being of the noble Djinn;
However this tells me when the data I placed on The Clipboard is gone...
public class PicTransfer implements Transferable, ClipboardOwner
//blah and etcetera
public void lostOwnership(Clipboard clipboard, Transferable contents)
System.out.println("Lost Ownership"); // data is gone
}used in conjunction with something like:
public void setContents(Transferable contents,
ClipboardOwner owner)And that fires up whenever the lostownership happens... -
Excel 2010 Synchronize List with SharePoint List using VBA
I have used and loved the interaction between Excel and SharePoint for many generations of both solutions. It's a wonderful opportunity to integrate the familiarity and simplicity of Excel (formatting, ease of use, availability) with the data storage
and centralized list capabilities of SharePoint. Right?
When upgrading to Excel 2010, I have noticed with much dismay that much of the inherent easy to use features of previous versions were effectively stripped from this newest version. Much research, time and energy has been spent working around and resolving
the deficiency. One Microsoft based article,
http://support.microsoft.com/kb/930006, has provided the mechanics behind utilizing the "hidden" functionality... although, this capability to use VBA to create the synchronized list was available in previous versions. However, once Microsoft
published this article to this "hidden" functionality... I feel that the behavior should be supported by Microsoft in some way. OK?
Revised instructions to reproduce the problem:
1. Create a SharePoint list with 20 dummy records.
- Note the List Name ##LIST_NAME##
- Note the View GUID ##VIEW_GUID##
- Note SharePoint Base URL ##BASE_URL##
2. REVISED... In Excel 2010, save the file as Compatible "Excel 97-2003 Workbook". Close the file and reopen. Create a connected table (ListObject) in Excel using the article above to the SharePoint list. Use Sample VBA code
below:
Sub LinkedSharePointList()
ActiveSheet.ListObjects.Add SourceType:=xlSrcExternal,_
Source:=Array(##BASE_URL## & "/_vti_bin", ##LIST_NAME##, _
##VIEW_GUID##), LinkSource:=True, Destination:=Range("A1")
End Sub
3. OOPS REVISED this item. The problem is actually with ROW 21... So, update record on row 21... (no matter where the table is located... (if the "Destination" is "A1", then the problem is with ID=20, but if the Table is
shifted down to say A12, then ID=9 on row 21). Anyway... make a simple change to that record... and you'll see the ID immediately change.... as if it's a NEW record. WEIRD! Note: If the sheet is protected, then an error is displayed
indicating that a "read-only" record cannot be updated (referring to the ID cell in column A for the current row).
4. Now "synchronize" the list with excel. The former record is still in the list unchanged AND there is a NEW record in the list holding the changes. There are a number of problems that seem to ONLY occur when something changes to ROW
21.... Next, try to copy/paste multiple records across multiple rows that intersect with ROW 21. Yikes!!
I look forward to hearing others' experience!
Thanks!
MarkHere are some things that you can try (change the code, where appropriate):
Private Sub CreateList()
Dim folder As folder
Dim f As File
Dim fs As New FileSystemObject
Dim RowCtr As Integer
RowCtr = 1
Set folder = fs.GetFolder("http://excel-pc:43231/Shared Documents/Forms/") '<=Variable Location
For Each f In folder.Files
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
Next f
End Sub
Sub ListAllFile()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim pth As String
Dim WBn As Workbook
Dim ObCount As Long
Dim FileNme As String
Application.ScreenUpdating = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("\\excel-pc:43231\Shared Documents\Forms\")
'** You'll need to specify your path here. By removing the http: from the path, the code liked it & found the folder. It wasn’t working previously ***
pth = "http://excel-pc:43231/Shared Documents/Forms/"
'** You'll need to specify your path here. The reason I’ve done this separately is because the path is not recognised otherwise when trying to specify it with workbook.open & using the value set for objFolder **
ObCount = objFolder.Files.Count
'** counts the number of files in the folder
'Loop through the Files collection
For Each objFile In objFolder.Files
Nm1 = Len("http://excel-pc:43231/Shared Documents/Forms/")
'** You'll need to specify your path here **
Nm2 = Len(objFile) - Nm1
FileNme = Right(objFile, Nm2)
'** I’ve done this part to find out/set the file name**
Set WBn = Workbooks.Open(pth & FileNme, , , , Password:="YourPassword")
'** opens the first file in the library – if there is no password, the remove everything from - , , , , Password:="Password1" – leaving the close bracket ‘)’
Application.ScreenUpdating = False
'** optional – you can leave the screen updating on
'<< Your coding here>>
'** The file is now open. Enter whatever code is specific to your spreadsheets.
Next
'** goes to next file within your sharepoint folder
End Sub
Sub SharePoint()
Dim xlFile As String, xlFullFile As String
Dim xlApp As Excel.Application
Dim wb As Workbook
xlFile = "\\excel-pc:43231\Shared Documents"
'http://excel-pc:43231/Shared Documents/
'****----denotes the path.(i.e) u give the path as windows search.Don't use "\" at the end.
'In the sharepoint path %20 denotes space.so u remove that and use space .
Set xlApp = New Excel.Application
xlApp.Visible = True
xlFullFile = GetFullFileName(xlFile, "Book") 'ANZ denotes starting characters of the file.
xlFile = xlFile & "\" & xlFullFile
Set wb = xlApp.Workbooks.Open(xlFile, , False)
'Once the workbook is opened u can do ur code here
wb.Close False
End Sub
Function GetFullFileName(strfilepath As String, _
strFileNamePartial As String) As String
Dim objFS As Variant
Dim objFolder As Variant
Dim objFile As Variant
Dim intLengthOfPartialName As Integer
Dim strfilenamefull As String
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(strfilepath)
'work out how long the partial file name is
intLengthOfPartialName = Len(strFileNamePartial)
For Each objFile In objFolder.Files 'Instead of specifying the starting characters of the file you can directly loop through all files in the folder .
'Test to see if the file matches the partial file name
If Left(objFile.Name, intLengthOfPartialName) = strFileNamePartial Then
'get the full file name
strfilenamefull = objFile.Name
Exit For
Else
End If
Next objFile
Set objFolder = Nothing
Set objFS = Nothing
'Return the full file name as the function's value
GetFullFileName = strfilenamefull
End Function
Sub SrchForFiles()
' Searches the selected folders and sub folders for files with the specified (xls) extension.
'ListTheFiles 'get the list of all the target XLS files on the SharePoint Directory
Dim i As Long, z As Long, Rw As Long, ii As Long
Dim ws As Worksheet, dd As Worksheet
Dim y As Variant
Dim fldr As String, fil As String, FPath As String
Dim LocName As String
Dim FString As String
Dim SummaryWB As Workbook
Dim SummaryWS As Worksheet
Dim Raw_WS As Worksheet
Dim LastRow As Long, FirstRow As Long, RowsOfData As Long
Dim UseData As Boolean
Dim FirstBlankRow As Long
'grab current location for later reference, for where to paste final data
Set SummaryWB = Application.ActiveWorkbook
Set SummaryWS = Application.ActiveWorkbook.ActiveSheet
y = "xls"
fldr = "\\excel-pc:43231\Shared%20Documents\Forms\AllItems.aspx"
FirstBlankRow = 2
'asd is a 1-D array of files returned
asd = ListFiles(fldr, True)
Set ws = Excel.ThisWorkbook.Worksheets(1) 'list of files
ws.Activate
ws.Range("A1:Z100").Select
Selection.Clear
On Error GoTo 0
For ii = LBound(asd) To UBound(asd)
Debug.Print Dir(asd(ii))
fil = asd(ii)
'open the file and grab the data
Application.Workbooks.Open (fil), False, True
'Get file path from file name
FPath = Left(fil, Len(fil) - Len(Split(fil, "\")(UBound(Split(fil, "\")))) - 1)
'Get file information
If Left$(fil, 1) = Left$(fldr, 1) Then
If CBool(Len(Dir(fil))) Then
z = z + 1
ws.Cells(z + 1, 1).Resize(, 6) = _
Array(Dir(fil), LocName, RowsOfData, Round((FileLen(fil) / 1000), 0), FileDateTime(fil), FPath)
DoEvents
With ws
.Hyperlinks.Add .Range("A" & CStr(z + 1)), fil
'.FoundFiles(i)
End With
End If
End If
'Workbooks.Close 'Fil
Application.CutCopyMode = False 'Clear Clipboard
Workbooks(Dir(fil)).Close SaveChanges:=False
Next ii
With ws
Rw = .Cells.Rows.Count
With .[A1:F1]
.Value = [{"Full Name","Location","Rows of Data","Kilobytes","Last Modified", "Path"}]
.Font.Underline = xlUnderlineStyleSingle
.EntireColumn.AutoFit
.HorizontalAlignment = xlCenter
End With
.[G1:IV1 ].EntireColumn.Hidden = True
On Error Resume Next
'Range(Cells(Rw, "A").End(3)(2), Cells(Rw, "A")).EntireRow.Hidden = True
Range(.[A2 ], Cells(Rw, "C")).Sort [A2 ], xlAscending, Header:=xlNo
End With
End Sub
Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _
As String()
Dim fso As New Scripting.FileSystemObject
Dim fld As Scripting.folder
Dim fileList As String
' get the starting folder
Set fld = fso.GetFolder(Path)
' let the private subroutine do all the work
fileList = ListFilesPriv(fld, NestedDirs)
' (the first element will be a null string unless the first ";" is removed)
fileList = Right(fileList, Len(fileList) - 1)
' convert to a string array
ListFiles = Split(fileList, ";")
End Function
' private procedure that returns a file list
' as a comma-delimited list of files
Function ListFilesPriv(ByVal fld As Scripting.folder, _
ByVal NestedDirs As Boolean) As String
Dim fil As Scripting.File
Dim subfld As Scripting.folder
' list all the files in this directory
For Each fil In fld.Files
'If UCase(Left(Dir(fil), 5)) = "MULTI" And fil.Type = "Microsoft Excel Worksheet" Then
If fil.Type = "Microsoft Excel Worksheet" Then
ListFilesPriv = ListFilesPriv & ";" & fil.Path
Debug.Print fil.Path
End If
Next
' if requested, search also subdirectories
If NestedDirs Then
For Each subfld In fld.SubFolders
ListFilesPriv = ListFilesPriv & ListFilesPriv(subfld, NestedDirs)
Next
End If
End Function
Finally . . .
Sub ListFiles()
Dim folder As Variant
Dim f As File
Dim fs As New FileSystemObject
Dim RowCtr As Integer
Dim FPath As String
Dim wb As Workbook
RowCtr = 1
FPath = "http://excel-pc:43231/Shared Documents"
For Each f In FPath
'Set folder = fs.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
'For Each f In folder.Files
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
Next f
End Sub
Sub test()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
'Set colSubfolders = objFolder.SubFolders
'For Each objSubfolder In colSubfolders
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
'Next
End Sub
Ryan Shuell -
Error on bapi_acc_document_post
Hi experts,
when i executing this bapi_acc_document_post, am getting error " FI/CO interface: Line item entered several times" i mention code below so please give me suggestion.
*& Report ZSAMPLE
REPORT ZSAMPLE.
data: BEGIN OF WA_HEADER,
ID TYPE I,
KUNNR TYPE n LENGTH 10,
INV_DATE TYPE c LENGTH 10,
PST_DATE TYPE c LENGTH 10,
REF TYPE invfo-xblnr,
AMT_DOCCUR TYPE PA2010-BETRG,
TXT(40),
END OF WA_HEADER.
DATA : IT_HEADER like WA_HEADER OCCURS 0 WITH HEADER LINE.
data: BEGIN OF WA_ITEM,
ID TYPE I,
GL_ACCOUNT TYPE n LENGTH 10,
ITEM_TEXT TYPE BAPIACGL09-ITEM_TEXT,
BUS_AREA TYPE BAPIACGL09-BUS_AREA,
AMT_DOCCUR TYPE BAPIACCR09-AMT_DOCCUR,
KOSTL TYPE CSKT-KOSTL,
* VAT(2),
END OF WA_ITEM.
DATA : IT_ITEM like WA_ITEM OCCURS 0 WITH HEADER LINE.
* value of excel-cell
TYPES: ty_d_itabvalue TYPE alsmex_tabline-value,
* internal table containing the excel data
ty_t_itab TYPE alsmex_tabline OCCURS 0,
* line type of sender table
BEGIN OF ty_s_senderline,
line(4096) TYPE c,
END OF ty_s_senderline,
* sender table
ty_t_sender TYPE ty_s_senderline OCCURS 0.
CONSTANTS: gc_esc VALUE '"'.
DATA temp_row TYPE I.
DATA TEMP(4).
INCLUDE lalsmexf01.
DATA: it_data1 TYPE ty_t_itab.
DATA: it_data2 TYPE ty_t_itab.
DATA: it_data_wa LIKE LINE OF it_data1.
DATA: it_data_wa2 LIKE LINE OF it_data1.
* DATA DECLARATION
data: st_rw_s1 TYPE i VALUE '2'.
data: st_cl_s1 TYPE i VALUE '1'.
data: st_rw_s2 TYPE i VALUE '2'.
data: st_cl_s2 TYPE i VALUE '1'.
data: ed_rw_s1 TYPE i VALUE '3'.
data: ed_cl_s1 TYPE i VALUE '7'.
data: ed_rw_s2 TYPE i VALUE '5'.
data: ed_cl_s2 TYPE i VALUE '8'.
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
TYPE-POOLS ole2.
*AT SELECTION-SCREEN.
PARAMETERS: filename LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
PERFORM value_help.
sTART-OF-SELECTION.
* CASE sy-ucomm .
* WHEN 'ONLI'.
PERFORM execute.
PERFORM bapi.
* ENDCASE.
* MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
*& Form VALUE_HELP
* text
* --> p1 text
* <-- p2 text
FORM VALUE_HELP .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
def_filename = ' '
def_path = ' '
mask = ',*.*,*.*.'
mode = 'O'
title = ' '
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 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.
ENDFORM. " VALUE_HELP
*& Form EXECUTE
* text
* --> p1 text
* <-- p2 text
FORM EXECUTE .
* PARAMETER CHECK
IF st_rw_s1 > ed_rw_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s1 > ed_cl_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_rw_s2 > ed_rw_s2.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s2 > ed_cl_s2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
workbook
'Open'
EXPORTING
#1 = filename.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* MARKING OF WHOLE SPREADSHEET
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s1
#2 = st_cl_s1.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s1
#2 = ed_cl_s1.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy marked area (SHEET1) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab it_data1
USING ld_separator.
* Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
* Working in Second Excel Work Sheet
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 2.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* Mark Sheet2
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s2
#2 = st_cl_s2.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s2
#2 = ed_cl_s2.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy Marked Area (Sheet2) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read Clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab1
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab1 it_data2
USING ld_separator.
* Clear Clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab1
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
* Leaving Application
CALL METHOD OF
application
'QUIT'.
m_message.
FREE OBJECT application.
m_message.
LOOP AT it_data1 INTO it_data_wa2.
IF temp_row ne it_data_wa2-ROW AND temp_row IS NOT INITIAL.
temp_row = it_data_wa2-ROW.
APPEND IT_HEADER.
ELSE.
temp_row = it_data_wa2-ROW.
ENDIF.
CASE it_data_wa2-COL.
WHEN '0001'.
IT_HEADER-ID = it_data_wa2-VALUE.
WHEN '0002'.
IT_HEADER-KUNNR = it_data_wa2-VALUE.
WHEN '0003'.
IT_HEADER-INV_DATE = it_data_wa2-value.
WHEN '0004'.
IT_HEADER-PST_DATE = it_data_wa2-VALUE.
WHEN '0005'.
IT_HEADER-REF = it_data_wa2-VALUE.
WHEN '0006'.
IT_HEADER-AMT_DOCCUR = it_data_wa2-VALUE.
WHEN '0007'.
IT_HEADER-TXT = it_data_wa2-VALUE.
ENDCASE.
ENDLOOP.
APPEND IT_HEADER.
CLEAR:temp_row.
LOOP AT it_data2 INTO it_data_wa ."WHERE ROW = it_data_wa2-ROW.
IF temp_row ne it_data_wa-ROW AND temp_row IS NOT INITIAL.
temp_row = it_data_wa-ROW.
APPEND IT_ITEM.
ELSEIF ( temp_row NE it_data_wa-ROW AND temp_row IS INITIAL ).
temp_row = it_data_wa-ROW.
* ELSE
ENDIF.
CASE it_data_wa-COL.
WHEN '0001'.
IT_ITEM-ID = it_data_wa-VALUE.
WHEN '0002'.
IT_ITEM-GL_ACCOUNT = it_data_wa-VALUE.
WHEN '0003'.
IT_ITEM-AMT_DOCCUR = it_data_wa-value.
WHEN '0004'.
IT_ITEM-ITEM_TEXT = it_data_wa-VALUE.
WHEN '0005'.
IT_ITEM-BUS_AREA = it_data_wa-VALUE.
WHEN '0006'.
IT_ITEM-KOSTL = it_data_wa-VALUE.
* WHEN '0007'.
* IT_ITEM-VAT = it_data_wa-VALUE.
ENDCASE.
ENDLOOP.
APPEND IT_ITEM.
ENDFORM. " EXECUTE
*ENDLOOP.
*& Form BAPI
* text
* --> p1 text
* <-- p2 text
FORM BAPI .
DATA: it_acc_gl LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,
it_acc_ap LIKE bapiacap09 OCCURS 0 WITH HEADER LINE,
it_acc_aR LIKE bapiacaR09 OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
it_curr_amt LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,
it_doc_header LIKE bapiache09 OCCURS 0 WITH HEADER LINE,
it_acc_tax LIKE bapiactx09 OCCURS 0 WITH HEADER LINE,
obj_type LIKE bapiache09-obj_type,
obj_key LIKE bapiache09-obj_key,
obj_sys LIKE bapiache09-obj_sys,
pstng_date LIKE it_doc_header-pstng_date,
doc_date LIKE it_doc_header-doc_date,
loop_cnt TYPE i VALUE 0,
gv_vendor(10) TYPE c,
gv_gl_acc(10) TYPE c.
DATA conv_s_amt TYPE BETRG.
DATA cur_line TYPE P.
data item_no type POSNR_ACC.
data item_no1 type POSNR_ACC.
CLEAR: obj_type, obj_sys, obj_key, pstng_date, doc_date, gv_vendor, gv_gl_acc.
* CLEAR: it_doc_header,it_acc_gl,it_curr_amt,IT_ACC_AR,IT_RETURN.
LOOP AT it_HEADER INTO WA_HEADER .
REFRESH it_doc_header.
it_doc_header-bus_act = 'RFBU'.
it_doc_header-username = sy-uname.
* it_doc_header = WA_HEADER-KUNNR." Customer Number
it_doc_header-header_txt = WA_HEADER-TXT." bdc_source-col_h. " Invoice Text
it_doc_header-comp_code = 'JPOL'."bdc_source-col_a. " Company Code
CONCATENATE WA_HEADER-INV_DATE+6(4) WA_HEADER-INV_DATE+3(2) WA_HEADER-INV_DATE(2)
into it_doc_header-doc_date.
CONCATENATE WA_HEADER-pst_date+6(4) WA_HEADER-pst_date+3(2) WA_HEADER-pst_date(2)
into it_doc_header-pstng_date.
it_doc_header-doc_type = 'DR'. " Return Order...?
it_doc_header-fisc_year = '2013'. " Return Order...?
it_doc_header-fis_period = '02'. " Return Order...?
it_doc_header-ref_doc_no = '123'."bdc_source-col_d. " Invoice Number
APPEND it_doc_header.
REFRESH it_acc_aR.
it_acc_aR-itemno_acc = '1'. " Invoice Number
it_acc_aR-customer = WA_HEADER-KUNNR. " Customer Number
it_acc_aR-comp_code = 'JPOL'. " Company Code
it_acc_aR-item_text = WA_HEADER-txt. " Line Item Text
APPEND it_acc_aR.
* it_acc_aR-itemno_acc = '4'. " Invoice Number
* it_acc_aR-customer = WA_HEADER-KUNNR. " Customer Number
* it_acc_aR-comp_code = 'JPOL'. " Company Code
* it_acc_aR-item_text = WA_HEADER-txt. " Line Item Text
* APPEND it_acc_aR.
REFRESH it_acc_gl.
REFRESH IT_CURR_AMT.
* ITEM_NO = 1.
"GL Information details collected
CLEAR : ITEM_NO,item_no1.
LOOP AT it_ITEM INTO WA_ITEM where id = wa_header-ID.
ITEM_NO = ITEM_NO + 1.
it_acc_gl-itemno_acc = ITEM_NO.
it_acc_gl-gl_account = WA_ITEM-GL_ACCOUNT."gv_gl_acc. " GL Account
it_acc_gl-item_text = WA_ITEM-ITEM_TEXT. "bdc_source-col_o. " Line Item Text
it_acc_gl-doc_type = 'DR'. " Return Order...?
it_acc_gl-comp_code = 'JPOL'."bdc_source-col_a. " Company Code
it_acc_gl-bus_area = WA_ITEM-BUS_AREA."bdc_source-col_a. " Company Code
it_acc_gl-CUSTOMER = WA_HEADER-KUNNR.
conv_s_amt = WA_ITEM-AMT_DOCCUR."bdc_source-col_f. " Invoice Amount
IF conv_s_amt < 0.
it_acc_gl-de_cre_ind = 'H'. " H-Credit
conv_s_amt = - conv_s_amt.
ELSE.
it_acc_gl-de_cre_ind = 'S'. " S-Debit
ENDIF.
APPEND it_acc_gl.
ITEM_NO1 = ITEM_NO1 + 1.
it_curr_amt-itemno_acc = ITEM_NO1 . " Invoice Number
it_curr_amt-curr_type = '00'.
it_curr_amt-currency = 'INR'. " Currancy
it_curr_amt-amt_doccur = conv_s_amt . " Line Item Amount
APPEND it_curr_amt.
ITEM_NO1 = ITEM_NO1 + 1.
it_curr_amt-itemno_acc = ITEM_NO1 . " Invoice Number
it_curr_amt-curr_type = '00'.
it_curr_amt-currency = 'INR'. " Currancy
it_curr_amt-amt_doccur = conv_s_amt * -1. " Line Item Amount
APPEND it_curr_amt.
ENDLOOP.
REFRESH it_return.
"Customer Invoice
* Do the post to GL Account and AP
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = it_doc_header
IMPORTING
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = it_acc_gl
currencyamount = it_curr_amt
accountreceivable = it_acc_aR
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* Check for any errors
WRITE : obj_key.
LOOP at IT_RETURN WHERE TYPE = 'E'.
WRITE : / 'Error :', IT_RETURN-MESSAGE .
endloop.
ENDLOOP.
ENDFORM. " BAPI
Result:Hi
Thank you for your help i did small modification i mention code below
REPORT ZCUS_INVOICE.
data: BEGIN OF WA_HEADER,
ID TYPE I,
KUNNR TYPE n LENGTH 10,
INV_DATE TYPE c LENGTH 10,
PST_DATE TYPE c LENGTH 10,
REF TYPE invfo-xblnr,
PRD_TEXT TYPE BAPIACGL09-ITEM_TEXT,
CMP_CODE TYPE BAPIACGL09-COMP_CODE,
AMT_DOCCUR TYPE PA2010-BETRG,
TXT(40),
END OF WA_HEADER.
DATA : IT_HEADER like WA_HEADER OCCURS 0 WITH HEADER LINE.
data: BEGIN OF WA_ITEM,
ID TYPE I,
GL_ACCOUNT TYPE n LENGTH 10,
ITEM_TEXT TYPE BAPIACGL09-ITEM_TEXT,
BUS_AREA TYPE BAPIACGL09-BUS_AREA,
AMT_DOCCUR TYPE BAPIACCR09-AMT_DOCCUR,
KOSTL TYPE CSKT-KOSTL,
* VAT(2),
END OF WA_ITEM.
DATA : IT_ITEM like WA_ITEM OCCURS 0 WITH HEADER LINE.
* value of excel-cell
TYPES: ty_d_itabvalue TYPE alsmex_tabline-value,
* internal table containing the excel data
ty_t_itab TYPE alsmex_tabline OCCURS 0,
* line type of sender table
BEGIN OF ty_s_senderline,
line(4096) TYPE c,
END OF ty_s_senderline,
* sender table
ty_t_sender TYPE ty_s_senderline OCCURS 0.
CONSTANTS: gc_esc VALUE '"'.
DATA temp_row TYPE I.
DATA TEMP(4).
INCLUDE lalsmexf01.
DATA: it_data1 TYPE ty_t_itab.
DATA: it_data2 TYPE ty_t_itab.
DATA: it_data_wa LIKE LINE OF it_data1.
DATA: it_data_wa2 LIKE LINE OF it_data1.
* DATA DECLARATION
data: st_rw_s1 TYPE i value '2'.
data: st_cl_s1 TYPE i value '1'.
data: st_rw_s2 TYPE i value '2'.
data: st_cl_s2 TYPE i value '1'.
data: ed_rw_s1 TYPE i value '50'.
data: ed_cl_s1 TYPE i value '9'.
data: ed_rw_s2 TYPE i value '50'.
data: ed_cl_s2 TYPE i value '6'.
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
TYPE-POOLS ole2.
*AT SELECTION-SCREEN.
PARAMETERS: filename LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
PERFORM value_help.
sTART-OF-SELECTION.
* CASE sy-ucomm .
* WHEN 'ONLI'.
PERFORM execute.
PERFORM bapi.
* ENDCASE.
* MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
*& Form VALUE_HELP
* text
* --> p1 text
* <-- p2 text
FORM VALUE_HELP .
CALL FUNCTION 'DSVAS_DOC_WS_FILENAME_GET_50'
EXPORTING
def_filename = ' '
def_path = ' '
mask = ',*.*,*.*.'
mode = 'O'
title = ' '
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 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.
ENDFORM. " VALUE_HELP
*& Form EXECUTE
* text
* --> p1 text
* <-- p2 text
FORM EXECUTE .
* PARAMETER CHECK
IF st_rw_s1 > ed_rw_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s1 > ed_cl_s1.
RAISE inconsistent_parameters.
ENDIF.
IF st_rw_s2 > ed_rw_s2.
RAISE inconsistent_parameters.
ENDIF.
IF st_cl_s2 > ed_cl_s2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
workbook
'Open'
EXPORTING
#1 = filename.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* MARKING OF WHOLE SPREADSHEET
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s1
#2 = st_cl_s1.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = ed_rw_s1
#2 = ed_cl_s1.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
* Copy marked area (SHEET1) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
* Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab it_data1
USING ld_separator.
* Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
* Working in Second Excel Work Sheet
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 2.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
* Mark Sheet2
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = st_rw_s2
#2 -
Uploading Excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi,
I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
but I'm getting a popup with the message
'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table.
the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
system details are as below
OS: windows 7
MS-Office - 2007
SAP : ECC06Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
I copied the function module to my own version and added the following code, which seems to work :
* clear clipboard
refresh excel_tab.
call method cl_gui_frontend_services=>clipboard_export
importing
data = excel_tab
changing
rc = ld_rc
exceptions
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
others = 4
* Copy only one cell to prevent the clipboard data message.
call method of worksheet 'Cells' = h_cell
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'Cells' = h_cell1
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
call method of range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
call method of range 'COPY'.
m_message.
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
call method of application 'QUIT'.
m_message. -
Reading data in a tab in an excel sheet
Hi,
I would like to read the data in an excel sheet and upload into an internal table for processing. I was able to do it using function module ALSM_EXCEL_TO_INTERNAL_TABLE but I am not able to read a particular tab. My excel sheet has tabls like A, B, C and D and I want to read only tab C. But currently, it reads data in tab A.
regards,
Srini.Pls check this and review it once. it works for 2 excel sheets in single excel file to read. Pls reward me if its helpful. Thanks !
FUNCTION z_uploading_from_2sheets.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(FILE_NAME) TYPE RLGRAP-FILENAME
*" REFERENCE(START_ROW_SHEET1) TYPE I
*" REFERENCE(START_COLUMN_SHEET1) TYPE I
*" REFERENCE(START_ROW_SHEET2) TYPE I
*" REFERENCE(START_COLUMN_SHEET2) TYPE I
*" REFERENCE(END_ROW_SHEET1) TYPE I
*" REFERENCE(END_COLUMN_SHEET1) TYPE I
*" REFERENCE(END_ROW_SHEET2) TYPE I
*" REFERENCE(END_COLUMN_SHEET2) TYPE I
*" TABLES
*" IT_DATA1 STRUCTURE ALSMEX_TABLINE
*" ALSMEX_TABLINE STRUCTURE ALSMEX_TABLINE
*" EXCEPTIONS
*" INCONSISTENT_PARAMETERS
*" UPLOAD_OLE
TYPES: ty_t_sender(1500) TYPE c.
DATA: excel_tab TYPE TABLE OF ty_s_senderline,
excel_tab1 TYPE TABLE OF ty_s_senderline.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
DATA: it_data TYPE STANDARD TABLE OF alsmex_tabline.
*MESSAGE DEFINATION
DEFINE m_message.
*Function Module To Upload Data From
*Excel File Into Two Internal Tables
*© 2005 SAP AG 6
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
*PARAMETER CHECK.
IF start_row_sheet1 > end_row_sheet1.
RAISE inconsistent_parameters.
ENDIF.
IF start_column_sheet1 > end_column_sheet1.
RAISE inconsistent_parameters.
ENDIF.
IF start_row_sheet2 > end_row_sheet2.
RAISE inconsistent_parameters.
*Function Module To Upload Data From Excel File Into Two Internal Tables
ENDIF.
IF start_column_sheet2 > end_column_sheet2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
*OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
application
'Workbooks' = workbook.
m_message.
CALL METHOD OF
workbook
'Open'
EXPORTING
#1 = file_name.
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
*Function Module To Upload Data From Excel File Into Two Internal Tables
m_message.
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 1.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
*MARKING OF WHOLE SPREADSHEET
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = start_row_sheet1
#2 = start_column_sheet1.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = end_row_sheet1
#2 = end_column_sheet1.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
*Function Module To Upload Data From Excel File Into Two Internal Tables
*Copy marked area (SHEET1) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
*Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab it_data
USING ld_separator.
APPEND LINES OF it_data TO it_data1.
*Function Module To Upload Data From Excel File Into Two Internal Tables
*Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
*Working in Second Excel Work Sheet
CALL METHOD OF
application
'Worksheets' = sheet
EXPORTING
#1 = 2.
m_message.
CALL METHOD OF
sheet
'Activate'.
m_message.
*Function Module To Upload Data From Excel File Into Two Internal Tables
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
*Mark Sheet2
CALL METHOD OF
sheet
'Cells' = h_cell
EXPORTING
#1 = start_row_sheet2
#2 = start_column_sheet2.
m_message.
CALL METHOD OF
sheet
'Cells' = h_cell1
EXPORTING
#1 = end_row_sheet2
#2 = end_column_sheet2.
m_message.
CALL METHOD OF
sheet
'RANGE' = range
EXPORTING
#1 = h_cell
#2 = h_cell1.
m_message.
CALL METHOD OF
range
'SELECT'.
m_message.
*Copy Marked Area (Sheet2) into Clippboard
CALL METHOD OF
range
'COPY'.
m_message.
*Function Module To Upload Data From Excel File Into Two Internal Tables
*Read Clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab1
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
*PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
PERFORM separated_to_intern_convert TABLES excel_tab1 it_data
USING ld_separator.
*Clear Clipboard.
REFRESH: excel_tab1.
APPEND LINES OF it_data TO it_data1.
CALL METHOD cl_gui_frontend_services=>clipboard_export
*Function Module To Upload Data From Excel File Into Two Internal Tables
IMPORTING
data = excel_tab1
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
*Leaving Application
CALL METHOD OF
application
'QUIT'.
m_message.
* >>>>> Begin of change note 575877
* to kill the Excel process it's necessary to free all used objects
FREE OBJECT h_cell. m_message.
FREE OBJECT h_cell1. m_message.
FREE OBJECT range. m_message.
FREE OBJECT worksheet. m_message.
FREE OBJECT workbook. m_message.
FREE OBJECT application. m_message.
* <<<<< End of change note 575877
ENDFUNCTION. -
How to put javascript function to AIR
Hi,
first I had Flex web application with onet javascript function in index.html file. Now I copied my code from web project mxml file to AIR project and it working properly. How can add this javascript function now. There is no html file now...
EDIT: I am trying to do (in my AIR application) copy to clipboard using roll Over the button. Maybe I can do this in another way instead of javascript function (as i did in my web application).SET CLIPBOARD DATA:
import flash.desktop.Clipboard;
import flash.desktop.ClipboardFormats;
var textToCopy:String = "Copy to clipboard.";
Clipboard.generalClipboard.clear();
Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, textToCopy, false);
GET CLIPBOARD DATA:
import flash.desktop.Clipboard;
import flash.desktop.ClipboardFormats;
if(Clipboard.generalClipboard.hasFormat(ClipboardFormats.TEXT_FORMAT)){
var text:String = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT);
(From LiveDocs: http://livedocs.adobe.com/flex/3/html/help.html?content=CopyAndPaste_1.html) -
How to read a excel file with more than one worksheet.
Hi,
I wanna read a sheet (anyone of it,not the first) in a excel.Who can help me!
best wishes,
Grant ChenDear All,
Thank you all for your reply!
I modified SAP FM ZALSM_EXCEL_TO_INTERNAL_TABLE.
I add an IMPORTING parameter 'I_SHEET'
which stands for the sequence number of worksheet in the FM.
FUNCTION ZALSM_EXCEL_TO_INTERNAL_TABLE .
*"*"Local Interface:
*" IMPORTING
*" VALUE(FILENAME) LIKE RLGRAP-FILENAME
*" REFERENCE(I_SHEET) TYPE I
*" VALUE(I_BEGIN_COL) TYPE I
*" VALUE(I_BEGIN_ROW) TYPE I
*" VALUE(I_END_COL) TYPE I
*" VALUE(I_END_ROW) TYPE I
*" TABLES
*" INTERN STRUCTURE ALSMEX_TABLINE
*" EXCEPTIONS
*" INCONSISTENT_PARAMETERS
*" UPLOAD_OLE
*{ INSERT EC6K900099 1
DATA: excel_tab TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA:
ld_rc TYPE i.
* Rückgabewert der Methode "clipboard_export "
* Makro für Fehlerbehandlung der Methods
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
* check parameters
IF i_begin_row > i_end_row. RAISE inconsistent_parameters. ENDIF.
IF i_begin_col > i_end_col. RAISE inconsistent_parameters. ENDIF.
* Get TAB-sign for separation of fields
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
* open file in Excel
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF application 'Workbooks' = workbook.
m_message.
CALL METHOD OF workbook 'Open' EXPORTING #1 = filename.
m_message.
* set property of application 'Visible' = 1.
* m_message.
********************Modified by Grant 20080717************
call METHOD of application 'Worksheets' = worksheet
exporting
#1 = I_SHEET.
m_message.
call method of worksheet 'Activate'.
* GET PROPERTY OF application 'ACTIVESHEET' = worksheet.
m_message.
* mark whole spread sheet
CALL METHOD OF worksheet 'Cells' = h_cell
EXPORTING #1 = i_begin_row #2 = i_begin_col.
m_message.
CALL METHOD OF worksheet 'Cells' = h_cell1
EXPORTING #1 = i_end_row #2 = i_end_col.
m_message.
CALL METHOD OF worksheet 'RANGE' = range
EXPORTING #1 = h_cell #2 = h_cell1.
m_message.
CALL METHOD OF range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
CALL METHOD OF range 'COPY'.
m_message.
* read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab intern
USING ld_separator.
* clear clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
CALL METHOD OF application 'QUIT'.
m_message.
* >>>>> Begin of change note 575877
* to kill the Excel process it's necessary to free all used objects
FREE OBJECT h_cell. m_message.
FREE OBJECT h_cell1. m_message.
FREE OBJECT range. m_message.
FREE OBJECT worksheet. m_message.
FREE OBJECT workbook. m_message.
FREE OBJECT application. m_message.
* <<<<< End of change note 575877
*} INSERT
ENDFUNCTION.
Edited by: Grant Chen on Jul 17, 2008 7:45 AM
Edited by: Grant Chen on Jul 17, 2008 7:46 AM -
How to download data from different sheet of excel file.
Hi Friends,
I have a Excel file with different sheet like sheet 1, sheet 2 and so on,
and i have to download each sheet data in to different internal tables.
Is there any FM or something else.
Pl. help
Thanks
Sunil.Hi,
You can create the function module for this.
The code sample is as below:
*Code Sample *
FUNCTION Z_UPLOADING_FROM_2SHEETS.
""Local interface:
*" IMPORTING
*" VALUE(FILE_NAME) LIKE RLGRAP-FILENAME
*" VALUE(START_ROW_SHEET1) TYPE I
*" VALUE(START_COLUMN_SHEET1) TYPE I
*" VALUE(START_ROW_SHEET2) TYPE I
*" VALUE(START_COLUMN_SHEET2) TYPE I
*" VALUE(END_ROW_SHEET1) TYPE I
*" VALUE(END_COLUMN_SHEET1) TYPE I
*" VALUE(END_ROW_SHEET2) TYPE I
*" VALUE(END_COLUMN_SHEET2) TYPE I
*" TABLES
*" IT_DATA1 STRUCTURE ALSMEX_TABLINE
*" IT_DATA2 STRUCTURE ALSMEX_TABLINE
*" EXCEPTIONS
*" INCONSISTENT_PARAMETERS
*" UPLOAD_OLE
DATA DECLARATION
DATA: excel_tab TYPE ty_t_sender,
excel_tab1 TYPE ty_t_sender.
DATA: ld_separator TYPE c.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
SHEET TYPE OLE2_OBJECT,
range TYPE ole2_object,
worksheet TYPE ole2_object.
DATA: h_cell TYPE ole2_object,
h_cell1 TYPE ole2_object.
DATA: ld_rc TYPE i.
MESSAGE DEFINATION
DEFINE m_message.
case sy-subrc.
when 0.
when 1.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
when others. raise upload_ole.
endcase.
END-OF-DEFINITION.
PARAMETER CHECK
IF START_ROW_SHEET1 > END_ROW_SHEET1.
RAISE inconsistent_parameters.
ENDIF.
IF START_COLUMN_SHEET1 > END_COLUMN_SHEET1.
RAISE inconsistent_parameters.
ENDIF.
IF START_ROW_SHEET2 > END_ROW_SHEET2.
RAISE inconsistent_parameters.
ENDIF.
IF START_COLUMN_SHEET2 > END_COLUMN_SHEET2.
RAISE inconsistent_parameters.
ENDIF.
CLASS cl_abap_char_utilities DEFINITION LOAD.
ld_separator = cl_abap_char_utilities=>horizontal_tab.
OPENING EXCEL FILE
IF application-header = space OR application-handle = -1.
CREATE OBJECT application 'Excel.Application'.
m_message.
ENDIF.
CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.
m_message.
CALL METHOD OF application 'Workbooks' = workbook.
m_message.
CALL METHOD OF workbook 'Open' EXPORTING #1 = FILE_NAME.
m_message.
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
m_message.
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
m_message.
CALL METHOD OF SHEET 'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
MARKING OF WHOLE SPREADSHEET
CALL METHOD OF sheet 'Cells' = h_cell
EXPORTING #1 = START_ROW_SHEET1 #2 = START_COLUMN_SHEET1.
m_message.
CALL METHOD OF sheet 'Cells' = h_cell1
EXPORTING #1 = END_ROW_SHEET1 #2 = END_COLUMN_SHEET1.
m_message.
CALL METHOD OF sheet 'RANGE' = range
EXPORTING #1 = h_cell #2 = h_cell1.
m_message.
CALL METHOD OF range 'SELECT'.
m_message.
Copy marked area (SHEET1) into Clippboard
CALL METHOD OF range 'COPY'.
m_message.
Read clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab IT_DATA1
USING ld_separator.
Clear the clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
Working in Second Excel Work Sheet
CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 2.
m_message.
CALL METHOD OF SHEET 'Activate'.
m_message.
GET PROPERTY OF application 'ACTIVESHEET' = sheet.
m_message.
Mark Sheet2
CALL METHOD OF sheet 'Cells' = h_cell
EXPORTING #1 = START_ROW_SHEET2 #2 = START_COLUMN_SHEET2.
m_message.
CALL METHOD OF sheet 'Cells' = h_cell1
EXPORTING #1 = END_ROW_SHEET2 #2 = END_COLUMN_SHEET2.
m_message.
CALL METHOD OF sheet 'RANGE' = range
EXPORTING #1 = h_cell #2 = h_cell1.
m_message.
CALL METHOD OF range 'SELECT'.
m_message.
Copy Marked Area (Sheet2) into Clippboard
CALL METHOD OF range 'COPY'.
m_message.
Read Clipboard into ABAP
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
data = excel_tab1
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE a037(alsmex).
ENDIF.
PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
USING ld_separator.
Clear Clipboard
REFRESH excel_tab.
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab1
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
Leaving Application .
CALL METHOD OF application 'QUIT'.
m_message.
FREE OBJECT application.
m_message.
ENDFUNCTION.
Maybe you are looking for
-
Since the latest update I cannot send emails from my email icon on my iPad, but I can receive ok. I am able to both send & receive emails via my sky/yahoo account Any ideas But I am not very technical minded Please help,
-
Problem with AppleID in iTunes store on iPod
For some reason when I go to update or download new apps in the itunes store on my iPod it no longer shows my complete appleID when it asks for my password and therefore I can't log in. On the store settings page it shows my proper ID and lets me lo
-
Assets are not visible in BCC.
Hi All, I modified child category and its product. The modified assets are visible from Content Administration Tab. But when we click on the project in merchandising the modified assets are not visible. When I change the site attributes a
-
Saving changes in KM Document IView
Howdy Folks! I am displaying an Excel Document on my Portal Site using an KM Document IView. This Excel Document is editabel for users of the Portal Site that they can leave information there. For example, it could be a public document and everybody
-
Where is my lost catalog?
I was working with a group of 12 photos in my cataalog, and it went away. I tried to revive, no luck. So I tried to import the items again -- the screen would not allow it because they were already in the catalog. How can I recover??? Thank you