cancel
Showing results for 
Search instead for 
Did you mean: 

BADI takes longer time to run

Former Member
0 Kudos
182

Hi Experts,

For one of my requirement, I have implemented a BADI using UJ_CUSTOM_LOGIC method. The BADI logic is to copy records from one version to another version using ct_data.

During testing we are encountering strange performance behaviour from BADI. If  we test the BADI for around 3000 records, it is taking around "6 mins" to run the BADI whereas if I test the BADI for around 1000 records it takes only few seconds to run. We are unable to trace the problem for this.

My script logic to run the BADI is:

*XDIM_MEMBERSET ACCOUNT= ACCT002,ACCT005,ACCT003

*XDIM_MEMBERSET TIME =%TIME_SET%

*XDIM_ADDMEMBERSET TIME = TMVL(1,%TIME_SET%),TMVL(2,%TIME_SET%),TMVL(3,%TIME_SET%),TMVL(4,%TIME_SET%),TMVL(5,%TIME_SET%),TMVL(6,%TIME_SET%),TMVL(7,%TIME_SET%),TMVL(8,%TIME_SET%)

*START_BADI ZCOPY

WRITE = ON

QUERY = ON

CATEGORY = %CATEGORY_SET%

TIME= %TIME_SET%

*END_BADI

Also my ABAPer tested putting time stamp before and after the code and debugged. We found out that the logic takes only fewer time to run, whereas it takes more time for writing back the records to the cube.

We are working on SAP BPC 10 SP 04, BW 7.3

Please help on this.........Are we missing anything from this?

Thanks & Regards,

Priyanka

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member191765
Active Participant
0 Kudos

Avoid select statements inside loop .. write select statements using for all entries if they table(/b28/pwqd06xj & /b28/pwqd0xzm ) are big .. if they are not big get full table and sort the entries using /b28/s_wqd06xj /b28/s_wqd0xzm ...then read using binary search inside the loop.

former_member186338
Active Contributor
0 Kudos

Hi Priyanka,

It's not possible to understand the issue without investigation of the badi code.

But why you need badi to copy, why not script logic (1000 and 3000 records is not a huge amount).

Also some strange code in the script (may be correct):

First you scope TIME to 9 months starting from month set by user and then - provide user selected month as a badi parameter...

Vadim

Former Member
0 Kudos

Hi Vadim,

1000, 3000 are just test records. In Actual there may be thousands of records. I had to implement BADI for copy as in the logic I require to lookup the property value of a particular dimension and then use the same ID in the dimension value, while writing back.

Yes in the script logic First from the user input I take the next 9 months data to read, and only the category from the passed parameter to derive the target version.

My mistake, copied the wrong code....;)

Attaching the code for your reference.

Regards,

Priyanka

former_member186338
Active Contributor
0 Kudos

Ups, strange badi code with a lot of hardcoded values and without passing badi parameters...

Vadim

sap_user62
Active Participant
0 Kudos

One suggestion.

Try to avoid select statement within a loop. For every record in your source it would hit the database table. So 10k records it would hit the data base 10k times.

Instead select all the master data of the 2 dimensions in an internal table and then read the table inside the loop with selections.

Thanks

Ed.