cancel
Showing results for 
Search instead for 
Did you mean: 

doubts in sapscript

Former Member
0 Kudos

Hi,

1.How we can use main window for Heading and total.

2. Is there any commond in sapscript for Getting the total of any coloumn as Samrtforms?.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Reward points if it is usefull.

Regards

Madhu G S

Former Member
0 Kudos

Answer for your first question:

It is very difficult to display the heading in all the pages using SAP script, but there is a solution.

You need to write some logic in your driver program in order to display the heading.

Imagine there are 50 records in your internal table and you knows that 25 records can fit in each page(trial and error method). Then you can use the following logiv

call header window( for first page)

loop at itab.

index = index + 1.

v_head = index mod 25.

if v_head = 0.

call the header window.(for subsiquent pages)

endif.

call data window.

endloop.

You can also use your own logic if records in first page are lesser than the remaining pages.

Answer for your second Question:

There is no inbuilt functionality to calculate sum in SAP scripts as in Smartforms.

You need to calculate it in your driver program. If you are changing the standard SAP Script and not able to change driver program then you can call a subroutine which is present in a include program from your SAP Script and calculate the sum in that subroutine.

I hope this information helps you.

Regards

Madhu G S

Former Member
0 Kudos

Hi,

Thanks for reply.

I have still doubts regaring that:

yes, we can create two elements one for heading and

one for data. but how heading will be called for next page.

we are looping the main data and calling respective elements for printing and then how we can print the heading in the next page.

Regards

Mohit

valter_oliveira
Active Contributor
0 Kudos

Hello again.

That header text element must be in the begining of the loop (but inside of it). Perhaps with an "IF condition" like: if first line of loop or new page. The only thing is that you have to determine if a new page occured. Probably counting the number of lines, or verifying if current page is different from previous page.

Regards.

Valter Olivera.

Former Member
0 Kudos

Hi,

For first question you need to use two different text elements and print. For header no need of loop, but for printing item details you need to call the write_form with second text element.

For Second one, there is no any standard command to find total, you need to calculate in print program and need to print the same.

Please reward if helpful.

valter_oliveira
Active Contributor
0 Kudos

Hello.

For question 1, you must create 2 text elements: /E header and /E total. Those elements must be called by your print program. The first one before the body of main window and second after.

For question 2, I would say that in your print program, when you are looping to your internal table, you can sum the values to the total variables that you will use in text element /E total.

Regards.

Valter Oliveira.