<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR>
<STYLE>@font-face {
        font-family: Cambria Math;
}
@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009>I have a need to get a Trip PDF and attach it to a Task
in a background step. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009>I get the PDF just fine. I attach to a
task in FORE GROUND just fine and dandy. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009>Now, where I am stumped. How to attach in a
background step. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009>I obviously can not use GUI controls to achieve this,
so anyone have an idea or three, or an example to reference?
</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=484433517-23012009>Thanks much! </SPAN></FONT></DIV><FONT face=Arial
color=#0000ff size=2><SPAN class=484433517-23012009></SPAN></FONT><FONT
face=Arial color=#0000ff size=2>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN
style="FONT-SIZE: 8pt; COLOR: #3399cc; FONT-FAMILY: Arial"><SPAN
style="FONT-WEIGHT: bold; COLOR: #000000">Rick Sample</SPAN> <SPAN
style="COLOR: #000000">| </SPAN>Office (314) 573-5700<SPAN
style="COLOR: #000000"> | </SPAN><A
href="mailto:rick.sample@graybar.com">rick.sample@graybar.com</A> <BR><A
href="http://www.graybar.com/" target=_BLANK>www.graybar.com</A> - <I>Graybar
Works to Your Advantage</I> </SPAN></DIV>
<DIV dir=ltr align=left><SPAN
style="FONT-SIZE: 8pt; COLOR: #3399cc; FONT-FAMILY: Arial"><EM></EM></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>CALL FUNCTION
'PTRM_WEB_FORM_PDF_GET'<BR> EXPORTING<BR>
i_employeenumber = object-key-employeenumber<BR>
i_tripnumber =
object-key-tripnumber<BR>*
i_periodnumber = '000'<BR>*
i_trip_component = ' '<BR>* i_trip_data_source =
'DB'<BR> i_display_form = '
'<BR>
i_language = sy-langu<BR>
IMPORTING<BR>
e_pdf_form =
lwa_pdf_form<BR> TABLES<BR>
et_return =
et_return.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>LOG-POINT ID
ztravel FIELDS et_return.<BR>LOG-POINT ID ztravel FIELDS log_crap
'4_gotPDF_return_code?'.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>**
container<BR>*IF g_pdf_my_container IS INITIAL.<BR>* CREATE OBJECT
g_pdf_my_container<BR>*
EXPORTING<BR>* container_name =
'HTML_FORM'<BR>* EXCEPTIONS<BR>*
OTHERS = 1.<BR>* IF
sy-subrc <> 0.<BR>* ENDIF.<BR>*ENDIF.<BR>*<BR>** html control<BR>*IF
g_pdf_html_control IS INITIAL.<BR>* CREATE OBJECT
g_pdf_html_control<BR>*
EXPORTING<BR>* parent =
g_pdf_my_container<BR>*
EXCEPTIONS<BR>* OTHERS = 1.<BR>* IF sy-subrc
<> 0.<BR>* ENDIF.<BR>*ENDIF.<BR>*<BR>*alignment = align_at_left +
align_at_right
+<BR>*
align_at_top + align_at_bottom.<BR>*<BR>*CALL METHOD
g_pdf_html_control->set_alignment<BR>* EXPORTING<BR>*
alignment = alignment<BR>* EXCEPTIONS<BR>*
OTHERS = 1.<BR>*IF sy-subrc <>
0.<BR>*ENDIF.<BR>*<BR>*l_pdf_size = XSTRLEN( lwa_pdf_form ).<BR>*l_len =
l_pdf_size.<BR>*WHILE l_len >= 1000.<BR>* l_pdf_line =
lwa_pdf_form+l_offset(1000).<BR>* APPEND l_pdf_line TO
l_pdf_data.<BR>* ADD 1000 TO l_offset.<BR>* SUBTRACT 1000 FROM
l_len.<BR>*ENDWHILE.<BR>*IF l_len > 0.<BR>* l_pdf_line =
lwa_pdf_form+l_offset(l_len).<BR>* APPEND l_pdf_line TO
l_pdf_data.<BR>*ENDIF.<BR>*<BR>*l_myurl = 'PDF.pdf'.<BR>*CALL METHOD
g_pdf_html_control->load_data<BR>* EXPORTING<BR>*
url =
l_myurl<BR>*
size =
l_pdf_size<BR>*
type =
'application'<BR>* subtype =
'pdf'<BR>* IMPORTING<BR>* assigned_url =
l_url<BR>* CHANGING<BR>* data_table =
l_pdf_data<BR>* EXCEPTIONS<BR>*
OTHERS = 1.<BR>*IF sy-subrc <>
0.<BR>*ENDIF.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>** show
data<BR>*CALL METHOD g_pdf_html_control->show_data<BR>*
EXPORTING<BR>* url = l_url<BR>*
EXCEPTIONS<BR>* OTHERS = 1.<BR>*IF sy-subrc <>
0.<BR>*ENDIF.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>*BREAK-POINT ID
ztravel.<BR>swc_get_element container 'zTaskID' ztaskid.<BR>LOG-POINT ID
ztravel FIELDS ztaskid.<BR>LOG-POINT ID ztravel FIELDS log_crap
'4_got_ztaskid?'.<BR>workitem_id = ztaskid.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2>att_header-file_type = 'B'.<BR>att_header-file_name =
'PDF'.<BR>att_header-file_extension = 'PDF'.<BR>att_bin =
lwa_pdf_form.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>BREAK-POINT ID
ztravel.<BR>CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'<BR>
EXPORTING<BR> workitem_id =
workitem_id<BR> att_header =
att_header<BR>
att_bin =
att_bin<BR> document_owner = sy-uname<BR>
language = sy-langu<BR>
do_commit = 'X'<BR>
IMPORTING<BR> return_code =
return_code<BR>
att_id = att_id<BR>
TABLES<BR> message_lines =
message_lines<BR> message_struct =
message_struct.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>LOG-POINT ID
ztravel FIELDS return_code.<BR>LOG-POINT ID ztravel FIELDS log_crap
'4_attach_return_code?'.</FONT></DIV><SPAN
style="FONT-SIZE: 8pt; COLOR: #3399cc; FONT-FAMILY: Arial"></SPAN><FONT
face=Arial color=navy size=2></FONT></BODY></HTML>