Application Development 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: 

Smartfrom printing

Former Member
0 Kudos

Hi,

I have designed one smart form. I am giving printer name on the selection screen based on printer name I need to print that layout directly with out any pop up I mean If I press execute button after giving the printer name on the selection screen I want print directly at the specified printer. For this which parameters I need to pass to smart form function module already I am using control_options and output_parameters but print is not coming if possible please send me the sample code for this. Please help me . I will give points.

Thanks.

4 REPLIES 4

Former Member
0 Kudos

Hi,

DATA: cparam type SSFCTRLOP,

outop type ssfcompop,

PER1 TYPE KONV-KBETR.

outop-tddest = 'LOCL'.

*outop-TDIMMED = 'X'.

*outop-TDNEWID = 'X'.

*outop-TDFINAL = 'X'.

*CPARAM-PREVIEW = 'X'.

*CPARAM-NO_DIALOG = 'X'.

U try to put copy and paste inu r print programe.

u remove and one by one comment and u will observe different things.

Assign points if useful.

former_member223537
Active Contributor
0 Kudos


Data : l_output type SSFCOMPOP.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZEKKO_EKPO'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
*  IMPORTING
*   FM_NAME                  = lv_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.


l_output-TDDEST = 'LOCL' . " Pass the 4 digiti output device type here, You can get it from SPAD=>Output devices
l_output-TDIMMED = 'X'.

CALL FUNCTION   '/1BCDWB/SF00000165'
  EXPORTING
*   ARCHIVE_INDEX              = ARCHIVE_INDEX
*   ARCHIVE_INDEX_TAB          = ARCHIVE_INDEX_TAB
*   ARCHIVE_PARAMETERS         = ARCHIVE_PARAMETERS
*   CONTROL_PARAMETERS         = CONTROL_PARAMETERS
*   MAIL_APPL_OBJ              = MAIL_APPL_OBJ
*   MAIL_RECIPIENT             = MAIL_RECIPIENT
*   MAIL_SENDER                = MAIL_SENDER
*   OUTPUT_OPTIONS             = OUTPUT_OPTIONS
*   USER_SETTINGS              = 'X'
    company_code               = company_code
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
*   JOB_OUTPUT_INFO            = JOB_OUTPUT_INFO
*   JOB_OUTPUT_OPTIONS         = JOB_OUTPUT_OPTIONS
* 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.

Former Member
0 Kudos

hi,

to suppress the pop up window u can do it many ways as

data: st_output_options TYPE ssfcompop,

st_control_parameters TYPE ssfctrlop,

v_language TYPE sflangu VALUE 'E',

v_e_devtype TYPE rspoptype.

DATA: funname TYPE rs38l_fnam.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

i_language = v_language

i_application = 'SAPDEFAULT'

IMPORTING

e_devtype = v_e_devtype.

st_control_parameters-no_dialog = 'X'.

st_control_parameters-getotf = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' " for GETTING NAME OF SMART FROM YJJ_SMARTFORM

EXPORTING

formname = 'YJJ_SMARTFORM'

IMPORTING

fm_name = funname. // VARIABLE WHICH CONTAINS THE NAME OF FM OF SMARTFORM

CALL FUNCTION funname " CALLING THE SMART FORM

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = st_control_parameters

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = st_output_options

  • USER_SETTINGS = 'X'

controlno = it_itab-controlno

pernr = it_itab-pernr

sname = it_itab-sname

stat = it_itab-stat

  • KOSTL =

werks = it_itab-werks

date = p_date

IMPORTING

  • document_output_info = st_document_output_info

job_output_info = tab_otf_data

  • job_output_options = st_job_output_options

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.

IF HELPFUL REWARD SOME POINTS.

WITH REGARDS,

SURESH ALURI.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Try this code.

DATA: gt_control TYPE ssfctrlop,

gt_output TYPE ssfcompop,

gs_input TYPE ssfcompin,

gv_func_name type RS38L_FNAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZZZ_TEST1'

IMPORTING

fm_name = gv_func_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

gt_output-tdnewid = 'X'.

gt_output-tddest = 'LP01'.

gt_output-TDNOPRINT = ' '.

gt_control-preview = 'X'.

gt_control-no_dialog = 'X'.

CALL FUNCTION gv_func_name

EXPORTING

control_parameters = gt_control

output_options = gt_output

user_settings = space

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

WRITE: 'Sy-subrc:',sy-subrc,

'Error occurred while calling smart form FM!'.

ENDIF.