cancel
Showing results for 
Search instead for 
Did you mean: 

Copy dates from service request to its follow up request.

former_member680819
Discoverer
0 Kudos

Hi All,

I am trying to copy the dates from the master service request to its child request. I have added the code in the copy_badi method DATES. But still this is not working. Could anyone help me out resolving this.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Arup,

In the DATES method, there is a changing parameter CT_INPUT_FIELDS. It has another sorted internal table FIELD_NAMES as its last field. Now you must have put your dates in changing parameter CS_DATES probably fields TIMESTAMP_FROM and TIMESTAMP_TO and possibly other fields as well. So you need to pass these field names i.e. TIMESTAMP_FROM and so on in the FIELD_NAMES internal table for your date type.

This should solve your problem.

Cheers,

Niraj

former_member680819
Discoverer
0 Kudos

Hi Niraj,

Thanks a lot for your answer. Issue resolved.

Cheers

Arup

vicky_upadhyay
Explorer
0 Kudos

Hi Arup,

Can you help me to solve this type of error ,

The requirement is: when I create a service request task the <b>dates</b> that belongs to Service request need to be copied to the following activity "Order Planned" date.

I tried by putting a break point in method DATES of CRM_COPY_BADI, this break point is not triggering at all while I am creating Follow up document i.e Activity.

Could you  please help me in understanding why the DATES method is not called on creating TASK followup from LEAD, whereas DATES method gets called when creating followup for Activity.


How to resolve , I am new in CRM ABAP.



Vicky

former_member680819
Discoverer
0 Kudos

Hi Vicky,

Greetings. With your issue there are two things which might impacting this.

1. To get the dates copied properly from one document to its follow up document, the copy routine has to be maintained properly in the customization.Here it should be maintained between lead to task.

2. To copy the dates, the date types has to be maintained in the date profile in both the transaction type. Ie both in lead and task.

You can go through the below link which will give you a better insight.

https://scn.sap.com/thread/2069960

However if you want to copy the dates then you can do it in order_save badi, Below is the set of code which copy a date field from oppt to quote. You can refer the same and do necessary changes based on your requirement.

method IF_EX_ORDER_SAVE~PREPARE.

    data: ls_source         type SIBFLPORB,
          ls_target type SIBFLPORB,
    lt_doc_flow_wrk TYPE CRMT_DOC_FLOW_WRKT,
    ls_doc_flow_wrk like LINE OF lt_doc_flow_wrk,
    lv_plandate type CGPL_PLANSTART,
    ls_oppt_h type CRMT_OPPORT_H_COM,
    lt_oppt_h type CRMT_OPPORT_H_COMT,
    lt_orderadm_h TYPE crmt_orderadm_h_comt,
    ls_orderadm_h TYPE crmt_orderadm_h_com,
    ls_fieldname TYPE crmt_input_field_names,
    ls_input_fields      TYPE crmt_input_field,
    lt_input_fields      TYPE crmt_input_field_tab.

    CONSTANTS: lc_create type char1 VALUE 'A',
               lc_refhdl TYPE char10 VALUE '0000000001'.


    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
      EXPORTING
        IV_HEADER_GUID           = IV_GUID
*       IV_ITEM_GUID             =
*       IT_HEADER_GUID           =
*       IT_ITEM_GUID             =
*       IS_FILTER                =
*       IV_INCLUDE_DELETED_ITEMS =
*       IV_RELATION_ID           =
      IMPORTING
        ET_DOC_FLOW_WRK          = lt_doc_flow_wrk.
*     ET_DOC_FLOW_PLNK_ATTR          =
*     ET_DOC_FLOW_PNT_ATTR           =
*     ET_DOC_FLOW_IPLK_ATTR          =
    Read table lt_doc_flow_wrk into ls_doc_flow_wrk INDEX 1.

    select single PLANSTART from cgpl_project into lv_plandate where GUID = ls_doc_flow_wrk-OBJKEY_A.

    ls_orderadm_h-guid             = iv_guid.
    INSERT ls_orderadm_h INTO TABLE lt_orderadm_h.

    ls_oppt_h-MODE    = lc_create.
    ls_oppt_h-ref_handle    = lc_refhdl.
    ls_oppt_h-STARTDATE = lv_plandate .
    APPEND ls_oppt_h TO lt_oppt_h.

  ls_fieldname-fieldname     = 'STARTDATE'.
  INSERT ls_fieldname INTO TABLE ls_input_fields-field_names.
  ls_input_fields-ref_handle = 1.
  ls_input_fields-ref_kind    = 'A'.
  ls_input_fields-objectname  = 'OPPORT_H'.
  INSERT ls_input_fields INTO TABLE lt_input_fields.

  CALL FUNCTION 'CRM_ORDER_MAINTAIN_SINGLE_OW'
    EXPORTING
      IS_OPPORT_H     = ls_oppt_h
    CHANGING
      CS_ORDERADM_H   = ls_orderadm_h
      CT_INPUT_FIELDS = lt_input_fields.


  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

Hope this will resolve your issue.

Regards

Arup

Answers (0)