Macros in LSMW
Hi all,
Do we use macros in the data conversions using LSMW. if yes could you please let me know how.
regards,
Kotireddy
We do not need to use macros in LSMW for conversions
But if you do want to write some codes for it you can use the option Rules.
In the option <b>'Maintain Field Mapping and Conversion Rules'</b> Choose a field and then you can click on rule
you can write some code for that particular field with the option <b>'ABAP Code'</b>.
the value to be manipulated would normally be in <Source Structure-fieldname > and the output of your code should be in the Standard fields e.g BBKPF-BLDAT(for finance documents)
Similar Messages
-
Error while performing LSMW or SHDB for KE52
HI,
I am facing problem in LSMW or SHDB for Ke52, whenever i am processing more than one record with BDC, the screen defaults the record profit center for the next records also skipping the first screen of KE52.
I need to change profit center group for profit centers.. this is mass change more than 7000 profit centers. I need to do this with LSMW or SHDB.. but system not processing properly.
can anyone guide me on this.
Thanks
PragyaHi Abhishek,
Thanks for the reply, BAPI's can be used. but now my problem solved. We have used SHDB for changing profit center or cost center. we have used a macro for this and while recording first we have used T code OKKS to default the controlling area and then used KE52 for changing profit center. It worked.
Thanks
Pragya
Edited by: Pragyam on Jan 14, 2012 10:17 AM -
LMSW or Excel macro...that is the question
Hi all,
I've written an interface that uploads planned independent requirements from a spreadsheet...couldn't have done it without the assistance of this forum of course...thank you!!! Now I've been handed a spreadsheet from a legacy system that contains requirements data. I've been asked to convert this existing spredsheet to the new format so the data can be loaded via my program. So I'm struggling with the idea of creating an Excel macro to convert the legacy file to the new format or use LSMW to perform the data load directly. I know nothing about LSMW. also, I had to create a custom BAPI from the SAP provided version to meet all of the functional requirements. Can someone give me some advice on how to best proceed?
regards,
MatHi Mathew,
Since u have already written a interface to update the PIR data guess you can use the same program to upload the data from the legacy spreadsheet and massage the data in the custom program itself and bring the data into a format which ur current program can accept. Since u already have a program just using them would make life more easy.
Cheers
VJ -
MySAP + Excel Macros + Upload OA
Hello,
I was wondering if anyone in the forum might be familiar with MySAP. We recently updated our system.
Prior to the change we used a macro that allowed us to upload an Outline Agreement into the system. Now we are unable to use this macro. Has anyone had similar issues? Would you be willing to share a macro if that is possible?
Regards,
JudiHello Judith,
I'm afraid your question is not that precise.
Your macro can simply be outdated with the actual sap transaction...(depends from which release you come to which one...)
Anyhow of course one could correct that "macro" or another solution (less release dependant to my knowledge) would be to use "an LSMW" to upload your contract.
Maybe one of your BC (technical) might help you on that.
cheers -
Logical filename and logical path in lsmw
Hi all,
I am doing a lsmw for purchasing info record . i created a logicalpath and assigned a physical path to that . i created a logical filename and assigned the logical path .but when i assign that to the lsmw it is throwing error as 'LOGICAL PATH DOES NOT POINT TO PHYSICAL DIRECTORY' .
can anybody provide a solution for that .
Thanks & regards
Magesh anandanhi ,
goto the tcode file then u find the relation between the logical and physical paths ...and their assignment..
hope it will helps u..
regards,
venkat. -
Hello Friends
I want to find if anybody can guide me on how to get all open sales order tables , i want to create a format and create a flat file for uplodading the file , for this what do i need and how do i do it.
Also for creating LSWM can i use the existing one which i can just Assign the New file to the existing one .
Regards.Dear Mehmood,
I want to find if anybody can guide me on how to get all open sales order tables
You want to extract all the open sales orders- which you can get from Table:VBUP key in overall document status in selection screen ( You can use VBUK also- but if there are certain sales orders in which some of the items are completed or few of them open, using VBUK - you will not get exact records)
Secondly, you can get the data by using Query also- in SQVI
design a query with VBAK / VBAP & VBUP
so that from VBAK you can give time period & sales area details
from VBAP - you can enter plant relevant details to filter certain records & item category as well
where as VBUP- filter wth the status.
once downloaded store in flat file.
Now Create LSMW object by using batch input recording method. after mapping the relevant fields,
prepare the flat file in such a - it suits to the upload file / recording file. then you can upload the already downloaded n stored open sales orders in flat file.
Hope this is what you are looking for.
Regards,
ReazuddinMD -
Macro to open and save as a value in a cell
How can I create a macro (I've named it Test) that will:
1.bring up the open dialogue box (to allow the user to choose a file)
2.save the file, with the file name determined by the text in cell A3 in .xlsx format
I have two pieces code that seem to work individually, but not together:
Dim strFileName As String
strFileName = Application.GetOpenFilename
If strFileName = "False" Then Exit Sub
MsgBox strFileName
ThisFile = Range("A3").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
Thanks for the help!Hi
With very little change, this works for me. I just declared your last variable. (thisFile)
Sub test()
Dim strFileName As String, thisFile As String
strFileName = Application.GetOpenFilename
If strFileName = "False" Then Exit Sub
MsgBox strFileName
thisFile = Range("A3").Value
ActiveWorkbook.SaveAs Filename:=thisFile
End Sub
Cimjet -
Memory usage of excel stays high after Macro is executed and excel crashes after trying to close it
Hi,
I'm trying to resolve an issue with an excel based tool. The macros retrieve data from an Oracle database and do calculations with the data. They also open and write into files in the same directory. The macros all run and finish the calculations. I can
continue to use and modify the sheet. I can also close the workbook, however excel memory usage I see in the windows Task manager stays elevated.If I close Excel it says: Excel stopped working and then it tries to recover information...
I assume something in the macro did not finish properly and memory was not released. I would like to check what is still open (connection, stream or any other object) when I close the workbook I would like to have a list of all still used memory. Is there
a possibility to do so.
Here the code I'm using, its reduced to functions which open something. Functions
get_v_tools() and get_change_tools() are same as get_client_positions().
Public conODBC As New ADODB.Connection
Public myPath As String
Sub get_positions()
Dim Src As range, dst As range
Dim lastRow As Integer
Dim myPath As String
lastRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row
Sheets("SQL_DATA").range("A2:AD" & lastRow + 1).ClearContents
Sheets("SQL_DATA").range("AG2:BE" & lastRow + 2).ClearContents
Sheets("SQL_DATA").range("AE3:AF" & lastRow + 2).ClearContents
k = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
Sheets("ToolsList").range("A2:M" & k).ClearContents
'open connection
Call open_connection
lastRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row
If lastRow < 2 Then GoTo ErrorHandling
'copy bs price check multiplications
Set Src = Sheets("SQL_DATA").range("AE2:AF2")
Set dst = Worksheets("SQL_DATA").range("AE2").Resize(lastRow - 1, Src.columns.Count)
dst.Formula = Src.Formula
On Error GoTo ErrorHandling
'new prices are calculated
newPrice_calculate (lastRow)
Calculate
myPath = ThisWorkbook.Path
'Refresh pivot table in Position Manager
Sheets("Position Manager").PivotTables("PivotTable3").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
myPath & "\[Position_Manager_v1.0.xlsm]SQL_DATA!R1C2:R" & lastRow & "C31" _
, Version:=xlPivotTableVersion14)
ErrorHandling:
Set Src = Nothing
Set dst = Nothing
If conODBC.State <> 0 Then
conODBC.Close
End If
End Sub
Sub open_connection()
Dim sql_data, sql_data_change, sql_data_v As Variant
Dim wdth, TotalColumns, startRow As Integer
Dim rst As New ADODB.Recordset
Errorcode = 0
On Error GoTo ErrorHandling
Errorcode = 1
With conODBC
.Provider = "OraOLEDB.Oracle.1"
.ConnectionString = "Password=" & pswrd & "; Persist Security Info=True;User ID= " & UserName & "; Data Source=" & DataSource
.CursorLocation = adUseClient
.Open
.CommandTimeout = 300
End With
startRow = Sheets("SQL_DATA").Cells(Sheets("SQL_DATA").rows.Count, "A").End(xlUp).Row + 1
sql_data = get_client_positions(conODBC, rst)
wdth = UBound(sql_data, 1)
Sheets("SQL_DATA").range("A" & startRow & ":AA" & wdth + startRow - 1).Value = sql_data
'Run change tools instruments
startRow = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
sql_data_change = get_change_tools(conODBC, rst)
wdth = UBound(sql_data_change, 1)
Sheets("ToolsList").range("A" & startRow & ":M" & wdth + startRow - 1).Value _
= sql_data_change
'open SQL for V tools instruments
startRow = Sheets("ToolsList").Cells(Sheets("ToolsList").rows.Count, "A").End(xlUp).Row + 1
sql_data_v = get_v_tools(conODBC, rst)
wdth = UBound(sql_data_v, 1)
Sheets("ToolsList").range("A" & startRow & ":L" & startRow + wdth - 1).Value = sql_data_v
conODBC.Close
ErrorHandling:
If rst.State <> 0 Then
rst.Close
End If
Set rst = Nothing
End Sub
Private Function get_client_positions(conODBC As ADODB.Connection, rst_posi As ADODB.Recordset) As Variant
Dim sql_data As Variant
Dim objCommand As ADODB.Command
Dim sql As String
Dim records, TotalColumns As Integer
On Error GoTo ErrorHandling
Set objCommand = New ADODB.Command
sql = read_sql()
With objCommand
.ActiveConnection = conODBC 'connection for the commands
.CommandType = adCmdText
.CommandText = sql 'Sql statement from the function
.Prepared = True
.CommandTimeout = 600
End With
Set rst_posi = objCommand.Execute
TotalColumns = rst_posi.Fields.Count
records = rst_posi.RecordCount
ReDim sql_data(1 To records, 1 To TotalColumns)
If TotalColumns = 0 Or records = 0 Then GoTo ErrorHandling
If TotalColumns <> 27 Then GoTo ErrorHandling
If rst_posi.EOF Then GoTo ErrorHandling
l = 1
Do While Not rst_posi.EOF
For i = 0 To TotalColumns - 1
sql_data(l, i + 1) = rst_posi.Fields(i)
Next i
l = l + 1
rst_posi.MoveNext
Loop
ErrorHandling:
rst_posi.Close
Set rst_posi = Nothing
Set objCommand = Nothing
get_client_positions = sql_data
End Function
Private Function read_sql() As String
Dim sqlFile As String, sqlQuery, Line As String
Dim query_dt As String, client As String, account As String
Dim GRP_ID, GRP_SPLIT_ID As String
Dim fso, stream As Object
Set fso = CreateObject("Scripting.FileSystemObject")
client = Worksheets("Cover").range("C9").Value
query_dt = Sheets("Cover").range("C7").Value
GRP_ID = Sheets("Cover").range("C3").Value
GRP_SPLIT_ID = Sheets("Cover").range("C5").Value
account = Sheets("Cover").range("C11").Value
sqlFile = Sheets("Cover").range("C15").Value
Open sqlFile For Input As #1
Do Until EOF(1)
Line Input #1, Line
sqlQuery = sqlQuery & vbCrLf & Line
Loop
Close
' Replace placeholders in the SQL
sqlQuery = Replace(sqlQuery, "myClent", client)
sqlQuery = Replace(sqlQuery, "01/01/9999", query_dt)
sqlQuery = Replace(sqlQuery, "54747743", GRP_ID)
If GRP_SPLIT_ID <> "" Then
sqlQuery = Replace(sqlQuery, "7754843", GRP_SPLIT_ID)
Else
sqlQuery = Replace(sqlQuery, "AND POS.GRP_SPLIT_ID = 7754843", "")
End If
If account = "ZZ" Then
sqlQuery = Replace(sqlQuery, "AND AC.ACCNT_NAME = 'ZZ'", "")
Else
sqlQuery = Replace(sqlQuery, "ZZ", account)
End If
' Create a TextStream to check SQL Query
sql = sqlQuery
myPath = ThisWorkbook.Path
Set stream = fso.CreateTextFile(myPath & "\SQL\LastQuery.txt", True)
stream.Write sql
stream.Close
Set fso = Nothing
Set stream = Nothing
read_sql = sqlQuery
End FunctionThanks Starain,
that's what I did the last days and found that the problem is in the
newPrice_calculate (lastRow)
function. This function retrieves data (sets it as arrays) which was correctly pasted into the sheet, loops through all rows and does math/calendar calculations with cell values using an Add-In("Quantlib")
Public errorMessage as String
Sub newPrice_calculate(lastRow)
Dim Type() As Variant
Dim Id() As Variant
Dim Price() As Variant
Dim daysTo() As Variant
Dim fx() As Variant
Dim interest() As Variant
Dim ObjCalend as Variant
Dim newPrice as Variant
On Error GoTo Catch
interest = Sheets("SQL_DATA").range("V2:V" & lastRow).Value
Type = Sheets("SQL_DATA").range("L2:L" & lastRow).Value Id = Sheets("SQL_DATA").range("M2:M" & lastRow).Value Price = Sheets("SQL_DATA").range("T2:T" & lastRow).Value
daysTo = Sheets("SQL_DATA").range("K2:K" & lastRow).Value
fx = Sheets("SQL_DATA").range("U2:U" & lastRow).Value
qlError = 1
For i = 2 To lastRow
If (i, 1) = "LG" Then
'set something - nothing spectacular like
interest(i, 1) = 0
daysTo(i , 1) = 0
Else
adjTime = Sqr(daysTo(i, 1) / 365)
ObjCalend(i,1) =Application.Run("qlCalendarHolidaysList", _
"CalObj", ... , .... other input parameters)
If IsError(ObjCalend(i,1)) Then GoTo Catch
'other calendar calcs
newPrice(i,1) = Application.Run( 'quantLib calcs)
End If
Catch:
Select Case qlError
Case 1
errorMessage = errorMessage & " QuantLibXL Cal Error at: " & i & " " & vbNewLine & Err.Description
ObjCalend(i,1) (i, 1) = "N/A"
End Select
Next i
Sheets("SQL_DATA").range("AB2:AB" & lastRow).Value = newPrice
'Sheets("SQL_DATA").range("AA2:AA" & lastRow).Value = daysTo
' erase and set to nothing all arrays and objects
Erase Type
Erase id
Erase Price
Set newPrice = Nothing
Is there a possibility to clean everything in:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
End Sub
Thanks in advance
Mark -
Hi,
I have created a LSMW for updating sales office in the Sales order by using Direct input method.
While specify files;I specified the file saved in the Desktop.While saving I get an error saying 'Logical path is not specified'.
Can anyone tell me why this error occurs and how to rectify this??
Thanks in Advance.
Thanks&Regards,
Sophia XavierHI
Place the cursor on "legacy data" and click on "create" option.
You will get one screen. There, you have input box called "FILE". By selecting drop box or pressing F4 on that, you will get all folders, files available at ur PC.
Search for you file, and double click on ur file. Next give all mandatory information in that screen. Finally press ok and save your "specify screens". It can be saved.
Reward if it is useful.
Thanks.
Siva kumar -
Creation of partner functions for customer master with LSMW
Hello,
I try to create partner functions together with a customer via Batch Input in LSMW.
Object: 0050, method: 0000, program name: RFBIDE00, program type: B.
I use the structure BKNVP (Customer master partner functions) to create a new partner and set values for the fields KTONR and PARVW.
When I start the batch input the fields are filled in correctly in a new dynpro. After the confirmation of these values the dynpro changes back to the partner functions sscreen, but the value for KTONR isn'n being transferred. So I get an error message.
Is it only possible to update partner functions with that BI or what is going wrong ?
Thanks in advance and regards
AlexHi Alex,
Could you specify what error message you are getting?
Thanks!
Rudra -
Error in Creation of Purchase Requisition through LSMW
Hi
I am trying to craete a PR upload prog through LSMW batch input method. In the Specify File option I am giving the TXT file destination.The TXT file is saved at my desktop. But while saving it is givving an error as "No logical path has been specified", Message no. /SAPDMC/LSMW_OBJ_060046
If anyone can help me out.Hi,
I would suggest to create a new one for this as file is placed on your desktop. But you can refer the standard one with which you will get the idea for creation:
Standard logical file name for this is: MM_PURCHASING_REQUISITIONS
In this file location is default in location /usr/sap/trans/data/mmrequisitions, instead of this you can give your converted data file name from step 7 Specify file for e.g PROJECT00_CUTOVER_MB1C_1.lsmw.conv
You can refer or use standard logical path LOCAL_TEMPORARY_FILES for this scene.
Hope this solves your problem.
Regards,
Brajvir -
Dear ALL
Recorded an LSMW for PA40 hiring actions which includes infogroup - [ IT 0000, 0001, 0002, 0105-ZVEN (Sub type)]
This is for external vendor employees hiring actions.
While recording or manually running the process, it is working fine.
When in foregroud or background process, the alternate pernr is getting generated. Say for 1st record , pernr generated is 80023, then for next it is 80025, 80027so on.
Kindly suggest me in this issue.
Thanks
MJHi,
1-you keep no range as external and assign PERNR sequentially so that it remains same as you want it
2-kindly go through the LSMW abain to see what have you assigned in field mapping & conversion rules
3- check one record created thru LSMW and see if next (alternate number gets assigned to Ref PERNR in IT0000)
Check the alternate number to see if anything gets assigned to it.
salil -
Hello Experts,
I am creating a macro, where the requirement is; user would select few columns of a KF & hit on a macro.
The values in the KF should get multiplied by 2.
Any clue how should I add ( *2) functionality in operation / function ?. Any other suggestion is welcomed.
Please help
Regards
Rahul ChitteHi Rahul,
You can set the macro to run for few period.
1) In the step of the macro, select the period you want to run
2) Within the step, Results row (Key figure row 'XXX") = Key figure row 'XXX" * 2 (remember to maintain a space between * and 2)
3) Check the macro for any error, which would help you for any inconsistencies
4) activate the macro to test your requirement.
hope this would solve your requirment.
Regards,
Nawanit -
Using a Logical File definition in LSMW
Hi all,
is there any way that we can use a Logical File (defined in transaction FILE) as an application server file in the "specify files" step, instead of having to enter the physical path/file?
Thanks in advance,
JustinHello,
Check pages 46 and 47 of the following document :
[http://sapabap.iespana.es/manuales/pdf/lsmw.pdf|http://sapabap.iespana.es/manuales/pdf/lsmw.pdf]
You can only use a logical filename for subsequent programs (example direct input programs) not for the actual input file of your LSMW.
Wim -
LSMW: Error concerning the logical path in Specify Files step
Hi,
I am trying on an ECC 6.0 EHP6 system to upload (open) POs from an existing SAP ERP system. Since I faced some complications in batch input recording method, I decided to go with the standard batch/direct input method.
I selected object 0085 (Purchase Order) and method 0001 (Purchase Order). The program that is used is RM06EEI0. I followed all the usual steps, but in the "Specify Files" step I get the message:
'****.lsmw.conv' does not exist; edit the logical path using transaction FILE
Being aware of both the FILE and SF01 transactions, I created the logical path and file (through the FILE transaction). However, after the modification, I get the message:
Logical file '****' is not assigned to physical file '****.lsmw.conv'
There is also the related SAP Note 753511 (Logical and physical path and file name in transaction LSMW) that refers to this case.Hi,
Click on specify file radio button>Legacy data-on the PC Front end
where input file location like C:\mydocument\desktop\test.txt
and give input in Name field: mydocument
in delimiter section > select Tabular
File structure section> tick on Field order matches source structure definition
File type: Record end marker(Text file)
then press enter key and other steps as same.
Second thing you said that you have used Batch input recording
after creation and recording finish , scroll the page below on recording and put a cursor unwanted field and remove unwanted input field.
I hope your problem will resolve. you can find the steps pdf on Google search try now.
Thanks
Sanjeet Kumar
Maybe you are looking for
-
Mac Book pro can't connect to Internet through Apple airport extreme base station
I had problems connecting to the internet in the past with my macbook pro. One day it suddenly started working again but then I bought a second apple TV I lost connectivity. I have tried changing the IP address manually and while it shows me connec
-
MacBook Pro - 13" or 15"?
I am going to purchase a macbook pro. I will use it for photos/Aperture, iMovie and internet. I was wondering if the 13" would suffice or do I need the 15"? I heard there was a lack of graphics card in the 13" and that I should get the 15", but that
-
Control nol going to java code
HI.. I am facing a problem. I am doing validation for fileuploader in java. I am able to do the validation in java. But the requirement is to do the validation in java (page code). When i am passing empty string and do a submit, its working fine i.e
-
I begin by using a simple HTML form to look up the record by date. The code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-US" "> <head> <meta http-equiv="Content-Type" content=
-
Open old file (version 2.0)
Hi to all. First of all, sorry for my english, but i'm italian. A Few days ago, my notebook has left me without a reason. The installed version was the 2.0. (yes, it was an old notebook). I was working on a file (5 months of working). I tried to open