RFC Calls: Function Module Parameter Passing

By | April 17, 2009 | Function Module | 12,626 | 2

Parameter Passing in the RFC Function Module Calls

Today we will discuss how system take care of the obligatory parameter passing in the RFC function module.

Generally, when we call the FM without passing the obligatory parameter, system would raise the exception CALL_FUNCTION_PARM_MISSING and would lead to run time error. Now, when we call the same RFC FM with perticular Destination without passing the obligatory parameter, system is not giving any runtime error. How does this happen? Why this different behaviour?

Actually, when we generate our RFC FM, System generates one more Include program with Subroutine which calls the FM. So, when we call the RFC FM using CALL FUNCTION … DESTINATION .. RFC Framework calls this generated Subroutine. This Subroutine passes all the parameters to the FM Call, including the obligatory ones and it is not giving us any runtime error of missing parameters.

To demonstrate this, I would use the RFC FM ZTEST_NP_RFC which was created in the FG ZTEST_NP. This is the code snippet for the RFC FM:

FUNCTION ztest_np_rfc.
*"*"Local Interface:
* Both initial.. Return 3
* Else.. Return 4
  IF  kunnr IS INITIAL
    subrc '3'.
    subrc '4'.

System has generated the Include LZTEST_NP_RFCV01 (L+fgname+V+fmnumber) with subroutine ZTEST_NP_RFC (same name as the FM) which call the FM. This include is part of the RFC framework. Here is the code snippet for this include LZTEST_NP_RFCV01:

*   NEVER CHANGE IT MANUALLY, PLEASE!                            **
FORM ztest_np_rfc %_RFC.
* Parameter declaration
  DATA kunnr TYPE
  DATA name1 TYPE
  DATA subrc TYPE
* Assign default values
* Call remote function
      kunnr kunnr
      name1 name1
      subrc subrc.
ENDFORM.                    "ZTEST_NP_RFC

Lets see the call to this FM using this test program.

DATAlf_subrc TYPE subrc.
* CALL RFC FM without passing the mandatory Parameters
*  and it would give us error
      subrc lf_subrc.

Now, how do we find out how does this work? Since this is a part of the system, we need to activate the system debugging.
1. Put a breakpoint on the FM
2. Run the Program
3. From the debugger, start the System debugging. Settings > System Debugging
4. Step in (F5)
5. Check the Call the Stack

Have a look at the call stack

.. and the RFC Framework subroutine:

This would raise an question: As a developer, how do we design our RFC FMs which would not fail in terms of the functionality (works even we don’t pass the mandatory parameters)? In next blog, we would explore why it behaves like this and how we can overcome the problem. You can find it here: RFC Calls II – Solution to mandatory Parameters to FM

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{272 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 272 articles.

Load comments


  • Madhu

    It is good one.


  • [...] time ago, I wrote about RFC Calls: Function Module Parameter Passing. In this post, I figured out the hidden include by using the naming standard. System has [...]

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.