05-18-2006 7:20 AM
Hi Everyone,
I am making a Prenum Check which has
1 Main Win 00 : Invoiced Item Lines for the Check Payment
2 Check Window: A Check to be printed
3 Main Win 01 : Copy of Main Win 00
The Main Window has Line Items of the Payment Invoices for Vendor, which can flow across multiple pages.So I cannot use NEW-WINDOW. I cannot make the changes in SAP Program. Please help me sorting out this issue with some small PERFORM Code which will copy contents of current main window and print it back in new window on the same page.
Please Help me....
Thanks in Advance.
Regards,
Abhsihek B.
05-18-2006 7:42 AM
Hi,
add a column for ex key, copy in double all the data of the table you loop for your main window. In the column key, for the first set of data set for ex 1 and in the second set of date set for ex 2.
So you loop in the table, if the column key = 1 you are in the first loop. At the end of this first loop you could make all you want.
After this you loop with the column key = 2 .........
Rgd
Frédéric
05-18-2006 7:42 AM
Hi,
add a column for ex key, copy in double all the data of the table you loop for your main window. In the column key, for the first set of data set for ex 1 and in the second set of date set for ex 2.
So you loop in the table, if the column key = 1 you are in the first loop. At the end of this first loop you could make all you want.
After this you loop with the column key = 2 .........
Rgd
Frédéric
05-18-2006 7:50 AM
Hi Frederic,
Thanks for ur quick response...
But can u send me the snippet for this code....
How would i pass the values of main window to a text element or variable which could be used in a var/const window.
Regards,
ABhishek
05-18-2006 7:54 AM
Hi abhishek,
1.
How would i pass the values of main window to a text element or variable which could be used in a var/const window.
That does not matter.
2. The sapscript layout,
may be having any kind of , n number of windows.
3. It just searches for the global variables in
the main program (driver program)
and simply prints them.
&var1&, &var2&
4. The latest variable value
is printed. (when write_form) is used.
regards,
amit m.
05-18-2006 8:01 AM
Hi,
Thanks for ur help,
That means can i just copy and paste the whole code of main window in var/const window with the text elements, then the data will automatically print in new window in sync with main window...
Regards,
Abhishek
05-18-2006 8:23 AM
Hi,
Please tell me can i copy the contents in var/const.
Will it work ??
Regards,
Abhishek
05-18-2006 9:01 AM
Hi again,
1. Yes we can absolutely copy the contenets
in var/const window.
2. But since the contents are under some ELEMENT,
the contents will only get printed
when we print them using WRITE_FORM.
3. In WRITE_FORM we also have to give the WINDOW Name.
regards,
amit m.
05-18-2006 11:56 AM
Hi Amit,
Can u send me the syntax for using write_form in sapscript...
I am a bit confused so if u can just send me some code to which i can refer.
Thanks,
Abhishek
05-18-2006 12:07 PM
hi abhishek,
TABLES: KNA1,KNB1.
data: var type i value '00345-'.
DATA: V_KUNNR LIKE KNA1-KUNNR.
*-- Data Declarations
data: it_vbap like KNA1 occurs 0 with header line.
*-- Selection Screen
selection-screen begin of block b1.
select-options: s_KUNNr for KNA1-KUNnr.
selection-screen end of block b1.
*-- Start of Selection
start-of-selection.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = IT_VBAP-KUNNR
IMPORTING
OUTPUT = IT_VBAP-KUNNR
.
select *
into table it_vbap
from KNA1
where KUNnr in s_KUNnr.
*****opening form
call function 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZP_FORM1'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
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
CODEPAGE = 11
OTHERS = 12
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*******writing the form
LOOP AT IT_VBAP.
call function 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
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
CODEPAGE = 9
OTHERS = 10
.
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.
*******closing the form
call function 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
hope this helps,
priya.
05-18-2006 12:13 PM
Hi Priya,
I was looking to 1 of the previous posts of urs..
i think u have done this...
I need to copy lineitems from main window to a new window which has element 525.
I have to use PERFORM and write a small code ti populate these itemlines, but i am a bit confused with exact syntax.
Please tell me steps so that i can do that
Regards,
Abhishek
05-18-2006 12:05 PM
HII
HAVE ALOOK AT THE CODE
TABLES : KNA1 , T005T.
SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
LAND1 LIKE KNA1-LAND1,
LANDX LIKE T005T-LANDX,
END OF ITAB.
DATA : V_LANDX TYPE T005T-LANDX.
DATA : IT_STEXT TYPE TLINE OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT KUNNR NAME1 LAND1 FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE
ITAB WHERE KUNNR IN
S_KUNNR.
LOOP AT ITAB.
SELECT SINGLE LANDX FROM T005T INTO (V_LANDX) WHERE LAND1 = ITAB-LAND1.
ITAB-LANDX = V_LANDX.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'Z50653_PAGE1'
LANGUAGE = 'E'
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
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
CODEPAGE = 11
OTHERS = 12
.
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
ARCHIVE_INDEX =
FORM = 'Z50653_PAGE1'
LANGUAGE = 'E'
STARTPAGE = 'PAGE1'
PROGRAM = ' '
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.
****
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = ' '
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
CODEPAGE = 9
OTHERS = 10
.
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.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
07-19-2006 4:04 AM
Hi Abhishek
Did you manage to solve this problem of getting the main window printed twice with the same content in a page?
I am also facing exactly the same problem . I also need a three part form for pre numbered check .
Please take a look at this forum thread.
Any thoughts on this would be much aprreciated.
Many Thanks
Bala