For form entry to set the print parameters u have to call one perform befor calling the smartform.
PERFORM set_print_param USING lds_addr_key
CHANGING lds_control_param
lds_composer_param
lds_recipient
lds_sender
prf_return_code.
**................. To call the smart form......................*
CALL FUNCTION gdf_mod_name
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = lds_control_param
* MAIL_APPL_OBJ =
mail_recipient = lds_recipient
mail_sender = lds_sender
output_options = lds_composer_param
user_settings = lcf_blank
gds_header = gds_header
gdf_ship_adrnr = gdf_ship_adrnr
gdf_plant_adrnr = gdf_plant_adrnr
gdf_pstyv = gdf_pstyv
gdf_plantname = gdf_plantname
gdf_vbeln = gdf_ekkn_vbeln
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
gdt_item = gdt_item
* 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.
*****************************************************************
FORM set_print_param USING prs_addr_key TYPE addr_key
CHANGING prs_control_param TYPE ssfctrlop
prs_composer_param TYPE ssfcompop
prs_recipient TYPE swotobjid
prs_sender TYPE swotobjid
prf_return TYPE sy-subrc.
*Local Declarations.
DATA: lds_itcpo TYPE itcpo.
DATA: ldf_repid TYPE sy-repid.
DATA: ldf_device TYPE tddevice.
*Program Name
ldf_repid = sy-repid.
*Local Constants.
CONSTANTS: lcf_x(1) VALUE 'X'.
*Smartform Conditions.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
pi_nast = nast
pi_addr_key = prs_addr_key
* PI_COUNTRY =
pi_repid = ldf_repid
* PI_SCREEN = ' '
IMPORTING
pe_returncode = prf_return
pe_itcpo = lds_itcpo
pe_device = ldf_device
pe_recipient = prs_recipient
pe_sender = prs_sender .
IF prf_return = 0.
*Setting up the Display of Smartform.
MOVE-CORRESPONDING lds_itcpo TO prs_composer_param.
prs_control_param-device = ldf_device.
prs_control_param-no_dialog = lcf_x.
prs_control_param-preview = gdf_xscreen.
prs_control_param-getotf = lds_itcpo-tdgetotf.
prs_control_param-langu = nast-spras.
ENDIF.
ENDFORM. " SET_PRINT_PARAM
PERFORM set_print_param USING lds_addr_key
CHANGING lds_control_param
lds_composer_param
lds_recipient
lds_sender
prf_return_code.
**................. To call the smart form......................*
CALL FUNCTION gdf_mod_name
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = lds_control_param
* MAIL_APPL_OBJ =
mail_recipient = lds_recipient
mail_sender = lds_sender
output_options = lds_composer_param
user_settings = lcf_blank
gds_header = gds_header
gdf_ship_adrnr = gdf_ship_adrnr
gdf_plant_adrnr = gdf_plant_adrnr
gdf_pstyv = gdf_pstyv
gdf_plantname = gdf_plantname
gdf_vbeln = gdf_ekkn_vbeln
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
TABLES
gdt_item = gdt_item
* 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.
*****************************************************************
FORM set_print_param USING prs_addr_key TYPE addr_key
CHANGING prs_control_param TYPE ssfctrlop
prs_composer_param TYPE ssfcompop
prs_recipient TYPE swotobjid
prs_sender TYPE swotobjid
prf_return TYPE sy-subrc.
*Local Declarations.
DATA: lds_itcpo TYPE itcpo.
DATA: ldf_repid TYPE sy-repid.
DATA: ldf_device TYPE tddevice.
*Program Name
ldf_repid = sy-repid.
*Local Constants.
CONSTANTS: lcf_x(1) VALUE 'X'.
*Smartform Conditions.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
pi_nast = nast
pi_addr_key = prs_addr_key
* PI_COUNTRY =
pi_repid = ldf_repid
* PI_SCREEN = ' '
IMPORTING
pe_returncode = prf_return
pe_itcpo = lds_itcpo
pe_device = ldf_device
pe_recipient = prs_recipient
pe_sender = prs_sender .
IF prf_return = 0.
*Setting up the Display of Smartform.
MOVE-CORRESPONDING lds_itcpo TO prs_composer_param.
prs_control_param-device = ldf_device.
prs_control_param-no_dialog = lcf_x.
prs_control_param-preview = gdf_xscreen.
prs_control_param-getotf = lds_itcpo-tdgetotf.
prs_control_param-langu = nast-spras.
ENDIF.
ENDFORM. " SET_PRINT_PARAM
No comments:
Post a Comment