RFC is a function that can be called by non-SAP systems, such as VB, C #, and Java. If we include related business logic in RFC, we can fully control the business data in SAP. Just like in tte, there is a program. The front-end is developed in OA, and the related customer is designed to pick up the inventory, and then the program is executed in the SAP system to deduct the corresponding inventory, this is very difficult. If you can put a button in the OA, click this button to automatically execute this program, which is convenient and easy to worry about. C # can be used to call RFC.
To implement the entire process, you must establish the corresponding RFC function in SAP, then use vs to establish the corresponding program, and write code to call it. The two are associated with nco3.0.
OK. This section describes how to create the RFC in SAP.
We assume that we want to implement such a function: A program form running outside the SAP system, with a drop-down box and a text box on it. After the program runs, it automatically loads the product number of a client in SAP to the drop-down box. If the user clicks this drop-down box and the content changes, the text box next to it will display the product name of this product number. Easy enough!
First, log on to sap. For example, the client we want to operate on is 888 (I created it myself, and figure it auspicious ). Run se37:
Then:
Create a function group and enter the following content:
Click Save.
Return to se37, enter the RFC function name to be called, for example, zrfc_mara_info, and click New (the right button ):
Click Save to bring up the following dialog box:
Click tick to ignore it.
The main screen is as follows:
The image is switched to the property page, and the RFC is set to be called remotely.
Because we will pass in a product number to read the product name, so, and set a parameter on the import page to pass in the product number:
The first check box indicates that this parameter can be selected or not, and the second indicates reference. If you do not check the RFC, the following message is displayed:
Because we want to capture the product name, we need a column to throw the product name. The so and export pages are as follows:
Because at the beginning of our program, we need to throw all the product number tables out, so. At this time, we need an internal table specifically used to throw the product number information. The table attribute page is as follows:
So far, all parameters have been set. The next step is to write the corresponding code in the code page.
The Code is as follows:
Select * into corresponding fields of table it_mara from Mara.
Select single maktx into maktx from Makt where matnr = matnr and spras = '1 '.
Click Activate! Activation here is not just as simple as activating this RFC. If you have other projects, check the following:
Now, the RFC has been created.
The next step is to call it in C # and release it in the next blog!