on 04-25-2007 8:32 AM
Hi All
I need to output the data in sapscript related to each vendor in new page.
I tried with below code but its not picking all the records related to 1 vendor.
LOOP AT it_data3.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
form = 'Z_FORM_16'
LANGUAGE = ' '
STARTPAGE = ' '
program = 'Z_FORM_16'.
ON CHANGE OF it_data3-wt_acco.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = ' '
FUNCTION = 'SET'
TYPE = 'CONST'
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 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDON.
ENDLOOP.
Pls give ur valuable suggestions.
Regards
Babita
After the ON CHANGE OF statement, you can add :
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'NEW-PAGE'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
.
The ON CHANGE will only work if the IT_DATA3 internal table is sorted on the field WT_ACCO.
regards,
Hans
Please reward all helpful answers !!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add a call of the function
regards,
Hans
Please reward all helpful answers !!!!! module CONTROL_FORM with NEW-PAGE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Hans . Could you please specify where to put this control_form.
also I tried something like this and getting repeated data and 1 blank page between each vendor.
LOOP AT it_data3.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
form = 'Z_FORM_16'
LANGUAGE = ' '
STARTPAGE = ' '
program = 'Z_FORM_16'.
ON CHANGE OF it_data3-wt_acco.
at end of wt_acco.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = ' '
FUNCTION = 'SET'
TYPE = 'CONST'
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.
ON CHANGE OF it_data3-wt_acco.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'NEW-PAGE'
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDON.
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDON.
*endat.
ENDLOOP.
also I want all data i.e. rows of a particular vendor should be printed on same page but right now after every line item a new page is getting triggered.
Hope I am able to explain the issue.
Awaiting quick reply for all Abapers.
Thanks
Babita
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.