04-10-2013 10:41 AM
Hello people,
I created smartform and report which calls it. When I am calling this form from report, there is a window with parameters: number of copies, printer,... and two buttons - print preview and print.
How I could detect in report which is calling this form, that there is print preview or print action? When using output using NACE, there is a form ENTRY using us_screen (xscreen). This is not accessible when calling form directly from report (without NACE).
Could you, please, give me some advice how to recognize print preview or print action in this case? I went through a lot of forums and didn't get any answer.
Thank you a lot.
David
04-10-2013 5:25 PM
Hi David,
If I understand your question you have a print program calling a smartform, and as the print program does not provide any spool info the form issues the print parameters pop-up. In this pop-up the user can choose to either print or print preview and when the control returns to the print program you want to know which of these options they chose?
The smartform has a export parameter JOB_OUTPUT_OPTIONS and the first field in this structure is TDPREVIEW. This is X if the user chose Print preview and blank if the chose print. (It's also blank if they choose cancel, but you can tell this as all other fields in this structure are blank).
regards,
Nick
04-10-2013 11:30 AM
Hello,
There is a parameters OUTPUT_OPTIONS of type SSFCOMPOP. Where you can pass the details of the print parameters.
For prinnting:
Constant: c_set type c value 'X",
c_print TYPE tddevice VALUE 'PRINTER',
Data:
p_screen(1) TYPE c, " Output on printer or screen
g_screen = us_screen.
PERFORM processing USING p_screen
CHANGING returncode.
Form Processing.
IF p_screen IS INITIAL.
w_compop-tdnoprev = c_set.
w_compop-tdnoprint = space.
w_compop-tdnewid = c_set.
w_ctrlop-getotf = space.
w_ctrlop-device = c_print.
Else.
For Preview
w_compop-tdnoprev = space.
w_compop-tdnoprint = c_set.
w_compop-tdnewid = c_set.
w_ctrlop-getotf = space.
w_ctrlop-no_dialog = space.
w_ctrlop-device = c_print.
Endif.
Endform.
Thanks,
Abhijit
04-10-2013 5:06 PM
04-11-2013 8:20 AM
Thank you for your answer, but it didn't helped me :-/. I am not going to disable pop-up for printing window, because I don't want to create something instead of this.
BR,
David
04-11-2013 9:37 AM
Hello,
I am not sure if I understand your code correctly.
At first, I thing that g_screen will not be used and not filled, because "US_SCREEN" is not used (calling form directly, not using NACE).
Where exactly is p_screen filled? Because according to the code it seems that there no filling of this parameter.
BR,
David
04-10-2013 5:25 PM
Hi David,
If I understand your question you have a print program calling a smartform, and as the print program does not provide any spool info the form issues the print parameters pop-up. In this pop-up the user can choose to either print or print preview and when the control returns to the print program you want to know which of these options they chose?
The smartform has a export parameter JOB_OUTPUT_OPTIONS and the first field in this structure is TDPREVIEW. This is X if the user chose Print preview and blank if the chose print. (It's also blank if they choose cancel, but you can tell this as all other fields in this structure are blank).
regards,
Nick
04-11-2013 8:39 AM
Hi Nick,
this field "TDPREVIEW" is filled using XSCREEN (US_SCREEN) when using finding of message through NACE. So in my case, it is empty.
I try to describe what I am doing:
Just after calling smartform from report I stop at breakpoint at FM for smartform:
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
user_settings = ' '
is_label = gs_label
.......
Right now are there in control_parameters and output_options values I added manually before. TDPREVIEW is not filled automatically and I am not modifing it.
Then I run this FM and pop-up windows with printing parameters appears, I can modify it according to the need. Then there are two buttons - printpreview and print. If I press printpreview, smartforms is displayed in printpreview. Then I go back (green arrow) to the report and check the structures "control_parameters" and "output_options" again. TDPREVIEW is not filled.
And this is my problem. I am not able to catch it. I am able to manually change it before running FM, but this is not what I need.
I don't want to deny this pop-up, because in this case it is necessary in selection screen to prepare all necessary fields instead of it. I only want to recognize whether I am printing or previewing.
Thank you and BR,
David
04-11-2013 8:48 AM
04-11-2013 8:57 AM
Hi David,
Understood, you are not trying to influence the pop-up from the print program, only to capture the choice made by the user once control returns to the print program.
To this end you need to map the smartform parameter JOB_OUTPUT_OPTIONS when you call the form FM, and it is this structure where the field TDPREVIEW is filled based on the user action.
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
user_settings = ' '
is_label = gs_label
IMPORTING
job_output_options = ls_output_options
This is the parameter I mention in my orginal reply.
Regards,
Nick
04-11-2013 9:49 AM
Hi Nick,
you saved me. It's working. And you are right, it was in last answer from you - I just missed the "IMPORTING" part :-/.
Thank you.
David