cancel
Showing results for 
Search instead for 
Did you mean: 

Different text depending on number of copies (RLB_INVOICE)

Former Member
0 Kudos

Dear SDN community,

I need to print the sales invoice in three copies, in which the first copy says "Original", the second "Duplicate" and the third "Triplicate".

Looking at RLB_INVOICE coding, I noticed that the Smartform is called three times. I copied standard Smartforms LB_BIL_INVOICE and created inside the reapeat window three different text elements with the conditions query the SFSY-COPYCOUNT variable. In every call, the variable is 1.

Is there any way to archive this requisite without changing standard report RLB_INVOICE?

Naturally, changing standard report I can pass sy-tabix variable inside SF and query this variable. But shouldn´t it be possible without changing standard report?!

Thanks in advance,

MPM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You might use a parameter export/import to know what is the copy.

clear lv_copy.

import lv_copy from memory id id_copy.

case id_copy .

when ' '.

text_copy = 'Original'.

id_copy = 1.

export lv_copy to memory id id_copy.

when '1'.

text_copy = 'Duplicate'.

id_copy = 2.

export lv_copy to memory id id_copy.

when '2'.

text_copy = 'Triplicate'.

free memory id id_copy.

endcase.

I am Sure that it is not the best solution, but I believe that I would work and he avoids the problem of copying the standard program

Another option would be to print only one copy of the form instead of 3, and to do a jump of page on having finished originally and different one on having finished the duplicate. This way you might use the field SFSY-PAGE.

Edited by: Jose Vaquero Polonio on Dec 20, 2010 6:27 PM

Former Member
0 Kudos

Dear José,

In your solution I need to copy standard program to a Z, right?!

Since I need to create a copy, I would rather prefer to pass the sy-index variable as parameter into my SF like shown below.


Data: ld_index like sy-index.
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.
* call smartform invoice
* MPM move sy-index to local variable
     move sy-index to ld_index.
      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
* MPM include index parameter
                      is_index             = ld_index
           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.

Since it seems to me that my requirement is quite normal, I was looking for way to solve it using the standard program. Somebody surely had the same problem?!

To Satyajit: Yes, I used a copy window and I am checking SFSY-COPPYCOUNT. But value is always 1. I have three text elements with conditions checking SFSY_COPYCOUNT, but all copies are always original since the value of SFSY-COPYCOUNT is always 1.

To sam_ins: I will check nast structure again, but I am quite sure I checked it already and the problema is the same as SFSY-COPYCOUNT.

Thanks anyway,

MPM

Edited by: Marcelo Moreira on Dec 21, 2010 11:23 AM

Former Member
0 Kudos

Hi Marcelo,

With the parameters export/import you do not need to create a program Z.

This code you it can put in the event initialization inside the smartform.

Former Member
0 Kudos

Hi José,

Actually my problem is that inside my Smartforms, even in the initialization event I have not any reference to the number of copies.

If I use import from memery of the copy number, somewhere I have to export to memery the number.

I may not getting the point of your solution. Can you explain little bit more?

Thanks,

MPM

Former Member
0 Kudos

The smartform executes three times.

The first time, you import from memory the parameter. No value recovers, so it is the first copy and you export the value 1 to memory.

The second time, you import from memory the parameter, you recover 1 so it is the second copy and export 2 to memory.

The third time, you import from memory the parameter, you recover 2, for what it is the third copy and free the parameter of memory.

for example:

lv_id = ls_bil_invoice-hd_gen-belnr.

clear lv_copy.

import lv_copy from memory id lv_id.

case lv_copy.

when 0.

lv_text = 'Original'.

lv_copy = 1.

export lv_copy to memory id lv_id.

when 1.

lv_text = 'Dup..'.

lv_copy = 2.

export lv_copy to memory id lv_id.

when 2.

lv_text = 'Trip..'.

free memory id lv_id.

endcase.

Regards,

Edited by: Jose Vaquero Polonio on Dec 21, 2010 12:12 PM

Edited by: Jose Vaquero Polonio on Dec 21, 2010 12:13 PM

Former Member
0 Kudos

Hi José,

I got it now. In fact this is a solution...not the most elegant one, with all respect, but a valid one.

Anyway, I espected to find a more standard solution...something like querying a variable with the number of prints that actually works, not like SFSY-COPYCOUNT.

Thanks.

Answers (2)

Answers (2)

satyajit_mohapatra
Active Contributor
0 Kudos

Have you used a copies window in your smartform??????

To diplay the text 'Org'/'Dup'/'Tri' create a copies window in your smartform. Now in the same window, create a programline to check the value of SFSY-COPYCOUNT and populate the texts accordingly in a variable. Now in a text element print the variable. The no of copies required will be controlled by the driver program.....

Former Member
0 Kudos

Hi

Try the following

In the standard RLB_INVOICE check there will be one subroutine for updating nast where u can check whether it is printing for firsttime or second time or third time.based on this print origianl,duplicate or triplicate.....