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: 

Regarding disabling print button

former_member242166
Participant
0 Kudos

Hi experts,

I have one report program, it calls one smartforms. Actually i want disable the print button on menu, i am calling the smartforms using SSF_FUNCTION_MODULE_NAME.

It may be basic question but now only i am facing this problem, please help me . i also attached screen shot for where i can diable that button.

Is there any coding needed in se38?  or anyother have to do?

Regards,

Linganathan.K

14 REPLIES 14

Former Member

Make OUPUT_OPTIONS-TDNOPRINT = 'X' in the FM which calls the smartform.

0 Kudos

Dear shambu,

Where i have to insert this line,  In exporting or importing?

Can you please send the sample code?

Regards,

Linganathan.K

0 Kudos

Hiii,

         See below code for disabling Print Button ..... all required changes in bold ....

here i put my example  do same changes in your program .

         DATA : LS_COMPOSER_PARAM TYPE  SSFCOMPOP.
         LS_COMPOSER_PARAM-TDNOPRINT = 'X'.


CALL FUNCTION fm_name  " This contain your FM name for your smartform
EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
*     CONTROL_PARAMETERS         =
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
      OUTPUT_OPTIONS             = LS_COMPOSER_PARAM

*     USER_SETTINGS              = 'X'
   lines                      = w_line
*   IMPORTING
*     DOCUMENT_OUTPUT_INFO       =
*     JOB_OUTPUT_INFO            =
*     JOB_OUTPUT_OPTIONS         =
TABLES
   it_ekko          = it_ekko
   it_ekpo          = it_ekpo
   int_komv         = int_komv
EXCEPTIONS
   formatting_error = 1
   internal_error   = 2
   send_error       = 3
   user_canceled    = 4
   OTHERS           = 5.

   IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.

0 Kudos

Dear Ashish,

Thanks for your response. I tried your code but it disables both print button. I mean when we select printer , in that place i want that print button. Screen shot attached for your reference.

Thanks and regards,

Linganathan.k

0 Kudos

Hiii,

       What exactly you want ??? As per my earlier code : Below output will come

Now If you want to show print button and disable print preview than you have to set


*  LS_COMPOSER_PARAM-TDNOPRINT = 'X'. "
For disabling print button
  LS_COMPOSER_PARAM-TDNOPREV = 'X'. " For disabling print preview button

Do changes as per your requirement

0 Kudos

Dear Ashish,

I am not talking about print preview. I am asking for print Button only. that is i want the print button (located nearby print preview) but i dont want the print button (which is located in menu bar) . I have attached two screen shots from this screen shots you can understand which one i need and which one i do not need. Please try to solve my problem .. hope u can help me.

Thanks and Regards,

Linganathan.k

0 Kudos

Hiii Linganathan ,

                           i was busy in my work ..... So for your requirement their is only possibility is implicit enhancement in standard program  SAPLSTXBW just check below code and do in your system definitely gui status print button will be disable when you see your print preview  

include - LSTXBWFCC

line no -109  perform exclude using: 'Z+', 'Z-'. else part

just apply below code


form exclude using fcode like sy-ucomm.
   data exists type boolean.
   loop at excludes where ucomm = fcode.
     exists = c_true.
     exit. "already in the table
   endloop.
   if exists = c_false.
     excludes = fcode. append excludes.
   endif.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form EXCLUDE, End                                                                                                                                 A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT ZHIDE_PRINT.    "active version
IF sy-cprog = 'ZMYPROG'.              " here you specify your tcode or program name
  * BREAK-POINT.
excludes = 'SPRI'. append excludes.
ENDIF.

ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
endform.                   " EXCLUDE

former_member242166
Participant
0 Kudos

Please Can anyone Help me for my query. I will be grateful to u people.

Thanks and Regards,

Linganathan.K

0 Kudos

Hi,

I think you need to change the pf-status of standard program SAPLSTXBW.

According to my knowledge u can't do that.

Regards

Vamshi

0 Kudos

Then there is no solutions for my problem ah?  Is there any other way? Please help me.

Thanks and Regards,

Linganathan.k

0 Kudos

Just a suggestion.

Why don't you create two radio buttons in your initial screen. Giving the users the option to select whether they want to PRINT or PREVIEW a certain form.

i.e.

After which, add to this to your code.

  IF rb_print EQ 'X'. " PRINT
     ls_composer_param-tdnoprev = 'X'.
   ELSEIF rb_pview EQ 'X'. " PREVIEW
     ls_composer_param-tdnoprint = 'X'.
   ENDIF.

I'll repeat, it's just a suggestion.

Regards,

-Jake

0 Kudos

Dear Jasonb Dacquel,

Thanks for your reply. My target is disable the print button (standard print button located in top). Please help me for the same. Refer my screen shot which i have attached earlier.

Thanks and Regards,

Linganathan.K

0 Kudos

Have you tried my suggestion?

AFAIK by selecting PREVIEW radiobutton will also disable that print button located in tool bar.

My suggestion is just ONE of the other way you're requesting.

-Jake

Private_Member_7726
Active Contributor
0 Kudos

Hi,

The only reasonable way I can think of boils down to following:

1) calling the print options dialog (using FM SSFCOMP_SHOW_DIALOG) in application rather than letting Smartform Composer handle it internally;

2) after options dialog setting CONTROL_PARAMETERS-NO_DIALOG = 'X' and, if the user has choosen preview, OUTPUT_OPTIONS-TDNOPRINT = 'X'


I have thrown together quick example based on SF_EXAMPLE_01 (do use SAPBC_DATA_GENERATOR to generate the test data or logic will not work!!!):


REPORT SF_EXAMPLE_01.


DATA: GS_SSFCOMPIN TYPE SSFCOMPIN .

DATA: GS_OUTPUT_OPTIONS TYPE SSFCOMPOP.

DATA: GS_CONTROL_PARAMETERS TYPE SSFCTRLOP .


DATA: CARR_ID TYPE SBOOK-CARRID,

      FM_NAME TYPE RS38L_FNAM.

PARAMETER:      P_CUSTID TYPE SCUSTOM-ID DEFAULT 1.

SELECT-OPTIONS: S_CARRID FOR CARR_ID     DEFAULT 'LH' TO 'LH'.

PARAMETER:      P_FORM   TYPE TDSFNAME   DEFAULT 'SF_EXAMPLE_01'.

DATA: CUSTOMER    TYPE SCUSTOM,

      BOOKINGS    TYPE TY_BOOKINGS,

      CONNECTIONS TYPE TY_CONNECTIONS.


START-OF-SELECTION .


  CALL FUNCTION 'SSFCOMP_SHOW_DIALOG'

    EXPORTING

      INPUT             = GS_SSFCOMPIN

      OK_BUTTON         = SPACE

    IMPORTING

*     ARCHIVE_PARAMETERS =

      OUTPUT_OPTIONS    = GS_OUTPUT_OPTIONS

      CONTROL_PARAMETERS = GS_CONTROL_PARAMETERS

    EXCEPTIONS

      ERROR             = 1

      OTHERS            = 2.

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ELSE .

    GS_CONTROL_PARAMETERS-NO_DIALOG = 'X' .

    IF GS_CONTROL_PARAMETERS-PREVIEW = 'X' .

      GS_OUTPUT_OPTIONS-TDNOPRINT = 'X' .

    ENDIF .

  ENDIF.

* get data

  SELECT SINGLE * FROM SCUSTOM INTO CUSTOMER WHERE ID = P_CUSTID.

  CHECK SY-SUBRC = 0.

  SELECT * FROM SBOOK INTO TABLE BOOKINGS

           WHERE CUSTOMID = P_CUSTID

           AND   CARRID   IN S_CARRID

           ORDER BY PRIMARY KEY.

  SELECT * FROM SPFLI INTO TABLE CONNECTIONS

           FOR ALL ENTRIES IN BOOKINGS

           WHERE CARRID = BOOKINGS-CARRID

           AND   CONNID = BOOKINGS-CONNID

           ORDER BY PRIMARY KEY.


* print data

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

      FORMNAME          = P_FORM

    IMPORTING

      FM_NAME           = FM_NAME

    EXCEPTIONS

      NO_FORM           = 1

      NO_FUNCTION_MODULE = 2

      OTHERS            = 3.


  IF SY-SUBRC <> 0.

*   error handling

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.


* now call the generated function module

  CALL FUNCTION FM_NAME

    EXPORTING

      CONTROL_PARAMETERS = GS_CONTROL_PARAMETERS

      OUTPUT_OPTIONS    = GS_OUTPUT_OPTIONS

      USER_SETTINGS     = SPACE

      CUSTOMER          = CUSTOMER

      BOOKINGS          = BOOKINGS

      CONNECTIONS       = CONNECTIONS

    EXCEPTIONS

      FORMATTING_ERROR  = 1

      INTERNAL_ERROR    = 2

      SEND_ERROR        = 3

      USER_CANCELED     = 4

      OTHERS            = 5.


  IF SY-SUBRC <> 0.

*   error handling

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

Do not forget to take ARCHIVE_PARAMETERS along; I have left it out because it's quick example for print button

cheers

Janis