Application Development 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: 

Performance issue with BAPI_ACC_DOCUMENT_POST

former_member361810
Participant
0 Kudos
1,780

Hello All,

Does anyone know or have experienced any performance issue with BAPI_ACC_DOCUMENT_POST?

I'm using this bapi ABAP code but is very slow, each document posting takes almost up to 1,4 minutes.

Each document contain 998 line items (debit and credit).

This program run a batch job. I'm posting 38 documents on an average takes up to 55 minutes.

After the posting, the program checking the processing message returned by the BAPI.

Would something have to be done in this situation or would it be necessary to parallelize this part of the code?

So how to implement multiple BAPI calls (parallelism). Have you any idea? May be another approach?

Thanks in advance,

 CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader = wa_document-documentheader
      IMPORTING
        obj_key        = lv_obj_key
      TABLES
        accountgl      = wa_document-accountgl_t
        currencyamount = wa_document-currencyamount_t
        criteria       = lt_criteria
        extension1     = lt_extension1
        return         = lt_return.


    DELETE lt_return WHERE type   EQ c_msg_type_e
                       AND id     EQ c_id_rw
                       AND number EQ c_msgnumb_609.


    READ TABLE lt_return
      WITH KEY type = c_msg_type_e
      INTO wa_return.
    IF sy-subrc EQ 0.


      PERFORM f_store_message
        USING wa_document
              wa_return
              abap_true
              space.
    ELSE.


      DESCRIBE TABLE lt_return LINES lv_lines.
      READ TABLE lt_return INTO wa_return INDEX lv_lines.
      IF sy-subrc EQ 0.


        IF wa_return-type EQ c_msg_type_s.


          CLEAR wa_return_commit.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait   = abap_true
            IMPORTING
              return = wa_return_commit.
          IF NOT wa_return_commit IS INITIAL.


            PERFORM f_store_message
              USING wa_document
                    wa_return_commit
                    abap_true
                    space.
          ELSE.


            PERFORM f_store_message
              USING wa_document
                    wa_return
                    abap_true
                    space.


            PERFORM f_add_item_txt_long
              USING lv_obj_key
                    wa_document-itm_text_t.


          ENDIF.


        ELSE.


          PERFORM f_store_message
            USING wa_document
                  wa_return
                  abap_true
                  space.
        ENDIF.
      ENDIF.
    ENDIF.
5 REPLIES 5

eduardo_hinojosa
Active Contributor
0 Kudos
669

Hi Raphael,

As I can see you are using EXTENSION1. Please, check the enhancements mentioned in note 487722 - Using EXTENSION1 for accounting BAPIs, eg: enhancement ACBAPI01, BTE RWBAPI01.

I hope it helps you

Regards

Eduardo

0 Kudos
669

Hi Eduardo,

Do you believe this slowness is related to the code for this part (EXTENSION1)?

We are already using it according to the note orientation.

...
lt_extension1    TYPE STANDARD TABLE OF bapiacextc,
...

Regards, Raphael

0 Kudos
669

Hi Raphael,

Maybe you need to populate a field there is not in the interface, so, you need to use an enhancement, check if there is any SELECT, which table is read, if you are using key or indexes. Maybe the easy is to run a trace with ST05 and check the output, usually this analysis reports the bottleneck, usually in SQL.

I hope it helps you

Regards

Eduardo

former_member361810
Participant
0 Kudos
669

I ran ST05 and noticed that what takes longer is BAPI_ACC_DOCUMENT_POST.

Would it be necessary to parallelize this part of the code?

So how to implement multiple BAPI calls (parallelism).

Have you any idea?

Thanks

former_member1716
Active Contributor
0 Kudos
669

Hello Raphael Domingues,

The time take by the BAPI is too high, i would suggest below steps to proceed further:

1) You should be using loop to process all the documents, Ensure the data is cleared after each run.

2) Try running the BAPI independently in SE37, may be by saving the test Variant in the debugger. Check if the performance is same.

3) Run the trace for both SE37 and your program, see if the performance is same.

4) Check for any important notes for this BAPI in your SAP version manual.

5) Your Final call would be reaching out to SAP with clear data, they could help you to resolve the same. I have improved performance of few BAPIs in my system by contacting SAP. Please make sure you have sufficient data and analysis to furnish.

Hope it helps!