Ein Textfeld automatisch befüllen
Man kann eine Prüftabelle Hinterlegen, dann überprüft das Programm ob ein Eintrag in der Prüftabelle existiert.
Falls keiner Existiert kann man diesen Wert in der neuen Tabelle auch nicht erfassen.
MODULE lese_stellen_texte OUTPUT.
TABLES: t513s.
SELECT SINGLE stltx FROM t513s INTO zjet1-jobd
WHERE sprsl = sy-langu
AND stell = zjet1-stell
AND endda = zjet1-endda.
IF sy-subrc = 0.
"mache nichts
ELSE.
zjet1-jobd = ' '.
ENDIF.
ENDMODULE.
*----------------------------------------------------------------------*
***INCLUDE LZHR_PKO02.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module GET_WERKS_TXT OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE get_werks_txt OUTPUT.
TABLES: T500P.
SELECT
SINGLE NAME1 FROM T500P INTOZHR_PK_WERKS-NAME1
WHERE molga = '02'
AND persa = ZHR_PK_WERKS-werks
AND bukrs = ZHR_PK_WERKS-werks.
IF sy-subrc = 0.
"mache
nichts
ELSE.
ZHR_PK_WERKS-NAME1 = '
'.
ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_TEXT_FAMST OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE get_text_famst OUTPUT.
TABLES: T502T.
SELECT
SINGLE FTEXT FROM T502T INTOZHR_PK_FAMST-fatxt
WHERE sprsl = sy-langu
AND famst = ZHR_PK_FAMST-famst.
IF sy-subrc = 0.
"mache
nichts
ELSE.
ZHR_PK_FAMST-fatxt = '
'.
ENDIF.
ENDMODULE.
*----------------------------------------------------------------------*
***INCLUDE LZZPY_LV_COCKPITO01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module LESE_TEXTE OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE lese_texte OUTPUT.
TABLES: tstct.
SELECT SINGLE ttext FROM tstct INTO zhr_lv_cockpit-ttext
WHERE sprsl = sy-langu
AND tcode = zhr_lv_cockpit-tcode.
IF sy-subrc = 0.
"mache nichts
ELSE.
zhr_lv_cockpit-ttext = ' '.
ENDIF.
TABLES: trdirt.
SELECT SINGLE text FROM trdirt INTO zhr_lv_cockpit-repti
WHERE name = zhr_lv_cockpit-pgmna
AND sprsl = sy-langu.
IF sy-subrc = 0.
"mache nichts
ELSE.
zhr_lv_cockpit-repti = ' '.
ENDIF.
TABLES: dd02t.
SELECT SINGLE ddtext FROM dd02t INTO zhr_lv_cockpit-as4text
WHERE tabname = zhr_lv_cockpit-tabname16
AND ddlanguage = sy-langu
AND as4local = 'A'
AND as4vers = ( SELECT MAX( as4vers ) FROM dd02t ).
IF sy-subrc = 0.
"mache nichts
ELSE.
zhr_lv_cockpit-as4text = ' '.
ENDIF.
TABLES: varit.
Data: lf_pgmna type program_id.
lf_pgmna = zhr_lv_cockpit-pgmna.
IF lf_pgmna IS INITIAL.
SELECT SINGLE pgmna FROM tstc INTO lf_pgmna
WHERE tcode = zhr_lv_cockpit-tcode.
ENDIF.
SELECT SINGLE vtext FROM varit INTO zhr_lv_cockpit-rvart_vtxt
WHERE langu = sy-langu
AND report = lf_pgmna
AND variant = zhr_lv_cockpit-variant.
IF sy-subrc = 0.
"mache nichts
ELSE.
zhr_lv_cockpit-rvart_vtxt = ' '.
ENDIF.
ENDMODULE.