cancel
Showing results for 
Search instead for 
Did you mean: 

Printing Purchase Order from ME9F using custom program and smartform

Former Member
0 Kudos

I was able to use my custom program which calls a smartform to print purchase orders from transaction ME9F. I did this using transaction NACE.

However, when I call "Output Message" from ME9F, the output always fails (shown by an 'X' icon after the checkbox). When I try to put back the standard program in NACE, it does not show an 'X' but a check which indicates that the printing was successful.

Do you know why this happens? What did I miss?

Here's my call to my smartform from my custom driver program:



    " Change Smartform ZP_MMSF_P01_PURCHASE_ORDER
    " to internal Function module name
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
            FORMNAME   = 'ZP_MMSF_P01_PURCHASE_ORDER'
        IMPORTING
            FM_NAME    = fmname
    .

    wa_cparam-no_dialog = 'X'.
    wa_output-tddest = 'LOCL'. "or 'LP01'.  "Spool: Output device

    CALL FUNCTION fmname
        EXPORTING
            control_parameters         = wa_cparam
            output_options             = wa_output
            i_data                     = i_data
            wa_lookup                  = wa_data_lookup
            goods_amt                  = goods_amt
            discount_amt               = discount_amt
            vat                        = vat
            total_amt                  = total_amt
            total_amt_inwords          = total_amt_inwords
    .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Go Through the below link it would help u out.

[http://vjkvijaya.blogspot.com/2009/03/puchace-order-smartform-driver-program.html]

Regards,

Vijaya Lakshmi.T

Former Member
0 Kudos

Thanks Vijaya,

That somewhat solved my problem! 10 points!

--

Kyle

Former Member
0 Kudos

Vijaya,

I have this problem though,

Whenever I try to provide values for CONTROL_PARAMETERS and OUTPUT_OPTIONS to the sapscript call in your code, the PO printing (even the preview) does not proceed. I do this because I wanted to suppress the printer dialog.

here is a fragment of the code:


.....
" code I added
" ---------------------------------------------------------------
LS_COMPOSER_PARAM-tddest = 'LOCL'. "or 'LP01'.  "Spool: Output device
LS_COMPOSER_PARAM-bcs_langu = sy-langu.

LS_CONTROL_PARAM-preview = 'X'.
LS_CONTROL_PARAM-no_open = 'X'.
LS_CONTROL_PARAM-no_close = 'X'.
LS_CONTROL_PARAM-device = 'PRINTER'.
LS_CONTROL_PARAM-no_dialog = 'X'.
" ---------------------------------------------------------------
DO NAST_ANZAL TIMES.
*--In case of repetition only one time archiving
* if sy-index > 1 and nast-tdarmod = 3.
* nast_tdarmod = nast-tdarmod.
* nast-tdarmod = 1.
* ls_composer_param-tdarmod = 1.
* endif.
IF SY-INDEX NE 1 AND REPEAT IS INITIAL.
REPEAT = 'X'.
ENDIF.
CALL FUNCTION LF_FM_NAME
EXPORTING

ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMETERS = ARC_PARAMS
CONTROL_PARAMETERS = LS_CONTROL_PARAM
MAIL_RECIPIENT = LS_RECIPIENT
MAIL_SENDER = LS_SENDER
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = SPACE
IS_NAST = NAST
IS_REPEAT = REPEAT
.....

I tried to trace it to the function module generated by smartform. The error propagates this way: From the function module, there is a call to function SSFCOMP_PROCESS_DOCUMENT. Then inside that function, there is a perform operation to tr_ssfcomp_process_doc


perform tr_ssfcomp_process_doc using startpage docstruc
                                       header.

Inside that form, it calls the macro tr_active which checks the value of ssfcstat-trlevel (tracelevel) against c_trlevel_document. In the macro, if ssfcstat-trlevel is less than c_trlevel_document, the smartform will fail. c_trlevel_document is 15 and ssfcstat-trlevel is 0, and so the smartform fails.

(you can see the macro tr_active in include LSTXBCMAC and the form tr_ssfcomp_process_doc is in the include LSTXBCFTR)

When I do not put values in CONTROL_PARAMETERS and OUTPUT_OPTIONS, everything is ok.

Do you know why this happens?

Thanks in advance!

Edit: I have found out about transaction SFTRACE, but this is disabled.

--

Kyle

Answers (0)