<!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&nbsp;attach to a 
task&nbsp;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>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=484433517-23012009>Now, where I am stumped.&nbsp;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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>CALL FUNCTION 
'PTRM_WEB_FORM_PDF_GET'<BR>&nbsp; EXPORTING<BR>&nbsp;&nbsp;&nbsp; 
i_employeenumber&nbsp;&nbsp; = object-key-employeenumber<BR>&nbsp;&nbsp;&nbsp; 
i_tripnumber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
object-key-tripnumber<BR>*&nbsp;&nbsp;&nbsp; 
i_periodnumber&nbsp;&nbsp;&nbsp;&nbsp; = '000'<BR>*&nbsp;&nbsp;&nbsp; 
i_trip_component&nbsp;&nbsp; = ' '<BR>*&nbsp;&nbsp;&nbsp; i_trip_data_source = 
'DB'<BR>&nbsp;&nbsp;&nbsp; i_display_form&nbsp;&nbsp;&nbsp;&nbsp; = ' 
'<BR>&nbsp;&nbsp;&nbsp; 
i_language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu<BR>&nbsp; 
IMPORTING<BR>&nbsp;&nbsp;&nbsp; 
e_pdf_form&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
lwa_pdf_form<BR>&nbsp; TABLES<BR>&nbsp;&nbsp;&nbsp; 
et_return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
et_return.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>** 
container<BR>*IF g_pdf_my_container IS INITIAL.<BR>*&nbsp; CREATE OBJECT 
g_pdf_my_container<BR>*&nbsp;&nbsp;&nbsp; 
EXPORTING<BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; container_name = 
'HTML_FORM'<BR>*&nbsp;&nbsp;&nbsp; EXCEPTIONS<BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1.<BR>*&nbsp; IF 
sy-subrc &lt;&gt; 0.<BR>*&nbsp; ENDIF.<BR>*ENDIF.<BR>*<BR>** html control<BR>*IF 
g_pdf_html_control IS INITIAL.<BR>*&nbsp; CREATE OBJECT 
g_pdf_html_control<BR>*&nbsp;&nbsp;&nbsp; 
EXPORTING<BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent = 
g_pdf_my_container<BR>*&nbsp;&nbsp;&nbsp; 
EXCEPTIONS<BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS = 1.<BR>*&nbsp; IF sy-subrc 
&lt;&gt; 0.<BR>*&nbsp; ENDIF.<BR>*ENDIF.<BR>*<BR>*alignment = align_at_left + 
align_at_right 
+<BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
align_at_top + align_at_bottom.<BR>*<BR>*CALL METHOD 
g_pdf_html_control-&gt;set_alignment<BR>*&nbsp; EXPORTING<BR>*&nbsp;&nbsp;&nbsp; 
alignment = alignment<BR>*&nbsp; EXCEPTIONS<BR>*&nbsp;&nbsp;&nbsp; 
OTHERS&nbsp;&nbsp;&nbsp; = 1.<BR>*IF sy-subrc &lt;&gt; 
0.<BR>*ENDIF.<BR>*<BR>*l_pdf_size = XSTRLEN( lwa_pdf_form ).<BR>*l_len = 
l_pdf_size.<BR>*WHILE l_len &gt;= 1000.<BR>*&nbsp; l_pdf_line = 
lwa_pdf_form+l_offset(1000).<BR>*&nbsp; APPEND l_pdf_line TO 
l_pdf_data.<BR>*&nbsp; ADD 1000 TO l_offset.<BR>*&nbsp; SUBTRACT 1000 FROM 
l_len.<BR>*ENDWHILE.<BR>*IF l_len &gt; 0.<BR>*&nbsp; l_pdf_line = 
lwa_pdf_form+l_offset(l_len).<BR>*&nbsp; APPEND l_pdf_line TO 
l_pdf_data.<BR>*ENDIF.<BR>*<BR>*l_myurl = 'PDF.pdf'.<BR>*CALL METHOD 
g_pdf_html_control-&gt;load_data<BR>*&nbsp; EXPORTING<BR>*&nbsp;&nbsp;&nbsp; 
url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
l_myurl<BR>*&nbsp;&nbsp;&nbsp; 
size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
l_pdf_size<BR>*&nbsp;&nbsp;&nbsp; 
type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
'application'<BR>*&nbsp;&nbsp;&nbsp; subtype&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
'pdf'<BR>*&nbsp; IMPORTING<BR>*&nbsp;&nbsp;&nbsp; assigned_url = 
l_url<BR>*&nbsp; CHANGING<BR>*&nbsp;&nbsp;&nbsp; data_table&nbsp;&nbsp; = 
l_pdf_data<BR>*&nbsp; EXCEPTIONS<BR>*&nbsp;&nbsp;&nbsp; 
OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1.<BR>*IF sy-subrc &lt;&gt; 
0.<BR>*ENDIF.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>** show 
data<BR>*CALL METHOD g_pdf_html_control-&gt;show_data<BR>*&nbsp; 
EXPORTING<BR>*&nbsp;&nbsp;&nbsp; url&nbsp;&nbsp;&nbsp; = l_url<BR>*&nbsp; 
EXCEPTIONS<BR>*&nbsp;&nbsp;&nbsp; OTHERS = 1.<BR>*IF sy-subrc &lt;&gt; 
0.<BR>*ENDIF.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>*BREAK-POINT ID 
ztravel.<BR>swc_get_element container 'zTaskID'&nbsp; 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>&nbsp;</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>&nbsp;</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>&nbsp; 
EXPORTING<BR>&nbsp;&nbsp;&nbsp; workitem_id&nbsp;&nbsp;&nbsp; = 
workitem_id<BR>&nbsp;&nbsp;&nbsp; att_header&nbsp;&nbsp;&nbsp;&nbsp; = 
att_header<BR>&nbsp;&nbsp;&nbsp; 
att_bin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
att_bin<BR>&nbsp;&nbsp;&nbsp; document_owner = sy-uname<BR>&nbsp;&nbsp;&nbsp; 
language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu<BR>&nbsp;&nbsp;&nbsp; 
do_commit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 'X'<BR>&nbsp; 
IMPORTING<BR>&nbsp;&nbsp;&nbsp; return_code&nbsp;&nbsp;&nbsp; = 
return_code<BR>&nbsp;&nbsp;&nbsp; 
att_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = att_id<BR>&nbsp; 
TABLES<BR>&nbsp;&nbsp;&nbsp; message_lines&nbsp; = 
message_lines<BR>&nbsp;&nbsp;&nbsp; message_struct = 
message_struct.</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</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>