Skip to Content
0
Oct 05, 2009 at 03:14 PM

link STXH and CRMD_ORDER_INDEX

74 Views

I have the following code:

DATA: BEGIN OF it_act_search OCCURS 0.
DATA: guid      TYPE crmt_object_guid.
DATA: post_date TYPE crmt_posting_date.
DATA: END OF it_act_search.

SELECT DISTINCT header posting_date_hd
  FROM crmd_order_index
  INNER JOIN but000 ON crmd_order_index~partner_no = but000~partner
  APPENDING table it_act_search
  WHERE ...

SELECT *
  FROM stxh
  INTO CORRESPONDING FIELDS OF TABLE it_stxh
  WHERE tdspras  = lv_spras
  AND   tdid     IN note_types_sel
  AND   tdobject = 'CRM_ORDERH'.

LOOP AT it_act_search INTO wa_act_search.
  READ TABLE it_stxh WITH KEY tdname = wa_act_search-guid.
  IF sy-subrc <> 0.
    DELETE TABLE it_act_search FROM wa_act_search.
  ENDIF.
ENDLOOP.

I now want to eliminate the LOOP because this is taking too much time. How can I link STXH and CRMD_ORDER_INDEX?

I already tried:

SELECT *
  FROM stxh
  INTO CORRESPONDING FIELDS OF T
  FOR ALL ENTRIES IN it_act_sear
  WHERE tdspras = lv_spras
  AND tdname = it_act_search_temp-guid
  AND tdid IN note_types_sel
  AND tdobject = 'CRM_ORDERH'.

but then I get the error message: "When you use the addition "FOR ALL ENTRIES IN itab", the fields "TDNAME" and "IT_ACT_SEARCH_TEMP-GUID" must have the same type and the same length"

Kind regards,

Lieselot