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

reg sapscript

Former Member
0 Likes
575

HI EXPERTS,

HERE THERE ARE 2 PROGRAMS PROGRAM A AND PROGRAM B,

PROGRAM A -- TO PRINT ALL INVOICES FOR A DAY.

PROGRAM B - PRINT PROGRAM FOR INVOICE.

IF I RUN THE PROGRAM A IN FOREGROUND THE RESULTS ARE SUBMITTED TO PROGRAM B AND THE FORMS ARE PRINTING., BUT IF I RUN THE PROGRAM A IN BACKGROUND ALL FORMS ARE WAITING IN SPOOL WITH MESSAGE FRONTEND UNAVAILABLE WHAT MIGHT BE THE PROBLEM.

****PROGRAM A***************

REPORT ZSDL_INVOICE_US_NON_PRINTAA .

TABLES : VBRK.

DATA : T_VBRK LIKE VBRK OCCURS 0 WITH HEADER LINE.

DATA : SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,

SELTAB1 LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.

DATA : LV_VBELNLOW TYPE VBRK-VBELN.

RANGES : R_FKART FOR VBRK-FKART.

REFRESH R_FKART.

CLEAR R_FKART.

R_FKART-SIGN = 'I'.

R_FKART-OPTION = 'EQ'.

R_FKART-LOW = 'ZUF2'.

APPEND R_FKART.

R_FKART-LOW = 'ZURE'.

APPEND R_FKART.

R_FKART-LOW = 'ZUL2'.

APPEND R_FKART.

R_FKART-LOW = 'ZUG2'.

APPEND R_FKART.

R_FKART-LOW = 'ZUS1'.

APPEND R_FKART.

R_FKART-LOW = 'ZUS2'.

APPEND R_FKART.

R_FKART-LOW = 'Z4S1'.

APPEND R_FKART.

R_FKART-LOW = 'Z4S2'.

APPEND R_FKART.

R_FKART-LOW = 'ZUB1'.

APPEND R_FKART.

R_FKART-LOW = 'ZUFE'.

APPEND R_FKART.

R_FKART-LOW = 'ZUF8'.

APPEND R_FKART.

R_FKART-LOW = 'ZUF5'.

APPEND R_FKART.

R_FKART-LOW = 'ZUB4'.

APPEND R_FKART.

R_FKART-LOW = 'ZUB2'.

APPEND R_FKART.

R_FKART-LOW = 'ZUB3'.

APPEND R_FKART.

R_FKART-LOW = 'ZS1'.

APPEND R_FKART.

R_FKART-LOW = 'ZS2'.

APPEND R_FKART.

R_FKART-LOW = 'ZSF2'.

APPEND R_FKART.

SELECT * FROM VBRK INTO TABLE T_VBRK

WHERE FKDAT EQ SY-DATUM

AND FKART IN R_FKART.

SORT T_VBRK BY VBELN FKART.

LOOP AT T_VBRK.

REFRESH : SELTAB.

CLEAR : SELTAB.

SELTAB-SELNAME = 'P_FKART'.

SELTAB-KIND = 'P'.

SELTAB-SIGN = 'I'.

SELTAB-OPTION = 'EQ'.

SELTAB-LOW = T_VBRK-FKART.

APPEND SELTAB.

SELTAB-SELNAME = 'P_REMARK'.

SELTAB-KIND = 'P'.

SELTAB-SIGN = 'I'.

SELTAB-OPTION = 'EQ'.

SELTAB-LOW = 'Thank you for your business.'.

APPEND SELTAB.

SELTAB-SELNAME = 'S_FKDAT'.

SELTAB-KIND = 'S'.

SELTAB-SIGN = 'I'.

SELTAB-OPTION = 'EQ'.

SELTAB-LOW = T_VBRK-FKDAT.

APPEND SELTAB.

SELTAB-SELNAME = 'S_KUNAG'.

SELTAB-KIND = 'S'.

SELTAB-SIGN = 'I'.

SELTAB-OPTION = 'EQ'.

SELTAB-LOW = T_VBRK-KUNAG.

APPEND SELTAB.

SELTAB-SELNAME = 'S_VBELN'.

SELTAB-KIND = 'S'.

SELTAB-SIGN = 'I'.

SELTAB-OPTION = 'EQ'.

SELTAB-LOW = T_VBRK-VBELN.

APPEND SELTAB.

SUBMIT ZSDL_INVOICE_US_NON_PRINTAB WITH SELECTION-TABLE SELTAB

AND RETURN.

ENDLOOP.

*********************************************END OF PROGRAM A*********************

**********PROGRAM B******************************

JUST WHAT WE NEED IS GIVEN BELOW

FORM ZOPEN_FORM .

*-- Open Layout for printing

DATA : I_ITCPO TYPE ITCPO.

I_ITCPO-TDCOPIES = 1.

I_ITCPO-TDIMMED = 'X'.

I_ITCPO-TDNOPREV = 'X'.

I_ITCPO-TDDEST = 'ZINV'.

I_ITCPO-RQPOSNAME = 'LEXMARK T632'." '
152.53.4.221'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • device = 'PRINTER'

DIALOG = ' '

  • form = 'ZSD_INVOICE_UK'

  • language = sy-langu

OPTIONS = I_ITCPO

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

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.

CLEAR I_ITCPO.

********END OF PROGRAM B*********************

3 REPLIES 3
Read only

ashok_kumar24
Contributor
0 Likes
536

Hi Kannan,

<b>Good Check the following programs ( Very Helpful )</b>

<b>SAP Script - Useful programs</b>

<b>RSTXFCON Converts SAPScript page formats

RSTXSCRP Save a SAPScript layout set to disk, and load it back into SAP.

RSTXTPDF4 Pass the spool number of a report's output to this program to have the output converted to PDF format.

RSWBO052 Change development class of a sapscript </b>

Good Luck and thanks

AK

Read only

Former Member
0 Likes
536

Hi

Check the paramters passed to I_ITCPO

Go to the structure ITCPO and give the correct parameter for printing.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
536

Hi Natarajan,

it seems that you try to print the spool in background and that your printer is a frontend printer with the 'Host spool access method F: printing on Front End Computer' (in transaction SPAD).

This doesn't work as far as I know. You have to provide a printer with an other Host spool access method, e.g. C or S or U).

Printing on a frontend printer means that the SAP System can reach the Frontend (the PC), this is not guaranteed. Perhaps you turn off your PC and then the background job can't reach your frontend.

Thank you.

Regards,

Manomeet

    • Award points if helpful **