cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Script - Calling Same Script Multiple Times - Page Number initializat

Adi_Bathineni
Participant
0 Kudos

Hi Guru's,

We are printing Shop Floor Paper work using SAP Scripts.

For the Production orders we have number of operations for each component.

If we print the production order, we should get the following result.

Ex: Production Order - 10 Components & Each componet has 4 pages

1st 4 pages - info about 1st component . The page numbers are printing from 1 to 4 as 1 of 40, 2 of 40 , 3 of 40 & 4 of 40.

After printing this, entire script is getting called and the page numbers are again printing 1 of 40 , 2 of 40 , 3 of 40 & 4 of 40.

we don't want that..we need to print 5 of 40, 6 of 40, 7 of 40 & 8 of 40 and so on.

Because of calling script its initializing the page number again, do we have any way to know how many pages got print or how many need to be printed or some other way to get this.

Please suggest me .

Thanks,

Adi.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Bathineni Adinarayana ,

As my understanding ,

for a PO you have 10 components and each component have 4 pages.

for first component you want apage numbers are like

1of4 ,2 of 4 and 3 of 4 and 4 of 4 is this correct?

if so than count the no.of pages if pages >4 than clear and initialize to 1 so that you will get solution

correct me if my understanding is wrong

Thanks

Surendra

Adi_Bathineni
Participant
0 Kudos

Hi Surendra,

Thanks for your reply....

That's the way its working now. when its getting called the 1st component its printing as 1 of 40, 2 of 40, 3 of 40 & 4 of 40.

When it calls the 2nd component it should print as 5 of 40, 6of 40 , 7 of 40 & 8 of 40. But the counter is getting initialized and printing as 1 of 40, 2 of 40, 3 of 40 & 4 of 40.

The reason for that, for every component the script is calling again. That's the reason, the page counter is getting initialized.

Thanks,

Adi.

Former Member
0 Kudos

you need to do that manually.

2 possible solutions:

1. Call your script just ONE time, and not for every component. Tho this will require vast changes in the logic of the driver program. It will be quite timeintensive but it will be a clean solution.

2. You could however before the end of processing of each subform store the actual pagenumber into ABAP memory or TVARVC.

Read this at the start of each subform, and clear it when read. Just make sure to print your variable now as i wouldnt try to assign new values to sy-pageno.