Skip to Content

Fetching Required Data From RFC Through Report Program

Remote Function Calls (RFC’s) is a call to a function module (method) running on the same or different system enabling external applications to access business processes and data in the R/3 System. RFC’s return the data in the export parameter and the data to be passed to the RFC can be sent though import parameter.
Suppose we need certain data fields for processing in our report program. We can easily find out a standard RFC which has the required data fields. But the problem arises when we find all the fields returned by RFC are not required for our program. We can easily follow the steps as covered in this document to fetch the required data by calling the standard RFC though report program. In this way we save on writing a customized RFC for the required fields. Secondly, the same standard RFC can be used by different report programs depending upon the required fields for the program.

Let’s take an example where we need to fetch four fields USER_ID, SUBJECT, CREATED_TIME, FORWARDED_BY for the BNAME (employee number) which we will pass as the input parameter. I have found a standard RFC SWN_UWL_GET_WORKLIST which suits my purpose and has all the required fields in the table type which it returns as the output variable. The underlying RFC returns the table type worklist which has the underlying structure UWLITEM containing 20 fields. But all these fields are not required for my program. I just need 4 fields out of these 20 fields.
To summarize the above point my requirement is to call a RFC from a report program and to use the same to fetch only four fields out of 20 fields it will return. How to handle this kind of scenario let’s see using the above example by following the step by step process as shown below.

Steps to be followed
Step 1.
Firstly we check the fields being returned by the standard RFC. I will open the RFC SWN_UWL_GET_WORKLIST using se37 transaction and open the export tab which will show me all the export values which this RFC will return back as shown below.


Here WORKLIST is the parameter name of table type UWLITEMLIST containing the fields which I need to be displayed thorough my report program ZGET_USERS_DATA.

Step 2.
Click on the table type UWLITEMLIST to check the associated structure which is UWLITEM and click on the structure name to see the associated fields as shown below.

Highlighted are the ones which we need to display through our report program. Note we don’t need all the fields which are being fetched by the RFC SWN_UWL_GET_WORKLIST through export parameter worklist.

Step 3.
We need to create a table type ZUWLITEMLIST and associated structure ZUWLITEM using se11 transaction. Give ZUWLITEMLIST in Data type radio button and then choose Table type option. After giving the table type short text give the Line type as ZUWLITEM as the name of the underlying structure. Save the table type as a local object or give the package name as per your requirement. Activate the table type and click on the line type ZUWLITEM.


Step 4.
Create the structure ZUWLITEM and the required fields as shown below. Note the fields in this structure are the same as we need to display though our report program for all the users being given as the input parameter in our report program.

Step 5.
After creating the table type ZUWLITEMLIST and associated structure we will write our report program ZGET_USERS_DATA. This program will fetch the required data by calling the RFC SWN_UWL_GET_WORKLIST after passing the required import parameter and receiving the output in the export parameter.
For the same go to transaction se38 and write the report program as

Step 6.
Output will be like as shown below.


1 Comment
You must be Logged on to comment or reply to a post.
  • I don’t see the purpose of your blog. Why do you create 2 ddic objects ? Why are you talking about RFC, what is the relationship with the ddic objects you create ?