Send Smartform Output Mail

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Send Smartform Output Mail as PDF for free.

More details

  • Words: 768
  • Pages: 6
*&---------------------------------------------------------------------* *& Report ZSANDEEP_SMARTFORM_PDF_CONVT *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* ****PURPOSE OF PROGRAM : convert smartform OUTPUT to PDF FORMAT AND SEND TO RECEIVER MAIL ADDRESS *******DEVELOPED BY : SANDEEP A JADHAV. ********DATE :- 18/11/2007

REPORT ZSANDEEP_SMARTFORM_PDF_CONVT. *STEP 1 . DECLARATION PART TABLES : PA0000 , PA0001 ,PA0002, PA0028 . DATA : ITAB_PA0001 LIKE PA0001 OCCURS 0 WITH HEADER LINE .

*STEP 2 FTECH THE DATA INTO THE INTERNAL TABLE SELECT * FROM PA0001 INTO CORRESPONDING FIELDS OF TABLE ITAB_PA0001 . *********************************************************************************************** *ACTUCAL PROGRAM IS STARTED NOW......................

************************************STEP 3 : DECLARATION PART data: v_len_in LIKE sood-objlen, structjob TYPE SSFCRESCL. DATA : i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE, i_tline TYPE TABLE OF tline WITH HEADER LINE. " make each line 132 characters *** make each line 255 characters DATA : BEGIN OF i_tline2 OCCURS 0, tline TYPE char255, END OF i_tline2. ****when we send a mail we mention the subject line ****this ZDATA itb is used for just giving a subject line data : zdata LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE. ZDATA-OBJ_NAME = 'TEST'. ZDATA-OBJ_DESCR = 'SUBJECT LINE '.

ZDATA-OBJ_LANGU = 'EN'. APPEND ZDATA. ********end of subject line

**********receiver mail address DATA : zreceivers TYPE TABLE OF somlreci1 WITH HEADER LINE. zreceivers-receiver = 'ABAP2' . " RECEIVER mail address zreceivers-rec_type = 'B'. " B -> FOR SAP USER . PLEASE CHECK THE TABLE 'TBCS_RECIP' zreceivers-REC_ID = 'ABAP2' . " receiver mail address APPEND zreceivers.

******* COPIED THE FUNCTION MODULE NAME INTO THE VARIABLE FM_NAME ********************8 DATA : FM_NAME TYPE rs38l_fnam value '/1BCDWB/SF00000002'. ************************************END OF STEP 3 ****************************************************************88]

************STEP 4 CALL THE FUNCTION MODULE SSF_FUNCTION_MODULE_NAME ************************************************************* *****SSF_FUNCTION_MODULE_NAME :- THIS FUNCTION MODULE IS USED FOR CALLING SMARTFORM NAME AND FUNCTION WHICH IS GENERATED BY SMARTFORMS CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSANDEEP_HR_TEST_PRG1' " SMARTFORM NAME * 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.

*END OF FUNCTION SSF_FUNCTION_MODULE_NAME

***********************************END OF STEP 4 *************************************************

************************************STEP 5 CALL THE FUNCTION MODULE ************************************* DATA : ls_CONTROL_PARAMETERS type SSFCTRLOP. ls_CONTROL_PARAMETERS-GETOTF = 'X'. ls_CONTROL_PARAMETERS-NO_DIALOG = ''. ls_CONTROL_PARAMETERS-PREVIEW = ''. * **********CALL THE FUNCTION MODULE /1BCDWB/SF00000002 DATA : w_compop TYPE ssfcompop, w_return TYPE ssfcrescl. CALL FUNCTION FM_NAME EXPORTING * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = CONTROL_PARAMETERS = ls_CONTROL_PARAMETERS * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = OUTPUT_OPTIONS = w_compop USER_SETTINGS = 'X' IMPORTING * DOCUMENT_OUTPUT_INFO = JOB_OUTPUT_INFO = w_return * JOB_OUTPUT_OPTIONS = TABLES ITAB_PA0001 = ITAB_PA0001 " passing the itab ( final output ) 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.

i_otf[] = w_return-otfdata[]. *************************STEP 6 CONVERT INTO OTF CALL FUNCTION 'CONVERT_OTF' EXPORTING format = 'PDF' max_linewidth = 132 * ARCHIVE_INDEX ='' * COPYNUMBER =0 * ASCII_BIDI_VIS2LOG ='' * PDF_DELETE_OTFTAB ='' IMPORTING BIN_FILESIZE = v_len_in * BIN_FILE = TABLES OTF = i_otf LINES = i_tline 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.

********************************STEP 7 **********

*SX_TABLE_LINE_WIDTH_CHANGE use :- make each line 255 characters CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE' * EXPORTING * LINE_WIDTH_SRC = * LINE_WIDTH_DST = * TRANSFER_BIN ='' TABLES CONTENT_IN = i_tline CONTENT_OUT = i_tline2 * * * * *

EXCEPTIONS ERR_LINE_WIDTH_SRC_TOO_LONG =1 ERR_LINE_WIDTH_DST_TOO_LONG =2 ERR_CONV_FAILED =3 OTHERS =4 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.

***********END OF SX_TABLE_LINE_WIDTH_CHANGE

*********************STEP 9

****FOR TRANSFERRING SMARTFORM OUTPUT TO RECEIVER MAIL ADDRESS CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' EXPORTING DOCUMENT_DATA = zdata DOCUMENT_TYPE * PUT_IN_OUTBOX COMMIT_WORK * IMPORTING * SENT_TO_ALL * NEW_OBJECT_ID TABLES * OBJECT_HEADER OBJECT_CONTENT * CONTENTS_HEX * OBJECT_PARA * OBJECT_PARB RECEIVERS * * * * * * * * *

= 'PDF' ='' = 'x' = = = = i_tline2 = = = = ZRECEIVERS " RECEIVER ADDRESS

EXCEPTIONS TOO_MANY_RECEIVERS =1 DOCUMENT_NOT_SENT =2 DOCUMENT_TYPE_NOT_EXIST =3 OPERATION_NO_AUTHORIZATION =4 PARAMETER_ERROR =5 X_ERROR =6 ENQUEUE_ERROR =7 OTHERS =8 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.

Use this tcode to check the sended mail u got it or not :- SBWP

Problem : Now the Problem is that I want to send this output file into the external mail id (i.e your personal mail id ) . Solution from my side ( but not confirm ) . Their must be setting in tcode :- SCOT

Related Documents

Send Smartform Output Mail
November 2019 3
Send Mail
June 2020 12
Send
November 2019 32