cancel
Showing results for 
Search instead for 
Did you mean: 

WorkFlow BADI : Get Responsi From R/3 for given WBS

Former Member
0 Kudos

Hi,

Scenario:

I am developing a Workflow BADI in SRM5.0.

For all cost centers I am getting approvers based on Z-table values.

But then for WBS... i have to get the list of approvers from R/3.

I created a Function module in R/3 dev which gets me Responsible person.

Issue:

While calling the RFC function module... by giving destination name, the Function module is working fine.

But I dont want to Hardcode Destination name.

Can I get the Destination name in some other manner ?

Helpful Answers will be rewarded.

Regards,

Ashwin.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please follow this logic:

1) Function Module BBP_GET_BACKEND_SYSTEMS will provide you the backend system detail (logical system name).

2) Then use the FM BBP_LOGICAL_SYSTEM_GETDETAIL to get the RFC destination of the backend system which can be used to make teh RFC call.

This would avoid hard coding and will work fine.

Sample Code:


*&---------------------------------------------------------------------*
*& Report  ZKB_BACKEND_SYS
*&---------------------------------------------------------------------*

REPORT  zkb_backend_sys.

DATA: lt_log_sys     TYPE TABLE OF bbps_logical_system.
DATA: lt_messages    TYPE TABLE OF balmi.
DATA: ls_log_sys     TYPE bbps_logical_system.
DATA: lv_destination TYPE rfcdest.

CALL FUNCTION 'BBP_GET_BACKEND_SYSTEMS'
  TABLES
    et_logical_systems = lt_log_sys
    et_messages        = lt_messages.

CLEAR ls_log_sys.
READ TABLE lt_log_sys INTO ls_log_sys INDEX 1.

CHECK sy-subrc EQ 0.

CALL FUNCTION 'BBP_LOGICAL_SYSTEM_GETDETAIL'
  EXPORTING
    logical_system = ls_log_sys-logsys
  IMPORTING
    destination    = lv_destination
  EXCEPTIONS
    not_found      = 1
    OTHERS         = 2.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


WRITE:/ 'RFC Destination is:', lv_destination.

Regards

Kathirvel

Edited by: Kathirvel Balakrishnan on Feb 25, 2008 1:23 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

if there is specific pattern of the RFC name then you can create a dynamic name based on sysid too.

Thanks,

Viv

Former Member
0 Kudos

Thanks Katrivel,

If i move to production environment,

will these FM's pick the backend r/3 Production systems ?

Can there be more than one backend system for SRM ?

I am in SRM- dev system.

BBP_LOGICAL_SYSTEM_GETDETAIL this FM is picking right now only one value which is the R/3 development system.

Thanks,

Ashwin.

Former Member
0 Kudos

Yes, that is right. The details are picked from the customization "Define Backend Systems". Hence you just need to maintain the correct backend system in IMG (which is a must to do activity).

Now it will pick only dev system because that will be appropiate backend that would have been configured (which is ideal).

Hope your problem is solved. Please close this thread.

Regards

Kathirvel

Former Member
0 Kudos

Hi,

You can use the steps mentioned by Kathirvel to get the RFC destination based on the Logical system defined in the SPRO settings without actually hard coding the value for the RFC!.

You can also use the FM "BBP_LOGICAL_SYSTEM_BY_TYPE" to get the RFC destination based on the type of backend system.

e.g.

constants : c_systype(10) type c value 'R/3_4.70'.

call function 'BBP_LOGICAL_SYSTEM_BY_TYPE'

exporting

iv_systype = c_systype

tables

et_logsys = it_logsys

exceptions

not_found = 1

others = 2.

BR,

Disha.

Do reward points for useful answers.