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

script doubt

Former Member
0 Likes
1,534

Hi

i used the following two satements in main window of my script.

/: BOX FRAME 10 TW

  • Page &PAGE& of &SAPSCRIPT-FORMPAGES&

I get abox and a message in page 1 of 5 onl;y in my first page.

I want this to to be extended for all pages i.e i need abox and a message saying page 2 of 5 in second page.

can anyone help me regarding this.

AND WHAT THE SYMBOLS MEAN , I AM CONFUSED AS TO WHICH ONE I NEED TO USE SYMBOLS MEAN *,/:,/e etc

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,501

Hi, I HAVE TRIED WITH THIS CODE TOO

I DISPLAYS THE DATE AFTER EVERY RECORD AND THAT TOO IN ONLY FIRST PAGE.

/E DATA

/: if &prev& EQ &page& .

  • page &page& of &sapscript-formpages&

/: &prev& = &prev& + 1 .

/: endif .

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&

I WANT SOME THING LIKE THIS

FIRST PAGE

PAGE 1 OF 5

123 456

234 567

---

SECOND PAGE

PAGE 2 OF 5

345 567

334 788

--

SECOND PAGE

PAGE 3 OF 5

345 888

222 999

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA'

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.

19 REPLIES 19
Read only

Former Member
0 Likes
1,501

hi kajol,

write this under a text element.

/E Details

/: BOX FRAME 10 TW

  • Page &PAGE& of &SAPSCRIPT-FORMPAGES&

in driver program.

loop at itab.

call function 'WRITE_FORM'

EXPORTING

ELEMENT = 'DETAILS'

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.

WHAT THE SYMBOLS MEAN , I AM CONFUSED AS TO WHICH ONE I NEED TO USE SYMBOLS MEAN *,/:,/e etc

/E-> Text element.

/: -> Command line

*-> Default Paragraph.

hope this helps,

do reward if it helps,

priya.

Read only

0 Likes
1,501

Hi ,

I HAVE THAT WRITTEN IN MAIN WINDOW .BUT FOR SOME REASON IT WORKS ONLY FOR FIRST PAGE.

can you help me to extend it to all pages

Read only

0 Likes
1,501

Hi,

Can you paste us the code in main window . I guess you did not have this piece of code under the element .Priya has already suggested this . PLease go through Priya's response once again .

regards,

Varun .

Message was edited by: varun sonu

Read only

Former Member
0 Likes
1,501

Hi Kajol,

In which window are you trying to print the data ? how many pages are there and is the window in which you are trying to print the data is in all the pages ? I guess you are not porinting in the main window .

/: is a command line whihc you can use to specfiy command statements like BOX, POSITION IF, CASE etc .

/E is an elemnt command whihc is used to link the form with the print program .

/E main

you use this variable in the FM write_form to specify that you want to write data to the main window .

Regards,

Varun .

Read only

Former Member
0 Likes
1,501

Hi Kajol,

1) If your page 1 of 5 is part of main window then do coding as suggested by Priya.

2) If not create a separate window and write these two statements under script editor.

3) The first two columns in the script editor descirbes about the action to be taken on text elements.Just press F4 at this column, then it will gives the descriptions of these columns.

<b>/: Command Line

/* Comment Line

/E Text Element

= Extended Line</b>

( Raw Line

/ Line Feed

/= Line Feed and Extended Line

/( Line Feed and Raw Line

Thanks,

Vinay

Read only

0 Likes
1,501

HI GUYS,

The page number is displaying for all pages but the problem is that its displaying after every record

This is my main window code

/E DATA

  • PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

/: BOX FRAME 10 TW

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&

O/P IS LIKE THIS

PAGE 1 OF 15

1233 123

PAGE 1 OF 15

12344 3434

INSTEAD I WANT PAGE 1 OF 15 ONLY ONCE AT THE TOP OF THE MAIN WINDOW AND THAT TOO AT RIGHT HAND CORNER

PLEASE GUIDE ME FOR THIS

Read only

0 Likes
1,501

Hi Kajol,

1) This is happened due to your WRITE_FORM as this ELEMENT E in a LOOP...ENDLOOP.

2) So,remove the PAGE statement from ELEMENT E and place out side of ELEMENT E.

3) Try with this replacement in your script editor.

<b>* PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

/E DATA

/: BOX FRAME 10 TW

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&</b>

Note: Plz reward points to all helpful answers and close the thread once problem is solved.

Thanks,

Vinay

Read only

0 Likes
1,501

Hi,

Kajol, rewrite your code like this :

/E lines

  • PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

/E DATA

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&

I think Vinay gave you the better answer.

Regards,

Varun .

Message was edited by: varun sonu

Read only

0 Likes
1,501

Hi,

I already tried that .If i do that i dont see the page number for for my second page .

I have created two pages

first page ,second page

the second page repeats

Read only

0 Likes
1,501

Hi,

Try to create a new window and have the same window on both pages above the main window .In the editor of that window have your code :

  • &page& of &formpages&

This should resolve your problem .

Regards,

Varun .

Read only

0 Likes
1,501

Hi ,

If i do that i doesn't the no of pages the data will take so its displays only like page 1 of thats it.

Read only

0 Likes
1,501

Hi,

Declare a variable in the print program :

data : prev type n value 1 .

In the main window use this code :

/E DATA

/: if &prev& EQ &page& .

  • page &page& of &sapscript-formpages&

/: &prev& = &prev& + 1 .

/: endif .

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&

Regards,

Varun .

Message was edited by: varun sonu

Message was edited by: varun sonu

Read only

0 Likes
1,501

hi kajol,

I WANT PAGE 1 OF 15 ONLY ONCE AT THE TOP OF THE MAIN WINDOW AND THAT TOO AT RIGHT HAND CORNER

  • ,,,,,(give tab space for right)Page: &PAGE& of &SAPSCRIPT-FORMPAGES&

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
1,502

Hi, I HAVE TRIED WITH THIS CODE TOO

I DISPLAYS THE DATE AFTER EVERY RECORD AND THAT TOO IN ONLY FIRST PAGE.

/E DATA

/: if &prev& EQ &page& .

  • page &page& of &sapscript-formpages&

/: &prev& = &prev& + 1 .

/: endif .

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&

I WANT SOME THING LIKE THIS

FIRST PAGE

PAGE 1 OF 5

123 456

234 567

---

SECOND PAGE

PAGE 2 OF 5

345 567

334 788

--

SECOND PAGE

PAGE 3 OF 5

345 888

222 999

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA'

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.

Read only

0 Likes
1,501

Hi,

Did you check wether prev value is getting updated ?

Regads,

Varun.

Read only

0 Likes
1,501

can you tell me how to debug the script plss

Read only

0 Likes
1,501

HI,

Goto se71 and follow the navigation : utilities -> activate debugger and then run the program .

Also try this :

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA'

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.

<u><b>prev = prev +1 .</b></u>

ENDLOOP.

IN the form editor remove &prev& = &prev& + 1

Regards,

Varun .

Message was edited by: varun sonu

Message was edited by: varun sonu

Read only

0 Likes
1,501

Hi Kajol,

1) Just place <b>&PAGE& OF &SAPSCRIPT-FORMPAGES&</b> statement between <b>TOP...ENDTOP</b>.

2) As for main window, you can determine lines, which are always O/P automatically at the top of the window with TOP...ENDTOP.

3) So, use this code in your script editor.

<b>/: TOP.

  • PAGE &PAGE& OF &SAPSCRIPT-FORMPAGES&

/: ENDTOP.

/E DATA

/: BOX FRAME 10 TW

  • &ITAB-MATNR&,,,,&ITAB-KOSTL&</b>

4) <b>To activate the debugger</b> in scripts,Select <b>Utilities</b> menu and select <b>Activate Debugger</b>.

Note: Plz reward points to all helpful answers and close the thread once problem is solved.

Thanks,

Vinay

Read only

0 Likes
1,501

Hi

Top,end top worked for me

Thanks all