*----------------Database Declaration-----------------------------*
TABLES: LFA1,ADR6.
*-----------------Internal Table Declaration----------------------*
*----------------Work VAriables ----------------------------------*
DATA: S_DOC_CHNG LIKE SODOCCHGI1.
DATA: L_TAB_LINES LIKE SY-TABIX.
DATA: COUNT1 TYPE I.
DATA: COUNT2(4) TYPE N.
DATA: W_ITCPO LIKE ITCPO,W_DIALOG,W_ITCPP LIKE ITCPP.
DATA: W_BIN_FILESIZE(10) TYPE C.
DATA: L_FILENAME LIKE RLGRAP-FILENAME .
DATA: OK_CODE LIKE SY-UCOMM.
DATA: SAV_OK_CODE LIKE SY-UCOMM.
DATA: LINE_COUNT TYPE I.
DATA: FLAG(1) VALUE 'X'.
DATA: WRK_LINES LIKE SY-TABIX.
DATA: WRK_REMNO LIKE ZDUNNING_EMAIL-REMNO.
DATA: T_OTFDATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
DATA: T_ASCII LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: T_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: T_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: T_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: T_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: T_TEXT1 LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: WRK_DAT LIKE SY-DATUM.
CONTROLS: TBCTL_EMAIL TYPE TABLEVIEW USING SCREEN 9000.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'DS'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
DIALOG = W_DIALOG
FORM = 'ZRP_DUNNING1'
LANGUAGE = SY-LANGU
OPTIONS = W_ITCPO
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. " OPEN_SCRIPT
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_IN_TXT_MODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM DOWNLOAD_IN_TXT_MODE. REFRESH T_PDF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING FORMAT = 'PDF'
MAX_LINEWIDTH = 255
IMPORTING BIN_FILESIZE = W_BIN_FILESIZE
TABLES OTF = T_OTFDATA
LINES = T_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
ENDFORM. " DOWNLOAD_IN_TXT_MODE
*&---------------------------------------------------------------------* *& Form DOWNLOAD_TO_PRES_SERV *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM DOWNLOAD_TO_PRES_SERV.
COUNT2 = IT_REQ1-COUNT.
CONCATENATE 'C:\RFQ_' COUNT2 '.
PDF' INTO L_FILENAME .
CALL FUNCTION 'DOWNLOAD'
EXPORTING BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = L_FILENAME
FILETYPE = 'BIN'
TABLES DATA_TAB = T_PDF
EXCEPTIONS INVALID_FILESIZE = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
CUSTOMER_ERROR = 7
OTHERS = 8.
CLEAR COUNT 2.
ENDFORM. " DOWNLOAD_TO_PRES_SERV
*&---------------------------------------------------------------------* *& Form SEND_MAIL_INSUR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM SEND_MAIL_INSUR. DATA : L_CHRLEN TYPE I, L_FILENAME LIKE RLGRAP-FILENAME , L_LENGTH LIKE T_OBJPACK-DOC_SIZE .
CLEAR : T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST,S_DOC_CHNG. REFRESH : T_OBJPACK,T_OBJTXT,T_OBJBIN,T_OBJHEAD,T_RECLIST.
S_DOC_CHNG-OBJ_NAME = 'RFQ Referrals'.
S_DOC_CHNG-OBJ_DESCR = 'RFQ Referrals'.
DESCRIBE TABLE T_OBJTXT LINES L_TAB_LINES.
READ TABLE T_OBJTXT INDEX L_TAB_LINES.
S_DOC_CHNG-DOC_SIZE = ( L_TAB_LINES - 1 ) * 255 + STRLEN( T_OBJTXT ).
CLEAR T_OBJPACK-TRANSF_BIN.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = 'RAW'.
APPEND T_OBJPACK.
PERFORM CONVERT_TABLE.
DESCRIBE TABLE T_OBJBIN LINES L_TAB_LINES.
T_OBJHEAD = L_FILENAME.
APPEND T_OBJHEAD.
T_OBJPACK-TRANSF_BIN = 'X'.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 1.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = L_TAB_LINES.
T_OBJPACK-DOC_TYPE = 'PDF'.
T_OBJPACK-OBJ_NAME = 'RFQ REFERRAL'.
T_OBJPACK-OBJ_DESCR = 'RFQ REFERRALS : PDF Format'.
T_OBJPACK-DOC_SIZE = L_TAB_LINES * 255.
W_BIN_FILESIZE = L_TAB_LINES * 255.
MOVE W_BIN_FILESIZE TO L_LENGTH+3(9).
TRANSLATE L_LENGTH USING ' 0'.
T_OBJPACK-DOC_SIZE = L_LENGTH .
APPEND T_OBJPACK.
T_RECLIST-RECEIVER = IT_REQ-EMAIL.
T_RECLIST-REC_TYPE = 'U'.
APPEND T_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = S_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES PACKING_LIST = T_OBJPACK
OBJECT_HEADER = T_OBJHEAD
CONTENTS_BIN = T_OBJBIN
CONTENTS_TXT = T_OBJTXT
RECEIVERS = T_RECLIST
EXCEPTIONS TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC EQ 0.
MESSAGE S501(ZF).
CLEAR IT_REQ2.
REFRESH IT_REQ2.
LOOP AT IT_REQ WHERE SEL = 'X'.
MOVE-CORRESPONDING IT_REQ TO IT_REQ2.
APPEND IT_REQ2.
DELETE IT_REQ WHERE SEL = 'X'.
CLEAR IT_REQ.
ENDLOOP.
FLAG = ' '.
ELSE.
MESSAGE E502(ZF).
ENDIF.
ENDFORM.
" SEND_MAIL_INSUR *&---------------------------------------------------------------------* *& Form CONVERT_TABLE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM CONVERT_TABLE.
DATA: HLTLINES TYPE I.
DATA: FLE1(2) TYPE P.
DATA: FLE2(2) TYPE P.
DATA: HFELD(500) TYPE C.
DATA: OFF1 TYPE P.
DATA: HTABIX LIKE SY-TABIX.
DESCRIBE TABLE T_PDF LINES HLTLINES.
DESCRIBE FIELD T_PDF LENGTH FLE1.
DESCRIBE FIELD T_OBJBIN LENGTH FLE2.
CLEAR T_OBJBIN.
REFRESH T_OBJBIN.
CLEAR OFF1.
CLEAR HFELD.
LOOP AT T_PDF.
HTABIX = SY-TABIX.
MOVE T_PDF TO HFELD+OFF1.
IF HTABIX = HLTLINES.
FLE1 = STRLEN( T_PDF ).
ENDIF. OFF1 = OFF1 + FLE1.
IF OFF1 GE FLE2.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(FLE2).
APPEND T_OBJBIN.
SHIFT HFELD BY FLE2 PLACES.
OFF1 = OFF1 - FLE2.
ENDIF.
IF HTABIX = HLTLINES.
IF OFF1 GT 0.
CLEAR T_OBJBIN.
T_OBJBIN = HFELD(OFF1).
APPEND T_OBJBIN.
ENDIF.
ENDIF.
ENDLOOP. ENDFORM. " CONVERT_TABLE *&---------------------------------------------------------------------* *& Form OPEN_SCRIPT1 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM OPEN_SCRIPT1.
IF W_ITCPP IS INITIAL.
W_DIALOG = 'X'.
IF SAV_OK_CODE = 'PRNPRV'.
W_ITCPO-TDGETOTF = ' '.
ENDIF.
IF SAV_OK_CODE = 'PDFD' OR SAV_OK_CODE = 'PDFM'.
W_DIALOG = 'X'.
W_ITCPO-TDGETOTF = 'X'.
ENDIF.
ELSE. " if w_itcpp is initial.
CLEAR W_DIALOG.
MOVE-CORRESPONDING W_ITCPP TO W_ITCPO.
ENDIF. " if w_itcpp is initial.
IF SAV_OK_CODE = 'PRNPRV'.
W_DIALOG = 'X'.
ENDIF.
*changed
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'DS'
* DIALOG = W_DIALOG
FORM = 'ZRP_DUNNING1'
LANGUAGE = SY-LANGU
* OPTIONS = W_ITCPO
* IMPORTING
* RESULT = W_ITCPP
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
OTHERS = 10.
ENDFORM. " OPEN_SCRIPT1
Friday, November 23, 2007
File - Print to PDF SAP Script
Labels:
File - Print to PDF SAP Script
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(952)
-
▼
November
(716)
- SAP Paper Documents
- SAP Repository
- SAP R/3 Implementation and Maintenance Tips
- ABAP/4 programming language overview
- The interactive eLearning system for ABAP™
- Helpful System Administration ABAPS
- free download abap programmin pdf book
- examples of real time objects in sap abap(1)
- examples of real time objects in sap abap
- work flow example2
- Workflow tips
- Miscellaneous sap abap faq
- BDC , LSMW, Conversions faq in abap
- Sap Scripts & Smart forms faqs in abap
- performance tuning in abap faqs
- Real Time BDC & LSMW faqs
- Real Time ABAP Internal Tables faqs
- Real Time ABAP Reports faqs
- Real Time questions ..in sap ABAP
- SAP ABAP FAQ (Technical)
- ABAP and Unicode
- ABAP and JavaScript
- ABAP Objects
- ABAP Database Access
- Running ABAP Programs
- ABAP User Dialogs
- The ABAP Programming Language
- Creating and Changing ABAP Programs
- Overview of the Components of Application Programs
- Introduction to ABAP
- ABAP Programming Documentation
- FREE DOWNLOAD ALE, EDI & IDOCS
- Conversion of IDOCs to XML.pdf
- FREE DOWNLOAD IDOC Interface Technology
- FREE DOWNLOAD EDI, IDOC Interface
- FREE DOWNLOAD IDOC BOOK
- FREE DOWNLOAD LSMW - Idoc Inbound Processing
- FREE DOWNLOAD SAP ABAP Idoc Interface
- FREE DOWNLOAD Java for SAP
- FREE DOWNLOAD Java for ABAP Programmers
- FREE DOWNLOAD Java and BAPI technology for EP
- free download Building Web Services with Java and ...
- free download Enable SAP with the power of Javascript
- FREE DOWNLOAD ABAP Training Simulator
- FREE DOWNLOAD SAP Accounting Training Simulators
- free download SAPScripts Made Easy
- CONDENSE
- CONSTANTS
- ABAP Quick Viewer
- sap abap XXL (EXtended Export of Lists)
- Some ABAP/4 Query header line variable
- Understanding SAP Query
- ABAP/4 Query
- ABAP/4 Query Hints and Tips
- SAP Website Links Exchange for ABAP, Basis or Cons...
- sap abap Program for Generate IDoc
- sap abap program for Reads an existing Idoc and di...
- List of ABAP Function modules
- sap abap FTP programming
- sap abap program for Issuing an Unix Command from ...
- sap abap program for RFC call to get Server List
- sap abap program for A SAP Pop-out Calculator
- sap ABAP program for Timers and Auto-refresh
- sap abap program for WS_EXECUTE to called External...
- sap abap programming Execute DOS Command from ABAP...
- To execute a dos command from ABAP
- sap abap program for Make your SAPGUI Disappear an...
- sap abap program for Using Function Modules F4_FIL...
- abp program for How to Restrict the Select Options
- sap abap program for Take Values from Selection-Sc...
- sap abap program for Change Text Into Password
- sap abap program for Function Module for Encryptio...
- sap abap program for FM VRM_SET_VALUE To List Box
- sap abap program for Value Request For Parameter
- sap abap program for Pop a Message to specific SAP...
- ABAP Pop-out box for user confirmation
- sap ABAP program for POP-UP Window
- sap abap program Sample XML Source Code For SAP
- sap abap XML file to word document through SAP
- sap abap program for How to Write Web Reports in SAP
- sap abap conversion Program to Test Line Selection...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for String Handling in ABAP - Rem...
- sap abap program for Split String into two parts a...
- sap abap conversion Program For Printing Prime Number
- sap abap program for How can I get Ascii value of ...
- sap abap program for Figure to Words for India but...
- sap abap conversion program for Print Number Value...
- sap abap conversion program for Insert a special T...
- sap abap program for Convert SAP Spool List to HTML
- sap program for Convert Month to Word in ABAP
- ABAP function to convert Number to Words
- sap abap program for How to Create Tree Control
- sap abap A sample Tree Programming
-
▼
November
(716)
No comments:
Post a Comment