cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform Printing

Former Member
0 Kudos

Hi All,

I have created a remuneration statement for use via ESS. I need to define the printer used in the smartform itself.

I have tried setting TDDEST as 'LOCL' though can't seem to get this working.

Any help please.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

This is the coding used to make the smartform output without print dialog.As you told,tddest ='LOCL', But check all other required parameters are also passed.

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

Former Member
0 Kudos

Thank you Jayanthi,

I am getting the below -

Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_PARAM_MISSING',

was neither

caught nor passed along using a RAISING clause, in the procedure "%GLOBAL_INIT"

"(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

When calling the function module "/1BCDWB/SF00000030", one of the parameters

needed according to the interface description was not specified.

This parameter was "HRDATA".

=====+=

560 DATA: control TYPE ssfctrlop,

561 control_parameters TYPE ssfctrlop,

562 output_options type SSFCOMPOP.

563 control-preview = 'X'.

564 control-no_open = 'X'.

565 control-no_close = 'X'.

566 control-no_dialog = 'X'.

567 control-device = 'PRINTER'.

568 output_options-tddest = 'LOCL'.

569 OUTPUT_OPTIONS-TDNOPRINT = 'X'.

570 OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

571 CALL FUNCTION 'SSF_OPEN'

572 EXPORTING

573 USER_SETTINGS = ' '

574 OUTPUT_OPTIONS = output_options

575 CONTROL_PARAMETERS = control

576 EXCEPTIONS

577 FORMATTING_ERROR = 1

578 INTERNAL_ERROR = 2

579 SEND_ERROR = 3

580 USER_CANCELED = 4

581 OTHERS = 5

582 .

583 IF sy-subrc <> 0.

584 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

585 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

586 ENDIF.

587 output_options-tddest = 'LOCL'.

588 OUTPUT_OPTIONS-TDNOPRINT = 'X'.

589 OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.

>>>> CALL FUNCTION '/1BCDWB/SF00000030'

591 EXPORTING

592 * ARCHIVE_INDEX =

593 * ARCHIVE_INDEX_TAB =

594 * ARCHIVE_PARAMETERS =

595 CONTROL_PARAMETERS = control

596 * MAIL_APPL_OBJ =

597 * MAIL_RECIPIENT =

598 * MAIL_SENDER =

599 OUTPUT_OPTIONS = output_options

600 USER_SETTINGS = ' '

601 * IMPORTING

602 ** DOCUMENT_OUTPUT_INFO =

603 * JOB_OUTPUT_INFO = w_return

604 ** JOB_OUTPUT_OPTIONS =

605 TABLES

606 itab = itab

607 * EXCEPTIONS

608 * FORMATTING_ERROR = 1

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

The code which I sent is for passing a table from program to smartform.You need to modify the function module '/1BCDWB/SF00000066'.You need to copy paste the generated function module in pattern of the ABAP editor.Then you will get all the related parameters.You need to pass the respective values for your smartform.

Former Member
0 Kudos

sorry,

I am putting the code in the initialization tab of the global definitions and if I use the code above I get -

The function module "/1BCDWB/SF00000066" was called, but cannot be

found in the Function Library.

Former Member
0 Kudos

Hi,

I think the FM generated is for some other report not for your requirement.

Please recall the same and use it

Regards

Shiva

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Once you activated the smartform, you can execute the smartform.At that time, you will be in the SE37 tcode screen. In that you will get the name of Fucntion module as '/...' something like that.You need to use that in your program.

Otherwise, simply use the SSF_FUNCTION_MODULE_NAME as suggested in this link and then pass the necessary parameters for your program.You should 'call function fm_name...

according to your smartform.In this link,they are passing one parameter g_salary and one table it_flttab to smartform.

http://www.sap-img.com/smartforms/a-sample-program-calling-smartform.htm

Message was edited by:

Jayanthi Jayaraman

Former Member
0 Kudos

Thanks for your patience with me.

The function module generated is /1BCDWB/SF00000030 as I put in earlier.

The code I have been using is

DATA: ctrl_param TYPE ssfctrlop,

out_option TYPE ssfcompop,

fm_name TYPE rs38l_fnam.

ctrl_param-preview = 'X'.

out_option-tddest = 'LOCL'.

ctrl_param-no_dialog = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZPYXXFO_ZCRS_PAYSLIP'

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

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 fm_name

EXPORTING

control_parameters = ctrl_param

output_options = out_option

user_settings = space

  • TABLES

  • itab = itab[]

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'SSF_CLOSE'.

however am getting -

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_PARAM_MISSING',

was neither

caught nor passed along using a RAISING clause, in the procedure "%GLOBAL_INIT"

"(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

When calling the function module "/1BCDWB/SF00000030", one of the parameters

needed according to the interface description was not specified.

This parameter was "HRDATA".

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

It looks from your code you are not passing any data to Smartform.But the error seems to happen in form interface->Import parameters or in Form Interface->Table, there is one called HRDATA. SO go to tcode Smartforms and check your Smartform.If it is there,you need to code accordingly. Suppose hrdata is the table used, then you need to pass

tables itab = 'HRDATA' something like that.

Message was edited by:

Jayanthi Jayaraman

Former Member
0 Kudos

yes I have HRDATA TYPE /1PYXXFO/ZCRS_PAYSLIP in form interface->Import parameters . This is a structure not a table.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Then you need to pass it in that function module as a table in program.

Check my code tutorial.I am explaining basic steps of passing data to Smartforms.

https://wiki.sdn.sap.com/wiki/display/Snippets/Smartform-Howtoavoidthedialog+box

Former Member
0 Kudos

Hi Jayanthi,

Thank you for all your help with this one though unfortunately it is something I cannot get to work.

Former Member
0 Kudos

I've modified the standard SAP class which controls running of HR Forms so that it is possible to override the default SAP output device by placing an entry in custom table ZHRPRGDFLT using transaction SM31.

Details of the entry in ZHRPRGDFLT (all in upper case) are:

PROGNAME = CL_HRFORM_HRF02 (upper case)

DATA_KEY = TDDEST

DATA_VALUE = LOCL

class = CL_HRFORM_HRF02, method = INIT_SMARTFORM_PARAMETERS

Former Member
0 Kudos

Hello,

as you said i can see the print preview for a range of documents without the dialog

box being pop up again n again,

but i am not able to take the print of the preview now

and also no spool request is generated

i am giving NEW SPOOL REQUEST option in the OUTPUT OPTIONS, but

still it is not coming in the spool SP01

also when i am tryin to directly print from the preview,

it is showing the error

Error in spool C call: spool overflow

the scenario is for a range of document printing i am looping the SMARTFORM function and for the printer request not to pop up many times i am using ur code.

everything is fine till the preview, but printing is the problem.

please help

i want a spool request to be generated

Answers (0)