2012 Oct 01 3:11 PM
hi abap ers,
i want to print a smartform. first i want to preview without additional pop up then i want to print.
code:
REPORT ZSMARTFORM_IMP1.
TABLES:vbak.
select-OPTIONS: s_vbeln for vbak-vbeln.
DATA: it_vbak TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
it_vbap TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,
it_vbak_temp TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
it_vbap_temp TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,
wa_vbak TYPE vbak,
FM_NAME TYPE rs38l_fnam.
data: output_options type ssfcompop.
DATA: CONTROL TYPE SSFCTRLOP.
SELECT * from vbak into TABLE it_vbak WHERE VBELN in s_vbeln .
if sy-subrc EQ 0.
select * from vbap INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln.
endif.
*
output_options-tddest = 'LP01'.
output_options-tdNOPRINT = ' '.
CONTROL-DEVICE = 'PRINTER'.
CONTROL-NO_DIALOG = 'X'.
CONTROL-PREVIEW = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSMARTFORM_IMP1'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_vbak into wa_vbak.
refresh:it_vbak_temp,
it_vbap_temp.
it_vbak_temp[] = it_vbak[].
it_vbap_temp[] = it_vbap[].
DELETE it_vbak_temp WHERE vbeln NE wa_vbak-vbeln.
DELETE it_vbap_temp WHERE vbeln NE wa_vbak-vbeln.
CALL FUNCTION FM_NAME
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = CONTROL
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = ' '
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
VBAK = it_vbak_temp[]
VBAP = it_vbap_temp[]
* 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.
endloop.
Regards
Sabyasachi Karforma
2012 Oct 01 4:46 PM
Hi Abap ers please solve my problem and tell a right way how to print in this case.
2012 Oct 01 4:49 PM
2012 Oct 01 4:58 PM
Hi Vipin ,
i only set
output_options-tddest = 'LP01'.
output_options-tdNOPRINT = ' '.
CONTROL-DEVICE = 'PRINTER'.
CONTROL-NO_DIALOG = 'X'.
CONTROL-PREVIEW = 'X'.
5 parameters. when i execute my code print preview page will open. here, TEXT menu present in menu bar and in 'TEXT' 'PRINT' option. when i click on print, a message with text 'spool request (number 15.902) created' is display. but when we go to tcode SP01 then it will not found.
2012 Oct 01 6:24 PM
2012 Oct 01 6:36 PM
HI your are still getting the problem ? it was solved last week rite?
2012 Oct 01 6:59 PM
HI geeta ,
plz read my question . its not print preview, i want to direct print my smartform ri8 now.
2012 Oct 01 11:13 PM
2012 Oct 02 7:59 AM
Hi ,
Try this.
data: output_options type ssfcompop.
DATA: CONTROL TYPE SSFCTRLOP.
CONTROL-preview = 'X'."Preview the output of Smartform
CONTROL-no_dialog = 'X'."Don't show Dialog
output_options-tddest = 'LP01'.
CALL FUNCTION FM_NAME
EXPORTING
CONTROL_PARAMETERS = CONTROL
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = ' '
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
VBAK = it_vbak_temp[]
VBAP = it_vbap_temp[]
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5
.
This will give print preview without dialog box, and you can print directly from there.
Thanks,
Susmitha
2012 Oct 02 8:25 AM
Sabyasachi,
Also make sure that
output_options-TDNEWID = 'X' .
output_options-TDDELETE = ' ' .
Thanks,
Susmitha