We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

[sap-abap] Program for Printing in MIGO doing things on its own

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by csalazar (SAP Business Analyst)
on Nov 27 at 12:47 PM
I am not an ABAPER and I am using the following code to print labels for receiving materials in MIGO. My problem its that althought in NACE all the parameters are there, there is a couple of things this code seems to be doing on its own:
1. On the first line of migo always executes a message (WE04) even if it not set up in NACE.
2. When it founds a message to print not only does it for that line but does it for all the lines on MIGO, so if I want to receive 2 items, I end up with 4 labels (2 for each)
If somebody knows where can I check those errors. First it goes to this program:
*&---------------------------------------------------------------------* *& Report ZIMPRIMEETIQ *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zimprimeetiq. *INCLUDE ZMILLS_MM_OC_TOP. tables: nast, "Messages  *nast, "Messages  tnapr, "Programs & Forms  itcpo, "Communicationarea for Spool  arc_params, "Archive parameters  toa_dara, "Archive parameters  addr_key,  mara. "Adressnumber for ADDRESS   DATA: xscreen.   INCLUDE ZMILLS_MM_OC_ETI.

And in ZMILLS_MM_OC_ETI:
*&---------------------------------------------------------------------* *& Include ZMILLS_MM_OC_ETI *&---------------------------------------------------------------------*  FORM entry USING ent_retco ent_screen.  DATA: l_druvo LIKE t166k-druvo,  l_nast LIKE nast,  l_from_memory.   * l_doc TYPE meein_purchase_doc_print.  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: w_charg TYPE charg_d,  w_matnr TYPE matnr,  w_menge TYPE menge_d,  w_lifnr TYPE elifn,  w_meins TYPE meins,  w_licha TYPE lichn.   DATA: BEGIN OF t_mseg OCCURS 0,  charg LIKE mseg-charg,  matnr LIKE mseg-matnr,  menge LIKE mseg-menge,  lifnr LIKE mseg-lifnr,  meins LIKE mseg-meins,  licha LIKE mch1-licha,  END OF t_mseg.        xscreen = ent_screen.    CLEAR ent_retco.  IF nast-aende EQ space.  l_druvo = '1'.  ELSE.  l_druvo = '2'.  ENDIF.   * CALL FUNCTION 'ME_READ_PO_FOR_PRINTING' * EXPORTING * ix_nast = nast * ix_screen = ent_screen * IMPORTING * ex_retco = ent_retco * ex_nast = l_nast ** doc = l_doc * CHANGING * cx_druvo = l_druvo * cx_from_memory = l_from_memory. * CHECK ent_retco EQ 0. * IF nast-adrnr IS INITIAL. ** PERFORM get_addr_key ** CHANGING ls_addr_key. * ELSE. * ls_addr_key = nast-adrnr. * ENDIF.   * Fill up pricing condition table if calling from ME9F * IF l_doc-xtkomv IS INITIAL. * SELECT * INTO TABLE l_doc-xtkomv FROM konv * WHERE knumv = l_doc-xekko-knumv. * ENDIF.   *Obtiene datos  SELECT *  INTO CORRESPONDING FIELDS OF TABLE t_mseg  FROM mseg  WHERE mblnr = nast-objky(10)  AND mjahr = nast-objky+10(4).       **Set the print Parameters  PERFORM set_print_param USING ls_addr_key  CHANGING ls_control_param  ls_composer_param  ls_recipient  ls_sender  ent_retco.   *Get the Smart Form name.  IF NOT tnapr-sform IS INITIAL.  lf_formname = tnapr-sform.  ELSE.  lf_formname = tnapr-fonam.  ENDIF. * Determine smartform function module for invoice  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'  EXPORTING  formname = lf_formname  IMPORTING  fm_name = lf_fm_name  EXCEPTIONS  no_form = 1  no_function_module = 2  OTHERS = 3.  IF sy-subrc <> 0. * error handling * ent_retco = sy-subrc. * PERFORM protocol_update_i.  ENDIF.    LOOP AT t_mseg.    IF NOT t_mseg-charg IS INITIAL.    SELECT SINGLE licha  INTO w_licha  FROM mch1  WHERE charg = t_mseg-charg  AND matnr = t_mseg-matnr.    ENDIF.  w_charg = t_mseg-charg.  w_matnr = t_mseg-matnr.  w_menge = t_mseg-menge.  w_lifnr = t_mseg-lifnr.  w_meins = t_mseg-meins.      CALL FUNCTION lf_fm_name  EXPORTING  archive_index = toa_dara  archive_parameters = arc_params  control_parameters = ls_control_param  mail_recipient = ls_recipient  mail_sender = ls_sender  output_options = ls_composer_param  user_settings = ' '  i_charg = w_charg  i_matnr = w_matnr  i_menge = w_menge  i_lifnr = w_lifnr  i_meins = w_meins  i_licha = w_licha * TABLES * l_xekpo = l_doc-xekpo\[\] * l_xekpa = l_doc-xekpa\[\] * l_xpekpo = l_doc-xpekpo\[\] * l_xeket = l_doc-xeket\[\] * l_xtkomv = l_doc-xtkomv\[\] * l_xekkn = l_doc-xekkn\[\] * l_xekek = l_doc-xekek\[\] * l_xkomk = l_xkomk * EXCEPTIONS  formatting_error = 1  internal_error = 2  send_error = 3  user_canceled = 4  OTHERS = 5.    endloop.  IF sy-subrc <> 0. * ent_retco = sy-subrc. * PERFORM protocol_update_i.   * get SmartForm protocoll and store it in the NAST protocoll * PERFORM add_smfrm_prot.  ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form set_print_param *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_LS_ADDR_KEY text * <--P_LS_CONTROL_PARAM text * <--P_LS_COMPOSER_PARAM text * <--P_LS_RECIPIENT text * <--P_LS_SENDER text * <--P_CF_RETCODE text *----------------------------------------------------------------------* FORM set_print_param USING is_addr_key LIKE addr_key  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_addr_key = is_addr_key  pi_repid = lf_repid  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_composer_param-tdnoprint = 'X'. "Note 591576  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.  ENDIF. ENDFORM.

__.____._
Copyright © 2010 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Related Content
Most Popular White Papers

In the Spotlight
Toolbox.com Groups Discussions Now Support BBCode. Share Code Snippets with Peers
_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language