REPORT Z_WHEREUSEDLIST.
TABLES : rsrd1.
TYPE-POOLS : slis.
* Types declaration.
TYPES : BEGIN OF ty_where,
tabname TYPE tabname,
fieldname TYPE fieldname,
rollname TYPE rollname,
END OF ty_where,
BEGIN OF ty_input,
element TYPE rsrd1-ddtype_val,
END OF ty_input,
BEGIN OF ty_table,
tabname TYPE tabname,
END OF ty_table,
BEGIN OF ty_result,
tabname TYPE tabname,
END OF ty_result,
BEGIN OF ty_display,
tabname TYPE tabname,
ddtext TYPE as4text,
END OF ty_display.
* Internal tables declaration.
DATA : it_where TYPE TABLE OF ty_where,
it_input TYPE TABLE OF ty_input,
it_table TYPE TABLE OF ty_table,
it_result TYPE TABLE OF ty_result,
it_display TYPE TABLE OF ty_display,
it_fcat TYPE slis_t_fieldcat_alv,
it_bdcdata TYPE TABLE OF bdcdata.
* Work areas declaration.
DATA : wa_where TYPE ty_where,
wa_input TYPE ty_input,
wa_table TYPE ty_table,
wa_result TYPE ty_result,
wa_display TYPE ty_display,
wa_fcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
wa_bdcdata TYPE bdcdata.
DATA : v_flag TYPE i,
v_title TYPE string,
v_text(70) TYPE c,
v_strlen TYPE i,
v_tabname TYPE tabname.
INITIALIZATION.
* Disabling select-options high option.
LOOP AT SCREEN.
IF screen-name = 'S_TYPE-HIGH'.
screen-input = 0.
screen-output = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
* Selection screen.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-000.
SELECT-OPTIONS : s_type FOR rsrd1-ddtype_val.
SELECTION-SCREEN END OF BLOCK b.
* Tables selection
START-OF-SELECTION.
PERFORM get_tablenames.
PERFORM get_multiple_matches.
END-OF-SELECTION.
PERFORM create_fcat USING : 'TABNAME' 1 'Table name',
'DDTEXT' 2 'Short description'.
PERFORM display_result.
FORM create_fcat USING v_fieldname TYPE c
v_colpos TYPE i
v_text TYPE c.
CLEAR wa_fcat.
wa_fcat-fieldname = v_fieldname.
wa_fcat-col_pos = v_colpos.
wa_fcat-seltext_l = v_text.
wa_fcat-tabname = 'T_DISPLAY'.
APPEND wa_fcat TO it_fcat.
ENDFORM. " CREATE_FCAT
FORM display_result .
wa_layout-colwidth_optimize = 'X'.
v_title = 'Where used list for-'.
LOOP AT it_input INTO wa_input.
CONCATENATE v_title wa_input-element ', ' INTO v_title.
ENDLOOP.
v_strlen = STRLEN( v_title ) - 1.
v_title = v_title+0(v_strlen).
v_text = v_title.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
i_grid_title = v_text
is_layout = wa_layout
it_fieldcat = it_fcat
TABLES
t_outtab = it_display.
ENDFORM. " DISPLAY_RESULT
FORM user_command USING uco TYPE sy-ucomm sf TYPE slis_selfield.
v_tabname = sf-value.
SELECT SINGLE
tabname
FROM
dd03vv
INTO
v_tabname
WHERE tabname = v_tabname.
IF sy-subrc = 0.
PERFORM bdc_dynpro USING 'SAPMSRD0' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RSRD1-TBMA_VAL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SHOW'.
PERFORM bdc_field USING 'RSRD1-TBMA'
'X'.
PERFORM bdc_field USING 'RSRD1-TBMA_VAL'
sf-value.
PERFORM bdc_dynpro USING 'SAPLSD41' '2200'.
CALL TRANSACTION 'SE11' USING it_bdcdata MODE 'E' UPDATE 'S'.
CLEAR it_bdcdata[].
ENDIF.
ENDFORM. "USER_COMMAND
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. "bdc_dynpro
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. " bdc_field
FORM get_tablenames.
* Consolidating selection inputs into an internal table.
LOOP AT s_type.
wa_input-element = s_type-low.
APPEND wa_input TO it_input.
ENDLOOP.
* Selecting the table names having the input data elements.
SELECT
tabname
fieldname
rollname
FROM
dd03vv
INTO TABLE
it_where
FOR ALL ENTRIES IN it_input
WHERE
rollname = it_input-element AND
as4local = 'A' AND
( tabclass = 'TRANSP' OR
tabclass = 'CLUSTER' OR
tabclass = 'POOL' ).
* Segregating the table names.
LOOP AT it_where INTO wa_where.
wa_table-tabname = wa_where-tabname.
APPEND wa_table TO it_table.
ENDLOOP.
SORT it_table BY tabname.
DELETE ADJACENT DUPLICATES FROM it_table COMPARING ALL FIELDS.
ENDFORM. " GET_TABLENAMES
FORM get_multiple_matches .
* Selecting the tables which are having all the input table names.
LOOP AT it_table INTO wa_table.
v_flag = 0.
LOOP AT it_input INTO wa_input.
READ TABLE it_where INTO wa_where WITH KEY
tabname = wa_table-tabname
rollname = wa_input-element.
IF sy-subrc NE 0.
v_flag = 1.
ENDIF.
ENDLOOP.
IF v_flag = 0.
wa_result-tabname = wa_table.
APPEND wa_result TO it_result.
ENDIF.
ENDLOOP.
* Retrieving table's short description.
IF it_result[] IS NOT INITIAL.
SELECT
tabname
ddtext
FROM
dd02t
INTO TABLE
it_display
FOR ALL ENTRIES IN it_result
WHERE
tabname = it_result-tabname.
IF sy-subrc = 0.
SORT it_display BY tabname ddtext.
DELETE ADJACENT DUPLICATES FROM it_display COMPARING tabname.
ENDIF.
ENDIF.
ENDFORM. " GET_MULTIPLE_MATCHES
댓글 4
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
411 | REPORT Z02_16. | sapjoy | 2012.07.31 | 1511 |
410 | REPORT z02_15. | sapjoy | 2012.07.31 | 1621 |
409 | REPORT z02_14. | sapjoy | 2012.07.31 | 1538 |
408 | REPORT z02_13. | sapjoy | 2012.07.31 | 1690 |
407 | REPORT z02_12. | sapjoy | 2012.07.31 | 1619 |
406 | REPORT z02_11. | sapjoy | 2012.07.31 | 1717 |
405 | REPORT z02_10. | sapjoy | 2012.07.31 | 1609 |
404 | REPORT z02_09. | sapjoy | 2012.07.31 | 1586 |
403 | REPORT z02_08. | sapjoy | 2012.07.31 | 1843 |
402 | REPORT z02_07. | sapjoy | 2012.07.31 | 1786 |
401 | REPORT z02_06. | sapjoy | 2012.07.31 | 1658 |
400 | REPORT z02_05. | sapjoy | 2012.07.31 | 1863 |
399 | REPORT z02_04. | sapjoy | 2012.07.31 | 1953 |
398 | REPORT z02_03 | sapjoy | 2012.07.31 | 1805 |
397 | REPORT z02_01. | sapjoy | 2012.07.31 | 1788 |
» | REPORT Z_WHEREUSEDLIST [4] | sapjoy | 2011.03.29 | 3215 |
395 | Z_EXPORT_GRAPHIC_FROM_SE78 [1] | sapjoy | 2011.03.29 | 4447 |
394 | REPORT ZSMARTFORMS_03. | sapjoy | 2008.11.28 | 3345 |
393 | REPORT zfalv_011. | sapjoy | 2011.02.16 | 3627 |
392 | <b>easy abap 소스 전체 파일 입니다. [188] | sapjoy | 2008.05.02 | 10149 |
잘봤습니다.ㅎ