cancel
Showing results for 
Search instead for 
Did you mean: 

sap script problem

Former Member
0 Kudos

I have data in the internal table like

1 A 1-1 100.00

1 A 1-1 200.00

1 A 1-1 300.00

2 B 1-2 100.00

2 B 1-2 200.00

2 B 1-2 300.00

3 C 1-3 100.00

3 C 1-3 200.00

3 C 1-3 300.00

4 D 1-4 100.00

4 D 1-4 200.00

i have to print this data in the script like

*First page

*subject window

A 1-1

*main window

1 A 1-1 100.00

1 A 1-1 200.00

1 A 1-1 300.00

total 600.00

*second page

*subject window

B 1-2

*main window

2 B 1-2 100.00

2 B 1-2 200.00

2 B 1-2 300.00

total 600.00

*Third page

*subject window

C 1-3

*main window

3 C 1-3 100.00

3 C 1-3 200.00

3 C 1-3 300.00

total 600.00

*Fourth page

*subject window

D 1-4

*main window

4 A 1-4 100.00

4 A 1-4 200.00

total 300.00

GrandTotal 2100.00

can anyone help me to get this

iam getting the output as

*First page

*subject window

B 1-2

*main window

1 A 1-1 100.00

1 A 1-1 200.00

1 A 1-1 300.00

total 600.00

*second page

*subject window

C 1-3

*main window

2 B 1-2 100.00

2 B 1-2 200.00

2 B 1-2 300.00

total 600.00

*Third page

*subject window

D 1-4

*main window

3 C 1-3 100.00

3 C 1-3 200.00

3 C 1-3 300.00

total 600.00

*Fourth page

*subject window

D 1-4

*main window

4 A 1-4 100.00

4 A 1-4 200.00

total 300.00

GrandTotal 2100.00

In subject window iam getting the next page record value

can anyone tell me how to avoid this

its urgent requirement

Thanks & regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Pradeep,

in the Subject window call a perform.. (i hope u know how to call a perform in script..)..

and in the main loop take the value of the sy-tabix into a global variable (say w_index ).

In the called perform read the same internal table into a different work area other than the work area which u are using to print maindata with index eq ( w_tabix - 1 )!!!

and then pass the first two field values into the script....

In scripts MAIN window will get executed first and then the remaining variable windows...

So at the time of printing the subject window ... work area will have 4th record !!! thats y the output is coming like that !!!

regards,

sai ramesh

Former Member
0 Kudos

Thank you sai

How to read the data from internal table itab to another work area

Can u please tell me

Former Member
0 Kudos

declare another work area with in that perform itself..

as

( itab is the main table )

<b>data wa_temp like line of itab.

data l_index type i.

l_index = w_tabix - 1.

read table itab into wa_temp index l_index.</b>

Please do remember to close the thread when ur problem is solved !!

Regards,

Sai Ramesh

Former Member
0 Kudos

Hi,

In the Second page, look at the Upper, Width and length of the Main window, you need to maintain the correct values for the main window in the second page

Regards

sudheer