Skip to Content
Author's profile photo Kelly Wang

SAP如何debug远程调用的函数模块 (SAP: How to debug RFC)

很多ABAP的初学者在debug程序的时候经常会遇到一个问题,那就是RFC的function module的debug问题,例如,A系统的程序中通过RFC调用了B系统中的一个function module, 在B系统中设置断点后,如何才能让程序执行到该断点是停下来呢?下面我将通过一个例子来说明. 

准备工作:

1. 准备两个系统:
Y58, 主程序会在该系统运行; Y57, 被调用系统, 主程序中会调用本系统的FM

2. 在系统Y58中创建一个RFC destination ‘testrfc’, 将connection type 设置为’3′, 并指定登录语言, 客户端, 用户名(本例中的用户名是’TESTRFC’),登录密码等信息. 此处需要特别注意的是, 此处指定的用户’TESTRFC’必须在系统Y57中存在,并且必须是具有debug权限的dialog用户. 参照下图:

/wp-content/uploads/2013/10/1_297989.png

/wp-content/uploads/2013/10/2_297990.png

/wp-content/uploads/2013/10/3_297991.png
 
3. 在系统Y57中创建一个FM,将’processing type’ 选为’Remote-Enabled Module’

/wp-content/uploads/2013/10/4_297995.png

/wp-content/uploads/2013/10/5_297996.png

4. 在系统Y58创建主程序’ZTEST_RFC_DEBUG_MAIN’, 在该程序中调用系统Y57中的FM ‘ZRFC_DEBUG_1 ‘并指定destination为 Y58中创建的’testrfc ‘, 如下图:

/wp-content/uploads/2013/10/6_297997.png

至此,准备工作完毕.

下面我们来看如何debug.

1. 登录系统Y57(此处需要注意,整个测试过程中要保持Y57的登录状态), 并设置被调用系统Y57的debug用户(即Y58中创建destination时指定的user ID). 设置路径:T-CD:SE38->Utilities->settings, 如下图:

/wp-content/uploads/2013/10/7_298001.png

2. 在将要测试的FM中设置外部断点,

/wp-content/uploads/2013/10/8_298002.png

3. 系统Y58中运行主程序,

/wp-content/uploads/2013/10/9_298003.png

结果: 程序停在所设断点处

/wp-content/uploads/2013/10/10_298013.png

关键点总结:

1. RFC destination中指定的User ID必须是具有debug权限的dialog帐号

2. 被调用系统中必须设定debug user ID 为RFC destination中指定的user ID, 且该User ID必须是具有debug权限的dialog用户

3. 断点类型必须为外部断点

Assigned Tags

      35 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo CY Guo
      CY Guo

      不错!很好! 解了我多年的困惑啊...

      Author's profile photo Former Member
      Former Member

      多谢分享

      Author's profile photo Former Member
      Former Member

      great help! up!!

      Author's profile photo Former Member
      Former Member

      很实用,步骤详细到让小伙伴们都惊呆了

      Author's profile photo Former Member
      Former Member

      不错, 很实用。。

      Author's profile photo Tony Fan
      Tony Fan

      很好,很实用。

      Author's profile photo Former Member
      Former Member

      很好很详细,收藏了!!!

      Author's profile photo Former Member
      Former Member

      好用、收了

      Author's profile photo Former Member
      Former Member

      good

      Author's profile photo Y. J. Lin
      Y. J. Lin

      Thanks!

      Author's profile photo Former Member
      Former Member

      不错,才貌双全。

      Author's profile photo Ning Li
      Ning Li

      good, 收藏了

      Author's profile photo Jim Guo
      Jim Guo

      很好很强大 🙂

      Author's profile photo Former Member
      Former Member

      学习了

      Author's profile photo Former Member
      Former Member

      多谢分享。

      Author's profile photo Aiolos Yang
      Aiolos Yang

      写得不错,简单易懂

      Author's profile photo Former Member
      Former Member

      hao

      Author's profile photo Former Member
      Former Member

      5星级的

      Author's profile photo Jie Bai
      Jie Bai

      非常详细,谢谢分享!

      Author's profile photo Bonnie Mu
      Bonnie Mu

      多谢分享,简单易懂.

      Author's profile photo Yao Zhang
      Yao Zhang

      非常详细啊,真是学习了!感谢!

      Author's profile photo Former Member
      Former Member

      写的很详细,按照这个来绝对能解决问题了

      Author's profile photo Jing Luan
      Jing Luan

      赞!

      Author's profile photo Jing Luan
      Jing Luan

      赞!

      Author's profile photo Jing Luan
      Jing Luan

      赞!

      Author's profile photo Former Member
      Former Member

      我项目上正在纠结怎么搞,真是雪中送炭啊!!!

      Author's profile photo Former Member
      Former Member

      很不错

      Author's profile photo Former Member
      Former Member

      very detail explanation, very useful

      Author's profile photo Zhang Chao
      Zhang Chao

      一直没发现可以设置debug 用户,nice!

      Author's profile photo Former Member
      Former Member

      不错!很好! 解了我多年的困惑啊...

      Author's profile photo Eason Ling
      Eason Ling

      赞!

      Author's profile photo Former Member
      Former Member

      good

      Author's profile photo Tikeer Guo
      Tikeer Guo

      很好。

      Author's profile photo Former Member
      Former Member

      不错

      Author's profile photo Former Member
      Former Member

      很有用,多谢