I’ve implemented user context propagation for work order RFC scenarios multiple times. Your issue involves all four key areas: RFC destination configuration, user context propagation, service user setup, and SSO for RFC. Here’s the complete solution:
1. RFC Destination Configuration for User Propagation:
Reconfigure your RFC destination in transaction SM59 to support trusted RFC with user propagation:
Transaction SM59 → Create/Change RFC Destination:
RFC Destination: ZWORK_ORDER_REMOTE
Connection Type: 3 (ABAP Connection)
Technical Settings:
Target Host: <remote_system_host>
System Number: <remote_sys_number>
Logon & Security:
Logon Procedure: Current User (NOT fixed user)
Trusted System: ☑ Enabled
User: <leave blank>
Password: <leave blank>
SNC Options: Enabled (if using SNC)
Critical: Setting “Current User” tells SAP to propagate the interactive user’s context through the RFC call, not use a fixed service user.
2. User Context Propagation Setup:
Establish trusted system relationship between source and target systems.
On Source System (calling system):
Transaction SMT1 → Create Trusted Relationship:
Trusted System: <TARGET_SID>
Client: <target_client>
Trust Type: RFC Trust
User: * (all users)
On Target System (receiving system):
Transaction SMT2 → Display Trusting Systems:
Verify entry exists:
Trusting System: <SOURCE_SID>
Client: <source_client>
Status: Active
Generate and exchange security tokens between systems. The target system must trust RFC calls from the source system.
3. Service User Setup (Fallback Pattern):
For scenarios where user propagation isn’t possible or desirable, maintain a properly authorized service user:
Create service user on target system:
User: RFC_WORKORDER_SVC
Type: Service
Valid From: <current_date>
Valid To: <far_future_date>
Roles:
Z_RFC_EQUIPMENT_READ (equipment master data)
Z_RFC_WORKORDER_WRITE (work order operations)
SAP_BC_RFC_METADATA_GET (RFC metadata)
Authorization objects for service user:
S_RFC: Function Group EQUIPMENT_*, Activity 16
I_EQUI: Equipment *, Activity 03 (Display)
I_IWERK: Plant * (or specific plants)
S_RFCACL: RFC Destination *, Activity 16
Implement hybrid RFC pattern:
" For read operations - use service user destination
CALL FUNCTION 'Z_GET_EQUIPMENT_MASTER'
DESTINATION 'ZWORK_ORDER_REMOTE_SVC'
EXPORTING
iv_equipment = lv_equnr
IMPORTING
es_equipment = ls_equi.
" For write operations - use user propagation destination
CALL FUNCTION 'Z_CREATE_WORK_ORDER'
DESTINATION 'ZWORK_ORDER_REMOTE'
EXPORTING
is_work_order = ls_workorder
IMPORTING
ev_order_number = lv_aufnr.
4. SSO for RFC Implementation:
Implement Single Sign-On for RFC using SAP logon tickets:
Step 1: Certificate Configuration
Transaction STRUST on both systems:
SSL Server Standard:
- Import CA certificate
- Generate system certificate
- Add to ACL (Access Control List)
- Export certificate for partner system
Step 2: Profile Parameters
Set parameters on both systems:
# Source System
login/create_sso2_ticket = 1
login/accept_sso2_ticket = 1
login/ticket_expiration_time = 480 (8 hours)
# Target System
login/accept_sso2_ticket = 1
login/ticket_only = 0
Step 3: Trust Configuration
Exchange certificates between systems and establish mutual trust.
5. Authorization Object Configuration:
Configure S_RFCACL on both systems for user context propagation:
Source System - For calling users:
Authorization Object: S_RFCACL
RFC_TYPE: Function Module
RFC_NAME: Z_GET_EQUIPMENT_MASTER, Z_CREATE_WORK_ORDER
ACTVT: 16 (Execute)
Target System - For propagated users:
Authorization Object: S_RFCACL
RFC_TYPE: Function Group
RFC_NAME: ZWORKORDER_*, EQUIPMENT_*
ACTVT: 16 (Execute)
Users must have S_RFCACL authorization on BOTH systems, or RFC calls fail even with proper trust.
6. User Synchronization:
Ensure users exist in both systems with identical user IDs:
Option A - Manual sync: Create matching users in both systems
Option B - CUA (Central User Administration): Automatic user synchronization
For CUA setup:
Transaction SCUA → Configure Central User Administration
Central System: <source_system>
Logical Systems: Add target system
User Distribution: Enable automatic
7. Testing and Validation:
Test user context propagation systematically:
" Test program for user propagation
REPORT z_test_rfc_user_propagation.
DATA: lv_remote_user TYPE sy-uname.
" Call remote function that returns executing user
CALL FUNCTION 'Z_GET_CURRENT_USER'
DESTINATION 'ZWORK_ORDER_REMOTE'
IMPORTING
ev_user = lv_remote_user.
WRITE: / 'Local User:', sy-uname.
WRITE: / 'Remote User:', lv_remote_user.
IF sy-uname = lv_remote_user.
WRITE: / 'SUCCESS: User context propagated'.
ELSE.
WRITE: / 'FAILURE: User context lost'.
ENDIF.
Create function module Z_GET_CURRENT_USER on target system:
FUNCTION z_get_current_user.
EXPORTING
ev_user TYPE sy-uname.
ev_user = sy-uname.
ENDFUNCTION.
Expected result: Local and remote users should match when using trusted RFC.
8. Troubleshooting Common Issues:
Issue: RFC call fails with “User not authorized”
Solution: Check S_RFCACL authorization on target system
Issue: RFC executes as service user despite trust configuration
Solution: Verify “Current User” selected in SM59, not fixed user
Issue: Trust relationship not working
Solution: Regenerate trust in SMT1, verify certificates in STRUST
Issue: User doesn’t exist on target system
Solution: Implement CUA or manually create matching user
9. Implementation Results:
After implementing this configuration:
- Work order RFC calls execute with propagated user context (not service user)
- Authorization checks on remote system use actual user’s permissions
- Audit trails show correct user for all RFC operations
- Equipment master data lookups respect plant-level authorizations
- Hybrid pattern allows flexibility: service user for reads, user propagation for writes
10. Security Best Practices:
- Use trusted RFC with user propagation for write operations (audit critical)
- Use service user for read-only operations (simpler, better performance)
- Implement certificate-based trust, not just user/password
- Set reasonable ticket expiration times (8-12 hours)
- Monitor RFC calls via SM59 statistics
- Regularly review S_RFCACL authorizations
- Use CUA for multi-system user management
The key principle: RFC destination configuration and trust relationship setup must work together. Configuring “Current User” in SM59 enables user propagation, but it only works if trusted system relationships are properly established via SMT1/SMT2 and certificates are configured in STRUST. Service user setup provides a fallback for scenarios where user propagation isn’t feasible, but should be used selectively based on operation type and security requirements.
This draft is based on general SAP S/4HANA knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.