Hi,
I'm calling a Z-Adobe-Form from a Z-program.
Since this Form is an Invoice, I need to be able to know whether the user actually printed the Form or not,
so I can manage the Original/Copy flag.
Searching the issue pointed to the NAST table, but printing my Form creates no entries there.
Also checked the to see if the Spool-ID is returned in the "FP_CLOSE_JOB" but it comes back empty.
The Form is printed from the Print-Preview, since the user want to see first before they print.
This is the main parts of my code:
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM set_printing_parameters
CHANGING es_outputparams TYPE sfpoutputparams. "Print parameters
es_outputparams-preview = 'X'. "Print preview
es_outputparams-dest = 'SPT1'.
es_outputparams-nodialog = ' '. "No daialog
es_outputparams-device = 'PRINTER'. "Output for printer
ENDFORM. " SET_PRINTING_PARAMETERS
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM open_print_job
CHANGING es_outputparams TYPE sfpoutputparams "Parameters to PDF: display,print etc...
ev_error TYPE flag. "Error flag..
DATA: lv_msg TYPE string. "#EC NEEDED
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = es_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i007(zmm_tech) DISPLAY LIKE 'E'.
ev_error = 'X'.
ENDIF.
ENDFORM. " OPEN_FTP_JOB
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM execute_pdf_form
USING iv_fm_name TYPE funcname "Fuction name
CHANGING ev_error TYPE flag. "Error flag.
DATA: ls_docparams TYPE sfpdocparams.
DATA: ls_pdf_out TYPE fpformoutput.
ls_docparams-langu = 'B'.
CALL FUNCTION iv_fm_name "Dynamic name I got from other part of the code
EXPORTING
/1bcdwb/docparams = ls_docparams
iv_bukrs = p_bukrs
iv_belnr = p_belnr
iv_gjahr = p_year
iv_tax_line = p_taxhdr "Write Tax Line in Header
iv_wire_payment = p_paytrn "Bank Transfer Payment
iv_sum_lines = p_line_d "With Lines Datailing
IMPORTING
/1bcdwb/formoutput = ls_pdf_out
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
ev_error = 'X'.
MESSAGE ID sy-msgid TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " EXECUTE_PDF_FORM
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM close_print_job
CHANGING ev_error TYPE flag. "Error flag
DATA: ls_result TYPE sfpjoboutput.
DATA: lv_msg TYPE string. "#EC NEEDED
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
e_result = ls_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e008(zmm_tech) INTO lv_msg. "close spool form to PDF failed
ev_error = 'X'.
ENDIF.
ENDFORM. " CLOSE_FTP_JOB
Any help will be appreciated.
Regards,
Ayal Telem.