Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to call the RFC destination dynamically in CRM system?

Former Member
0 Kudos

i call an RFC in  CRM which has  an ECC destination.

i had written hardcoded, but when it went to production or quality the destination may change

CALL FUNCTION 'Z_Function_module' DESTINATION 'ERZCLNT301'.

so, Is there any FM to get the RFC destination, or any other process other than hard coding?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

the below code will works

CALL FUNCTION 'SMOF0_READ_SITESELECT'

          TABLES

            to_siteselect = lt_siteselect.

        READ TABLE lt_siteselect INTO ls_siteselect

               WITH KEY sitetypeid = cl_smw1_siteprovider=>c_sitetype_r3oltp.

        ev_dest = ls_siteselect-rfcdest.

Regards,

akshath

11 REPLIES 11

KiranJ
Active Participant
0 Kudos

Hi ,

        In this system field  sy-sysid  , you can get the system id like is it DEV , Quality  or production

depending on that you can pass the RFC destination.


jayanthi_jayaraman
Active Contributor
0 Kudos

HI,

Check whether RFCDES table helps.

0 Kudos

Hi

i checked the RFCDES table but it fetches all the data of DES

matt
Active Contributor
0 Kudos

You need some way of specifying the destination depending on what the calling system is. You could use a table that holds the valid destination, or a TVARVC variable, or something like

CASE sy-sysid.

WHEN 'DC4'.

dest = 'ECCDEV'.

WHEN 'TC4'.

dest = 'ECCTEST'.

WHEN 'PC4'.

dest = 'ECCPROD'.

ENDCASE.

Or you could look at setting up partner ids in ALE and using them.

Former Member
0 Kudos

If sy-mandt = '301'                    " for Production

CALL FUNCTION 'Z_Function_module' DESTINATION 'ERZCLNT301'

ELSEIF sy-mandt = '101'                   "  for Development

CALL FUNCTION 'Z_Function_module' DESTINATION 'ERZCLNT101'

ELSE.                                                  " for quality

CALL FUNCTION 'Z_Function_module' DESTINATION 'ERZCLNT201'

ENDIF.


Create a variable of type RFCDEST and pass these destination as per client.

Former Member
0 Kudos

helo all,

thank you for the replies, really those are helpful but if i dont know the destination may it varies then what is the other approach. i think it is better to call the FM? is ther any FM?

Former Member
0 Kudos

Hi Akshath,

Use FM 'CRM_AV_CHECK_R3_GET_DESTIN' to get the destination.

CALL FUNCTION 'CRM_AV_CHECK_R3_GET_DESTIN'

     IMPORTING

       ev_destination  = lv_destination

     EXCEPTIONS

       invalid_release = 1

       OTHERS          = 2.


Thanks,

Ritu

0 Kudos

hi ritu,

i tried this earlier but it is not fetching any data in lv_destination. could you please elaborate how it will be helpful

Former Member
0 Kudos

the below code will works

CALL FUNCTION 'SMOF0_READ_SITESELECT'

          TABLES

            to_siteselect = lt_siteselect.

        READ TABLE lt_siteselect INTO ls_siteselect

               WITH KEY sitetypeid = cl_smw1_siteprovider=>c_sitetype_r3oltp.

        ev_dest = ls_siteselect-rfcdest.

Regards,

akshath

0 Kudos

HI Akshath,

Both the fm CRM_AV_CHECK_R3_GET_DESTIN and SMOF0_READ_SITESELECT are giving same result.

See the screenshot for result.

Thanks,

Ritu

0 Kudos

Hi ritu

i have tested the same