Application Development and Automation 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: 
Read only

RFC functions

Former Member
0 Likes
3,184

hi

when i am using rfc_ping like below the sy-subrc = 0.

CALL FUNCTION 'RFC_PING' DESTINATION dest_asia

EXCEPTIONS

communication_failure = 1

system_failure = 2

OTHERS = 3.

but, when i am using 'RFC_FUNCTION_SEARCH' to check for function module, it is throwing sy-subrc = 3 when the FM is present in the destination system. please help

CALL FUNCTION 'RFC_FUNCTION_SEARCH' DESTINATION dest_asia

EXPORTING

funcname = 'Z_MM_STOCK'

EXCEPTIONS

nothing_specified = 1

no_function_found = 2

OTHERS = 3.

1 ACCEPTED SOLUTION
Read only

former_member188827
Active Contributor
0 Likes
2,515

I think your function 'Z_MM_STOCK' is not remote enabled.first make it remote enabled and then try.

13 REPLIES 13
Read only

Former Member
0 Likes
2,515

Hello Ganesh,

Problem is that you have not provided tables parameter for importing the result of function module execution.

Try adding tables parameter and check if problem persist.

Thanks,

Augustin.

Read only

0 Likes
2,515

hI..i dont think the tables parameter is needed.

Read only

former_member188827
Active Contributor
0 Likes
2,516

I think your function 'Z_MM_STOCK' is not remote enabled.first make it remote enabled and then try.

Read only

0 Likes
2,515

it is remote enabled.

Read only

0 Likes
2,515

then try to debug 'RFC_FUNCTION_SEARCH' to see where the problem lies..Also,check if you have released the FM 'ZMM_STOCK'.

Read only

0 Likes
2,515

when i debugged..the error is showing in the call itslef.. is there anything wrong in the call?

Read only

0 Likes
2,515

Hi, This Function module has to be called using the Destination keyword.

For Example,

DATA: lw_rfcfunc TYPE rfcfunc,

i_rfcfunc TYPE STANDARD TABLE OF rfcfunc.

lw_rfcfunc-funcname = 'BAPI_APO_AVAILABILITY_CHECK'.

APPEND lw_rfcfunc TO i_rfcfunc.

CALL FUNCTION 'RFC_FUNCTION_SEARCH' DESTINATION p_rfcdes "System where the FM existence should be checked

EXPORTING

funcname = 'BAPI_APO_AVAILABILITY_CHECK'

  • GROUPNAME = ' '

  • LANGUAGE = SY-LANGU

TABLES

functions = i_rfcfunc

EXCEPTIONS

nothing_specified = 1

no_function_found = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

This will return sy-subrc = 0 if FM exists, otherwise sy-subrc is 2.

This RFC Function Module checks, if the FM mentioned is available in the TFDIR Table with PMODE = R (Remote) in the system which is called. If the DEstination keyword is not mentioned, it checks for the entry in the current system table, hence sy-subrc is always 2 in your case.

Please let me know if this works.

REgards,

Janani

Edited by: janani chakrapani on Aug 11, 2009 5:13 PM

Read only

0 Likes
2,515

but i get sy-subrc = 3

Read only

0 Likes
2,515

Have u checked if your function module has an entry in the TFDIR table in the destination system when FMODE = 'R'.

If there is an entry, then the Function module will work, when executed in a program with the DEstination option.

Also, check if the RFC Destination is reachable by using the Funciton Module

CALL FUNCTION 'RFC_PING' DESTINATION p_rfcdes "Destination system where FM/BAPI is available

EXCEPTIONS

system_failure = 1

communication_failure = 2

OTHERS = 99.

If sy-subrc is 0 for RFC_PING, then cal RFC_FUNCTION_SEARCH.

Regards,

Janani

Read only

0 Likes
2,515

yes, i checked the table TFDIR and entry is there with FMODE = 'R'.

and have done rfc_ping..it gives sy-subrc = 0.

i havent given tables parameter..but gave funcname..is that any problem?

Read only

Former Member
0 Likes
2,515

hi ,

You can check the RFC connection in tcode: SM59. You can also test the connection through this tcode.

check whether gateway host and gateway service is fulfilled.

Saurabh Goel

Read only

0 Likes
2,515

if there was any problem...the FM RFC_PING shud throw sy-subrc ne 0..but its 0..i cheked the connections..they r fine

Read only

matt
Active Contributor
0 Likes
2,515

See what rc you get with:¨

data: smess type c length 80,
      cmess type c length 80.

CALL FUNCTION 'RFC_FUNCTION_SEARCH' DESTINATION dest_asia
    EXPORTING
      funcname = 'Z_MM_STOCK'
    EXCEPTIONS
      nothing_specified = 1  
      no_function_found = 2
      OTHERS = 3
      system_failure = 4 MESSAGE smess 
      communication_failure = 5 MESSAGE cmess.

Also look at the contents of smess and cmess.

If you still get rc = 3, runn the function on the destination machine with the same parameters, and see what results you get.

matt