*&---------------------------------------------------------------------*
*& Report ZSF_PDF_DRIV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSF_PDF_DRIV.
TYPES: BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MEINS TYPE VBRP-MEINS,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP.
DATA : I_VBRP TYPE TABLE OF VBRP,
WA_VBRP TYPE VBRP.
DATA : FM_NAME TYPE RS38L_FNAM.
DATA : OUT_OPTIONS TYPE SSFCOMPOP."SSFCRESOP.
DATA : OP_OPTION TYPE SSFCTRLOP,
JOB_OUTPUT TYPE SSFCRESCL,
V_BIN_FILESIZE TYPE I.
TYPES : BEGIN OF TY_URL,
NAME(80),
URL TYPE STRING,
END OF TY_URL.
DATA : IT_URL TYPE TABLE OF TY_URL,
WA_URL TYPE TY_URL.
DATA :I_PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
SELECT VBELN POSNR MEINS NETWR FROM VBRP INTO CORRESPONDING FIELDS OF
TABLE I_VBRP UP TO 10 ROWS.
OP_OPTION-GETOTF = 'X'. " for pdf data
OP_OPTION-NO_DIALOG = 'X'. " no print priview
OUT_OPTIONS-TDCOPIES = '3'.
***FOR NO OF COPIES
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSF_PDF'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
.
WA_URL-NAME = 'mail'.
WA_URL-URL = 'https://www.google.co.in/'.
APPEND WA_URL TO IT_URL.
CALL FUNCTION 'HR_RCF_SF_URL_REFRESH_GT'
.
CALL FUNCTION 'HR_RCF_SF_URL_PREPARE_CALLBACK'
TABLES
PT_URL = IT_URL.
OUT_OPTIONS-URLCALL = 'HR_RCF_SF_URL_CALLBACK'.
CALL FUNCTION FM_NAME
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = OP_OPTION
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = OUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
* DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = JOB_OUTPUT
* JOB_OUTPUT_OPTIONS =
TABLES
I_VBRP = I_VBRP.
PERFORM pdf.
**.
*&---------------------------------------------------------------------*
*& Form pdf
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM pdf .
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_BIN_FILESIZE
* BIN_FILE =
TABLES
OTF = JOB_OUTPUT-OTFDATA
LINES = I_PDF
.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = V_BIN_FILESIZE
FILENAME = 'C:\Documents and Settings\vijaykumar\Desktop\VI.pdf'
FILETYPE = 'BIN'
TABLES
DATA_TAB = I_PDF.
ENDFORM. " pdf
*& Report ZSF_PDF_DRIV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSF_PDF_DRIV.
TYPES: BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MEINS TYPE VBRP-MEINS,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP.
DATA : I_VBRP TYPE TABLE OF VBRP,
WA_VBRP TYPE VBRP.
DATA : FM_NAME TYPE RS38L_FNAM.
DATA : OUT_OPTIONS TYPE SSFCOMPOP."SSFCRESOP.
DATA : OP_OPTION TYPE SSFCTRLOP,
JOB_OUTPUT TYPE SSFCRESCL,
V_BIN_FILESIZE TYPE I.
TYPES : BEGIN OF TY_URL,
NAME(80),
URL TYPE STRING,
END OF TY_URL.
DATA : IT_URL TYPE TABLE OF TY_URL,
WA_URL TYPE TY_URL.
DATA :I_PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
SELECT VBELN POSNR MEINS NETWR FROM VBRP INTO CORRESPONDING FIELDS OF
TABLE I_VBRP UP TO 10 ROWS.
OP_OPTION-GETOTF = 'X'. " for pdf data
OP_OPTION-NO_DIALOG = 'X'. " no print priview
OUT_OPTIONS-TDCOPIES = '3'.
***FOR NO OF COPIES
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSF_PDF'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
.
WA_URL-NAME = 'mail'.
WA_URL-URL = 'https://www.google.co.in/'.
APPEND WA_URL TO IT_URL.
CALL FUNCTION 'HR_RCF_SF_URL_REFRESH_GT'
.
CALL FUNCTION 'HR_RCF_SF_URL_PREPARE_CALLBACK'
TABLES
PT_URL = IT_URL.
OUT_OPTIONS-URLCALL = 'HR_RCF_SF_URL_CALLBACK'.
CALL FUNCTION FM_NAME
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = OP_OPTION
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = OUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
* DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = JOB_OUTPUT
* JOB_OUTPUT_OPTIONS =
TABLES
I_VBRP = I_VBRP.
PERFORM pdf.
**.
*&---------------------------------------------------------------------*
*& Form pdf
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM pdf .
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_BIN_FILESIZE
* BIN_FILE =
TABLES
OTF = JOB_OUTPUT-OTFDATA
LINES = I_PDF
.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = V_BIN_FILESIZE
FILENAME = 'C:\Documents and Settings\vijaykumar\Desktop\VI.pdf'
FILETYPE = 'BIN'
TABLES
DATA_TAB = I_PDF.
ENDFORM. " pdf
No comments:
Post a Comment