cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Doubt for optimize abap code in BADI

PTecnico
Participant
0 Likes
303

Dear Experts,

I need to create a relationship between a position and another object in infotype HRP1001.
Currently, I am implementing a BAdI and receiving the parameter is_ee_org_ass_repl_req.

Within the implementation, I am executing several SELECT statements inside a LOOP AT to build the required structure. However, this approach is causing performance issues due to multiple database queries.How can I avoid executing queries inside a LOOP AT, which is causing performance issues?

Regards

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

NooruBohra
Active Participant
0 Likes

Hi,

I don't see any of the "is_ee_org_ass_repl_req-org_assignment" internal table's fields to be used in the queries. Then why to put in the loop at all. Result is always going to be same, isn't it? You can move the queries outside the loop.

If you've not shared the whole code and I assume you're using few fields from the internal table "is_ee_org_ass_repl_req-org_assignment" for selecting the data using those selects, then you can have below two options

1. Use for all entries or ranges to select data in one go and then use READ statements within the loop.
2. If you're on new ABAP version, then you can do a join also to fetch the data in one go.
this will eliminate the select within the loop.

Regards.

PTecnico
Participant
0 Likes

.