Skip to Content
avatar image
Former Member

How to do a commit from update task mode.

Hi guys!

I have a problem, inside a function module called in update task mode I need to add a record to a Z table and do a commit so its available in a step later in the same process.

If I do a commit, I get a dump because you can't do that. I tried another thing, to call another function module as a new task and inside this FM add the insert and the commit. It's not doing anything.

Code works because if I execute the first FM from SE37 as a normal FM, the records is added to the table.

So, is there a way to add a record to a table and do the correspondent commit inside a FM called in update task mode? Keep in mind that I'm doing a select to retrieve this record in a posterior step, that's why I need it, I'm adding functionality to an existing program and trying to modify as little as I can.

Thanks for your help!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 08, 2017 at 01:50 AM

    Hi,

    The code which you are using to update the z table, place it in a RFC enabled function module and write a commit statement inside this RFC enabled FM.

    Call this RFC enabled FM from the main program or FM as DESTIANTION 'NONE'.

    EG: CALL FUNCTION '<RFC ENABLED FM>' DESTINATION 'NONE'.


    In this way you can avoid dump and you can update the z table.

    Refer notes 1895298, 896173

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 06, 2017 at 08:56 PM

    How exactly is the later step performed? Read consistency means your select should already 'see' the new data if it is in the same LUW, So im wondering whether there's some caching or something involved or it's going into another LUW?

    Alternatively, is it possible to transport the updated info to the later step? Perhaps using a static class attribute or something like that.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 07, 2017 at 02:33 PM

    But why an explicit commit? Inside an update FM and everything called there you are by default inside a DB LUW. There are no rollbacks, only in case of errors.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 07, 2017 at 06:19 AM
    -1

    Hi,

    You can do a Commit after call the FM in update task mode, so the FM will be execute and add the record, but in fact it is the same as call the FM in normal way.

    Best regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 06, 2017 at 11:29 PM
    -4

    Try:

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    wait = 'X'.

    Add comment
    10|10000 characters needed characters exceeded