Google

PROGRAM FOR SCRIPT

REPORT ZTEST_SCRIPT_1_RAJ NO STANDARD PAGE HEADING.


TABLES : EKKO,
EKPO,
LFA1.

PARAMETERS : P_EBELN LIKE EKKO-EBELN.

DATA : INT_EKKO LIKE EKKO OCCURS 0 WITH HEADER LINE.

DATA : INT_EKPO LIKE EKPO OCCURS 0 WITH HEADER LINE.


SELECT * FROM EKKO INTO TABLE INT_EKKO WHERE EBELN = P_EBELN.

IF SY-SUBRC EQ 0.
READ TABLE INT_EKKO WITH KEY EBELN = P_EBELN.
SELECT SINGLE * FROM LFA1 WHERE LIFNR = INT_EKKO-LIFNR.
ELSE.
STOP.
ENDIF.


SELECT * FROM EKPO INTO TABLE INT_EKPO WHERE EBELN = P_EBELN.


CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_SCRIPT_1'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11
.
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 'START_FORM'
EXPORTING
FORM = 'ZTEST_SCRIPT_1'
EXCEPTIONS
FORM = 1
OTHERS = 2.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'TITLE'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'INFO'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'ADDRESS'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
ELEMENT = 'ITEM_LABEL'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.



LOOP AT INT_EKPO WHERE EBELN = P_EBELN.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
ELEMENT = 'ITEM_VALUES'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.


ENDLOOP.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'FOOTER'
EXCEPTIONS
WINDOW = 1
OTHERS = 2.

CALL FUNCTION 'END_FORM'.

CALL FUNCTION 'CLOSE_FORM'.