Skip to Content
0
Former Member
Nov 04, 2009 at 07:49 AM

How to attach pdf to workitems

27 Views

Can any one explain with detail how to attach pdf output to workitem.

My requirement is i have to attach smartform pdf to workitem

I have followed the one of the forums but i am unable to do the same. In my case i am able to see the attachment icon but i am unable to open the document. kindly explain indetails.

i doing below mentioned process.

in B.O method i am doing below mentioned way

w_rspoid = '9682'. " Spool number

**IF sy-subrc IS INITIAL.

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = w_rspoi

IMPORTING

pdf_bytecount = numbyte

pdf_spoolid = pdfspoo

btc_jobname = jobname

btc_jobcount = jobcoun

TABLES

pdf = pdf

.

FIELD-SYMBOLS: <p> TYPE x.

DATA: zxstring TYPE xstring,

it_solix_tab TYPE SOLIX_TAB.

LOOP AT pdf.

MOVE pdf TO git_lines.

Append git_lines.

CLEAR : git_lines, pdf.

ENDLOOP.

CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'

EXPORTING

ip_solitab = git_lines[] "GIT_LINES_TEM

IMPORTING

ep_solixtab = it_solix_tab[].

CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

EXPORTING

input_length = numbytes

IMPORTING

buffer = zxstring

TABLES

binary_tab = it_solix_tab.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

W_HEADER-FILE_TYPE = 'B'.

W_HEADER-FILE_NAME = 'FORM_PR111'.

W_HEADER-FILE_EXTENSION = 'PDF'.

W_HEADER-LANGUAGE = SY-LANGU.

CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'

EXPORTING

workitem_id = WORKITEMID

ATT_HEADER = W_HEADER

  • ATT_TXT =

ATT_BIN = zxstring

  • DOCUMENT_OWNER = SY-UNAME

  • LANGUAGE = SY-LANGU

  • DO_COMMIT = 'X'

IMPORTING

  • RETURN_CODE =

ATT_ID = w_att_id

  • TABLES

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

.

ENDIF.

SWC_SET_ELEMENT CONTAINER 'SOFM' W_ATT_ID-DOC_ID.