Assign keywords from excel
Hi there, I was wondering if anyone might have a suggestion for me: All our product images are named with a 9-digit ID number. All the item numbers and product information (name, color, gender, category, view, etc.) are stored in an Excel workbook for each photoshoot. Typically, we generate a list of keywords from the excel doc (using applescript), then import that list into Bridge before manually assigning keywords to each image. This seems like a perfect opportunity for automation. Is it possible for Bridge to open the Excel doc, find the cell with the name of the image, and assign the associated keywords from the same row? seems easy enough, but I'm not sure where to start.
-S
For gereral JavaScript array functionality :-
http://www.w3schools.com/js/js_obj_array.asp
There are a few examples of complete scripts here :-
http://www.ps-scripts.com/bb/viewtopic.php?f=19&t=2320&sid=ad12f973f1d32fd1d4870ebc47cbefd 5
Similar Messages
-
Importing Keywords from Excel into Lightroom (XMP)
My current photo log is in Excel. I'm thinking of moving to Lightroom. Does anyone know if there would be a programmatic way to import keywords from an Excel file, and avoid having to manually apply keywords to each imported image? The data in my Excel file provides a perfect (nearly perfect?) correspondence between keyword and image file name. I know next to nothing about XMP, but I could get some help if I knew this was possible. Thanks!
Garry, try this: Take one image in LR, apply some metadata and use "Metadata > XMP > Export XMP Metadata to File". Examine this xmp file to see what it has to look like.
Alexander.
Canon EOS 400D (aka. XTi) • 20" iMac Intel • 12" PowerBook G4 • OS X 10.4 • LR 1 • PSE 4 -
Hi 2 all,
Can anyone please send me the complete steps for uploading of data from excel to BI??
Also tell me that when we use DSO or when we use infocube? and if we design query in query designer then we use info cube fields or DSO fields??
Please respond.
Regards,
Aisha Ishrat
ICI Pakistan Ltd.Hi,
there is no separate Tcode for 3.5 environment... but in RSA1 itself they give 3.X functionality also.. So, if you want to follow the 3.5 procedure you can go thru that... in the Infosource tab--> select your info area -->and right clcik it.. ->in that create INFOSOURCE 3.X.. for that just right clcik ur CUBE or DSO and --> Additional functions --> Update Rules.. and like that you can follow the same procedure which you done in 3.5..
and for data loading in BI 7.0 from fla file means
fisrt create one Cube or DSO with the same structure which you have in flatfile..
and activate it..
->now comes to Datasource tab> create one Datasource here you need to select type of data for example.. select Transactional data --> and menntion your flatfile name in extraction tab- and file type and eneter your info object names in FIELDS tab --> and load preview data Activate it..
now select your datasource and create info package and schedule it.. now your data will loded in to PSA level...
> and now comes to info provider select your cube.. and right clcik it.. and create transformations.,. and activate it..
> and create DTP -- Activate it.. and Execute it..
1)Create datasource. Here u can set/check the Soucre System fields.
2)Create Transformation for that datasource. (no more update rules/transfer rules)
2.1) While creating transformation for DS it will ask you for data target name, so just assign where u want to update ur data.
DataSource -> Transformation -> (DTP)-->Data Target
Now if you want to load data into data target from Source System Datasource:
1) Create infopackage for that data source. If you are creating infopackage for new datasources, it will only allow you update upto PSA, all other options u can see as disabled.
2)Now Create DTP (Data Transfer Process) for that data source.
3) NOw schdule the Infopackage, once the data is loaded to PSA, you can execute your DTP which will load data to data target.
Data Transfer Process (DTP) is now used to load data using the dataflow created by the Transformation. Here's how the DTP data load works:
1) Load InfoPackage
2) Data gets loaded into PSA (hence why PSA only is selected)
3) DTP gets "executed"
4) Data gets loaded from PSA into the data target once the DTP has executed
1) Create a data source
RSA1->Source Systems->FILE(File)->PC_FILE(Filesourcesystem)->Create Application Component(optional)-Create Data source
2) Create the data provider
3) Create Transformation
Right click on the data provider, choose 'create transformation' and choose your data source (give relevant data source and its type)
Just connect the relavant fields between your data source and data provider.
4) Create DTP
Then Double click on the DTP node created under yous transformations. choose the extraction mode
5) Load the data: there are 2 ways:
you can run the infopackage and DTP separately or create a process chain consisting of these infopackage and DTP and run.
Also check /people/sankar.kumar/blog/2006/10/11/loading-text-filestxt-into-bw-with-hex-option for hex option
Thanks,
Sankar M -
Upload data from excel with vba by calling a function module
Hello all,
i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
Can you give me some tips how can i
upload data from excel with vba by click a button.
The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results.
How can I call the function module correct with vba?
Thanks a lot for your tips!!!!
Chris
Message was edited by:
Christoph KirschnerHI
Uploading data directly from Excel file format
* Upload data direct from excel.xls file to SAP
REPORT ZEXCELUPLOAD.
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
<b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
*Title : Excel Uploading
TYPES: BEGIN OF t_datatab,
col1(25) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
col4(30) TYPE c,
col5(30) TYPE c,
col6(30) TYPE c,
col7(30) TYPE c,
col8(30) TYPE c,
col9(30) TYPE c,
col10(30) TYPE c,
col11(30) TYPE c,
END OF t_datatab.
DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
wa_datatab TYPE t_datatab.
Data : p_table type t_datatab occurs 0 with header line.
DATA : gd_scol TYPE i VALUE '1',
gd_srow TYPE i VALUE '1',
gd_ecol TYPE i VALUE '256',
gd_erow TYPE i VALUE '65536'.
DATA: it_tab TYPE filetable,
gd_subrc TYPE i.
field-symbols : <fs>.
*Selection screen definition
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename
DEFAULT 'c:test.xls' OBLIGATORY. " File Name
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
REFRESH: it_tab.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.xls'
multiselection = ' '
CHANGING
file_table = it_tab
rc = gd_subrc.
LOOP AT it_tab INTO p_file.
* so_fpath-sign = 'I'.
* so_fpath-option = 'EQ'.
* append so_fpath.
ENDLOOP.
START-OF-SELECTION.
PERFORM upload_excel_file TABLES it_datatab
USING p_file
gd_scol
gd_srow
gd_ecol
gd_erow.
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3,
wa_datatab-col4,
wa_datatab-col5,
wa_datatab-col6,
wa_datatab-col7,
wa_datatab-col8,
wa_datatab-col9,
wa_datatab-col10,
wa_datatab-col11.
ENDLOOP.
*& Form UPLOAD_EXCEL_FILE
* upload excel spreadsheet into internal table
* -->P_TABLE Table to return excel data into
* -->P_FILE file name and path
* -->P_SCOL start column
* -->P_SROW start row
* -->P_ECOL end column
* -->P_EROW end row
FORM upload_excel_file TABLES p_table
USING p_file
p_scol
p_srow
p_ecol
p_erow.
DATA : lt_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
* Has the following format:
* Row number | Colum Number | Value
* i.e. 1 1 Name1
* 2 1 Joe
DATA : ld_index TYPE i.
* Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = p_scol
i_begin_row = p_srow
i_end_col = p_ecol
i_end_row = p_erow
TABLES
intern = LT_INTERN
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'Error Uploading file'.
EXIT.
ENDIF.
IF lt_intern[] IS INITIAL.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE:/ 'No Data Uploaded'.
EXIT.
ELSE.
SORT lt_intern BY row col.
LOOP AT lt_intern.
MOVE lt_intern-col TO ld_index.
assign component ld_index of structure
p_table to <fs>.
move : lt_intern-value to <fs>.
* MOVE lt_intern-value TO p_table.
AT END OF row.
APPEND p_table.
CLEAR p_table.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. "UPLOAD_EXCEL_FILE
Regards
Pavan -
Upload data from excel (not the excle file) into SAP
Guys,
how can we upload data from excel sheet into SAP? I mean just the data not the entire file,
I have a requirement where user press a button in excel sheet and the data in the sheet will get uploaded into SAP.
I am sure we have to use BAPI and some VB programming for macros, I will really appriciate if anyone can help how to achive this.
some sample code exampe will help.
Cheers!I think u r writing BDC for Uploading the data from excel flile to sap. for this is the code I am sending u can use then for Uploading data from excel to sap.
DATA: lv_filename TYPE rlgrap-filename.
FIELD-SYMBOLS : <fs>.
DATA : l_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA : l_index TYPE i.
PARAMETERS : startcol TYPE i ,
startrow TYPE i ,
endcol TYPE i ,
endrow TYPE i .
PARAMETERS: p_flnam LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnam.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-repid
FIELD_NAME = ' '
IMPORTING
file_name = p_flnam .
MOVE p_flnam TO lv_filename.
Uploading the flat file from the desktop
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = lv_filename
i_begin_col = startcol
i_begin_row = startrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = l_intern
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT l_intern BY row col.
LOOP AT l_intern.
MOVE l_intern-col TO l_index.
ASSIGN COMPONENT l_index OF STRUCTURE itab TO <fs>.
MOVE l_intern-value TO <fs>.
AT END OF row.
APPEND itab.
CLEAR itab.
ENDAT.
ENDLOOP.
I hope it will help u.
Regards
Nayan -
Please help me to get this done!....Thanks in Advance
This is current script I use to update AD record but its taking user id to pick the user in AD, which is some time give error not update properly..
# UpdateUsers.ps1
# PowerShell program to update Active Directory users from the information in a
# Microsoft Excel spreadsheet. Only single-valued string attributes supported.
# Author: Richard Mueller
# PowerShell Version 1.0
# September 12, 2011
Trap
If ("$_".StartsWith("Cannot load COM type Excel.Application"))
"Excel application not found, program aborted"
Add-Content -Path $LogFile -Value "## Excel application not found"
Add-Content -Path $LogFile -Value " $_"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
Break
If (("$_".StartsWith("Exception has been thrown")) -and ($Step -eq "4"))
"Excel spreadsheet not found, program aborted"
Add-Content -Path $LogFile -Value "## Excel spreadsheet not found: $ExcelPath"
Add-Content -Path $LogFile -Value " $_"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
Break
If ("$_".StartsWith("The server is not operational"))
"Domain Controller not found, program aborted"
Add-Content -Path $LogFile -Value "## Domain Controller not found"
Add-Content -Path $LogFile -Value " $_"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
Break
If ("$_".StartsWith("The directory service is unavailable"))
"Active Directory not found, program aborted"
Add-Content -Path $LogFile -Value "## Active Directory not found"
Add-Content -Path $LogFile -Value " $_"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
Break
If ("$_".StartsWith("The specified domain"))
"Domain not found, program aborted"
Add-Content -Path $LogFile -Value "## Domain not found"
Add-Content -Path $LogFile -Value " $_"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
Break
"Unexpected error: $_"
Add-Content -Path $LogFile -Value "## Unexpected error: $_"
Add-Content -Path $LogFile -Value " Step: $Step"
Break
Function CleanUp
Trap
"Error during cleanup: $_"
Add-Content -Path $LogFile -Value "## Error during cleanup: $_"
$Script:Errors = $Script:Errors + 1
Continue
# Function to release Excel objects from memory.
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Columns)} While ($x -gt -1)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Rows)} While ($x -gt -1)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Range)} While ($x -gt -1)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Sheet)} While ($x -gt -1)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Worksheets)} While ($x -gt -1)
$Workbook.Close($False)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Workbook)} While ($x -gt -1)
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Workbooks)} While ($x -gt -1)
$Excel.Quit()
Do {$x = [System.Runtime.InteropServices.Marshal]::ReleaseComObject($Excel)} While ($x -gt -1)
# Specify paths to spreadsheet and log file.
$Script:Errors = 0
$Step = "1"
$ExcelPath = "c:\scripts\UpdateUsers.xls"
$LogFile = "c:\scripts\UpdateUsers.log"
Write-Host "Please Standby..."
# Add to the log file.
$Step = "2"
Add-Content -Path $LogFile -Value "------------------------------------------------" -ErrorAction Stop
Add-Content -Path $LogFile -Value "UpdateUsers.ps1 Version 1.0 (September 12, 2011)"
Add-Content -Path $LogFile -Value $("Started: " + (Get-Date).ToString())
Add-Content -Path $LogFile -Value "Spreadsheet: $ExcelPath"
Add-Content -Path $LogFile -Value "Log file: $LogFile"
$Step = "3"
# Open specified Excel spreadsheet.
$Excel = New-Object -ComObject "Excel.Application"
$Workbooks = $Excel.Workbooks
$Step = "4"
$Workbook = $Workbooks.Open($ExcelPath)
$Worksheets = $Workbook.Worksheets
$Sheet = $Worksheets.Item(1)
$Range = $Sheet.UsedRange
$Rows = $Range.Rows
$Columns = $Range.Columns
$Step = "5"
# Hash table of attribute syntaxes.
# The LDAP display names will be read from the spreadsheet.
# The corresponding syntaxes will be read from the Schema container.
$Attributes = @{}
# Array of spreadsheet column headings.
$Cols = @()
$Step = "6"
# Read attribute LDAP Display Names from the first row of the spreadsheet.
$ID = 0
For ($k = 1; $k -le $Columns.Count; $k = $k + 1)
# Retrieve column heading, the lDAPDisplayName of an attribute.
$Value = $Sheet.Cells.Item(1, $k).Text
# Keep track of all column headings.
$Cols += $Value
# Skip duplicates in hash table.
If ($Attributes.ContainsKey($Value) -eq $False)
# Default is "NotFound", until found in the AD Schema.
$Attributes.Add($Value, "NotFound")
# Keep track of which column uniquely identifies users.
If ($Value.ToLower() -eq "distinguishedname") {$ID = $k}
If (($Value.ToLower() -eq "samaccountname") -and ($ID -eq 0)) {$ID = $k}
# This script cannot be used to rename users.
If ($value.ToLower() -eq "cn")
Add-Content -Path $LogFile -Value "## This script cannot be used to rename users"
Add-Content -Path $LogFile -Value " Do not specify the cn attribute in the spreadsheet"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
CleanUp
Return "Program aborted: cn attribute found in spreadsheet" `
+ "`nSee log file: $LogFile"
$Step = "7"
If ($ID -eq 0)
Add-Content -Path $LogFile -Value "## No column found to identify users"
Add-Content -Path $LogFile -Value " One column must be distinguishedName or sAMAccountName"
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
CleanUp
Return "Program aborted: No column found in spreadsheet to identify users" `
+ "`nSee log file: $LogFile"
# Create filter to query for attributes in the schema.
$Attrs = $Attributes.Keys
$Filter = "(&(objectCategory=AttributeSchema)(|"
ForEach ($Attr In $Attrs)
$Filter = $Filter + "(lDAPDisplayName=$Attr)"
$Filter = $Filter + "))"
$Step = "8"
$RootDSE = [System.DirectoryServices.DirectoryEntry]([ADSI]"LDAP://RootDSE")
$Domain = $RootDSE.Get("defaultNamingContext")
$Schema = $RootDSE.Get("schemaNamingContext")
$Step = "9"
# Use the NameTranslate object.
$objTrans = New-Object -comObject "NameTranslate"
$objNT = $objTrans.GetType()
# Initialize NameTranslate by locating the Global Catalog.
$objNT.InvokeMember("Init", "InvokeMethod", $Null, $objTrans, (3, $Null))
$Step = "10"
# Retrieve NetBIOS name of the current domain.
$objNT.InvokeMember("Set", "InvokeMethod", $Null, $objTrans, (1, "$Domain"))
$NetBIOSDomain = $objNT.InvokeMember("Get", "InvokeMethod", $Null, $objTrans, 3)
Add-Content -Path $LogFile -Value "NetBIOS name of domain: $NetBIOSDomain"
$Step = "11"
$Searcher = New-Object System.DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = [ADSI]"LDAP://$Schema"
$Searcher.PageSize = 200
$Searcher.SearchScope = "subtree"
$Searcher.PropertiesToLoad.Add("lDAPDisplayName") > $Null
$Searcher.PropertiesToLoad.Add("attributeSyntax") > $Null
$Searcher.PropertiesToLoad.Add("isSingleValued") > $Null
$Searcher.PropertiesToLoad.Add("systemFlags") > $Null
# Filter on specified attributes.
$Searcher.Filter = $Filter
$Step = "12"
# Query Active Directory.
$Results = $Searcher.FindAll()
# Enumerate recordset.
ForEach ($Result In $Results)
# Retrieve properties of attributes.
$Name = $Result.Properties.Item("lDAPDisplayName")[0]
$SysFlags = $Result.Properties.Item("systemFlags")[0]
$SyntaxNum = $Result.Properties.Item("attributeSyntax")[0]
$SingleValued = $Result.Properties.Item("isSingleValued")[0]
# Only single-valued string attributes supported by this version of the program.
Switch ($SyntaxNum)
"2.5.5.12" {$Syntax = "String"}
Default {$Syntax = "NotSupported"}
If ($Name.ToLower() -eq "distinguishedname") {$Syntax = "DN"}
If (($SysFlags -band 4) -ne 0)
$Attributes[$Name] = "Constructed"
Else
If ($SingleValued -eq $True)
$Attributes[$Name] = $Syntax
Else
$Attributes[$Name] = "NotSupported"
$Step = "13"
# Check if any attributes not found or have unsupported syntax.
$Found = $True
ForEach ($Attr In $Attrs)
$Syntax = $Attributes[$Attr]
If ($Syntax -eq "NotFound")
Add-Content -Path $LogFile -Value "## Attribute $Attr not found in schema"
"Attribute $Attr not found in schema"
$Found = $False
If ($Syntax -eq "NotSupported")
Add-Content -Path $LogFile -Value "## Attribute $Attr has a syntax that is not supported"
"Attribute $Attr has a syntax that is not supported"
$Found = $False
If ($Syntax -eq "Constructed")
Add-Content -Path $LogFile -Value "## Attribute $Attr is operational, so is not supported"
"Attribute $Attr is operational, so is not supported"
$Found = $False
$Step = "14"
If ($Found -eq $False)
Add-Content -Path $LogFile -Value $("Program aborted: " + (Get-Date).ToString())
CleanUp
Return "Program aborted" `
+ "`nSee log file: $LogFile"
# Read remaining rows of the spreadsheet, until the first blank value is found
# in the column that identifies users.
$Step = "15"
$Script:Updated = 0
$Script:Unchanged = 0
$j = 2
Do {
# Retieve ID value for the user first.
$Value = $Sheet.Cells.Item($J, $ID).Text
$Found = $False
$Step = "16"
If ($Cols[$ID - 1] -eq "distinguishedname")
# Any forward slash characters must be escaped.
$DN = $Value.Replace("/", "\/")
# Bind to the user object.
# If user not found, $User.Name will be $Null.
$User = [ADSI]"LDAP://$DN"
If ($User.Name -ne $Null)
$Found = $True
$Step = "17"
If ($Cols[$ID - 1] -eq "samaccountname")
Trap
Write-Host ""
"Error translating name: $_"
Add-Content -Path $LogFile -Value "## Error translating name $Value"
Add-Content -Path $LogFile -Value " Description: $_"
$Script:Errors = $Script:Errors + 1
Continue
# Convert sAMAccountName to distinguishedName.
$DN = ""
$Step = "18"
$objNT.InvokeMember("Set", "InvokeMethod", $Null, $objTrans, (3, "$NetBIOSDomain$Value"))
$DN = $objNT.InvokeMember("Get", "InvokeMethod", $Null, $objTrans, 1)
$Step = "19"
If ($DN -ne "")
$Step = "20"
# Any forward slash characters must be escaped.
$DN = $DN.Replace("/", "\/")
# Bind to the user object.
$User = [ADSI]"LDAP://$DN"
$Found = $True
If ($Found -eq $True)
$Step = "21"
# Read remaining values for this user.
$Changed = $False
For ($k = 1; $k -le $Columns.Count; $k = $k + 1)
# Skip the identifying column.
If ($k -ne $ID)
$Step = "22"
# Retrieve attribute name for this column from array.
$AttrName = $Cols[$k - 1]
# Retrieve attribute syntax from hash table.
$Syntax = $Attributes[$AttrName]
$Step = "23"
# Retrieve attribute value for this user.
$Value = $Sheet.Cells.Item($j, $k).Text
# Skip blank values.
If ($Value -ne "")
If ($Syntax -eq "String")
Trap
If ("$_".StartsWith("The directory property cannot be found"))
Continue
Else
Write-Host ""
"Error retrieving value from Active Directory: $_"
Add-Content -Path $LogFile -Value "## Error retrieving $AttrName for user $DN"
Add-Content -Path $LogFile -Value " Description: $_"
$Script:Errors = $Script:Errors + 1
Continue
$Step = "24"
# Single-valued string attribute.
# Retrieve existing value.
$OldValue = ""
$OldValue = $User.Get($AttrName)
# Check if existing value to be deleted.
If ($Value.ToLower() -eq ".delete")
If ($OldValue -ne "")
If ($AttrName.ToLower -eq "samaccountname")
Add-Content -Path $LogFile -Value `
"## Mandatory attribute sAMAccountName cannot be cleared for user: $DN"
$Script:Errors = $Script:Errors + 1
Else
Trap
Write-Host ""
"Error deleting value from Active Directory: $_"
Add-Content -Path $LogFile -Value "## Error deleting $AttrName for user $DN"
Add-Content -Path $LogFile -Value " Description: $_"
$Script:Errors = $Script:Errors + 1
Continue
$Step = "25"
# Make the attribute value "not set".
$User.PutEx(1, $AttrName, 0)
$Changed = $True
Else
$Step = "26"
# Check if new value from spreadsheet different.
If ($Value -ne $OldValue)
Trap
Write-Host ""
"Error assigning value from Active Directory: $_"
Add-Content -Path $LogFile -Value "## Error assigning $AttrName for user $DN"
Add-Content -Path $LogFile -Value " Description: $_"
$Script:Errors = $Script:Errors + 1
Continue
# Assign the new value to the attribute.
$User.Put($AttrName, $Value)
$Changed = $True
Else
# Unexpected error.
Add-Content -Path $LogFile -Value `
"## Unexpected syntax: $Syntax for attribute $AttrName for user $DN"
$Script:Errors = $Script:Errors + 1
If ($Changed -eq $True)
Trap
Write-Host ""
"Error saving to Active Directory: $_"
Add-Content -Path $LogFile -Value "## Error saving to AD for user $DN"
Add-Content -Path $LogFile -Value " Description: $_"
$Script:Errors = $Script:Errors + 1
$Script:Updated = $Script:Updated - 1
Continue
$User.SetInfo()
Add-Content -Path $LogFile -Value "Update user: $DN"
Write-Host "." -NoNewLine
$Script:Updated = $Script:Updated + 1
Else
Add-Content -Path $LogFile -Value "User unchanged: $DN"
Write-Host "." -NoNewLine
$Script:Unchanged = $Script:Unchanged + 1
Else
Add-Content -Path $LogFile -Value "## User not found: $Value"
Write-Host "." -NoNewLine
$Script:Errors = $Script:Errors + 1
$j = $J + 1
} Until ($Sheet.Cells.Item($j, $ID).Text -eq "")
$Step = "27"
CleanUp
Add-Content -Path $LogFile -Value $("Finished: " + (Get-Date).ToString())
Add-Content -Path $LogFile -Value "Number of users updated: $Script:Updated"
Add-Content -Path $LogFile -Value "Number of users unchanged: $Script:Unchanged"
Add-Content -Path $LogFile -Value "Number of errors: $Script:Errors"
Write-Host ""
"Done"
"Number of errors: $Script:Errors"
"See log file: $LogFile"Actually scripts run fine with excel file, currently we are using user-id to pick to update AD. Now we want to update AD use employee id. You can say to identify the record in AD through employee ID instead of user-id.
I do not think you will get anyone here to fix that for you. You need to find someone who knows PowerShell to help you or learn PowerShell your self.
I would fix it for you but not for free. It is too oddly designed and has too many dependencies. Any small change is likely to break it.
¯\_(ツ)_/¯ -
What's The Best Way to Assign Keywords to Multiple Images?
I'm finally starting to organize my photos with keywords, but something about the way it works in LR2 is driving me batty.
I came back from a concert Saturday night with over 1,000 photos (double coverage by me and my wife). I'm trying to use keywords to designate the 14 different performers who appeared on the stage at different times during the evening, when there could be anywhere from 1 to 7 performers on the stage at the same time.
Now, it seems to me the easiest way to assign these keywords would be:
1) select a series of photos in which one or more performers appear
2) in either the "keyword suggestions" or "keyword set" panel, click on the keyword "buttons" I've already created from the performers names.
But this doesn't always work. I note that when I highlight a number of photos, ONE is more brightly highlighted than the others, and sometimes, that's the ONLY one that gets the keywords I just clicked on. Apparently, that one image is more "selected" than the others in the series I've highlighted.
It would not be quite so infuriating if that approach didn't work at all, but the oddity seems to be that sometimes it works and sometimes it doesn't, and I don't know what I'm doing different when it does or doesn't work.
What does work universally is to to the "Keyword List" panel and type in the name I need, and then right click when the name comes up and select "add keyword to selected photos." That seems to work every time.
Or, I can type "Click here to add keywords," type in the name I need, and hit return twice. That assigns the keyword to all the selected images. But then I have to do it again for every performer that appears in that series of frames.
Like I say, the easiest scenario would be the 1-2 step I outlined above, but I cant seem to get that to work all the time.
Anybody know the trick to getting that 1-2 scenario to work every time?
Thanks,
--PSOh, wow. I have exactly the same problem of LR not assigning keywords to all my selected images.
I will try the grid, select the grid and not the filmstrip, and look for the current image metadata checkbox as well.
BTW, Adobe told me to delete the preferences file, which I did.
They told me to optomize the catalog, which I did.
And, lastly they told me to create a new catalog and import all the data from my old catalog, which I did not do.
Stand by ...
Wow, that is it. You folks solved my problem.
Library Mode, select in the grid OR filmstrip (yep-but harder to see in the filmstrip anyway),
COULD NOT FIND-look for the current image metadata checkbox as well.
Michael -
Copying data from excel(more than one row) and pasting into table control
I have a requirement to copy data from excel and have it pasted it into the corresponding fields table control when the user clicks on an icon.For the first part I used a class to copy it from the clip board.By the previous process,I get the data inside an internal table, but even after trying to split the data using 'split at cl_abap_char_utilities=>horizontal_tab into table itab.' it's not working.The table and the excel file are of the same structure.
Does anyone know any cause as to why it might not work?Is there any other way to achieve my objective?
BonHi,
try to get data into internal table as below
TYPES : BEGIN OF ty_data ,
zbukr TYPE payr-zbukr ,
hbkid TYPE payr-hbkid ,
hktid TYPE payr-hktid ,
rzawe TYPE payr-rzawe ,
chect TYPE payr-chect ,
laufd TYPE reguh-laufd ,
laufi TYPE reguh-laufi ,
lifnr TYPE reguh-lifnr ,
vblnr TYPE reguh-vblnr ,
rwbtr TYPE reguh-rwbtr , "uncommented
unique_no TYPE char13 , " Added SAP Doc. No. and current year concate in NEFT,RTGS and Fund Transfer cases
END OF ty_data .
DATA : wa_file LIKE LINE OF it_file ,
wa_data TYPE ty_data .
DATA: it_data1 TYPE kcde_intern WITH HEADER LINE,
wa_data1 LIKE LINE OF it_data1.
start-of-selection.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = lv_file1
i_begin_col = '1'
i_begin_row = '4'
i_end_col = '11'
i_end_row = '60000'
TABLES
intern = it_data1
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc = 0.
PERFORM format_data.
ENDIF.
FORM format_data.
DATA : ld_index TYPE i.
FIELD-SYMBOLS : <fs>.
DATA it_tab LIKE wa_data OCCURS 0 WITH HEADER LINE.
LOOP AT it_data1.
MOVE it_data1-col TO ld_index.
ASSIGN COMPONENT ld_index OF STRUCTURE
it_tab TO <fs>.
MOVE : it_data1-value TO <fs>.
MOVE it_data1-value TO p_table.
AT END OF row.
APPEND it_tab.
CLEAR it_tab.
ENDAT.
ENDLOOP.
it_data[] = it_tab[] .
ENDIF.
endform. "format_data -
BAPI for automatic Pr creation witth multiple files from excel sheet
I have written a programm for automatic PR creation with the help of bapi , where its picks data from excel sheet and makes PR .It is picking excel files from one folder(Files) for PR creation and moving to another folder(Files sucess).
now the problem is if Folder (Files) contains one excel sheet ,PR is created fine , but if the Folder(Files) have multiple excel sheet ,its is creating 1st PR right, but next PR's contains all the line item of 1st PR , 2nd PR and so on .can anyone suggest me where is the problem in codes.
types : begin of x_file ,
key1(10),
pur_grp(4),
maktx(40),
plant(4) ,
req(10),
s_qty(13),
wbs(24),
gl(10),
trackno(10),
supl(4),
deladd(255).
types : end of x_file .
data : str5 type char10.
data : mm type char2.
data : yyyy type char4.
data : dd type char2.
data : str9 type char10.
data : str6 type char10.
data : month type char2.
data : year type char4.
year = sy-datum+0(4).
month = sy-datum+4(2).
dd = sy-datum+6(2).
yyyy = sy-datum+0(4).
mm = sy-datum+4(2).
dd = sy-datum+6(2).
clear str6 .
clear str5.
concatenate dd'.' month '.' year into str5 .
concatenate yyyy mm dd into str6 .
DATA : file type rlgrap-filename .
data : it_file type table of x_file .
data : wa_file type x_file .
data : it_header type table of x_file .
data : wa_header type x_file .
*& Internal Table For Define Row and Coloum Postion
data: col_start type i value 1 ,
row_start type i value 2,
col_end type i value 256 ,
row_end type i value 65000 .
*& Internal Table For Retrieve Data From Excel
*data: excel_bdcdata like kcde_cells occurs 0 with header line.
*data: excel_bdcdata1 like kcde_cells occurs 0 with header line.
data: excel_bdcdata like ALSMEX_TABLINE occurs 0 with header line.
data: excel_bdcdata1 like ALSMEX_TABLINE occurs 0 with header line.
data: it_index type i.
DATA : IT_INDEX1 TYPE I.
*& Define Field Symbol
field-symbols: <fs> .
data : bdcdata like bdcdata occurs 0 with header line.
data : messtab like bdcmsgcoll occurs 0 with header line.
data : req_items type table of bapiebanc .
data : wa_req_items type bapiebanc .
data : req_acc_asg type table of bapiebkn.
data : wa_req_acc_asg type bapiebkn.
DATA : RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE .
*data : return type table of bapireturn.
*data : wa_return type bapireturn .
data : number type ebeln .
*****************************MOVE FILES******************************
data : xsource type string .
data : xdestin type string .
data : destin1 type string .
data : destin2 type string .
DATA : DEST1 TYPE STRING.
DATA : DEST11 TYPE STRING.
DATA : DEST2 TYPE STRING.
DATA : DEST22 TYPE STRING.
data : sou_dir_name like SALFILE-LONGNAME.
data : tar_dir_name like SALFILE-LONGNAME.
data : tar_dir_name1 like SALFILE-LONGNAME.
data : sou_filename like EDI_PATH-PTHNAM .
data : tar_filename like EDI_PATH-PTHNAM .
data : filename1 type string .
data : tar_filename1 like EDI_PATH-PTHNAM .
data : file_itab like SALFLDIR occurs 0 with header line.
data : wa_file_itab like SALFLDIR.
data : file_count type i .
data : dir_count type i.
data : dir_table like sdokpath occurs 0 with header line.
data : file_table like SDOKPATH occurs 0 with header line.
data : wa_file_table like sdokpath.
data : strr type string ,
str1 type string ,
str2 type string ,
str3 type string .
DATA : PA_VAL TYPE CHAR1.
sou_dir_name = 'D:\barcodes\files\'.
tar_dir_name = 'D:\barcodes\files-success\'.
"success folder.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
DIRECTORY = sou_dir_name
FILTER = '.'
IMPORTING
FILE_COUNT = file_count
DIR_COUNT = dir_count
TABLES
FILE_TABLE = file_table
DIR_TABLE = dir_table
EXCEPTIONS
CNTL_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ENDIF.
loop at file_table into wa_file_table.
clear : strr , str1 , str2 , str3 .
strr = wa_file_table-PATHNAME .
concatenate sou_dir_name strr into str1 .
concatenate tar_dir_name strr into str2 . " success
concatenate tar_dir_name1 strr into str3 . " failed
FILE = STR1 .
*start-of-selection.
*& Function For Retrieve Data From Excel
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = FILE
i_begin_col = col_start
i_begin_row = row_start
i_end_col = col_end
i_end_row = row_end
tables
intern = excel_bdcdata
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF sy-subrc NE 0.
WRITE : / 'File Error'.
EXIT.
ENDIF.
loop at excel_bdcdata.
translate excel_bdcdata to upper case .
move excel_bdcdata-col to it_index.
assign component it_index of structure wa_file to <fs> .
move excel_bdcdata-value to <fs>.
at end of row.
append wa_file to it_file .
clear wa_file.
endat.
endloop.
sort it_file by key1. "pur_grp maktx plant .
it_header[] = it_file[].
delete adjacent duplicates from it_header comparing key1 pur_grp maktx
plant .
data : h_item(5) type n .
data : h_pack(10) type n .
data : line_no(5) type n .
data : ln_no(5) type n .
loop at it_header into wa_header .
ln_no = 1.
h_item = h_item + 10.
h_pack = h_pack + 1.
wa_req_items-preq_item = h_item .
wa_req_items-doc_type = 'BOM'.
wa_req_items-pur_group = wa_header-pur_grp .
wa_req_items-MATERIAL = wa_header-maktx .
wa_req_items-plant = wa_header-plant .
wa_req_items-pckg_no = h_pack .
wa_req_items-deliv_date = str6 .
wa_req_items-item_cat = '0'.
wa_req_items-acctasscat = 'P'.
*wa_req_items-distrib = '2' .
**wa_req_items-gr_ind = 'X'.
wa_req_items-ir_ind = '2'.
wa_req_items-purch_org = 'TISL' .
wa_req_items-QUANTITY = wa_header-s_qty.
wa_req_items-PREQ_NAME = wa_header-req.
wa_req_items-SUPPL_PLNT = wa_header-supl.
wa_req_items-trackingno = wa_header-trackno.
append wa_req_items to req_items .
clear wa_req_items.
wa_req_acc_asg-preq_item = h_item .
wa_req_acc_asg-g_l_acct = wa_file-gl .
WA_req_acc_asg-wbs_elem = wa_header-wbs .
append wa_req_acc_asg to req_acc_asg .
clear wa_req_acc_asg.
h_pack = h_pack + 1 .
endloop.
clear ln_no .
***BREAK-POINT.
*& BAPI FUNCTION
call function 'BAPI_REQUISITION_CREATE'
importing
number = number
tables
requisition_items = req_items
requisition_account_assignment = req_acc_asg
return = return .Can someone please give me sol........
-
Reading long text from excel file to an internal table
Hi
Can any body tell me how to read long text from excel file to an internal table.
When i am using this FM KCD_EXCEL_OLE_TO_INT_CONVERT then it is reading only 32 characters from each cell.
But in my excel sheet in one of the cell has very long text which i need to upload into a internal table.
may i know which FM or what logic i need to use for this problem.
RegardsHi,
Here is an example program. It will upload an Excel file with two columns. You could also assign the Excel structure dynamically, but I wanted to keep the example simple. The main point is that the internal table (it_excel in this example) must match the Excel structure that you want to convert.
Remember, this is just an example to help you figure out how to properly use the technique. It will certainly need to be modified to fit your requirements, and as always there may be a better way to get the Excel converted... this is just one possibility that has worked for me in the past.
*& Report zexcel_upload_test *
REPORT zexcel_upload_test.
TYPE-POOLS: truxs.
TYPES: BEGIN OF ty_excel,
col_a(10) TYPE n,
col_b(35) TYPE c,
END OF ty_excel.
DATA: l_data_tab TYPE TABLE OF string,
l_text_data TYPE truxs_t_text_data,
l_gui_filename TYPE string,
it_excel TYPE TABLE OF ty_excel.
FIELD-SYMBOLS: <wa_excel> TYPE ty_excel.
PARAMETERS: p_file TYPE rlgrap-filename.
* Pass the file name in the correct format
l_gui_filename = p_file.
* Upload data from PC
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_gui_filename
filetype = 'ASC'
has_field_separator = 'X'
CHANGING
data_tab = l_data_tab
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 ...
EXIT.
ENDIF.
* Convert from Excel into the appropriate itab
l_text_data[] = l_data_tab[].
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = l_text_data
i_filename = p_file
TABLES
i_tab_converted_data = it_excel
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ...
EXIT.
ENDIF.
LOOP AT it_excel ASSIGNING <wa_excel>.
* Do something here...
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM filename_get CHANGING p_file.
* FORM filename_get *
FORM filename_get CHANGING p_in_file TYPE rlgrap-filename.
DATA: l_in_file TYPE string,
l_filetab TYPE filetable,
wa_filetab TYPE LINE OF filetable,
l_rc TYPE i,
l_action TYPE i,
l_init_dir TYPE string.
* Set the initial directory to whatever you want it to be
l_init_dir = 'C:\'.
* Call the file open dialog without multiselect
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Load file'
default_extension = '.XLS'
default_filename = l_in_file
initial_directory = l_init_dir
multiselection = 'X'
CHANGING
file_table = l_filetab
rc = l_rc
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
REFRESH l_filetab.
ENDIF.
* Read the selected filename
READ TABLE l_filetab INTO wa_filetab INDEX 1.
IF sy-subrc = 0.
p_in_file = wa_filetab-filename.
ENDIF.
ENDFORM. " filename_get
Regards,
Jamie -
Data upload from excel into SAP
Hi Gurus
Could anyone please guide me how to upload excel data into SAP?
I need to update existing Gross weight and Net weight data. Got new data in excel format.So need to upload excel file straight into SAP and update the data.
Step by step procedure will be much appreciated.
Rgds
Utpaltry with bdc .....
below coding is move the data from excel to internal table ....
TYPES: BEGIN OF s_ovro,
VKORG LIKE V_TVSFK-VKORG,
VTWEG LIKE V_TVSFK-VTWEG,
SPART LIKE V_TVSFK-SPART,
STGKU LIKE V_TVSFK-STGKU,
STGAK LIKE V_TVSFK-STGAK,
STAFO LIKE V_TVSFK-STAFO,
END OF s_ovro.
DATA: I_OVRO TYPE TABLE OF s_ovro,
w_ovro type s_ovro.
data : request(15) type c,
i type c.
DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
FIELD-SYMBOLS: <FS1> TYPE ANY.
include bdcrecx1.
SELECTION-SCREEN BEGIN OF BLOCK DATA WITH FRAME.
PARAMETERS: P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\Documents and Settings\itfactory\Desktop\sd1.xls' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK DATA.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
start-of-selection.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 24
I_END_ROW = 60000
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
LOOP AT IT_EXCEL.
ASSIGN COMPONENT IT_EXCEL-COL OF STRUCTURE
W_ovro TO <FS1>.
<FS1> = IT_EXCEL-VALUE.
AT END OF ROW.
MOVE-CORRESPONDING: Wib TO Iib.
APPEND w_ovro to I_ovro.
CLEAR W_ovro.
ENDAT.
ENDLOOP.
through bdc program update the data from internal table to bdc... -
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
How to remove a keyword from a group of photos
I want to remove a keyword from a group of photos. They all have the same keyword attached, of course. When I right-click keyword and choose 'Remove keyword from selected photos' it removes the keyword from the most-selected photo ONLY, not from all photos that are selected. I have to remove the keyword from each photo one at a time.
I'm running LR 5.6 on a Mac.
Thanks for any assistance.etmarcr wrote:
I didn't think about..
Perhaps not the most intuitive, but that's how I do it..
Free tip: to assign to all, remove the '*' (asterisk). -
How do you assign keywords in iMovie 10.0.7?
I cannot find how to assign keywords in iMovie 10.0.7.
This reply doesn't reflect the iMovie '11 interface. This looks like the older versions, which allowed the user to toggle Advanced Tools. iMovie '11 does not have this option, and there are no Inspect or Keyword buttons available. I've searched all over YouTube and Google trying to find an answer to what seems to be a common and simple problem. Was the keyword capability removed from iMovie 10.0.x versions?
-
How to update Ztable from Excel file and how to check conditions ,
HI this uday,
pls help me how can i update Ztable from Excel file and how to check conditions .
regards
uday
Moderator message: please (re)search yourself before asking.
Edited by: Thomas Zloch on Jul 13, 2010 12:00 PMHi
Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
L_INTERN : internal table with your fields .
make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
LOOP AT L_INTERN INTO WA_LINTERN .
MOVE WA_LINTERN-COL TO L_INDEX.
ASSIGN COMPONENT L_INDEX OF STRUCTURE WA_INREC TO <FS> .
IF SY-SUBRC = 0.
MOVE WA_LINTERN-VALUE TO <FS>.
ENDIF.
AT END OF ROW . "#EC *
APPEND WA_INREC TO IT_DATA. "
CLEAR WA_INREC.
ENDAT.
ENDLOOP.
Regards
Swapnil
Maybe you are looking for
-
Unable to run HelloWorld Programm from different jdevloper project.
HI, I have created the HelloWorld programm provided in cdb development kit in another jdevelper project and included all the jar files provided in the cdb development kit lib folder. the program looks like this. package bean; * Copyright (c) 2007, Or
-
Sorting entire records Problem: Assume you have an array of 20 items (master array), and first 5 items are pulled into another array (paged array), Which is the dataprovider for the datagrid. And the datagrid has 10 columns. When the user sorts on th
-
Changing Acrobat 9 pro extened Japanese Version to English Settings
I have purchased a Japanese Acrobat 9 pro extended for the Japanese capabilities but would like to have the settings and tool bars in English is this possible? Thank you...
-
Problems connecting to Oracle 11g R1 RAC
Hi everybody In my factory we hava a web aplication called Matrix one that is connected to an oracle database 11g. This aplication uses Weblogic 9.2.3 to load the web pages. Until now we had an oracle running in one server, but now we have put an ora
-
Next-gen Applet is completely blank on Mac OS X
Hi. I am experiencing a strange behavior on Mac OS X with Java Applets deployed though the JNLP mechanism (i.e., exploiting the next-generation Java Plug-in). For testing purposes, I have developed a VERY SIMPLE applet, just setting a BorderLayout on