- Include text
Populate indicator in program
perform get_text using '0002' ls_detail-vbeln"Header note 1 2019.04.15
changing ls_header-header_note.
set indicatorin Conditions as "GS_HEADER-HEADER_NOTE <> ''",display the long text only when the it is not null
或打上“No error if no text exists”
- Error Handling
call function wf_name
exporting
user_settings = ''
id_header = vl_buffid1
id_detail = vl_buffid2
id_detail2 = vl_buffid3
control_parameters = lwa_control
output_options = lwa_options
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
data lt_errortab type tsferror.
field-symbols: <fs_errortab> type line of tsferror.
call function 'SSF_READ_ERRORS'
importing
errortab = lt_errortab.
loop at lt_errortab assigning <fs_errortab>.
call function 'NAST_PROTOCOL_UPDATE'
exporting
msg_arbgb = <fs_errortab>-msgid
msg_nr = <fs_errortab>-msgno
msg_ty = <fs_errortab>-msgty
msg_v1 = <fs_errortab>-msgv1
msg_v2 = <fs_errortab>-msgv2
msg_v3 = <fs_errortab>-msgv3
msg_v4 = <fs_errortab>-msgv4
exceptions
others = 1.
endloop.
endif.
- control batch print
FORM _PRINT_DATA TABLES PT_DATA .
DATA:LS_ROWS TYPE LINE OF LVC_T_ROW,
LC_FMNAM TYPE RS38L_FNAM,
OUTPUT_OPTIONS TYPE SSFCOMPOP,
CONTROL_PARAMETERS TYPE SSFCTRLOP,
LS_DATA LIKE LINE OF IT_DATA.
CHECK PT_DATA[] IS NOT INITIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'XXXXXX'
IMPORTING
FM_NAME = LC_FMNAM
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
CONTROL_PARAMETERS-NO_DIALOG = ''.
CONTROL_PARAMETERS-PREVIEW = ''.
CONTROL_PARAMETERS-NO_OPEN = 'X'.
CONTROL_PARAMETERS-NO_CLOSE = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
CONTROL_PARAMETERS = CONTROL_PARAMETERS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
ENDIF.
CLEAR:LS_DATA, L_WA_HEADER.
REFRESH:L_IT_DETAIL.
LOOP AT PT_DATA INTO LS_DATA.
CALL FUNCTION LC_FMNAM
EXPORTING
CONTROL_PARAMETERS = CONTROL_PARAMETERS
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = ' '
is_header = L_WA_HEADER
TABLES
t_detail = L_IT_DETAIL
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
DATA LT_ERRORTAB TYPE TSFERROR.
FIELD-SYMBOLS: <FS_ERRORTAB> TYPE LINE OF TSFERROR.
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
ERRORTAB = LT_ERRORTAB.
LOOP AT LT_ERRORTAB ASSIGNING <FS_ERRORTAB>.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
MSG_ARBGB = <FS_ERRORTAB>-MSGID
MSG_NR = <FS_ERRORTAB>-MSGNO
MSG_TY = <FS_ERRORTAB>-MSGTY
MSG_V1 = <FS_ERRORTAB>-MSGV1
MSG_V2 = <FS_ERRORTAB>-MSGV2
MSG_V3 = <FS_ERRORTAB>-MSGV3
MSG_V4 = <FS_ERRORTAB>-MSGV4
EXCEPTIONS
OTHERS = 1.
ENDLOOP.
ENDIF.
ENDLOOP.
CLEAR:LS_DATA, L_WA_HEADER.
FREE:L_IT_DETAIL.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3.
ENDFORM. " _PRING_DATA