Search on this Website

Saturday, December 25, 2010

Displaying Multiple Smartforms-Abap code

In so many organizations where the management needs to appoint the new employees to their management with the help of the system. The way to appoint the employees are done by giving the Appointment Letters to their employees and all these letters are generated in SAP through the Transaction Code - SMARTFORMS and here is the solution of HOW to generate multiple letters through Smartforms?


Call Function Required:-

1.) SSF_OPEN
2.) SSF_CLOSE



SSF_OPEN :- This call function is required to open all the Smartforms simultaneously without having Print preview navigation Window. It has few importing and exporting parameters that you have to defined as per your requirement. Below is the example code for that call function.

***********************************************************************
* Data Declaration * ***********************************************************************

DATA : control_parameters TYPE ssfctrlop,
wa_job_output_info TYPE ssfcrescl.

***********************************************************************
* Call FM SSF_OPEN to Open all the letters * ***********************************************************************

CALL FUNCTION 'SSF_OPEN'
EXPORTING
* ARCHIVE_PARAMETERS =
* USER_SETTINGS = 'X'
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJ =
* OUTPUT_OPTIONS =
control_parameters = control_parameters
* IMPORTING
* 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.


control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.




SSF_CLOSE :- Using this call function you can close all the smartforms simultaneously. This call function is written when you have to close all the smartforms after having all the


***********************************************************************
* Call FM SSF_CLOSE to Close all the letters *
***********************************************************************

CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = wa_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.

IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Here "wa_job_output_info" is one of the kinds of control parameter defined in the call function.


 In order to display all the Smartforms in .PDF format you can use the call function SSFCOMP_PDF_PREVIEW. It takes the input at importing parameter as OTF type string.

No comments: