Add Custom Field to Purchase Requisition – MEREQ001

I looked for a detailed document about ME51N-ME52N-ME53N add custom field in SCN but i have not found fully described. That’s why i decided create this blog.

Symptom :

Some customers need to add custom fields for their purchasing request documents then try to copy this field other subsequent purchasing documents such a purchase order. You can benefit from this blog for these requirements.

Related OSS Notes : 

1- Add ZZUSER to CI_EBANDB .

2- Create subscreen and fill out modules.

Attributes :

Layout :

Flow Logic :

ABAP Codes :

PBO –> Status module.

*----------------------------------------------------------------------* *& Module STATUS_0111 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0111 OUTPUT. */ M.Ozgur Unal - 26.10.2017 - SP IT *& ZXM02U01 include dan gönderildi. IMPORT flag_input FROM MEMORY ID 'Z_FLAG_INPUT_ZXM02U01'. LOOP AT SCREEN. IF screen-group1 = 'ZPR'. IF flag_input = 'X'. screen-input = 1. ELSE. screen-input = 0. ENDIF. MODIFY SCREEN. ENDIF. ENDLOOP. ENDMODULE.

PAI –> Field on request

*----------------------------------------------------------------------* *& Module CHECK_ZZUSER INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE check_zzuser INPUT. */ M.Ozgur Unal - 26102017 - SP IT DATA : ls_zfi_tek_ony TYPE zfi_tek_ony. CHECK NOT ci_ebandb-zzuser IS INITIAL. SELECT SINGLE * FROM zfi_tek_ony INTO ls_zfi_tek_ony WHERE zzuser EQ ci_ebandb-zzuser. IF sy-subrc IS NOT INITIAL. MESSAGE e163(zmm). ENDIF. ENDMODULE.

Note : I did not fill out user_commad_0111 so that there is no details !

3- Development for EXIT_SAPLMEREQ_001 –>  INCLUDE ZXM02U01 .

*&---------------------------------------------------------------------* *& Include ZXM02U01 *&---------------------------------------------------------------------* */ M.Ozgur Unal - 261017 - SP IT DATA : ls_mereq_item TYPE mereq_item. DATA : cur_activity TYPE aktvt. * clear eban values if no PReq item IF im_req_item IS INITIAL. CLEAR: ci_ebandb. ELSE. * read item data from system ls_mereq_item = im_req_item->get_data( ). * fill customer field with old values ci_ebandb-zzuser = ls_mereq_item-zzuser. ENDIF. CALL METHOD im_req_item->get_activity RECEIVING re_aktvt = cur_activity. CASE cur_activity. WHEN 'A'. flag_input = space. WHEN 'V'. flag_input = 'X'. "Modify ENDCASE. * MEREQ001 Enh customer sub screen de kullanılacak. FREE MEMORY ID 'Z_FLAG_INPUT_ZXM02U01'. EXPORT flag_input FROM flag_input TO MEMORY ID 'Z_FLAG_INPUT_ZXM02U01'.

4- Development for EXIT_SAPLMEREQ_003 –>  INCLUDE ZXM02U03 .

*&---------------------------------------------------------------------* *& Include ZXM02U03 *&---------------------------------------------------------------------* */ M.Ozgur Unal - 261017 - SP IT DATA: l_mereq_item TYPE mereq_item, eban TYPE eban, l_aktvt TYPE aktvt. IF NOT im_req_item IS INITIAL. " read item data from system l_mereq_item = im_req_item->get_data( ). l_aktvt = im_req_item->get_activity( ). IF l_aktvt EQ 'A'. ELSEIF l_aktvt EQ 'V' OR l_aktvt EQ 'H'. IF l_mereq_item-zzuser NE ci_ebandb-zzuser. l_mereq_item-zzuser = ci_ebandb-zzuser. ex_changed = 'X'. ENDIF. IF ex_changed = 'X'. CALL METHOD im_req_item->set_data( l_mereq_item ). ENDIF. ENDIF. ENDIF.

RESULTS :

Purchase Requisition 

EBAN is updated correctly !

I hope that you will need to copy custom fields to subsequent documents such a purchase order. You have to add same field to subsequent purchasing document and fill out fields in subscreen referance to purchase requisition.

If you want to copy PR custom field to PO custom field with a referance, you can benefit from PBO of customer screen in SAPMM06E 0111 CUSTSCR1 SAPLXM06 0111 ! (Screen exit PO)

Enhancement IMP –> MM06E005 Customer fields in purchasing document .

Read custom field PR .

 IF i_aktyp EQ 'H' OR i_aktyp EQ 'V' SELECT SINGLE zzuser FROM EBAN INTO @DATA(wa_eban) WHERE ebeln = ekpo-ebeln AND ebelp = ekpo-ebelp. IF sy-subrc IS INITIAL. gs_ci_ekpo-zzuser = wa_eban-zzuser. ENDIF. ENDIF.

Thanks for your time !

M.Ozgur Unal

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !

Do you want to Get SAP Courses?

Get SAP Courses and Training, Videos, Other Useful Resources
Join Now
Written by SAP Expert TEAM.
close-link