Adding Files as Attachments to SAP Interactive Forms in the Java Environment

Similar documents
How to Download Multiple Files in ZIP using WebDynpro Java

How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3

POWL: Infoset Generation with Web Dynpro ABAP

Upload Image file from system in Web dynpro view

Template Designer: Create Automatic PDF Documents for Attachment or Print Purpose

SDN Community Contribution

Integration of Web Dynpro for ABAP Application in Microsoft Share Point Portal

Easy Lookup in Process Integration 7.1

Using Radio Buttons in Web Template

Fetching User Details from the Portal and Displaying it in Web Dynpro with Authentication in the Portal

Federated Portal for Composite Environment 7.1

MDM Syndicator: Custom Items Tab

Add /Remove Links on ESS Home Page in Business Package 1.5

SDN Community Contribution

BAPI Execution in offline Adobe Form

Creating Custom SU01 Transaction Code with Display and Password Reset Buttons

MDM Import Manager - Taxonomy Data (Attribute Text Values) Part 3

List of Values in BusinessObjects Web Intelligence Prompts

Material Master Archiving in Simple Method

How to Create and Schedule Publications from Crystal Reports

Displaying SAP Transaction as Internet Application in Portal

Material Listing and Exclusion

This article explains the steps to create a Move-in letter using Print Workbench and SAPScripts.

Graphical Mapping Technique in SAP NetWeaver Process Integration

Financial Statement Version into PDF Reader

Open Text DocuLink Configuration - To Access Documents which are Archived using SAP

Solution to the Challenges in Pivoting

SAP PI/XI: Generating Sequence Number Between Multiple Instances of Mapping Execution

Developing Crystal Reports on SAP BW

MDM Syndication and Importing Configurations and Automation

Limitation in BAPI Scheduling Agreement (SA) Create or Change

Linking Documents with Web Templates

How to Create Top of List and End of List of the ALV Output in Web Dynpro for ABAP

Step by Step Method for File Archival in BW

DB Connect with Delta Mechanism

Validity Table in SAP BW/BI

Dialog Windows in WebDynpro ABAP Applications

Creating Rules in Process Composer and using them in Process

Creation of Key Figures with Higher Decimal Place Precision

Standalone BW System Refresh

Information Broadcasting Part 3 Scheduling the First Report

Replacement Path: Explained with an Illustrated Example

Step By Step: the Process of Selective Deletion from a DSO

How to use Boolean Operations in the Formula as Subsidiary for IF Condition

Universal Worklist - Delta Pull Configuration

Programmatical Approach to User Management in Enterprise Portal

Explore to the Update Tab of Data Transfer Process in SAP BI 7.0

E-Sourcing System Copy [System refresh from Production to existing Development]

How to Default Variant Created for Report Developed In Report Painter/Writer

Message Prioritization in Advanced Adapter Engine

SAP BusinessObjects Translation Manager Functionality and Use

SAP BI BO Unit/Currency Logic for Unknown Units Case Study

How to Configure User Status in mysap SRM

Database Statistics During ODS Activation

Creating, Configuring and Testing a Web Service Based on a Function Module

SDN Community Contribution

Internationalization in WebDynpro ABAP Applications

Xcelsius Tricks Part 5 Create a Loading Bar in SAP Crystal Dashboard and Presentation Design (Xcelsius 2008)

How to Upload a File into the Knowledge Management (KM) Repository using KM API.

Web Dynpro Interactive Forms Data Transfer and Scripting

ecatt Part 6 System Data Container

SUP: Personalization Keys and Synchronize Parameter

Extracting Missing Fields of Data Source Which Are Present In Their Extract Structure

Table Row Popup in Web Dynpro Component

Step by Step Procedure for DSO Creation

SAP Biller Direct Step by Step Configuration Guide

Recreating BIA Indexes to Address the Growth of Fact Index Table

How to Display Traffic Lights for Exceptions in BI Web Reports

Different Types of iviews in Enterprise Portal 7.0

SMT (Service Mapping Tool)

Extraction of Hierarchy into Flat File from R/3 and Loading in BW System

Errors while Sending Packages from OLTP to BI (One of Error at the Time of Data Loads through Process Chains)

Custom Password Reset Tool in SAP Enterprise Portal Using Web Dynpro for Java

Web Dynpro ABAP: Changing ALV Contents and Saving in Database

Step By Step Procedure to Implement Soap to JDBC Scenario

How to Integrate SAP xmii Services with Web Dynpro Java

Data Flow During Different Update Mode in LO Cockpit

Implying Security on Business Object XI 3.1 Universe having SAP BW as Source

Step-By-Step guide to Virtual InfoCube Implementation

ios Ad Hoc Provisioning Quick Guide

Open Hub Destination - Make use of Navigational Attributes

Process Chain Log Deletion

Working with Dynamic Tables in Interactive Adobe Forms and WebDynpro ABAP

Web Dynpro: Coloring Table Conditionally

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Purpose of Goods Receipt Message indicator in Purchase Orders

Step by Step Guide How to Use BI Queries in Visual Composer

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

Creating Multiple Methods/Operations and Exposing BAPI as a Webservice

Exception Handling in Web Services exposed from an R/3 System

Load Info Cube in SCM 5.0 (BI 7.0)

Administrating ABAP+JAVA and SLD Problems of SAP PI 7.1

BPM Multi Line Container in Integration Process

Currency Translation in SAP BI Step by step Guide

Using Nested Exception Aggregation in BEx Reports- Scenario

SDN Community Contribution

Config Tool Activities

SAP QM-IDI Interface. SDN Contribution. Applies to: Summary. Author Bio. SAP QM Interfaces

Data Mining: Scoring (Linear Regression)

Server Connectivity and Data Load from Non SAP System to BW

Transcription:

Adding Files as Attachments to SAP Interactive Forms in the Java Environment Applies to: SAP NetWeaver 7.0, For more information, visit the SAP Interactive Forms by Adobe. Summary This document demonstrates how to add attachments to your Adobe Form. Very often Adobe Forms are used to provide summary reports that can be downloaded by the user. When these reports have supporting documents linked to them, they can be added to Adobe Form as attachments. Author: Joyer Cardoza Company: L&T Infotech Created on: 26 October 2009 Author Bio Joyer Cardoza is a SAP NetWeaver Consultant with L&T Infotech having over 4 years of experience in Java, Enterprise Portal and WebDynpro. 2009 SAP AG 1

Table of Contents Introduction... 3 Prerequisites... 3 Business Scenario... 3 Solution Implementation... 4 WebDynpro Context... 4 Sample Code... 4 Related Content... 6 Disclaimer and Liability Notice... 7 2009 SAP AG 2

Introduction This document aims to explain how to add files as attachments in an Adobe Form generated by WebDynpro code. Prerequisites Knowledge Requirement 1. Java 2. WebDynpro Java 3. Adobe Interactive Forms and PDF Document Object Business Scenario User seeks to make an SAP FI Posting using custom developed interactive and intuitive wizard. Due to stringent audit requirement he is required to upload Supporting Documentation in this wizard that supports his request for such a posting. The document can be of any type an image of email approval from his superior, an excel doc containing transaction details, word doc etc. Towards the end of the process, the user wants to maintain a copy of the data he has fed in the wizard along with the supporting documents uploaded by him, for his personal records. The reviewer uses the data and attachments in the PDF report for his audit. 2009 SAP AG 3

Solution Implementation Note: The Adobe Form in this case has been created using an XDP Template and an XML Data Source and is a Non Interactive Form. WebDynpro Context Attribute Name type ctx_va_datasource ctx_va_description ctx_va_filename ctx_va_filetype binary string string WDWebResourceType Sample Code IWDPDFDocumentCreationContext pdfobject = WDPDFDocumentFactory.getDocumentHandler().getDocumentCreationContext(); pdfobject.setdata(xmloutputstream); pdfobject.settemplate(bytarrxdpoutputstream); pdfobject.setinteractive(false); // XML Data Source //XDP Template Note: When you have an existing Interactive Form use: IWDPDFDocumentAccessibleContext pdfobject = WDPDFDocumentFactory.getDocumentHandler().getDocumentAccessibleContext() ; pdfobject.setpdf(byte[] pdfstream) or pdfobject.setpdf(outputstream pdfstream) //Node Containing files to be added as attachments to the PDF IPublicPDFComp.ICtx_vn_PDFAttachmentsNode l_attachmentsnode = wdcontext.nodectx_vn_pdfattachments(); IPublicPDFComp.ICtx_vn_PDFAttachmentsElement l_attachmentselement = null; 2009 SAP AG 4

IWDPDFDocumentAttachment l_pdfattachment = null; for(int i=0; i< l_attachmentsnode.size(); i++){ l_attachmentselement = l_attachmentsnode.getctx_vn_pdfattachmentselementat(i); l_pdfattachment = pdfobject.newattachment(); // Add new attachment, set the binary content, name and description l_pdfattachment.setdescription(l_attachmentselement.getctx_va_description()); l_pdfattachment.setmimetype(l_attachmentselement.getctx_va_filetype()); l_pdfattachment.setname(l_attachmentselement.getctx_va_filename()); l_pdfattachment.setresource(l_attachmentselement.getctx_va_datasource()); pdfobject.setattachment(l_pdfattachment); } ByteArrayOutputStream bytarrpdfoutputstream = new ByteArrayOutputStream(); try { ByteArrayInputStream inputpdfstream = new ByteArrayInputStream(pdfObject.execute().getPDF()); IOUtil.write(inputPDFStream, bytarrpdfoutputstream); inputpdfstream.close(); bytarrpdfoutputstream.close(); } catch (IOException e) { g_messagemanager.reportexception(e.tostring(), true); } catch (Exception e){ g_messagemanager.reportexception(e.tostring(), true); } // Create an object of IWDResource using the InputStream or byte[]. This can be bound with the resource property of the FileDownload byte[] pdfwithattachment = bytarrpdfoutputstream.tobytearray(); 2009 SAP AG 5

Related Content To know more, refer following links: SAP Interactive Forms by Adobe in the Java Environment Javadocs Interactive Forms elearning For more information, visit the SAP Interactive Forms by Adobe. 2009 SAP AG 6

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2009 SAP AG 7