08-07-2015 7:16 PM
Hallo Experts,
I have requirement to display purchase order in Report only Purchase Order that not Posted in Good Recipt.
I have use this BAPI ( BAPI_PO_GETITEMS ) or EKPO and EKBE.
Both give different result . Please give me idea which is best BAPI or EKPO and EKBE.
Thanks
08-08-2015 7:01 AM
Hi,
Try,
REPORT ytest.
TABLES: ekpo,
ekbe.
DATA: itab_po type table of ekpo,
itab_gr type table of ekbe,
wa like line of itab_po,
lv_cnt type i.
SELECT-OPTIONS s_po for ekpo-ebeln.
START-OF-SELECTION.
select * from ekpo into table itab_po
where ebeln IN s_po.
IF sy-subrc IS INITIAL.
SELECT * FROM ekbe into table itab_gr
for all entries in itab_po
where ebeln = itab_po-ebeln
and ebelp = itab_po-ebelp.
ENDIF.
LOOP at itab_po into wa.
lv_cnt = sy-tabix.
READ TABLE itab_gr with key ebeln = wa-ebeln
ebelp = wa-ebelp transporting no fields.
CHECK sy-subrc IS INITIAL.
DELETE itab_po INDEX lv_cnt.
ENDLOOP.
Hope it helpful,
Regards,
Venkat
08-08-2015 7:01 AM
Hi,
Try,
REPORT ytest.
TABLES: ekpo,
ekbe.
DATA: itab_po type table of ekpo,
itab_gr type table of ekbe,
wa like line of itab_po,
lv_cnt type i.
SELECT-OPTIONS s_po for ekpo-ebeln.
START-OF-SELECTION.
select * from ekpo into table itab_po
where ebeln IN s_po.
IF sy-subrc IS INITIAL.
SELECT * FROM ekbe into table itab_gr
for all entries in itab_po
where ebeln = itab_po-ebeln
and ebelp = itab_po-ebelp.
ENDIF.
LOOP at itab_po into wa.
lv_cnt = sy-tabix.
READ TABLE itab_gr with key ebeln = wa-ebeln
ebelp = wa-ebelp transporting no fields.
CHECK sy-subrc IS INITIAL.
DELETE itab_po INDEX lv_cnt.
ENDLOOP.
Hope it helpful,
Regards,
Venkat
08-08-2015 8:08 AM
you can try this code, it gives you many options, to select the POs,
REPORT zibo_test1.
TABLES: ekpo.
DATA: lt_ekpo TYPE TABLE OF ekpo.
SELECT-OPTIONS s_ebeln FOR ekpo-ebeln.
START-OF-SELECTION.
" Select Purchasing Doc.
" we will get the positions, and we have to chek them if they don't exist
" in table EKBE History per Purchasing Document
" so it means, they do not Posted in Good Recipt yet.
SELECT * FROM ekpo AS ekpo INTO TABLE lt_ekpo
WHERE ebeln IN s_ebeln
AND NOT EXISTS ( SELECT * FROM ekbe AS ekbe
WHERE ekpo~ebeln = ekbe~ebeln
AND ekpo~ebelp = ekbe~ebelp ).
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'EKPO'
i_callback_program = sy-repid
TABLES
t_outtab = lt_ekpo.
Regards
Ibr
08-08-2015 8:25 AM
Hello,
antoher option , you can use this FM BAPI_PO_GETDETAIL
you can enter the purchase order and X for ITEM and History
who does not exist in history, it means, not yet posted,
so this example shows you that this item has been posted,
Another example without history, not yet posted,
Regards
Ibr
08-08-2015 9:21 AM
Hi,
there is another program to know if the PO is opened,
Open PO Quantity
this report provide also the open PO quantity,
Start this transaction ME2N ,
and enter the selection parameters : WE101
then press F8, exeucte it.
Regards
Ibr