Posted: Sun Mar 02, 2008 2:10 pm Post subject: Lists all tables that contain the selected field
Code:
REPORT ZLISTTABFIELD MESSAGE-ID Z1 LINE-COUNT 65 LINE-SIZE 132.
* NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* Description: This program lists all tables that contain the field *
* defined in the selection criteria. In addition, you *
* will be able to select a line and then have which will *
* then transfer you to transaction SE12.
* Youcan also select the line and use PF8 for SE16 *
* *
* Customizing: You need not to make any customizing to use this program*
* *
* Change of You only have to check that tables, functions and *
* release: includes still exist. *
* *
* Programmer: Howard Caras *
* Date: May 1997 *
* *
* SAP R/3 2.2C *
*----------------------------------------------------------------------*
TABLES: DD03P, "Tabla generada para vista DD03P
DD02L. "Tablas SAP
DATA: BEGIN OF DYNTAB OCCURS 2000.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF DYNTAB.
DATA: BEGIN OF FIELDS OCCURS 100,
TABNAME LIKE DD03P-TABNAME, "Nombre de tabla
TABCLASS LIKE DD02L-TABCLASS, "Tipo de tabla
FIELDNAME LIKE DD03P-FIELDNAME, "Nombre de campo local
POSITION LIKE DD03P-POSITION, "Posición de un campo en la tabl
KEYFLAG LIKE DD03P-KEYFLAG, "Indicador para un campo correspo
MANDATORY LIKE DD03P-MANDATORY, "Indica campo obligatorio (NOT
ROLLNAME LIKE DD03P-ROLLNAME,"data element
CHECKTABLE LIKE DD03P-CHECKTABLE, "Nombre de la tabla de verific
INTLEN LIKE DD03P-INTLEN, "Longitud interna en byte
DOMNAME LIKE DD03P-DOMNAME, "Denominación de un dominio
ROUTPUTLEN LIKE DD03P-ROUTPUTLEN, "Longitud de campo (cantidad d
MEMORYID LIKE DD03P-MEMORYID,"parameter ID
END OF FIELDS.
PARAMETERS:
* field like dd03p-fieldname,
DOWNLOAD AS CHECKBOX,
FILENAME(65) TYPE C DEFAULT 'C:DOWNLOAD--------.---',
FILETYPE(3) TYPE C DEFAULT 'ASC'.
SELECT-OPTIONS: FIELD FOR DD03P-FIELDNAME.
TRANSLATE FIELD USING '*%'.
SELECT * FROM DD03P
WHERE DDLANGUAGE = SY-LANGU
AND FIELDNAME IN FIELD.
MOVE-CORRESPONDING DD03P TO FIELDS.
SELECT * FROM DD02L
WHERE TABNAME = DD03P-TABNAME.
ENDSELECT.
IF SY-SUBRC = 0.
MOVE DD02L-TABCLASS TO FIELDS-TABCLASS.
ENDIF.
CHECK FIELDS-TABCLASS NE 'INTTAB'.
APPEND FIELDS.
HIDE DD03P-TABNAME.
ENDSELECT.
IF NOT SY-SUBRC = 0.
ULINE.
WRITE: / 'No tables found for field', FIELD.
ULINE.
ENDIF.
SORT FIELDS.
RANGES R_TABNAME FOR FIELDS-TABNAME.
INCLUDE ZEBCI005. "Include con macros útiles
DATA: L_CONT TYPE I, L_CONT2 TYPE I.
DESCRIBE TABLE FIELD LINES L_CONT.
LOOP AT FIELDS.
AT NEW TABNAME.
CLEAR L_CONT2.
ENDAT.
ADD 1 TO L_CONT2.
AT END OF TABNAME.
IF L_CONT2 < L_CONT.
ADDRANGO_EQ R_TABNAME FIELDS-TABNAME.
ENDIF.
ENDAT.
ENDLOOP.
LOOP AT R_TABNAME.
DELETE FIELDS WHERE TABNAME = R_TABNAME-LOW.
ENDLOOP.
LOOP AT FIELDS.
AT NEW TABNAME.
FORMAT INTENSIFIED ON.
ENDAT.
WRITE: / FIELDS-TABNAME,
FIELDS-TABCLASS,
FIELDS-FIELDNAME,
FIELDS-POSITION,
FIELDS-KEYFLAG,
FIELDS-MANDATORY,
FIELDS-ROLLNAME,
FIELDS-CHECKTABLE,
FIELDS-INTLEN,
FIELDS-DOMNAME,
FIELDS-MEMORYID.
DETAIL.
ENDLOOP.
IF DOWNLOAD NE ''.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = FILETYPE "ASC, WK1, DBF, DAT, BIN, WK1
TABLES
DATA_TAB = FIELDS.
ENDIF.
AT LINE-SELECTION.
SET PARAMETER ID 'DOB' FIELD SY-LISEL(30) .
CALL TRANSACTION 'SE12' AND SKIP FIRST SCREEN.
AT PF8.
CHECK SY-LISEL <> ''.
SET PARAMETER ID 'DTB' FIELD SY-LISEL(10) .
REFRESH DYNTAB.
PERFORM DYNPRO USING:
'X' 'SAPMSTAZ' '0100' "Selection screen
,' ' 'DD02V-TABNAME' SY-LISEL(10).
CALL TRANSACTION 'SE16' USING DYNTAB MODE 'A' .
*---------------------------------------------------------------------*
* FORM DYNPRO *
*---------------------------------------------------------------------*
FORM DYNPRO USING DYNBEGIN NAME VALUE.
IF DYNBEGIN = 'X'.
CLEAR DYNTAB.
MOVE : NAME TO DYNTAB-PROGRAM,
VALUE TO DYNTAB-DYNPRO,
DYNBEGIN TO DYNTAB-DYNBEGIN.
APPEND DYNTAB.
ELSE.
CLEAR DYNTAB.
MOVE: NAME TO DYNTAB-FNAM,
VALUE TO DYNTAB-FVAL.
APPEND DYNTAB.
ENDIF.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.