Skip to Content

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

Problem with BAPI

hi,

I have written a se38 program to change the status o an activity in a complaint tcode CIC0. I have written the following coed. but then it doesn't work I am forwarding the code too. can you please cgeck and tell me where I am going wrong :

REPORT  Z_CRMORDERREAD.

data : lt_header_guid type CRMT_OBJECT_GUID_TAB,
       wa_header_guid type CRMT_OBJECT_GUID,
       lt_doc_flow type CRMT_DOC_FLOW_WRKT,
       wa_doc_flow type CRMT_DOC_FLOW_WRK,
       lt_status type CRMT_STATUS_WRKT,

       h_header type table of BAPIBUS2000110_HEADER_INS,
       wah_header type BAPIBUS2000110_HEADER_INS, " work area

       hx_header type table of bapibus2000110_header_insx,
       wahx_header type bapibus2000110_header_insx, " work area

       s_status type table of BAPIBUS20001_STATUS_INS,
       was_status type BAPIBUS20001_STATUS_INS, " work area

       sx_status type table of BAPIBUS20001_STATUS_INSX,
       wasx_status type BAPIBUS20001_STATUS_INSX. " work area

data : return type table of BAPIRET2.

   wa_header_guid = '443A2B18B2AA01D802000000888DE636'.
*                    443A2B18B2AA01D802000000888DE636
     append wa_header_guid to lt_header_guid.

     CALL FUNCTION 'CRM_ORDER_READ'
      EXPORTING
         IT_HEADER_GUID                = lt_header_guid
      IMPORTING
         ET_STATUS                     = lt_status
         ET_DOC_FLOW                   = lt_doc_flow
               .
     IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.

*loop at lt_doc_flow into wa_doc_flow.
*write :/ wa_doc_flow-objkey_b.
wah_header-GUID = wa_header_guid. "wa_doc_flow-objkey_b.
*was_status-ref_guid = wa_header_guid. "wa_doc_flow-objkey_b.
append wah_header to h_header.
*endloop.

wahx_header-GUID = 'X'.
append wahx_header to hx_header.

was_status-ref_guid = wa_doc_flow-objkey_b.
was_status-status = 'E0004'.
append was_status to s_status.

wasx_status-ref_guid = 'X'.
wasx_status-status = 'X'.
append wasx_status to sx_status.


CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
 TABLES
   HEADER              = h_header
   HEADERX             = hx_header

   STATUS              = s_status
   STATUSX             = sx_status
   RETURN              = return
          .


commit work.
write sy-subrc.
*loop at return.
*
*endloop.

break-point.

Regards,

Vijay.

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