使用report找出系统里维护了available status reason的document

157 阅读1分钟

Created by Jerry Wang, last modified on May 14, 2015

执行如下report,得出Opportunity id 521维护了status change reason:

clipboard1
在ui上的drop down list里能看到所有的statuschange reason:
clipboard2

REPORT ZGET_STATUS_REASON.
 
 
 
DATA: wa_spfli   TYPE crmd_orderadm_h,
 
      wa_sflight TYPE sflight,
 
      lt_code      TYPE TABLE OF com_code_f4,
 
      wa_sflight_back TYPE sflight.
 
 
DATA: c1 TYPE cursor,
 
      c2 TYPE cursor.
 
 
OPEN CURSOR @c1 FOR
 
  SELECT *
 
    FROM crmd_orderadm_h
 
    ORDER BY PRIMARY KEY.
 
 
DO.
 
  FETCH NEXT CURSOR @c1 INTO @wa_spfli.
 
  IF sy-subrc NE 0.
 
    EXIT.
 
  ENDIF.
 
 
  CALL FUNCTION 'CRM_SERVICE_OS_GET_DATA'
 
    EXPORTING
 
      iv_ref_guid     = wa_spfli-guid
 
      iv_profile_type = 'H'
 
      iv_ref_kind     = 'A'
 
    TABLES
 
      et_code         = lt_code
 
    EXCEPTIONS
 
      error_occured   = 1
 
      invalid_guid    = 2
 
      invalid_profile = 3
 
      OTHERS          = 4.
 
  IF sy-subrc <> 0 OR lt_code IS INITIAL.
 
    CONTINUE.
 
  ENDIF.
 
 
  WRITE: / 'id: ' , wa_spfli-object_id, ' type: ' , wa_spfli-process_type.
 
  CLOSE CURSOR: @c1.
 
  RETURN.
 
 
ENDDO.
 
 
CLOSE CURSOR: @c1.