While Creating Purchase Requisition in ME51n, Purchase Info Record number gets populated automatically, however supplier material is not assigned even though its maintained in the Purchase Info Record.
See below supplier material number is maintained in Info Record.
Implement BADI – ME_PROCESS_REQ_CUST
METHOD if_ex_me_process_req_cust~process_item. DATA: l_preq TYPE mereq_item, lv_idnlf TYPE idnlf. CALL METHOD im_item->get_data RECEIVING re_data = l_preq. IF ( l_preq-infnr IS NOT INITIAL ) AND ( l_preq-idnlf IS INITIAL ) . " if info record is found. " Add idnlf from purchase info record SELECT SINGLE idnlf INTO l_preq-idnlf FROM eina WHERE infnr = l_preq-infnr . IF sy-subrc = 0. CALL METHOD im_item->set_data EXPORTING im_data = l_preq. ENDIF. ENDIF. ENDMETHOD.
Above method will fetch supplier material from Purchase Info Record to Purchase Requisition.