在同一个SMARTFOMR中,想实现前几页是竖向打印的,而后几页变为横向打印的,觉得这个需求有点不切实际
老大说这样的打印好像只有Mircosoft Word能够实现,我觉得这也有点不可能。如果你有好的方法能够实现在同一个SMARTFORM中实现打印方向的改变,请你与我联系,我将非常感谢。
当然,需求是不能不实现的,毕竟俺是拿着工资上着班的,所以没办法,简便的方法做不出来,只能用笨方法做了,一个SMARTFORM完成不了的工作,我把他分配给两个,这样实现起来虽然麻烦点,但终归是把这个需求解决了,还是挺高兴的。
具体实现方法就不详细说了,其实很简单,和上一篇循环打印的原理差不多,只是把一个SMARTFORM的循环打印变成了控制两个SMARTFORM同时打印而已。贴段代码出来,大家一看就明白了。希望哪位遇到这样的需求了能够对你有所帮助。
当然,如果你有更好的方法,请与我联系。谢谢。
*要竖打的内表数据 ---竖打FORM调用
CONCATENATE sy-uname sy-uzeit+4(2) INTO mid.
EXPORT table = itab TO DATABASE indx(hk) ID mid.
CONDENSE mid NO-GAPS.
DATA fm_name TYPE tdsfname.
DATA: ls_control_param TYPE ssfctrlop .
DATA: ls_composer_param TYPE ssfcompop .
DATA: outopt TYPE ssfcresop.
DATA: i_job_output_info TYPE ssfcrescl.
ls_control_param-langu = '1'.
ls_control_param-no_open = 'X'.
ls_control_param-no_close = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
IMPORTING
job_output_options = outopt
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.
EXIT.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_CUSTOMER_BILL'
variant = ' '
direct_call = ' '
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 = ls_control_param
output_options = ls_composer_param
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.
DELETE FROM DATABASE indx(hk) ID mid.
**要横打的内表数据 ---横打FORM调用
IF jtab IS NOT INITIAL.
CLEAR fm_name.
CLEAR mid.
CONCATENATE sy-uname sy-uzeit+4(2) INTO mid.
*将内表数据存入ABAP内存
EXPORT table = jtab TO DATABASE indx(hk) ID mid.
CONDENSE mid NO-GAPS.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_CUSTOMER_BILL_ADD'
variant = ' '
direct_call = ' '
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 = ls_control_param
output_options = ls_composer_param
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.
DELETE FROM DATABASE indx(hk) ID mid.
ENDIF.
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = i_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.