How can I find the link between a Sales Order and the Spool Requests it produces?
Requirement: The user want to batch output the sales orders when the output type is such as "ZTYP" and download them to PDF files respectively.
At present, I create the spool id first using :
ls_nast-mandt = sy-mandt.
ls_nast-kappl = lc_kappl. "Application
ls_nast-objky = ls_print-vbeln.
ls_nast-kschl = p_kschl. "Message type ls_
nast-spras = sy-langu.
ls_nast-parnr = ls_print-kunnr. "Partner
ls_nast-parvw = lc_parvw. "Partner Role
ls_nast-nacha = '1'. "Transm. Medium
ls_nast-vsztp = lc_4. "Date/Time
ls_nast-manue = lc_x.
ls_nast-ldest = lc_locg. "Logical destination
ls_nast-dimme = lc_x. "Print immed.
ls_nast-anzal = 1. "Number of messages
ls_nast-tdarmod = 3. "Print and archive delivery
append ls_nast TO li_nast.
call function 'RV_MESSAGES_INSERT'
tables
tab_xnast = li_nast[].
call function 'RV_MESSAGES_UPDATE'
exporting
msg_no_update_task = lc_x
msg_objky = ls_nast-objky.
call function 'RV_MESSAGES_REFRESH'.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = lc_x.
But, after execution, the nast-cmfpnr (number) has no value.
And then use NAST~CMFPNR to fetch spool id from table CMFP.
Just use tables NAST and CMFP and link CMFP~NR = NAST~CMFPNR. Filter Nast Selection as much as possible and CMFP with APLID ARBGB MSGTY and MSGNR.
Because the nast-cmfpnr (number) has no value.Then I can not select the spool id from CMFP.
I wonder why the nast-cmfpnr has no value? How should i do?
Thank you for your kindly help.