Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Smartforms Prints not Coming in Sequence

former_member196157
Active Participant
0 Likes
7,462

Hiii Experts,

I print the smartforms using driver program, for printing the multiple invoices, for that I am printing the multiple copies of smartform i.e. '

Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy'.......for that all logic is ok with using the copies window.........

                                   Now problem is that the copies of the smartforms not coming in sequence i.e. when I enter the multiple invoice for that invoices the print preview shows first all 'Original Copy' of all invoices and then shows all 'Duplicate copy'  of all invoice and so on for other copies but we want

for first invoice ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy' ..... for second invoice ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy'...... for third invoice ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy'

within in copy window I use code as below...

if sfsy-copycount = '001'.
     text1 = 'Original Copy'.
   elseif  sfsy-copycount = '002'.
     text1 = 'Duplicate Copy'.
   elseif  sfsy-copycount = '003'.
     text1 = 'Triplicate Copy'.
   elseif  sfsy-copycount = '004'.
     text1 = 'Extra Copy I'.
   elseif  sfsy-copycount = '005'.
     text1 = 'Extra Copy II'.
   endif.

Plz help me .......

Thanks......


1 ACCEPTED SOLUTION
Read only

former_member196157
Active Participant
0 Likes
7,094

Dear All,

Finally got the solution by myself ,

I just tick the checkbox Group.........

Thanks to all of u for useful helps....

Thanks once again

22 REPLIES 22
Read only

koolspy_ultimate
Active Contributor
0 Likes
7,094

Hi,

   Try the below code..

instead of using sfsy-copycount in smart form , write the logic in your driver program.


inside you final loop where you append values to internal table (this internal table will be used in sf) try the below code...

loop at itab into wa_tab.

your logic..

do n times.
       if n = 3. """"""""Here 3 will execute the smart form 3 times..
         flag = flag + 1.
       endif.

       if flag = 1.
         v_desc  = 'ORIGINAL-BUYERS COPY' .  """""""""""
v_desc will be your text.
       elseif flag = 2.
         v_desc = 'DUPLICATE-TRANSPORTERS COPY'.
       elseif flag = 3.
         v_desc = 'TRIPLICATE-SELLERS COPY' .
       endif.

       wa_final-zdesc  = v_desc.
       wa_final-zdesc1 = v_desc1.
       append wa_final to it_final.  """"""""" it_final will be appended to smartform.
     enddo.

endloop.

Hope this will solve your problem..

Regards,

Madhumahesh.

Read only

Former Member
0 Likes
7,094

Hi,

In u r form

First Create one Separate Window for Text of type 'Copies Window'.

In program lines write the below code

IF SFSY-COPYCOUNT = '001'.

v_TEXT = 'Original'.

ENDIF.

IF SFSY-COPYCOUNT = '002'.

v_TEXT = 'Duplicate'.

ENDIF.

IF SFSY-COPYCOUNT = '003'.

v_TEXT = 'Triplicate'.

ENDIF.

IF SFSY-COPYCOUNT = '004'.

v_TEXT = 'Quadruplicate'.

ENDIF.

IF SFSY-COPYCOUNT = '005'.

v_TEXT = 'Extra Copy'.

ENDIF.

Then Print 'V_TEXT' in Text Element

pls check this link

http://scn.sap.com/thread/1334754

Read only

0 Likes
7,094

Dear Kiran,

As per ur suggestion I already done the code but my question is that  when I print preview or print the Form for multiple invoices then it prints all original copies then duplicate copies and so on but we want sequence as first invoice Original copy, Duplicate Copy ,triplicate copy and then for second invoice Original copy, Duplicate Copy ,triplicate copy and so on .......sequence should no be change

Read only

0 Likes
7,094

Hi,

    Did you try what i mentioned earlier?

Regards,

Madhumahesh.

Read only

0 Likes
7,094

Hi,

That means in your case, when control enters into the smartforms.. it should loop for 4 times and then for second invoice.. it should again loop for 4 times..right..

I have implemented this scenario for our client.. please do following..

     wa_heading-name 'Original Copy'.

     APPEND wa_heading TO it_heading.

     CLEAR: wa_heading.

     wa_heading-name 'Duplicate Copy'.

     APPEND wa_heading TO it_heading.

     CLEAR: wa_heading.

    wa_heading-name =  'Triplicate copy'.

     APPEND wa_heading TO it_heading.

     CLEAR: wa_heading.


    wa_heading-name =  'Extra copy'.

    APPEND wa_heading TO it_heading.

     CLEAR: wa_heading.

And then loop your Main window or the nodes which are common for all copies.

and for each copy give command line as i shown below..


Regards

Tejas

Read only

0 Likes
7,094

Yes

Read only

0 Likes
7,094

Can you post your source code, where you are appending data into final internal table?

Regards,

Madhumahesh.

Read only

VijayaKrishnaG
Active Contributor
0 Likes
7,094

Hi Mahadeo,

How did you and where did you enter multiple invoices? Are you calling Smartform in the loop of internal table with multiple invoices or what??

Thanks & Regards,

-Vijay

Read only

Former Member
0 Likes
7,094

hi Mahadeo,

i think your design of the smartforms have problem.

loop invoices.

   loop copies where num = invoices-num.  (of couse, the itab of copies already sort by your sequence )

   logic of templete or table.

  

hope will help you.

Regards,

Archer

Read only

Former Member
0 Likes
7,094

Hi,

  You can write logic in the driver program, after writing the SSF_OPEN,

   after writing loop for multiple invoices, just write the code

  DO 3 TIMES.
    N = N + 1.
    IF N = 1.
      COPY = 'ORIGINAL FOR BUYER'.
    ELSEIF N = 2.
      COPY = 'Duplicate for Transporter'..
    ELSEIF N = 3.
      COPY = 'Triplicate for Assessee'..
   

ENDIF.

then you just call the function module generated for the form and write ENDDO after it.

Regards

Kusuma

Read only

0 Likes
7,094

Hi Dear,

You may have used "Main Window".

Please use "Copies Window".

With Thanks & Regards,

Tushar Trivedi.

Read only

former_member196157
Active Participant
0 Likes
7,094

Hiii Experts,

Here is the source Code,

Selection Screen:

Source Code:

loop at h_inv1 into winv1.
   loop at i_inv1 into winv2 where exnum = winv1-exnum.
     append winv2 to i_inv.
   endloop.
     append winv1 to h_inv.
CLEAR LS_CONPARA.
  DESCRIBE TABLE h_inv1 lines cnt.
   if cnt > 1.
     AT FIRST.
        LS_CONPARA-NO_OPEN  = SPACE.
        LS_CONPARA-NO_CLOSE = 'X'.
      ENDAT.

      IF FLAG = SPACE.
        LS_CONPARA-NO_OPEN  = 'X'.
        LS_CONPARA-NO_CLOSE = 'X'.
      ENDIF.

      AT LAST.
        LS_CONPARA-NO_OPEN  = 'X'.
        LS_CONPARA-NO_CLOSE = SPACE..
      ENDAT.

       call function lv_smartform
        EXPORTING
          CONTROL_PARAMETERS = LS_CONPARA
        tables
          h_inv            = h_inv
          i_inv            = i_inv
        exceptions
          others             = 0.

   CLEAR: FLAG.
   clear: h_inv[], i_inv[].
  else.
          call function lv_smartform
       EXPORTING
         CONTROL_PARAMETERS = LS_CONPARA
       tables
         h_inv            = h_inv
         i_inv            = i_inv
       exceptions
         others             = 0.
   endif.
endloop.

"we want"

for first invoice 0100000101: ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy' then

for second invoice 0100000102 ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy' then

for third invoice 0100000103 ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy'

But it comes like that ,

for first invoice 0100000101:      ' Original Copy', '

for second invoice 0100000102 ' Original Copy',copy'

for third invoice 0100000103     ' Original Copy',

for first invoice 0100000101:      ' Duplicate Copy'

for second invoice 0100000102 ' Duplicate Copy'

for third invoice 0100000103     ' Duplicate Copy'

for first invoice 0100000101:    'Triplicate copy'

for second invoice 0100000102 'Triplicate copy'

for third invoice 0100000103     'Triplicate copy'

I use Copies window

in copies window code is like that.........

if sfsy-copycount = '001'.
     text1 = 'Original Copy'.
   elseif  sfsy-copycount = '002'.
     text1 = 'Duplicate Copy'.
   elseif  sfsy-copycount = '003'.
     text1 = 'Triplicate Copy'.
   elseif  sfsy-copycount = '004'.
     text1 = 'Extra Copy I'.
   elseif  sfsy-copycount = '005'.
     text1 = 'Extra Copy II'.
   endif.

Read only

0 Likes
7,094

Dear Mahadeo,

Please try this one

data: SSFCOMPOP TYPE SSFCOMPOP.

  SSFCOMPOP-TDCOPIES = 3.   " Number of copy you want


CALL FUNCTION fm_name
  EXPORTING
   OUTPUT_OPTIONS             = SSFCOMPOP


*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    ITAB                       = ITAB
    ITAB3                      = ITAB3
    ITAB2                      = ITAB2
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 4
*   OTHERS                     = 5
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards,

Yogesh Chaudhari

Read only

0 Likes
7,094

This is a very long time Query for which I am seeking answer for , when we Implement multi print option using

http://help.sap.com/saphelp_nw04s/helpdata/en/71/9ccd9c8e0e11d4b608006094192fe3/content.htm

Hope I will get answer from your query

Read only

former_member196157
Active Participant
0 Likes
7,094

Dear all,

My problem is only with sequence of printing the copies.........

"we want"

for first invoice 0100000101: ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy' then

for second invoice 0100000102 ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy' then

for third invoice 0100000103 ' Original Copy', ' Duplicate Copy','Triplicate copy','Extra copy'

But it comes like that ,

for first invoice 0100000101:      ' Original Copy', '

for second invoice 0100000102 ' Original Copy',copy'

for third invoice 0100000103     ' Original Copy',

for first invoice 0100000101:      ' Duplicate Copy'

for second invoice 0100000102 ' Duplicate Copy'

for third invoice 0100000103     ' Duplicate Copy'

for first invoice 0100000101:    'Triplicate copy'

for second invoice 0100000102 'Triplicate copy'

for third invoice 0100000103     'Triplicate copy'

I use Copies window

in copies window code is like that.........

if sfsy-copycount = '001'.
     text1 = 'Original Copy'.
   elseif  sfsy-copycount = '002'.
     text1 = 'Duplicate Copy'.
   elseif  sfsy-copycount = '003'.
     text1 = 'Triplicate Copy'.
   elseif  sfsy-copycount = '004'.
     text1 = 'Extra Copy I'.
   elseif  sfsy-copycount = '005'.
     text1 = 'Extra Copy II'.
   endif.

Thanks........

Read only

0 Likes
7,094

Hi

What i would suggest is in case you want to control this print order. Then in your internal table append as many entries as you need to print for copies etc and each time while calling smartform pass a flag to signify whether which copy it is.

It will then print in order.

Nabheet

Read only

former_member196157
Active Participant
0 Likes
7,095

Dear All,

Finally got the solution by myself ,

I just tick the checkbox Group.........

Thanks to all of u for useful helps....

Thanks once again

Read only

0 Likes
7,094

Great

Read only

0 Likes
7,094

But where can we set this in Control Parameters ?

Am using Multi Print with NO_DIALOG = 'X'.

Read only

0 Likes
7,094

Got it

SSFCOMPOP-TDGROUP = 'X'.

For future reference

Read only

0 Likes
7,094

Dear ,

Yes U r correct.......

use SSFCOMPOP-TDGROUP = 'X'.

then it will check automatic checkbox of group...

if u want to come number of copies and group check box tick automatically 'then we can do enhancement also and achieve it......

Actually I did the enhancement for default Number of copies based on selection screens radio buttons i.e. five copies ,three copies so on

when user select radio button five copies then number of copies 5 automatically come and also the group check box is active.

Thanks......

Read only

0 Likes
7,094

This thread was equally beneficial for me as well.

I corrected my Multi Sale Invoices Print program