How is the data available in your Infoprovider level? By based on the data, you have to pick the records with some logic.The logic which you are looking for is only possible if you have data like below:--
Eg:
1001 | 2001 | DP | 2222 | |
1001 | 2001 | DP | 5001 | 5555 |
1002 | 2002 | CS | 3001 | 3333 |
1003 | 2003 | CQ | 4444 | |
1004 | 2001 | CT | 4001 | 5555 |
1005 | 2004 | DP | 6666 | |
1005 | 2004 | DP | 7001 | 7777 |
With your present data availability, you can get any records.
Regards,
Suman