Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Help needed for badi order_save - change to header

Hello,

I'm trying to make a custom description for an crm transaction(activitiy). Can anyone give me some sample code or help for the <<change_before_save>> method.

I can read the data from the memory but I need some help on changing it.

method IF_EX_ORDER_SAVE~CHANGE_BEFORE_UPDATE.

  INCLUDE crm_object_names_con.

  DATA : lt_act_guid   TYPE crmt_object_guid_tab,
         x_guid        TYPE BALLOGHNDL,
         lt_orderadm_h TYPE crmt_orderadm_h_wrkt,
         ls_orderadm_h TYPE crmt_orderadm_h_wrk,
         ls_activity_h TYPE crmt_activity_h_wrkt,
         importob      TYPE crmt_object_name_tab.
  DATA : ls_changes    TYPE CRMT_INPUT_FIELD_NAMES,
         lt_changes    TYPE CRMT_INPUT_FIELD_NAMES_TAB,
         ls_header     TYPE CRMT_ORDERADM_H_COM.

  REFRESH lt_act_guid.
  APPEND iv_guid to lt_act_guid.

  CALL FUNCTION 'CRM_ORDER_READ_OW'
   EXPORTING
     IT_HEADER_GUID                    = lt_act_guid
   IMPORTING
     ET_ORDERADM_H                     = lt_orderadm_h
     ET_ACTIVITY_H                     = ls_activity_h
    CHANGING
      CV_LOG_HANDLE                    = x_GUID
            .

  ls_changes-fieldname = 'a new description'.
  ls_changes-CHANGEABLE = '  '.
  append ls_changes to lt_changes.

  LOOP at lt_orderadm_h INTO ls_orderadm_h.
    MOVE-CORRESPONDING ls_orderadm_h to ls_header.
    ls_header-description = 'DESCRIPTION'.
  ENDLOOP.

I think i need FUNCTION 'CRM_ORDERADM_H_MAINTAIN_OW but I can't get it working and

what about FUNCTION 'CRM_ORDERADM_H_CHANGE_OW'?

Kind regards,

Frederik

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question