Combining Multiple Smartform Outputs Into One PDF File

Similar documents
Converting SAP Script outputs to PDF file

SDN Community Contribution

Triggering the Process Chains at Particular Date using Events

Mass Upload Documents to BW

A Simple search program for Dictionary objects

SDN Community Contribution

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

Creation of Sets in SAP-ABAP, How to Read them INI SAP-ABAP Reports

Using Customer Exit Variables in BW/BI Reports: Part - 14

Routines in SAP BI 7.0 Transformations

SAP BW Copy Existing DTP for Data Targets

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

Displaying SAP Transaction as Internet Application in Portal

Function Module to Create Logo

Easy Lookup in Process Integration 7.1

Graphical Mapping Technique in SAP NetWeaver Process Integration

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

How to Create and Schedule Publications from Crystal Reports

ALV Object Model Hierarchical Sequential List The Basics

Using Drop Down By Index in Table UI Element in WebDynpro ABAP

To Check the Files/Reports in Application Server and Trigger Mail Alerts

DB Connect with Delta Mechanism

Using Radio Buttons in Web Template

Step by Step Guide to Creating a Process Type to Close an Open Request in a Cube in BI 7.0

Linking Documents with Web Templates

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

Material Master Archiving in Simple Method

POWL: Infoset Generation with Web Dynpro ABAP

How to Configure User Status in mysap SRM

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

MDM Syndicator: Custom Items Tab

Download SAP Query Output to Local/ Network Folders in Background

ALV with Dynamic Structure in Web DynPro

Using Customer Exit Variables in BW/BI Reports: Part - 4

Limitation in BAPI Scheduling Agreement (SA) Create or Change

SDN Community Contribution

ABAP Code Sample to Attach F1 and F4 Help Fields in ALV Grid

Table Row Popup in Web Dynpro Component

Custom Process types Remote Trigger and End Time

Working with the Roadmap UI Element in Web Dynpro ABAP

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

Dynamically Enable / Disable Fields in Table Maintenance Generator

Freely Programmed Help- Web Dynpro

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

Working with Tabstrip in Webdynpro for ABAP

ABAP Program to Read/Populate Selection Screen Parameters Dynamically

Procedure to Trigger Events in Remote System Using an ABAP Program

Table Popins and Business Graphics in Web Dynpro ABAP

Data Extraction & DS Enhancement in SAP BI Step by Step

Applies To:...1. Summary...1. Table of Contents...1. Procedure..2. Code... Error! Bookmark not defined.0

Customized Transaction to Trigger Process Chain from Failed Step

Recreating BIA Indexes to Address the Growth of Fact Index Table

How to Create your Own Rule in Workflow?

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

Open Hub Destination - Make use of Navigational Attributes

Offsetting Account Description in FBL3N & FAGLL03 GL Line Item Display Reports

Generating Self-Defined Functions for ALV in Web Dynpro for ABAP

Material Master Extension for New Plant

Web Dynpro: Coloring Table Conditionally

Implementing a BAdI in an Enhancement Project (CMOD)

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

Creating Custom SU01 Transaction Code with Display and Password Reset Buttons

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

Database Statistics During ODS Activation

Step by Step Procedure for DSO Creation

Financial Statement Version into PDF Reader

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

Material Listing and Exclusion

About ITAB Duplicate_Key (SAP lrsaods) Runtime Error

SMT (Service Mapping Tool)

Reporting Duplicate Entries

Working with Dynamic Tables in Interactive Adobe Forms and WebDynpro ABAP

Developing Crystal Reports on SAP BW

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

Step by Step Method for File Archival in BW

How to Create and Execute Dynamic Operating System Scripts With XI

Validity Table in SAP BW/BI

Using Query Extract to Export Data from Business warehouse, With Pros and Cons Analyzed

SDN Community Contribution

ABAP Code - Recipients (Specific Format) SAP BW Process Chain

Implementing Customer Exit Reporting Variables as Methods

List of Values in BusinessObjects Web Intelligence Prompts

Step by Step Guide to Enhance a Data Source

Customizing Characteristic Relationships in BW-BPS with Function Modules

Web Dynpro ABAP: Dynamic Table

Purpose of Goods Receipt Message indicator in Purchase Orders

ecatt Part 6 System Data Container

How to Display Result Row in One Line While Reporting On Multiproviderer

Restricting F4 (Input Help) Values While Running a SAP BW Query

Solution to the Challenges in Pivoting

Information Broadcasting Part 3 Scheduling the First Report

Step By Step Procedure to Implement Soap to JDBC Scenario

Setting up Connection between BW and R/3 for Data Load

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

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

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

A Step-by-Step Guide on IDoc-ALE between Two SAP Servers

Adding Custom Fields to Contract Account Screen

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

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

Transcription:

SDN Contribution Combining Multiple Smartform Outputs Into One PDF File Applies to: SAP R/3 46C ABAP / SMARTFORMS Summary This program code would help those who want to combine multiple smartform outputs into a single OTF output and then to download them as a single PDF file in your local PC Author: Sylendra Prasad M Company: Wipro Technologies, SAP ABAP Consultant Created on: 13 th June 2006 2006 SAP AG 1

Table of Contents Procedure 2 Sample Code 4 Screenshot of the output PDF file 9 Disclaimer and Liability Notice 10 Author Bio 11 Procedure The Function Module generated by the system when you activate the Smartform is obtained by the Function Module SSF_FUNCTION_MODULE_NAME and the data to be passed to the smartform is sent by calling this FM In this FM, we ll set the GETOTF field of the CONTROL_PARAMETERS parameter This FM would import the details of the Smartform into a parameter JOB_OUTPUT_INFO, which is of type SSFCRESCL SSFCRESCL contains a field OTFDATA, which is a table type of ITCOO containing the OTF equivalent of the Smartform output ITCOO has two fields TDPRINTCOM, which is the command ID and TDPRINTPAR, which is the print parameter 2006 SAP AG 2

A sample content of the OTF table is given below For every Smartform output in its OTF equivalent, TDPRINTCOM begins and ends with // So the final OTF table that should be sent as PDF output should contain only one pair of // to mark the beginning and end of the table TDPRINTCOM value for end-of-page will be EP So if you want to combine multiple Smartforms into one OTF table, the beginning and end markers ( // ) for subsequent smartforms should be removed and appended after EP command in the OTF table Here is the sample content of OTF table, which contains the output of two Smartforms 2006 SAP AG 3

Similarly we can append multiple smartform outputs to one OTF table and then use the Function Module CONVERT_OTF to convert the OTF data to PDF data and then you can use the Function Module GUI_DOWNLOAD to download the PDF data to your local file Sample Code REPORT yshail_smartform1_new ****************************DECLARATIONS******************************** TABLES: zshail_t1,sflight DATA: cparam TYPE ssfctrlop, outop TYPE ssfcompop, fm_name TYPE rs38l_fnam, my_tabix TYPE sy-tabix, file_size TYPE i, bin_filesize TYPE i DATA: tab_otf_data TYPE ssfcrescl, pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE, 2006 SAP AG 4

itab LIKE TABLE OF zshail_t1 WITH HEADER LINE, otab TYPE TABLE OF sflight WITH HEADER LINE, tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE start-of-selection ***************** suppressing the dialog box**************************** outop-tddest = 'LP01' cparam-no_dialog = 'X' cparam-preview = space cparam-getotf = 'X' *****************for the first smartform******************************** CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' formname = 'ZSHAIL_SMFORM2' * VARIANT = ' ' * DIRECT_CALL = ' ' fm_name = fm_name no_form = 1 no_function_module = 2 OTHERS = 3 IF sy-subrc <> 0 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 ENDIF SELECT my_id my_income my_name FROM zshail_t1 INTO TABLE itab CALL FUNCTION fm_name * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = control_parameters = cparam * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = output_options = outop user_settings = space * DOCUMENT_OUTPUT_INFO = job_output_info = tab_otf_data * JOB_OUTPUT_OPTIONS = TABLES it_tab = itab[] formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5 IF sy-subrc <> 0 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 2006 SAP AG 5

ENDIF **********appending the otf data into the final table********************** tab_otf_final[] = tab_otf_data-otfdata[] **************for the second smartform************************************* CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' formname = 'ZSHAIL_SMTAB' * VARIANT = ' ' * DIRECT_CALL = ' ' fm_name = fm_name no_form = 1 no_function_module = 2 OTHERS = 3 IF sy-subrc <> 0 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 ENDIF SELECT carrid connid fldate price FROM sflight INTO CORRESPONDING FIELDS OF TABLE otab CALL FUNCTION fm_name * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = control_parameters = cparam * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = output_options = outop user_settings = space * DOCUMENT_OUTPUT_INFO = job_output_info = tab_otf_data * JOB_OUTPUT_OPTIONS = TABLES itab = otab[] formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5 IF sy-subrc <> 0 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 ENDIF 2006 SAP AG 6

***removing the initial and final markers from the OTF data********** DELETE tab_otf_data-otfdata WHERE tdprintcom = '//' ***************** searching for the end-of-page in OTF table************ READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP' my_tabix = sy-tabix + 1 ************ appending the modified OTF table to the final OTF table**** INSERT LINES OF tab_otf_data-otfdata INTO tab_otf_final INDEX my_tabix ************ converting OTF data into pdf data************************** CALL FUNCTION 'CONVERT_OTF' format = 'PDF' max_linewidth = 132 * ARCHIVE_INDEX = ' ' * COPYNUMBER = 0 * ASCII_BIDI_VIS2LOG = ' ' bin_filesize = bin_filesize * BIN_FILE = TABLES otf = tab_otf_final lines = pdf_tab err_max_linewidth = 1 err_format = 2 err_conv_not_possible = 3 err_bad_otf = 4 OTHERS = 5 IF sy-subrc <> 0 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 ENDIF *************downloading the converted PDF data to your local PC******** CALL FUNCTION 'GUI_DOWNLOAD' bin_filesize = bin_filesize filename = 'D:\TESTPDF' filetype = 'BIN' * APPEND = ' ' * WRITE_FIELD_SEPARATOR = ' ' * HEADER = '00' * TRUNC_TRAILING_BLANKS = ' ' * WRITE_LF = 'X' * COL_SELECT = ' ' * COL_SELECT_MASK = ' ' * DAT_MODE = ' ' * CONFIRM_OVERWRITE = ' ' * NO_AUTH_CHECK = ' ' * CODEPAGE = ' ' * IGNORE_CERR = ABAP_TRUE 2006 SAP AG 7

* REPLACEMENT = '#' * WRITE_BOM = ' ' * TRUNC_TRAILING_BLANKS_EOL = 'X' filelength = file_size TABLES data_tab = pdf_tab * FIELDNAMES = file_write_error = 1 no_batch = 2 gui_refuse_filetransfer = 3 invalid_type = 4 no_authority = 5 unknown_error = 6 header_not_allowed = 7 separator_not_allowed = 8 filesize_not_allowed = 9 header_too_long = 10 dp_error_create = 11 dp_error_send = 12 dp_error_write = 13 unknown_dp_error = 14 access_denied = 15 dp_out_of_memory = 16 disk_full = 17 dp_timeout = 18 file_not_found = 19 dataprovider_exception = 20 control_flush_error = 21 OTHERS = 22 2006 SAP AG 8

Screenshot of the output PDF file First smartform output 2006 SAP AG 9

Second Smartform output 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 2006 SAP AG 10

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 Author Bio I am an SAP ABAP Consultant working for Wipro Technologies 2006 SAP AG 11