Skip to Content

Original value of a changed attribute

Hi Experts,

Can you please let me know the way to find the original value of a changed attribute?

eg: I have an attribute "NAME" and the original value: ABC

Now, I changed the value to: DEF and click save. At this point of time how do I get the original value ABC before the actual save/commit happens.

I tried the method "IS_PROPERTY_CHANGED" in the class: "CL_CRM_BOL_ENTITY" but doesn't seem to be working.

Thanks in advance.

-Chandra Indukuri

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 19, 2013 at 03:57 AM

    Hi Chandra,

    you can try this in SET_<fieldname> method of attribute.

    in this method code checks the orignal and new value.

    * only set new value if value has changed
    IF <nval> <> <oval>.

    current->set_property(
    iv_attr_name = 'ZZCRMD_COMP' "#EC NOTEXT
    iv_value = <nval> ).

    ENDIF.

    Hope it will help.

    Regadrs,

    @Harish Kumar

    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks for the reply Harish and you are right. BUT I was not clear with my earlier post.

      Here is the extension to my earlier post: Once I know that the Attribute is changed I need to send data to PI. There are around 50 attributes which need to be checked. If some attributes are changed then I need to send "X information is changed" and some other attributes are changed then I need to send "Y information is changed" and in the case of combination "X information is changed and Y information is changed".

      So, instead of checking each attribute in Set-method I am checking in the event handler of "Save". Also checking the BADI's.

      Appreciate your help.

  • Posted on Dec 19, 2013 at 05:12 AM

    Hi,

    You can get it from buffer using CRM_ORDER_READ_OW or from database table . Or you can register call back event FM for event AFTER_CHANGE for your object there you will get old and new values.

    Regards,

    Deepika C.

    Add a comment
    10|10000 characters needed characters exceeded

    • Thank you Deepika for your reply.

      I see that you mentioned the Order FM but I am working on BP. When ever there is a change in the value I need to send the information to PI.

      If there is a change in Address (any one field in the address) then I need to send "Address is changed", if general information is changed then "General information is changed". If both are changed at the same time then I need to send both the above messages.

      Can you elaborate on the AFTER_CHANGE event?

      Thanks,
      Chandra

  • Posted on Dec 19, 2013 at 09:37 PM

    Here is the extension to my earlier post: Once I know that the Attribute is changed I need to send data to PI. There are around 50 attributes which need to be checked. If some attributes are changed then I need to send "X information is changed" and some other attributes are changed then I need to send "Y information is changed" and in the case of combination "X information is changed and Y information is changed".

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 30, 2013 at 12:26 PM

    Hi Chandra,

    Please try the following code :

    lr_tx->check_save_needed( iv_ignore_rejected_entities = abap_true ).

    The method check_save_needed has this code :

    field-symbols: <ENTRY> type CRMT_BOL_TX_MANAG_LINE.

    RV_RESULT = ABAP_FALSE.

    * check if at least one tx context have to be saved

    loop at ME->TRANSACTION_TAB->* assigning <ENTRY>.

    <ENTRY>-DATA_CHANGED = <ENTRY>-TRANSACTION->CHECK_SAVE_NEEDED( IV_IGNORE_REJECTED_ENTITIES ).

    if <ENTRY>-DATA_CHANGED = ABAP_TRUE.

    RV_RESULT = ABAP_TRUE.

    return.

    endif.

    endloop.

    Hope it will help you achieve what you want

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.