Skip to Content
avatar image
Former Member

INSERT custom table strange behave

Hi Experts,

I am facing some issue with INSERT entries into custom tables.

FIDCCP02 idoc (Inbound) processing through RDBAPP01 report. I have created Custom function process code and Function module. My requirement is based on some calculation it will update 3 custom tables. When i run the more idoc through this report 2 tables are getting updated and last table is not getting inserted. this behavior only happens for some idocs and some time. when i reprocess the same idoc again all the 3 tables are getting inserted . After insert Catch is handled and error meesage also handled. i could not find the pattern when it goes error.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 05, 2018 at 12:48 AM

    Hi Vinuta Hegde,

    About your issue - "Custom Function Module updating 3 custom tables".

    SAP has best practices for working with this scenario as below.

    1. Create a new one specific custom (Z_INSERT_DB_TABLE) Function Module (abap-fm-update-module.png) which has been flagged as "update function modules".

    2. Inside the new one FM (Z_UPDT_DB_TABLE) implement the ABAP code "PERFORM insert_db_table ON COMMIT." and encapsulates INSERT database statement for custom tables without COMMIT WORK but you can check sy-subrc after each INSERT.

    FORM insert_db_table.
    INSERT z_xpto FROM TABLE gt_xpto[].
    IF sy-subrc NE 0.
    MESSAGE ...

    3. After calling FM (Z_UPDT_DB_TABLE) trigger the COMMIT WORK.

    Let me know the results.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you for your detail description. This issue is resolved by uncomment the COMMIT WORK in function module.Each IDOC processing CUSTOM TABLE is getting INSERT the records and implicit commit is taking care by sap standard it self. When i removed explicit commit after insert statement everything working.

  • May 04, 2018 at 11:30 AM

    Hi Vinuta,

    Can you please check the internal table which is updating custom table has unique primary key values. Also have your written code to update the Custom table, if yes debug your code to check the same. Generally SAP code will not interfere with Custom Code. There could be one more reason, Some idoc's are not having information which i needed to update your 3rd table.

    Hope this is helpful.

    Best Regards,

    Navin Fernandes

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      when we are processing bulk idocs through RDBAPP01 report, some idocs we are facing this issue. But processcode(custom function module related to this idoc) will run for each idoc processing. INSERT is happening in custom function module.