Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> UserExit>SALIN001



Index

SALIN001

SAP ArchiveLink: Customer Exits
Customer exit SALIN001 is retrieved for the function module ARCHIVELINK_FUNCTION.

It is a precondition that when defining protocols and applications for a document type dependent function OPEN , "active" is selected (i.e. the function calls flow via OLE, OpenDoc or AppleScript).

The following parameters are specified in the customer exit:

  • a method
  • an application
  • one or more OLE parameter(s)

Customer exit SALIN001 enables you to call any OLE method and attributes directly from ABAP reports. In addition, you can start Visual Basic Program from the frontend.

Example

Create a project. The name of your project must be within the customer name range.
You can find information online about creating and processing projects, in the SAP library under
Basis - ABAP Workbench - Enhancements of SAP standard
in the section "The R/3 Enhancement Concept".
Enter SALIN001 as SAP enhancement. There can only be one object per enhancement.
You activate your project in the ABAP workbench.

You can use all OLE relevant ABAP commands within Include ZXOAMU01.
Example
*---------------------------------------------------------------------*
* INCLUDE ZXOAMU01 *
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* dti = documentclass
* dpa = documentpath
* wid = windows-ID
* aid = archive-ID
* did = document-ID
* wit = windows title
* uid = user-ID
*-- messages ---------------------------------------------------------*
* 799 = Error from OLE application
* 175 = Error calling application from OLE
*---------------------------------------------------------------------*
 
DATA: WORD TYPE OLE2_OBJECT,
      SAPVIEWER TYPE OLE2_OBJECT.
 
CASE DTI.
  WHEN 'DOC'.
    CASE METHOD.
      WHEN 'CDDP'.                        " Display local file
        CASE APPLICATION.
          WHEN 'WINWORD'.
 
*---------- create object of class WORD.BASIC ------------------------*
            CREATE OBJECT WORD 'WORD.BASIC'.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '799'
               RAISING ERROR_OLE WITH 'WORD.BASIC'.
            ENDIF.
 
*---------- Open file dpa --------------------------------------------*
            CALL METHOD OF WORD 'FileOpen' EXPORTING #1 = DPA.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '175'
               RAISING ERROR_OLE WITH 'FileOpen'.
            ENDIF.
 
*---------- Show application -----------------------------------------*
            CALL METHOD OF WORD 'AppShow'.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '175'
               RAISING ERROR_OLE WITH 'AppShow'.
            ELSE.
               RAISE EXIT.
            ENDIF.
          WHEN OTHERS.                  " further applications
            EXIT.
        ENDCASE.
      WHEN OTHERS.                      " further methods
        EXIT.
    ENDCASE.
  WHEN 'FAX'.
    CASE METHOD.
      WHEN 'CDDC'.                      " Display object
        CASE APPLICATION.
          WHEN 'ALVIEWER'.
 
*---------- create object of class ALVIEWER.APP ----------------------*
            CREATE OBJECT SAPVIEWER 'ALVIEWER.APP'.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '799'
               RAISING ERROR_OLE WITH 'ALVIEWER.APP'.
            ENDIF.
 
*---------- Show application -----------------------------------------*
            CALL METHOD OF SAPVIEWER'ShowAppWindow'.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '175'
               RAISING ERROR_OLE WITH 'ShowAppWindow'.
            ENDIF.
 
*---------- Open the corresponding document --------------------------*
            CALL METHOD OF SAPVIEWER 'OpenDocumentSimple'
                        EXPORTING #1 = WID
                                  #2 = AID
                                  #3 = DID
                                  #4 = WIT
                                  #5 = UID.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '175'
               RAISING ERROR_OLE WITH 'OpenDocumentSimple'.
            ENDIF.
 
*---------- Get the error code from the application ------------------*
            GET PROPERTY OF SAPVIEWER 'R3ReturnCode' = EID.
            IF SY-SUBRC <> 0.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '175'
               RAISING ERROR_OLE WITH 'R3ReturnCode'.
            ENDIF.
            IF EID <> SPACE AND EID <> '0'.
               MESSAGE ID 'OA' TYPE 'W' NUMBER '799'
               RAISING ERROR_OLE WITH EID.
            ELSE.
               RAISE EXIT.
            ENDIF.
          WHEN OTHERS.               " further applications
            EXIT.
        ENDCASE.
      WHEN OTHERS.                   " further methods

Function/Program:
  • EXIT_SAPLOPTM_001: SAP ArchiveLink: Customer Exit for the Function ARCHIVELINK_FUNCTION

02-Oct-2005