Skip to Content

Read value changed in a workitem in mdg

May 18, 2017 at 03:45 PM


avatar image

Hi Experts ,

During change operation of a business partner requester submit the changes to 1 st approves and if approver changes the data and approves it has to go to next ( i.e) approver 2 else it has to activate the change request .


req (changes data and submit) --> APP1 ( if he edits and changes data ) ----> appr2 ( approves and activate)


req (changes data and submit) --> APP1 ( approves and activate)

I am facing challenges in reading the changes done by approver 1 in the WF level data changed since it overwrites staging area during requestor and approver changes . Please share your valuable inputs


Suresh PC

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Pavan Bhamidipati May 19, 2017 at 06:32 AM

Hi Suresh,

Below code will help you to read the change document of a CR.

 BEGIN OF s_document_header,
 change_request TYPE usmd_crequest,
 edition TYPE usmd_edition,
 changed_by TYPE xubname,
 changed_at TYPE sycdate,
 changed_on TYPE sytime,
 document_number TYPE cdchangenr,
 wdy_application TYPE sytcode,
 objectcl TYPE cdobjectcl, 
 objectid TYPE cdobjectv, 
 END OF s_document_header .

 t_document_header TYPE SORTED TABLE
 OF s_document_header
 WITH UNIQUE KEY document_number .

PARAMETERS: p_crnum TYPE usmd_crequest.

DATA lc_model TYPE usmd_model VALUE '0G'.
DATA lo_usmd_chg_doc TYPE REF TO cl_usmd_mdf_change_document.
DATA lo_if_model TYPE REF TO if_usmd_model.
DATA lt_crequest TYPE SORTED TABLE OF usmd_crequest WITH UNIQUE KEY table_line.
DATA ls_crequest TYPE usmd_crequest .
DATA lt_doc_hdr TYPE t_document_header.
DATA ls_doc_hdr TYPE s_document_header.
DATA lt_cg_doc_val TYPE usmd_ts_change_document_value.
DATA lt_cg_doc_chng TYPE usmd_th_change_document_change.
DATA lt_cg_doc_val_comp TYPE usmd_ts_change_document_value.
DATA lt_message TYPE usmd_t_message.

APPEND p_crnum TO lt_crequest.

CALL METHOD cl_usmd_mdf_change_document=>get_instance
 eo_instance = lo_usmd_chg_doc.

CALL METHOD cl_usmd_model=>get_instance
 i_usmd_model = lc_model
 eo_instance = lo_if_model
 et_message = lt_message.

CALL METHOD lo_usmd_chg_doc->read_document_header
 it_crequest = lt_crequest
 io_model = lo_if_model
 et_document_header = lt_doc_hdr.

LOOP AT lt_doc_hdr INTO ls_doc_hdr.
 CALL METHOD lo_usmd_chg_doc->read_document_lines
 is_document_header = ls_doc_hdr
 io_model = lo_if_model
 et_changed_value = lt_cg_doc_val
 et_changed_detail = lt_cg_doc_chng
 et_compound_value = lt_cg_doc_val_comp
 et_message = lt_message.

Call this inside a method of dynamic agents BADI and try to see if the old and new value is same or not and if they are different then simply change the process pattern to auto approval. Make sure you have a auto approval step. I am not so sure what kind of workflow are you using in your case.

Thanks, Pavan

Show 1 Share
10 |10000 characters needed characters left characters exceeded

thanks for your valuable input and it worked .


Suresh PC