04-07-2010 3:36 PM
Hi all,
I have Purchase Requisitions from external system getting posted into SAP as idocs and creating a PO. Sometimes the same PR is sent twice which is creating a duplicate PO in SAP.
Is there a Function module / BAPI to check whether the PR has alrady been posted in SAP ?
Thanks,
Surya
04-07-2010 4:05 PM
Hello,
You may make use of method PROCESS_ITEM of the BADI ME_PROCESS_REQ_CUST (SE18/SE19) to check duplicates of Purchase Requisitions.
Thanks,
Venu
04-07-2010 4:25 PM
Hi Venu,
Just days back our system is upgraded from 4.7 to 6.
I can able to see the method.. Could you please tell where and how to use this method..
Thanks,
Surya
04-08-2010 11:58 AM
Hi all,
My requirement here is, Whenever the the data is read and before the PO is being created, I have to keep a check with reference to PR number (EKKO-UNSEZ) to see whether a PO for this particular PR is already created in SAP or not.
I have to use a FM / BAPI for this purpose.
Can you please suggest a way to do this ?
Thanks,
Surya.
04-08-2010 12:17 PM
Create an implementation of Badi " ME_PROCESS_PO_CUST".
Add the following code in method "CHECK"
method if_ex_me_process_po_cust~check.
types : begin of ty_ekko,
ebeln type ebeln,
unsez type unsez,
end of ty_ekko.
data : it_ekko type standard table of ty_ekko.
data: ls_mepoheader type mepoheader.
ls_mepoheader = im_header->get_data( ).
if ls_mepoheader-unsez is not initial.
select ebeln unsez
from ekko
into table it_ekko
where unsez = ls_mepoheader-unsez.
if sy-subrc eq 0.
Message 'Purchase Requistion already referenced' type 'E'.
endif.
endif.
endmethod.
Regards
Vinod
04-09-2010 1:38 PM
Hi Vinod,
Thanks for the reply.
May I know what I have to pass in the CALL METHOD.
And what ls_mepoheader = im_header->get_data( ). will fill in the ls_mepoheader.
what are the values to be passed to the method.
Pleaes let me know these as I am very new to this..
Thanks in advance,
Surya.
04-09-2010 4:54 PM
Hi surya,
In "ls_mepoheader = im_header->get_data( ). ", you dont need to pass any parameters. This method will pass the currently processing purchase order header data into the structure "ls_mepoheader". Once the header data is assigned to "ls_mepoheader" you can use it for further processing.
Regards
Vinod
04-12-2010 10:07 AM
Hi Vinod,
The FM that processes the IDoc segments and creates a PO ( by calling a PO) is IDOC_INPUT_PORDCR.
So in this FM, after the segments of the Idoc are read I have to place to code for checking whether the PO has been created with a particular UNSEZ.
How should I call the method and what parameters to be passed. Could you please explain me the flow of this particular method .?
Thanks in advance,
Surya.
04-12-2010 10:22 AM
If you are creating the PO through IDOC, do the validation in the Customer Exit "EXIT_SAPLMEWP_002" (Enhancement : "SAPLMEWP"). UNSEZ field value is available in Bapi structure field "PO_HEADER_ADD_DATA-OUT_REF"
Example code:
select eblen unsez from ekko
into <itab>
where unsez = PO_HEADER_ADD_DATA-our_ref.
if sy-subrc eq 0.
raise <appropriate error>.
endif.
Regards
Vinod