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

Speed up a BAPI update

ricky_shaw
Contributor
0 Likes
1,874

Hello Experts,

I am using a BAPI to update the busines partner details.

Its normally taking 3 seconds for a record to get updated.

But when i loop for 200,000 records it is taking 7 hrs of time to update.

Is there a way to speed up the BAPI update?

thanks

Ricky

Edited by: Ricky Sh on Sep 22, 2011 1:14 AM

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
1,635

Can you process them in parallel?

If it is BAPI, it would be a ALE interface (IDOC) generated for it. If not you can generate for that BAPI.

From your program create IDOCs and use the RBDAPP01 to process those IDOCs.

RBDAPP01 has an option to process them in parallel by setting up the packet size. This parallel processing could use as many available work processes to process your recrods.

Regards,

Naimesh Patel

9 REPLIES 9
Read only

Former Member
0 Likes
1,635

Hi Ricky,

Considering the volume of records you need to update, 7 hours is faster than expected. I tried to compute in simple math the details you provided. Lets see below:

Given:

3 sec/ record to update

Problem:

200,000 records to update. How long it will take to finish updating?

Using the simple ratio you provided above, you can calculate easily how many hours you expect to finish the updating process. Right?

So in 1 hour, how many records you can update? You need to convert Hour into seconds then apply the ratio mentioned above.

1 hr = ( 60 min / 1 hr )* (60 secs/ 1 min)

1 hr = 3600 secs

Since you update a record in 3 seconds, thus:

1 hr = 3600 / 3

1 hr = 1200 records

So in 1 hour, you can update only 1200 records. And in 7 hours, there are 8400 records you can update which is far incomparable with 200,000 records.

I hope I presented an acceptable idea that the slow performance is NOT due to the BAPI but on the volume of records that is processing.

Cheers

Read only

0 Likes
1,635

Hi levis,

Thanks for the math

I mean it may NOT update few records due to some lock issue.etc..

Can you /someone tell me how i can schedule it for paralell processing?

thanks

Ricky

Read only

0 Likes
1,635

Hi Ricky,

Im sorry if I haven't got your question right.

Anyway, the thing you need to do is this.

1. Before updating (using the BAPI), check first if that item is locked or not. In order to know if its locked, there's a lot of tutorial on the net on how to check if an item is locked.

2. If yes, proceed with your BAPI to update that record.

3. If not, then by-pass it or continue your LOOP statement.

Read only

0 Likes
1,635

Hi

Try to see the help for CALL FUNCTION .....STARTING NEW TASK task

Max

Read only

0 Likes
1,635

Hello Max,

I want to use CALL FUNCTION .....STARTING NEW TASK.

I have internal table it_ever wih 200,000 records. I want to use this CALL FUNCTION .....STARTING NEW TASK for every 25000 records.

How do i do this?

My code is below: its NOt allowing me to use Import parameters so i commented it.

 loop at it_ever into wa_ever .
    clear : wa_out,wa_out_err,ls_return.

    if wa_ever-gemfakt eq '1'.
      clear ls_contr_data.
      ls_contr_data-contract = wa_ever-vertrag.
      ls_contr_data-joint_invoice = '3'.
      ls_contr_x-joint_invoice = 'X'.

      lv_task = 'task1'.
call function 'BAPI_ISUCONTRCT_CHANGEFROMDATA' starting new task lv_task destination 'NONE'
        exporting
          contractdata  = ls_contr_data
          contractdatax = ls_contr_x.
*        importing
*          return        = ls_return.

      if ( ( ls_return-type ne 'E' ) or ( ls_return-type ne 'A' ) ).

        call function 'BAPI_TRANSACTION_COMMIT'
          exporting
            wait = 'X'.

endloop

.

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
1,635

Hello Ricky,

you can indeed get the response from your call.

And what you are missing is the control of the resources. With your coding you will make the whole system standing still.

Please read this docu about parallel processing:

http://help.sap.com/saphelp_nw04/helpdata/en/fa/096e92543b11d1898e0000e8322d00/frameset.htm

Regards,

Yuri

Read only

0 Likes
1,289

Hi Ricky,

You can use background jobs, in your program you can split your records into different batches, say for each batch you want 10k records, it means you will then create 20 bacthes that will run concurrently in the background, this will use what ever number of processes are available in your system, if the maximum work processes for example is 6, then this will process 6 batches which have 10k records in each concurrently, and when one batch completes the next batch in line processes.

 

I have done this for another project where I had to load business partners.

 

Regards,

Tshepo

Read only

Former Member
0 Likes
1,635

Hi,

Could you tell me which BAPI your using for update.

Does commit work is used explictly after BAPI call for each record update. If so could you use commit work for a counter of say every 50 records update.

Regards,

Bysani.

Read only

naimesh_patel
Active Contributor
0 Likes
1,636

Can you process them in parallel?

If it is BAPI, it would be a ALE interface (IDOC) generated for it. If not you can generate for that BAPI.

From your program create IDOCs and use the RBDAPP01 to process those IDOCs.

RBDAPP01 has an option to process them in parallel by setting up the packet size. This parallel processing could use as many available work processes to process your recrods.

Regards,

Naimesh Patel