Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /kunden/349566_51067/webseiten/4ap.de/framework/class.database.php on line 61
4AP.de ~ alles fuer ABAP-Programmierer - Infos zur SAP Programmiersprache - DBTAB dynamisch
 

4AP.de ~ alles fuer ABAP-Programmierer - Infos zur SAP Programmiersprache


Suche



 

DBTAB dynamisch

www.4AP.de - ABAP Syntaxbeispiel: Datenbanktabelle dynamisch auslesen

Beispielcoding: Datenbanktabelle dynamisch auslesen (kopieren erlaubt aber auf eigene Gefahr :-))

 


Datenbankfelder dynamisch auslesen:
*
* Coded by Thorsten Neubüser - www.4ap.de
*
DATA: BEGIN OF ITAB_FELDER OCCURS 0,
FIELDNAME LIKE DD03L-FIELDNAME,
ROLLNAME LIKE DD03L-ROLLNAME,
SCRTEXT_L LIKE DD04T-SCRTEXT_M, " C20mittellang. Schlüsselwort
END OF ITAB_FELDER,
MARC_FELDER LIKE ITAB_FELDER OCCURS 0 WITH HEADER LINE,
MBEW_FELDER LIKE ITAB_FELDER OCCURS 0 WITH HEADER LINE.

perform felder_holen tables marc_felder using 'MARC'.
perform felder_holen tables mbew_felder using 'MBEW'.

*&---------------------------------------------------------------------*
*& Form FELDER_HOLEN
*&---------------------------------------------------------------------*
* liest die Felder der Datenbanktabelle aus
*----------------------------------------------------------------------*
* -->ITAB_FELDER interne Tabelle für Feldnamen
* -->tabelle Name der transparenten Tabelle
*----------------------------------------------------------------------*

FORM FELDER_HOLEN TABLES ITAB_FELDER LIKE ITAB_FELDER[]
USING TABELLE.
SELECT DD03L~FIELDNAME DD03L~ROLLNAME
DD04T~SCRTEXT_L
FROM DD03L INNER JOIN DD04T
ON DD04T~ROLLNAME = DD03L~ROLLNAME
AND DD04T~DDLANGUAGE = SY-LANGU
INTO CORRESPONDING FIELDS OF TABLE ITAB_FELDER
WHERE DD03L~TABNAME = TABELLE
AND DD03L~ROLLNAME NE ''.
SORT ITAB_FELDER BY FIELDNAME.
IF SY-SUBRC NE 0.
MESSAGE I000(ZP) WITH 'Form "felder_holen" fehlgeschlagen'(008)
TABELLE.
ENDIF.
ENDFORM. " FELDER_HOLEN