cancel
Showing results for 
Search instead for 
Did you mean: 

Heading based on no. of copies

Former Member
0 Kudos

Hi all,

Suppose I give a print of script output for 3 copies.

For the 1st copy I should get the heading as 'Original ' on the top right side of my page , for the 2nd copy I should get heading 'Duplicate' and for the third copy 'Office document'. How can I make it possible? Please suggest.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You have a structure ITCPO.... You have field tdcopies

populate this structure in your print program and in your script create a variable window and write the logic based on this field

Print program.

do tdcopies times

w_index = sy-index.

Your open_form code starts here

write_form etc

end_form

enddo

In your variable window check the condition

if &w_index& eq 1.

original

else

copy

endif.

this should be helpful

any queries revert back

regards

padma

Former Member
0 Kudos

Hi Padma,

It seems, we are calling the script form for as many no. of times as the no. of copies we need. Can't we validate it without putting the DO, ENDDO statement in driver program? Because I can't assure you that we'll take 3 copies every time.Some times we may need only one copy. Your response helped me a lot . I am studying all those structures.Please give more details. Is there any way to change the heading as per the no. of copies given while taking print from SP02 . Here we don't have option for immediate printing.So I have to validate data after entering into SP02. Is this possible?

Answers (2)

Answers (2)

former_member387317
Active Contributor
0 Kudos

Hi Jayasri P,

Nice Requirement...

I think it's not possible from SP02 and all...

See the below process...

For SAP Scripts.

You will have to call the script in a loop.(DO... ENDDO)...

The number of times the loop is called shud be equal to the number of copies

and u can get the no of copies from either NAST-ANZAL or TDCOPIES

Now store it's value in variable say TOTAL_COPY

counter = 0. initialize conuter to zero

DO TOTAL_COPY TIMES

counter = counter + 1. " or u can use sy-index here...
if counter = 1.
text = 'original'.
elseif counter = 2.
text = '2nd Copy'.
elseif counter = 3.
text = '3rd Copy'.
elseif counter = 4.
text = '4th Copy'.
endif.

*Now print this text in some variable window as per ur need.
*This is the logic how u can achive this functionality..

OPEN_FORM....
WRITE_FORM (for each window and textelements)
CLOSE_FORM

ENDDO.

also have a look on below threads for more information...

http://help.sap.com/saphelp_nw70/helpdata/EN/d6/0db74a494511d182b70000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw70/helpdata/EN/d6/0db875494511d182b70000e829fbfe/content.htm

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

Hi Jayasri,

Even i could not get the same when i was trying...

You can try one thing... You can accept the number of copies using parameters and pass it to the structure ITCPO.

Hope this should help you.

regards

padma

Former Member
0 Kudos

Hi Padma,

Actually I am trying to do this for the Tcode J1IF11. Here I have to give the challan no. and should select 'Print immediately' Tab and should save the document.Then I am going to SP02 and looking for the preview. Is n't there any way of looking for the preview there itself from the transaction? That's why I am not getting from where I can pass the no. of copies to be printed.

Former Member
0 Kudos

hi

it will be easy to work on the same issue in smartform by using copies window.

Former Member
0 Kudos

This code will suffice:

if &PAGE& = 1

heading = 'Original'

elseif &PAGE& = 2

heading = 'Duplicate'

elseif &PAGE& = 3

heading = 'Office document'

endif.

reward points

Former Member
0 Kudos

Hi patrik,

I am asking different headings for each individual copy, not for page.Is this what the correct ans. you provided? Please reply.

Edited by: Jayasri P. on Jul 4, 2008 11:53 AM