Can someone help me with the code for this problem. I would like to check for a given vendor, if there is any PO placed in a financial year (i.e. 1st Jan to 31st Dec) & if any PO is open.
Link: LFM1-LIFNR <=> EKKO-LIFNR
Criteria for PO Placed:
1.Read system date & extract only the year part into 'S_Year' from the system date.
2.Read only the year part of EKKO-BEDAT into 'E_Year' & match with system year. (i.e. 'E_Year' same as 'S_Year').
3.Loop until we find a document (EKKO-EBELN) which matches the above condition
4.Once the document is selected check if deletion indicator (EKPO-LOEKZ) is not 'L'for all lines (EKPO-EBELP) -> If this condition fails, repeat step 3.
->If all condition checks are ok, display text 'Active'.
->If not display text 'Not-Active'
Criteria for PO Open: for the given vendor
1. Loop & find a PO for the vendor for which EKPO-LOEKZ & EKPO-ELIKZ is initial irrespecive of the year.
-> If the 2 conditions are ok, display text 'PO Active'
-> If not display ' '
Eg: The output which i am looking for is something like as shown below
Vendor | PO Status | Vendor Status
123 | Active | Active
245 | | Active
545 | Active | Not-Active
Hope my problem is clear, await inputs.