11-28-2005 4:52 PM
Hi,
is there a function, that lets you print a purchase order from the system, if not , what would the best way of doing this be?
I did try
Function 'ME_DISPLAY_PURCHASE_DOCUMENT'
which works , I belive , if the document has been printed before, but not if it has not, am I correct?
Once printed I need the spool no.
Thanks
11-28-2005 5:17 PM
Create a Z Function module using the code below.
One import parameter for PO num say I_PO.
You can have few exceptions.
Declare NAST Table in the global data of the function group.
Replace 'XXXX' with proper values.
clear nast.
Raise exception if there is no delivery no.
IF I_PO IS INITIAL.
RAISE Exception.
ENDIF.
Fill in the NAST header line for this label.
CLEAR NAST.
NAST-OBJKY = I_PO.
NAST-LDEST = 'XXXX'.
NAST-SPRAS = 'EN'.
NAST-TDSPRAS = 'EN'.
NAST-DIMME = 'X'. " Print Immediate' flag
NAST-DELET = 'X'. " Release after print'
NAST-ANZAL = 1. " Specify one copy
NAST-NACHA = 1. " output to printer
NAST-VSZTP = 4.
NAST-KAPPL = 'XXXX'.
NAST-KSCHL = 'XXXX'.
NAST-EDIKEY = 0.
NAST-MANUE = 'X'.
NAST-VSTAT = '0'. " set status = not yet processed
NAST-ERUHR = SY-UZEIT.
NAST-ERDAT = SY-DATUM.
NAST-USNAM = SY-UNAME.
Insert entry into NAST
INSERT NAST.
COMMIT WORK AND WAIT.
Call sap STANDARD routines to process the message request
LW_SUBRC = 999.
PERFORM EINZELNACHRICHT(RSNAST00)
USING LW_SUBRC.
IF LW_SUBRC <> 0.
RAISE Exception.
ENDIF.
Thanks,
Rajesh.
11-28-2005 6:53 PM
hi,
tried that in a small prog,
not sure what the Kappl parameter should be, but anyway it complains about
LW_SUBRC being unknown.
Thanks
11-28-2005 6:56 PM
11-28-2005 7:25 PM
hi,
now keep getting
Processing program missing for output ZARG (medium 1)
REPORT zstprintpreview2 .
TABLES nast.
DATA lw_subrc LIKE sy-subrc.
CLEAR nast.
Fill in the NAST header line for this label.
CLEAR nast.
nast-objky = '4500006302'.
nast-ldest = '$LT4F'.
nast-spras = 'EN'.
nast-tdspras = 'EN'.
nast-dimme = 'X'. " Print Immediate' flag
nast-delet = 'X'. " Release after print'
nast-anzal = 1. " Specify one copy
nast-nacha = 1. " output to printer
nast-vsztp = 4.
nast-kappl = 'XXXX'.
nast-kschl = 'ZARG'.
nast-edikey = 0.
nast-manue = 'X'.
nast-vstat = '0'. " set status = not yet processed
nast-eruhr = sy-uzeit.
nast-erdat = sy-datum.
nast-usnam = sy-uname.
Insert entry into NAST
INSERT nast.
COMMIT WORK AND WAIT.
Call sap STANDARD routines to process the message request
lw_subrc = 999.
PERFORM einzelnachricht(rsnast00)
USING lw_subrc.
IF lw_subrc <> 0.
RAISE exception.
ENDIF.
11-28-2005 7:30 PM
11-28-2005 8:44 PM
This is what I had in there
AUFB Dunning Ord Confirm
ERIN Reminder
MAHN Dunning
MAIL New PO printout
NEU New PO printout
NEUS New PO printout
ZEDI Glens EDI Output
And i've tried it with NEUS
?
11-30-2005 1:27 AM
Hi
Rajesh Mandalapu's suggestion has fixed the problem,
The spool number is returned in sy-msgv1, how reliable is it use this as the spool number I have just created, in a multi user environment?