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: 

Finding RFC destinations

SrihariNerella
Participant
0 Kudos

Hi ,

I am calling RFC functional module and I am passing the destination by Hardcoding . How can we pass the destinations dynamically .

For example i am pasing the destination like

CALL FUNCTION 'Z_PROMOTION_ON_ARTNR_ME_FIND' DESTINATION 'D01CLNT202'

In above case destination is 'D01CLNT202' this destination for Developement system whenever the code moved to qualaity i have to pass the quality destination system and then production means i have to pass production destination system.

How can i pass the destination dynamically . Is there any FM or method ?

Regards

Srihari

8 REPLIES 8

kesavadas_thekkillath
Active Contributor
0 Kudos

Check with function IC_LOGSYS_GET_RFCDEST . It returns the destination of the logical system. You can refer table T000 to link logical system & client

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

I don't think there is any FM or method which can return you the RFC destination of the particular system!

You can specify the RFC destination dynamically by passing the value in a character-like variable, like this:

CALL FUNCTION 'Z_PROMOTION_ON_ARTNR_ME_FIND' DESTINATION gv_dest

You can use the following 2 approaches:

1. If there is a scope of User Interaction, you can create an screen-element where the user can i/p the RFC destination name(F4 help will help the cause). But there is a chance that the user may not be aware of the correct RFC dest.

2. You can create a TVARVC param & store the RFC destination against it. This has to be done in the QAS & PROD system as well. In your program you will have to query the TVARVC table using the parameter(this has to be hardcoded though!) & get the RFC dest.

I've implemented both these solutions, but find the latter more convincing. The end users are finicky when it comes to technical terms like "RFC", "FTP" et al.

@Keshav: How do you get the logical system for the QAS & PROD systems?

BR,

Suhas

Edited by: Suhas Saha on May 18, 2011 3:25 PM

former_member182485
Active Contributor
0 Kudos

Hi,

You can use the following code to find the system and based on this you can change the destination.

Data: itsysname TYPE TABLE OF t_sysname,

SELECT sysnam FROM tmsmconf INTO TABLE itsysname.

READ TABLE itsysname INTO wasysname INDEX 1.

IF wasysname-sysnam EQ 'DEV'. "Development server id

dest = ''D01CLNT202'.

ELSEIF wasysname-sysnam EQ 'QLT'. "Quality Server id

dest = ''Q01CLNT202'.

ELSEIF wasysname-sysnam EQ 'PRD'. "Production server id

dest = ''P01CLNT202'.

ENDIF.

Just replace DEV QLT and PRD with your dev quality and production server id's and put destination accordingly.

Hope this solves your problem.

Regards

Bikas

Former Member
0 Kudos

Hi Srihari,

You need to check with your BASIS team on the naming convention they are following when creating RFC destination, based on which may be you can create a FM which can be re-used across your project.

As an example: If the naming convention is SYSIDXXXXXXXMANDT, where XXXXXXX is a predefined constant/literal (CLNT in your case i guess), you can create an FM which does the above concatenation and returns the destination string. This way if there is a change to the naming convention, you just need to change this one FM created by you.

Also, note that there can be multiple RFC destinations.

Regards,

Chen

kiran_k8
Active Contributor
0 Kudos

Create a Ztable having fields like ,systemid,client,rfc destination with table maintenance generator and maintan all the RFC destinations required.Now use this ztable in your program to fetch the RFC dest dynamically based on the Client and system id.

systemid field wil have for ex DVD,QUA,PROD

Client field wil have the respective client ids for ex 001,002,003

rfc field will have the RFCDESTINATION.

Maintain ths table in Dev and transport it to quality and production.

Thanks,

K.Kiran.

Former Member
0 Kudos

You have to use ztable or a parameter table to store destinations. Read it at runtime and use variable for RFC destinations.

SrihariNerella
Participant
0 Kudos

I have created logical destination based omn system id .

Former Member
0 Kudos

hi sir,

you can see in sm59 or in segmenta creating t.code we21 or you can bottom there server id will be available mean exactly where your t.code displays