PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

AnyTabUpdateTask

An ABAP utility that saves any internal table to its database table inside CALL FUNCTION ... IN UPDATE TASK with one call, plus classes for grouping and walking internal tables.

Making a database change inside an update task otherwise means a function module and a table type written for that one table, which is what the README's own counter-example shows. AnyTabUpdateTask replaces both with one call: NEW zcl_c8a005_save2db( )->save2db( iv_tabname = ... it_tab_content = ... )->do_commit_if_any( ), which takes the table name and the internal table and commits them, and the table name can be left out. Several tables can be queued on one instance and committed in one step, where an empty table is not taken into account. Beside it, zcl_c8a005_group_tab groups an internal table by a field and walks the groups. The main functionality sits in package ZC8A_005, with a demo report in the separate sub-package ZC8A_005_DEMO, and checkpoint group ZC8A005_CONTROL can be switched on in transaction SAAB for debugging and tracing.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
Transactional modelABAPTransactional modelcapabilityHow a business object's behaviour is defined and who owns the transaction — the choice that shapes everything downstream in an application.

Who is behind it

OlegBash599OlegBash599PersonMaintains this
In the atlas: maintains 3, contributes to 3
@OlegBash599
maintainer

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
Inside its host
Distributed through
does not say

Connections1

README

quoted from OlegBash599/AnyTabUpdateTask under MIT, read
OlegBash599/AnyTabUpdateTask/README.mdOn GitHub

AnyTabUpdateTask

Utility for DataBase Changes in Update Task and OOP&Functional working with internal tables

Utility is for avoiding creation additional function modules and table types for stable and fast code-writing. Utility is for object-oriented and functional approach of internal-table processing.

Main functionality is in package ZC8A_005.
Demo-report is in addtional sub-package ZC8A_005_DEMO which is in separate folder(https://github.com/OlegBash599/AnyTabUpdateTask/tree/main/src/zc8a_005_demo) in this repository.


Simple Example for MODIFY table using this utility:

    DATA lc_db_tab_sample TYPE tabname VALUE 'ZTC8A005_SAMPLE'.
    DATA lt_sample_tab TYPE STANDARD TABLE OF ztc8a005_sample.

    lt_sample_tab = VALUE #(
        ( entity_guid = 'ANY_SIMPL_GUID_MOD' entity_param1 = 'CHAR10' entity_param2 = '0504030201' )
        ( entity_guid = 'ANY_SIMPL_GUID2_MOD' entity_param1 = '2CHAR10' entity_param2 = '0102030405'  )
        ( entity_guid = 'ANY_SIMPL_GUID2_DEL' entity_param1 = '2CHAR10' entity_param2 = '777909034' )
        ).

    NEW zcl_c8a005_save2db(
      )->save2db( iv_tabname = lc_db_tab_sample
                  it_tab_content = lt_sample_tab )->do_commit_if_any( ).

Without this utlity it could be like that (with creation of additional objects)

Show update by function (without the utility AnyTabUpdateTask)
    DATA lt_sample_tab TYPE STANDARD TABLE OF ztc8a005_sample.

    lt_sample_tab = VALUE #(
        ( entity_guid = 'ANY_SIMPL_GUID_MOD' entity_param1 = 'CHAR10' entity_param2 = '0504030201' )
        ( entity_guid = 'ANY_SIMPL_GUID2_MOD' entity_param1 = '2CHAR10' entity_param2 = '0102030405'  )
        ( entity_guid = 'ANY_SIMPL_GUID2_DEL' entity_param1 = '2CHAR10' entity_param2 = '777909034' )
        ).

    CALL FUNCTION 'Z_C8A_005_DEMO_UPD_SAMPLE'
      IN UPDATE TASK
      EXPORTING
        it_sample = lt_sample_tab.
  
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = abap_true.
  

Example for several tables

Utility AnyTabUpdateTask for several Tables
    DATA lc_db_tab_sample TYPE tabname VALUE 'ZTC8A005_SAMPLE'.
    DATA lt_sample_tab TYPE STANDARD TABLE OF ztc8a005_sample.
    DATA lt_sample_empty_tab TYPE STANDARD TABLE OF ztc8a005_sample.
    DATA lt_head_tab TYPE STANDARD TABLE OF ztc8a005_head.
    DATA lt_item_tab TYPE STANDARD TABLE OF ztc8a005_item.
    DATA lv_ts TYPE timestamp.
    DATA lo_saver_anytab TYPE REF TO zcl_c8a005_save2db.

    GET TIME STAMP FIELD lv_ts.

    lt_sample_tab = VALUE #(
        ( entity_guid = 'ANY_GUID_MOD' entity_param1 = 'CHAR10' entity_param2 = '0504030201'
            entity_param3 = sy-uzeit entity_param4 = sy-datum entity_param5 = lv_ts )
        ( entity_guid = 'ANY_GUID2_MOD' entity_param1 = '2CHAR10' entity_param2 = '0102030405'
          entity_param3 = sy-uzeit entity_param4 = sy-datum entity_param5 = lv_ts )
        ( entity_guid = 'ANY_GUID2_DEL' entity_param1 = '2CHAR10' entity_param2 = '777909034'
          entity_param3 = sy-uzeit entity_param4 = sy-datum entity_param5 = lv_ts )
        ).

    lt_head_tab = VALUE #(
        ( head_guid = 'ANY_GUID_UPD' head_param1 = 'ANY_GUID_ADD' head_param2 = '9988776655'
            head_param3 = sy-uzeit head_param4 = sy-datum head_param5 = lv_ts )
        ( head_guid = 'ANY_GUID2_UPD' head_param1 = 'ANY_GUID2_ADD' head_param2 = '9988776655'
            head_param3 = sy-uzeit head_param4 = sy-datum head_param5 = lv_ts )
        ( head_guid = 'ANY_GUID_DEL' head_param1 = 'ANY_GUID_ADD' head_param2 = '9988774444'
            head_param3 = sy-uzeit head_param4 = sy-datum head_param5 = lv_ts )
        ( head_guid = 'ANY_GUID2_DEL' head_param1 = 'ANY_GUID2_ADD' head_param2 = '9988774444'
            head_param3 = sy-uzeit head_param4 = sy-datum head_param5 = lv_ts )
     ).

    lt_item_tab = VALUE #(
        ( head_guid = 'ANY_GUID_UPD' item_guid = 'ANY_ITEM_GUID_ADD' item_param1 = '2CHAR10' item_param2 = '9988776655'
            item_param3 = sy-uzeit item_param4 = sy-datum item_param5 = lv_ts )
        ( head_guid = 'ANY_GUID2_UPD' item_guid = 'ANY_ITEM_GUID2_ADD' item_param1 = '2CHAR10'
            item_param3 = sy-uzeit item_param4 = sy-datum item_param5 = lv_ts )
        ( head_guid = 'ANY_GUID_DEL' item_guid = 'ANY_ITEM_GUID_ADD' item_param2 = '9988776655'
            item_param3 = sy-uzeit item_param4 = sy-datum item_param5 = lv_ts )
        ( head_guid = 'ANY_GUID2_DEL' item_guid = 'ANY_ITEM_GUID2_ADD' item_param1 = '2CHAR10'
            item_param3 = sy-uzeit item_param4 = sy-datum item_param5 = lv_ts )
    ).


    CREATE OBJECT lo_saver_anytab.
    lo_saver_anytab->save2db( EXPORTING iv_tabname     = lc_db_tab_sample
                                        it_tab_content = lt_sample_tab ).

    lo_saver_anytab->save2db( EXPORTING iv_tabname     = 'ZTC8A005_HEAD'
                                        it_tab_content = lt_head_tab ).

    lo_saver_anytab->save2db( EXPORTING iv_tabname     = 'ZTC8A005_ITEM'
                                        it_tab_content = lt_item_tab ).

    CLEAR lt_sample_empty_tab.
    lo_saver_anytab->save2db( EXPORTING iv_tabname     = lc_db_tab_sample
                                        it_tab_content = lt_sample_empty_tab ).


    " #RU:обновление всех таблиц будет одномоментно после commit
    " #EN:database changes are to be after commit-command
    " #RU:а по пустой таблицы ничего происходить не будет (не будет поставлен Update Task)
    " #EN: empty table does not take into account while commit command
    lo_saver_anytab->do_commit_if_any( ).
  

Option not to pass table name
    DATA lt_sample_tab TYPE STANDARD TABLE OF ztc8a005_sample.

    lt_sample_tab = VALUE #(
        ( entity_guid = 'ANY_SIMPL_GUID_MOD' entity_param1 = 'CHAR10' entity_param2 = '0504030201' )
        ( entity_guid = 'ANY_SIMPL_GUID2_MOD' entity_param1 = '2CHAR10' entity_param2 = '0102030405'  )
        ( entity_guid = 'ANY_SIMPL_GUID2_DEL' entity_param1 = '2CHAR10' entity_param2 = '777909034' )
        ).

    CREATE OBJECT lo_saver_anytab.
    lo_saver_anytab->save2db( EXPORTING it_tab_content = lt_sample_tab )->do_commit_if_any( ).

for the sake of fast debugging and tracing ControlGorup is added ZC8A005_CONTROL. So it is possible to switch on and off ControlGroup via tcode SAAB.


Additional examples and descriptions are on https://olegbash.ru/anytabupdatetask


The blog about the utility with commens is on https://blogs.sap.com/2022/08/21/database-update-with-utility-anytab-updatetask/


The well-structured educational and library source SAPLAND.ru: https://sappro.sapland.ru/kb/articles/stats/konsistentnoe-obnovlenie-bazi-dannih-pri-pomoschi-phunktsionala-any-tab-update-t.html


In Russian you can add your comments here: The Old-Merry SAPFORUM: https://sapboard.ru/forum/viewtopic.php?f=13&t=100324


HABR-blog https://habr.com/ru/articles/787282/

Object-Oriented grouping

details are in unit test and in demo-report

    DATA lt_fi_doc TYPE tt_fi_doc.

    DATA lt_fi_doc_sum_by_kunnr TYPE tt_fi_doc.

    _fill_mock( IMPORTING et_fi_doc = lt_fi_doc ).

    mo_cut->set_in( it = lt_fi_doc )->group_by(
         EXPORTING iv_f1 = 'KUNNR' ).

    CLEAR lt_fi_doc_sum_by_kunnr.
    WHILE mo_cut->has_next_grp( ) EQ abap_true.
      mo_cut->get_next_grp( ).
      _calc_sum_in_group( EXPORTING io_tab_group = mo_cut
                          CHANGING ct_fi_doc_sum = lt_fi_doc_sum_by_kunnr ).
    ENDWHILE.
TODO list
MIT, read

Details

Sources3
Added by handdiscovered herechecked
github.com/OlegBash599/AnyTabUpdateTasktree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, data-and-persistence
abaplint
issues under its own abaplint configuration1,018
lines2,735
statements1,646
objects22
files46
analysed, main
abaplint version2.120.84
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:olegbash599-anytabupdatetask
JSON
/artifacts/olegbash599-anytabupdatetask.json
MCP
Connecting an agent