本文主要是介绍abap smartforms 转换成pdf xtring,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近客户有一个需求是需要讲发票的smartform 发送到第三方系统。
原先的做法是,SAP只是发送发票数据过去,由第三方系统去自己创建PDF打印。
那么就遇到了一个问题,SAP中的发票打印产生修改的时候。第三方系统也要同步修改,
涉及到数据发送不完全的,还需要修改发送数据的接口。
这样每次的变更,对各系统来说就比较麻烦且工作量大,效率也不高。
后来研究了下,发现可以将smartform转换成PDF,再转成xstring去发送,
对方收到之后,再转回PDF。
DATA: lv_func_name TYPE rs38l_fnam. "数据元素DATA: lw_output_options TYPE ssfcompop .DATA: ls_document_output TYPE ssfcrespd,ls_job_output TYPE ssfcrescl,ls_job_options TYPE ssfcresop,ls_control_parameters TYPE ssfctrlop. "Smart Forms: 控制结构.DATA: lv_message TYPE string.DATA: lv_bin_size TYPE i,lv_pdf_xstring TYPE xstring.DATA: lt_tline TYPE STANDARD TABLE OF tline.CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'EXPORTINGformname = 'ZSD_SF_INVOICE_NEW'IMPORTINGfm_name = lv_func_nameEXCEPTIONSno_form = 1no_function_module = 2OTHERS = 3.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.
*设置不打开对话框,ls_control_parameters-no_dialog = 'X'.ls_control_parameters-langu = sy-langu.ls_control_parameters-getotf = 'X'.lw_output_options-tdnoprev = 'X'.CALL FUNCTION lv_func_nameEXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =control_parameters = ls_control_parameters
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =output_options = lw_output_options
* USER_SETTINGS = 'X'ls_head = ls_headIMPORTINGdocument_output_info = ls_document_outputjob_output_info = ls_job_outputjob_output_options = ls_job_optionsTABLESit_items = lt_itemEXCEPTIONSformatting_error = 1internal_error = 2send_error = 3user_canceled = 4OTHERS = 5.IF sy-subrc <> 0.CALL FUNCTION 'MESSAGE_TEXT_BUILD'EXPORTINGmsgid = sy-msgidmsgnr = sy-msgnomsgv1 = sy-msgv1msgv2 = sy-msgv2msgv3 = sy-msgv3msgv4 = sy-msgv4IMPORTINGmessage_text_output = lv_message.ENDIF.
*CALL FUNCTION 'CONVERT_OTF'EXPORTINGformat = 'PDF'IMPORTINGbin_filesize = lv_bin_sizebin_file = lv_pdf_xstringTABLESotf = ls_job_output-otfdatalines = lt_tlineEXCEPTIONSerr_max_linewidth = 1err_format = 2err_conv_not_possible = 3err_bad_otf = 4OTHERS = 5.IF sy-subrc <> 0.CALL FUNCTION 'MESSAGE_TEXT_BUILD'EXPORTINGmsgid = sy-msgidmsgnr = sy-msgnomsgv1 = sy-msgv1msgv2 = sy-msgv2msgv3 = sy-msgv3msgv4 = sy-msgv4IMPORTINGmessage_text_output = lv_message.RETURN.ENDIF.*lv_pdf_xstring 就是我们需要的smartform xtring
*可以放到下面这个结构中
TYPES:BEGIN OF ty_invoice,vbeln TYPE vbeln_vf,xstring TYPE xstring,END OF ty_invoice.
DATA: gs_invoice TYPE ty_invoice.
这篇关于abap smartforms 转换成pdf xtring的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!