Application Development and Automation 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: 
Read only

disbale print preview in scripts

Former Member
0 Likes
573

I sthere any way to disable print preview for users in script.. such as the button disbaled or not availble???

2)Is there any way to prevent a program from executed in foreground (the execute button should be disabled if that can be done) Can we use s-batch to check in such cases?

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
521

You can disable the execute in foreground this way.



report zrich_0002 .

* Used to limit user commands on selection-screen
include rsdbc1xx.

* Selection Screen
parameters: p_check type c.

* Events
at selection-screen output.

  append 'PRIN' to current_scr-excl.
  append 'ONLI' to current_scr-excl.

Regards,

Rich heilman

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
522

You can disable the execute in foreground this way.



report zrich_0002 .

* Used to limit user commands on selection-screen
include rsdbc1xx.

* Selection Screen
parameters: p_check type c.

* Events
at selection-screen output.

  append 'PRIN' to current_scr-excl.
  append 'ONLI' to current_scr-excl.

Regards,

Rich heilman

Read only

0 Likes
521

Hi rich Can we do any thing in se71 or nace or nact to disable print preview or can we make the script directly to print instead of giving option to preview?

Read only

0 Likes
521

Hi,

if you don't want preview then you need to pass

itcpo-TDNOPREV = 'X'.along with other parameters, and pass this ITCPO structure to open_form.

regards

vijay

Read only

0 Likes
521

REPORT  ZTEST_SCRIPT.
TABLES: ekpo.

DATA: var1 TYPE i VALUE '000145-',
      var2(10) TYPE c VALUE 'venkata',
      var3 TYPE i VALUE '-000135',
      var4(10) TYPE n VALUE '00000001',
      var5(15) TYPE c VALUE 'test',
      var6(13) TYPE p DECIMALS 3 VALUE '1234.54',
      var7(10) TYPE c VALUE 'hello',
      var8 TYPE i VALUE '000000',
      v_matnr TYPE ekpo-matnr,
      v_empty(10) TYPE c VALUE ' '.


SELECT SINGLE * FROM ekpo WHERE
       ebeln = '4500000262'.
IF sy-subrc = 0.
  v_matnr = ekpo-matnr.
ENDIF.
CLEAR ekpo.

SELECT SINGLE * FROM ekpo WHERE
ebeln = '4500000261'.
<b>data: ITCPO type ITCPO.
itcpo-TDNOPREV = 'X'.</b>
CALL FUNCTION 'OPEN_FORM'
 EXPORTING
   FORM                              = 'ZTEST_SCRIPT1'
<b>   OPTIONS                           = itcpo</b>
 EXCEPTIONS
   CANCELED                          = 1
   DEVICE                            = 2
   FORM                              = 3
   OPTIONS                           = 4
   UNCLOSED                          = 5
   MAIL_OPTIONS                      = 6
   ARCHIVE_ERROR                     = 7
   INVALID_FAX_NUMBER                = 8
   MORE_PARAMS_NEEDED_IN_BATCH       = 9
   SPOOL_ERROR                       = 10
   CODEPAGE                          = 11
   OTHERS                            = 12
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'WRITE_FORM'
 EXPORTING
   ELEMENT                        = 'MAIN'
   FUNCTION                       = 'SET'
   TYPE                           = 'BODY'
   WINDOW                         = 'MAIN'
* IMPORTING
*   PENDING_LINES                  =
 EXCEPTIONS
   ELEMENT                        = 1
   FUNCTION                       = 2
   TYPE                           = 3
   UNOPENED                       = 4
   UNSTARTED                      = 5
   WINDOW                         = 6
   BAD_PAGEFORMAT_FOR_PRINT       = 7
   SPOOL_ERROR                    = 8
   CODEPAGE                       = 9
   OTHERS                         = 10
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'CLOSE_FORM'
* IMPORTING
*   RESULT                         =
*   RDI_RESULT                     =
* TABLES
*   OTFDATA                        =
* EXCEPTIONS
*   UNOPENED                       = 1
*   BAD_PAGEFORMAT_FOR_PRINT       = 2
*   SEND_ERROR                     = 3
*   SPOOL_ERROR                    = 4
*   CODEPAGE                       = 5
*   OTHERS                         = 6
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.