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 PO report in ABAP

rajesh_nayak2
Explorer
0 Kudos
1,010

Hi ,

I am developing a report for open PO .

selection screen contains 2 fields , sales org and creation date.

I m stuck now.

below select query gets the open orders

SELECT ekko~EBELN

ekko~BUKRS

ekko~BSTYP

ekko~BSART

ekko~BSAKZ

ekko~LOEKZ

ekko~STATU

ekko~AEDAT

ekko~ERNAM

ekko~KUNNR

ekbe~BEWTP

into CORRESPONDING FIELDS OF TABLE it_ekko

FROM ekko JOIN ekpo on ekkoebeln = ekpoEBELN

join ekbe on ekpoEBELN = ekbeEBELN

where ekkoekorg in p_org and ekkoBSTYP = 'F' and ekkoLOEKZ = ' ' and ekbeELIKZ = ' ' and ekko~AEDAT in c_date.

but my question is how do I differentiate weather its GR'd IR'd etc . I also want the open quantity ( ordered qty - deliveried qnty)

Can some one give me some hint/logic?

Thanks,

Raj

5 REPLIES 5

Former Member
0 Kudos
241

Check out EKET table.

INNER JOIN eket ON ekpoebeln = eketebeln AND ekpoebelp = eketebelp

0 Kudos
241

Hi Rajesh,

For open PO - elikz NE 'X' or EQ ' ' ( You get this field in EKBE & also in EKPO)

For GR - bewtp = 'E' & For IR - Bewtp = 'Q' (in table EKBE)

For Schedule lines - Use table EKET (like if Ordered Qty is 5 -and Del. Qty comes in 3 Schedules of 2 +2 +1 )

Set a flag - as it's completely open (i.e. 5 out of 5 open) or Pending (2 out of 5 are pending ) with the help of table EKET & EKBE.

Reply Back if you hvae any query.

Edited by: Ashlesha R. Bhagat on Jan 4, 2011 7:18 AM

0 Kudos
241

Hi Ashelsha,

Thanks for the info.

I still have some doubts i.e scheduled lines table concept I didnt understand .

If the order is scheduled the entry ll be in this table ? as soon as its deliveried the entry is removed? or any other concepts?

and if the PO is GR'd - bewtp = 'E' & For IR'd - Bewtp = 'Q' (in table EKBE)? or if GR and IR are pending then these values?

Sorry for troubling you.

Thanks,

Raj

Edited by: rajesh.nayakbola on Jan 5, 2011 10:09 AM

0 Kudos
241

Hi,

Extremely sorry... for not looking back to this Thread.

It's too late, still trying to make it as clear as I can.

Complete Process - Purchase Requision (PR) --> Purchase Order (PO) --> MIGO (or GR) --> MIRO (or GI)

Come to Your Requirement -->


* PO qty will be your 'Ordered Qty' (EKPO-menge)
i.e. 
   PO       POItem       Material       Ordered Qty
   1234       10             M1                  10
   1234        20            M2                   5

* If the Material is Delivered - ('MIGO' or GR) - ONLY THEN you find Entries in EKBE table with bewtp = 'E'.
    PO       POItem       Material  Category  Qty(delivered)
   1234       10             M1          E           10

* If Invoice is done- (MIRO or GI) - ONLY THEN you find entries in EKBE table with bewty = 'Q'.
      PO       POItem       Material  Category  Qty(invoiced)
     1234       10             M1         E           10
     1234       10             M1         Q           10  
----------------------------------------------------------------------------------------------
For Schedule Lines  -->
Material can deliverd as
1. Complete in one Delivery --> as Ordered Qty = 10 & Delivered Qty = 10
2. Partial in each Schedule  --> Ordered Qty = 10 & Delivered Qty =  5 + 2 + 2 + 1.
-->If You need to Trace this Schedules, Only then go to table EKET otherewise Not Required. Above tables have enough info
* Once the First Schedule Delivered this table gets its entry for the PO
i.e.
      PO       POItem      Schedule line  Date             Scheduled Qty
     1234       10             1          01.02.2011             5
* Then for Next Schedules --
      PO       POItem      Schedule line  Date             Scheduled Qty
     1234       10             1          01.02.2011             5
     1234       10             2          10.02.2011             2
     1234       10             3          10.02.2011             2
     1234       10             4          18.02.2011             1

Edited by: Ashlesha R. Bhagat on Feb 18, 2011 7:59 AM

kesavadas_thekkillath
Active Contributor
0 Kudos
241

You can get open quantity from MDUB . Subtract the two quantity fields ( are consolidated values ). For GR & IR you can get it from EKBE ( i think the field which differentiates this is VGBAE or BWART ).