SAP for Retail Discussions
Join conversations about personalization, omnichannel strategies, and operational excellence in retail using SAP for Retail software.
cancel
Showing results for 
Search instead for 
Did you mean: 

Record being Deleted when we modify any thing from T-Code:VK12

rajesh_rai4
Explorer
0 Kudos

Hi expert,

     any one can help me when we have done any change from T-code:vk12 old one record being Deleted.please help?

Regards,

Rajesh Kumar Rai

4 REPLIES 4

former_member198994
Participant
0 Kudos

Hi Rajesh,

From your post I am unclear of your steps in VK12. Will you be able to tell us more?

If you are changing the values for same validity period, system does overwrite the values. but condition record number remains the same. you can check the same in A table.

Regards,

Raja

Former Member
0 Kudos

Hi Rajesh,

Your records may be overwritten due to the change in price condition or due to overlapping of valid period.

you can use the BAPI_PRICES_CONDITION.if you want to delete the old record from access sequence table and keep only
the new record,use RV_CONDITION_COPY

CALL FUNCTION 'RV_CONDITION_COPY'
    EXPORTING
      application              = 'V'
      condition_table          = '999'      " cond. table
      condition_type           = lc_kschl   " cond. type
*     date_from                = '20120505' " valid on
*     date_to                  = '99991231' " valid to
      enqueue                  = 'X'        " lock entry
      i_komk                   = ls_komk
      i_komp                   = ls_komp
      key_fields               = ls_komg    " key fields
      maintain_mode            = 'A'        " A= create
                                            " B= change,
                                            " C= display
                                            " D= create
*  with reference
      no_authority_check       = 'X'
      keep_old_records         = 'X'
      overlap_confirmed        = 'X'
      no_db_update             = space
    IMPORTING
      e_komk                   = ls_komk
      e_komp                   = ls_komp
      new_record               = g_new_record
    TABLES
      copy_records             = lt_komv
    EXCEPTIONS
     enqueue_on_record                 = 1
     invalid_application               = 2
     invalid_condition_number          = 3
     invalid_condition_type            = 4
     no_authority_ekorg                = 5
     no_authority_kschl                = 6
     no_authority_vkorg                = 7
     no_selection                      = 8
     table_not_valid                   = 9
     no_material_for_settlement        = 10
     no_unit_for_period_cond           = 11
     no_unit_reference_magnitude       = 12
     invalid_condition_table           = 13
     OTHERS                            = 14
           
   IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.


Here, you have an option to keep old records or not. Also, use the below FM together with RV_CONDITION_COPY.


CALL FUNCTION 'RV_CONDITION_SAVE'.
   CALL FUNCTION 'RV_CONDITION_RESET'.
* necessary to write data
   COMMIT WORK.

0 Kudos

Hi Expert,

      i want  to keep old record also for ref Purpose.so please suggest what we have to do.

Regards,

RAjesh

0 Kudos

Hi Rajesh,

In V/06 (Condition Type Maintenance), choose SPACE (Do Not delete) for delete fr. DB. This will ensure that condition records are not getting deleted from DB, however will be archived when archive run is carried out. However this setting is valid for physical deletion of condition records.

Now if you are talking about having having both old and new condition records of same validity in the system, default system behavior is overwrite the existing condition record with new values. However an audit trail (VK12 -> environment -> changes) is available on the condition record recording all the past history.

If you want to prevent overwriting of condition record, it is best to manually delete (set deletion indicator) on the condition record in VK12 and then create a new condition record with same validity period. In this way, you will have both the records but manual intervention is required.

Hope this helps.

Regards,

Raja