*&---------------------------------------------------------------------*
*& Report ZTEST_PARTH
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_PARTH.
TABLES: VBAP, VBAK, KNA1.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN no-extension no intervals.
DATA: P_KUNNR TYPE VBAK-KUNNR,
P_VBELN TYPE VBAP-VBELN.
TYPES: BEGIN OF IT_KNA1,
NAME1 TYPE KNA1-NAME1,
NAME2 TYPE KNA1-NAME2,
ADRNR TYPE KNA1-ADRNR,
TELF1 TYPE KNA1-TELF1,
END OF IT_KNA1,
BEGIN OF IT_VBAP,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
PMATN TYPE VBAP-PMATN,
VRKME TYPE VBAP-VRKME,
END OF IT_VBAP.
DATA: GT_KNA1 TYPE IT_KNA1, "OCCURS 0 with header line,
GT_VBAP TYPE IT_VBAP. "OCCURS 0 with header line.
AT SELECTION-SCREEN.
SELECT KUNNR VBELN FROM VBAK INTO (P_KUNNR, P_VBELN) WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE ID 'zparthmessage' TYPE 'E' NUMBER '002' WITH 'erooorrr'.
ENDIF.
START-OF-SELECTION.
SELECT NAME1 NAME2 ADRNR TELF1 FROM KNA1 INTO CORRESPONDING FIELDS OF GT_KNA1
WHERE KUNNR = P_KUNNR.
endselect.
IF SY-SUBRC <> 0.
MESSAGE ID 'zparthmessage' TYPE 'E' NUMBER '002' WITH 'erooorrr kna1'.
ENDIF.
SELECT VBELN POSNR MATNR PMATN VRKME
INTO CORRESPONDING FIELDS OF GT_VBAP
FROM VBAP
WHERE VBELN = P_VBELN.
endselect.
IF SY-SUBRC <> 0.
MESSAGE ID 'zparthmessage' TYPE 'E' NUMBER '002' WITH 'erooorrr vbap'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_DEMO12'
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXPORTING
* ARCHIVE_INDEX =
FORM = 'ZTEST_DEMO12'
* LANGUAGE = ' '
* STARTPAGE = ' '
PROGRAM = 'ZTEST_PARTH'
* MAIL_APPL_OBJECT =
* IMPORTING
* LANGUAGE =
EXCEPTIONS
* FORM = 1
* FORMAT = 2
* UNENDED = 3
* UNOPENED = 4
* UNUSED = 5
* SPOOL_ERROR = 6
* CODEPAGE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'HEADER'
ELEMENT = 'CUST_DETAILS'
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
ELEMENT = 'E1'
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'CLOSE_FORM'.
RUN the Report.
Output |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25688124/viewspace-1171301/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25688124/viewspace-1171301/