‎2005 Sep 05 11:39 AM
Hi,
I have a problem in SapScript. I had 3 windows on the NEXT-Page of my form. Two of these windows has dynamic lines. Therefore I have to loop over a internal table and print the workarea in the form.
At first, I had normal windows, but it was not possible to write multiple lines by calling the element.
so I copied the content of the 3 windows in only one and made all of them to main windows. No it shows Main, Main 01 and Main 02 on the next Page. All of them has the same content.
If I want to call the different elements form the print program now, I get the message, that "Main 01" oder "Main 02" are not exisiting! How can I call them from the program?
cheers Arne
‎2005 Sep 05 12:37 PM
Hi Arne,
In a sapscript you can have 99 instances of the main window. and for all of them the call has to be only for MAIN window. (not like MAIN 01, etc., the numbers that appear give you only the instance and not the window name). Because all of them share the same text elements. what you can do is when you have data spilling over your window you can use the command NEW-WINDOW inside the Text element so that the next MAIN window will be called with the next record.
and if you have multiple sets of data (ie., I see you might have 3 internal tables to display data from) then define one main window with 3 text elements and call them separately.
Deepak
‎2005 Sep 05 12:06 PM
‎2005 Sep 05 12:11 PM
This is my code for the several elements:
SELECT * FROM qmfe INTO wa_qmfe
WHERE qmnum = iviqmel-qmnum.
CALL FUNCTION 'WRITE_FORM' " Print pos detail.
EXPORTING
WINDOW = 'MAIN 01'
ELEMENT = 'AFFECT1'.
ENDSELECT.
CALL FUNCTION 'WRITE_FORM' " Print pos detail.
EXPORTING
WINDOW = 'MAIN 02'
ELEMENT = 'ESTIMAT1_BEFORE_LINE_1'.
SELECT * FROM qmma INTO wa_qmma
WHERE qmnum = iviqmel-qmnum.
APPEND wa_qmma TO it_qmma.
CLEAR wa_qmma.
ENDSELECT.
DATA l_count TYPE i.
LOOP AT it_qmma INTO wa_qmma.
CALL FUNCTION 'WRITE_FORM' " Print pos detail.
EXPORTING
WINDOW = 'MAIN 02'
ELEMENT = 'ESTIMAT1_LINE_1'.
IF l_count = 10.
EXIT.
ENDIF.
l_count = l_count + 1.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM' " Print pos detail.
EXPORTING
WINDOW = 'MAIN 02'
ELEMENT = 'ESTIMAT1_AFTER_LINE_1'.
‎2005 Sep 05 12:19 PM
Perhaps it's stupid, but have you called your windows: MAIN 01 (MAIN 02) or MAIN_01 (MAIN_02)?
I don't think it can insert space in the name of a window.
‎2005 Sep 05 12:22 PM
Hi,
I think you should use MAIN instead of MAIN 01, MAIN 02 etc.
Thanks
Vinod
‎2005 Sep 05 12:21 PM
Yes, I know, what You mean. the windows got the names automatically, when I have defined them as "Main".....
So the name in SapScript shows it with Space. I have tried 'Main01' and also 'Main 01'.... But both doesn´t work!
‎2005 Sep 05 12:27 PM
The problem is, when You have more than one Main-window, it calls them automatically different!
I need main windows to call elements in a loop. For normal windows, it´s not working and it´s overwriting the content You set before.
I also need more than one main-window to call the elements on the right positions of the page...
the problem is, how to call them
‎2005 Sep 05 12:56 PM
I think you didn't create three main-window, but you have a page with more main windows than one, but the main window is the same, so the system has generated that error.
If you have a dynamic text which it can need many lines (and you can't know how many), i think you should insert the text element in the main window.
‎2005 Sep 05 12:37 PM
Hi Arne,
In a sapscript you can have 99 instances of the main window. and for all of them the call has to be only for MAIN window. (not like MAIN 01, etc., the numbers that appear give you only the instance and not the window name). Because all of them share the same text elements. what you can do is when you have data spilling over your window you can use the command NEW-WINDOW inside the Text element so that the next MAIN window will be called with the next record.
and if you have multiple sets of data (ie., I see you might have 3 internal tables to display data from) then define one main window with 3 text elements and call them separately.
Deepak
‎2005 Sep 05 12:43 PM
Ok, but how can I manage, on which place exactly the data is going to be displayed? For example....
I have the two boxes, where 15 lines can be displayed. But it´s also possible, that there are only 3 records or something. then it´s not in the right order anymore....
don´t know how to manage this.....
‎2005 Sep 05 1:04 PM
Ok, that´s right.... I have several Text elements in my main window. But when I´m calling them, it is not in the right order, when the lines are less then the maximum of 15. Then my complete page-order is not working....
‎2005 Sep 05 1:13 PM
If the lines are less than maximun, can you write blank lines?