on 12-27-2006 11:02 AM
Hi all, iam facing a problem in implimenting the watermark in sap script.
i have used the following code in print program to impliment this. Actually what is happening is it is printing each record and water mark in each page and second record and again water mark in second page. my requirement is i should get water mark in all pages and records get printed accordingly .
i have created an instance of main window in the script and used the following code in print program. can any one help me out in this case.
please give me the suggestions in this case.
REPORT zwatermark_script .
TABLES:mara.
SELECT-OPTIONS:s_matnr FOR mara-matnr.
DATA:BEGIN OF it_mara OCCURS 0,
mandt LIKE mara-mandt,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
END OF it_mara.
DATA:wa_itab LIKE it_mara.
START-OF-SELECTION.
SELECT mandt
matnr
ersda
FROM mara
INTO TABLE it_mara
WHERE matnr IN s_matnr.
END-OF-SELECTION.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZMARK_SCRIPT'
language = sy-langu.
LOOP AT it_mara.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'WATERMARK'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'.
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 'CONTROL_FORM'
EXPORTING
command = 'NEW-WINDOW'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Write main contents
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ELE'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'.
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9 .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP. "LOOP AT it_mara
CALL FUNCTION 'CLOSE_FORM'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I mean like below
SELECT SINGLE maktx FROM makt INTO makt-maktx WHERE
matnr eq traptab-matnr.
PERFORM set_text_symbol USING:
'&MABDR-MAKTX&' makt-maktx.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'POS_ZEILE'
function = 'APPEND'
window = 'MAIN'
EXCEPTIONS
OTHERS = 7.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramu
In ur code, where u pass the text element fields? once u pass the text fields in ur code, after that assign the same text field into form and try.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.