cancel
Showing results for 
Search instead for 
Did you mean: 

To generate 3 copies of smartform

Former Member
0 Kudos

Hi Experts,

I need to generate the 3 copies of smartform 1) ORIGINAL 2) DUPLICADO 3)TRIPLICADO

If the user gives numberof copies 2 then need to generate 2 original copies ,2 Duplicado copies and 3 triplicado copies.

Please suggest.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

U declare a paramters for No of copies on selection screen. Now do like below..

Parameters : p_cop type TDSFCOPIES.

data : g_s_out type ssfcompop.

g_s_out-tdcopies = 3 * p_cop.

CALL FUNCTION l_f_fname

EXPORTING

control_parameters = l_t_control

output_options = g_s_out

user_settings = space

p_langu = p_langu

TABLES

g_t_item = g_t_final

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

Hope it helps!!

Rgds,

Pavan

SuhaSaha
Advisor
Advisor
0 Kudos

>

> If the user gives numberof copies 2 then need to generate 2 original copies ,2 Duplicado copies and 3 triplicado copies.

> Please suggest.

Hello,

This seems weird to me. Do the triplicado copies have to be more than the other 2 copies ?

Plz revert back.

BR,

Suhas

Former Member
0 Kudos

Sorry it was the mistake.

I need to generate the 3 copies of smartform 1) ORIGINAL 2) DUPLICADO 3)TRIPLICADO

If the user gives numberof copies 2 then need to generate 2 original copies ,2 Duplicado copies and 2 triplicado copies.

Former Member
0 Kudos

hi,

After creating a window.

Go to the General Attributes window and then select window type as copies window.

In that select options u just need to select the original and copies identical.

The variable SFSY-COPYCOUNT would provide us count of the copy whether it is a first copy, second copy and others. We would use this field to print the owner of the copy.

Define a string, which would hold the name of the copy (bank copy and others) depending on the value of SFSY-COPYCOUNT. Define a variable in the global definition.

Write the code in the copies window which will help you to identify which one is orginal and others are duplicate.

if SFSY-COPYCOUNT = 001.

TEXT= 'Orginal'.

if SFSY-COPYCOUNT = 001.

TEXT= 'Duplicate''.

endif.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

If i understand correctly the 3 copies will be printed everytime irrespective of "number of copies" input by the user while printing.

Plz revert back.

BR,

Suhas

Former Member
0 Kudos

Hi Sunil

Thanks for the reply.

We had already done it.

But if we give no of copies as 1 then it prints 3 copies each with text 'ORIGINAL'.

What we have done is:

if sfsy-copycount = 001.

v_count1 = 1.

elseif sfsy-copycount = 002.

v_count1 = 2.

elseif sfsy-copycount = 003.

v_count1 = 3.

endif.

here if condtion is v_count1 = 1 , ORIGINAL is printed

if condtion is v_count1 = 2 , DUPLICADO is printed

if condtion is v_count1 = 3 , TRIPLICADO is printed

Former Member
0 Kudos

Hi Suhas

The 3 copies ORIGINAL , DUPLICADO and TRIPLICADO should be printed everytime.

ex: if no of copies is 1 i need 1ORIGINAL , 1 DUPLICADO and 1TRIPLICADO copies (in all 3 copies)

if no of copies is 2 i need 2 ORIGINAL , 2 DUPLICADO and 2 TRIPLICADO copies (in all 6 copies)

if no of copies is 3 i need 3 ORIGINAL , 3 DUPLICADO and 3 TRIPLICADO copies (in all 9 copies) and so on.

Please help me out.

Former Member
0 Kudos

Hi,

Take one parameter count = No.of Copies * 3. (assume 3 is no of copies)

loop the count. "9

loop the no of copies. " 3

WA_SSFCOMPOP-TDNEWID = 'X'. "New Spool Number

call smart form. " For first iteration 3 copies Print as Original

"For Second iteration 3 copies Print as Duplicate

"for Third iteration 3 copies Print Triplicado

endloop.

endloop.

SuhaSaha
Advisor
Advisor
0 Kudos

>

> Hi Suhas

>

> The 3 copies ORIGINAL , DUPLICADO and TRIPLICADO should be printed everytime.

>

> ex: if no of copies is 1 i need 1ORIGINAL , 1 DUPLICADO and 1TRIPLICADO copies (in all 3 copies)

> if no of copies is 2 i need 2 ORIGINAL , 2 DUPLICADO and 2 TRIPLICADO copies (in all 6 copies)

> if no of copies is 3 i need 3 ORIGINAL , 3 DUPLICADO and 3 TRIPLICADO copies (in all 9 copies) and so on.

>

> Please help me out.

Hello,

This is quite simple then.

Try this algo:


DATA:
ST_SSFCTRLOP TYPE SSFCTRLOP, "Smart Forms: Control structure
ST_SSFCOMPOP TYPE SSFCOMPOP, "SAP Smart Forms: Smart Composer (transfer) options
ST_SSFCRESOP TYPE SSFCRESOP. Smart Forms: Return value at start of form printing

DO 3 TIMES.
CASE SY-INDEX.
WHEN '1'.
V_NAME = 'ORIGINAL'.
CLEAR: ST_SSFCTRLOP, ST_SSFCOMPOP, ST_SSFCRESOP.
WHEN '2'.
V_NAME = 'DUPLICADO'.
ST_SSFCOMPOP-TDCOPIES = ST_SSFCRESOP-TDCOPIES .
ST_SSFCTRLOP-NO_DIALOG = 'X'.
WHEN '3'.
V_NAME = 'TRIPLICADO'.
V_NAME = 'DUPLICADO'.
ST_SSFCOMPOP-TDCOPIES = ST_SSFCRESOP-TDCOPIES .
ST_SSFCTRLOP-NO_DIALOG = 'X'.

* CALL the Smartform & pass the V_NAME as an interface param. if you need to print ORIGINAL , DUPLICADO and TRIPLICADO 
* on the respective copies. Please pass the EXPORTING params: ST_SSFCTRLOP, ST_SSFCOMPOP also to the FM.

* In the S-Form IMPORT param you'll find JOB_OUTPUT_OPTIONS (struc. SSFCRESOP) please capture it. As the field SSFCRESOP-TDCOPIES is of importance in your case.
ENDDO.

Hope i am clear. You donot have to worry about the no. of copies b'coz as the user inputs

BR,

Suhas

Former Member
0 Kudos

Hi Suhas

We have tried this

The problem is the function module in the program by default prints 3 copies.

That is if i give no of copies as 1 then it prints 3 * 3 9 copies. that is 3 ORIGINAL 3 DUPLICADO and 3 TRIPLICADO.

i have modified the standard program RLB_INVOICE as follows ( Code in between ****** is written by me) (Rest is standard code):

DO nast_anzal TIMES.

  • In case of repetition only one time archiving

IF sy-index > 1 AND nast-tdarmod = 3.

nast_tdarmod = nast-tdarmod.

nast-tdarmod = 1.

ls_composer_param-tdarmod = 1.

ENDIF.

IF sy-index NE 1 AND repeat IS INITIAL.

repeat = 'X'.

ENDIF.

DO 3 TIMES. " START OF CODE BY ME

DATA: V_COUNT1 TYPE I.

IF SY-INDEX = 1.

v_count1 = 1.

ELSEIF SY-INDEX = 2.

V_COUNT1 = 2.

ELSE.

V_COUNT1 = 3.

ENDIF. " END OF CODE BY ME

*************************************************

  • call smartform invoice

CALL FUNCTION lf_fm_name

EXPORTING

archive_index = toa_dara

archive_parameters = arc_params

control_parameters = ls_control_param

  • mail_appl_obj =

mail_recipient = ls_recipient

mail_sender = ls_sender

output_options = ls_composer_param

user_settings = space

is_bil_invoice = ls_bil_invoice

is_nast = nast

is_repeat = repeat

v_count1 = v_count1

importing job_output_info = ls_job_info

  • document_output_info =

  • job_output_options =

EXCEPTIONS formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • error handling

cf_retcode = sy-subrc.

PERFORM protocol_update.

  • get SmartForm protocoll and store it in the NAST protocoll

PERFORM add_smfrm_prot.

ENDIF.

ENDDO.