Skip to Content
0

print smarform from abap web dynpro

Nov 07, 2016 at 07:18 PM

36

avatar image

Dear Experts,

My Requirement is: I have a view with a print button on it.

When user clicks on the print button, smartform has to get printed without any display/preview.

I have written the below code, but print is not coming.

1. call function SSF_FUNCTION_MODULE_NAME

LS_COMPOSER_PARAM-TDIMMED = 'X'.
LS_COMPOSER_PARAM-TDCOPIES = '3'.
LS_COMPOSER_PARAM-TDDEST = 'LP01'. "'LOCL'.
LS_COMPOSER_PARAM-TDNOPREV = 'X' .
LS_COMPOSER_PARAM-TDDELETE = ' '.

LS_CONTROL_PARAM-DEVICE = 'PRINTER'.

2. calling the smartform

CALL FUNCTION lv_formname
EXPORTING
* archive_index = toa_dara
* archive_parameters = arc_params
CONTROL_PARAMETERS = LS_CONTROL_PARAM
* mail_recipient = ls_recipient
* mail_sender = ls_sender
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = 'X'
LV_VBELN = LV_VBELN
IMPORTING
DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.

In 'JOB_OUTPUT_INFO' i am fetching spool request number.

3. When i used the below FM, spool request status is showing as complete in tcode: SP01, but print is not coming.

CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
EXPORTING
COPIES = '1'
DEVICE = 'LP01'
* DIVISION = '*'
ENDPAGE = 0
* PRIO = 0
* RECEIVER = '*'
* REQEST_TITLE = '*'
SPOOL_REQUEST_ID = LS_JOB_OUTPUT_INFO
* STARTPAGE = 0
* TELELAN = '*'
* TELENUM = '*'
* POSNAME =
* ACTTIME =
* TABLES
* ATTRIBUTES =
EXCEPTIONS
ARCHIVE_DEST_INVALID = 1
ARCHIVE_DEST_NOT_FOUND = 2
ARCHIVE_DEST_NO_RIGHT = 3
CANNOT_ARCHIVE = 4
CHANGE_ARCHDEST_NO_RIGHT = 5
CHANGE_COPIES_NO_RIGHT = 6
CHANGE_DEST_NO_RIGHT = 7
CHANGE_DEVTYPE_NO_RIGHT = 8
CHANGE_PRIO_NO_RIGHT = 9
CHANGE_TELENUM_NO_RIGHT = 10
CHANGE_TITLE_NO_RIGHT = 11
DEST_INVALID = 12
DEST_NOT_FOUND = 13
DEST_NO_RIGHT = 14
INTERNAL_PROBLEM = 15
INVALID_FAX_ATTRIBUTE = 16
INVALID_PARAMETERS = 17
NON_OWNER_NO_RIGHT = 18
NO_LAYOUT = 19
NO_SPOOL_REQUEST = 20
OUT_AGAIN_NO_RIGHT = 21
SPOOLER_PROBLEM = 22
OTHERS = 23.

4. Used this FM, but not working

CALL FUNCTION 'RSPO_RPRINT_SPOOLREQ'
EXPORTING
TEND = SY-TABIX
* POPUP = 'X'
* PFROM = 0
* PTO = 0
TABLES
REQ_VIEW = req_view
CHANGING
RS_SELFIELD = RS_SELFIELD
EXCEPTIONS
ERROR = 1
OTHERS = 2.

Please help me on this.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers