Application Development and Automation 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: 
Read only

Performance issue on function module fagl_segment_contains_data

former_member602116
Participant
0 Likes
2,555

Hi Experts,

We have a custom transaction code that has a runtime issue as it takes very long to process . Per checking via SAT, long runtime (almost 90% runtime) is happening in check_data(1) TO check_data(4) of standard FM FAGL_SEGMENT_CONTAINS_DATA since inside these subroutines there is a select from a generic identifier. Since this is standard SAP, I didn't expect to see a code where nested loop is performed.

LOOP AT lt_ledgers.

LOOP AT lt_tka02.

WHILE ( ld_akt_year <= ld_end_year AND
ld_akt_year <= ld_syyear ) .

PERFORM check_data USING ...

PERFORM check_data(2) USING ...

PERFORM check_data(3) USING ...

PERFORM check_data(4) USING ...

ENDWHILE.

ENDLOOP.

ENDLOOP.

Is this kind of code okay?

We have always been taught to avoid retrieving from the database within a loop and to also avoid nested loops. But in this FM, retrieving from database is inside a nested loop. Please correct me if I'm wrong.

Thank you.

Regards,

Kath

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
2,255

Hello kdarunday

Yeah, sometimes these happen... Check SAP OSS note #2219690 - it might help.

Kind regards,
Mateusz
6 REPLIES 6
Read only

MateuszAdamus
Active Contributor
2,256

Hello kdarunday

Yeah, sometimes these happen... Check SAP OSS note #2219690 - it might help.

Kind regards,
Mateusz
Read only

0 Likes
2,255

Hi Mateusz,

Thanks for the confirmation. I have checked the OSS Note however, per checking the software component is SAP_FIN 720

And we are still currently on SAP_FIN 617:

Does this mean the correction cannot be applied to our system?

Thank you.

Regards,

Kath

Read only

2,255

Yes, it would appear so. In this case I would raise a ticket with SAP as this is a standard code's issue.


Kind regards,
Mateusz
Read only

michael_piesche
Active Contributor
2,255

What SAP version do you currently have?

Did you check support.sap.com. There is a SAP note from late 2016 concerning this issue. And looking at the code changes from that SAP note, it should address your problem, as your posted coding would be affected by it:

Read only

0 Likes
2,255

Hi Michael,

Thanks for this. Per checking the OSS Note, software component is SAP_FIN 720 but we are still currently on SAP_FIN 617.

Does this mean the correction cannot be applied to our system?

Thank you.

Regards,

Kath

Read only

0 Likes
2,255

kdarunday, since you are on 617, and the correction is only offered for 720, I strongly assume that the SAP note cannot be applied to your system (neither through trx. SNOTE, nor 'manually' by your development through modification).

  • To be sure though, you could download the SAP note with Trx. SNOTE and check its status.
  • Also, you could have a developer check if modifying the referenced repository items (FM FAGL_SEGMENT_CONTAINS_DATA, Include LFAGL_SEGMENT_CHECKF01) according to the changes in the SAP note would help your problem. But again, I strongly assume that you will be missing further neccessary DDIC and Repository data, because you are on an older version and there are also prerequisite SAP notes to be implemented as well.
  • Best thing you can do, is open a support request with SAP regarding your problem. I assume though, that the answer will be to upgrade to either 720 or the latest SAP_FIN version which is currently 730, if i am not mistaken.