I am writing a PO approvals app using SAP, SUP and iOS.
The idea behind this app is to show you any SAP purchase order you are involved with (you created it, or initiated the release step on it, or need to review and approve it, or did approved it) and allow you to approved purchase orders where you are deemed to be the reviewer for that purchase order.
To do this I have defined 2 MBO's in SUP called POHeaders (purchase order headers) and POItems (purchase order items) based on my custom RFC ZSUPPO_RFC_GETLIST which returns these 2 tables based on our selection criteria. Both these MBOs I have placed in a cache group so that the CDB in SUP is refreshed every 15 minutes. This works fine and my CDB is refreshed with the updated list purchase order data (as per the required selection in ZSUPPO_RFC_GETLIST) from SAP every 15 minutes.
However each PO needs to end up in the PO approvals app of multiple people based on whether they are deemed the originator, release step initiator, the reviewer (the person who will review and approve the PO) and the approved by person.
This means I want the client device to only retrieve purchase order headers and purchase order items from POHeaders and POItems which are associated with the device via the devices SAP login credentials (stored in the SUPDataVault). To do this I have created a synchronization parameter called SAPECCUSERNAME one for each the POHeaders MBO and the POItems MBO.
Additionally I have included custom download data for each as follows -
POHeaders Customized Download Data -
SELECT x.* FROM POHeaders x WHERE ( (x.ORIGINATOR_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( x.INITIATOR_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( x.REVIEWER_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( x.APPROVEDBY_SAPUSERNAME=:SAPECCUSERNAME ) )
POItems Customized Download Data -
SELECT x.* FROM POItems x
WHERE x.PO_NUMBER IN ( SELECT x.PO_NUMBER FROM POHeaders y
WHERE ( (y.ORIGINATOR_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( y.INITIATOR_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( y.REVIEWER_SAPUSERNAME=:SAPECCUSERNAME ) ) OR ( ( y.APPROVEDBY_SAPUSERNAME=:SAPECCUSERNAME ) ) )
However I find that after synchronization I have the correct purchase order headers on the device, but I am not getting any purchase order items on the device.
I have tried not having anything defined custom download data-wise for POItems (which gives me all the POItems availble in the CDB - not just for those purchase orders which my client SAP username is associated with) as well as replacing the "IN" with "=" above (which gives me none). I've also tried coding up a JOIN but this gives me an exception.
My iOS sync code is as follows (note that I seem to be forced to use subscribe/unsubscribe here to not get a SUPPersistense Excpetion - does anyone know why this is the case?). This code is obviously runs once I have registered and am connected to SUP.
CCASUPPOHeadersSynchronizationParameters *supPurchaseOrderHeadersSyncParams = [CCASUPPOHeaders getSynchronizationParameters];
//[supPurchaseOrderHeadersSyncParams delete]; // do we need this ?
CCASUPPOItemsSynchronizationParameters *supPurchaseOrderItemsSyncParams = [CCASUPPOItems getSynchronizationParameters];
//[supPurchaseOrderItemsSyncParams delete]; // do we need this?
[CCASUPMyApprovalsDB synchronize:@"PurchaseOrders"]; // synchronize purchase orders data
Nothing seems to work. Anyone have any ideas about the proper way to go about doing this?
Please note that we are not using the PO approvals WF in SAP here, and have no plans to given our unusual release strategy.