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

Print Button Coding

Former Member
0 Likes
2,498

I have to add the print button in application tool bar. When i am click the print button output directly goes to printer. but i have write the code but it is not working.

REPORT ZBOM.

if r_ucomm EQ '&PRINT'.

   DATA: params   LIKE PRI_PARAMS,

         arcparams LIKE ARC_PARAMS,

         DAYS(1)  TYPE N VALUE 2,

         COUNT(3) TYPE N VALUE 1,

         VALID    TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

         EXPORTING

            DESTINATION            = 'LT50'

             COPIES                 = COUNT

             LIST_NAME              = 'TEST'

             LIST_TEXT              = 'SUBMIT TO SAP-SPOOL'

             IMMEDIATELY            = 'X'

             RELEASE                = 'X'

             NEW_LIST_ID            = 'X'

             EXPIRATION             = DAYS

             LINE_SIZE              = 44

             LINE_COUNT             = 80

             LAYOUT                 = 'X_44_120'

             SAP_COVER_PAGE         = 'X'

             COVER_PAGE             = 'X'

             RECEIVER               = 'SAP*'

             DEPARTMENT             = 'System'

             SAP_OBJECT             = 'RS'

             AR_OBJECT              = 'TEST'

             ARCHIVE_ID             = 'XX'

             ARCHIVE_INFO           = 'III'

             ARCHIVE_TEXT           = 'Description'

             NO_DIALOG              = ' '

          IMPORTING

             OUT_PARAMETERS         = params

             OUT_ARCHIVE_PARAMETERS = arcparams

             VALID                  = VALID.

IF VALID <> SPACE.

   SUBMIT ZBOM_VS_OFFER TO SAP-SPOOl

   SPOOL PARAMETERS Params

     ARCHIVE PARAMETERS arcparams

     WITHOUT SPOOL DYNPRO

     with p_matnr = p_matnr

     with p_werks = p_werks

                 and return.

*   NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.

ENDIF.

endif.

ENDFORM.

10 REPLIES 10
Read only

Former Member
0 Likes
1,885

If you want the dialog box, dont use WITHOUT SPOOL DYNPRO.

Thanks,

Shambu

Read only

0 Likes
1,885

but it is not working.

Read only

0 Likes
1,885

Do you want the Output to directly go to the Printer or do you want a dialog box?

Read only

0 Likes
1,885

I want the output to directly go to the printer.

Read only

0 Likes
1,885

I want the output to directly go to the printer( in ABAP 4.7 Version).

Read only

0 Likes
1,885

Hello Mahesh ,

In our system there is a provision in which the output (smartform) is directly Printed using the local printer attached to the system. And the code which makes it possible is below check the same it may be helpful for you.

       WA_COMPOP-TDNEWID   = 'X'.

*     WA_COMPOP-TDFINAL   = 'X'.

       wa_compop-TDARMOD = '1'.

       WA_COMPOP-TDIMMED   = 'X'.

       WA_COMPOP-TDDELETE  = 'X'.

       WA_COMPOP-TDCOPIES  = 1 .

       WA_CTRLOP-DEVICE    = 'PRINTER'.    " Here we dont give printer name 'KX-P3696'.

       WA_CTRLOP-NO_DIALOG = 'X'.

       WA_CTRLOP-PREVIEW   = ' '.

And this Parameters are  passed as CONTROL_PARAMETERS and OUTPUT_OPTIONS while calling the smartform.

With reference to the above code you try to provide the Destination field with PRINTER instead of LT50 and then check.

Read only

0 Likes
1,885

Thank you Sijin.

Read only

0 Likes
1,885

Did the suggestion work ?

Read only

0 Likes
1,885

Yes.

Read only

Former Member
0 Likes
1,885

I have to add the Download excel button in application tool bar. When i am click the excel button report output can be downloaded in EXCEL sheet. But i have design the layout in smartform & call the driver program but it can't be downloaded. If any one tell me.