How to call RFC from Excel
Hi all,
Can any one give me sample VBA code to connect to SAP and call an RFC.
I have found some code fragments in this forum, I would be grateful if someone can send me code for end-to-end processing.
Regards,
Hanif
Message was edited by: Muhammad Hanif
check out this,
http://www.vbforums.com/showthread.php?t=337408
Regards
Raja
Similar Messages
-
How to call RFC from Power Builder
Hi,
I am using Power Builder Tools and I want to know how can i call RFC from Power Builder
Thanks for ur replyHi,
Although I have not worked with Powerbuilder, I am sure if you have a certain level of proficiency with it, you will be able to code your logic that will call your wrappers written in VB/C/.NET etc. Check out the wonderful weblog by Thomas Jung on integrating ActiveX controls with ABAP Control Framework at https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/995. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
Do get back if you have further queries.
Regards
Message was edited by: Shehryar Khan -
I have created rfc function, and it works fine in SAP, but when I try to call this function from Excel I get '0.00000', data type is correct.
VBA code:
Set F2 = functionCtrl.Add("ZFUNC")
F2.exports("PARAM1") = "123"
F2.exports("PARAM2") = "321"
F2.Call
MsgBox F2.Imports("EXP1").Value
Any suggestions?it's is ok now
-
How to Call RFC from PortalService using a ServiceUser
Hi,
I have some code that calls an RFC using JCO.
(I have other code I wrote using JCA to connect from a portlet, but that requires a Session and uses an IProfile)
Our security team wants me to use a Serviceuser instead. But I can't seem to figure out how to use a ServiceUser to call an RFC.
If I can just get an IConnection, i can use the rest of my JCA code to call the RFC. But I'm stuck getting the connection
The closes I've gotten is this:
com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("myserviceuser");
IConnectorGatewayService cgs=PortalRuntime.getRuntimeResources().getService (IConnectorGatewayService.KEY);
ConnectionProperties cp=new ConnectionProperties(new Locale(),user);
IConnection conn=cgs.getConnection("mySAPsystemalias",cp);
There are two problems with this (or maybe more)
The connectionproperties takes an IProfile not an IUser
I also thought I needed a com.sap.security.api.IUser, not the one above.
Can someone point out what is wrong or a different way?
thanks
Chris BuchholzChris,
You could always use a JCO JNDI connection, in which case you dont need anything other than a HashMap of the the following properties
client
messageserverHost
systemLangauge
group
type
systemType
systemId
serverPort
username
password
The username and password you supply can be a service user or a normal logon user as far as I know.
Cheers,
Steve -
How to call RFC from external System to get HR Data
According to the requirement the "HR" Workflow has to be able to view the employee details from external system Using the standard Microsoft connectors.
So, my job is to create an RFC where i need to fetch the HR data from the infotypes P0001 and P0002. And they will call this RFC by requesting employees surname, ID number and/or Employee number.
Do i need to simply write OPEN SQL statements in RFC or
do i need to call any BAPI's?
Setting up RFC's(Creation of Destinations) is not our job.
Someone Please help me in this regard with some valuable input. Thanks in Advance.
Ram.Hi Ram,
to get the information from HR sytem you could call the BAPI
BAPI_EMPLOYEE_GETDATA
Regards
Bernd -
HOW TO UPLOAD DATA FROM EXCEL TO INTERNALTABLE
HI,
HOW TO UPLOAD DATA FROM EXCEL TO INTERNALTABLE? & WITH EXAMPLE.hi,
chk this, put the data into an excel file.
fields inside it are name and age.
sample excel sheet.
coloumn 1 is name and column 2 is age
name age
A 8
C 13
D 55
DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
data : record like db_name_age occurs 0 with header line.
DATA : v_start_col TYPE i VALUE '1', "starting col
v_start_row TYPE i VALUE '1', " starting row
v_end_col TYPE i VALUE '2', " total columns
v_end_row TYPE i VALUE '10'. "total no of record
FORM f_upload .
CLEAR : int_excel, int_excel[].
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = wf_filename
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = int_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
*Message is 'Unable to upload data from ' wf_filename.
MESSAGE e169(zm050) WITH wf_filename.
ELSE.
SORT int_excel BY row col.
REFRESH : record.
CLEAR : record.
LOOP AT int_excel.
CASE int_excel-col. "go thru each column.
WHEN 1.
record-name = int_excel-value.
WHEN 2.
record-age = int_excel-value.
ENDCASE.
AT END OF row.
APPEND record.
CLEAR record.
ENDAT.
ENDLOOP.
*inserting into table
modfiy db_name_age from table record.
ENDIF.
<i><b>ANOTHER EXAMPLE</b></i>
TYPE-POOLS truxs.
types: begin of t_tab,
col1(5) type c,
col2(5) type c,
col3(5) type c,
end of t_tab.
data : itab type standard table of t_tab,
wa type t_tab.
data it_type type truxs_t_text_data.
parameter p_file type rlgrap-filename.
data ttab type tabname.
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 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
tables
i_tab_converted_data = itab[]
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
end-of-selection.
loop at itab into wa.
write : wa-col1,
wa-col2,
wa-col3.
endloop.
rgds,
anver
<i>if hlped pls mark points</i> -
How to upload data from excel to SAP and options to be used
How to upload data from excel to SAP and options to be used
thank you,
Regards,
Jagrut Bharatkumar shuklaHi Jagrut,
You can use gui_upload.
chk the sample program mentioned below.
REPORT ZFTP .
DATA: BEGIN OF I_FILE OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE.
DATA: BEGIN OF I_FILE2 OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE2.
DATA: W_COUNT TYPE I.
PARAMETERS: P_FILEN TYPE STRING,
P_FILE2 TYPE STRING,
P_NUM(4) TYPE N..
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILEN.
PERFORM F_FILE_GET USING P_FILEN TEXT-G01.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE2.
PERFORM F_FILE_GET USING P_FILE2 TEXT-G01.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = P_FILEN
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = I_FILE
IF SY-SUBRC <> 0.
MESSAGE E024(Z1).
ENDIF.
LOOP AT I_FILE.
W_COUNT = W_COUNT + 1.
IF NOT W_COUNT > P_NUM.
MOVE I_FILE TO I_FILE2.
APPEND I_FILE2.
ENDIF.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = P_FILE2
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = I_FILE2
FIELDNAMES =
*& Form F_FILE_GET
text
-->P_P_FILEN text
-->P_TEXT_G01 text
FORM F_FILE_GET USING L_FILENA L_TEXT.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ',.,*.TXT.'
MODE = 'O'
TITLE = L_TEXT
IMPORTING
FILENAME = L_FILENA
rc =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward if helpful.
Regards,
Harini.S -
Example-- Call RFC from external Java Application
Update: I need code example to call RFC from External Java application. Can onybody help me?
RGDS
RP
hi all.
i want to create my own log for each interface.
i saw this blog:
/people/michal.krawczyk2/blog/2006/09/20/xi-abap-mapping-logs--more-standard-better-visibility
my doubt is how to catch the error that i see in SXI_MONITOR y put it in a Sub-Objetc.
For example: in sxi_monitor i get the error for my interface NMUCustomer: "No receiver could not be found" or "Error Mapping Traformation".
I created an Object called ZNMUCUSTOMER and a Sub-Objetc called ZERROR.
what i must do to get the error I see in monitor and assign it to Sub-Object??
Rgds.
Message was edited by:
Rodrigo Pertierra
Message was edited by:
Rodrigo Pertierra
Message was edited by:
Rodrigo PertierraHi,
Oh, you are using ABAP mapping ......
then use the following in ABAP mapping ..
TRACE1,TRACE2,TRACE3.... for trace level 1,2,3......
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/866ce290-0201-0010-338f-b8c3553aaa0f
Regards
Chilla -
Calling RFC from custom connector
Hi,
I am developing a custom connector for UWL to get tasks from 3rd party system.
I need to call a RFC from backend SAP system to complete Input data for this 3rd party provider.
I assume that I have to make an RFC call from getItems() method of connector.
Any idea how to call a RFC from UWL custom connector code?
Please help.
Thanks & Regards,
AmeyHello Karri,
Yes, I am aware of two ways of calling RFCs from Java code.
Normally, I use following approach to call RFCs from my other Portal Components (JSPDynpages): -
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
String sapSystem = myProfile.getProperty("SystemIdentifier");
ISystemLandscapeWrapper landscapeWrapper = (ISystemLandscapeWrapper) UMFactory.getSystemLandscapeWrappers().get(0);
ISystemLandscapeObject systemLandscapeObject = landscapeWrapper.getSystemByAlias(sapSystem);
IJCOClientService clientService = (IJCOClientService) PortalRuntime.
getRuntimeResources().getService(JCO_CLIENT);
request.getNode().putValue(LOCALE_NODE_KEY, Locale.ENGLISH);
IJCOClientPoolEntry poolEntry = clientService.getJCOClientPoolEntry(sapSystem,request);
JCO.Client client = poolEntry.getJCOClient();
client.connect();
IRepository repository = JCO.createRepository("repository", client);
IFunctionTemplate functionTemplate = repository.getFunctionTemplate(Z_BAPI_EMP_GBU_GET);
JCO.Function function = new JCO.Function(functionTemplate);
JCO.ParameterList importList = function.getImportParameterList();
importList.setValue("US", "OBJTYP");
importList.setValue(request.getUser().getUniqueName(), "USRID");
client.execute(function);
JCO.ParameterList outputList = function.getExportParameterList();
gbuCountryBean.setGbu(outputList.getString("GBU"));
gbuCountryBean.setCountry(outputList.getString("COUNTRYCODE"));
gbuCountryBean.setPersArea(outputList.getString("PERS_AREA"));
gbuCountryBean.setCompanyCode(outputList.getString("COMPANYCODE"));
When I tried implementing same in UWL custom connector, I am not able to get instance of 'request' object.
Any hints/ideas on this?
Hence as an temporary alternative, I wrote following to successfully execute RFC.
mConnection = JCO.createClient(sapclient, sapuser,
sappassword, "EN", saphost, sapsysnumber);
mConnection.connect();
mRepository = new JCO.Repository("GetLeaveRequestFlag", mConnection );
IFunctionTemplate ftemplate = mRepository.getFunctionTemplate(Z_BAPI_CHECK_LR_TO_APPROVE);
myFunction = new JCO.Function(ftemplate);
JCO.Field OBJECT_TYPE = myFunction.getImportParameterList().getField("OBJECT_TYPE");
OBJECT_TYPE.setValue("US");
JCO.Field USERID = myFunction.getImportParameterList().getField("USERID");
OBJECT_TYPE.setValue(p_userID);
mConnection.execute(myFunction);
JCO.Field leaveRequestFlag = myFunction.getExportParameterList().getField("FLAG_LEAVE_REQUEST_RECORD");
mConnection.disconnect();
But only catch here is that I need to create & maintain SAP logon credentials for a particular user manually.
It is not possible to single sign on connector user into SAP system (like its done above).
Any thoughts on this?
Thanks & Regards,
Amey -
Calling RFCs from Webdypro application!!!!
Can anybody show me a suitable example for calling rfc from webdynpro application.
Hi steve,
Look at this tutorial..
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial on accessing abap functions in web dynpro - 4.htm
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial on handling transactions with bapis in web dynpro - 5.htm
Follow the steps provided in those documents.
You can easily understand how to access ABAP functions from WebDynpro.
Let me know if you need more help on this.
Regards,
Karthick -
Calling RFCs from Web through XI
We have used SAP.NET connector in the past to call RFCs from ASP.NET pages from our public website. We have now decided to use XI as the enterprise integration engine going forward.I am interested to know whether anybody has used XI to call RFCs from ASP.NET webpages. I do know that the XI to SAP calls would be made through RFC adapter.Will the communication from ASP.NET page to XI be thourgh the HTTP adapter ? or is there any other smarter way. Can somebody point me to sample code for the calls through http adapter or a how to guide?
cheers
RameshHi
U have scenario like this ASP.NET->XI->RFC, that means u will send a value from the ASP.NET page to RFC thru XI and then this RFC will give result which will come to ASP.NET frontend.
For this go thru this blog it will help u to understand how to communicate from ASP.NET to XI
<b>https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1442</b [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]> [original link is broken]
Code Sample is provided in the blog.
Hope it helps.
Regards
Arpit Seth -
Call RFC from DELPHI Windows Services Program
Hi all,
Are there any way to call RFC from DELPHI Windows Services Program?
Best regards.
Munur EBCIOGLUHi again Bhagat,
1. Yes, it's included on 7.4 ABAP Stack (SAP NetWeaver 7.4 SP8 - Optimized for SAP HANA, Cloud and Mobile - Service Release 2 available now!). In a recent customer, SAP licences GW by user but there are other license model like session licensing: https://store.sap.com/sap/cp/ui/resources/store/html/SolutionDetails.html?pid=0000009470&catID=&pcntry=US&sap-language=EN&_cp_id=id-1385059687642-0
2. You could install as an AddOn on your 7.3 system, there are many options depending on your desired infrastructure: SAP Gateway deployment options in a nutshell For example our customer have deployed Central Hub Gateway in a standalone stack ABAP to act as an standalone oData bridge between ABAP/nonAbap systems.
3. You could deploy SAPUI5 apps in 7.x, Java Web Servers or HTTP Web Servers. You must consider your SSO scenario:
- SSO Logon Tickets. You will need to configurate SSO Logon Tickets between SAP NW Portal & SAP NW Gateway & your backend (ECC, etc). In order to pass SAP session cookie you will need setup SAP Web Dispacther and access portal & gateway throught SAP WD with the same domain.
- SAML2 Tickets. This scenario lets you provide portal & gateway on different domains enabling SSO. You could configure SAP NW Portal as an Identity Provider and other systems must trust SAP Portal as IdP.
Cheers -
How to import data from excel or csv files to Oracle table
hello everybody,
I am new here and new in Oracle. I would like to know the steps how to import data from excel or csv files to Oracle table.
Let say I already have table inside the Oracle. Then my user give me the sets of data inside the Excel Worksheet.
So, how can I import the excel data into Oracle table.
Thank you in advance.
cheers,
shimaEven easier. Download JDeveloper 11G from this site.
Set up the database connection, right click on the table, select Import->Excel and specify your file to load it. On the import pop-up, you must view and update each tab indicating Columns, Data Types, and DML.
Columns -- move the selected columns that you want to load to the box on the right
Data Types -- select column name from second column to which the data for each column of the import file should load
DML -- click this tab to generate the INSERT SQL
Once done click 'Insert' -
Related documents or links on how to call webservices from WDJ
Hi all
i need documents & links on how to call webservices from Webdynpro for Java.
if anybody send the documents on sample scenarios on the same then it is the great help to me...
Thanks
SunilHi Sunil,
May these links help you.
http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/frameset.htm
http://help.sap.com/saphelp_nwce10/helpdata/en/64/0e0ffd314e44a593ec8b885a753d30/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/d2/0357425e060d53e10000000a155106/frameset.htm
and the below thread to call weservices in java.
Re: How to call a web service from Java
Regards,
Supraja -
Calling RFC from JSP : development component
Hi everyone,
I created JSP that call RFC from SAP/R3.
I have problem with the DestinationService.
Without DCs, it worked very good.
But since I created a DC for my JSP project, I have exception at run time regarding
the java.lang.NoClassDefFoundError: com/sap/security/core/server/destinations/api/DestinationService.
Eventhough I add the specific jar, I get an excpetion.
Thanks for the help.
DavidGo to the application-j2ee-engine.xml file and add following reference:
<reference
reference-type="weak">
<reference-target
provider-name="sap.com"
target-type="interface">tcsecdestinations~interface</reference-target>
</reference>
Maybe you are looking for
-
My Q5 started acting weird last evening...Whenever I set the alarm, an alarm (clock) icon appears on the top left of the screen. But now after setting the alarm, the icon does not appear. The alarm also fails to work even when one has set it. I am up
-
SCM client copy- Problem in CIF
Hi, Recently we done client copy from production system to test system for both SCM as well as ecc system. Problem is Master data is with logical system name of production system in APO. We defined only logical system names for ECC and SCM client an
-
ORA-01882:timezone region not found while trying to add ADF-BC Fact in Rule
Hi, I want to use the SOA component "Oracle Business Rules" in the ADF application. I created a ADF Application, created relevant VO's. I created a SOA project in the same workspace and tried to add a ADF-BC fact to the Business Rule component. I con
-
TomaHawk dataList tag and javaScipt
Hi, Does anyone have a sample javaScript function to access an inputText field inside a dataList tag? Thanks.
-
Sign in password not recognozed problem - is there...
I've browsed many posts where people cannot sign in due to a password not recognized error. Has anyone found a fix for this? I've tried a hard power off/on and deleting and re-installing Skype, but still get the error.