Hi,
I am wondering whether we can achieve in BEx. But I have an idea on how to do it in modeling level.
Let's say your Query is based on a Cube. Your cube get's loaded from some datasources. My idea here is to make a self loop between your Cube to Cube.
Char1, Char2 and Char3 are already available in your Cube with data. Insert a new infoobject called Char4 in your cube. Create direct mapping between your same cubes. So that you will see one to one mapping for all the fields . Only Char4 will have to be mapped now. Create a field level routine for Char4 or end routine to update Char4 in the self looped cube.
You can Implement your logic in the routine.
Regards,
Suman