‎2007 Dec 18 4:22 AM
Hi Guys,
Question. Is there anyway that i could skip the output device screen selection and straight go to 'print preview'? at the same i wish to set the printer to 'LOCL'. Thanks in advance
Regards
‎2007 Dec 18 5:04 AM
hi,
then u can try the above code which will help you i belive..
regards,
karthik.
‎2007 Dec 18 4:28 AM
hi ,
if you are using smartforms then go to global settings--->form interface
-->Export tab --->JOB_OUTPUT_OPTIONS type SSFCRESOP which has all the setting for output option and TDIMMED is the component associated with that which should be set to X in the program..
hope this will help you ..
if its a script then this is the code...
tables : itcpo.
FORM open_form .
itcpo-tdnewid = 'X'.
itcpo-tdimmed = p_imme.
itcpo-tddest = 'LOCL'.
itcpo-tddataset = 'DELB'.
itcpo-tdsuffix1 = p_ldest.
itcpo-tdsuffix2 = lips-vbeln.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
application = 'TX'
archive_index = space
archive_params = space
device = 'PRINTER'
dialog = ' '
form = 'ZV_DEL_LABEL'
language = sy-langu
options = itcpo
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
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " open_form
regards,
karthik..
Edited by: karthikeyan sukumar on Dec 18, 2007 10:00 AM
‎2007 Dec 18 4:29 AM
Hi,
U did not mention the typr u r using it if it is script we hav function module called OPEN_FORM there in exproting we hav device option there u can giive ur own device by this u wont get the popup screen....
regards,
Sana.
reward for helpful answers.....
‎2007 Dec 18 4:39 AM
Hi Guys,
Sorry. Forgot to mention that it's on sapscript. Thanks
‎2007 Dec 18 5:04 AM
hi,
then u can try the above code which will help you i belive..
regards,
karthik.
‎2007 Dec 18 6:39 AM
Thanks for the reply. I shall try with the codes and let you know of the outcome. One question though, where should i place these codes? sorry, i'm very new to ABAP. Currently, i have one main program A which dynamically submits userID to the selection screen of program B and automatically process it. now, i'm returned with the screen output device screen. Thanks
Regards
‎2007 Dec 18 9:14 AM
hi ,
In your sap script you would be having open form,write form and close form you have to declare before open form...
i have pasted a sample code here you can check it.....
REPORT ZV_DELIVERY_SLIP_PRINT .
----
Tables:
----
tables: likp,vbak,adrc,vbpa,kna1,sadr,ITCPO,LIPS.
parameters: p_vbeln like likp-vbeln obligatory,
p_proj(50) type C,
p_node(50) type c,
p_pal(50) type c default 'PALLET 1 of 2',
p_ldest like nast-ldest default 'LOCL',
p_imme type c default 'X'.
Start-of-selection.
perform 100_collect_db_recs.
perform 200_collect_adrc_details.
&----
*& Form 100_collect_db_recs
&----
text
----
--> p1 text
<-- p2 text
----
FORM 100_collect_db_recs .
select single * from LIPS where vbeln = p_vbeln.
if sy-subrc ne 0.
write:/02 'Delivery does not exist!'.
stop.
else.
select single * from vbak where vbeln = lips-vgbel.
if sy-subrc ne 0.
write:/02 'Sales Order does not exist!'.
endif.
endif.
ENDFORM. " 100_collect_db_recs
&----
*& Form 200_collect_adrc_details
&----
text
----
--> p1 text
<-- p2 text
----
FORM 200_collect_adrc_details .
SELECT SINGLE *
FROM VBAK
WHERE VBELN EQ vbak-kunnr.
SELECT SINGLE *
FROM KNA1
WHERE KUNNR EQ vbak-kunnr.
SELECT SINGLE ADRNR
INTO vbpa-adrnr
FROM VBPA
WHERE VBELN EQ vbak-vbeln
AND PARVW EQ 'WE'. " Sold to party.
SELECT SINGLE NAME1
INTO sadr-name1
FROM SADR
WHERE ADRNR EQ vbpa-ADRNR.
SELECT NAME1 NAME2 NAME3 NAME4 STREET CITY1 CITY2 PO_BOX
STR_SUPPL1 POST_CODE1 FROM
ADRC INTO (ADRC-NAME1, ADRC-NAME2,ADRC-NAME3,ADRC-NAME4,
ADRC-STREET,ADRC-CITY1,ADRC-CITY2,ADRC-PO_BOX,
ADRC-STR_SUPPL1,ADRC-POST_CODE1)
WHERE ADDRNUMBER = vbpa-ADRNR.
EXIT.
ENDSELECT.
if sy-subrc = 0.
perform open_form.
perform start_form.
perform write_form.
perform end_form.
perform close_form.
Write:/02 'Delivery Label Printed!'.
else.
write:/02 'Error Collecting Address Details!'.
endif.
ENDFORM. " 200_collect_adrc_details
&----
*& Form open_form
&----
text
----
--> p1 text
<-- p2 text
----
FORM open_form .
itcpo-tdnewid = 'X'.
itcpo-tdimmed = p_imme.
itcpo-tddest = 'LOCL'.
itcpo-tddataset = 'DELB'.
itcpo-tdsuffix1 = p_ldest.
itcpo-tdsuffix2 = lips-vbeln.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
application = 'TX'
archive_index = space
archive_params = space
device = 'PRINTER'
dialog = ' '
form = 'ZV_DEL_LABEL'
language = sy-langu
options = itcpo
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
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " open_form
&----
*& Form start_form
&----
text
----
--> p1 text
<-- p2 text
----
FORM start_form .
CALL FUNCTION 'START_FORM'
EXPORTING
startpage = 'FIRST'
EXCEPTIONS
form = 1
format = 2
unended = 3
unopened = 4
unused = 5
OTHERS = 6.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " start_form
&----
*& Form write_form
&----
text
----
--> p1 text
<-- p2 text
----
FORM write_form .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TEXT'
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " write_form
&----
*& Form end_form
&----
text
----
--> p1 text
<-- p2 text
----
FORM end_form .
CALL FUNCTION 'END_FORM'
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 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.
ENDFORM. " end_form
&----
*& Form close_form
&----
text
----
--> p1 text
<-- p2 text
----
FORM close_form .
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " close_form
regards,
karthik.