SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Download a smartform into the PDF Format



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Smartforms, SapScripts, PDF
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Jan 31, 2009 7:00 pm    Post subject: Download a smartform into the PDF Format Reply with quote

Code:
*--------------------------------------------------------------------*
* Program Name : ZPPREP_SHOPFLOOR_VIEWER_ZOOM
 
REPORT zppeerep_shorepfloor_viewer_zoom.
 
*--------------------------------------------------------------------*
* T A B L E S    D E C L A R A T I O N
*--------------------------------------------------------------------*
*---Tables Used.
TABLES: afpo,
        mara,
        marc,
        aufk,
        afko,
        itcoo,
        nast,                          "Messages
        *nast,                         "Messages
        tnapr,                         "Programs & Forms
        addr_key,
        arc_params,                    "Archive parameters
        toa_dara.                      "Archive parameters
 
 
 
*--------------------------------------------------------------------*
* I N T E R N A L    T A B L E S     D E C L A R A T I O N
*--------------------------------------------------------------------*
*--Internal Tables Used.
 
*--------------------------------------------------------------------*
* D A T A     D E C L A R A T I O N
*--------------------------------------------------------------------*
*--Global Variables Used.
DATA: ws_matnr LIKE afpo-matnr,
      ws_werks LIKE aufk-werks,
      ws_mtart LIKE mara-mtart,
      ws_wrkst LIKE mara-wrkst,
      ws_fname TYPE rs38l_fnam,
      ws_ctrlp TYPE ssfctrlop,
      ws_optns TYPE ssfcompop,
      w_padest LIKE tsp03l-padest.                          "BMC01+
 
DATA: da_message_printed(1) TYPE c,
      da_preview_processed(1) TYPE c,
      repeat(1) TYPE c,
      da_subrc LIKE sy-subrc.
 
DATA: w_otfdata  TYPE ssfcrescl.
DATA: BEGIN OF it_itcoo OCCURS 0.
        INCLUDE STRUCTURE itcoo.
DATA: END OF it_itcoo.
DATA: w_otf  TYPE itcoo.
 
*--Data Declaration for Printing Layout
DATA: ls_itcpo     TYPE itcpo.
DATA: lf_repid     TYPE sy-repid.
DATA: lf_device    TYPE tddevice.
DATA: cf_retcode   TYPE sy-subrc.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender    TYPE swotobjid.
DATA: ls_control_param   TYPE ssfctrlop.
DATA: ls_composer_param  TYPE ssfcompop.
DATA: ls_addr_key        LIKE addr_key.
DATA: w_screen(1) TYPE c.
DATA: xscreen(1) TYPE c.
 
DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
*--------------------------------------------------------------------*
* C O N S T A N T S
*--------------------------------------------------------------------*
CONSTANTS: c_fas1(8)  TYPE c VALUE 'PRINTFAS',
           c_fas2(15) TYPE c VALUE 'PRINTFASDRAWING',
           c_wip1(8)  TYPE c VALUE 'PRINTWIP',
           c_wip2(15) TYPE c VALUE 'PRINTWIPDRAWING'.
 
*--------------------------------------------------------------------*
* S E L E C T I O N - S C R E E N.
*--------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
* Production order
PARAMETERS: p_aufnr LIKE afpo-aufnr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK bl1.
 
*--------------------------------------------------------------------*
START-OF-SELECTION.
*--------------------------------------------------------------------*
*--Begin of Commenting                   "
*--Get Partially processed orders
  MOVE: sy-mandt         TO nast-mandt,
        'V1'             TO nast-kappl,
        p_aufnr          TO nast-objky,
        p_aufnr          TO nast-parnr,
        sy-langu         TO nast-spras,
        sy-datum         TO nast-erdat,
        '1'              TO nast-nacha,
        '3'              TO nast-vsztp,
        'X'              TO nast-manue,
        sy-uname         TO nast-usnam,
        'DFLT'           TO nast-ldest,
        sy-langu         TO nast-tdspras,
        'Shop Floor Papers' TO nast-tdcovtitle,
        '1'              TO nast-tdarmod,
        'BUS2032'        TO nast-objtype.
 
*--Printer settings
  CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
    EXPORTING
      pi_nast       = nast
      pi_repid      = sy-repid
    IMPORTING
      pe_returncode = cf_retcode
      pe_itcpo      = ls_itcpo
      pe_device     = lf_device
      pe_recipient  = ls_recipient
      pe_sender     = ls_sender.
 
  MOVE-CORRESPONDING ls_itcpo TO ls_composer_param.
  ls_control_param-device      = 'PRINTER'.
  ls_control_param-no_dialog   = 'X'.
  ls_control_param-preview     = 'X'.
  ls_control_param-getotf      = ls_itcpo-tdgetotf.
  ls_control_param-langu       = sy-langu.
 
*--End   of Commenting                   "
*--Start of Addition                     "
  CLEAR:   ws_werks.
  SELECT   SINGLE werks
           INTO   ws_werks
           FROM   aufk
           WHERE  aufnr = p_aufnr.
 
  CLEAR:   ws_matnr.
  SELECT   SINGLE plnbez
           INTO   ws_matnr
           FROM   afko
           WHERE  aufnr = p_aufnr.
 
  CLEAR:   marc.
  SELECT   SINGLE matgr
           INTO   marc-matgr
           FROM   marc
           WHERE  matnr = ws_matnr
           AND    werks = ws_werks.
 
 
*--End   of Addition                     "
*  CHECK NOT ws_matnr IS INITIAL.       
  IF NOT ws_matnr IS INITIAL.           
 
*--Start of Addition                     
    SELECT   SINGLE matgr
             INTO   marc-matgr
             FROM   marc
             WHERE  matnr = ws_matnr
             AND    werks = ws_werks.
 
*--Start of Addition BY Rapidigm01_01+
  ELSE.
    marc-matgr = c_wip1.
  ENDIF.
*--End Of Addition BY Rapidigm01_01+
*--End   of Addition                     "
*--------------------------------------------------------------------*
END-OF-SELECTION.
*--------------------------------------------------------------------*
  PERFORM call_smartform.
 
*--------------------------------------------------------------------*
* F O R M    R O U T I N E S
*--------------------------------------------------------------------*
*&-------------------------------------------------------------------*
*&      Form  call_smartform
*&-------------------------------------------------------------------*
*       text
*--------------------------------------------------------------------*
FORM call_smartform.
 
  CLEAR: ws_ctrlp, ws_optns, ws_fname.
 
*--Start of Addition                                 "
 
  TRANSLATE marc-matgr TO UPPER CASE.
  IF marc-matgr = c_fas1 OR
     marc-matgr = c_fas2.
    PERFORM call_paper_a.
  ELSEIF marc-matgr = c_wip1 OR
         marc-matgr = c_wip2.
    PERFORM call_paper_b.
  ENDIF.
 
*--End   of Addition                                 "
 
 
ENDFORM.                    "call_smartform
 
*&-------------------------------------------------------------------*
*&      Form  call_paper_a
*&-------------------------------------------------------------------*
*       text
*--------------------------------------------------------------------*
FORM call_paper_a.
 
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
*>>BC SPARTA03    DATE: 19/05/2008
*      formname           = 'ZPPSF_SHOP_FLOOR_PAPER_A'  "Rapidigm03_01-
      formname           = 'ZPPSF_SHOP_FLOOR_PAPER_C'  "Rapidigm03_01-
*<<EC SPARTA03    DATE: 19/05/2008
*       formname  = 'ZPPSF_SHOP_FLOOR_PAPER_A_2893'   "Rapidigm03_01+
    IMPORTING
      fm_name            = ws_fname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
 
  CHECK NOT ws_fname IS INITIAL.
 
  CLEAR w_otfdata.
  ls_control_param-getotf = 'X'.
 
  CALL FUNCTION ws_fname
    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      = ' '
      is_nast            = nast
      aufnr              = p_aufnr
      flag_orig          = 'X'
    IMPORTING
      job_output_info    = w_otfdata
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
 
  LOOP AT w_otfdata-otfdata INTO w_otf.
 
    APPEND w_otf TO it_itcoo.
 
  ENDLOOP.
 
  CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
    TABLES
      otf_table = it_itcoo.
 
 
ENDFORM.                    "call_paper_a
 
*&-------------------------------------------------------------------*
*&      Form  call_paper_b
*&-------------------------------------------------------------------*
*       text
*--------------------------------------------------------------------*
FORM call_paper_b.
 
  DATA: ws_doknr TYPE draw-doknr,
        ws_dokvr TYPE draw-dokvr.
 
  CLEAR: ws_doknr, ws_dokvr.
 
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZPPSF_SHOP_FLOOR_PAPER_B'
    IMPORTING
      fm_name            = ws_fname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
 
  CHECK NOT ws_fname IS INITIAL.
 
  CLEAR w_otfdata.
  ls_control_param-getotf = 'X'.
 
  CALL FUNCTION ws_fname
    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      = ' '
      is_nast            = nast
      aufnr              = p_aufnr
      doknr              = ws_doknr
      dokvr              = ws_dokvr
      flag_orig          = 'X'
    IMPORTING
      job_output_info    = w_otfdata
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
 
  LOOP AT w_otfdata-otfdata INTO w_otf.
 
    APPEND w_otf TO it_itcoo.
 
  ENDLOOP.
 
  CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
    TABLES
      otf_table = it_itcoo.
 
 
ENDFORM.                    "call_paper_b
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Smartforms, SapScripts, PDF All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.