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

Business partner creating a relationship performance problems

Former Member
0 Likes
2,778

Hello experts,

we implemented a report where we create business partner relationships. Each credit manager (business partner; not many) takes care of a lot of customers (business partners; many).

For the creation of the relationship, we used the function as you can see here:

CALL FUNCTION 'BAPI_BUPR_RELATIONSHIP_CREATE'
           EXPORTING
             businesspartner1         = wa_but050-partner1
             businesspartner2         = wa_but050-partner2
             relationshipcategory     = wa_but050-relationship
             validfromdate               = wa_but050-date_from
             validuntildate               = wa_but050-date_to
             differentiationtypevalue = wa_but050-difftype
           EXCEPTIONS
             error_message            = 1
             OTHERS                    = 2.

After 500 creations we commit with the following function, because if the report aborts, we already have some data saved:

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXCEPTIONS
       error_message = 1
       OTHERS         = 2.

As we run the report for the first time it took about 10 days(!) for about 230.000 relationships. I don't know the exact time, but it was very slow. We also think that the more relationships are created the longer it takes to create new one's.

So:

Is there another way to create the relationships or is there a way to improve the report, because we will have to create more relationships in the future.

I am quite sure, that the performance problems come from the function 'BAPI_BUPR_RELATIONSHIP_CREATE'.

We already tried a simply UPDATE but while testing we had problems with the deletion of the relationships (We also aren't sure, how SAP generates the relationshipnumber ...).

Thanks in advance for your help.

Hello experts,

we implemented a report where we create business partner relationships. Each credit manager (business partner; not many) takes care of a lot of customers (business partners; many).

For the creation of the relationship, we used the function as you can see here:

CALL FUNCTION 'BAPI_BUPR_RELATIONSHIP_CREATE'
           EXPORTING
             businesspartner1         = wa_but050-partner1
             businesspartner2         = wa_but050-partner2
             relationshipcategory     = wa_but050-relationship
             validfromdate               = wa_but050-date_from
             validuntildate               = wa_but050-date_to
             differentiationtypevalue = wa_but050-difftype
           EXCEPTIONS
             error_message            = 1
             OTHERS                    = 2.

After 500 creations we commit with the following function, because if the report aborts, we already have some data saved:

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXCEPTIONS
       error_message = 1
       OTHERS         = 2.

As we run the report for the first time it took about 10 days(!) for about 230.000 relationships. I don't know the exact time, but it was very slow. We also think that the more relationships are created the longer it takes to create new one's.

So:

Is there another way to create the relationships or is there a way to improve the report, because we will have to create more relationships in the future.

I am quite sure, that the performance problems come from the function 'BAPI_BUPR_RELATIONSHIP_CREATE'.

We already tried a simply UPDATE but while testing we had problems with the deletion of the relationships (We also aren't sure, how SAP generates the relationshipnumber ...).

Thanks in advance for your help.

5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
2,256

Hi,

did you try to put a SQL trace (ST05) for a low quantity of lines ? (sometimes performance issues occurs with table set to buffer)

Regards

Fred

Read only

0 Likes
2,256

Thank you for your Answer, Frédéric. I've checked whether the buffer is set to table but050 and it isn't:

So do you still suggest to put a SQL trace?

Read only

0 Likes
2,256

yes you will have the information of which table made that.

ST05 --> Trace ON

launch your program

ST05 --> Trace Off

ST05 --> Trace list

in the menu --> summarize

and check the top time

Fred

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,256

You could try some parallelism (if not too much lock problem)

  • Build a wrapper (RFC enabled FM) to create a batch of record. It receives, let's say 500, records, call the BAPI 500 times and execute a commit work with wait option. (Must not get a time-out so take care of size of record batches)
  • In the caller, determine first how many processes can be reasonably used. Look at FM SPBT_INITIALIZE.
  • Loop at your internal table, create sets of 500 records, if processes are available (first number determined minus current process in use) wait til one is freed (or execute one call of the FM in the current task).in the CALL FUNCTION func STARTING NEW TASK task statement use a {CALLING meth}|{PERFORMING subr} ON END OF TASK, add 1 to number of tasks running; n the called method/form decrease number of task running. Also I would suggest the use of DESTINATION IN GROUP in the call function statement.

For performance analysis, use as already written ST05 SQL trace, also use SAT/SE30 to determine if performance comes from database or abap coding or lock waits or memory consumption, also check SM13 during execution, the update processes may be saturated, or SM21 for system warnings during execution. Did you look for OSS notes ?

Regards,

Raymond

Read only

thw
Explorer
0 Likes
2,256

Thank you for your answers.

Meanwhile I was in contact with SAP.

The result was that this function module is the only one to create such relationships and the optimization for mass udpate of that FM is not possible, because it's the "heart" for creating relationships ...