SELECT U.OPRID , X.BUSINESS_UNIT , X.WORK_ORDER_ID , P.NAME , W.DURATION , W.POAMOUNT , W.CURRENCY_CD FROM PS_SPF_WO_APR_XREF X , PS_EOAW_STEPINST S , PS_EOAW_USERINST U , PS_SPF_WORDERREC W , PS_SPB_PERSON_TBL P WHERE S.EOAWSTEP_INSTANCE = U.EOAWSTEP_INSTANCE AND S.EOAWPRCS_ID = 'SP_WORKORDER' AND (S.EOAWTHREAD_ID = X.EOAWPARENT_THREAD OR S.EOAWTHREAD_ID = X.EOAWTHREAD_ID) AND X.EOAWPRCS_ID = S.EOAWPRCS_ID AND X.EOAWDEFN_ID = S.EOAWDEFN_ID AND W.WORK_ORDER_ID = X.WORK_ORDER_ID AND W.BUSINESS_UNIT = X.BUSINESS_UNIT AND W.WO_CONID = P.PERSON_ID AND S.EOAWSTEP_NBR = ( SELECT MIN(S_S.EOAWSTEP_NBR) FROM PS_EOAW_STEPINST S_S WHERE S_S.EOAWSTEP_INSTANCE = S.EOAWSTEP_INSTANCE AND S_S.EOAWDEFN_ID = S.EOAWDEFN_ID AND S_S.EOAWPRCS_ID = S.EOAWPRCS_ID AND S_S.EOAWSTEP_STATUS = 'P')
|