Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice instead of hard-coded RFC destinations?

is there a good way to use not hardcoded RFC destinations?

Right now our solution is to check which system is used and then assign the destination to a variable

IF cl_role EQ 'P'.
      p_dest = 'ESW300'.
   ELSE.
      p_dest = 'EAW300'.
   ENDIF.

which we use when calling our destination function.

CALL FUNCTION 'XYZ' DESTINATION p_dest

Is there a good way to not use the hardcoded destinations?

Thank you for the help!

like image 394
Jen Mer Avatar asked Mar 03 '23 14:03

Jen Mer


1 Answers

RFC destinations are already an abstraction of the endpoint so I would not recommend to abstract it yet again. For that reason I would suggest using the same name across systems as a leading practice and not change them to be instance specific.

Otherwise I would suggest instead of hard-coding that you determine the RFC destination dynamically if you really want to use different RFC destination names across systems (I would not). If you look at some SAP standard programs they use specific format to determine the expected RFC destination name for example <hostname>_<systemname>_<system number> is used by SolMan but there are many examples if you look at the standard RFC destinations you can find.

I would also recommend as a best practice that any hard coded values never be populated inline as your example shows but in a header constant.

I realize you were probably only trying to focus on your question but for others reading this.

like image 56
SAP Pro Avatar answered Mar 29 '23 17:03

SAP Pro