Vous êtes sur la page 1sur 13

Printing in purchasing

14-07-13

Printing of purchasing documents


Version 1.00
(4. March-2002)

Markus Wolf

Printing in purchasing

14-07-13

Introduction........................................................................................................................3
Documents....................................................................................................................................................3 Processes.......................................................................................................................................................3

Programs.............................................................................................................................3
Creating messages........................................................................................................................................3 Messages for new and changed documents..............................................................................................4 Message determination.............................................................................................................................4 Urging and reminding...............................................................................................................................5 Sending messages.........................................................................................................................................6 Message output.........................................................................................................................................6

The form MEDRUCK.......................................................................................................7 Customizing......................................................................................................................10


Maintain Message Determination Scheme.................................................................................................10 Assign Message Determination Scheme....................................................................................................10 Define message types.................................................................................................................................10 Fine-tune Control........................................................................................................................................11 Define Access-Sequence............................................................................................................................11 Define condition tables...............................................................................................................................12

Condition-/Message Entries............................................................................................12 If a message comes in.......................................................................................................13

Printing in purchasing

14-07-13

Introduction
The printing program does not only confess with the output of purchasing documents on the printer but with all methods of getting the documents to the vendor. This can be a printout, but also sending a purchasing document by fax or E-mail. The same program and form are used for the output of several documents and processes.

Documents
The documents that can be output are: Request for quotation Purchase Order Contract Scheduling Agreement Delivery Schedule

Processes
The processes that require the output of a document: Creating a new document Changing an existing document Creating a new delivery schedule for a scheduling agreement Urging/reminding a delivery

Programs
Different programs are involved in creating and sending out messages. Our programs are SAPMM06E, SAPFM06P and the function groups MEPO, MEDRUCK and MEDR. From basis it is mainly RSNAST00 and RSNASTED(for EDI).

Creating messages
Creating a message simply means to create a new record in the table NAST. KAPPL EF: PO EA: RFQ EV: outline agreement EL: delivery schedule Document number (EF, EA, EV) Document + item + scheduling line (EL) Message Type: NEU, MAHN,... (new, reminder, ...) Language that should be used for the output (language dependent forms) Partner (number) Partner function 1: Print output 2: Fax 5: External Send (E-Mail) 6: EDI 7: SAPoffice and others 1: Send with periodically scheduled job 3

OBJKY KSCHL SPRAS PARNR PARVW NACHA

VSZTP

Printing in purchasing 2: Send with job, with additional time specification 3: Send with application own transaction 4: Send immediately (when saving the application) 0: Not processed 1: Successfully processed 2: Incorrectly processed Activity flag. If this is set, no more messages of this type will be created for the related document

14-07-13

VSTAT AKTIV

For testing messages it is usually a good idea to set the dispatch-time (VSZTP) to 1 or 3, so that the message is not directly sent out. Sometimes just changing the dispatch-time from 4 to 3 may solve the problem. Especially for change messages there is the problem that creating the change-documents on the database (CDHDR, CDPOS) and the message output both run in update task (V2). The sequence of the processing is not guaranteed !

Messages for new and changed documents


Messages for new or changed documents are created from within the programs SAPMM06E and the function-group MEPO (since 4.6). The routines NACHRICHT_ERZEUGEN and NACHRICHT_MODIFIZIEREN are the most important. NACHRICHT_ERZEUGEN calls the function ME_MESSAGES_FIND to find out what message has to be created. NACHRICHT_MODIFIZIEREN will block or release a message dependent form its input parameter. This is used for documents in status Hold or if a release strategy is involved. The function ME_MESSAGES_FIND mainly calls the functions MM_PARTNERS_FOR_MESSAGING and MESSAGING to create the new message. At the end of ME_MESSAGES_FIND the XNAST should contain the new message.

Message determination
The message determination uses the same condition technique as it is used in Pricing. Generally speaking a message type is the same as a condition type, but the term condition type is more generic. Messages serve to send a purchase document or a dunning/reminder of a purchase document to the vendor. Messages can be created and send for Request for Quotations (RFQ), Purchase Orders (PO), scheduling agreements, delivery schedules and contracts. To transmit a message you can use different media like printer, fax, EDI, E-Mail or SAPoffice. If a message is being sent via E-Mail then there are two possibilities: 1. A PDF-document is attached to the mail. The mail itself does not contain any Purchase data. 2. The content of the message is written as ASCII-text into the mail itself. To set up the message determination of purchasing documents you have to assign a message scheme to a Purchasing document. But, setting up the message determination of purchasing documents is not mandatory. If no message determination is set, then the system always creates the message type NEU for a purchasing document. The prerequisite is that a printer can be determined. To determine a printer, the system checks in the following sequence. a) Is a printer assigned to a purchasing group? b) Is a printer maintained in the user defaults? c) Is a printer maintained in the user parameters?

Printing in purchasing

14-07-13

If no printer can be found at all, no message will be created. This is the case not only for printers, but for other media (fax, mail, etc.) as well. Note that this can also happen when the message determination is set up.
message determination scheme

... mesage type (e.g. 'NEU') mesage type (e.g. 'MAHN')

access sequence 1. condition table 2. condition table 3. condition table ...

access sequence 1. condition table 2. condition table ...

vendor, doc.type, purch.org.

vendor, doc.type

doc.type

When creating or changing a purchasing document the message determination will be always processed. The system looks up the message scheme that is assigned to the purchasing document. Each scheme contains several message types. The message types, themselves, are linked with condition tables, which contain the condition entries. For each message type there is an access sequence that determines in which sequence the condition entries for a message type are looked up. If a valid condition entry is found then the message type of that entry will be chosen, and a message in the purchasing document will be created. The relevant data of the message will be taken from the condition entry, e.g. (message) partner, (output) medium, dispatching time.

Urging and reminding


Urging messages/reminders are created by the report RM06ENMA. It is possible to select the documents that have to be examined. All positions of each selected documents are tested if a message has to be created. The messages are created in the routine NACHRICHTEN_ERZEUGEN by using the function ME_MESSAGES_FIND. With note 369948 an extensive diagnostic output has been added to this report. It was also changed that the messages are not sent out immediately. Originally messages were created, sent out (without any feedback whether sending was successful or not) and the counter in the scheduling line was increased. Now the messages are created, we wait for a feedback and the counter is only increased when the message was created successful and the message is sent out (function WFMC_MESSAGE_SINGLE) in a last step.

Printing in purchasing

14-07-13

Sending messages
The output is usually initiated by one of our programs. If the messages are customized for an immediate output these are the programs SAPMM06E, RM06ENMA and the function-group MEPO. If the output is initiated manually (or a batch-job) this is usually the report RM06ENDR(<=4.0) or RM06ENDR_ALV(>=4.5). The most important part is the routine USER_COMMAND from where the functions WFMC_MESSAGE_SINGLE (real output), WFMC_MESSAGE_SINGLE_NO_UPDATE (test, draft) or WFMC_MESSAGE_SINGLE_SCREEN (preview) are called. These functions call routines in the standard-report RSNAST00. In this report the routine PROGRAMM_AUFRUFEN is of special interest as in this routine the name of the printing program and the form are retrieved from the customizing and then the application and message-specific entry-routine in the printing program is called:
* don't process locked entries (but don't perform this check * in preview mode) if us_screen ne on. RETURNCODE = 3. check nast-snddr eq space. endif. IF NAST-NACHA = '1' AND NAST-TDRECEIVER IS INITIAL. NAST-TDRECEIVER = NAST-USNAM. ENDIF. CALL FUNCTION 'NAST_PROTOCOL_INITIALIZE'. *TNAPR = TNAPR. * try to perform all routines in TNAPR (RONAM - RONAM5) DO 5 TIMES VARYING RONAM FROM *TNAPR-RONAM NEXT *TNAPR-RONAM2 VARYING FONAM FROM *TNAPR-FONAM NEXT *TNAPR-FONAM2 VARYING PGNAM FROM *TNAPR-PGNAM NEXT *TNAPR-PGNAM2. CHECK PGNAM NE SPACE. TNAPR-RONAM = RONAM. TNAPR-FONAM = FONAM. TNAPR-PGNAM = PGNAM. IF TNAPR-RONAM NE SPACE OR TNAPR-PGNAM NE SPACE. * initial protocol entry for this processing program call

At this point we can set a breakpoint to check if the fields TNAPR-RONAM, FONAM and PGNAM contain the correct entries or if the customer uses his own program and form, we can change these data in the debugger. In the standard, the program should be SAPFM06P, the routine should be something like ENTRY_NEU or ENTRY_MAHN (dependent on the message) and the form should be MEDRUCK. If a problem only occurs with the customers form and program but not with our standard form and program -> Rmot

Con$ulting !

The entry-routines will then start reading the data concerning the current message and output the document. Until 4.5B the whole logic was located in the program SAPFM06P, from 4.6B on the entry-routines call the functions ME_READ_PO_FOR_PRINTING and ME_PRINT_PO from the function-group MEDRUCK.

Message output
When one wants to test the output of a message by RM06ENDR_ALV, there are 3 choices: 1. Output message: The message is really processed and sent to the device for which it was created (fax, printer, ) 2. Display message: A preview window is opened and the message is displayed on the screen. There is an important difference between the preview from ME21N and ME9F/K/L: ME21N: Not all data is already present on the database, so the printout may be incomplete. It is not possible to print change-messages, as in the ME21N no changes have been written to the database and so no change-documents (CDHDR, CDPOS) exist. ME9x: The document and all related data do exist on the database, so the preview should show exactly the same data as the printout. 6

Printing in purchasing 3.

14-07-13

Trial printout: The message is sent to the printer (no matter for what device the message was created). The status (NAST-VSTAT) is not changed.

The report RM06ENDR_ALV is usually not called directly but by one of the following transactions: Release <= 3.1I ME90: Transmit purchasing documents ME91: Reminding and Urging purchasing documents ME92: Monitor receipt of order acknowledgement Release >3.1I ME9A: Transmission of RFQs ME91A: Reminding and Urging of RFQs ME9F: Transmit POs ME91F: Reminding and Urging POs ME92F: Monitor receipt of order acknowledgement ME9L: Transmission of scheduling agreements ME9E: Transmission of delivery schedules ME91E: Reminding and Urging of delivery schedules ME92L: Monitor receipt of order acknowledgement ME84: Create delivery schedule releases ME9K: Transmit contracts ME92K: Monitor receipt of order acknowledgement Printer and fax settings as well as the dispatching time can be changed before transmitting a purchasing document. But, it is possible to exclude certain dispatching times for a message type. Messages of purchasing documents that are subject to release will not be displayed or transmitted. Special Information for Releases as of 4.6B: When issuing NEU-messages or change-messages the quantity of the goods receipt will be taken into account. Messages already processed can be processed again when using the function Repeat Output in the message overview. When urging a purchasing document it is not sufficient to create the urging message MAHN manually in the message overview of the document. Such a message will not be processed. The urging message has to be created by the appropriate transaction as this is the only possibility to determine the relevant data.

The form MEDRUCK


The one and only SAPscript form that is used for the output of purchasing documents is the form MEDRUCK. It can be displayed and modified with the transaction SE71. Usually the most recent form should be the MEDRUCK in P9C (at the moment) in client 000. This one should also be same as the form ZMEDRUCK_000 in U9C in client 800. The form consists of several windows. To examine them in detail:

Printing in purchasing

14-07-13

Printing in purchasing

14-07-13

In this window we can see the text-elements, for example: /E HEADER_TARGET_VALUE IN &'Target value 'EKKO-KTWRT& &EKKO-WAERS& This element in the form is printed out, when the following code in MEDRUCK (routine PRINT_HEADER) is performed:
* Zielwert, wenn vorhanden --------------------------------------------* IF ekko-ktwrt NE 0 AND nast-kappl NE 'EL'. "311394 CALL FUNCTION 'WRITE_FORM' EXPORTING element = 'HEADER_TARGET_VALUE' EXCEPTIONS OTHERS = 01. CLEAR sy-subrc. ENDIF.

These text elements are the link between the printing program and the form. So if something does not look right on the form, try to identify the affected text-element, set a breakpoint in the ABAP before the WRITE_FORM for this text-element and check the content of the variables listed in this text-element in the form.

Printing in purchasing
ABAP

14-07-13

Read data from database

select * from xy into table itab.

Print data into form

call function OPEN_FORM ... loop at itab. ... A = itab-a. call function WRITE_FORM EXPORTING element = 'TEXT1'. ... * B = itab-b. call function WRITE_FORM EXPORTING element = 'TEXT2'. ... endloop. ... call function CLOSE_FORM

SAPscript Form
/E TEXT1 IL &'Text A is 'A&

/E TEXT2 IL &'Text B is 'itab-b&

Customizing
The Customizing can be found in transaction OLME under Messages. Transactions that make the Customizing easier to use, but do not substitute are: NACE and OMGG. The subsequent customizing settings can be found in the branch Messages -> Output Control.

Maintain Message Determination Scheme


Purchasing document RFQ Purchase Order Contract Sched. Agreement/Expeditor Inbound Delivery Transaction code M/32 M/36 M/68 M/42 VNE7

You can define more than one scheme. But only one scheme can be assigned to one purchasing document type.

Assign Message Determination Scheme


You can set a dispatching time here as default. To make sure that the message determination works properly, the flags M for message determination (T161N-NFIND) and P for partner determination (T161N-NEUPR) should be set. The flag Rel. mess. (T161N-OBJLG) is only relevant for scheduling agreement releases. If this flag is set, the system creates a new message for each release. To each purchasing document only one message scheme can be assigned.

Define message types


Purchasing document RFQ Purchase Order Contract Transaction code M/30 M/34 M/38 10

Printing in purchasing Sched. Agreement/Expeditor Inbound Delivery M/40 VNE3

14-07-13

If a message shall be sent via EDI, in transaction WE20 the message type has to be maintained for the message partner. In the details of a message type several settings are available: General Data: One message scheme is assigned to the message type. In case a communication strategy shall be used, this has to be assigned here as well. Make sure that the flags for Access to conditions and Multiple issuing are set. The flag for Multiple issuing allows sending messages multiple times to the same partner this is relevant for urgings and reminders. If the flag for partner-independent output is not set, the system allows only certain partner roles for the message determination. To create change messages properly, the program FM06AEND and the form CHANGE_FLAG must be maintained. In case you want to send a message via Email and provide purchasing-document-specific information in the title of the Email you need to maintain the area Replacement of text symbols with the program SAPMM06E and form TEXT_SYMBOL_REPLACE. Default Values: Here you can maintain the dispatching time and the transmission medium. Processing routines In the branch Processing routines (in the folder tree on the left) the processing programs, form routines and forms can be assigned to the different media. This can also be done with the following transactions: Purchasing document Transaction code RFQ OMFD Purchase Order OMFE Contract OMFF Sched. Agreement/Expeditor OMFG

Fine-tune Control
Defines which message type shall be used for which print operation (new print, change print, urging letter, expediter). For the message type NEU the print operations 1 (new print) and 2 (change print) should be always maintained. In case scheduling agreements are used, the flag Update print-dependent data (T161M-DRUAB) should be selected. This flag controls whether print-dependent data should be updated when printing messages in case of scheduling agreement releases. Please note that when transmitting several message types, e.g. LPH1 and LPJ2, the flag should be set only for the last one. Purchasing document Transaction code RFQ OMQK Purchase Order OMQN Contract OMQO Sched. Agreement/Expeditor OMQP Inbound Delivery VNE3

Define Access-Sequence
This is a cross-client setting Purchasing document RFQ Purchase Order Contract Transaction code M/48 M/50 M/52 11

Printing in purchasing Sched. Agreement/Expeditor Inbound Delivery M/54 VNE4

14-07-13

The access sequence is assigned to the message type. Assigned can be only one access sequence. The access sequence serves as key combination for the creation of condition-/message entries. The access sequence orders the condition tables in a certain sequence. Tables with the smallest sequence number will be looked up first. The tables should be sorted from specific to unspecific. In this case the most specific condition table will be looked up first. The flag Exclusive prevents the system to look up subsequent tables in case one table was already matched. This prevents that more than one message will be created.

Define condition tables


Purchasing document RFQ Purchase Order Contract Sched. Agreement/Expeditor Inbound Delivery Transaction code M/58 M/61 M/67 M/64 VNE2

The condition tables contain those fields for which a purchasing document will be checked when determining the message. In the standard the tables delivered contain the following fields: Table name 025 026 027 Fields Purch. Org./Vendor for EDI Doc.Type/Purch.Org/Vendor Document Type

Communication strategy: (>= 4.6B) Menu Path: SPRO -> Basis Components -> Basis Services -> Message Control For each message type a communication strategy can be maintained. The communication strategy determines the sequence in which the system looks up the communication type (Email, Fax, Printer) of a partner. SAPConnect must support the communication types. The first communication type that has a valid entry will be used. The advantage of a communication strategy is that you, for example, can send a message primarily by Email. All partners without an Email-address shall receive their messages by fax. All partners without Email and fax shall receive the message by mail (Printer).

Condition-/Message Entries
After having set up the customizing it is mandatory to fill the condition tables. As long as the condition tables are not filled there will be no message determination! Menu path: Logistics -> Materials Management -> Purchasing -> Master Data -> Messages Purchasing document RFQ Purchase Order Contract Sched. Agreement/Expeditor Service Entry Sheet Inbound Delivery Transaction code MN01 MN03 MN04 MN06 MN07 MN09 MN10 MN12 MN13 MN15 MN24 MN26

12

Printing in purchasing

14-07-13

In the condition entry at the latest, a transmission medium has to be maintained. Otherwise a message will not be created. The settings in the condition entry always override all other settings that might have been maintained in other parts of the customizing. Via the determination analysis, which can be found within the message overview of a purchasing document, it is possible to identify why a message was created or not. When using FAX or Email as transmission medium please make sure, that a valid fax number or Emailaddress in the vendors master data is maintained. In case a message should be transmitted immediately, the flag Print immediately in the communication data should be set. Otherwise the message is send to the spool and the transmission has to be continued from there, e.g. via a job. When holding a faulty purchase order in ME21N, no message will be created. The message determination will wait until the purchase order is no longer faulty.

If a message comes in
If a customer is having problems, the following things should be checked: Does the problem appear with standard program and form ? Are partners correctly determined ? Is a message created automatically ? (make sure that the dispatch time is set to 3) Is it possible to enter a message manually and send it out ?

13

Vous aimerez peut-être aussi