04-18-2007 9:55 AM
Hi experts ,
If you please to tell me how the "Condition for output trontrol" (NACE ) works , especially for the application code V6 Handling Units , And its requirements KOBEV and KOBED . Is it right that the message will be created when the sy-subrc = 0 in the KOBEV ? .
My problem is : I want to print a form (SAPscript) after executing the transaction VL31N . And i have coded some conditions checks for the form KOBEV_xxx , but it did not work .( But when i set a breakpoint in KOBEV forms , it stoped at the breakpoint when executing the the transaction VL31N) .
Even i have set the value sy-subrc = 0 always in order that the message will be created .
but nothing happened . When i use the transaction HUMO to create the message by hand, The form was printed well in the spool ( SP01) .
PS : I am in very urgent situation for this . please help me . Reward immeadiately.
04-18-2007 9:59 AM
at the break-point , try to check Form name and output type it is taking .
check open_form or start_form and NAST table entries.
Regards
Prabhu
04-18-2007 10:35 AM
Hi,
First thank you very much for your answer .
My problem is that i do not know how the message is created : The sy-subrc = 0 is the only condition for creating the messages ? Because here at the breakpoint i have debuged till the system propramm. but i find nothing relating to the creation of the message . This is mysterious to me so i need help from you .. please inform me if you have any ideas about this
Thanks.
04-18-2007 10:41 AM
Hi,
You are messing up the things together.
What's your exact requirement?
First what output you wants to print? Delivery or Handling Unit?
If it is delivery use Tcode VL71, for Handling Units use VL74.
then coming to the routines, why you are writing Routines in VOFM using KOBEV_xxx, KOBED.. and checking for Sy-subrc value?
why this is concerned with printing the output.to put some extra contion we may use this. I feel that there is no need for you to write anything here.
So do you know the output type for your application.
With that Output type go to NACE transaction and check the program and the print form/smartform assignment? whether they are correctly assigned or not?
reward if useful
regards,
ANJI
04-18-2007 11:16 AM
Thank you very much for your answers .
My requirement is to print a SAPscriptform after executing the transaction VL31N .
Here i have created 3 messages types : Z1 Z2 Z2 .
VL74 : yes it runs . but what i need here is the execution of the sub routines :
KOBEV_610 => if sy-subrc = 0 : message Z1 will created => printing pro is triggered
KOBEV_611 => if sy-subrc = 0 : message Z2 will created => printing pro is triggered
KOBEV_612 => if sy-subrc = 0 : message Z3 will created => printing pro is triggered
So what i wonder here is : Even i have set sy-subrc = 0 . But the messages were not created .
Thanks
06-22-2007 12:05 PM
I have same problem too. I have entered output conditions. I see Output ignored (requirement 902 not fulfilled) in output analysis. However, form is printing. But condition is not ok and the form mustn't print.
04-18-2007 10:54 AM
Hai friend,
Try the following code. I used this code for an invoice printing in vfo3. I think you are familiar with NACE. You just change this code. Make sure of these 4 things.
1. Give 'entry' as form routine in the processing routines.
2. The perform set print param is must
3. Change the CALL FUNCTION lf_fm_name exporting parameters with your match.
4. Reward if helpfull.
&----
*& Report ZEXDOC_BRC_DRIVER
*&
&----
*& Driver program for calling the smartform for invoice creation
*&
&----
REPORT zexdoc_brc_driver.
*Declations
INCLUDE zexdoc_brc_driver_top.
*Data selections
INCLUDE zexdoc_brc_driver_sub.
*Print settings
INCLUDE zexdoc_brc_driver_forms.
----
FORM ENTRY
----
FORM entry USING return_code us_screen.
DATA: lf_retcode TYPE sy-subrc.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing USING us_screen
CHANGING lf_retcode.
IF lf_retcode NE 0.
return_code = 1.
ELSE.
return_code = 0.
ENDIF.
ENDFORM. "ENTRY
----
FORM PROCESSING *
----
FORM processing USING proc_screen
CHANGING cf_retcode.
DATA: ls_print_data_to_read TYPE lbbil_print_data_to_read.
DATA: ls_bil_invoice TYPE lbbil_invoice .
DATA: lf_fm_name TYPE rs38l_fnam .
DATA: ls_control_param TYPE ssfctrlop .
DATA: ls_composer_param TYPE ssfcompop .
DATA: ls_recipient TYPE swotobjid .
DATA: ls_sender TYPE swotobjid .
DATA: lf_formname TYPE tdsfname .
DATA: ls_addr_key LIKE addr_key .
DATA: ls_dlv-land LIKE vbrk-land1 .
DATA: ls_job_info TYPE ssfcrescl .
SmartForm from customizing table TNAPR
lf_formname = tnapr-sform.
IF cf_retcode = 0.
select print data
PERFORM get_data.
ENDIF.
IF cf_retcode = 0.
PERFORM set_print_param USING ls_addr_key
ls_dlv-land
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
cf_retcode.
ENDIF.
IF cf_retcode = 0.
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.
IF sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
ENDIF.
ENDIF.
IF cf_retcode = 0.
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 = ' '
exdoc_billno = wa_bilno
exdoc_bdate = wa_bdate
exdoc_qty = wa_qty
exdoc_dec = wa_dec
exdoc_name = wa_name
exdoc_country = wa_country
exdoc_bilamt = wa_bilamt
exdoc_cur = wa_cur
exdoc_amt = wa_amt
exdoc_exchrate = wa_rate-exch_rate
exdoc_name1 = wa_name1
exdoc_city = wa_city
exdoc_street = wa_street
IMPORTING
job_output_info = ls_job_info
document_output_info =
job_output_options =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
error handling
cf_retcode = sy-subrc.
ENDIF.
ENDIF.
ENDFORM. "PROCESSING
-
&----
*& Include ZEXDOC_BRC_DRIVER_TOP
&----
INCLUDE rvadtabl.
----
*Work variables
DATA: wa_bdate TYPE vbrk-fkdat . "Billing date
DATA: wa_fname(30) TYPE c . "Function module name
DATA: wa_qty TYPE vbrp-fkimg . "Billed quantity
DATA: wa_dec TYPE vbrp-arktx . "Description of goods
DATA: wa_delv TYPE vbrp-vgbel . "Ref doc number
DATA: wa_kunnr TYPE likp-kunnr .
DATA: wa_adrno TYPE kna1-adrnr . "Address no:-Destination
DATA: wa_name TYPE adrc-mc_name1 . "Name -Destination
DATA: wa_country TYPE adrc-country . "Country-Destination
DATA: wa_bilamt TYPE vbrk-netwr . "Billed amount
DATA: wa_cur TYPE vbrk-waerk . "Currency
DATA: wa_amt TYPE vbrk-netwr . "Billed amount in INR
DATA: wa_rate TYPE bapi1093_0 . "Bapi exchange rate structure
DATA: wa_code TYPE vbrk-bukrs . "Company code
DATA: wa_adrno1 TYPE t001-adrnr . "Address no:-official address
DATA: wa_name1 TYPE adrc-mc_name1 . "Name -full official address
DATA: wa_city TYPE adrc-mc_city1 . "City -full official address
DATA: wa_street TYPE adrc-mc_street. "Street-full official address
DATA: retcode LIKE sy-subrc . "Returncode
DATA: xscreen(1) TYPE c . "Output on printer or screen
DATA: wa_bilno TYPE vbrk-vbeln . "Storing the nast-objky
-
&----
*& Include ZEXDOC_BRC_DRIVER_SUB
&----
&----
*& Form GET_data
&----
FORM get_data .
wa_bilno = nast-objky. "Storing the bill number
*Selecting billing date,bill amount,currency,company code for p_billno
SELECT SINGLE fkdat netwr waerk bukrs
INTO (wa_bdate,wa_bilamt,wa_cur,wa_code)
FROM vbrk
WHERE vbeln = nast-objky. "Billno.
*Selecting quantity,description,reference document number
SELECT SINGLE fkimg arktx vgbel
INTO (wa_qty,wa_dec,wa_delv)
FROM vbrp
WHERE vbeln = nast-objky.
*Selecting the ship-to-party for the reference document number
SELECT SINGLE kunnr
FROM likp
INTO wa_kunnr
WHERE vbeln = wa_delv.
*Slecting the address number for the selected ship-to-party
SELECT SINGLE adrnr
FROM kna1
INTO wa_adrno
WHERE kunnr = wa_kunnr.
*Selecting customer name and country for the selected adrnr
SELECT SINGLE mc_name1 country
INTO (wa_name,wa_country)
FROM adrc
WHERE addrnumber = wa_adrno.
*Selecting the address number for the company code
SELECT SINGLE adrnr
FROM t001
INTO wa_adrno1
WHERE bukrs = wa_code.
*Selecting name,city,street for full official address
SELECT SINGLE mc_name1 mc_city1 mc_street
INTO (wa_name1,wa_city,wa_street)
FROM adrc
WHERE addrnumber = wa_adrno1.
PERFORM sub_curr_convert. "Currency conversion
ENDFORM. " GET_data
*&----
*& Form sub_curr_convert
*&----
FORM sub_curr_convert .
*Getting the exchange rate
CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
EXPORTING
rate_type = 'M'
from_curr = wa_cur
to_currncy = 'INR'
date = sy-datum
IMPORTING
exch_rate = wa_rate.
*Calculating the INR amount
wa_amt = wa_bilamt * wa_rate-exch_rate.
ENDFORM. " sub_curr_convert
-
&----
*& Include ZEXDOC_BRC_DRIVER_FORMS
&----
&----
*& Form SET_PRINT_PARAM
&----
FORM set_print_param USING is_addr_key LIKE addr_key
is_dlv-land LIKE vbrk-land1
CHANGING cs_control_param TYPE ssfctrlop
cs_composer_param TYPE ssfcompop
cs_recipient TYPE swotobjid
cs_sender TYPE swotobjid
cf_retcode TYPE sy-subrc.
DATA: ls_itcpo TYPE itcpo .
DATA: lf_repid TYPE sy-repid .
DATA: lf_device TYPE tddevice .
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
lf_repid = sy-repid.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
pi_nast = nast
pi_country = is_dlv-land
pi_addr_key = is_addr_key
pi_repid = lf_repid
pi_screen = xscreen
IMPORTING
pe_returncode = cf_retcode
pe_itcpo = ls_itcpo
pe_device = lf_device
pe_recipient = cs_recipient
pe_sender = cs_sender.
IF cf_retcode = 0.
MOVE-CORRESPONDING ls_itcpo TO cs_composer_param.
CS_CONTROL_PARAM-NO_OPEN
CS_CONTROL_PARAM-NO_CLOSE
cs_control_param-device = lf_device.
cs_control_param-no_dialog = 'X'.
cs_control_param-preview = xscreen.
cs_control_param-getotf = ls_itcpo-tdgetotf.
cs_control_param-langu = nast-spras.
CS_CONTROL_PARAM-REPLANGU1
CS_CONTROL_PARAM-REPLANGU2
CS_CONTROL_PARAM-REPLANGU3
CS_CONTROL_PARAM-STARTPAGE
ENDIF.
ENDFORM. " SET_PRINT_PARAM
Regards rakesh.