---
title: Publisher: Triggering Storing and Linking
slug: publisher-triggering-storing-and-linking
docTags: 
createdAt: 2021-11-03T14:22:50.000Z
---

In your custom code or enhancements (primarily in the "processing" or appropriate form of your Z version of the message output), add code that calls the “publish\_message” method of the “/dflow/cl\_publishing”.  

The example below shows the retrieval of the spool id as well as various other input parameters like the filename (used for the document that will be stored in the content management system) so that the call to the “publish\_message” method can be made.  

Calls to the method can also be made using the SAP OTF table or by passing in the PDF as a string instead of using the spool id.  Adjustments will need to be made for the particular message output program/function module that is getting Gimmal Link Enterprise functionality added to it.  

Consult with an ABAP developer for assistance in gathering the correct information so that a call to the “publish\_message” can be made successfully.  

## Example

\* Ensure the user has selected to PRINT the document (ie. Not Fax/EDI/etc)

IF finaa-nacha = 1. "Print

  “ define the variables we need to make the call to Gimmal Link publisher

  DATA lo\_publishing TYPE REF TO /dflow/cl\_publishing.

  DATA lv\_object\_id  TYPE /dflow/cl\_publishing=>gt\_object\_id.

  DATA lv\_arc\_doc\_id TYPE /dflow/cl\_publishing=>gt\_id.

  DATA lv\_filename   TYPE file\_table-filename.&#x20;

&#x20; DATA lv\_document\_linked type abap\_bool.

&#x20; DATA lv\_document\_stored type abap\_bool.

&#x20; DATA lv\_message type string.



  “ get an instance of the Gimmal Link publisher object

  lo\_publishing = /dflow/cl\_publishing=>get\_instance( ).

 

  " set FILENAME (format the filename to how you would like)

  CONCATENATE bkorm-konto bkorm-bukrs INTO lv\_filename SEPARATED BY '\_'.

 

  “ determine the SAP object id for this particular object

  lv\_object\_id+0(10) = bkorm-konto. "Customer number

  lv\_object\_id+10(4) = bkorm-bukrs. "Company code

 

  “ try to make the call to the Publisher method and catch any exceptions

  “ in this example the sap object type and document type are hard coded

  TRY.

      CALL METHOD lo\_publishing->publish\_message

            EXPORTING

              iv\_spool\_id   = itcpp-tdspoolid

\*             it\_otf        =

\*             iv\_pdf\_xstring            =

              iv\_filename   = lv\_filename

              iv\_sap\_object = 'KNB1'

              iv\_ar\_object  = 'ZCRMPUBL01'

              iv\_object\_id  = lv\_object\_id

        IMPORTING

&#x20;           ev\_arc\_doc\_id = lv\_arc\_doc\_id

&#x20;           ev\_error      = lv\_error

            ev\_document\_stored = lv\_document\_stored

            ev\_document\_linked = lv\_document\_linked

            et\_return     = lt\_return.

          .

      CATCH /dflow/cx\_common . 

&#x20;       lv\_message = lo\_error->get\_text( ).
&#x20;       lv\_error   = abap\_true.
&#x20;       MESSAGE lv\_message TYPE 'I'.

  ENDTRY.

      READ TABLE lt\_return INTO ls\_return WITH KEY type = 'E'.
&#x20;   IF sy-subrc EQ 0.
&#x20;     MOVE: 'ZTC' TO syst-msgid,
&#x20;           'E' TO syst-msgty,
&#x20;           '018'  TO syst-msgno,
&#x20;           ls\_return-message(50) TO syst-msgv1,
&#x20;           ls\_return-message+50(50) TO syst-msgv2,
&#x20;           ls\_return-message+100(50) TO syst-msgv3,
&#x20;           ls\_return-message+150(50) TO syst-msgv4.
&#x20;     PERFORM protocol\_update.
&#x20;     MOVE: '/DFLOW/ZDOCUFLOW' TO syst-msgid,
&#x20;           'E' TO syst-msgty,
&#x20;           '001'  TO syst-msgno,
&#x20;           'Link Enterprise storage connection error - contact admin' TO syst-msgv1.
&#x20;     PERFORM protocol\_update.
&#x20;     MOVE c\_rc01 TO g\_subrc.
&#x20;   ELSE.
&#x20;     MOVE: '/DFLOW/ZDOCUFLOW' TO syst-msgid,
&#x20;           'S' TO syst-msgty,
&#x20;           '001'  TO syst-msgno,
&#x20;           'Link Enterprise storage success' TO syst-msgv1.
&#x20;     PERFORM protocol\_update.
&#x20;   ENDIF.

ENDIF.

