09-11-2007 4:52 AM
Hi ALL ,
How to call a Non-SAP ( applications written in other technologies) from ABAP.
09-11-2007 5:00 AM
Well for calling an application ( without callback) you can use fm - WS_EXECUTE
Example -
CALL FUNCTION WS_EXECUTE
EXPORTING PROGRAM = 'winword'
launches MS Word.
Now if you want to execute them with callback then - you will have to go for OLE automation. The prerequisite is the Application has to support the OLE automation framework. You can do them like this -
DATA : H_EXCEL TYPE OLE2_OBJECT,
H_WRKBK TYPE OLE2_OBJECT,
* Create Excel Application.
CREATE OBJECT H_EXCEL 'Excel.Application'. " This is the CLSID.
CHECK SY-SUBRC EQ 0.
* Get the Workbook object.
CALL METHOD OF H_EXCEL 'Workbooks' = H_WRKBK.
CHECK SY-SUBRC EQ 0.
Hope it helps.
09-11-2007 5:12 AM
HI SKC ,
Thanks for your reply .Sorry , i think i havent explained the question correctly .
i have to make a call to a NON -SAP application which is on a different system .I dont have to launch a application .i just have to call a function .
09-11-2007 5:16 AM
The function u want to call has to be RFC enabled ( check the attributes tab in SE37 u ll find a radio button with the same caption).
In SM59 , U will have to define a RFC destination for the Target system - here u will define the IP address, User ID etc.
Then u can call the FM like this
CALL FUNC 'func' DESTINATIOn dest
EXPORTING....
You can refer to the help of CALL FUNCTION , it will give u all the details.
Revert back in case of problems.
09-11-2007 5:24 AM
Hi SKC,
Thanks for your reply .My Function is not in ABAP, It is written in NON-SAP techanology .
I did not understand the point you have mentioned.
>><b>The function u want to call has to be RFC enabled ( check the attributes tab in SE37 u ll find a radio button with the same caption).</b>
Do i have to create some equavalant function module for the NON-SAP function in ABAP .If so how to do that .
09-11-2007 5:36 AM
So u want to call a function that is -
1. In a diff system.
2. Non SAP.
Well, i have told u about calling a function of a diff system. It has to support OLE automation framework. There is no way u can call a function of a DLL or an EXE.
My previous codes showed the ways of calling functions of MSExcel.
Now RFC enabled FMs are the FMs ( use transaction SE37 for viewing Function Modules ) those can be called from outside system. For example u can call RFC_GET_MATERIAL_DATA from ur MS Excel file or any other application. For this Function module , if u go to the attribute tab, u ll find that it is RFC enabled.
It depends highly on ur target system - if it is as simple as Java Script - then it can be done - if it is C/C++ then there is no way u can call them from ABAP.
09-11-2007 6:08 AM
Hi,
Thanks for your reply . I dont want to call SAP from NON -SAP . i want to call the other way round . Want to call NON-SAP from SAP.if any one know how to do it Please help.