Send pdf file to workflow through web dynpro.

Advertisement

Hi All,
I have a web dynpro component, with this component i am raising a request, which will go to multiple level of approvals(for this triggering workflow from web dynpro).
Now i want to send a pdf file as an attachment to approvers work items.
For this i have used File Upload UI element, and i have binded data property of this upload UI element with an attribute of type Xstring.
Now can you please help me to send this file to workflow.
I am able to send a pdf file as an attachment through executable report (SE38), but same functionality is not working from web dynpro.
Code used in executable report is as below:
DATA: t_data_tab TYPE TABLE OF x255,
bin_size TYPE i,
buffer_x TYPE xstring,
buffer_zip TYPE xstring,
filename TYPE string VALUE 'C:\Documents and Settings\My Documents\Downloads\IT.pdf'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename                      = filename
filetype                      = 'BIN'
IMPORTING
filelength                    = bin_size
  HEADER                        =
TABLES
data_tab                      = t_data_tab.
**get xstring
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
  EXPORTING
    input_length = bin_size
  IMPORTING
    buffer       = buffer_x
  TABLES
    binary_tab   = t_data_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.
ZSWR_ATT_HEADER-FILE_TYPE = 'B'.
ZSWR_ATT_HEADER-FILE_NAME = 'FORM-407'.
ZSWR_ATT_HEADER-FILE_EXTENSION = 'PDF'.
ZSWR_ATT_HEADER-LANGUAGE = 'EN'.
WORKITEMID = '000000401208'.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
  EXPORTING
    WORKITEM_ID          = WORKITEMID
    ATT_HEADER           = ZSWR_ATT_HEADER
  ATT_TXT              =
    ATT_BIN              = buffer_x
   DOCUMENT_OWNER       = SY-UNAME
   LANGUAGE             = SY-LANGU
   DO_COMMIT            = 'X'
IMPORTING
  RETURN_CODE          =
   ATT_ID               = ZSWR_ATT_ID
TABLES
  MESSAGE_LINES        = SWR_MESSAG
*MESSAGE_STRUCT       =
if sy-subrc = 0.
else.
endif.
But function "GUI_UPLOAD" is not working in web dynpro.
Regards,
Amar

Advertisement

HI,
Try out this code :
FileInputStream is = new FileInputStream(file);
      long length = file.length();
      byte[] bytes = new byte[(int)length];
      long bytesRead = is.read(bytes);
      if (bytesRead < length)
       throw new IOException("Could not completely read file "+file.getName());
      is.close();
element.setDocumentContent(bytes);
Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
Regards
Sid

November 30, -0001

Send pdf file to workflow through web dynpro.

Hi All, I have a web dynpro component, with this component i am raising a request, which will go to multiple level of approvals(for this triggering workflow from web dynpro). Now i want to send a pdf file as an attachment to approvers work items. For

Workflows in web dynpro java

Hi experts, please guide me about the workflows in web dynpro java. i have to implement workflow outside SAP, i dont have any idea about it.Dear Shilpi For Configuring Workflows outside SAP we need to have a Gateway HUB where it channelizes to connec

Unable to send or create a link to send pdf file since update to Yosemite.

Unable to send or create a link to send pdf file since update to Yosemite.Hi Donald S Matheson, Are you still facing this issue? May i know which application or service you are using. Can be more precise and provide me the steps to check the behavior

HI Masters , I need information for file upload program in web dynpro java

Hi masters,        i need some inforamtion and documentation on file upload program in web dynpro javaHi surya, You can follow this procedure to upload the file i) Take One Context Attribute named as "D1" of Type "binary". ii) Take one

Sending PDF file in presentation layer as a attachment to Email

Hi, I have a PDF file in my Presentation layer, I want to send it as a attachment to Email. Is there any Function Module or sample code to it. Regards, Adithya M.Hi Maha, Go through this hope u can understand. also check this link http://abapcode.blo

How to send PDF file to XI

Hi All: I need to send <b>pdf</b> file to SAP XI, can I achive it using FILE adapter?? If not with File adapter then please let me know how I can send it to XI? Thanks AdityaHey do you wnat to do some mapping in XI or simple transfer the file

Create a DB-Table through Web Dynpro

Hi everybody, how can i create a new DB-Table on my Database (oracle) through a Web Dynpro Application. In my Web Dynpro Application i create in the dictionary area a table with some colums. After deploying it into my WAS i opened the SQL-Developer b

Upload file into KM using Web Dynpro ABAP

Hi, I'm looking at converting an existing Web Dynpro Java application to a Web Dynpro ABAP application. However, I cannot find how to upload a file and store it in the Portal KM repository using WDA. I have been able to do it successfully using WDJ.

Send PDF file directly to printer

Hi, I have a requirement. I need to send a PDF file to a printer directly for printing. Printer name will be fetched dynamically based on a parameter of report. Please let me know how can we do it. Regards, GuddanHI, Try this in your program. It may

Calling session bean's business method through web dynpro component

Hi All, Can anybody tell me how to call a session bean's methods through a web dynpro WITHOUT java-model or web service model ?? I have following scenario:- 1. Stateless Session bean having two business methods 2. Web Dynpro component 3.Now i want to

Some pdf files not coming through in Mail

Different people have sent me pdf files and having trouble. yesterday someone sent 2 at once and then sent 1 each and it worked. today someone sent 1 and it didn't work What happens is that the pdf file is with the email if I look in View Source but

Can you convert a .pdf file to a Muse web page

We have a nicely formatted brochure in .pdf format.  Instead of trying to painstakingly recreate it in Muse, or just put a boring hyperlink to the .pdf, I'd like to be able to import that .pdf directly as it's own page in Muse.  Is there any way to d

Can I fax a pdf file from pc through HP 5610 usb connection?

My old XP pc had a telephone/fax modem that allowed me to send out papaerless documents as faxes. My new Win 8.1  desktop has no such hardware. I found a 5610 All-in one at the thrift store. Can I direct files through the usb port to be sent as faxes

Cant send a file in Numbers through AOL or Yahoo

im trying to email a file that i have in numbers but it wont even let me click on the file when i go to attach it. what can i do, i need to send it tonight. the file was originally created in excel on a PC but i had no problem opening it in numbers.

Problem sending pdf file on Windows mail

I get the error message "There is a problem sending messages from [email protected] right now.  Contact your provider for more information" (both on aol.com and gmail.com) each time I send an e-mail with a pdf attachment.  I have the Adobe Reade

Cannot send pdf files

i am using send now via Adobe ReaderX1The SendNow forum is http://forums.adobe.com/community/sendnow Please explain what "cannot" means.Read other 3 answers

Sending Body of letter Through mail along with PDF file.

Dear friends,       I want to write some text in the mail(Body) while sending the PDF file.           Now I am sending PDF file , besides PDF file I have to write some text in the mail.                  Please help me .                               

File Upload In DMS Using Web Dynpro ABAP

Hi, I have a requirement to upload files in DMS using Web Dynpro. I have written the code by the hint of the following thread:- scn.sap.com/thread/1865934  My code is uploading all files but when I try to view them from CV03N only txt files are displ

Issue regarding sending E-Mail with PDF file(s) as attachment

Hi, Can anybody provide me with code to send PDF file as E-Mail Attachment! I know we have to use F.M <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b> but how we have to use it to send PDF file as attachment! I was able to send Text files as Attachments i

Problem on opening pdf file in IE inline (through streaming method)

Hello           I had a problem opening pdf file at IE through streaming. I create a page           that have a hyperlink to open the new window and talk to a serlvet. When           clicked, this serlvet will stream a pdf file from the file server t