LinkedIn
RSS

At CRM, how to get R/3 RFC

You are coding at SAP CRM. You want to get the R/3 RFC to do something integrated with R/3 system.

How?

DATA ls_erpsite             TYPE smof_erpsh.

*- Get R/3 RFC (ls_erpsite-rfcdest)
CALL FUNCTION ’SMOF_READ_SMOFERPSH’
EXPORTING
i_sitetypeid = ’SMOF_ERPSITE’
IMPORTING
e_smof_erpsh = ls_erpsite.
CHECK ls_erpsite IS NOT INITIAL.

*- Ping R/3 using obtained RFC to confirm communication
CALL FUNCTION ’RFC_PING’
DESTINATION ls_erpsite-rfcdest
EXCEPTIONS
system_failure        = 1
communication_failure = 2.
CHECK sy-subrc = 0.


Leave a Reply