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

Regarding Smartforms printing - multiple pages

Former Member
0 Likes
1,272

Hi Friends:

Please help me out on this query. I know how to make a smartform. I've made smartforms but the condition is that it triggers only one smartform. I've a requuirement that I've to trigger smartform for multiple vendors.The format of the smartform will be the same.Logo will be same. The address of the vendors will be changed.The line items in the main window will be changed.Footer will be constant. There will be a select option on the selection screen, which will select a range of the vendors.There will be some other parameters.I tried using loop, but every time it triggers one smartform & then again displays "print preview dialog box". I want all the smartforms to generate in one go.once the smartform for one vendor finishes, it should trigger a new one on the next page.Please help me out urgently.If anyone has a sample program, please send it to me.Reward points will be there.

8 REPLIES 8
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
952

Hi,

Pass the select-option as a input to smartform.

Check this link.Here I am explaining how to do this.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501...

If you want to restrict print dialog box,you can achieve it by the following coding.

&----


*& Report ZZZ_JAYTEST1 *

&----


REPORT zzz_jaytest1 NO STANDARD PAGE HEADING MESSAGE-ID zhrt.

  • Variable Declaration

DATA : v_form_name TYPE rs38l_fnam,

itab TYPE STANDARD TABLE OF pa0001,

w_ctrlop TYPE ssfctrlop,

w_compop TYPE ssfcompop,

w_return TYPE ssfcrescl.

SELECT * FROM pa0001 INTO TABLE itab UP TO 5 ROWS.

SORT itab BY pernr.

DELETE ADJACENT DUPLICATES FROM itab COMPARING pernr.

DATA: control TYPE ssfctrlop,

control_parameters TYPE ssfctrlop,

output_options type SSFCOMPOP.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

control-no_dialog = 'X'.

control-device = 'PRINTER'.

output_options-tddest = 'LOCL'.

OUTPUT_OPTIONS-TDNOPRINT = 'X'.

OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

USER_SETTINGS = ' '

OUTPUT_OPTIONS = output_options

CONTROL_PARAMETERS = control

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.

output_options-tddest = 'LOCL'.

OUTPUT_OPTIONS-TDNOPRINT = 'X'.

OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

CALL FUNCTION '/1BCDWB/SF00000066'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = control

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = output_options

USER_SETTINGS = ' '

  • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO = w_return

    • JOB_OUTPUT_OPTIONS =

TABLES

itab = itab

  • 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.

CALL FUNCTION 'SSF_CLOSE'.

Kindly reward points if it helps.

Read only

Former Member
0 Likes
952

Hi Jayanthi:

Thanks for the response.But I still didn't get the way. Actually I want to generate multiple pages in smartforms.Each opage will be related to different vendor.For this what steps should I take?in the driver program & in smartforms?please guide step by step. I'll really be thankful.

Read only

0 Likes
952

Hi,

Hope you cehcked the link I had give.In that I had explained clearly how to pass the select-options as table input to smartform.

So you need to pass the select-options to smartform as explained.

Another way is in your driver program, you can have select statement to get the vendor details in an internal table.Once the internal table is populated with data,export the data to smartform using tables parametrs.Here the table structure should be available globally.

FOrm Interfaces->Tables

itab like structure_name

Then inside smartform,use tables to loop the internal table data and print the text elements.

Check this link.Here I am expalining more about table concept.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501...

Read only

Former Member
0 Likes
952

Hi Jayanthi:

Kindly give me any no. on which I can talk to u.....

Read only

Former Member
0 Likes
952

Hi

In the print program, call the smartform FM in a loop for different vendors. Pass all the variable attributes i.e. Address of the vendor and the list items.

You need to set the control parameters for the smartform so that the Print preview dialog box does not appear.

In CONTROL_PARAMETERS, set NO_DIALOG = 'X'.

A different page will be created of each vendor in the same spool request as this is the only SF called in the loop.

Regards

Navneet

Read only

0 Likes
952

Hi

Logic:

DATA : form_name TYPE rs38l_fnam,

DATA: control TYPE ssfctrlop,

control_parameters TYPE ssfctrlop,

output_options type SSFCOMPOP.

control-no_dialog = 'X'.

control-device = 'PRINTER'.

output_options-tddest = 'LOCL'.

loop at it_vendor.

CALL FUNCTION form_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = control

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = output_options

USER_SETTINGS = ' '

  • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO = w_return

    • JOB_OUTPUT_OPTIONS =

TABLES

VENDOR_DETAILS = it_vendor

ITEM_LIST = it_item_list

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

endloop.

Regards

Navneet

Read only

0 Likes
952

Hi Navneet:

I tried but it didn't work..plz give me the steps of smartforms & complete coding..if possible....

Read only

Former Member
0 Likes
952

Hi Navneet ..thanks for the help..