
gs_control_param-getotf = 'X'. "When get OTF is set to "X" then FM will return OTF
CALL FUNCTION gv_fm_name "Name of the FM generated by smartforms
EXPORTING
control_parameters = gs_control_param
mail_recipient = lv_recipient
mail_sender = lv_sender
output_options = gs_composer_param
user_settings = ' '
is_nast = nast
IMPORTING
job_output_info = gs_job_output
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc EQ 0.
DATA:gv_pdf_xstring TYPE xstring,
gt_job_output_info TYPE STANDARD TABLE OF itcoo,
lv_base64str TYPE string.
gt_job_output_info[] = gs_job_output-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_file = gv_pdf_xstring
TABLES
otf = gt_job_output_info
lines = gt_pdf_tab[]
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc EQ 0.
cl_http_utility=>if_http_utility~encode_x_base64( EXPORTING unencoded = gv_pdf_xstring RECEIVING encoded = lv_base64str ).
ELSE.
DATA: ls_output TYPE zws_mt_doc_to_spo_rqst,
ls_input TYPE zws_mt_doc_to_spo_resp.
ls_output-mt_doc_to_spo_rqst-folder_path = 'test/test/'.
ls_output-mt_doc_to_spo_rqst-file_name = 'test.pdf'.
ls_output-mt_doc_to_spo_rqst-file_content_b64str = lv_base64str.
TRY.
DATA(lo_doctospo) = NEW ZWS_CO_SI_DOC_TO_SPO_SYNC( ).
lo_doctospo->si_doc_to_spo_sync_out( EXPORTING output = ls_output IMPORTING input = ls_input ).
CATCH cx_ai_system_fault INTO DATA(lo_exception).
ENDTRY.
- Send PDF as an attachment from ECC along with the payload and then convert attachment into base64 string using UDF in graphical mapping or Java mapping.
- using ABAP program generate PDF and save in Application server(AL11) then with FILE adapter in SAP PO pick the PDF(binary file) and convert PDF into base64 string using JAVA Mapping
- A new window will appear, when we simply click over field we can select dynamic content(whatever is there in JSON schema will appear)
- Whichever site the user has access will appear in the drop-down
- within site select the folder path where we will be dropping our file(we are sending path from SAP so path is being accessed dynamically here)
- enter the file name(we are sending filename from SAP so name is being accessed dynamically here)
- Since we are sending our PDF as base64 string, we will be converting it to binary here by writing expression base64ToBinary(triggerBody()?['FileContentB64Str']) FileContentB64Str has been selected from Dynamic content
- base64ToBinary is present under Conversion functions under expression
When the program is executed proxy program is invoked and data is sent to SAP PO which can be seen in SAP PO message monitor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |