Ir al contenido principal

BADI ME_PROCESS_PO_CUST para pedidos de compra

 En este post vamos a ver una de las BADI´s mas utilizadas dentro de SAP. No es otro que la BADI ME_PROCESS_PO_CUST que se utiliza para incluir funcionalidad dentro de los pedidos de compra (ME21NME22NME23N) a través de los diferentes métodos que pone a nuestra disposición.


Para los que no tengáis claro que es una BADI os dejo el siguiente link del blog donde ya hablamos sobre ellas:

El primer paso si queremos utilizar esta BADI sería implementarla y activarla. Para ello debemos utilizar la transacción SE19. Aquí introduciremos el nombre de la BADI y pulsaremos sobre el botón "IMPLEMENTAR" como se ve en la siguiente imagen:




Tras esto el sistema nos pedirá que asignemos un nombre a nuestra implementación.




Tras aceptar el sistema nos mostrará la implementación que se va a crear. Podremos ver todos los métodos que están disponibles y en los que vamos a poder introducir código. Además nos va a mostrar la clase sobre la que vamos a trabajar para introducir nuestra lógica. En nuestro caso la clase se va a llamar ZCL_IM_ME_PROCESS_PO_CUST.




Finalmente grabamos y activamos. Ahora ya tenemos implementada la BADI y vamos a poder comenzar a introducir nuestro código a través de la clase que hemos comentado anteriormente. Para modificar la clase ejecutamos la transacción SE24.




Dentro veremos todos los metodos disponibles sobre los que vamos a poder trabajar. 




En este punto ya lo que hace falta es identificar cual de los método se adecua mas a lo que necesitamos. Como veis hay unos cuentos y cada uno se ejecuta en un punto diferente de la ejecución. Os comento algunos de ellos: 
  • IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER: Se lanza cuando modificamos algún dato de cabecera y por ejemplo el usuario presiona enter.
  • IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM: Se lanza cuando modificamos algún dato a nivel de linea y por ejemplo el usuario presiona enter.
  • IF_EX_ME_PROCESS_PO_CUST~PROCESS_ACCOUNT: Se utiliza para tratar los datos de imputación que haya introducido el usuario. Por ejemplo podemos utilizarlo para chequear un centro de coste o una cuenta en función del material.
  • IF_EX_ME_PROCESS_PO_CUST~CHECK: Como su nombre indica es un método marcado para realizar controles. Tiene un parámetro de salida que nos permite marcar la ejecución como errónea.
Podéis ir explorando el resto. Mi recomendación es que cuando necesitéis incluir lógica marquéis breakpoints en los diferentes métodos y ejecutéis la creación ó modificación de un pedido de compras. De esta forma veréis donde para cada método y que información traen sus parámetros. De está forma va a ser mas sencillo decidir donde introducir vuestro código.

FUENTE:
http://sapuniverse.blogspot.com/2016/01/badi-meprocesspocust-para-pedidos-de.html

Comentarios

Entradas más populares de este blog

A to Z of OLE Excel in ABAP 7.4

  SAP users, both business and end users always need to download the output of a report to spreadsheet and do their analytics.   The standard excel output from a report is very simple process but it is old fashioned and the spreadsheet looks quite boring.  There is no default formatting and the users have to do all the hard work of changing the fonts, coloring the texts, marking the borders etc. Updated 16th Aug 2019  –  If you are working in non-ABAP 7.4 (below), there is complete reference program for you too. Go to the end of this article.  Thank you  Legxis  ( LeonievonK ) for the share. I acknowledge, whatever I mentioned above can be achieved in many ways programmatically. We can do it in the old traditional ABAP way but  providing multiple tabs in the spreadsheet and formatting is quite tricky with non  OLE  method. OLE = Object Linking and Embedding The high level agenda of this article is to be the  G.O.A.T.  (please google it if you do not know the full form)  of OLE Excel Gu
How to add custom field in Additional B Tab for SAP Sales Order In this article we want to explain step by step how to add custom field in SAP Sales Order transaction VA01/VA02/VA03. This time Mr ABAPGurus will give the tutorial of enhancement to add custom field in SAP Sales order. In this sample we will add new custom field for comments and customer satisfaction, this data will save into separate table from SAP Standard table ( VBAK / VBAP ). SAP provided us with ADDITIONAL TAB in the sales order transaction ( VA01/VA02/VA03 ) which allow customer to add custom fields.  T he different between ADDITIONAL A and ADDITIONAL B is the ADDITIONAL A for field which already predefine in Sales Order Header ( VBAK ) fields and ADDITIONAL B is for field that freely define. This sample we will use ADDITIONAL B because we will store data from customer satisfaction into Z database table. 1. Create one Z table using SE11 SAP Transaction code. 2.Using SE38 Transaction code and ope

VOFM

Creating VOFM custom routine, functionality same as SAP standard routine 103 with Additional Functionality 1.    Introduction 1.1   Document Purpose 1.2    This is the document helps you to create custom routine for sales order for below specific requirement: Functional description: In case of sale order with the SD document category ‘K’ or ‘L’ or ‘H’ related to an invoice, we need to fill the fixed value date (VBKD_VALDT) with the billing reference date (VBRK_FKDAT). For example: Invoice 90001111, the billing date is 22.07.2013 If we create a sale order related to this invoice, we want the fixed value date equal to the billing reference date. As per the requirement: Sap standard routine ‘103’ triggers whenever sales order is being created with reference. Sap standard routine is configured in VOFM transaction as: Sap standard routine ‘103’ has the functionality of copying the billing document header data and billing document line item data into the