Attatching PDF File in background step

akshay.bhagwat@wipro.com akshay.bhagwat at wipro.com
Fri Jan 23 17:13:45 EST 2009


Hi Rick,
 
There is a blog on SDN ( Right now I do not have direct link, if I get
it, I'll mention the same) .. Pls check if that helps to you.
For background tasks I believe you will have to try the OPEN DATASET
technique and use application server instead of Front end.
 
Regards 

Akshay Bhagwat

 

 

________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Sample, Rick
Sent: Friday, January 23, 2009 12:43 PM
To: SAP Workflow Users' Group
Subject: Attatching PDF File in background step


I have a need to get a Trip PDF and attach it to a Task in a background
step. 
I get the PDF just fine. I attach to a task in FORE GROUND just fine and
dandy. 
 
Now, where I am stumped. How to attach in a background step. 
I obviously can not use GUI controls to achieve this, so anyone have an
idea or three, or an example to reference? 
 
Thanks much! 
 
Rick Sample | Office (314) 573-5700 | rick.sample at graybar.com 
www.graybar.com <http://www.graybar.com/>  - Graybar Works to Your
Advantage 
 
 
CALL FUNCTION 'PTRM_WEB_FORM_PDF_GET'
  EXPORTING
    i_employeenumber   = object-key-employeenumber
    i_tripnumber       = object-key-tripnumber
*    i_periodnumber     = '000'
*    i_trip_component   = ' '
*    i_trip_data_source = 'DB'
    i_display_form     = ' '
    i_language         = sy-langu
  IMPORTING
    e_pdf_form         = lwa_pdf_form
  TABLES
    et_return          = et_return.
 
LOG-POINT ID ztravel FIELDS et_return.
LOG-POINT ID ztravel FIELDS log_crap '4_gotPDF_return_code?'.
 
** container
*IF g_pdf_my_container IS INITIAL.
*  CREATE OBJECT g_pdf_my_container
*    EXPORTING
*      container_name = 'HTML_FORM'
*    EXCEPTIONS
*      OTHERS         = 1.
*  IF sy-subrc <> 0.
*  ENDIF.
*ENDIF.
*
** html control
*IF g_pdf_html_control IS INITIAL.
*  CREATE OBJECT g_pdf_html_control
*    EXPORTING
*      parent = g_pdf_my_container
*    EXCEPTIONS
*      OTHERS = 1.
*  IF sy-subrc <> 0.
*  ENDIF.
*ENDIF.
*
*alignment = align_at_left + align_at_right +
*            align_at_top + align_at_bottom.
*
*CALL METHOD g_pdf_html_control->set_alignment
*  EXPORTING
*    alignment = alignment
*  EXCEPTIONS
*    OTHERS    = 1.
*IF sy-subrc <> 0.
*ENDIF.
*
*l_pdf_size = XSTRLEN( lwa_pdf_form ).
*l_len = l_pdf_size.
*WHILE l_len >= 1000.
*  l_pdf_line = lwa_pdf_form+l_offset(1000).
*  APPEND l_pdf_line TO l_pdf_data.
*  ADD 1000 TO l_offset.
*  SUBTRACT 1000 FROM l_len.
*ENDWHILE.
*IF l_len > 0.
*  l_pdf_line = lwa_pdf_form+l_offset(l_len).
*  APPEND l_pdf_line TO l_pdf_data.
*ENDIF.
*
*l_myurl = 'PDF.pdf'.
*CALL METHOD g_pdf_html_control->load_data
*  EXPORTING
*    url          = l_myurl
*    size         = l_pdf_size
*    type         = 'application'
*    subtype      = 'pdf'
*  IMPORTING
*    assigned_url = l_url
*  CHANGING
*    data_table   = l_pdf_data
*  EXCEPTIONS
*    OTHERS       = 1.
*IF sy-subrc <> 0.
*ENDIF.
 
** show data
*CALL METHOD g_pdf_html_control->show_data
*  EXPORTING
*    url    = l_url
*  EXCEPTIONS
*    OTHERS = 1.
*IF sy-subrc <> 0.
*ENDIF.
 
*BREAK-POINT ID ztravel.
swc_get_element container 'zTaskID'  ztaskid.
LOG-POINT ID ztravel FIELDS ztaskid.
LOG-POINT ID ztravel FIELDS log_crap '4_got_ztaskid?'.
workitem_id = ztaskid.
 
att_header-file_type = 'B'.
att_header-file_name = 'PDF'.
att_header-file_extension = 'PDF'.
att_bin = lwa_pdf_form.
 
BREAK-POINT ID ztravel.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
  EXPORTING
    workitem_id    = workitem_id
    att_header     = att_header
    att_bin        = att_bin
    document_owner = sy-uname
    language       = sy-langu
    do_commit      = 'X'
  IMPORTING
    return_code    = return_code
    att_id         = att_id
  TABLES
    message_lines  = message_lines
    message_struct = message_struct.
 
LOG-POINT ID ztravel FIELDS return_code.
LOG-POINT ID ztravel FIELDS log_crap '4_attach_return_code?'.

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20090124/57e98bce/attachment.htm


More information about the SAP-WUG mailing list