Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Detect print preview in smartform

former_member213871
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

9 REPLIES 9

Abhijit74
Active Contributor
0 Kudos

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

0 Kudos

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

Hello,

Have you checked my solution?

Thanks,

Abhijit

0 Kudos

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

0 Kudos

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