SPAN { font-family: "Courier New"; font-size: 10pt; color: rgba(0, 0, 0, 1); background: rgba(255, 255, 255, 1) }
.L0S31 { font-style: italic; color: rgba(128, 128, 128, 1) }
.L0S32 { color: rgba(51, 153, 255, 1) }
.L0S52 { color: rgba(0, 0, 255, 1) }
.L0S55 { color: rgba(128, 0, 128, 1) }
.L0S70 { color: rgba(128, 128, 128, 1) }
核心几个功能
*& Form PDF_PRINT
*&---------------------------------------------------------------------*
*通过地址获取文件流
*----------------------------------------------------------------------*
FORM FRM_GET_CONTENT USING URL TYPE STRING
CHANGING CONTENT TYPE XSTRING.
DATA : HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT.
CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
EXPORTING
URL = URL
IMPORTING
CLIENT = HTTP_CLIENT
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
HTTP_CLIENT->SEND( ).
HTTP_CLIENT->RECEIVE( ).
"CONTENT = HTTP_CLIENT->RESPONSE->TO_XSTRING( ).
CONTENT = HTTP_CLIENT->RESPONSE->GET_DATA( ).
HTTP_CLIENT->CLOSE( ).
ENDIF.
ENDFORM.
SPAN { font-family: "Courier New"; font-size: 10pt; color: rgba(0, 0, 0, 1); background: rgba(255, 255, 255, 1) }
.L0S31 { font-style: italic; color: rgba(128, 128, 128, 1) }
.L0S32 { color: rgba(51, 153, 255, 1) }
.L0S33 { color: rgba(77, 166, 25, 1) }
.L0S52 { color: rgba(0, 0, 255, 1) }
.L0S55 { color: rgba(128, 0, 128, 1) }
.L0S70 { color: rgba(128, 128, 128, 1) }
*&---------------------------------------------------------------------*
*& Form PDF_PRINT
*&---------------------------------------------------------------------*
* 打印PDF
*----------------------------------------------------------------------*
FORM pdf_print USING p_xstring TYPE xstring.
DATA: l_rqdestl TYPE rspolname,
l_rqdest TYPE rspopname.
DATA: l_spoolid TYPE rspoid,
l_msg TYPE string.
DATA: ls_outpars TYPE sfpoutpar.
DATA: size TYPE i.
DATA: total_size TYPE i.
DATA: spoolid TYPE rspoid.
DATA: copies TYPE rspocopies.
DATA: lifetime.
CALL FUNCTION 'FPCOMP_SHOW_DIALOG'
CHANGING
ie_outpar = ls_outpars
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 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.
LEAVE PROGRAM.
ENDIF.
size = xstrlen( p_xstring ).
ADD size TO total_size.
copies = ls_outpars-copies.
lifetime = ls_outpars-lifetime.
CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
EXPORTING
dest = ls_outpars-dest
pages = 0
pdf_data = p_xstring
name = ls_outpars-dataset
suffix1 = ls_outpars-suffix1
suffix2 = ls_outpars-suffix2
copies = copies
* PRIO = ps_op-
immediate_print = ls_outpars-reqimm
auto_delete = ls_outpars-reqdel
titleline = ls_outpars-covtitle
receiver = ls_outpars-receiver
division = ls_outpars-division
authority = ls_outpars-authority
lifetime = lifetime
* "printer = l_rqdestl
* dest = 'PDF3'
* "pages = 1
* pdf_data = p_xstring
* immediate_print = 'X' "如需立即打印,设置为X
* auto_delete = 'X'
IMPORTING
spoolid = l_spoolid
EXCEPTIONS
OTHERS = 1.
ENDFORM. " PDF_PRINT
手机扫一扫
移动阅读更方便
你可能感兴趣的文章