2013 Dec 10 3:08 PM
To print by message, I tried to use directly the CALL FUNCTION (WFMC_MESSAGES_SELECT, WFMC_MESSAGES_PROCESS, ...) but it didn't work.
So I'm trying to use the standard program RSNAST0D.
If I call it by SE38, it works fine with my example. If I call by my z-program it doesn't work.
If I stop the program in debug at the first instruction (CALL FUNCTION 'WFMC_MESSAGES_SELECT') in two sessions with both the two cases (called directly by SE38 and called by my z-program) I can see the same parameters values in both sessions.
But only one of them gets the spool.
This is the code of the SUBMIT, but I think it is not important: I'm sure that the parameters values are identical, as it was called directly:
wa_selection-selname = 'S_KAPPL'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = 'V2'.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_NACHA'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = '1'.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_KSCHL'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
IF f_type = 'PKL'.
wa_selection-low = 'ZLD2'.
ELSEIF f_type = 'RIR'.
wa_selection-low = 'ZRIR'.
ELSEIF f_type = 'RID'.
wa_selection-low = 'ZRID'.
ELSEIF f_type = 'DDT'.
wa_selection-low = 'ZLDF'.
ENDIF.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_OBJKY'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = wa_zmspool-vbeln.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_MODE'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = f_vermo.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_DIALOG'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = ' '.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_GRID'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = ' '.
APPEND wa_selection TO it_selection.
SUBMIT RSNAST0D WITH SELECTION-TABLE it_selection AND RETURN.
2013 Dec 11 10:56 PM
In the spool request you should see a field (checkbox?) labeled something like 'Closed, not possible to add to'. If this is not set then the same output for the same printer and same user will continue to be added to an existing open spool request. I've ran into this several times with different output, so usually if I don't see a new spool I just increase the date range in SP01 and usually find an old one.
To print by message, I tried to use directly the CALL FUNCTION (WFMC_MESSAGES_SELECT, WFMC_MESSAGES_PROCESS, ...) but it didn't work.
So I'm trying to use the standard program RSNAST0D.
If I call it by SE38, it works fine with my example. If I call by my z-program it doesn't work.
If I stop the program in debug at the first instruction (CALL FUNCTION 'WFMC_MESSAGES_SELECT') in two sessions with both the two cases (called directly by SE38 and called by my z-program) I can see the same parameters values in both sessions.
But only one of them gets the spool.
This is the code of the SUBMIT, but I think it is not important: I'm sure that the parameters values are identical, as it was called directly:
wa_selection-selname = 'S_KAPPL'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = 'V2'.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_NACHA'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = '1'.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_KSCHL'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
IF f_type = 'PKL'.
wa_selection-low = 'ZLD2'.
ELSEIF f_type = 'RIR'.
wa_selection-low = 'ZRIR'.
ELSEIF f_type = 'RID'.
wa_selection-low = 'ZRID'.
ELSEIF f_type = 'DDT'.
wa_selection-low = 'ZLDF'.
ENDIF.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'S_OBJKY'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'EQ'.
wa_selection-low = wa_zmspool-vbeln.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_MODE'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = f_vermo.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_DIALOG'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = ' '.
APPEND wa_selection TO it_selection.
wa_selection-selname = 'P_GRID'.
wa_selection-kind = 'P'.
wa_selection-option = 'EQ'.
wa_selection-low = ' '.
APPEND wa_selection TO it_selection.
SUBMIT RSNAST0D WITH SELECTION-TABLE it_selection AND RETURN.
2013 Dec 10 3:13 PM
You could have your program schedule it as an immediate background job. That's what we do. Not sure why your method isn't working. I'd expect it to.
Neal
2013 Dec 10 3:22 PM
Thank you for the fast answer.
No. My program doesn't run (and must not run) in background.
Furthermore, my program doesn't get the spool by RSNAST0D, but it get a new correct record in table NAST.
2013 Dec 10 7:48 PM
But what I'm suggesting is that you change your program so that it creates RSNAST0D as a background job. Is there a reason not to do that?
Neal
2013 Dec 11 8:51 AM
My program needs the spool to make the pdf, so it isn't nice to make it waiting for the spool.
Meanwhile i found the real problem (but not the solution): RSNAST0D always get the spool pages, but it add them on a only spool number (3-4 days old).
So I have an old spool with 140 pages, which contains all my tests!
Why did it work so?
2013 Dec 11 2:06 PM
I remember controls somewhere which specify that the report should create a new spool (or not). I'll try to remember where they are. Perhaps in the meantime, someone will name that spot first...
Neal
2013 Dec 11 10:56 PM
In the spool request you should see a field (checkbox?) labeled something like 'Closed, not possible to add to'. If this is not set then the same output for the same printer and same user will continue to be added to an existing open spool request. I've ran into this several times with different output, so usually if I don't see a new spool I just increase the date range in SP01 and usually find an old one.
2013 Dec 12 9:38 AM
I found it.
"OPEN_FORM" is the right point: there si a paremeter "OPTIONS".
The right way is this one:
https://scn.sap.com/thread/1596051
Thanks to all.