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: 

Short dump when calling FM BAPI_TRANSACTION_COMMIT

Former Member
0 Kudos
3,988

Hi,

Short dump when calling BAPI_TRANSACTION_COMMIT after creating GR using BAPI_GOODSMVT_CREATE_OIL.

Please find attached screen short with dump details .

Kindly help me out.

12 REPLIES 12

Ashg1402
Contributor
0 Kudos
927

Hi,

Run it without commit bapi.

According to documentation -

The method can only perform your function if no error messages were generated in the Return table. This is the case if the header data and all the items were processed successfully.

Transaction control is not implemented. The calling program therefore has to execute the Commit Work itself after this method has been successfully invoked (in other words, if no errors were reported in the Return parameter).

Former Member
0 Kudos
927

Hi,

Without COMMIT WORK , How GR will be saved in database.

Can you explain me in details

0 Kudos
927

Hi,

You are reading only one line from bapi return table. There can multiple entries in that table. Suppose first entry is of success/warning and others contain error. In this case your BAPI_Commit won't work.

Try like this:

data: lv_flag type c.

clear lv_flag.

    loop at wlt_ret into wls_ret where ret-type eq 'E'.

        lv_flag = 'X'.

    endloop.

    if lv_flag is initial.

      call function 'BAPI_TRANSACTION_COMMIT'

        exporting

          wait   = '1'.

    endif.

0 Kudos
927

As Bala said, this is explained in details in the ABAP documentation (COMMIT WORK cannot be used in an update task), so please read it and revert back if something in the doc is not clear.

Former Member
0 Kudos
927

Hi Rossi,

How can I avoid this dump without commit work?

Could you please suggest to me.

Thanks in Advance.

0 Kudos
927

Do you have difficulties with understanding the documentation? It's very clear. You must not use commit work (and not database commit too) because it's the pillar of the update concept! Read the doc and revert back with a more precise question (which will prove you made an effort).

former_member196213
Active Participant
0 Kudos
927

Hi,

Everything is looks fine. I believe this call to BAPI_*** and corresponding commit work is inside any Function Module(and that function module is update function module).

We are not suppose to write commit work in update function module.

Just to confirm can you share the Active Calls and Event. And if there are function modules in the stack just check in se37(Attibutes->Processing Type) whether they are update function module.

Best Regards,

Vishal Kumar Yadav

0 Kudos
927

Hello Vishal,

My requirement is

If Invoice created to customer then output type should be trigger. Output type should create PO, based on Purchase order GR will be created automatically.

PO created successfully, Even GR also created but it's not committed to database so no document exits when I am checking in MIGO.

There is no update FM triggered. I believe my code everything correct, Is there any customizing changes required from functional side.

Could you please suggest to me.

Thanks.

0 Kudos
927

There is no update FM triggered.

Sorry but you're wrong; the COMMIT_IN_POSTING exception that you have mentioned (in your screen capture) proves that there is an update task (so there is an update FM).

Maybe you didn't understand that your code is executed by a standard update function module?

former_member197132
Participant
0 Kudos
927

  call function 'BAPI_TRANSACTION_COMMIT'

        exporting

          wait   = 'X'.

raymond_giuseppi
Active Contributor
0 Kudos
927

Is this message not clear enough?


Invalid COMMIT WORK in an update function module

Some developper coded/triggered a COMMIT WORK in an update FM, when this FM is executed in update task this trigger the dump. Correct this, find the BAdI/Exit/enhancemnt in the Abap stack of the dump (or with transaction SM13)

Hints:

  • You could post the whole dump in a txt/xml file, smaller that a partial screen copy...)
  • To check during execution if currently running in update task, use FM  TH_IN_UPDATE_TASK
  • Don't use any update/create BAPI call in a update task, cause you won't be allowed to COMMIT, look for another solution like CALL FUNCTION - IN BACKGROUND TASK
  • Don't call any FM/method that execute a COMMIT WORK in update task (some old BAPI did)
  • Read some documentation like COMMIT WORK online/F1 help or The Update Process  (*)

Regards,

Raymond


(*) so next time you wont any longer write something like "There is no update FM triggered." when executing a COMMIT WORK...

kesavadas_thekkillath
Active Contributor
0 Kudos
927

Check if there are any custom badi or customer exit implemented , in which a commit is triggered.


Regards

Kesav