Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SapScript Problem

Former Member
0 Likes
1,337

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,314

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

11 REPLIES 11
Read only

Vinod_Chandran
Active Contributor
0 Likes
1,314

Hi Arne,

Can you post the code of WRITE_FORM?

Thanks

Vinod

Read only

Former Member
0 Likes
1,314

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'.

Read only

0 Likes
1,314

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.

Read only

0 Likes
1,314

Hi,

I think you should use MAIN instead of MAIN 01, MAIN 02 etc.

Thanks

Vinod

Read only

Former Member
0 Likes
1,314

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!

Read only

Former Member
0 Likes
1,314

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

Read only

0 Likes
1,314

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.

Read only

Former Member
0 Likes
1,315

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

Read only

Former Member
0 Likes
1,314

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.....

Read only

Former Member
0 Likes
1,314

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....

Read only

0 Likes
1,314

If the lines are less than maximun, can you write blank lines?