This Blog is all about the users of SAP those who need some of the data to be hosted on some legacy system or some where other system.
- For eg. Some company displays their employees birthday list for tommorow on company’s web page or a portal.
- e.g. Employee’s In & Out Punch Data report for the top level executives. etc.
This whole requirement is explained using one simple demo RFC and with MS Excel 2007.
Exactly speaking using this you can have data exported in excel sheet and same is the method if you want it to have in your local web application or web portal.
As Excel is very old and popular tool among the end users and most of the IT programmer are well know with macros programming this is a task of say 30 mins.
1. Get the RFC created in SAP R/3 for the data you require.
FUNCTION Y_TEST_RFC_ON_DOT_NET. |
2. Create one Excel file and insert the control say here it is Buttion1 as shown in below:
3. Right Click button and you will find the option called “Assign Macro” in the context menu as shown in below figure.
4. By default if you have named button as Button1 it will prompt you for Button1_Click, Clik OK as clearly depicted by below image.
5. Go to Developer tab of office 2007 and click on Visual basic button as pointed in the image below:
6. You will see the Visual basic code window as shown in figure below you have write the code shown next to the image.
'Subroutine for event click of button Getdata |
Public Sub rfc_sample() ' Statement creating SAP functions object to perform further operations. ' Setting connection properties for the Connecion object. |
' Subroutine for the rendering data into excel sheet |
7. Now Testing time, Click on the button as depicted by figure below:
8. As we have coded the message box for the number of records fetched it will be displayed as show in figure below:
9. Programmed to the copy in the Sheet3 you will have to traverse to sheet 3 and check the desired output.
10. Output….
Hope you would have got the idea to impress your end users with this and also for you it might be good learning. If any queries write it to me.
Yes, On Client side it is required as the VB library get updated on installation of SAP GUI, so that objects can be used.
Regards,
Gaurav Patwari
Thank you for sharing such a kind of information on this blog....
Just a little curious to know about what all could be the areas or scope of RFC's with other technologies & their interoperability.
If you could throw some light on this context.
The interoperability with other technologies such Java, .Net and other can be possible the same way. Java you need to have the JCO Library and same way the library on .Net gets updated on SAP GUI Installation at the .Net client side. Its most convenient option that way.
Regards,
Gaurav Patwari