Print t Text File at OS Level Print t Text File at OS Level Applies t: All SAP prducts based n ABAP stack Summary A tutrial n hw t print t text file at OS Level frm SAP. The tutrial prvides detailed step-by-step cnfiguratin details t create a printer which prints t text file at OS level in designated File System. Example cnfiguratin is dne fr SAP prducts installed n HP-UX 11i. Authr(s): Harpreet Singh Cmpany: Accenture (Bangalre India) Created n: 29 September 2006 Authr Bi I am wrking as SAP-BASIS Team Lead at Accenture. I have arund 6Yrs in SAP-BASIS experience which include tw implementatin prjects. Certificatins: WAS 640 certified technlgy cnsultant OCP (Oracle Certified prfessinal DBA Track) SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 1
Print t Text File at OS Level Table f Cntents Applies t:... 1 Summary... 1 Authr Bi... 1 Business Requirement... 2 Prcedure... 2 Example... 5 Disclaimer and Liability Ntice... 7 Business Requirement Yu want t redirect the spl utput t a text file at OS Level rather than the Real Printer. Prcedure Execute transactin SPAD Click utput devices and switch t change mde Click Create SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 2
Print t Text File at OS Level On Device Attribute tab Prvide necessary details like Output Device name Shrt Name Device type as ASCIIPRI : Sme generic ASCII printer Spl Server prvide name f the app server running spl wrk prcess and whse file system yu wuld like t use fr print files. Prvide ther details as required. On Access methd tab prvide details such as Hst Spl Access methd as L : Print Lcally Using LP/LPR Hst printer any name yu wuld like t have this is just a dummy name. Click Edit Cmmand Set Yu will get ne mre bx in Access tab named Cmmand Set ID as shw belw SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 3
Print t Text File at OS Level Prvide ne character name and duble click n that. Fllwing screen will ppup Prvide the necessary details as described belw Descriptin : Any descriptin fr cmmand set ID Cmmand t transfer print data : Here (in belw Fig) /usr/bin/cp &F <File System Path> This will cpy the cntents f utput t file system yu specified in place f <File System Path> &F is the file name with default strage path and default strage path is data directry fr instance i.e. /usr/sap/<sid>/<instance>/data and default file name is <OUTPUT_ID>.<SID> Secnd part after semicln is the script at OS level yu wuld like t execute after cmpleting the first step, this wuld be required t rename the file t understandable file name. Yu can pass n parameter t this scripts fllwing parameter are allwed &P : utput device &F : transfer file &f : name f transfer file withut path name share (as f 4.0A) &p : path name f transfer file (as f 4.0A) &C : number f cpies &I : jb name f SAP spler &J : jb name f SAP spler with database name &L : layut &M : client f wner &O : wner &m : printing client SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 4
Print t Text File at OS Level & : printing user &t : phne number (FAX) &T : title &R : recipient (cver sheet) &D : department (cver sheet) &S : SAP name f utput device &Y : pririty &U : UNIX cver sheet requested? ('N'=N, 'X'=Yes, 'D'=Default) &N: number f the spl request (as f Release 4.5A) &n: number f the utput request (as f Release 4.5A) c: number f pages (as f Release 4.0A) &s: field 'Suffix2' f the spl request (as f Release 4.0A) Cmmand t query jb status : This is required t knw the status f the utput at OS level, if this nt that much imprtant yu can prvide ech k but dn t leave it blank. Click Enter and Save the printer definitin Its dne Example Fr example if yu wuld like t create the file t /intf/rq1/utb/mm/pending and rename the file t <CREATOR>-<TITLE>-<SPOOL ID>_<YYYYMMDDHHMMSS>.dne Create the fllwing script (say name spl_utput_t_s.sh and placed at /var/adm/scripts/basis/general ) SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 5
Print t Text File at OS Level J=$1 N=$2 O=$3 T=$4 E=".dne" d=`date '+20%y%m%d%H%M%S'` FN=`ech $J awk -F/ '{printf("%s",$7)}'` FN1=${O}-${T}-${N}_${d}${E} mv /intf/rq1/utb/mm/pending/${fn} /intf/rq1/utb/mm/pending/${fn1} and in Cmmand t transfer print data enter /usr/bin/cp &F /intf/rq1/utb/mm/pending/ ; /var/adm/scripts/basis/general/spl_utput_t_s.sh &F &N &O &T Here parameter &F &N &O &T are passed t scripts. SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 6
Print t Text File at OS Level Disclaimer and Liability Ntice This dcument may discuss sample cding r ther infrmatin that des nt include SAP fficial interfaces and therefre is nt supprted by SAP. Changes made based n this infrmatin are nt supprted and can be verwritten during an upgrade. SAP will nt be held liable fr any damages caused by using r misusing the infrmatin, cde r methds suggested in this dcument, and anyne using these methds des s at his/her wn risk. SAP ffers n guarantees and assumes n respnsibility r liability f any type with respect t the cntent f this technical article r cde sample, including any liability resulting frm incmpatibility between the cntent within this dcument and the materials and services ffered by SAP. Yu agree that yu will nt hld, r seek t hld, SAP respnsible r liable with respect t the cntent f this dcument. SAP DEVELOPER NETWORK sdn.sap.cm BUSINESS PROCESS EXPERT COMMUNITY bpx.sap.cm 2006 SAP AG 7