Copy PR Header Note Text To PO Header Text Using Userexit
Copy PR Header Note Text To PO Header Text Using Userexit
STEP 2 Create a Purchase Requisition with header Note text in ME51N transaction
Click here to continue.. 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
While calling the function module SAVE_TEXT, we have to specify the above data.