‎2007 Aug 14 9:20 PM
Hi all,
I have this piece of code .
when i click cancel win the pop window which shows me print,print preview and cancel with all other printer and print parametrs.
If i click cancel i get a message saying
output was cancelled by the user
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = 'X'
form = space
language = sy-langu
options = itCTT
.
call function 'START_FORM'
exporting
ARCHIVE_INDEX =
form = 'ZFORM '
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
For this piece of code the iam getting a mess
START_FORM is invalid, OPEN_FORM is missing
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = 'X'
form = space
language = sy-langu
options = itcTT
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
others = 11
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'START_FORM'
exporting
ARCHIVE_INDEX =
form = 'ZFORM '
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
For the second case the sy-subrc is 1
Thanks
David
‎2007 Aug 14 9:34 PM
That's right, call OPEN_FORM specifying exceptions as in the second piece of code. Then check sy-subrc value and DON'T call START_FORM if it is 1 (or better, if it's not zero).
Something like this:
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Else.
call function 'START_FORM'
exporting
* ARCHIVE_INDEX =
form = 'ZFORM '
* LANGUAGE = ' '
* STARTPAGE = ' '
* PROGRAM = ' '
* MAIL_APPL_OBJECT =
* IMPORTING
* LANGUAGE =
* EXCEPTIONS
* FORM = 1
* FORMAT = 2
* UNENDED = 3
* UNOPENED = 4
.
endif.
Regards.
<b>Please reward points if helpful.</b>
‎2007 Aug 14 9:33 PM
Did you try giving the form name in OPEN_FORM as ZFORM and uncomment the exceptions in the function module?
-Kriss
‎2007 Aug 14 9:34 PM
That's right, call OPEN_FORM specifying exceptions as in the second piece of code. Then check sy-subrc value and DON'T call START_FORM if it is 1 (or better, if it's not zero).
Something like this:
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Else.
call function 'START_FORM'
exporting
* ARCHIVE_INDEX =
form = 'ZFORM '
* LANGUAGE = ' '
* STARTPAGE = ' '
* PROGRAM = ' '
* MAIL_APPL_OBJECT =
* IMPORTING
* LANGUAGE =
* EXCEPTIONS
* FORM = 1
* FORMAT = 2
* UNENDED = 3
* UNOPENED = 4
.
endif.
Regards.
<b>Please reward points if helpful.</b>
‎2007 Aug 15 2:20 PM
Hi,
i did that, why we comment the exceptions in the open_form , doesnot go for forward and open a start_form and where is the error coming from in the first case when we comment or delete the exception in open_form
Thanks
‎2007 Aug 15 2:58 PM
You must uncomment the exceptions in the OPEN_FORM call. That way you can capture errors and identify them according to SY-SUBRC value. In thes case, whatever error occurs, you must not call START_FORM, so you just evaluate SY-SUBRC <> 0.
If you comment the exceptions, a dump will occur if an error does.
Regards.
<b>Please reward points if helpful. </b>