05-20-2014 12:48 PM
Hello Experts,
I have a requirement, have to develop a report in which I've to get all the PO's created against PR (line item wise) But i'm not getting which table(EBAN or EKPO) to loop to get all the created PO's against Particular PR.
Thanks in advance,
Regards,
Hardik B
05-20-2014 1:01 PM
Hi,
You can use EKKO and EKPO.
EKKO is a header PO table and based on EKKO PO you can fetch its line items from EKPO table.
BR
Sumeet
05-20-2014 1:08 PM
hi,
you can use EKPO table . EKPO-BANFN field is purchase requisition number.
As mention Sumeet, EKKO is PO header table and EKPO item level.
if you need more information related to PR then you pass EKPO-BANFN value in EBAN table.
Regards,
Prasenjit
05-20-2014 2:07 PM
Dear Hardik,
For ur requirement...SAP already given the Tcode. ME5A .
This will give u the all information regarding the PO created against PR.
Try this.
If it is not suitable for u,
then go for Z development.
Thanks & regards
Kranthi.
05-23-2014 6:07 AM
Hello All,
Yes, there is ME5A for checking PO's created against PR but here i'm not getting Line item wise if for example there are 2 PO's created for single line item then i'm getting only single PO created.
So for my requirement I developed Z report & looped to EKPO but in this case i'm not getting those line item for which PO is not created.
If I loop to EBAN i'm not getting all the PO Created & If I loop to EKPO i'm not getting those line item of PR for which PO is not created.
Regards,
Hardik B
05-23-2014 6:14 AM
Hi Hardik,
in getching data from eban pass the value to get banfn and bnfpo both, then you will get the line items too. olease share your code (only relevant one ), with ekpo and eban.
05-23-2014 6:37 AM
Dear Sanjeev Sir,
I'm currently looping EKPO, so for PR I've 3 line item 10, 20, 30 for line item 10 & 20 there are 2 PO's for each & for line Item 30 no PO is created. I've to display 5 entries for this (2 entry for line item 10, 2 for line item 20 and 5th entry of PR without PO details)
loop at it_ekpo into wa_ekpo.
wa_final-ebeln = wa_ekpo-ebeln.
wa_final-ebelp = wa_ekpo-ebelp.
wa_final-menge1 = wa_ekpo-menge.
wa_final-meins1 = wa_ekpo-meins.
wa_final-matkl1 = wa_ekpo-matkl.
read table it_eban into wa_eban with key banfn = wa_ekpo-banfn
bnfpo = wa_ekpo-bnfpo
matnr = wa_ekpo-matnr
werks = wa_ekpo-werks
lgort = wa_ekpo-lgort
matkl = wa_ekpo-matkl.
if sy-subrc = 0.
wa_final-banfn = wa_eban-banfn.
wa_final-bnfpo = wa_eban-bnfpo.
wa_final-werks = wa_eban-werks.
wa_final-badat = wa_eban-badat.
wa_final-bsart = wa_eban-bsart.
wa_final-knttp = wa_eban-knttp.
wa_final-frgkz = wa_eban-frgkz.
wa_final-statu = wa_eban-statu.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = wa_eban-matnr
importing
output = wa_eban-matnr.
wa_final-matnr = wa_eban-matnr.
wa_final-txz01 = wa_eban-txz01.
wa_final-menge = wa_eban-menge.
wa_final-preis = wa_eban-preis.
wa_final-prtotal = wa_final-menge * wa_final-preis.
wa_final-meins = wa_eban-meins.
wa_final-bednr = wa_eban-bednr.
wa_final-ekgrp = wa_eban-ekgrp.
wa_final-afnam = wa_eban-afnam.
wa_final-lfdat = wa_eban-lfdat.
wa_final-frgst = wa_eban-frgst.
wa_final-lgort = wa_eban-lgort.
wa_final-ebakz = wa_eban-ebakz.
wa_final-loekz = wa_eban-loekz.
wa_final-erdat = wa_eban-erdat.
append wa_final to it_final.
clear: wa_final,wa_ekpo,wa_eban,wa_ekko,wa_lfa1,wa_name.
endloop.
In this output I want 5th line as
1100000215 30 balnk blank.....
Regards,
Hardik B
05-23-2014 6:52 AM
Hi Hardik, do one thing put a break-point at that point where you are selecting data from ekpo and eban table. and see how many data you are getting in both internal tables.
I can't do it for you, the ideal way to code (pass the data of ekpo to eket to get all the pr details and then pass it to eban table). And please change your code accordingly.
SELECT EBELN EBELP MENGE FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE IT_EKPO
WHERE EBELN = your condition
AND EBELP = your condition.
SELECT banfn bnfpo ebeln ebelp from EKET INTO CORRESPONDING FIELDS OF TABLE IT_EKET
FOR ALL ENTRIES IN IT_EKO
WHERE EBELN = IT_EKPO-EBELN
AND EBELP = IT_EKPO-EBELP.
SELECT banfn
bnfpo
bsart
TXZ01
bstyp
ekgrp
erdat
matnr
werks
lgort
matkl
menge
meins
badat
lfdat
ebeln
ebelp
bedat
bsmng
FROM EBAN
INTO TABLE IT_EBAN
FOR ALL ENTRIES IN IT_EKET
WHERE BANFN EQ IT_EKET-BANFN
AND BNFPO EQ IT_EKET-BNFPO.
05-29-2014 10:13 AM
Hello All,
I fulfilled the requirement by nested looping. 1st to EBAN and then to EKPO.
Thank you all for your reply.
Regards,
Hardik B