Skip to Content
avatar image
Former Member

how to call the RFC destination dynamically in CRM system?

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?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 24, 2014 at 08:42 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 05:10 AM

    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.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 05:11 AM

    HI,

    Check whether RFCDES table helps.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 05:17 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 05:35 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 24, 2014 at 06:02 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 24, 2014 at 08:02 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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