Posted: Sat Jan 31, 2009 7:00 pm Post subject: Download a smartform into the PDF Format
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.
*--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 '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.
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.