Skip to Content
0
Mar 14, 2019 at 02:00 PM

ME9F wont send email for Custom program but will for STD

86 Views Last edit Jul 10, 2019 at 12:53 PM 2 rev

Hi,

My custom program and adobe form works fine in me23n it previews, and also in me9f so all good there. But it wont send as an email in me9f. i switched NACE back to STD which sent the email so it must be some missing logic in my customer driver program.

Given that the program has the correct logic to print, it must be something small im missing for email? and since STD works it means NACE is correctly configured. I added some logic in my code below that when its ZNEU (email) it doesnt do preview. I thought this would fix it but still nothing in SOST. Its also nothing to do with master data as STD sends email for same PO.


Any ideas?

Thanks

Code below (works for print not for email)

__________________

DATA: ls_outputparams TYPE sfpoutputparams,
ls_docparams TYPE sfpdocparams,
lv_form TYPE tdsfname,
lv_fm_name TYPE rs38l_fnam,
ls_pdf_file TYPE fpformoutput,
lv_device TYPE output_device,
lv_failed TYPE boole_d,
lv_anzal TYPE nast-anzal. "Number of outputs (Orig. + Cop.)

ls_outputparams-getpdf = abap_false.
ls_outputparams-nodialog = abap_true.
ls_outputparams-dest = gs_nast-ldest.
ls_outputparams-copies = gs_nast-anzal.
ls_outputparams-dataset = gs_nast-dsnam.
ls_outputparams-suffix1 = gs_nast-dsuf1.
ls_outputparams-suffix2 = gs_nast-dsuf2.
ls_outputparams-cover = gs_nast-tdocover.
ls_outputparams-covtitle = gs_nast-tdcovtitle.
ls_outputparams-authority = gs_nast-tdautority.
ls_outputparams-receiver = gs_nast-tdreceiver.
ls_outputparams-division = gs_nast-tddivision.
ls_outputparams-arcmode = gs_nast-tdarmod.
ls_outputparams-reqimm = gs_nast-dimme.
ls_outputparams-reqdel = gs_nast-delet.
ls_outputparams-schedule = gs_nast-tdschedule.
ls_outputparams-senddate = gs_nast-vsdat.
ls_outputparams-sendtime = gs_nast-vsura.
ls_outputparams-reqfinal = 'X'.

** ls_outputparams-getpdf = 'X'.
* ls_outputparams-nodialog = ''.
** ls_outputparams-langu = 'E'.
IF gs_nast-kschl = 'ZNEU'.
CLEAR: ls_outputparams-preview.
ls_outputparams-nodialog = ''.
ELSE.
ls_outputparams-preview = 'X'.
ls_outputparams-noprint = 'X'.
ENDIF.

*--- Open the spool job
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.

IF sy-subrc <> 0.
* <gv_returncode> = sy-subrc.
* PERFORM protocol_update.
* RETURN.
ENDIF.

*--- Get the name of the generated function module

lv_form = 'ZAF_MM_PURCHORD'.

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lv_form
IMPORTING
e_funcname = lv_fm_name.

CALL FUNCTION lv_fm_name
EXPORTING
/1bcdwb/docparams = ls_docparams
input_data = gs_data
IMPORTING
/1bcdwb/formoutput = ls_pdf_file
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.

*--- Close the spool job
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.

IF sy-subrc <> 0.
* message e000 with <gs_vbdkr>-vbeln
* into gv_dummy.
* perform protocol_update.
RETURN.
ENDIF.

______________________________________