Copy PR Header Note Text to PO Header Text using Userexit

...Previous

STEP 3

Build logic to copy the PR header note text to PO header text in Include ZXM06U43.

There are two function modules used here

1.READ_TEXT -> Read the header note text from the PR

2.SAVE_TEXT -> Save the PR header note text to PO header text while saving the Purchase Order

Source Code

DATA : lt_tekpo  TYPE TABLE OF bekpo,
       ls_tekpo  
TYPE bekpo,
       lt_lines  
TYPE TABLE OF tline,
       lv_tdname 
TYPE thead-tdname,
       ls_header 
TYPE thead.

lt_tekpo[] = tekpo[].

LOOP AT lt_tekpo INTO ls_tekpo.

lv_tdname = ls_tekpo-banfn.

  
CALL FUNCTION 'READ_TEXT'
    
EXPORTING
      
client                  = sy-mandt
      
id                      'B01'
      
language                = sy-langu
      name                    = lv_tdname
      object                  = 
'EBANH'
    
TABLES
      
lines                   = lt_lines
    
EXCEPTIONS
      
id                      1
      
language                2
      name                    = 
3
      not_found               = 
4
      object                  = 
5
      reference_check         = 
6
      wrong_access_to_archive = 
7
      
OTHERS                  8.
  
IF sy-subrc <> 0.
    
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  ls_header-tdobject = 
'EKKO'.
  ls_header-tdid     = 
'F01'.
  ls_header-tdspras  = sy-langu.

  
CALL FUNCTION 'SAVE_TEXT'
    
EXPORTING
      
client   = sy-mandt
      
header   = ls_header
      
insert   'X'
    
TABLES
      
lines    = lt_lines
    
EXCEPTIONS
      
id       1
      
language 2
      name     = 
3
      object   = 
4
      
OTHERS   5.
  
IF sy-subrc <> 0.
    
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDLOOP.

STEP 4

Create PO and save it through ME21N, then the PR header note text will be copied to PO header Text

Header text information for the Purchase order is

While calling the function module SAVE_TEXT, we have to specify the above data.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image