Application Development and Automation 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: 
Read only

Error in multiple operation with change document object for custom table

Former Member
0 Likes
727

hi all,

I have developed a change document object for a custom table ZTEST and developed a report program for insertion, updation & deletion..everything works fine if I do only once ie. if I created only 1 entries. If I created 2 new entries , I am getting an Error "DUPREC:POS&Z3RL_TAB&Z3RL_TAB" and EXIT the transaction.

why I am getting this error??? is it not possible to do multiple operation with the change document???

kindly help.

Edited by: JaiKarthik on Apr 7, 2010 6:20 AM

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
626

Probable reason will be in the CHANGEDOCUMENTUPDATE* function module there will be any duplicate entries while passing values to this function module

a®

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
627

Probable reason will be in the CHANGEDOCUMENTUPDATE* function module there will be any duplicate entries while passing values to this function module

a®

Read only

0 Likes
626

   LOOP AT ts_mod INTO wa_mod.
            READ TABLE <i_itab> INTO <wa_tab> INDEX wa_mod-row.

* Select the existing entries in table Z3RL for change history
                SELECT SINGLE * FROM z3rl
                       INTO wa_z3rl
                       WHERE vkorg   = <wa_tab>+3(4)
                       AND   zzkunnr = <wa_tab>+7(10).
* Move the old entries
                IF sy-subrc = 0.
                  CLEAR ls_z3rl.
                  ls_z3rl = wa_z3rl.
                ENDIF.

* Update the table
             MODIFY (viewname) FROM <wa_tab>.

               CLEAR wa_z3rl.
                wa_z3rl-mandt      = <wa_tab>+0(3).
                wa_z3rl-vkorg      = <wa_tab>+3(4).
                wa_z3rl-zzkunnr    = <wa_tab>+7(10).

* Populate change tables
                CLEAR wa_change.
                wa_change-teilobjid = 'Z3RL'.
                wa_change-textart = 'TEST_2'.
                wa_change-textspr = 'EN'.
                wa_change-updkz = 'U'.
                APPEND wa_change TO ts_change.

*call the fM to log the values in CDHDR table.
                CALL FUNCTION 'Z3RL_WRITE_DOCUMENT'
                  EXPORTING
                    objectid                 = 'Z3RL'
                    tcode                    = sy-tcode
                    utime                    = sy-uzeit
                    udate                    = sy-datum
                    username                 = sy-uname
                    planned_change_number    = ' '
                    object_change_indicator  = 'U'
                    planned_or_real_changes  = 'U'
                    no_change_pointers       = 'U'
                    upd_icdtxt_z3rl= 'U'
                    n_z3rl= wa_z3rl
                    o_z3rl        = ls_z3rl
                    upd_z3rl= 'U'
                    lv_opt                   = ' '
                  TABLES
                    icdtxt_z3rl= ts_change.


            CLEAR : wa_mod, <wa_tab>.
          ENDLOOP.

Edited by: JaiKarthik on Apr 7, 2010 6:49 AM

Read only

Former Member
0 Likes
626

answered