Query to get date goods receive date vs inspection start date and inspection end date

Hi everyone

Ive recently started diving into SAP queries. I currently have access to my company’s data lake for SAP data (meaning I don’t have access to meaningful column headers). I am using xlean website to figure out tables and column names.

I have been asked to compare goods received vs inspection start and end dates. I am not sure the best approach but from searching around this forum i’ve come up with the following, but the PO_Posting_date seems to update whenever a new part gets received on that PO. Do you have any suggestions on how to look this information up?

 

Thanks in advance!

 

select ekbe.BELNR as material_doc_number, ekbe.BLDAT as doc_date, ekbe.BUDAT as PO_Posting_Date, ekbe.MENGE as quantity, ekbe.ebeln as purchase_order, ekbe.matnr as material_number, ekbe.werks as plant, qals.prueflos as inspection_lot_number, qals.art as inspection_Type, qals.stat35 as usage_decision_made, qals.ENSTEHDAT as inspection_lot_created_Date, qals.ENTSTEZEIT as inspection_lot_created_time, qals.PASTRTERM as inspection_lot_inspection_start_date, qals.PASTRZEIT as inspection_lot_inspection_start_time, qals.PAENDTERM as inspection_lot_inspection_end_date, qals.PAENDZEIT as inspection_lot_inspection_end_time, if(qals.pastrterm != qals.paendterm, ‘not match’, ‘match’) as compare_dates
from prod_l1.mbp.ekbe
left join prod_l1.mbp.qals on qals.ebeln = ekbe.ebeln and qals.ebelp = ekbe.ebelp
–join prod_l1.mbp.QAMB on QAMB.mblnr = prod_l1.mbp.ekbe.belnr and QAMB.mjahr = prod_l1.mbp.ekbe.gjahr and QAMB.zeile = ekbe.buzei
where ekbe.werks = ‘US9L’ and ekbe.bewtp = ‘E’
order by ekbe.src_commit_time desc

 

 

 

Scroll to Top