on 08-11-2010 9:05 AM
I developed a custom SmartForm for VA02 and have suppressed the print dialog with this
wa_cparam-preview = 'X'.
wa_cparam-no_dialog = 'X'.
wa_cparam-device = 'PRINTER'.
* wa_output-tdnoprint = 'X'. "no printing from print preview
* wa_output-tddest = 'loca'. "or 'lp01'. "spool: output device
notice the hardcoded preview = 'X'
The problem with this is that the print preview is shown whichever I press, Print or Print Preview. If I remove it, the form will not display at all, even in Print Preview.
I think their function codes are PRNT and VIEW, respectively. I checked structures TNAPR and NAST but haven't found a clue. I checked google but couldn't find anything.
Again, how do you determine if "PRINT" or "PRINT PREVIEW" is pressed?
--
Kyle
I. feel. so. stupid.
My first question is answered. PRNT or VIEW is stored in sy-ucomm. How could I forget?...
For my second question (not printing when I want it to print. printing automatically when I don't want it to print), think I should create a separate/new thread? Or let's just discuss it here?
--
Kyle
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anyway, another problem I was having is that it does not print automatically even when "Print Immediately" is checked in the output type. And my user defaults have "Output Immediately" also checked.
I tried setting output_options-tdimmed to 'X', but now, everytime I create a new output in VA02 (Extras > Output > Header > Edit) and save the document, SAPLPD automatically popups and automatically prints the document!
How can I stop this from happening? I want to print the document only when I select the PRINT button, not when I save an output...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kyle,
Purpose of the parameter wa_cparam-preview - This field determines whether a print preview is displayed on the screen for a selected printer or whether a document is printed directly.
Purpose of the parameter wa_cparam-no_dialog - whether the pop-up (which will ask for the printer parameters such as Printer name, print immediately,...) needs to be displayed.
Also for you qn - Again, how do you determine if "PRINT" or "PRINT PREVIEW" is pressed?
Answer is, just check with the export parameter (import parameter in your function module) - JOB_OUTPUT_OPTIONS-TDPREVIEW & JOB_OUTPUT_OPTIONS-TDIMMED.
Just for your information, it is possible to print & at the same time preview the layout.
In brief, if you want to print and preview, then set the control_parameters in your import parameters (export parameter in your function module) (control_parameters-tdpreview & tdimmed).
Hope, I answered for your qn.
Regards,
Selva K.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Selva,
Thanks for the input.
Here's what I wanted to do. If the user presses, PRINT, no preview will be shown. If he chooses Print Preview, a preview will be displayed.
So roughly, it would be something like
IF ??? = "PRNT"
wa_cparam-preview = ''.
ELSE
wa_cparam-preview = 'X'.
ENDIF.
But I do not know what variable to check
--
Kyle
Hi Selva,
Thanks for guiding me on this.
Here's my actual code for the subroutine:
FORM display_form.
TABLES:
tnapr
.
DATA:
fm_name TYPE rs38l_fnam,
wa_cparam TYPE ssfctrlop,
wa_output TYPE ssfcompop
.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = tnapr-sform
IMPORTING
FM_NAME = fm_name
.
CHECK fm_name IS NOT INITIAL.
* wa_cparam-preview = 'X'.
wa_cparam-no_dialog = 'X'.
wa_cparam-device = 'PRINTER'.
* wa_output-tdnoprint = 'X'. "no printing from print preview
* wa_output-tddest = 'loca'. "or 'lp01'. "spool: output device
* wa_output-tdimmed = 'X'.
* wa_output-tddelete = 'X'.
CALL FUNCTION fm_name
EXPORTING
control_parameters = wa_cparam
* output_options = wa_output
user_settings = SPACE
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
.
ENDFORM.
to be continued below to keep formatting...
Like you said, I did not set anything in control_parameters-preview but since the importing parameter control_parameters is used, it's like saying
control_parameters-preview = ''.
and this keeps the preview from showing at all (no print preview whatsoever).
Also, using this present code, where output_options is not being used, whenever I create an output and save the document, a spool is automatically queued in SP01 with status . When I press print from VA02, nothing happens. The document only prints if I press print from SP01.
If I set and enable output_options-tdimmed to 'X', it behaves as described in my previous post (prints automatically).
Hi Kyle,
Sorry, Little confused :-(.
You set the variable wa_cparam-no_dialog = 'X'. So no dialog box will be displayed toa sk your option while running. So you should mention in the program as per your req as below:
Option 1. Only preview is required, then set wa_output-tdimmed = ' '. & wa_cparam-preview = 'X'.
Option 2. Only print is required, then set wa_output-tdimmed = 'X '. & wa_cparam-preview = ' '.
Option 3. Both print & preview is required, then set wa_output-tdimmed = 'X '. & wa_cparam-preview = 'X'.
Regards,
Selva K.
Hi Selva,
Yes I set wa_cparam-no_dialog to 'X' so no dialog box will appear. However, if wa_cparam is used, its other fields are used as well (in this problematic scenario, wa_cparam-preview).
I used sy-ucomm for the logic and it's almost nearing success.
CASE sy-ucomm.
" Print Preview
WHEN 'VIEW'.
wa_cparam-preview = 'X'.
" Print
WHEN 'PRNT'.
wa_output-tdimmed = 'X'.
wa_output-tddelete = 'X'.
ENDCASE.
This has resulted to the following behaviour:
1) Preview shows when user presses "Print Preview", no preview when user presses "Print" /OK/
2) No automatic printing when output is saved /almost OK (see below)/
3) Not printing when user chooses Issue Output To > Print /not OK/
For some reason, the print program is being called by VA02 whenever I create an output because it still automatically queues in SP01 with status (--). This still does not change when the document is printed via Issue Output To.
Very helpful insights, by the way. Awarded points.
--
Kyle
It's ok now. I forgot to uncomment the exporting parameter output_options. VA02 still calls this print program when creating output and in turn queues an entry in SP01. When printing, there are 2 entries in SP01.
I added a little check so that only buttons Print and Print Preview will make an output.
Posting my code in the next post for others who have the same problem. Code formatting is not ok for very long post
--
Kyle
The code is not showing correctly even if Preview is OK. Just use VIEW SOURCE from your browser to see it in a readable form
-
FORM display_form.
TABLES:
tnapr
.
DATA:
fm_name TYPE rs38l_fnam,
wa_cparam TYPE ssfctrlop,
wa_output TYPE ssfcompop
.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = tnapr-sform
IMPORTING
FM_NAME = fm_name
.
CHECK fm_name IS NOT INITIAL.
wa_cparam-no_dialog = 'X'.
wa_cparam-device = 'PRINTER'.
* wa_output-tdnoprint = 'X'. "no printing from print preview
* wa_output-tddest = 'loca'. "or 'lp01'. "spool: output device
CASE sy-ucomm.
" Print Preview
WHEN 'VIEW'.
wa_cparam-preview = 'X'.
" Print
WHEN 'PRNT'.
wa_output-tdimmed = 'X'.
wa_output-tddelete = 'X'.
WHEN OTHERS.
EXIT.
ENDCASE.
CALL FUNCTION fm_name
EXPORTING
control_parameters = wa_cparam
output_options = wa_output
user_settings = SPACE
.
ENDFORM.
--
Kyle
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.