Skip to content

Instantly share code, notes, and snippets.

@JouryJonkergouw
Created January 26, 2017 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JouryJonkergouw/2b714c57e31e9143880139dc17fc1f3c to your computer and use it in GitHub Desktop.
Save JouryJonkergouw/2b714c57e31e9143880139dc17fc1f3c to your computer and use it in GitHub Desktop.
FUNCTION ZBW_KEYFIG_WHERE_USED.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_IOBJNM) TYPE RSD_IOBJNM
*" EXPORTING
*" REFERENCE(E_T_COMPLIST) TYPE RZD1_T_COMPDIR_COMPIC
*"----------------------------------------------------------------------
FIELD-SYMBOLS:
<l_s_complist> TYPE rzd1_s_compdir_compic.
DATA:
l_th_where_used TYPE rzd1_th_where_used_list,
l_s_where_used TYPE rzd1_s_where_used_list,
l_t_complist TYPE rzd1_t_compdir_compic,
l_t_uid TYPE rsz_t_uid,
l_th_eltxref TYPE rzd1_th_eltxref,
l_ts_eltxref TYPE SORTED TABLE
OF rzd1_s_eltxref
WITH NON-UNIQUE KEY teltuid
INITIAL SIZE 200,
l_ts_xref_full TYPE rzd1_ts_eltxref.
CALL FUNCTION 'RSZ_DB_FULL_XREF_GET'
EXPORTING
i_objvers = 'A'
IMPORTING
e_ts_eltxref = l_ts_xref_full.
CALL FUNCTION 'RSZ_DB_KEYFIG_WHERE_USED'
EXPORTING
i_iobjnm = i_iobjnm
i_objvers = 'A'
IMPORTING
e_th_element_uid = l_th_where_used.
SELECT compuid INTO TABLE l_t_uid
FROM v_compdir_compic
FOR ALL ENTRIES IN l_ts_xref_full
WHERE deftp = 'REP' AND
objvers = 'A' AND
infocube = l_ts_xref_full-infocube.
CALL FUNCTION 'RSZ_P_DB_RESOLVE_XREF'
EXPORTING
i_t_eltuid = l_t_uid
IMPORTING
e_th_eltxref = l_th_eltxref
EXCEPTIONS
OTHERS = 0.
l_ts_eltxref = l_th_eltxref.
LOOP AT l_th_where_used
INTO l_s_where_used.
CLEAR l_t_complist.
* Only check UID belongs to interested InfoCube/query
READ TABLE l_ts_eltxref TRANSPORTING NO FIELDS
WITH KEY teltuid = l_s_where_used-uid.
CHECK sy-subrc EQ 0.
IF abap_true = rs_c_false.
* want to have direct usage only
* must remove reusable elements
CALL FUNCTION 'RRMS_MESSAGE_OFF'.
CALL FUNCTION 'RSZ_DB_COMP_EXIST'
EXPORTING
i_objvers = 'A'
CHANGING
c_compuid = l_s_where_used-uid
EXCEPTIONS
component_not_found = 1
parameter_error = 0
no_infocube_found = 0.
IF sy-subrc = 0.
* skip components
CONTINUE.
ENDIF.
CALL FUNCTION 'RRMS_MESSAGE_OFF_RESET'.
ENDIF.
CALL FUNCTION 'RSZ_P_WHERE_USED_COMPLIST_GET'
EXPORTING
i_eltuid = l_s_where_used-uid
i_objvers = 'A'
i_queries_only = abap_true
i_ts_eltxref = l_ts_xref_full "MP N1691039
IMPORTING
e_t_complist = l_t_complist.
LOOP AT l_t_complist
ASSIGNING <l_s_complist>.
* COLLECT <l_s_complist> INTO e_t_complist.
* UMB_SC COLLECT_OVERFLOW_TYPE_P dump and error UMK 202
* This is a short dump, to be applied in support package.
READ TABLE e_t_complist TRANSPORTING NO FIELDS
WITH KEY compuid = <l_s_complist>-compuid
objvers = <l_s_complist>-objvers.
IF sy-subrc NE 0.
INSERT <l_s_complist> INTO TABLE e_t_complist.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFUNCTION.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment