Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Open Quantity Purchase Order of Good Recipt

former_member213491
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

VenkatRamesh_V
Active Contributor
0 Kudos

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

4 REPLIES 4

VenkatRamesh_V
Active Contributor
0 Kudos

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

former_member184158
Active Contributor
0 Kudos

Hi Muhammad Zafarullah,

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

former_member184158
Active Contributor
0 Kudos

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

former_member184158
Active Contributor
0 Kudos

Hi,

there is another program to know if the PO is opened,

Open PO Quantity