Code: Alles auswählen.
DATA: lv_guid TYPE crmt_object_guid.
DATA: ls_requested_obj TYPE crmt_object_name.
DATA: lt_header_guid TYPE crmt_object_guid_tab, "2 / kommt aus IMPORT ( CRM_ORDER_READ )
lt_requested_obj TYPE crmt_object_name_tab, "2 >>> IMPORT
lt_partner TYPE crmt_partner_external_wrkt, "2 >>> EXPORT
lt_status TYPE crmt_status_wrkt. "2 / kommt aus EXPORT ( CRM_ORDER_READ )
ls_requested_obj = 'PARTNER'.
INSERT ls_requested_obj INTO TABLE lt_requested_obj.
ls_requested_obj = 'STATUS'.
INSERT ls_requested_obj INTO TABLE lt_requested_obj.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid "1
it_requested_objects = lt_requested_obj "1
iv_no_auth_check = 'X'
IMPORTING
et_partner = lt_partner "1
et_status = lt_status "1
EXCEPTIONS
document_not_found = 1
error_occurred = 2
document_locked = 3
no_change_authority = 4
no_display_authority = 5
no_change_allowed = 6
OTHERS = 7.
IF sy-subrc <> 0.
ENDIF.
LOOP AT lt_status INTO ls_status WHERE status = 'I0005'.
LOOP AT lt_partner INTO ls_status WHERE guid = guid.
READ TABLE lt_partner INTO ls_partner WITH KEY guid.
ENDLOOP.
ENDLOOP.
Code: Alles auswählen.
"wir lesen nur gekündigte Stati
LOOP AT lt_status INTO ls_status WHERE status = 'I0005'.
"zu diesen Stati lesen wir den Partner mit dem passenden Schlüssel aus LS_STATUS
READ TABLE lt_partner INTO ls_partner WITH KEY ???.
"gefundenen Partner ausgeben
if sy-subrc = 0.
WRITE: 'Partner ', ls_partner-MyPartnerName, ' ist gekündigt'.
NEW-LINE.
endif.
ENDLOOP.
Folgende Benutzer bedankten sich beim Autor Alexander D. für den Beitrag:
cschmoel