Show TOC

Calls Without References to the Logical SystemLocate this document in the navigation structure

Example

HR forwards payroll results to Accounting. Here the appropriate documents are posted. The HR document does not have a reference to the document created in Accounting.

The method to be called is named, for example, ACDoc.Display. ACDoc.Display does not have any filter objects. The field HRKPF-DOCNR contains the ID of the HR document.

Since the logical system cannot be identified directly, the logical target system has to be determined from the distribution model.

The source code below shows how the Accounting document display is called from the HR document display:

...
DATA:
  HEAD LIKE HRKPF,
  SERVER LIKE BDBAPIDEST,
  RETURN LIKE BAPIRET2,
  MSG_TXT(80) TYPE C,
  FILTER_VALUES LIKE BDI_FOBJ OCCURS 0 WITH HEADER LINE.
...
* get logical system and RFC-Destination for remote method call
* no filter objects are used
REFRESH FILTER_VALUES.
* get server system from ALE distribution model
CALL FUNCTION 'ALE_BAPI_GET_UNIQUE_RECEIVER'
  EXPORTING
    OBJECT                        = 'ACDOC'
    METHOD                        = 'DISPLAY'
  IMPORTING
    RECEIVER                      = SERVER
  TABLES
    FILTEROBJECTS_VALUES          = FILTER_VALUES.
  EXCEPTIONS
    ERROR_IN_FILTEROBJECTS        = 1
    ERROR_IN_ALE_CUSTOMIZING      = 2
    NOT_UNIQUE_RECEIVER           = 3
    NO_RFC_DESTINATION_MAINTAINED = 4
    OTHERS                        = 5.
IF SY-SUBRC <> 0.
  IF SY-SUBRC = 4.
* application specific message saying document can't be displayed
   ...
  ELSE. 
*   hard error
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDIF.
* call display function. If SERVER_DEST is initial, it's a local call.
CALL FUNCTION 'BAPI_ACDOC_DISPLAY'
  DESTINATION SERVER-RFCDEST    
  EXPORTING
    DOCUMENT_ID = HEAD-DOCNR
  IMPORTING
    RETURN = RETURN
  EXCEPTIONS
    COMMUNICATION_FAILURE = 1 MESSAGE MSG_TXT
    SYSTEM_FAILURE        = 2 MESSAGE MSG_TXT.
IF SY-SUBRC <> 0.
* handle remote exceptions
  MESSAGE E777(B1) WITH 
    'HRDoc.Display' HEADER-AWSYS MSG_TXT(50) MSG_TXT+50(30).
ELSEIF NOT RETURN-TYPE IS INITIAL.
* handle return parameter
 ...
ENDIF.

         
Note

This example does not use filter objects. If filter objects exist for the object method to be called, the distribution model query must be adjusted accordingly.