on 08-06-2008 9:17 AM
Hi,
I have a requirement like if there is already an entry in NAST table with o/p type ZURD and printer name USJC-PM03,then an error message has to be displayed like 'This Output already printed in USJC-PM03,Change the printer name 'USJC-PM03' to 'LOCL' and then print' on the vf03 screen.
But even if I change the printer name from 'USJC-PM03' to 'LOCL',it is showing the same error message.This message should not be shown.
I have changed the printer name using print options button.
I have used the following code in the program.
lf_formname = tnapr-sform.
determine print data
PERFORM set_print_data_to_read USING lf_formname
CHANGING ls_print_data_to_read
cf_retcode.
IF cf_retcode = 0.
select print data
PERFORM get_data USING ls_print_data_to_read
CHANGING ls_addr_key
ls_dlv-land
ls_bil_invoice
cf_retcode.
ENDIF.
IF sy-tcode = C_VF03.
SELECT SINGLE * FROM tnapr WHERE kschl = 'ZURD'
AND nacha = 1
AND kappl = 'V3'.
SELECT count(*)
FROM NAST
INTO lv_count
WHERE objky = ls_bil_invoice-hd_gen-bil_number
AND kappl = c_v3
AND kschl = c_ZURD
AND ldest = c_PM03.
IF LV_COUNT GE 1.
Message e000(zup) with text-001 text-002 text-003.
ELSE.
determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING formname = lf_formname
variant = ' '
direct_call = ' '
IMPORTING fm_name = lf_fm_name
EXCEPTIONS no_form = 1
no_function_module = 2
OTHERS = 3.
call smartform invoice
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_appl_obj =
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = space
is_bil_invoice = ls_bil_invoice
is_nast = nast
is_repeat = repeat
importing document_output_info =
*Uncomented the line to get the spool id or OTF formatted data -
*NY047532
IMPORTING
job_output_info = w_job
NY047532
job_output_options =
EXCEPTIONS formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
ENDIF.
ENDIF.
What should be done for the error message not to be shown when the printer name is 'LOCL'.
Hello,
See your code
__IF sy-tcode = C_VF03.__
__SELECT SINGLE * FROM tnapr WHERE kschl = 'ZURD'__
__AND nacha = 1__
__AND kappl = 'V3'.__
__SELECT count(*)__
__FROM NAST__
__INTO lv_count__
__WHERE objky = ls_bil_invoice-hd_gen-bil_number__
__AND kappl = c_v3__
__AND kschl = c_ZURD__
__AND ldest = c_PM03.__
__IF LV_COUNT GE 1.__
__Message e000(zup) with text-001 text-002 text-003.__
__ELSE.__
You are selecting data from NAST table. Nast table contains the data which you are giving while assigning the output type to invoice number so it will always select the printer 'usjc-PM03'.
If you want the data which you are providing at print option .Then don't select data from the NAST table.
The NAST structure itself will contain the data which you are providing at print-option.
No need to select data from NAST.
Each time that query will run successfuly and error will be occure.
Because when you are changing printer at print option the data is not updated in DATABASE table(NAST). So each time the query fetches old data and error will ocuure.
Please note these things.
Edited by: Anil Mane on Aug 6, 2008 10:50 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.