‎2009 Aug 31 7:07 AM
Hi experts,
i am working on one report in which i have attached two smartforms that have to b printed one after another.I have completed this tast.Now the requirement id two convert both these smartforms into single pdf file..is it possible..i know how to conert single smartform into pdf.But have no idea about 2 smartforms into single pdf.Can u plz help me if there is any way to accomplish this tast.
Regards,
Raman
‎2009 Aug 31 7:12 AM
Hi Sharma, <li>Check the below SDN contribution in PDF [Combining Multiple Smartform Outputs Into One PDF File|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450&overridelayout=true] Thanks Venkat.O
‎2009 Aug 31 7:12 AM
Hi Sharma, <li>Check the below SDN contribution in PDF [Combining Multiple Smartform Outputs Into One PDF File|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450&overridelayout=true] Thanks Venkat.O
‎2009 Aug 31 7:16 AM
Hi
See this [WIKI|http://wiki.sdn.sap.com/wiki/x/jkM ] Its conversion of smartforms into PDF
You can put loop from
.................GET SMARTFORM FUNCTION MODULE NAME.................
till
.........................CONVERT TO OTF TO PDF.......................
so in one internal table it_lines it will contain data for 2 smartforms
then convert it into one PDF file.
so you get 2 smartforms in one PDF.
Thanks
Viquar Iqbal
‎2009 Aug 31 7:17 AM
call smartform FM.
get otfdata into one table. =====>(itab1)
call second smartform FM.
get otf data into another internal table ====>itab2
now append lines of itab2 to itab1.
so you have both pdf data in one otf table.
now use convert_otf* FM to get your PDF
‎2009 Aug 31 7:19 AM
just append the OTF of both smartforms into single internal table and convert to PDF.
‎2009 Aug 31 7:23 AM
Hi,
Just check this program.. REPORT yshail_smartform1_new . 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, 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 first smartform*************************************** CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = 'ZSHAIL_SMFORM2' * VARIANT = ' ' * DIRECT_CALL = ' ' IMPORTING fm_name = fm_name EXCEPTIONS 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 EXPORTING * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = control_parameters = cparam * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = output_options = outop user_settings = space IMPORTING * DOCUMENT_OUTPUT_INFO = job_output_info = tab_otf_data * JOB_OUTPUT_OPTIONS = TABLES it_tab = itab[] EXCEPTIONS 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. *********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' EXPORTING formname = 'ZSHAIL_SMTAB' * VARIANT = ' ' * DIRECT_CALL = ' ' IMPORTING fm_name = fm_name EXCEPTIONS 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 EXPORTING * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = control_parameters = cparam * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = output_options = outop user_settings = space IMPORTING * DOCUMENT_OUTPUT_INFO = job_output_info = tab_otf_data * JOB_OUTPUT_OPTIONS = TABLES itab = otab[] EXCEPTIONS 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. **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' EXPORTING format = 'PDF' max_linewidth = 132 * ARCHIVE_INDEX = ' ' * COPYNUMBER = 0 * ASCII_BIDI_VIS2LOG = ' ' IMPORTING bin_filesize = bin_filesize * BIN_FILE = TABLES otf = tab_otf_final lines = pdf_tab EXCEPTIONS 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' EXPORTING bin_filesize = bin_filesize filename = 'D:TEST.PDF' filetype = 'BIN' IMPORTING filelength = file_size TABLES data_tab = pdf_tab
have alook to this [Combining Multiple Smartform Outputs Into One PDF|[Combining Multiple Smartform Outputs Into One PDF|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450&overridelayout=true]
regards,
Archana
Edited by: Archana Kumari on Aug 31, 2009 8:23 AM
‎2009 Aug 31 7:26 AM
Hi Raman,
Kindly post your query in respected forum FORM PRINTING.
Here is the Process for converting multiple smartform output to pdf format.
a. As we know on activation of a Smartform system will generate a function module. And this function module name can be obtained by SSF_FUNCTION_MODULE_NAME and the data to be passed to the smart form is sent by calling this function module.
b. we have u201Ccontrol parametersu201D as import parameter. When we set control_param-getotf = u2018Xu2019 , We get smartform output in OTF format. Then the application program can use the field JOB_OUTPUT_INFO-OTFDATA (export parameter) to access the OTF table.
c. 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.
d. For every Smartform output in its OTF equivalent, TDPRINTCOM begins and ends with u2018//u2019. So the final OTF table that should be sent as PDF output should contain only one pair of u2018//u2019 to mark the beginning and end of the table. TDPRINTCOM value for end-of-page will be u2018EPu2019.
e. So if you want to combine multiple Smartforms into one OTF table, the beginning and end markers (u2018//u2019) for subsequent smartforms should be removed and appended after u2018EPu2019 command in the OTF table.
f. Similarly we can combine multiple smart forms by removing u2018//u2019 and append them using u2018EPu2019 and convert from OTF format to PDF using Convert_OTF and save as PDF file using GUI_DOWNLOAD.This solves your problem.
Regards,
Pavan.
‎2009 Aug 31 7:38 AM
Hi, Raman
if Venkat and Iqbal can find the helpful Links than why you can't do it youself?. Please Search Before Posting.
Faisal
‎2009 Sep 16 3:27 PM
Hi Faisal Altaf,
Raman question is realistic. The links provided by Venkat and Isbal are learners smartforms help. But it seems Raman really had an issue in middle of his core complex development. Please warn him only if you are able to solve otherwise try to help.
thanks,
Anil
‎2009 Sep 17 6:26 AM
Hi anil there is no offence here ... what faisal meant was to just search the forum before posting because this is frequently asked question.
‎2009 Sep 30 8:53 PM
Right, but they might have already searched and then looked for help. We should provide the useful link and then advice the searching ways.