Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to do "read old merge new" in background ABAP

OttoGold
Active Contributor
0 Kudos

Hi, ladies and gentlemen,

I always get some nice pieces of advise, so I ask for your help with another problem:))

I would like to do "read old, merge new" like in PFCG through my ABAP program. The goal is to to do that in mass and see how many of my roles blow up.

I found (or was advised to find - thanks gentlemen) the SUPRN_AUTH_DATA_IN_EXP_MODE function, which is cool. It does what I want to do except one tiny detail. When you check the data in 1250, 1251 tables, you spot a node number column which is then used in PFCG to format the categories, objects, fields tree. But the output of the above mentioned function module does not produce these numbers. I really don`t want to build that order by myself, don`t want to damage my system by any low level hacks.

So I cannot call that function module and then change the role tables, because I don`t have those numbers.

So can anybody suggest how to really perform the "read old merge new" so the DB gets changed? And I don`t have to do this myself? Of course the functionality must work in background without user intervention needed. I was hoping for help from SUPRN_PROFILE_GENERATOR, but it very talkative so I cannot use in in background (silent mode). Or if somebody can suggest a way, I would be so grateful.

Another thing that could solve my problem would be a function module that can build the above described node order. But I am not sure a function module which does that exist. I was able to debug some parts of the processing and some black magic is done by FORMs, which is not something well usable.

Thank you for your time and effort if you reached this point of my lengthy question:))

Have a nice day,

cheers Otto

1 ACCEPTED SOLUTION

martin_voros
Active Contributor
0 Kudos

Hi Otto,

probably the easiest way is to re-factor SAP code.

When you compare SUPRN_PROFILE_GENERATOR and SUPRN_AUTH_DATA_IN_EXP_MODE then you can see that basically SUPRN_AUTH_DATA_IN_EXP_MODE ends on line 310 of SUPRN_PROFILE_GENERATOR. So everything after that is related to displaying tree with authorization values. Line 321 contains a call of routine tree_build_ber that builds a tree in global table brtree. The value brtree-child is what is used in agr_1250-node. Unfortunately for you, this routine does not have a clean interface and it's using global variables like brtree, i_tobc and i_tobj. So you can try to copy and refactor it and create a proper clean interface.

Another approach could be to use implicit enhancement point at the end of SUPRN_AUTH_DATA_IN_EXP_MODE and call tree_build_ber from there. Both FMs are in same function group so they share all global variables. So what you need to do is to populate i_tobc and i_tobj and then just call that routine. The just simply fill node values from brtree table. You can extend an interface of FM with a simple optional switch that would activate this additional code. By default it will be turned off so there won't be any issue for standard programs using this FM.

Cheers

3 REPLIES 3

martin_voros
Active Contributor
0 Kudos

Hi Otto,

probably the easiest way is to re-factor SAP code.

When you compare SUPRN_PROFILE_GENERATOR and SUPRN_AUTH_DATA_IN_EXP_MODE then you can see that basically SUPRN_AUTH_DATA_IN_EXP_MODE ends on line 310 of SUPRN_PROFILE_GENERATOR. So everything after that is related to displaying tree with authorization values. Line 321 contains a call of routine tree_build_ber that builds a tree in global table brtree. The value brtree-child is what is used in agr_1250-node. Unfortunately for you, this routine does not have a clean interface and it's using global variables like brtree, i_tobc and i_tobj. So you can try to copy and refactor it and create a proper clean interface.

Another approach could be to use implicit enhancement point at the end of SUPRN_AUTH_DATA_IN_EXP_MODE and call tree_build_ber from there. Both FMs are in same function group so they share all global variables. So what you need to do is to populate i_tobc and i_tobj and then just call that routine. The just simply fill node values from brtree table. You can extend an interface of FM with a simple optional switch that would activate this additional code. By default it will be turned off so there won't be any issue for standard programs using this FM.

Cheers

0 Kudos

I don`t get it how comes your answers are always so detailed and precise. I hope you`re not the original author of the code:))

Anyway, you`re super great developer or black magic is you long time hobby:)) Thank you very much. It is a good starting point. I will be back with the feedback. I welcome other suggestions in the meantime as well. I really hoped there would be a way how to call something instead of hacking into the code:))

cheers Otto

0 Kudos

Hello again Martin, experts,

I managed to put the spell together and then cast the spell. I now have the tree constructed in the global memory (or how do I call the memory of the package). Last step is obvious: how to pull the tree definition from that memory, so I play with that in my own code?

Thanks Otto