Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Purchase Requisition Header Long Text using Badi - ME_PROCESS_REQ_CUST.

Link to Content's target Space :

http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Development+and+Programming.

Applies to:

Sample code developed in ECC 5.0

Summary

This post narrates the use of BADI - ME_PROCESS_REQ_CUST, Method - PROCESS_HEADER for populating Purchase Requisition Header Text.

Author(s):  Vinod Kumar T

   
Company:     NIIT Technologies Limited
Created on:    02.12.2010
Author(s) Bio
Vinod Kumar is an ABAP consultant working with NIIT Technologies Limited.

Table of Contents

Processing Steps.


* Create Implementation for BADI using Transaction code SE19

  • Click on Method - PROCESS_HEADER
  • Check the Process mode using the LOCAL class parameter TRTYP
  • Populate the Text only if TRTYP is eqal to H (Creation)
  • Use the interface method IF_LONGTEXTS_MM~SET_TEXT of importing parameter IM_HEADER to create long text.
  • Use Text Object EBANH, Text ID B01 as parameters for above step.

Purchase Requisition Screen

Sample Code

Error rendering macro 'code': Invalid value specified for parameter 'lang'
  METHOD if_ex_me_process_req_cust~process_header.
*    SET purchase requisition text
*    text object : ebanh (customer order header texts)
*    text id : b01       (header note)

  DATA : lt_textlines TYPE mmpur_t_textlines,
         ls_textlines TYPE mmpur_textlines.

  DATA : lv_obj       TYPE REF TO object,
         lv_attr      TYPE string,
         lv_trtyp     TYPE trtyp.

  FIELD-SYMBOLS: <fs_lcl> TYPE ANY.

** Get transaction State 'H' - New **
  lv_obj ?= im_header.
  MOVE 'MY_STATE->TRTYP' TO lv_attr.
  ASSIGN lv_obj->(lv_attr) TO <fs_lcl>.
  lv_trtyp = <fs_lcl>.

  IF lv_trtyp EQ 'H'.   "New Purchase Requisition"
    REFRESH : lt_textlines.
    CLEAR   : ls_textlines.
    MOVE 'EBANH' TO ls_textlines-tdobject.
    MOVE 'B01'   TO ls_textlines-tdid.
    MOVE '*'     TO ls_textlines-tdformat.
    MOVE 'Test Header Note - Line 1' TO ls_textlines-tdline.
    APPEND ls_textlines TO lt_textlines.

    MOVE 'EBANH' TO ls_textlines-tdobject.
    MOVE 'B01'   TO ls_textlines-tdid.
    MOVE '*'     TO ls_textlines-tdformat.
    MOVE 'Test Header Note - Line 2' TO ls_textlines-tdline.
    APPEND ls_textlines TO lt_textlines.

* Call method to Update header text **
* im_count is be checked, otherwise this method will be
* called again after calling below method.
    IF im_count LE 1.
      CALL METHOD im_header->if_longtexts_mm~set_text(
        EXPORTING
          im_tdid      = 'B01'
          im_textlines = lt_textlines ).
    ENDIF.
  ENDIF.
ENDMETHOD.
 

Related Content

Useful Information

ME_PROCESS_REQ_CUST - BADI for Purchase Requisition