cancel
Showing results for 
Search instead for 
Did you mean: 

send to spool

Former Member
0 Kudos
233

how to automatically send sapscript form to spool without using popup dialog?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hiiii

see following code

DATA: LVS_ITCPO         TYPE   ITCPO,
      LVF_DEVICE(30)    TYPE   C,
      LVF_DIALOG(1)     TYPE   C   VALUE ' ',
      LVS_RECIPIENT     LIKE   SWOTOBJID,
      LVS_SENDER        LIKE   SWOTOBJID,
      LVS_SNAST         TYPE   SNAST,
      LVF_PROGRAM       LIKE   SY-REPID,
      LVS_COMM_TYPE     TYPE   AD_COMM,
      LVS_COMM_VALUES   TYPE   SZADR_COMM_VALUES.

* convert communication data
MOVE-CORRESPONDING NAST TO LVS_SNAST.
MOVE SY-REPID           TO LVF_PROGRAM.
if LVS_SNAST-NACHA = '5'.
  LVS_SNAST-NACHA = '1'.
  LVS_SNAST-LDEST = 'LP01'.
endif.

CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
     EXPORTING
          PI_COMM_TYPE              = LVS_COMM_TYPE
          PI_COMM_VALUES            = LVS_COMM_VALUES
          PI_SCREEN                 = US_SCREEN
*           PI_NEWID                  =
          PI_COUNTRY                = US_COUNTRY
          PI_REPID                  = LVF_PROGRAM
          PI_SNAST                  = LVS_SNAST
     IMPORTING
          PE_ITCPO                  = LVS_ITCPO
          PE_DEVICE                 = LVF_DEVICE
          PE_MAIL_RECIPIENT         = LVS_RECIPIENT
          PE_MAIL_SENDER            = LVS_SENDER
     EXCEPTIONS
          COMM_TYPE_NOT_SUPPORTED   = 1
          RECIPIENT_CREATION_FAILED = 2
          SENDER_CREATION_FAILED    = 3
          OTHERS                    = 4.
IF SY-SUBRC <> 0.
  RETCODE = SY-SUBRC.
  SYST-MSGTY = 'E'.
  PERFORM PROTOCOL_UPDATE.
ENDIF.

check retcode eq 0.

* if there is no communication type
IF  LVS_COMM_TYPE IS INITIAL.
*   set device
  CASE NAST-NACHA.
    WHEN '1'.
      *LVF_DEVICE = 'PRINTER'.*
      *LVS_ITCPO-tdgetotf = 'X'.*        *"Check this*
    WHEN '2'.
      LVF_DEVICE = 'TELEFAX'.
      LVS_ITCPO-TDTELENUM = NAST-TELFX.
      IF NAST-TLAND IS INITIAL.
        LVS_ITCPO-TDTELELAND = US_COUNTRY.
      ELSE.
        LVS_ITCPO-TDTELELAND = NAST-TLAND.
      ENDIF.
      LVS_ITCPO-TDSENDDATE = NAST-VSDAT.
      LVS_ITCPO-TDSENDTIME = NAST-VSURA.
      LVS_ITCPO-TDFAXUSER  = NAST-USNAM.
  
    WHEN OTHERS.
      LVF_DEVICE = 'PRINTER'.
  ENDCASE.
ENDIF.


* open form

CALL FUNCTION 'OPEN_FORM'
    EXPORTING
*           APPLICATION        = 'TX'
         ARCHIVE_INDEX      = TOA_DARA
         ARCHIVE_PARAMS     = ARC_PARAMS
         DEVICE             = LVF_DEVICE
         DIALOG             = ' '
         FORM               = TNAPR-FONAM
         LANGUAGE           = NAST-SPRAS
         OPTIONS            = LVS_ITCPO
         MAIL_SENDER        = LVS_SENDER
         MAIL_RECIPIENT     = LVS_RECIPIENT
*           MAIL_APPL_OBJECT   = ' '
*           RAW_DATA_INTERFACE = '*'
*      IMPORTING

reward if useful

thx

twinkal

Former Member
0 Kudos

Hi Oscar,

*Before calling the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z08V3_COLLI'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.*

LVS_ITCPO-TDNOPRINT = ' ' - This will get the spool number in Sp01

LVS_ITCPO-TDNEWID = 'X'. then it will create a Spool Request.

Edited by: Raj on Jun 19, 2008 8:05 PM

Former Member
0 Kudos

Try this:

data: itcpo LIKE ITCPO.

clear itcpo.

device = 'PRINTER'.

COUNTRY = 'US'.

itcpo-TDNOPREV = 'X'.

itcpo-TDCOPIES = 1. " one copy

  • itcpo-TDDEST = 'TF01'.

itcpo-TDNEWID = 'X'. " do not reuse old spool request

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = device

DIALOG = ' '

FORM = 'ZNOTICE'

LANGUAGE = SY-LANGU

OPTIONS = ITCPO

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

ARCHIVE_ERROR = 7

MORE_PARAMS_NEEDED_IN_BATCH = 8

OTHERS = 9.

the rest of your code