SAP Materials Management
ME59 , ME59N are standard SAP transactions for converting PR to PO automatically either in the background or foreground when optimized procurement process is used. ie. PR automatically converted to PO when source of supply is assigned in PR.
This document explains the various enhancement options available with these standard transactions.
Refer to : PO Document Type determination in ME59 ME59N for more details on how PO document type determination works in SAP.
Enhancement : ME59
The modification solution uses the table T160. You can add an entry using table maintenance (transaction SM31 or SE16) for transaction ME59 and set a default document type (unfortunately not using the Customizing transaction OMH5) since this is restricted to the transactions, where the default document type is also applied in the standard system).
To be able to use the default value in transaction ME59, implement the program change specified below in the report RM06BB10 (SAP Note : 114213) . The modification is only possible for the simplest case (no stock transport order, no split according to item category) and gives highest priority to the default document type if it is allowed according to Customizing.
This enhancement provides higher priority to ME59 setup than ME21.
Refer to : PO Document Type determination in ME59 ME59N for understanding the sequence of document type determination using configuration.
Enhancement : ME59N
BADI : ME_BSART_DET can be used for defaulting PO document type based on business requirements. This enhancement spot has a higher priority and will override all the other sequence and default the document type entered here.
You have to create a new enhancement implementation and add the required code. ABAPer can help.
Sample Implementation where i am assigning PO document type based on PR document type. Additional logic can be included based on business requirements.
Contact us in case you need more details or would like to discuss about your specific business requirements.
Reference
PO Document Type determination in ME59 ME59N