Publisher: Triggering Storing and Linking
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.
* 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.
DATA lv_document_linked type abap_bool.
DATA lv_document_stored type abap_bool.
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
ev_arc_doc_id = lv_arc_doc_id
ev_error = lv_error
ev_document_stored = lv_document_stored
ev_document_linked = lv_document_linked
et_return = lt_return.
.
CATCH /dflow/cx_common .
lv_message = lo_error->get_text( ). lv_error = abap_true. MESSAGE lv_message TYPE 'I'.
ENDTRY.
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'. IF sy-subrc EQ 0. MOVE: 'ZTC' TO syst-msgid, 'E' TO syst-msgty, '018' TO syst-msgno, ls_return-message(50) TO syst-msgv1, ls_return-message+50(50) TO syst-msgv2, ls_return-message+100(50) TO syst-msgv3, ls_return-message+150(50) TO syst-msgv4. PERFORM protocol_update. MOVE: '/DFLOW/ZDOCUFLOW' TO syst-msgid, 'E' TO syst-msgty, '001' TO syst-msgno, 'Link Enterprise storage connection error - contact admin' TO syst-msgv1. PERFORM protocol_update. MOVE c_rc01 TO g_subrc. ELSE. MOVE: '/DFLOW/ZDOCUFLOW' TO syst-msgid, 'S' TO syst-msgty, '001' TO syst-msgno, 'Link Enterprise storage success' TO syst-msgv1. PERFORM protocol_update. ENDIF.
ENDIF.