Categorias

Obter tabela de um determinado campo

Informação fornecida por Rodolpho Elmir.

Obtenção das tabelas onde se encontra determinado campo

*&---------------------------------------------------------------------*
*& Report ZTABELAS * 
*& * 
*&---------------------------------------------------------------------* 
*& Autor: Rodolpho Elmir *
*&---------------------------------------------------------------------* 

REPORT ZTABELA LINE-SIZE 94 NO STANDARD PAGE HEADING. ************************************************************************

* SELECTION-SCREEN BEGIN OF LINE.

* SELECTION-SCREEN COMMENT 30(40) TEXT-008

* FOR FIELD PARM.

* SELECTION-SCREEN POSITION POS_LOW.

* PARAMETERS PARM AS CHECKBOX. " LIKE SAPLANE-PLANETYPE.

* SELECTION-SCREEN END OF LINE. ************************************************************************

DATA: BEGIN OF BDC_TAB OCCURS 0. 

INCLUDE STRUCTURE BDCDATA.DATA: 

END OF BDC_TAB.

TABLES: 

DD03L, 

DD02L, 

DD02T.

DATA: 

TABELAS LIKE DD03L-TABNAME, 

NO_CAMPO TYPE I, 

NO_TABELA(04) TYPE N, 

DESCRIPCION LIKE DD02T-DDTEXT, 

VERSION LIKE DD02T-AS4VERS, 

TIPO_TABELA LIKE DD02L-TABCLASS.

SELECT-OPTIONS TABELA FOR DD03L-TABNAME. 

SELECT-OPTIONS CAMPO FOR DD03L-FIELDNAME.

SELECT-OPTIONS ELEMENTO FOR DD03L-ROLLNAME. 

SELECT-OPTIONS DOMINIO FOR DD03L-DOMNAME.

* PARAMETERS DESCRICAO LIKE DD02T-DDTEXT.

SELECTION-SCREEN BEGIN OF BLOCK TIPO_TABELA WITH FRAME TITLE TEXT-001.

PARAMETERS: 

TRANSP RADIOBUTTON GROUP TIPO, 

INTTAB RADIOBUTTON GROUP TIPO.

PARAMETERS VIEW RADIOBUTTON GROUP TIPO.

PARAMETERS POOL RADIOBUTTON GROUP TIPO.

PARAMETERS CLUSTER RADIOBUTTON GROUP TIPO.

PARAMETERS APPEND RADIOBUTTON GROUP TIPO.

PARAMETERS TODAS RADIOBUTTON GROUP TIPO. 

SELECTION-SCREEN END OF BLOCK TIPO_TABELA.

IF TRANSP = 'X'. 

TIPO_TABELA = 'TRANSP'.

ELSEIF INTTAB = 'X'. 

TIPO_TABELA = 'INTTAB'.

ELSEIF VIEW = 'X'. 

TIPO_TABELA = 'VIEW'.

ELSEIF POOL = 'X'. 

TIPO_TABELA = 'POOL'.

ELSEIF CLUSTER = 'X'. 

TIPO_TABELA = 'CLUSTER'.

ELSEIF APPEND = 'X'. 

TIPO_TABELA = 'APPEND'. 

ELSEIF TODAS = 'X'. 

TRANSLATE TIPO_TABELA USING '+_*%'.

TIPO_TABELA = '%'. 

ENDIF.

 
START-OF-SELECTION. 

SELECT DISTINCT TABNAME COUNT(*) 

INTO (TABELAS,NO_CAMPO) 

FROM DD03L 

WHERE FIELDNAME IN CAMPO 

AND TABNAME IN TABELA 

AND ROLLNAME IN ELEMENTO 

AND DOMNAME IN DOMINIO 

GROUP BY TABNAME.

* MOVE SY-DBCNT TO NO_TABELA. 

NO_TABELA = NO_TABELA + 1. 

SELECT * 

FROM DD02L 

WHERE TABNAME = TABELAS 

AND TABCLASS LIKE TIPO_TABELA. 

ENDSELECT. 

IF SY-SUBRC EQ 0.

* TRANSLATE DESCRICAO USING '+_*%'.

* IF DESCRICAO = SPACE. 

DESCRICAO = '%'. 

ENDIF. 

SELECT DDTEXT 

INTO DESCRIPCION 

FROM DD02T 

WHERE TABNAME = TABELAS

* AND DDTEXT LIKE DESCRICAO " LIKE DESCRICAO 

AND DDLANGUAGE = SY-LANGU. 

ENDSELECT. 

WRITE: / SY-VLINE NO-GAP,

TABELAS HOTSPOT COLOR COL_KEY NO-GAP, 

SY-VLINE NO-GAP, 

NO_CAMPO COLOR COL_NORMAL NO-GAP, 

SY-VLINE NO-GAP, 

DD02L-TABCLASS COLOR COL_NORMAL NO-GAP, 

SY-VLINE NO-GAP, 

DESCRIPCION(60) COLOR COL_NORMAL INTENSIFIED OFF NO-GAP, 

SY-VLINE NO-GAP. 

HIDE TABELAS. 

ENDIF. 

ENDSELECT. 

ULINE.
 

 
 TOP-OF-PAGE. 

IF NOT NO_TABELA IS INITIAL. 

SHIFT NO_TABELA LEFT DELETING LEADING '0'. 

WRITE: SY-TITLE, 

NO_TABELA, 

'ocorrências'. 

ENDIF. 

ULINE. 

FORMAT COLOR COL_HEADING. 

WRITE: /01 SY-VLINE NO-GAP, 

04 'Tabela' NO-GAP, 

12 SY-VLINE NO-GAP, 

13 'Incidência' NO-GAP, 

24 SY-VLINE NO-GAP, 

27 'Tipo' NO-GAP, 

33 SY-VLINE NO-GAP, 

58 'Descrição' NO-GAP, 

94 SY-VLINE NO-GAP. 

ULINE.

AT LINE-SELECTION. 

PERFORM PREENCHE_BDC_TAB. 

CALL TRANSACTION 'SE11' USING BDC_TAB MODE 'E'.
 

 
 *&---------------------------------------------------------------------* 

*& Form PREENCHE_BDC_TAB 

*&---------------------------------------------------------------------*

FORM PREENCHE_BDC_TAB. 

REFRESH BDC_TAB. 

BDC_TAB-PROGRAM = 'SAPMSRD0'. " NOME DO PROGRAMA DO DICIONARIO 

BDC_TAB-DYNPRO = '100'. " INITIAL SCREEN 

BDC_TAB-DYNBEGIN = 'X'. 

APPEND BDC_TAB. 

CLEAR BDC_TAB. 

BDC_TAB-FNAM = 'RSRD1-OBJNAME'. " OBJECT NAME 

BDC_TAB-FVAL = TABELAS. 

APPEND BDC_TAB. 

CLEAR BDC_TAB. 

BDC_TAB-FNAM = 'RSRD1-TBMA'. " DICTIONARY OBJECT 

BDC_TAB-FVAL = 'X'. 

APPEND BDC_TAB. 

CLEAR BDC_TAB. 

BDC_TAB-FNAM = 'BDC_OKCODE'. " DISPLAY 

BDC_TAB-FVAL = 'SHOW'. 

APPEND BDC_TAB. 

BDC_TAB-PROGRAM = 'SAPMSRD0'. " NOME DO PROGRAMA DO DICIONARIO 

BDC_TAB-DYNPRO = '100'. " INITIAL SCREEN 

BDC_TAB-DYNBEGIN = 'X'. 

APPEND BDC_TAB. 

CLEAR BDC_TAB. 

BDC_TAB-FNAM = 'BDC_OKCODE'. " BACK 

BDC_TAB-FVAL = '/3'. 

APPEND BDC_TAB.

ENDFORM. " PREENCHE_BDC_TAB