cancel
Showing results for 
Search instead for 
Did you mean: 

need to generate 3 copies for script: Original, duplicate, triplicate

Former Member
0 Kudos

Hi guys,

I am working on scripts.

I need to generate 3 copies for script: Original, duplicate, triplicate.

Please let me know the procedure.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

You will have

Open_form
Start_form
Write_form
End_form
Close_form

Statements in your Print Program. So place your statements from Start_form to End_form in a DO statement.

You said you want 3 Copies. So

Open_form.
DO 3 times.
Start_form.
Write_form.
End_form.
ENDDO.
Close_form .

This will create 3 copies.

In order to print different text on each copy, create a new window in the SAPSCRIPT at the required position.

Create three text elements in that window

E/ ORIGINAL
      ORIGINAL
E/ DUPLICATE
      DUPLICATE
E/ TRIPLICATE
      TRIPLICATE.

Now inside DO ENDDO, call this window along with the name of the text element, based on the count.

data: count type c.   "This should be declared globally
Open_form.
DO 3 times.
 count = count + 1.
Start_form.
If count = 1.
Write_form.
    window = newwindow
    Element = original.
elseif count = 2.
Write_form.
    window = newwindow
    Element = Duplicate.
elseif count = 3.
 Write_form.
    window = newwindow
    Element = Triplicate.
End_form.
ENDDO.
Close_form .

Former Member
0 Kudos

Hi,

You can pass parameter ITCPO-TDCOPIES to function module 'OPEN_FORM' and for printing of text 'Duplicate' i think you have to write logic as mention in other replies, you can also try symbol &SAPSCRIPT-COUNTER_x& if its useful to store current copy number in sap script.

Thanks,

Santosh

Former Member
0 Kudos

Hi,

several procedures possible.

In NACE define trhee steps to print.

In printprogram gave 3 copies ijn the parameters

and maybe more.

But start with trying on this 2

Gr., Frank

Former Member
0 Kudos

Frank, thank you.

But, how to get the NUMBER OF copies. I mean 1 st copy-> original 2 second -> duplicate 3rd -> triplicate.

I need the parameters or logic for this.

Please help me in this regard.

Former Member
0 Kudos

another possbility

you can build in your logic a loop (3 times)

which creates 3 times the same form.

With a global variable you count. if value 1 print Original if value is 2 print Duplicate if value is 3 print triplicate

Hope this helps.

Gr.,Frank

Former Member
0 Kudos

Hi

U need to change the logic of print program.

I can suppose u need to print at least 3 copies (1 for original, 1 for duplicate and 1 for triplicate), that shouldn't depends on how many copies the user has choosen to print, so if the user chooses two copie, that means it should be printed 6 copies( 2 for original, 2 for duplicates,.......).

So u should create DO cycle to repeat the print third, and insert all ABAP code to manage the print into the cycle, then u can set a variable where u insert the word COPY, DUPLICATE and TRIPLICATE.

DO 3 TIMES.
  CASE SY-INDEX.
     WHEN 1.  _COPY = 'COPY'.
     WHEN 2. _COPY = 'DUPLICATE'.
     WHEN 3. _COPY = 'TRIPLICATE'.
   ENDCASE. 
......... abap code to print the document
ENDDO.

Max

Former Member
0 Kudos

Hi,

I think this is not possible in Script. This is possible in smartforms. Because in smartforms we can get the copy count. Based on this we do.

Former Member
0 Kudos

Hi,

Now my requirement changed to smart form from Script.

Please let me know, how to get Original, duplicate, triplicate in smart forms.

SDN frds sugested that we can make use of COPY window.

we can use SFSY-copycount. (001/002/003).

But where can we make the variable/configuration that, total no of copies =3??

There exists NO configuration for my Driver prgm.

Edited by: puneindian on Jul 13, 2009 4:14 PM

Former Member
0 Kudos

i think we need to make the export variable of FM

i_tab-tdcopies = 3.

pass "itab" to "option" parameter.

Former Member
0 Kudos

Hi,

In print program before calling the Generated Function module of the form you need to pass the number of copies to that function module.

DATA: ls_composer_param TYPE ssfcompop.

......

ls_composer_param-tdcopies = 3.

CALL FUNCTION lf_fm_name

EXPORTING

..................................

control_parameters = ls_control_param