‎2013 Sep 10 4:26 PM
Hallo,
I'm not sure, if this is the right place to ask for this, but I need to get all open purchase orders for some given materials.
The problem is i've only got access to the BAPI's (i'm using them in an interface to another system)
and sometimes there are many (maybe about 3000) materials to check at once.
I know I could use BAPI_PO_GETITEMS and check for every material, but as mentioned
there can be a large number of materials to check and so this is REALLY slow.
I've found the Transaction ME2M in which you can provide a list or range of materials.
Is there something like this as a BAPI?
Best wishes,
Torben
‎2013 Sep 11 9:41 PM
Hi Torben,
I don't think there will be a standard BAPI for this. It is however not much effort to write a custom BAPI (which is actually just an RFC enabled function). If you know how you define an 'open purchase order', this should be done in about an hour or so. Because it is custom code, it will give you flexibility and performance for mass operations, if correctly written.
If you can give me a definition for an 'open purchase order', I can give you the select code and that would just leave you with the definition of the data structures and the RFC function.
Regards,
Freek
‎2013 Sep 11 9:41 PM
Hi Torben,
I don't think there will be a standard BAPI for this. It is however not much effort to write a custom BAPI (which is actually just an RFC enabled function). If you know how you define an 'open purchase order', this should be done in about an hour or so. Because it is custom code, it will give you flexibility and performance for mass operations, if correctly written.
If you can give me a definition for an 'open purchase order', I can give you the select code and that would just leave you with the definition of the data structures and the RFC function.
Regards,
Freek
‎2013 Sep 12 12:15 PM
Hi Freek,
Thanks for the answer, I'll need to talk with my customer about this, if they want to have some custom code like this in their system (actually I'm only responsable for the other software and the interface between both).
But just to answer your question: An open purchase order is defined by my customer as an purchase order which has items left for receipt. So actually for them all orders that can be viewed by ME2M with the selection filter "WE101" are open.
Thanks again,
Torben
‎2013 Sep 12 12:57 PM
Ok. Let me know if you need further information.
Regards,
Freek
‎2013 Sep 11 9:59 PM
The tables 'ekko' and 'Ekpo' have this data but you better check with a functional MM so I suggest you ask this community:
http://scn.sap.com/community/erp/logistics-mm
Hope I helped
‎2013 Sep 12 4:29 AM
Please use the Std Functionality available in SAP .
Use the Transaction code - ME2M ,
input your required materials
select the "scope list ' as required
also select the "selection parameter" -"WE101" For the open purchase order
Hope this will meet your requirements
‎2013 Sep 12 12:20 AM
Hi
I dont know much about BAPI, but you can try with ME2M by using selection parameter WE101.
Thanks,
Santosh
‎2013 Sep 12 5:54 AM
‎2013 Sep 12 6:34 AM
Hi Torben,
You don't need to go for BAPI. Simply, use ME2N Transaction.
- Put your Material list or PO list
- Choose selection parameter 'WE101' for all POs due for Good Receipt and use 'RECHNUNG' for all POs open for Invoicing.
Also, try to take use of table EKBE (PO History) and field BEWTP (PO History Cat.) as E.
Regards,
Sumit Pukale
‎2013 Sep 12 8:22 AM
Sadly I need to go for BAPI, because as I've said I'm not using the Client but an Interface with another Software and from there the only things I can access are the BAPIs, so yeah, I know the ME2N Transaction and how to display the Data from there and that's why I thought there could be a similar BAPI for this.
Yes I've checked for these BAPIs but they need an order number as input and I've only got the material numbers.
Regards,
Torben
‎2013 Sep 12 9:42 AM
Hi,
The report ME2M helps to provide open purchase order report for material.
Do input Scope of list WE101 and execute.
The other option is use table EKBE ( Purchase order history).
check for Receipts & Inovice option field and you get list of open PO's.
In MMBE --- Environment -- List of open PO's are available.
Hope this helps.
‎2013 Sep 12 12:18 PM
Hi Torben,
I hope you need to create your own custom FM with help of your Functional Consultant , Check some logic may be help full to achieve your actual requirement .
SELECT * FROM EKPO INTO TABLE I_EKPO
WHERE MATNR EQ S_MATNR " Material Number
AND BSTYP EQ 'F'
AND LOEKZ EQ SPACE.
LOOP AT I_EKPO INTO WA .
*Get the Header Document
CLEAR EKKO.
SELECT SINGLE * FROM EKKO WHERE EBELN EQ WA-EBELN .
CASE WA-BSTYP .
WHEN 'F' . " Purchase Order
Get PO Data Details from BAPI (BAPI_PO_GETDETAIL )
CALL FUNCTION 'BAPI_PO_GETDETAIL'
EXPORTING
PURCHASEORDER = WA-EBELN
ITEMS = 'X'
HISTORY = 'X'
TABLES
PO_ITEMS = I_PO_ITEMS
PO_ITEM_HISTORY_TOTALS = I_PO_ITEMS_HIST.
*Delete Where Not Item with PO
DELETE I_PO_ITEMS WHERE PO_ITEM NE WA-EBELP
OR DELETE_IND NE SPACE.
DELETE I_PO_ITEMS_HIST WHERE PO_ITEM NE WA-EBELP.
*Sum the PO Qty
CLEAR I_PO_ITEMS.
LOOP AT I_PO_ITEMS.
AT FIRST.
SUM.
EXIT.
ENDAT.
ENDLOOP.
*Sum the Delivered Qty
CLEAR I_PO_ITEMS_HIST.
LOOP AT IT_PO_ITEMS_HIST.
AT FIRST.
SUM.
EXIT.
ENDAT.
ENDLOOP.
*Check if Delivered Qty is less than Ordered Qty
IF I_PO_ITEMS_HIST-DELIV_QTY < I_PO_ITEMS-QUANTITY.
* Release order
IF EKKO-BSART EQ 'REL'.
IF EKKO-KDATE GE SY-DATUM OR EKKO-KDATE IS INITIAL.
* Fetch Open PO Number i.e WA-EBELN .
ENDIF .
ELSE.
* Fetch Open PO Number i.e WA-EBELN .
ENDIF.
ENDIF.
ENDCASE .
ENDLOOP .
Regard's
Smruti
‎2013 Sep 12 7:33 PM
For Display PR
call function 'ME_DISPLAY_OBJECT_RQ'
exporting
key = banfn.
For Display PO
call function 'ME_DISPLAY_PURCHASE_DOCUMENT'
exporting
i_ebeln = it_final-ebeln
i_ebelp = it_final-ebelp
exceptions
not_found = 1
no_authority = 2
invalid_call = 3
preview_not_possible = 4
.
For Display Material Document
CALL FUNCTION 'MIGO_DIALOG'
EXPORTING
i_action = 'A04'
i_refdoc = 'R02'
i_notree = 'X'
i_skip_first_screen = 'X'
i_okcode = 'OK_GO'
i_mblnr = belnr
i_mjahr = gjahr
EXCEPTIONS
illegal_combination = 0
OTHERS = 0.
For Display MIRO(invoice) Document
call function 'MRM_INVOICE_DISPLAY'
exporting
i_belnr = it_final-lfbnr
i_gjahr = it_final-gjahr
changing
return = return
.
For Display FI (Accouting) Document
call function 'AC_DOCUMENT_RECORD'
exporting
i_awtyp = bkpf-awtyp
i_awref = bkpf-awkey+00(10)
i_aworg = bkpf-awkey+10(10)
i_awsys = bkpf-awsys
* i_awtyp_incl = 'BKPF'
i_awtyp_excl = ' '
i_bukrs = bukrs
i_valutyp = '0'
x_dialog = 'X'.