Call RFC_READ_TABLE via VBA.
I try to get data from table LFBK (bank data for vendor).
Here is my VBA code to get data, it's not works. Anyone can suggest me what's wrong? Thank you very much.
Anek
Public Sub RFC_Read_Table()
Dim Functions As Object
Dim RfcCallTransaction As Object
Dim Messages As Object
Dim BdcTable As Object
Dim tblOptions
Dim tblData
Dim tblFields
Dim strExport1
Dim strExport2
Dim filOutput
Dim intRow As Integer
Set Functions = CreateObject("SAP.Functions")
Functions.Connection.System = "PDS"
Functions.Connection.client = "240"
Functions.Connection.user = "S0110028"
Functions.Connection.Password = "0603cacc"
Functions.Connection.Language = "EN"
If Functions.Connection.Logon(0, False) <> True Then
Exit Sub
End If
Set RfcCallTransaction = Functions.Add("RFC_READ_TABLE")
Set strExport1 = RfcCallTransaction.exports("QUERY_TABLE")
Set strExport2 = RfcCallTransaction.exports("DELIMITER")
Set tblOptions = RfcCallTransaction.Tables("OPTIONS") '
Set tblData = RfcCallTransaction.Tables("DATA") '
Set tblFields = RfcCallTransaction.Tables("FIELDS") '
strExport1.Value = "LFBK"
strExport2.Value = ";"
tblOptions.AppendRow
tblOptions(1, "TEXT") = "LIFNR EQ '41'" ' Suppose I want to bank data from vendor number 41.
tblFields.AppendRow
tblFields(1, "FIELDNAME") = "LIFNR"
tblFields.AppendRow
tblFields(2, "FIELDNAME") = "BANKS"
tblFields.AppendRow
tblFields(3, "FIELDNAME") = "BANKL"
tblFields.AppendRow
tblFields(4, "FIELDNAME") = "BANKN"
tblFields.AppendRow
tblFields(5, "FIELDNAME") = "BUTYP"
If RfcCallTransaction.Call = True Then
If tblData.RowCount > 0 Then
Dim DatTxt, OutputTxt As String
OutputTxt = "Vendor, Bank Country, Bank Key, Book No., Run No."
DatTxt = "c:\bankdata.txt"
Open DatTxt For Output As #1
Print #1, OutputTxt
For intRow = 1 To tblData.RowCount
OutputTxt = tblData(intRow, "WA")
Print #1, OutputTxt
Next
Close #1
Else
MsgBox "No records returned"
End If
Else
MsgBox "Error"
End If
Set filOutput = Nothing
Functions.Connection.Logoff
End Sub
Hi Raj,
I've looking a long time on the web, i would like some direction on this,
Im facing excatly the same trouble above, just a little different, i need to place several numbers on the list, when i type more than 2 number on: tblOptions(1, "TEXT") = "LIFNR IN ('0000000041','0000000060')" , it fires an error "system failure".
I need to pull out about 1k data numbers and i wrote a piece of code to add several numbers in a string variable:
Dim material as String
dim myMaterialNumber(10000) as String
i = 1
j = 0
Do While Worksheets("Sheet1").Range("M2").Cells(i, 1) <> ""
material = Worksheets("Sheet1").Range("M2").Cells(i, 1)
j = j + 1
If Len(material) = 10 Then
myMaterialNumber(j) = "00000000" & Replace(material, "-", "")
Else
myMaterialNumber(j) = "00000" & Replace(material, "-", "")
End If
If j = 1 Then
eljuntos = "'" & myMaterialNumber(j)
Else
eljuntos = eljuntos & "','" & myMaterialNumber(j)
End If
i = i + 1
Loop
eljuntos = eljuntos & "'"
But when i try to use the sentence IN(, it appears a "system failure error", and doing it one by one takes too long.
objOptTab.Rows.Add
objOptTab(objOptTab.RowCount, "TEXT") = "MATNR IN (" & eljuntos & ") and "
objOptTab.Rows.Add
objOptTab(objOptTab.RowCount, "TEXT") = "WERKS EQ '7034'"
This passes with no error,
But when the function is called:
If objRfcFunc.call = False Then
MsgBox objRfcFunc.Exception
End If
It fires a "System Failure" Error.
I've found that the sentence OR could be helpful but i haven't found how this sentece works.
Please help Raj!
Many thanks in advance!
Similar Messages
-
How to set a sheet as Ad Hoc via VBA ...
We keep trying to convert our existing workbooks for Smart View.
As you can imagine this is a nightmare process but we keep trying ...
There is some progress and we learnt a lot on the way but we still face some major issues - we find SV with VBA to be an unpredictible combo.
Anyway ...
In simple words I use a sequence of VBA SV API calls to create private connection (HypCreateConnection), to connect the sheet (HypConnect) and to retrieve data (HypRetrieveRange) - along the way I set up SV options and hide the Panel and the POV.
All "by the book" - I wish such "a book" ever existed ... I mean the documentation is far from "in depth" ...
The process works in c. 80% of cases (i.e. grids) but it fails on some (so far I found no correlation with anything else)
I have tried and tried all sorts of tricks to debug it.
It works with ALL grids in 1 in 20 tests but you can never predict when and why.
So it can work but something somewhere causes the process to fail on some grids in most of the tests.
I noticed one detail ...
While the sheet gets connected and retrieved with our process the Sheet Info still shows the sheet status as Empty ...
When working from a blank worksheet and with the Panel open (i.e. NOT via VBA) one of the steps is to click on Ad Hoc Analysis button.
It is unclear to me what exactly this one step does and it does not seem to be connecting or refreshing the grid.
It seems it defines the grid to be an Ad Hoc one.
Can the same be achieved programatically via VBA ?
So far I have NOT found any equivalent API call.
In desperation I am going to replace all HypRetrieveRange calls with HypMenuVRefresh call.
Would it define the sheets as Adf Hoc ?
I will find out ...
Will it help with some odd grids ?
Fingers crossed it will.
RegardsHi Deiter,
You can achieve this with below steps.. I am giving below steps considering you want
to keep the condition type set as Obligatory always in your Pric Procedure
-> Write a custome routine for "Requirement Routine" with the logic : When item category
is ZAN, remove "Obligatory" check from KOMT1-KOBLI.
-> Assign this routine to condition type ZZ00
you are ready to go now.
Why i am suggesting this...
-> Industry best practise, to write minumum codes in user exits (in this case it will be sales user exit),
as it increases system response time
-> If we change someting in user exit, imagine, everytime you are creating a Sales Order, which does
not call for this pricing procedure (with cond typ: ZZ00 ), still this part of user exit code written
to check if item cat is ZAN or not will be called, so why to make system work more when
actually not required
Hope this helps !
Regards
Subhajit -
Control BEx Analysis Grid context menu entries via VBA
Hey Forum,
I have kind of a tricky question for you. I want to control BEx Analysis Grid context menu entries via VBA, namely the Expand Hierarchy Node function when I right click on a Hierarchy node entry.
Does anyone know how to access this function via VBA?
I also thought about adding a BEx button and access it via VBA but I am lacking the correct Button Parameters to expand/collapse a hierarchy node.
Anyone has a tipp for me?
Thanks,
R.Hello, DDrazdou and All too
Did you have any information about requested function?
I need to call binded transaction in R\3, and meanwhile, I just write wrapping functional module in the R\3, and making RFC call from VBA...
It seems to work fine, but may be the better(standart) way is posible.
with best regards, Alex. -
The ForEach Loop Enumerator is Empty - SSIS Error when executing through CMD via VBA
I am currently working on a SSIS package that is to be triggered through CMD via VBA (Access). All that the package does is read a bunch of files from a folder and upload them into a table in SQL Server. The tricky part comes is that this folder location from
which the package is to read the files is dynamic.
I figured out a way to make it dynamic, by using variables
I have used the following variables:
"Directory" against DIRECTORY in COLLECTION>>EXPRESSIONS in the ForEachfile Enumerator,
"FilePath" (With Index 0) in the Variable Mappings
PROBLEM : As the final link in the chain, I have used following to be triggered from VBA
dtexec \f "C:\Desktop\SSISAppend.dtsx" /Set "\Package.Variables[User::Directory].Property[Value];C:\Desktop\AppendFiles"
When I try to execute the package using the above command, it gives out the error
Code : 0x8001C004
Description: The For Each File Enumerator is empty. The For Each File enumerator did not find any files that meatched the file pattern, or the specified directory was empty.
But, when I run the package from MS VisualStudio 2008, the package runs fine, takes the location of the file assigned to the variable "Directory".
All help is appreciatedWhere are you executing the package from? You're giving an aboslute path so this will work only if package as well as the folder is in the same machine from which you execute the above code. Otherwise you need to use UNC path.
Another thing to check is what login is executing the command and you need to ensure it does have access to the directoty path as well as to the path where package resides.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to set variables values via VBA.
Anybody please help.
How to set variables values via VBA in workbook. SAP Netweaver 2004s.Pass variable values with VBA and BI 7.0 funtions to Query
At first a remark u2013 Iu2019ve read a lot of threads saying that passing values to a query can be done by using VBA code only. Iu2019ve tested it but Iu2019m not sufficient with the new BEX 7.0 API and therefore I use a mixture of BEX 7.0 funtionality and VBA. I create a BEX 7.0 design item button passing the values to a query u2013 I hide this button somewhere on the sheet or on a hidden sheet and I then raise the event to click the button from VBA code. Works fine and the maintenance is easier if something changes in the API in the future again.
How to start:
Switch to design mode in BEX Analyzer:
Implement a BEX 7.0 design item u201Cbuttonu201D
Click on the button to implement the properties
Make the input for the commands
data_provider = dataprovider_1
cmd = process_variables
subcmd = var_submit
No comes the part with the variables u2013 Letu2019s assume a query has 4 variables but you only want to change 1 with the button u2013 an organizational unit for instance.
Make a range somewhere in the excel with the following structure:
Name Index Value
VAR_NAME_1 1 Variablename
VAR_VALUE_EXT_1 1 variablevalue
Value should contain the name of your variable of course and u201Cvalueu201D the value of your variable
Set a name for this range with EXCEL functionality but without the header:
Back to the properties of the button: Insert the name of the range with the variables in the field Command Range:
If you have more variables to process you can of course enhance your Filterrange!
In the left upper Corner you have a name for your button:
Now you can raise the button-click in vba like this:
Application.Run "'" & ThisWorkbook.Name & "'!Sheet2.BUTTON_35_Click"
regards, Lars -
Error calling appl. via OLE OA175 after inst. Patch4 or 5 of SAPGUI 7.20
I have maintained a OLE application with the "oaa4 ArchiveLink:Application Maintenance" to do special work on documents with special type.
It worked very well until I installed the Patch4 or Patch5 of the SAPGUI 7.20.
Now I get the message: "Error calling Application via OLE ...".
It looks like a bug in the patches but may be there is something wrong with me (or my application). Has someone any experience with this patch or with this error message.
In the meantime I got an answer:
You have to grant your OLE application in the security options in the SAP-GUI-Configuration.
Edited by: Terkosh on Feb 13, 2012 3:48 PMhow do I grant the OLE application ?
-
Questions regarding FaceTime: When I call someone, it rings but they can't answer and when someone calls me via FaceTime it won't even ring.
Using FaceTime http://support.apple.com/kb/ht4319
Troubleshooting FaceTime http://support.apple.com/kb/TS3367
The Complete Guide to FaceTime: Set-up, Use, and Troubleshooting Problems
http://tinyurl.com/32drz3d
Cheers, Tom -
Hi All,
I'm trying to connect our SolMan development to the CEN. However when registering ccmsr within J2ee admin it gives the following errors.
Does anybody have an idea?
Output for : /usr/sap/DSM/SYS/exe/run/sapccmsr(-j2ee,-v,pf=/usr/sap/DSM/SYS/profile/DSM_DVEBMGS00_ijmdsm01)
CCMS version 20040229, 64 bit, multithreaded, Non-Unicode
compiled at Oct 28 2006 systemid 324 (IBM RS/6000 with AIX)
relno 7000
patch text patch collection 2006/4, OSS note 914721
patchno 83 intno 20050900
running on ijmdsm01 AIX 3 5 00C97C6E4C00
Logfile for : /usr/sap/DSM/SYS/exe/run/sapccmsr(-j2ee,-R,-f,/tmp/csm53771.conf,pf=/usr/sap/DSM/SYS/profile/DSM_DVEBMGS00_ijmdsm01) [Thr 01] Mon Mar 26 13:29:05 2007
INFO: CCMS agent sapccmsr working directory is /usr/sap/ccms/DSM_00/sapccmsr
INFO: CCMS agent sapccmsr config file is /usr/sap/ccms/DSM_00/sapccmsr/csmconf
INFO: Central Monitoring System is . (found in config file)
INFO: additional Central Monitoring System is . (found in config file)
INFO: found ini file /usr/sap/ccms/DSM_00/sapccmsr/sapccmsr.ini.
INFO: Checking Distributed Statistical Records Library dsrlib.o
INFO: checking version an Unicodeness of dsrlib.o
INFO: DSR: Dynamic Library dsrlib.o (version 22) successfully loaded.
INFO: DSR: Dynamic Library dsrlib successfully loaded.
INFO: DSR: Path /usr/sap/ccms/DSM_00/dsr for Distributed Statistical Records.
INFO: CCMS version 20040229, 64 bit, multithreaded, Non-Unicode compiled at Oct 28 2006 systemid 324 (IBM RS/6000 with AIX) relno 7000 patch text patch collection 2006/4, OSS note 914721 patchno 83 intno 20050900 running on ijmdsm01 AIX 3 5 00C97C6E4C00 pid 479452 profile /usr/sap/DSM/SYS/profile/DSM_DVEBMGS00_ijmdsm01
INFO: Attached to Shared Memory Key 73 (size 40000000), no pool used
INFO: Connected to Monitoring Segment segment status WARM_UP segment started at Thu Mar 22 08:58:40 2007 segment version 20040229
INFO: DSM:000:999999 connected to DSM, host ijmdsm01, System Nr. 00, traceflag
INFO: DSM release is 700 , (kernel release 700 )
ERROR: DSM:000:CSMREG calling SALS_MS_GET_LOCAL_MS_INFO via RFC failed, can not get version of DSM. RfcRc = 2, C_CALL_FAILED</b>
INFO: SLM:000:999999 connected to SLM, host rthuas50, System Nr. 10, traceflag
INFO: SLM release is 700 , (kernel release 700 )
INFO: SLM:000:CSMREG connected to SLM, host rthuas50, System Nr. 10, traceflag INFO: SLM release is 700 , (kernel release 700 ), CCMS version 20040229 INFO: RFC logon info for SLM:000:CSMREG can be updated at any time with -R option: sapccmsr -R INFO: Updated saprfc.ini in agent work directory /usr/sap/ccms/DSM_00/sapccmsr
ERROR: Registration failed: Can't get version of DSM. RfcRc = 2, C_CALL_FAILED RFC Error Info for SALS_MS_GET_LOCAL_MS_INFO message: status: EXCEPTION C_CALL_FAILED RAISED intstat: Mon Mar 26 13:29:10 2007 INFO: dsr: dsrlib unloaded.
...closing this logfile...
Registration of CCMS Customizing Destination
Error during registration of CCMS Customizing destination
Source system cannot be set to UnicodeHi,
Check these notes.
641339 - RZ20: CCMS monitoring context loses client assignment
558608 - Correction: Starting/stopping LDAP Connector via CCMS
827843 - Access Alert Analysis Methods that are Defined Locally
Feel free to revert back.
--Ragu -
Just downloaded FACETIME on my 4yr. olf Imac running Snow Leopard. When making a call to my friend's Imac all works correctly going both ways. When my wife calls me via Facetime from her Ipad, I cannot click on "accept"- not there? When called by the Imac (newest), the "accept" or "reject" radio button appears for me to click and connect. On my wife's Ipad the two radio buttons always appear when a call actiivates Facetime and comes on?
There is nothing I can find in "Preferences" in Facetime to turn that on or off. I suspect it has to do with having a more current operating system; that the "controls" are in the operating system? [I'm guessing] It's frustrating getting Facebook calls from several friends on Ipads! Any ideas...VFPI suspect it has to do with not having a more current operating system
Exactly, what Apple is doing is leveraging new features only on newer OS X versions to force you to upgrade OS X to 10.7 or later.
What they don't tell you is 10.7 or later will NOT run your PowerPC based software, some of it you can't get Intel versions like for perfectly working printers, scanners and games etc. So it can be a very expensive OS X upgrade to 10.7 or later with third party software.
http://roaringapps.com/apps:table
Also they don't tell you is the risk in bricking your machine if the update goes badly, so you have to have AppleCare in case that occurs so it's on them to fix it. Else your paying money to replace the logicboard or buying a new machine prematurely.
A four year old machine can't have AppleCare, it's only good for 3 years from date of purchase new.
Your machine came with a boot hard drive, it's usually got about 4-5 years of life on it, then it needs to be replaced.
Also they don't tell you the newer OS X version has more abilities and features that causes your machine to slow down in performance, especially on older machines.
Also they implement new, idotic and extremely fustrating new user interface features in a arbitrary "you take it or leave it" manner with little or no fall back method.
So upgrading OS X is a gamble on older machines that otherwise would likely work perfectly fine for the next 5 years if one didn't need to have to mess with it.
Since Snow Leopard has slightly over 25% OS X version market share, your still good for security updates etc for the next few years if you just want to stay where your at and be happy.
OS X 10.4/10.5 need to upgrade, 10.6.8 ok still
The Lions are, well, not so welcome due to Scott Forstall retard UI issues, OS X Mavericks 10.9 is likely going to fix things a bit better.
But basically what is occuring is Apple is trying to force a faster hardware upgrade cycle with the more expensive products by leveraging features on the smaller devices that expire sooner.
Apple is a hardware company that leverages whatever it can to get you to buy more hardware, it's why they are as rich as they are. -
BEx Analyzer - Edit Variables via VBA
Hi all,
I need to set the BEx variable values via VBA to change a selection for an input ready query.
Is there a way to do that?
Thanks a lot.
Best regards,
Christian.I heard that are some functions in BW 3.5 with getBex and setBex.
But it isn`t supported for BW 7.0. -
Accessing ribbon via vba ApplicationOptionsDialog
hi,
I am using microsoft access 2010 project (adp). I need to disable the file menu when I distribute the ade to
clients.
the backstage disable has no effect. my customized ribbon below. I only need to a way via vba to turn off the
ApplicationOptionsDialog button! thanks!
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab idMso="TabExternalData" visible="false" /> <tab idMso="TabCreate" visible="false" />
<tab idMso="TabDatabaseTools" visible="false" /> <tab idMso="TabHomeAccess" visible="false" />
</tabs>
</ribbon>
<backstage>
<tab idMso="TabInfo" visible="false"/>
<button idMso="FileSave" visible="false"/>
<button idMso="SaveObjectAs" visible="false"/>
<button idMso="FileOpenDatabase" visible="false"/>
<button idMso="FileCloseDatabase" visible="false"/>
<tab idMso="TabRecent" visible="false"/>
<tab idMso="TabNew" visible="false"/>
<tab idMso="TabPrint" visible="false"/>One thing to remember is that backstage commands ONLY work for the system wide ribbon. In other words, you cannot place backstage commands in a ribbon assigned to a given form/report.
And as noted here, your schema definition needs to be changed from:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
To
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
As a general rule, the older ribbon format will work, but not if you using new 2010 features. So backstage commands ONLY work in the application wide ribbon specified for startup. And you need to use the 2009 schema as opposed to 2006 schema.
Regards,
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada -
Hi experts
in interaction center, the users can see the call lists assigned, but they can't modify it.
So, is possible change/delete call lists via WEB UI??? For example add a call at the list, or delete all the call list??
Best regards
MarcoHi,
Starting CRM 7.0 SP4 a lean version of the Call List Management application was developed.
It does not cover all the functionality of the SAP GUI application.
Here is a list of features that are covered in this version of the WebUI application:
- Quick search
View options: tile layout and editable overview page with assignment block
- Advanced search
View options: tree view and table view
- Creation of new call lists
- Edit existing call lists
Update contact persons: When editing a call list, you can update the contact persons. By default, the relationship type Has contact person is considered. Contact persons for whom the Do not contact checkbox is selected, are not added to the list of contact persons.
The following tabs are available:
Call List Details
Execution Progress
Assignment
You can create and delete assignments.
Calls (display only)
Business context (display only)
If you are interested in using this lean version you must upgrade to CRM 7.0 SP4, where this functionality has been made available or else you can always carry on with the SAPGUI version of the transaction CRMD_TM_CLDIST.
Hope this information helps.
Best Regards,
Vinod -
Hi,
I would like to know the procedure to call BEx via VB script. Some background about the issue.
I am in the process of performing the stress test for the BI 7.0 using mercury load runner. So, from the mercury i will be calling the VB script to execute the BI query.
Any help will be highly appreciated.
Regards
SachinHi,
Have a look at this Doc:
www.bwexpertonline.com/downloads/boeke04.doc
Hope this will be helpful.
Regards,
Prema -
How application call servlet via https
Hi guys
Does anybody know how application call servlet via https? Is it same as
http? How can I set up trusted certification? Thanks in advance.
Regards,
Mark.I meant to give a code example in the last one, sorry.
URL u = new URL("https://mysecureURL.com");
javax.net.ssl.HttpsURLConnection conn = (javax.net.ssl.httpsURLConnection) u.openConnection();There is other good info in the JSSE forums.
Cheers,
Peter. -
Hi friends,
While the following commands work great when launched from the T-SQL:
SELECT 'XLS' AS [Version], *
from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0; Database=C:\Users\faraz.qureshi\Desktop\OldJunk\Book1.xls; HDR=YES; IMEX=1',
'SELECT * from [testdata]')
UNION ALL
SELECT 'XLSX', *
from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0; Database=C:\Users\faraz.qureshi\Desktop\OldJunk\Book1.xlsx; HDR=YES; IMEX=1',
'SELECT * from [testdata]');
to import from Excel 2003 as well as Excel 2007+ both, what command could help me to achieve the same without interaction with SSMS, i.e. directly from Excel?
In other words, suppose I have a named range in excel testrange
how can I export the same in a new table named Test
in a database named Test_DB that exists on a server and instance named
MyComputer\SQL_FAQ.
Further, is it necessary to close
the Excel File first? Couldn't I export the selected range of Excel?
Thanks in advance.
Thanx in advance, Best Regards, Faraz A QureshiHi FARAZ,
Regarding your description, Your requirement is about some programing approach to export excel to SQL Server, which is out of the queue of this forum.
According to "via VBA" in your question, I would you suggest you post your question to a dedicated
VBA forum. It is more appropriate and more experts will help you.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support
Maybe you are looking for
-
I use a microdost exchange 2010 in my office. I just bought a macbook pro and try to syn my office mail. While it has been set up properlly and it has started downloading some of my older emails, it is taking very long and does not download all the
-
Relation between business area and WBS element in sales orders
Hi, I need to find the business area for WBS element for line items in sales orders. Which database table can I use for that. Thanks, Abhishek
-
I want to make space on my harddrive. How do I burn Clips from my Events to DVD as a backup so that I can delete certain Events? Thanks
-
How can i make a picture in html?
How can i insert an image in html script. I want when people visit me website they can see a picture. But how can a insert a pictrue from my laptop to my html script?
-
My nano has a white screen cannot reset
My nano has a white screen I tried the menu select buttons to do a reset it resets but the screen is still white. I could faintly see the apple sysmbol if I look at the nano at a sharp angle.