Code: Alles auswählen.
FORM NAME.
DATA: w_name_text TYPE ad_namtext.
SELECT SINGLE name_text
INTO w_name_text
FROM usr21
INNER JOIN adrp
ON adrp~persnumber = usr21~persnumber
WHERE usr21~bname = sy-uname.
ENDFORM.
Code: Alles auswählen.
[/REPORT ZR_SERV_PROG1.
DATA: h_lgpbe type lgpbe.
w_name_text TYPE ad_namtext.
INCLUDE RIPRID01. " General DATA and TABLE struct.
*------------------*
START-OF-SELECTION.
*------------------*
PERFORM PRINT_PAPER. "can be started via SUBMIT or PERFORM PRINT_PAPER
*$*$ ................ M A I N F O R M .............................*
*... DATA STRUCTURE: ..................................................*
*... *
*... CAUFVD (AFIH AUFK AFKO plus other dialog fields: ORDER HEADER) *
*... ! *
*... !-- AFVGD (AFVC AFVV plus dialog fields) Order operatns *
*... ! ! *
*... ! !-- The sub operations also stored AFVGD and are pre *
*... ! ! sorted. The SUMNR fields distinguishes Main operaitons*
*... ! ! and sub operations *
*... ! !-- AFFHD Prod Resources *
*... !-- RESBD Materials *
*... !-- RIPW0 Object list dialog area *
*......................................................................*
*----------------------------------------------------------------------*
* FORM PRINT_PAPER *
*----------------------------------------------------------------------*
* Main driving Form behind the Printing of Papers *
* All information is imported from MEMORY *
*----------------------------------------------------------------------*
* --> FORM Name of SAPSCRIPT form to use. *
* --> WWORKPAPER Print options for SAPSCRIPT. *
* Structure command to define wworkpaper so the *
* individual fields can be addressed. *
* --> DATA STRUCTURES See form DATA_IMPORT INCLUDE RIPRID01 *
*----------------------------------------------------------------------*
*$*$ - P R I N T P A P E R
FORM PRINT_PAPER. " This form name must be used !!!
*$*$ - STARTED BY EXTERNAL PERFORM
PERFORM ORDER_DATA_IMPORT. " See INCLUDE RIPRIf02
PERFORM MAIN_PRINT. " Print the PAPER now
ENDFORM.
CAUFVD-AUFNR" order obj number as key
' '. " New form for each Order
PERFORM LOCK_AND_SET " Enque and determine copy number
USING C_HEADER_ORDER. " open for Header level
PERFORM SET_TITLE.
PERFORM NAME.
PERFORM TITLE_PAGE.
PERFORM READ_ORDER_TEXT_TABLES. " Read tables for CAUFVD
PERFORM ORDER_HEADER_SHORT. " Now print the order header see f02
PERFORM PARTNER_DETAILS " prints partner details
TABLES ORDER_IHPAD_TAB. "
PERFORM TECH_OBJECT_PARTNER " partner address equi / F.Locat
USING CAUFVD-EQUNR "
CAUFVD-TPLNR. "
PERFORM DMS_OBJECT_PRINT USING CAUFVD-EQUNR "EPS drawing print
CAUFVD-TPLNR. "
PERFORM OPERATIONS_WITH_MAT. " reservations are printed with Op.
PERFORM END_OF_REPORT. " Print end of report line
PERFORM CLOSE_FORM. " Close the form.
PERFORM UNLOCK_AND_LOG. " Dequeue and Log print
ENDFORM.
*$*$ F O R M R O U T I N E S -------------------------------------*
*... Includes for General and Sepcific form routines
INCLUDE RIPRIF01. " General PRINT routines
INCLUDE RIPRIF02. " General PRINT routines ORDERS
FORM NAME.
CLEAR w_name_text.
SELECT SINGLE name_text
INTO w_name_text
FROM usr21
INNER JOIN adrp
ON adrp~persnumber = usr21~persnumber
WHERE usr21~bname = sy-uname.
ENDFORM.
code]
Fehlendes ERRORHANDLING hinter dem SELECT SINGLE!christof hat geschrieben:Hallo zusammen.
Ich habe folgendes Problem...
Ich möchte den Benutzername auf das Formular andrucken. Komischerweise druckt es das erste mal nicht an, erst beim zweiten mal.
Dies wäre mein Code-Beispiel? Habe ich hier etwas falsch gemacht?
Vielen Dank für eure HilfeCode: Alles auswählen.
FORM NAME. DATA: w_name_text TYPE ad_namtext. SELECT SINGLE name_text INTO w_name_text FROM usr21 INNER JOIN adrp ON adrp~persnumber = usr21~persnumber WHERE usr21~bname = sy-uname. ENDFORM.
Code: Alles auswählen.
if sy-subrc ne 0.
* Fehler: Keine Daten gefunden!
endif.
Erweiter ddas Fehlerhandling noch um so etwas:a-dead-trousers hat geschrieben:Code: Alles auswählen.
if sy-subrc ne 0. * Fehler: Keine Daten gefunden! endif.
Code: Alles auswählen.
if sy-subrc ne 0.
w_name_text = 'Felix Fehler'.
endif.